konovalov-aleks / reSL

The reversed source code for ShortLine v1.1 game
https://konovalov-aleks.github.io/
GNU General Public License v3.0
13 stars 1 forks source link

Crash with uninitialized mouse mode pointer on Windows (and probably GNU/Linux) #4

Closed retifrav closed 2 weeks ago

retifrav commented 2 weeks ago

I've built the game on Windows, and it built fine, but it crashes on launch:

> resl.exe
Renderer: direct3d
Supported pixel formats:
        SDL_PIXELFORMAT_ARGB8888
        SDL_PIXELFORMAT_YV12
        SDL_PIXELFORMAT_IYUV
Pixel format: SDL_PIXELFORMAT_ARGB8888

> echo %errorlevel%
-1073741819

Debugger says the following:

A breakpoint instruction (__debugbreak() statement or a similar call) was executed in resl.exe.

ucrtbased.dll!00007fffeebe2fb5()
ucrtbased.dll!00007fffeebe3153()
ucrtbased.dll!00007fffeebfae2d()
ucrtbased.dll!00007fffeec01345()
ucrtbased.dll!00007fffeec00bd7()
ucrtbased.dll!00007fffeebfebc8()
ucrtbased.dll!00007fffeec018af()
resl.exe!resl::taskMouseEventHandling() Line 81
    at reSL\src\game\mouse\mouse.cpp(81)

and that line is:

assert(mouse::g_state.mode);

So it looks like the problem is that this pointer is not initialized. I am unfortunately a bit stupid when it comes to C++ and pointers, so I couldn't figure out how to fix it.

I have also tried it on GNU/Linux, and there it crashes on launch too, probably for the same reason (although I haven't attached a debugger to verify that).

Finally, I've tried to build and run it on Mac OS, and there the game launched just fine, no crash.

konovalov-aleks commented 2 weeks ago

Hello! Thank you for report!

The crash was already fixed several days ago: https://github.com/konovalov-aleks/reSL/pull/2

Please, try to update the source and build again

retifrav commented 2 weeks ago

You are right, I was on a bit older commit, I should've specified that. Yes, with the latest sources it doesn't crash anymore, thank you!

Also tested it properly on GNU/Linux (Steam Deck, in fact), and it actually works fine there too (the original problem turned out to be unrelated):

resl-steam-deck