elishacloud / dxwrapper

Fixes compatibility issues with older games running on Windows 10/11 by wrapping DirectX dlls. Also allows loading custom libraries with the file extension .asi into game processes.
zlib License
1.17k stars 83 forks source link

Unofficial Arcanum Patch #47

Closed Ghost-Terms closed 1 year ago

Ghost-Terms commented 4 years ago

I'm playing Arcanum with the Unofficial Arcanum Patch available here: https://terra-arcanum.com/drog/uap.html

One of the features is the HighRes mod that allows the game to be played in a higher resolution without having to stretch so many things. While I do like this, I would like to have some stretching.

My thinking was I would configure HighRes to install at 1280x720 resolution (which is the default configuration for HighRes) and then have DxWnd stretch it to 1600x900. Unfortunately no matter what I tried, I could not get this to work. The game would launch but it would render in the bottom right corner only. I could get it to behave differently depending on whether or not I used the ddraw.dll from HighRes. I tried using the one that came with the game as well (via GOG, which supposedly has issues), but that would crash instantly when used with HighRes + DxWnd.

I have also set DDrawCompat to 1 in dxwrapper.ini, which seems to be necessary in every case. There are more features from DxWnd I would really like to utilize, such as the ability for the cursor to leave the window without having to alt+tab out.

I would appreciate any guidance you could give me, and it would also be helpful to know whether I should use HighRes's ddraw.dll, GOG's ddraw.dll, or just leave it deleted because dxwrapper.dll is supposedly handling that functionality.

Sorry if this issue is a bit unorganized but my brain is a bit fried after all the hours of tinkering I've been doing on this game. Cheers.

elishacloud commented 4 years ago

@ImportTaste, you can play this game with the Unofficial Arcanum Patch using dxwrapper. I tested this and it works fine. dxwrapper allows you to stretch the resolution from 1280x720 to 1600x900, however, it looks bad when you stretch it because those resolutions are not evenly divisible. There is a feature to do integer clamping for scaling and it looks much better when that is enabled, though there will be a black box around the edges.

Note: you will need to replace the HighRes's ddraw.dll with the dxwrapper's ddraw.dll. dxwrapper will convert all the ddraw functions to their Direct3D9 equivalent so for the most part the game will run better. I did notice that dxwrapper will add some delay on a few screens, but it only happens in certain cases and only for a few seconds so it should be manageable. I will look into fxing this delay later. However, for the most part the game play is much smoother with dxwrapper, as far as I can tell. I own the game, but have not played it much.

Here is a patch with the settings already configured to use 1600x900 and integer scaling clamp enabled: dxwrapper.zip

Ghost-Terms commented 4 years ago

@elishacloud I hit an issue that I was hitting before, I figured it was just because I hadn't configured it correctly but I guess not? I extracted the contents of that archive into my Arcanum directory after applying HighRes and overwrite everything (including ddraw.dll), just to be clear.

image

Ghost-Terms commented 4 years ago

Oh, I should probably post the log.

