crosire / d3d8to9

A D3D8 pseudo-driver which converts API calls and bytecode shaders to equivalent D3D9 ones.
BSD 2-Clause "Simplified" License
881 stars 78 forks source link

[GTA III/VC] Crash error when changing resolution #39

Closed gwet18 closed 6 years ago

gwet18 commented 6 years ago

III: 1 then 2

VC: 3 then 4

LethalManBoob commented 6 years ago

Same crashes here on serious sam. Expect its also when i alt tab as the game needs to recall directx. This crashes it.

elishacloud commented 6 years ago

The issue with GTA VC is that after the resolution changes it calls CreateDevice to create another Direct3D device however when the d3d8to9 wrapper tries to create the device Windows is returning error -2005530520 (88760868) which basically means the device is lost D3DERR_DEVICELOST. The solution is to simply try creating the device again. It seems to always work the second time.

I am not sure if the same fix will work on GTA III and Serious Sam since I don't own those games. Try with this file here and let me know how it works.

gwet18 commented 6 years ago

I think it doesn't work either, same errors..

elishacloud commented 6 years ago

Yes, you are right. There is more than one issue. Apparently GTA does not always close the current device before trying to create a new one. Try this one out.

gwet18 commented 6 years ago

Toggling resolutions in III seems to be fine, in VC gives a different error now: default crashdump

elishacloud commented 6 years ago

I am running VC and it works fine for me. Can you tell me what OS you are using, what version of VC you are using and what type of video card you have?

Also I did make a slight update that might address the issue. Could you check this file and let me know if it makes any difference?

gwet18 commented 6 years ago

Yeah, this one works and toggling is fine now, thank you! :)

LethalManBoob commented 6 years ago

Serious sam with direct3d runs alot better and no longer crashes when alt tabbing... about half of the time. The other half.. crash. Alt tabbing is also a lot slower as well. Good start but its a really big issue to fix i imagine.

elishacloud commented 6 years ago

@LethalManBoob, I assume you mean Serious Sam: The Second Encounter? I tried Serious Sam: The First Encounter and it only uses OpenGL not Direct3D.

I am using the GOG version of Serious Sam: The Second Encounter on Windows 10 64bit and the latest update of d3d8to9 works fine for me when I Alt+Tab out. I tried it 10 times with no crash.

Can you try with the latest build here?

Also what version of Serious Sam are you using? What video card and operating system are you using?

LethalManBoob commented 6 years ago

The latest steam release. My os is the latest windows 10 home basic and i use a gtx 1080. With this latest build i am still crashing constanstly. (never on opengl though, just direct3d) Alt tabbing however is alot slower and less responsive. And yes i used your latest build. And no you can change the api. You go into options and then video options. just click the opengl Maybe only in the steam release. See, opengl dosent allow refresh rates over 60. So i have no choice.

elishacloud commented 6 years ago

I was able to find the Direct3D option but I still cannot reproduce the issue with either Serious Sam: The First Encounter or Serious Sam: The Second Encounter. I am using the GOG version so the crash could be related to the Steam version.

I am running Windows 10 Pro with a GTX 780. I tried Alt+Tab a bunch of times with no crash. I will need to check with the Steam version later. If you can find a specific way to reproduce the crash let me know.

LethalManBoob commented 6 years ago

For me. Alt tabbing in direct3d with d3d8 to 9 causes consistant crashes. Every time.

Logs of d3d8.log and serioussam.log dont show anything.

its always the "serious sam has stopped responding" type of crash.

elishacloud commented 6 years ago

Ok, I was able to reproduce this issue and it is the same issue with both GTA games and both Serious Sam games. My previous fix was not solving the root issue. It looks like there was a ref count issue with d3d8to9. Check out the attached file and let me know if this solves the issue. This should also fix both the crash and the slow alt+tab issue.

d3d8.zip

LethalManBoob commented 6 years ago

Well that seems to have fixed the crashing thankfully. But alt tabbing is still very slow,

elishacloud commented 6 years ago

What is the difference in alt+tab speed with d3d8to9 vs without? How long is it actually taking? I am trying to figure out if this is an issue with d3d8to9 or just an issue with the game.

BTW: alt+tab is very quick for me on both Steam and GOG versions of the game.

crosire commented 6 years ago

Fixed in 24129269a9763373bd7a5b5ea49b76962010a2b4.