Interrupt / systemshock

Shockolate - A minimalist and cross platform System Shock source port.
GNU General Public License v3.0
812 stars 65 forks source link

Launching systemshock built with mingw fails #128

Open janisozaur opened 6 years ago

janisozaur commented 6 years ago

I tried building systemshock with mingw toolchain (based on GCC 7.2.1) and it was successful.

Trying to launch the produced binary, however, fails, at least when used with wine. Here's the error report including stack trace, on 0b8006a

Register dump:
 CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
 EIP:0044fda7 ESP:00c7fa28 EBP:00c7fa50 EFLAGS:00010246(  R- --  I  Z- -P- )
 EAX:00000000 EBX:002461d0 ECX:00000000 EDX:00000000
 ESI:002461b8 EDI:00000001
Stack dump:
0x00c7fa28:  02680000 00440000 00c7fa50 004132d4
0x00c7fa38:  00000010 00000000 02680000 00000000
0x00c7fa48:  00000040 00000000 00c7fd80 00412761
0x00c7fa58:  00000001 0051e88f 00000146 0051e8dc
0x00c7fa68:  00c7fa90 7e9c1000 002461b8 00000001
0x00c7fa78:  00c7faa8 7e95403a 0014f4d8 00402161
Backtrace:
=>0 0x0044fda7 init_popups+0x2e() [/home/janisozaur/workspace/systemshock/src/GameSrc/popups.c:62] in systemshock (0x00c7fa50)
  1 0x00412761 init_all+0x193() [/home/janisozaur/workspace/systemshock/src/GameSrc/init.c:327] in systemshock (0x00c7fd80)
  2 0x00401cd1 SDL_main+0x43(argc=0x1, argv=0x2461b8) [/home/janisozaur/workspace/systemshock/src/MacSrc/Shock.c:139] in systemshock (0x00c7fda0)
  3 0x0050fda4 in systemshock (+0x10fda3) (0x00c7fde8)
  4 0x004013eb in systemshock (+0x13ea) (0x00c7fec0)
  5 0x7b4638e2 call_process_entry+0x11() in kernel32 (0x00c7fed8)
  6 0x7b46520c in kernel32 (+0x4520b) (0x00c7ffd8)
  7 0x7b4638ee call_process_entry+0x1d() in kernel32 (0x00c7ffec)
0x0044fda7 init_popups+0x2e [/home/janisozaur/workspace/systemshock/src/GameSrc/popups.c:62] in systemshock: movl   0x14(%eax),%edx
62          popup_rects[i] = f->anchorArea;
Modules:
Module  Address         Debug info  Name (56 modules)
PE    400000-  a7a000   Dwarf           systemshock
PE  64b40000-64b54000   Deferred        libwinpthread-1
PE  67a80000-67aa3000   Deferred        sdl2_mixer
PE  6c940000-6ca0b000   Deferred        sdl2
PE  6d0c0000-6d0de000   Deferred        libgcc_s_sjlj-1
PE  6fe40000-6ff7f000   Deferred        libstdc++-6
ELF 7b400000-7b7ee000   Dwarf           kernel32<elf>
  \-PE  7b420000-7b7ee000   \               kernel32
ELF 7bc00000-7bd01000   Deferred        ntdll<elf>
  \-PE  7bc10000-7bd01000   \               ntdll
ELF 7c000000-7c004000   Deferred        <wine-loader>
ELF 7d97d000-7d9af000   Deferred        libexpat.so.1
ELF 7d9af000-7dade000   Deferred        libglib-2.0.so.0
ELF 7db22000-7db6c000   Deferred        libfontconfig.so.1
ELF 7db6c000-7dbe4000   Deferred        libpcre.so.1
ELF 7dbe4000-7dca3000   Deferred        libharfbuzz.so.0
ELF 7dca3000-7dcbc000   Deferred        libz.so.1
ELF 7dcbc000-7dcfa000   Deferred        libpng16.so.16
ELF 7dcfa000-7ddca000   Deferred        libfreetype.so.6
ELF 7ddca000-7de38000   Deferred        libncursesw.so.6
ELF 7de96000-7dec1000   Deferred        msacm32<elf>
  \-PE  7dea0000-7dec1000   \               msacm32
ELF 7dec1000-7df7b000   Deferred        winmm<elf>
  \-PE  7ded0000-7df7b000   \               winmm
ELF 7df7b000-7dff3000   Deferred        shlwapi<elf>
  \-PE  7df90000-7dff3000   \               shlwapi