17640 21:57:47.533 Starting DxWrapper v1.0.6333.21
17640 21:57:47.533 To Be Filled By O.E.M. To Be Filled By O.E.M. To Be Filled By O.E.M. (Desktop)
17640 21:57:47.533 ASRock Z170M Pro4S                        (Desktop)
17640 21:57:47.534 NVIDIA GeForce GTX 1070
17640 21:57:47.535 Windows 10 64-bit (10.0.18362) 
17640 21:57:47.535 "Arcanum.exe" (PID:4396)
17640 21:57:47.542 Disabling High DPI Scaling...
17640 21:57:47.542 Loaded library: user32.dll
17640 21:57:47.542 Loaded library: shcore.dll
17640 21:57:47.542 Loading 'ddraw.dll'...
17640 21:57:47.542 Hooking ddraw.dll APIs...
17640 21:57:47.542 Enabling ddraw wrapper
17640 21:57:47.542 Enabling dinputto8 wrapper
17640 21:57:47.542 Loading 'dinput.dll'...
17640 21:57:47.542 Hooking dinput.dll APIs...
17640 21:57:47.543 Enabling dinput8 wrapper
17640 21:57:47.543 Loading 'dinput8.dll'...
17640 21:57:47.543 Enabling d3d9 wrapper
17640 21:57:47.543 Loading 'd3d9.dll'...
17640 21:57:47.546 DxWrapper loaded!
17640 21:57:47.594 dd_DirectDrawCreateEx
17640 21:57:47.595 Redirecting 'DirectDrawCreate' IID_IDirectDraw7 to --> 'Direct3DCreate9'
17640 21:57:47.595 Creating device m_IDirectDrawX::m_IDirectDrawX(00928A30) converting device from v7 to v9
17640 21:57:47.595 Redirecting 'Direct3DCreate9' ...
17640 21:57:47.625 Creating device m_IDirect3D9Ex::m_IDirect3D9Ex(009C5080)
17640 21:57:47.661 Creating device m_IDirect3DDevice9Ex::InitDirect3DDevice(009CB330)
17640 21:57:50.820 m_IDirectDrawX::~m_IDirectDrawX(00928A30) deleting device!
17640 21:57:50.827 m_IDirect3DDevice9Ex::~m_IDirect3DDevice9Ex(009CB330) deleting device!
17640 21:57:50.830 m_IDirect3D9Ex::~m_IDirect3D9Ex(009C5080) deleting device!
17640 21:57:50.830 m_IDirectDrawSurfaceX::CleanupSharedEmulatedMemory Deleting 0 emulated surfaces!
17640 21:57:50.833 Quiting DxWrapper
17640 21:57:50.833 Unloading libraries...
17640 21:57:50.833 Reseting screen resolution
17640 21:57:50.864 Reseting font smoothing
17640 21:57:50.870 DxWrapper terminated!

EDIT: Just noticed something..

17640 21:57:47.533 Starting DxWrapper v1.0.6333.21
17640 21:57:47.533 To Be Filled By O.E.M. To Be Filled By O.E.M. To Be Filled By O.E.M. (Desktop)
17640 21:57:47.533 ASRock Z170M Pro4S                        (Desktop)
17640 21:57:47.534 NVIDIA GeForce GTX 1070

Shouldn't (Desktop) be on Lines 3 and 4 and not Lines 2 and 3? This is probably related to using my motherboard for my second display, since my graphics card didn't have a second DVI port. This would be the first time I'd ever had an issue though.

elishacloud commented 4 years ago

Shouldn't (Desktop) be on Lines 3 and 4 and not Lines 2 and 3?

No. Lines 2 and 3 are the correct lines for this.

Check your compatibility settings. They should all be disabled:

image

Ghost-Terms commented 4 years ago

yup, they are.

image

elishacloud commented 4 years ago

Try setting the DdrawOverrideBitMode to 32:

DdrawOverrideBitMode       = 32
Ghost-Terms commented 4 years ago

Same error, no change.

elishacloud commented 4 years ago

Ok, that's weird. I am using the GOG version. Maybe this has something to do with the version of the game you are using. Try this debug build and send me the log files. Hopefully this will help me troubleshoot the issue. I probably won't be able to look into this right away.

Debug file: dxwrapper.zip

Ghost-Terms commented 4 years ago

With this debug version the game actually launches but I get a white screen. I had to kill the process in task manager. Here's the log.

dxwrapper-arcanum.zip

elishacloud commented 4 years ago

Thanks for the log file. It is interesting that the debug build is working. The debug build is a newer build. It is possible that something in the newer build helps. Before I get a chance to look at the debug logs would you mind trying this build?

dxwrapper.zip

BTW: thanks for all your tests!

Ghost-Terms commented 4 years ago

Crashes with the same Windows Desktop error from before, I'm fairly sure the log is the same as before as well but just in case I overlooked something...

