Compiling in Windows...

Strictly for discussing ZSNES development and for submitting code. You can also join us on IRC at irc.libera.chat in #zsnes.
Please, no requests here.

Moderator: ZSNES Mods

Post Reply
jdratlif
Regular
Posts: 317
Joined: Tue Sep 14, 2004 12:48 am
Location: In a small padded white room
Contact:

Compiling in Windows...

Post by jdratlif »

I have made a patch for zsnes which I want to test. It seems to work in Linux, but I use Windows much more often, so I want to compile it and test it myself before I submit it here for other people.

But it won't compile for some reason.

Okay, here is what I did.

a) Downloaded and Installed DirectX SDK 9.0 (Summer 2004).
b) Downloaded the source from ipherswipsite. The 0907 version. The same version I used in Linux.
c) Patched the source code (I use mingw, but for just a patch program, this shouldn't matter if it was mingw, cygwin, or win32-native). Besides, it never fails on the file I changed.
d) Installed nasm (0.98.36)

Start command prompt. make -f makefile.win

I put the DirectX 9.0 Summer 2004 headers and library in C:\MSSDK. It will either read the headers or the library file if it's in the C:\Program Files\Microsoft DirectX 9.0 SDK (Summer 2004) direcory, but not both. Couldn't figure that out. Moving on...

C:\msys\1.0\home\jdratlif\zsnes\src>make -f makefile.win
cl /Ox /G6 /c /D__WIN32__ /I"C:\MSSDK"\Include /Foversion.obj version.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

version.c
cl @link.win32 win/zsnes.res /link /libpath:"C:\MSSDK"\lib
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

