phoboslab / wipeout-rewrite

2.64k stars 212 forks source link

[Windows] No "missing SDL2.dll" error when running wipeout.exe without SDL2.dll #106

Closed Vandino86 closed 10 months ago

Vandino86 commented 10 months ago

I recently built Wipeout for Windows following the README.md tutorial. When I launched the game via the MSYS2 UCRT64 command line environment (cd wipeout-rewrite/build/; ./wipeout.exe), it ran and played fine. When I copied both wipeout.exe and the "wipeout" folder (the game data) to a dedicated directory on another drive then tried to launch the game by double-clicking wipeout.exe in Windows Explorer, I got an error dialog box saying "The code execution cannot proceed because glew32.dll was not found. Reinstalling the program may fix this problem." Searching through my MSYS2 installation directory (C:\msys64), I found glew32.dll in C:\msys64\ucrt64\bin, which I then copied to the directory on the other drive where wipeout.exe was located. Afterwards, double-clicking wipeout.exe would launch the game without error, but it had one glaring issue: Alt+Tab-ing out of the game and back in caused the whole game screen to turn back. It still responded to controls and the sound effects and music still played, as evidenced when pressing up and down on the d-pad while I was in the main menu with the black screen. I needed to shut down and start the game back up again whenever this happened. Since this issue did NOT occur when launching wipeout.exe via MSYS2 UCRT64 as mentioned previously, I thought maybe it needed another .dll despite the lack of error messages saying so. This turned out to be correct: according to Process Explorer, wipeout.exe was using C:\msys64\ucrt64\bin\SDL2.dll in addition to C:\msys64\ucrt64\bin\glew32.dll when launched via MSYS2 UCRT64. Copying SDL2.dll to the directory on the other drive where wipeout.exe was located fixed the black screen Alt+Tab issue.

While I'm glad I finally fixed this issue (meaning I should be able to run this game from a flash drive), I'm curious as to why/how wipeout.exe doesn't throw an error when launching it without SDL2.dll, especially since it throws an error without glew32.dll. I think there should be an error message for every missing essential .dll, or as many as reasonably possible, unless there's something obvious I'm missing here.

phoboslab commented 10 months ago

I guess you already had an SDL2.dll on your system that the game used. Probably(?) an older version. By copying the SDL2.dll from msys64 next to the wipeout.exe, you forced the game to use this (presumably) newer SDL2.dll.

Without any SDL2.dll on the system, the game shouldn't be able to start at all.

Vandino86 commented 10 months ago

I guess you already had an SDL2.dll on your system that the game used. Probably(?) an older version. By copying the SDL2.dll from msys64 next to the wipeout.exe, you forced the game to use this (presumably) newer SDL2.dll.

Without any SDL2.dll on the system, the game shouldn't be able to start at all.

Thanks for the tip. I ran wipeout.exe again without SDL2.dll in the same directory, and according to Process Explorer, it was using SDL2.dll from my Android Platform Tools folder that's listed in my system path (I use Android Platform Toosl for adb and scrcpy). That one was from the scrcpy v2.0 release and was version 2.26.4.0 while the SDL2.dll from MSYS2 that fixed the Alt+Tab issue was version 2.28.4.0.

For some reason, I assumed I didn't have SDL2.dll installed onto my PC, as I didn't remember installing any other program that used it. It turns out that scrcpy does indeed use it, however.

I should note that the latest scrcpy release (v2.2 as of 2023-11-24) has an SDL2.dll that's version 2.28.4.0 and doesn't cause the Alt+Tab issue when ran with wipeout.exe, but it's larger and different than MSYS2's 2.28.4.0 SDL2.dll:

SDL2.dll scrcpy v2.0 (2.26.4.0) Size: 2509824 bytes (2451 KiB) SHA256: c2325ce01734ee1abe0f2a040d2ca8551012be3820a1fb2f32530d872df19517

SDL2.dll MSYS2 UCRT64 (2.28.4.0) Size: 2316063 bytes (2261 KiB) SHA256: 34ef4e12ffa20aa0b179cde2fff67607613cc758421f94418f282a3e8c937f5e

SDL2.dll scrcpy v2.2 (2.28.4.0) Size: 2499072 bytes (2440 KiB) SHA256: 520d0459b91efa32fbccf9027a9ca1fc5aae657e679ce8e90f179f9cf5afd279

I think this can be closed. Thanks again!