ELF 7dff3000-7e2af000   Deferred        shell32<elf>
  \-PE  7e000000-7e2af000   \               shell32
ELF 7e2af000-7e3e1000   Deferred        oleaut32<elf>
  \-PE  7e2d0000-7e3e1000   \               oleaut32
ELF 7e3e1000-7e464000   Deferred        rpcrt4<elf>
  \-PE  7e3f0000-7e464000   \               rpcrt4
ELF 7e464000-7e5c1000   Deferred        ole32<elf>
  \-PE  7e480000-7e5c1000   \               ole32
ELF 7e5c1000-7e5db000   Deferred        version<elf>
  \-PE  7e5d0000-7e5db000   \               version
ELF 7e5db000-7e7e4000   Deferred        user32<elf>
  \-PE  7e5f0000-7e7e4000   \               user32
ELF 7e7e4000-7e912000   Deferred        gdi32<elf>
  \-PE  7e7f0000-7e912000   \               gdi32
ELF 7e912000-7e9cb000   Deferred        msvcrt<elf>
  \-PE  7e930000-7e9cb000   \               msvcrt
ELF 7e9cb000-7ea46000   Deferred        advapi32<elf>
  \-PE  7e9e0000-7ea46000   \               advapi32
ELF 7eec0000-7eed5000   Deferred        libnss_files.so.2
ELF 7eed5000-7efa2000   Deferred        libm.so.6
ELF 7efa5000-7efb7000   Deferred        libbz2.so.1.0
ELF 7efb7000-7efdb000   Deferred        imm32<elf>
  \-PE  7efc0000-7efdb000   \               imm32
ELF f7b6c000-f7b72000   Deferred        libdl.so.2
ELF f7b77000-f7b80000   Deferred        libuuid.so.1
ELF f7bd0000-f7dad000   Deferred        libc.so.6
ELF f7dad000-f7dce000   Deferred        libpthread.so.0
ELF f7dce000-f7f84000   Dwarf           libwine.so.1
ELF f7f86000-f7fb0000   Deferred        ld-linux.so.2
ELF f7fb3000-f7fb4000   Deferred        [vdso].so
Threads:
process  tid      prio (all id:s are in hex)
00000008 (D) Z:\home\janisozaur\workspace\systemshock\build-mingw\systemshock.exe
    00000009    0 <==
0000000e services.exe
    0000002d    0
    00000024    0
    0000001d    0
    00000015    0
    00000014    0
    00000013    0
    00000010    0
    0000000f    0
00000011 winedevice.exe
    0000001a    0
    00000017    0
    00000016    0
    00000012    0
0000001b plugplay.exe
    0000001f    0
    0000001e    0
    0000001c    0
00000020 Updater.exe
    0000002c    0
    0000002b    0
    0000002a    0
    00000029    0
    00000026    0
    00000025    0
    00000021    0
00000027 winedevice.exe
    00000035    0
    00000030    0
    0000002f    0
    0000002e    0
    00000028    0
00000038 explorer.exe
    0000003c    0
    0000003b    0
    0000003a    0
    00000039    0
System information:
    Wine build: wine-3.13
    Platform: i386
    Version: Windows XP
    Host system: Linux
    Host version: 4.17.6-1-ARCH

Note I have not made any configuration or any other steps than building and launching the executable.

janisozaur commented 6 years ago

Offending line from the lowermost frame: https://github.com/Interrupt/systemshock/blob/0b8006ac06f1271f4238e801c09e9bfeed3693b1/src/GameSrc/popups.c#L62

inguin commented 6 years ago

Are there any error messages before the crash? The game is trying to load resources from res/data/gamescr.res at that point. Is the Linux build working with the same res directory?

inguin commented 6 years ago

OK, I see the same crash when trying to start without the res directory. Most likely you forgot to copy it.

The game should exit at the first critical error, but that code is currently commented out: https://github.com/Interrupt/systemshock/blob/1e258b57e8e37cebcc7d414b2b6611fb436bacd0/src/MacSrc/InitMac.c#L236

Interrupt commented 6 years ago

We should probably do a sanity check on startup where we look to see if the directory exists and can at least load some kind of data from it like a known string from cybstrng.res.

inguin commented 6 years ago

I think the existing message is clear enough: WARN resfile.c:145: ResOpenResFile: can't open file: res/data/cybstrng.res

The game should just exit at that point instead of continuing as if nothing had happened.