M-HT / SR

A project to statically recompile following games to create Windows or Linux (x86 or arm) versions of the games - Albion, X-Com: UFO Defense (UFO: Enemy Unknown), X-Com: Terror from the Deep, Warcraft: Orcs & Humans, Septerra Core: Legacy of the Creator, Battle Isle 3: Shadow of the Emperor
305 stars 17 forks source link

Building Win32 under mingw32 environment #24

Closed xcom169 closed 3 years ago

xcom169 commented 3 years ago

Hello!

I'm almost done with my win32 build, but the last command gives an error. I think it can't link together the parts. Maybe with a GCC flag it can be forced to build the .exe file. Can you please take a look at my GCC work, and linking ?

MINGW32 ~/SR/games/Warcraft/SR-War $ scons version=cdgog device=pc-windows SDL2=0 scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... gcc -o audio/pc.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE audio/pc.c gcc -o display/pc.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE display/pc.c gcc -o Game_config.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE Game_config.c gcc -o Game_thread.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE Game_thread.c gcc -o input/pc.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE input/pc.c gcc -o main.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE main.c gcc -o Warcraft-in2.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE Warcraft-in2.c gcc -o Warcraft-inout.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE Warcraft-inout.c gcc -o Warcraft-int.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE Warcraft-int.c gcc -o Warcraft-int2.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE Warcraft-int2.c gcc -o Warcraft-music-midiplugin.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE Warcraft-music-midiplugin.c gcc -o Warcraft-music-midiplugin2.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE Warcraft-music-midiplugin2.c gcc -o Warcraft-music.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE Warcraft-music.c gcc -o Warcraft-out2.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE Warcraft-out2.c gcc -o Warcraft-proc-events.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE Warcraft-proc-events.c gcc -o Warcraft-proc-vfs.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE Warcraft-proc-vfs.c gcc -o Warcraft-proc.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE Warcraft-proc.c gcc -o Warcraft-sound.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE Warcraft-sound.c gcc -o Warcraft-timer.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE Warcraft-timer.c gcc -o virtualfs.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE virtualfs.c gcc -o xmi2mid.o -c -m32 -O2 -Wall -DALLOW_OPENGL -lmingw32 -fno-PIE xmi2mid.c nasm -fwin32 -Ox -w+orphan-labels -w-number-overflow -ix86/ -o x86/Game-asm.o x86/Game-asm.asm nasm -fwin32 -Ox -w+orphan-labels -w-number-overflow -ix86/ -o x86/SR-asm-calls.o x86/SR-asm-calls.asm nasm -fwin32 -Ox -w+orphan-labels -w-number-overflow -ix86/ -o x86/SR-asm.o x86/SR-asm.asm nasm -fwin32 -Ox -w+orphan-labels -w-number-overflow -ix86/ -o x86/asm_inout.o x86/asm_inout.asm nasm -fwin32 -Ox -w+orphan-labels -w-number-overflow -ix86/ -o x86/asm_int.o x86/asm_int.asm gcc -o SR-War.exe -m32 -no-pie -s Game_config.o Game_thread.o Warcraft-in2.o Warcraft-inout.o Warcraft-int.o Warcraft-int2.o Warcraft-music-midiplugin.o Warcraft-music-midiplugin2.o Warcraft-music.o Warcraft-out2.o Warcraft-proc-events.o Warcraft-proc-vfs.o Warcraft-proc.o Warcraft-sound.o Warcraft-timer.o main.o virtualfs.o xmi2mid.o display/pc.o audio/pc.o input/pc.o x86/war-asm-cdgog.o x86/Game-asm.o x86/SR-asm-calls.o x86/SR-asm.o x86/asm_inout.o x86/asm_int.o -lSDL_mixer -lSDL -lpthread -lopengl32 C:/tools/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/lib/../lib/libmingw32.a(lib32_libmingw32_a-crt0c.o): in function `main': C://M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `WinMain@16' collect2.exe: error: ld returned 1 exit status scons: *** [SR-War.exe] Error 1 scons: building terminated because of errors.

xcom169 commented 3 years ago

-lSDLmain -lmingw32 was needed. It seems to be working with it.

M-HT commented 3 years ago

I added the libraries in the latest commit.

xcom169 commented 3 years ago

Hello!

Thanks! It's also working with SDL2, however I had to change " gcc -o SR-War.exe -m32 -no-pie -s Game_config.o Game_thread.o Warcraft-in2.o Warcraft-inout.o Warcraft-int.o Warcraft-int2.o Warcraft-music-midiplugin.o Warcraft-music-midiplugin2.o Warcraft-music.o Warcraft-out2.o Warcraft-proc-events.o Warcraft-proc-vfs.o Warcraft-proc.o Warcraft-sound.o Warcraft-timer.o main.o virtualfs.o xmi2mid.o display/pc.o audio/pc.o input/pc.o x86/war-asm-cdgog.o x86/Game-asm.o x86/SR-asm-calls.o x86/SR-asm.o x86/asm_inout.o x86/asm_int.o -lSDL_mixer -lSDL -lpthread -lopengl32 "

and add -lSDL2main for the last gcc command. I dont' understand why.

After I had to copy SDL2.dll and SDL2_mixer.dll next to the exe file.

I noticed that the mouse cursor leaves some shadow on the screen. I noticed that music playing is not working from the WAR1.bin/cue. I have to mount that as D drive?

M-HT commented 3 years ago

I noticed that the mouse cursor leaves some shadow on the screen.

Is that the SDL mouse cursor ? Check option Display_MouseCursor in Warcraft.cfg.

I noticed that music playing is not working from the WAR1.bin/cue. I have to mount that as D drive?

Depending on which MIDI subsystem you choose (option Audio_MIDI_Subsystem in Warcraft.cfg) you may need to compile a midi-plugin and maybe also compile or download a midi-library. Or you can take plugins and libs from Albion release.