11460 00:16:48.967 Starting DxWrapper v1.0.6338.21
11460 00:16:48.968 To Be Filled By O.E.M. To Be Filled By O.E.M. To Be Filled By O.E.M. (Desktop)
11460 00:16:48.968 ASRock Z170M Pro4S                        (Desktop)
11460 00:16:48.968 NVIDIA GeForce GTX 1070
11460 00:16:48.969 Windows 10 64-bit (10.0.18362) 
11460 00:16:48.969 "Arcanum.exe" (PID:8068)
11460 00:16:48.976 Disabling High DPI Scaling...
11460 00:16:48.976 Loaded library: user32.dll
11460 00:16:48.976 Loaded library: shcore.dll
11460 00:16:48.976 Loading 'ddraw.dll'...
11460 00:16:48.976 Hooking ddraw.dll APIs...
11460 00:16:48.978 Enabling ddraw wrapper
11460 00:16:48.978 Enabling dinputto8 wrapper
11460 00:16:48.978 Loading 'dinput.dll'...
11460 00:16:48.978 Hooking dinput.dll APIs...
11460 00:16:48.978 Enabling dinput8 wrapper
11460 00:16:48.978 Loading 'dinput8.dll'...
11460 00:16:48.978 Enabling d3d9 wrapper
11460 00:16:48.978 Loading 'd3d9.dll'...
11460 00:16:48.981 DxWrapper loaded!
11460 00:16:49.026 dd_DirectDrawCreateEx
11460 00:16:49.026 Redirecting 'DirectDrawCreate' IID_IDirectDraw7 to --> 'Direct3DCreate9'
11460 00:16:49.026 Creating device m_IDirectDrawX::m_IDirectDrawX(0079D638) converting device from v7 to v9
11460 00:16:49.026 Redirecting 'Direct3DCreate9' ...
11460 00:16:49.058 Creating device m_IDirect3D9Ex::m_IDirect3D9Ex(008562B8)
11460 00:16:49.095 Creating device m_IDirect3DDevice9Ex::InitDirect3DDevice(00837918)
11460 00:16:51.048 m_IDirectDrawX::~m_IDirectDrawX(0079D638) deleting device!
11460 00:16:51.054 m_IDirect3DDevice9Ex::~m_IDirect3DDevice9Ex(00837918) deleting device!
11460 00:16:51.057 m_IDirect3D9Ex::~m_IDirect3D9Ex(008562B8) deleting device!
11460 00:16:51.057 m_IDirectDrawSurfaceX::CleanupSharedEmulatedMemory Deleting 0 emulated surfaces!
11460 00:16:51.060 Quiting DxWrapper
11460 00:16:51.060 Unloading libraries...
11460 00:16:51.060 Reseting screen resolution
11460 00:16:51.094 Reseting font smoothing
11460 00:16:51.099 DxWrapper terminated!
elishacloud commented 4 years ago

Ok, I see why you are getting a white screen with the debug build. That is just one function call and should be easy to fix. However, since the debug build does not have the same error it is hard to troubleshoot with that log. I added more logging to the release build. Can you try once more with this build and send me the log file?

dxwrapper.zip

Ghost-Terms commented 4 years ago

Here you go:

dxwrapper-arcanum.zip

elishacloud commented 4 years ago

I believe I see what the issue is. I put a quick patch in, specific to this game. Try this one:

dxwrapper.zip

Ghost-Terms commented 4 years ago

Nope, back to the Windows Desktop error.

elishacloud commented 4 years ago

Can you send me your arcanum.cfg and Arcanum.exe files?

Ghost-Terms commented 4 years ago

yup here ya go

Arcanum.zip

elishacloud commented 4 years ago

This is not a complete solution, but this one should work.

dxwrapper.zip

Ghost-Terms commented 4 years ago

Sorry for the late reply, been busy. It does boot now, but when I turn on windowed mode there's a lot of black and the game only renders in a portion of the window:

