narzoul / DDrawCompat

DirectDraw and Direct3D 1-7 compatibility, performance and visual enhancements for Windows Vista, 7, 8, 10 and 11
BSD Zero Clause License
907 stars 69 forks source link

Conquest Frontier Wars crashes with v0.3.0 #96

Closed elishacloud closed 3 years ago

elishacloud commented 3 years ago

The wrapper crashes with v0.3.0 (and v0.2.1), but works fine with v0.2.0 on Conquest Frontier Wars, I am using the GOG version. It crashes after restarting a game or leaving a game. I tried with the debug version and the game won't even play at all. The release version with debug logs actually works better than the regular release version and is much harder to make the game crash (sorry for the large log files here).

Debug build crashes on launch: DDrawCompat-Conquest-Debug.zip

Release build with debug logs (takes longer to crash the game): DDrawCompat-Conquest.zip

narzoul commented 3 years ago

I'm unable to reproduce the crash with either "restart mission" or "resign", and it's not clear from the logs what goes wrong. Can you check a crash dump?

elishacloud commented 3 years ago

For some reason no crash dumps are created, the game just seems to exit by itself. If you use the release build without logs it seems to crash easier. Here are the steps:

  1. Click "Single Player"
  2. Select "Campaign"
  3. Select "Terran Campaign"
  4. Click on the circle to select Mission 1.
  5. Click "Start" to start the mission.
  6. Once the mission is started, press ESC to bring up the menu and then exit the mission.
  7. Once the mission is exited, click on the circle to select Mission 1 again.
  8. Click "Start" to start the mission again.
  9. Once the mission is started, press ESC to bring up the menu and then exit the mission.
  10. If you are using the release build it will typically crash here. If not, then repeat steps 7 though 9 until crash (exits).

Edit: I believe Windows is causing the game to exit because of null pointer access. I had this issue a while back on dxwrapper and if I remember right, it had something to do with how the game handled/managed its interfaces. It was trying to use an interface that I had already deleted. Not sure if the same thing is happening with DDrawCompat here.

narzoul commented 3 years ago

Yes, I got it now, thanks. After running it through a debugger, it looks like it's accessing a deleted IDirectDrawClipper interface in updateWindowClipList (DirectDrawClipper.cpp). The Release method's hook should normally remove the deleted instances from g_clipperData, but it looks like it doesn't get invoked (at least not through the vtable) when the parent DirectDraw object is released without explicitly releasing the clipper first. I'll figure out some fix for this for the next release.

Funny, I seem to remember I caught this issue before too. It looks like I forgot to fix it though...

narzoul commented 3 years ago

Fixed in v0.3.1. Thanks for all the reports!