cl /Fezsnesw.exe chips\dsp1proc.obj chips\dsp2proc.obj dos\sw.obj dos\gppro.obj dos\vesa12.obj dos\zsipx.obj d
os\modemrtn.obj dos\joy.obj dos\debug.obj dos\vesa2.obj dos\initvid.obj cfgload.obj endmem.obj init.obj initc.
obj uic.obj patch.obj ui.obj vcache.obj effects\water.obj effects\smoke.obj effects\burn.obj version.obj video
\procvid.obj win\copyvwin.obj win\winintrf.obj win\winlink.obj win\zloaderw.obj win\ztcp.obj win\zfilew.obj wi
n\zipxw.obj video\makev16b.obj video\makev16t.obj video\makevid.obj video\mode716.obj video\mode716b.obj video
\mode716d.obj video\mode716e.obj video\mode716t.obj video\mode7.obj video\mode7ext.obj video\mv16tms.obj video
\newg162.obj video\newgfx16.obj video\newgfx2.obj video\newgfx.obj video\m716text.obj video\2xsaiw.obj video\s
w_draw.obj video\hq2x16.obj video\hq2x32.obj video\hq3x16.obj video\hq3x32.obj video\hq4x16.obj video\hq4x32.o
bj gui\gui.obj gui\menu.obj cpu\addrni.obj cpu\dma.obj cpu\dsp.obj cpu\dspproc.obj cpu\execute.obj cpu\irq.obj
cpu\memory.obj cpu\spc700.obj cpu\stable.obj cpu\table.obj cpu\tableb.obj cpu\tablec.obj chips\dsp1emu.obj ch
ips\fxemu2.obj chips\fxemu2b.obj chips\fxemu2c.obj chips\fxtable.obj chips\sa1proc.obj chips\sa1regs.obj chips
\sfxproc.obj chips\st10proc.obj chips\seta10.obj zip\unzip.obj zip\zpng.obj zlib.lib libpng.lib wsock32.lib us
er32.lib gdi32.lib shell32.lib winmm.lib ddraw.lib dsound.lib dinput8.lib d3dx.lib /link /section:.text,erw



Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/out:zsnesw.exe
/section:.text,erw
/libpath:C:\MSSDK\lib
chips\dsp1proc.obj
chips\dsp2proc.obj
dos\sw.obj
dos\gppro.obj
dos\vesa12.obj
dos\zsipx.obj
dos\modemrtn.obj
dos\joy.obj
dos\debug.obj
dos\vesa2.obj
dos\initvid.obj
cfgload.obj
endmem.obj
init.obj
initc.obj
uic.obj
patch.obj
ui.obj
vcache.obj
effects\water.obj
effects\smoke.obj
effects\burn.obj
version.obj
video\procvid.obj
win\copyvwin.obj
win\winintrf.obj
win\winlink.obj
win\zloaderw.obj
win\ztcp.obj
win\zfilew.obj
win\zipxw.obj
video\makev16b.obj
video\makev16t.obj
video\makevid.obj
video\mode716.obj
video\mode716b.obj
video\mode716d.obj
video\mode716e.obj
video\mode716t.obj
video\mode7.obj
video\mode7ext.obj
video\mv16tms.obj
video\newg162.obj
video\newgfx16.obj
video\newgfx2.obj
video\newgfx.obj
video\m716text.obj
video\2xsaiw.obj
video\sw_draw.obj
video\hq2x16.obj
video\hq2x32.obj
video\hq3x16.obj
video\hq3x32.obj
video\hq4x16.obj
video\hq4x32.obj
gui\gui.obj
gui\menu.obj
cpu\addrni.obj
cpu\dma.obj
cpu\dsp.obj
cpu\dspproc.obj
cpu\execute.obj
cpu\irq.obj
cpu\memory.obj
cpu\spc700.obj
cpu\stable.obj
cpu\table.obj
cpu\tableb.obj
cpu\tablec.obj
chips\dsp1emu.obj
chips\fxemu2.obj
chips\fxemu2b.obj
chips\fxemu2c.obj
chips\fxtable.obj
chips\sa1proc.obj
chips\sa1regs.obj
chips\sfxproc.obj
chips\st10proc.obj
chips\seta10.obj
zip\unzip.obj
zip\zpng.obj
zlib.lib
libpng.lib
wsock32.lib
user32.lib
gdi32.lib
shell32.lib
winmm.lib
ddraw.lib
dsound.lib
dinput8.lib
d3dx.lib
win/zsnes.res
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _ftell already defined in LIBC.lib(ftell.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _fprintf already defined in LIBC.lib(fprintf.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _fopen already defined in LIBC.lib(fopen.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _malloc already defined in LIBC.lib(malloc.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _sprintf already defined in LIBC.lib(sprintf.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _fwrite already defined in LIBC.lib(fwrite.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _fread already defined in LIBC.lib(fread.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _fclose already defined in LIBC.lib(fclose.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _free already defined in LIBC.lib(free.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _fflush already defined in LIBC.lib(fflush.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _fseek already defined in LIBC.lib(fseek.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _gmtime already defined in LIBC.lib(gmtime.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _strncpy already defined in LIBC.lib(strncpy.obj)
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "MSVCRTD" conflicts with use of other libs; use /NODEFAULTLIB:library
zsnesw.exe : fatal error LNK1169: one or more multiply defined symbols found
del version.obj

-------------------------------------------

There is no combination of /NODFEAULTLIB with LIBC, MSVCRT, and MSVCRTD I haven't tried. None of them work. If you take one away, both copies of the symbol go with it.

The latest DirectX headers don't compile with it. So I had to get a DX8 copy of dsound.c. I don't think that is affecting things, but I thought I should mention it. It had compile errors if you use the (Summer 2004) version of dsound.c.

I have also tried compiling it from withing Visual Studio (nasm fails on init.asm for some weird reason ".\init.asm:3122: error: short jump is out of range") So I copied the object files from the compilation (with MSVC) into the Release folder. Then it gave me linking errors (too many to list)

I tried compiling on mingw. nasm thought it didn't specify an input file. That didn't make sense either, but I've tried everything that came to mind.

I don't know what's wrong. Is there something I'm missing?

I installed zlib, libpng, gmake, and the dx sdk. It compiles, but it won't link.

I really want to test my patch before I send it out publicly.

Thanks in advance...
http://jdrrant.blogspot.com/ - CODEpendent Blog
http://games.technoplaza.net/ - Emulation Goodies
jdratlif
Regular
Posts: 317
Joined: Tue Sep 14, 2004 12:48 am
Location: In a small padded white room
Contact:

ow the pain...

Post by jdratlif »

Well, thanks to pagefault, Nach, and ipher, I have a compiled version.

I don't know what I did wrong, only that it's something in the zlib or libpng libraries I built.

But who cares about that. I made an incredibly useful patch. It changes the game clock in the options menu from 24 hour to 12 hour time with AM and PM markers. Nifty, eh?

Yeah, I know. But we all gotta start somewhere...

Here is the diff for version 0907. It will almost certainly work in version 0920, but I haven't tested it yet.

(edit: I removed the old version)

Since it took me 11 million hours to compile on windows, I also made a windows binary, but you can compile with that patch if you know how and have the tools...

(edit: I removed the old version)
Last edited by jdratlif on Tue Sep 21, 2004 5:05 pm, edited 1 time in total.
http://jdrrant.blogspot.com/ - CODEpendent Blog
http://games.technoplaza.net/ - Emulation Goodies
jdratlif
Regular
Posts: 317
Joined: Tue Sep 14, 2004 12:48 am
Location: In a small padded white room
Contact:

bug fix...

Post by jdratlif »

Well, it's a good thing I thought to test thoroughly before posting that patch. oh wait, I didn't do that...

Not a big deal, but midnight was still showing up as the 0 hour.

I've tested all the time settings now and they all seem to work. But I haven't tested it thoroughly enough to be sure there are no problems. But now that I have a working Windows version, I will start that.

I don't have any 8 bit video (non transparency modes) to test. So I have never seen if the 8bit code I made works at all. It should, but I just have no way to test this. It would be nice if someone who could test this would and let me know if it blows up.

Here's the new patch. It's released against the 0920 version of the source, but I didn't have to change the original patch to get it to work on the 0920 version rather than the 0907 version, so Nach must not have changed the src/video/procvid.asm file in any way that conflicted with my patch. Yeah, I ramble...

The diff file
http://games.technoplaza.net/zsnes/zsne ... k.diff.bz2

The windows binary
http://games.technoplaza.net/zsnes/zsne ... -clock.zip

The linux SDL binary (I guess you'd probably compile your own but for whatever reason...compiled under gentoo with SDL 1.2.7)
http://games.technoplaza.net/zsnes/zsne ... -clock.bz2
http://jdrrant.blogspot.com/ - CODEpendent Blog
http://games.technoplaza.net/ - Emulation Goodies
Noxious Ninja
Dark Wind
Posts: 1271
Joined: Thu Jul 29, 2004 8:58 pm
Location: Texas
Contact:

Re: ow the pain...

Post by Noxious Ninja »

jdratlif wrote:But who cares about that. I made an incredibly useful patch. It changes the game clock in the options menu from 24 hour to 12 hour time with AM and PM markers. Nifty, eh?
But some of us actually like 24-hour time. :cry:
[u][url=http://bash.org/?577451]#577451[/url][/u]
Clements
Randomness
Posts: 1172
Joined: Wed Jul 28, 2004 4:01 pm
Location: UK
Contact:

Post by Clements »

I much prefer 12-Hour since besides train/bus timetables we do not use the 24-Hour clock in this country, thus I am not as used to it. I have to subtract 12 from the time if it goes passed 12 to know what the time is. :lol:

Anywoo, you'll probably have to find some way for the user to decide which clock format they want.
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

Clements wrote:Anywoo, you'll probably have to find some way for the user to decide which clock format they want.
Which means new checkbox somewhere in the GUI and thus a big pain in the ass to extend window size and add the interactive box.
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
jdratlif
Regular
Posts: 317
Joined: Tue Sep 14, 2004 12:48 am
Location: In a small padded white room
Contact:

Re: ow the pain...

Post by jdratlif »

Noxious Ninja wrote:
jdratlif wrote:But who cares about that. I made an incredibly useful patch. It changes the game clock in the options menu from 24 hour to 12 hour time with AM and PM markers. Nifty, eh?
But some of us actually like 24-hour time. :cry:
Yeah, I realize that. But I always wanted it.

I thought about making it a menu option, but at the time I was worried it would mean altering the config file which would screw up all the old config files people use, which I was against. But I think I have a solution to that now, so I might look into it.
http://jdrrant.blogspot.com/ - CODEpendent Blog
http://games.technoplaza.net/ - Emulation Goodies
jdratlif
Regular
Posts: 317
Joined: Tue Sep 14, 2004 12:48 am
Location: In a small padded white room
Contact:

Compile Problems Solved, and now I know why...

Post by jdratlif »

I finally found out what the problem was.

pagefault suggested I recompile my zlib and libpng libraries. But that didn't make sense at the time because I just compiled them.

The problem: Windows stupid lying pos documentation.

The /MD flag does not necessarily link only with the MSVCRT library, it might also choose to bring in libc.lib. The help doesn't say that (or maybe it does somewhere, but not on the command prompt help).

Anyway, if you want to compile in Windows using VC (version 6 or later), you need to edit the nmakefiles for libpng and zlib.

Remove the -MD flag from the CFLAGS. The zlib win32 makefile is in win32\Makefile.msc. The libpng makefile is scripts\makefile.vcawin32 (or makefile.vcwin32, but I used the assembly one cause it seemed like a good idea).

After you do, the libraries are correct and everything is wonderful.
http://jdrrant.blogspot.com/ - CODEpendent Blog
http://games.technoplaza.net/ - Emulation Goodies
Cecil
Paladin
Posts: 75
Joined: Fri Jul 30, 2004 2:25 am

Re: ow the pain...

Post by Cecil »

jdratlif wrote:
Noxious Ninja wrote:
jdratlif wrote:But who cares about that. I made an incredibly useful patch. It changes the game clock in the options menu from 24 hour to 12 hour time with AM and PM markers. Nifty, eh?
But some of us actually like 24-hour time. :cry:
Yeah, I realize that. But I always wanted it.

I thought about making it a menu option, but at the time I was worried it would mean altering the config file which would screw up all the old config files people use, which I was against. But I think I have a solution to that now, so I might look into it.
Uh, I think every time a new WIP is released we have to delete the config files anyway when we download it. At least, that's what I've heard.
System Specs:

2.2GHz Athlon64 X2 4400+, 2GB DDR 400 SDRAM
EVGA Geforce 7600GT 256MB
Realtek AC '97
Microsoft Windows Vista Home Premium
jdratlif
Regular
Posts: 317
Joined: Tue Sep 14, 2004 12:48 am
Location: In a small padded white room
Contact:

Re: ow the pain...

Post by jdratlif »

Cecil wrote:Uh, I think every time a new WIP is released we have to delete the config files anyway when we download it. At least, that's what I've heard.
That's not an absolute. If none of the config options were changed, the file wouldn't change, hence there would be no need to change the config file.

For example, I used my 0907 config file with 0920.

However, it is probably best to delete your config file just in case the format did change. It's just not an absolute that you will need to.
http://jdrrant.blogspot.com/ - CODEpendent Blog
http://games.technoplaza.net/ - Emulation Goodies
ipher
ZSNES Developer
ZSNES Developer
Posts: 269
Joined: Wed Jul 28, 2004 2:37 am
Contact:

Post by ipher »

You don't need to delete your config files every time you update to another WIP... i don't know about you, but i hate redoing all of my settings every time i get another version. But if you run into some wierd bugs, the first thing you should do to try to solve it is delete the files, just in case.
[url=http://www.ipherswipsite.com]ipher's WIP Site[/url]
Post Reply