PCSX2 Crashing On GL Content if GL and D3D DLLs Are Present in 4.5.0+

  • Zombeaver
  • Topic Author
More
3 years 11 months ago #1 by Zombeaver PCSX2 Crashing On GL Content if GL and D3D DLLs Are Present in 4.5.0+ was created by Zombeaver
If both dxgi.dll and opengl32.dll are present alongside PCSX2 (which has access to use both, and which of the two is preferred is dependent on the game) using the Direct3D 11 renderer works fine and hooks into dxgi.dll as expected, you can pause and go to the video plugin section and there are no issues. When using the OpenGL renderer, however, content can be started and it will function normally but if you pause the emulation and then go to the video plugin section the app will crash.

This can be avoided by renaming dxgi.dll to d3d11.dll, which will still work if using the Direct3D 11 renderer, however it doesn't get hooked properly (on launch) until you force it to do a renderer refresh (pressing F9 twice).

Both dxgi.dll and opengl32.dll can be side by side and work as expected in 4.4.2. The issue seems to have started in 4.5.0 (and is still present in 4.6.1).

In summary:

1) 4.5.0+ causes a crash if both dxgi.dll and opengl32.dll are present, GL content is started and then attempting to change the video plugin settings; doesn't happen if dxgi.dll is named d3d11.dll instead

2) d3d11.dll doesn't get hooked when using the Direct3D 11 renderer unless you do a renderer refresh while content is running

Please Log in or Create an account to join the conversation.

  • crosire
More
3 years 11 months ago #2 by crosire Replied by crosire on topic PCSX2 Crashing On GL Content if GL and D3D DLLs Are Present in 4.5.0+
This is expected behavior. Since ReShade 4.5 it does a self-check that ensures ReShade is only loaded once into the process (to prevent multiple instances of ReShade being applied on top of each other accidentally).
With you having both dxgi.dll and opengl32.dll in the folder, that is exactly what happens when you switch APIs: PCSX2 loads multiple copies of ReShade. ReShade detects that and prevents the second DLL from loading, which is why PCSX2 throws an error and crashes here.

Do not do that. There is a reason this is prevented now. The fact that it worked before is entirely because of luck, since loading multiple copies of ReShade was extremly unstable.

You do not need to do it anyway. Install as opengl32.dll (and only as such) if you first start with OpenGL. Switching to D3D11 later will work, because ReShade detects that D3D11 is loaded and will hook the right functions. Same way the other way around, if you first start with D3D11. Install as dxgi.dll in that case and switching to OpenGL in the plugin settings will work.

Please Log in or Create an account to join the conversation.

  • Zombeaver
  • Topic Author
More
3 years 11 months ago - 3 years 11 months ago #3 by Zombeaver Replied by Zombeaver on topic PCSX2 Crashing On GL Content if GL and D3D DLLs Are Present in 4.5.0+
I think you misunderstood what I'm reporting. I'm not talking about changing renderers.

dxgi.dll + opengl32.dll + using PCSX2 set to D3D11 = no issues during play / no issues accessing the video plugin menu

d3d11.dll + opengl32.dll + using PCSX2 set to GL = no issues during play / no issues accessing the video plugin menu

d3d11.dll + opengl32.dll + using PCSX2 set to D3D11 = no issues during play (but you have to trigger a renderer refresh to get it to hook, which can be done by swapping to sotware mode and then back to hardware with F9) / no issues accessing the video plugin menu

dxgi.dll + opengl32.dll + using PCSX2 set to GL = no issues during play / crashes when you go into the video plugin menu

There's no reason that they would ever need to both be loaded into the process either way - you can't have it running in both D3D and GL mode at the same time, it's one or the other. You can't switch modes from one to the other when one (either) Reshade dll is loaded (that causes another, different crash, as you're describing), but I'm not expecting to be able to do that (and that's not what I'm reporting about), I just didn't expect it to outright crash simply by pulling up part of the UI (which doesn't require you to switch them at all, as there are many other functions in the video plugin menu, not just D3D / GL selection).