image

EDIT: actually this seems to be a problem with fullscreen mode as well. Maybe that's what you meant by this not being a complete solution.

elishacloud commented 4 years ago

The black border around the game happens because of integer scaling clamp DdrawIntegerScalingClamp. This is what I mentioned here. You can disable that if you don't like that. It will stretch to fill the screen.

Dxwrapper does not fully support windowed mode yet. For this game you need to configure dxwrapper to use fullscreen windowed mode FullscreenWindowMode. How are you enabling windowed mode?

Ghost-Terms commented 4 years ago

I just changed these options:

EnableWindowMode           = 1
FullscreenWindowMode       = 0

And in the HighRes patcher's config.ini I have this set:

//Graphics:
Windowed = 1 // 0 = fullscreen mode, 1 = windowed mode
Renderer = 1 // 0 = software, 1 = hardware
DoubleBuffer = 1 // 0 = disabled, 1 = enabled (unless windowed)
DDrawWrapper = 0 // 1 = install DDrawCompat wrapper
ShowFPS = 0 // 0 = no change, 1 = always enabled

So it launches windowed just fine with this combination, except it's off-center.

You are right in that disabling DdrawIntegerScalingClamp made the game stretch, which works great for the fullscreen windowed, but just regular windowed it looks like this: image

This is similar to what it looked like before, but as you can see, disabling DdrawIntegerScalingClamp did make a big difference, not as much black.

Would you be willing to make this work?

EDIT: Also, really wishing I had a 1920x1200 monitor instead of a 1920x1080 monitor right now, then I could set the config.ini resolution to 960x600 and then stretch it to 1920x1200 with dxwrapper and it would look gorgeous. Oh well.

Ghost-Terms commented 4 years ago

Actually, I am noticing that the transitions are much more sluggish than the much older version of dxwrapper I was using before (available here). Like just clicking around in the main menu, it seems as though everything is not in sync. And I don't mean like screen tearing, I mean the proper assets sort of trickle in instead of appearing all at once.

mirh commented 4 years ago

And you can't set it to 960x540.. because?

Ghost-Terms commented 4 years ago

@mirh The native resolution of the game is 800x600, and setting the height below 600 (via the HighRes patcher) doesn't seem to work properly.

Ghost-Terms commented 4 years ago

@elishacloud I compiled the latest commit (https://github.com/elishacloud/dxwrapper/commit/7b2129f92b23a53a5ff4e9d3caa6e61a58063b0e) and I'm back to getting the Windows Desktop mode error.

I did mention prior, even though the build you gave me before did work, it wasn't really performing as well as the DdrawCompat configuration on the site I linked you. I'm not sure if anything can be done about that, though.

Also, is getting the scaling clamp to work properly in windowed mode in the cards right now, or should I not get my hopes up on that?

elishacloud commented 4 years ago

I am noticing that the transitions are much more sluggish than the much older version of dxwrapper

@ImportTaste, I did mention about the delay in transitions in this thread. I'm not quite sure what is causing it. I have not had time to look into it yet.

Also, is getting the scaling clamp to work properly in windowed mode in the cards right now, or should I not get my hopes up on that?

Currently dxwrapper's dd7to9 feature has issues with some games when windowed mode is enabled. This is pretty common as I have seen similar issues in almost every wrapper that that converts ddraw to some other version of DirectX. Some wrappers, such as cnc-ddraw, even recommend disabling windowed mode the game itself.

I may be able to hard code some solution specifically for this game to get windowed mode to work. I will look into this when I have time.

elishacloud commented 4 years ago

I compiled the latest commit (7b2129f) and I'm back to getting the Windows Desktop mode error.

The issue here is that I did not have proper fix for this in my last updates so I never checked in the fix. However, I fixed this issue in my latest commit yesterday 8c7818958579db9feccb5d5ce25c34872278abe4.

elishacloud commented 1 year ago

Closing this as completed.