narzoul / DDrawCompat

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

Nvidia G-Sync prevents Arcanum from booting when enabled when the DDraw compatch is installed. #65

Closed Wetpig closed 3 years ago

Wetpig commented 4 years ago

As the title says Arcanum wont boot when the ddrawcompat patch is installed and G-Sync is enabled.

I recently purchased a new monitor which has the G-sync functionality which is automatically enabled by the nvdia control panel. Since Drog (creator of the UAP for Arcanum) had the same video card, it dawned on me that the only difference was the monitor and the aforementioned G-sync setting.

When I disabled G-sync the game runs with the compatch installed, With G-sync enabled one must first disable the DDrawcompat in the High res config.ini file before the game will boot, thus reducing performance.

narzoul commented 4 years ago

Are you saying the game does not start at all, not even a black screen? Does the process keep running in the background (in task manager) or does it exit too?

I don't have G-Sync hardware for testing, so please upload the logs taken with the ReleaseWithDebugLogs build of the latest experimental release.

Wetpig commented 4 years ago

It dosnt start at all, the process runs, a portion of the desktop momentarily opens a window that immediately closes, the process does not continue to run in the backround.

Ill get that log to you soon!

Edit: Where do i find the "ReleaseWithDebugLogs build" ?

narzoul commented 4 years ago

https://github.com/narzoul/DDrawCompat/releases/tag/experimental It's in ddraw-debug.zip.

Wetpig commented 4 years ago

ddraw.log

Sorry for the delay, I hope this is what you were after.

narzoul commented 4 years ago

Thanks! It looks like it crashes in pfnPresent1. To continue, I would like to ask also for a crash dump. Please check my comment here on how to get one: https://github.com/narzoul/DDrawCompat/issues/50#issuecomment-520162844 Please upload both the crash dump and the debug logs from the same test run.

Though from a quick look at my code, I have a feeling the crash is in just Nvidia drivers at this point. It may be that DirectDraw does not support G-Sync in full-screen exclusive mode. Do you have Compatibility Administrator installed by chance? If so, you could test the DXPrimaryEmulation shim with "-DisableMaxWindowedMode" parameter, without the use of any ddraw wrappers, to see if that reproduces the crash also. I'll write more details on how to do this, if needed.

Wetpig commented 4 years ago

Arcanum.exe.12932.zip

[ddraw.log](https://github.com/narzoul/DDrawCompat/files/4600605/ddraw.lo

Ok, Try now.

narzoul commented 4 years ago

The first link isn't working. Maybe the upload didn't finish before you pressed Comment?

Wetpig commented 4 years ago

Arcanum.exe.12932.zip

Ok, try that.

narzoul commented 4 years ago

Well, it does indeed crash in the Nvidia drivers. I suspect the drivers don't support exclusive full-screen mode in DirectDraw with G-Sync enabled. If you google around for "directdraw gsync crash" (without quotes) you will find lots of similar issues reported.

Without DDrawCompat, it probably works because by default, DirectDraw games run in fake full-screen mode (similar to borderless windowed mode) in Windows 10 (probably since Windows Vista even, I'm not sure exactly). So in this case G-Sync is not used anyway, DWM (the desktop compositor) handles presentation.

If you wish to double-check this yourself, you'd need the Application Compatibility Toolkit from Microsoft to test real full-screen mode in Arcanum without any DirectDraw wrappers. Based on your logs, I think you have Windows 10, so you can get the Toolkit for the correct version of Windows 10 from here: https://docs.microsoft.com/en-us/windows-hardware/get-started/adk-install You don't have to install the whole ADK, select only the "Application Compatibility Tools" feature during installation and deselect everything else.

After installation, you can launch "Compatibility Administrator (32-bit)" from the Start menu and do the following to launch the game in real full-screen mode (after removing ddraw.dll from the Arcanum folder):

  1. Press the Fix button in the toolbar at the top.
  2. Enter "Arcanum" under "Name of the program to be fixed" (doesn't really matter for testing, it just won't accept some special characters, like the angle brackets present there by default).
  3. Press the Browse button and select Arcanum.exe from your Arcanum install directory.
  4. Click Next twice.
  5. Put a check mark in the checkbox next to DXPrimaryEmulation in the list.
  6. Click on the Parameters button, and enter "-DisableMaxWindowedMode" under Command line, without the quotation marks. Press OK.
  7. Click on the Test Run button, then OK to launch the game.
  8. After testing with both G-Sync on and off, you can press Cancel and close the tool.

If the Test Run crashes when G-Sync is enabled, but not when it's disabled, then I think it pretty much proves that it's a driver issue. In that case, there is not much I can do about it for a while, since it would require rewriting the presentation layer in DDrawCompat to at least Direct3D 9, which is a lot of work (and possibly some hacking, since DirectDraw and Direct3D 9 can't interwork natively) that I wasn't planning to do for the next stable release yet. Maybe later.

For now, I'd suggest to leave G-Sync disabled for Arcanum and anything else you use DDrawCompat with. I suppose you can disable it in Nvidia control panel on a per-application basis, so you don't have to toggle the global settings on and off all the time when switching between games.

If you really want to get G-Sync working now, you could also try some other DirectDraw wrappers that should already support this, like dgVoodoo 2 or https://github.com/elishacloud/dxwrapper (Dd7to9 part). @elishacloud may be able to help you with the latter. Though I'm not sure if there is any benefit to this in Arcanum, since hopefully you can already run the game at max FPS anyway.

@elishacloud: By the way, for better Arcanum support, you should consider adding a fix in your wrappers similar to the one discussed here: https://github.com/narzoul/DDrawCompat/issues/63

elishacloud commented 4 years ago

@Wetpig, I have used dxwrapper with this game and it seems to work for me. I have not played it much, so I am not sure how it is suppose to look. But a quick test seems to run ok. Note: my code just up-converts this game to Direct3D9. Let me know if you have any issues.

Just unzip these files into the game: ddraw.zip

@elishacloud: By the way, for better Arcanum support, you should consider adding a fix in your wrappers similar to the one discussed here: #63

Thanks @narzoul! I will look into this.

Wetpig commented 4 years ago

Thanks for the help, im not fussed i can just turn it off, i was just wanted to make sure you were aware of it.

narzoul commented 4 years ago

Well, I'm still curious if this is only an issue with DDrawCompat, or also with native DirectDraw if real full-screen exclusive mode is used. If anyone can test it (based on the instructions in my previous comment), please do so.

Wetpig commented 4 years ago

Ok, I will do the further testing, please allow some time as I am very busy.

EDIT: Is it just the ddraw.zip you want me to try out?

narzoul commented 4 years ago

Sorry, I don't get an e-mail notification about edits, so I didn't notice you added a question to your comment until now.

No, it's not about ddraw.zip. I was referring to the Application Compatibility Toolkit I mentioned in my long comment earlier (with the 8 steps). For that you'll specifically have to remove ddraw.dll from the Arcanum directory, and run the mentioned test through ACT, with and without G-Sync enabled.

narzoul commented 4 years ago

Is this still an issue with the latest experimental release? The presentation part was changed quite a bit, so there is a chance this may have been resolved as a side effect. Can anyone test it?

narzoul commented 3 years ago

Unfortunately I can't debug this further without help from someone with G-sync hardware. Closing until then.