With you having both dxgi.dll and opengl32.dll in the folder, that is exactly what happens when you switch APIs: PCSX2 loads multiple copies of ReShade. ReShade detects that and prevents the second DLL from loading, which is why PCSX2 throws an error and crashes here.

To be doubly clear, the crash I'm describing isn't prompted by switching renderers, it's prompted by literally just accessing a part of the UI that, among many other things, lets you choose a renderer. And it only happens in one very specific scenario, which I've described. I am not attempting to switch APIs at any point during this.

I maintain a large PCSX2 config project designed to provide configuration files for many (hundreds of) games, these are then loaded on a game by game basis. Which renderer is "best" is entirely game-dependent. Having to switch from one .dll to the other depending on which renderer is used in this scenario is, obviously, not exactly ideal. It isn't necessary either so long as you don't plan on making any config changes, even with everything exactly as it is now. It loads one dll or the other depending on which renderer is used on start. I just found, and still find, the behavior that I'm seeing rather odd. One dll, of two, is causing a crash in one situation out of four and the other isn't.

Install as opengl32.dll (and only as such) if you first start with OpenGL. Switching to D3D11 later will work, because ReShade detects that D3D11 is loaded and will hook the right functions. Same way the other way around, if you first start with D3D11. Install as dxgi.dll in that case and switching to OpenGL in the plugin settings will work.

This is interesting, I didn't know it would do this. I can confirm no issues there. That doesn't really help in this situation though since some games are setup with one and some with the other and that's what's used on launch. As I said though, that, in and of itself, doesn't cause any issues with both .dlls present. It's just when (if) you need to get into the video plugin settings in that one specific scenario that there's an issue.
Last edit: 3 years 11 months ago by Zombeaver.

Please Log in or Create an account to join the conversation.

  • crosire
More
3 years 11 months ago #4 by crosire Replied by crosire on topic PCSX2 Crashing On GL Content if GL and D3D DLLs Are Present in 4.5.0+
Going into the plugin settings menu (whether you switch renderers or not) is what causes PCSX2 to load the second copy of ReShade. I explained why that crashes. As said, installing multiple copies of ReShade simultaneously is not supported and not supposed to work. Don't do it.

Please Log in or Create an account to join the conversation.

  • Zombeaver
  • Topic Author
More
3 years 11 months ago - 3 years 11 months ago #5 by Zombeaver Replied by Zombeaver on topic PCSX2 Crashing On GL Content if GL and D3D DLLs Are Present in 4.5.0+
Then the software is behaving inconsistently regardless. Whether PCSX2 is at fault for that (and maybe that's the case) or Reshade, I don't know, but based on what you're saying I would expect the same crash when performing the same action with both dlls present and starting in D3D. It doesn't. That doesn't cause the crash. It only happens with GL.

Some games need to be started with D3D and some games need to be started with GL as specified beforehand in their configs. They're automatically loaded from command line. Reshade already works in that scenario as-is, with both .dlls present so I'm grateful for that. This is something that's used in conjunction with a front-end . You tell it to start a game, the front-end starts PCSX2 and the game specified with its corresponding config though command line, and that config specifies the renderer. When you quit it closes the game and PCSX2. Start a different game, and it does that again. Which of those use D3D and which use GL varies from game to game depending on what it needs. All of that works fine with Reshade as-is, but you have to use both dlls. If the config that's loaded is D3D, dxgi gets hooked. If it's GL, opengl32 gets hooked. Using only one Reshade dll is not an option/solution because they never switch in this scenario from PCSX2's/Reshade's perspective, which means that it would only ever be loaded for configs that use that specific renderer.

The only "snag" is I just can't make edits while Reshade is loaded, the content that was started was using GL, specifically, and the dx dll is named dxgi.dll rather than d3d11.dll. It's not the end of the world as I'm not really using Reshade while making the configs in the first place, but the behavior that's being exhibited is an inconsistency because it only occurs with one of the dlls. I thought you'd want to know. If the response to all that is "working as intended" then alrighty then. Godspeed.
Last edit: 3 years 11 months ago by Zombeaver.

Please Log in or Create an account to join the conversation.

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.