PrismaticFlower / shaderpatch

Improved shaders (and fun stuff for modders) for Star Wars Battlefront II (2005) - Incompatible with Classic Collection
MIT License
39 stars 2 forks source link

Unable to use other plugins that use D3D9 #60

Closed Knight450 closed 5 years ago

Knight450 commented 5 years ago

With the new shaderpatch released, I am unable to use other plugins that use a D3D9.dll for effects such as Reshade. Is this intentional?

PrismaticFlower commented 5 years ago

Yes and no.

Shader Patch presents itself as being Direct3D 9 to the game but does not use it. And it only implements the specific D3D9 functionalty the game needs, so trying to run general D3D9 applications against Shader Patch would result in SP fast failing (intentional crashing) the instant it used something it didn't support.

So that's the yes answer, it's intentional in the sense Shader Patch wants to use (and does) features provided by Direct3D 11 and as a result warps the game's calls to do just that. This incidentally breaks anything else that wants to come along and hook the game's Direct3D 9 calls.

But now for the no answer. Shader Patch doesn't take any special action to attempt to block other things hooking graphics API functions. The key thing is it uses Direct3D 11, so whatever you're wanting to use in addition to it must target Direct3D 11.

In your case Reshade targets all graphics APIs (more or less). Now I don't use Reshade or anything like them (they're far too overbearing for me) but I think all you have to do is rename the Reshade dll to d3d11.dll and it'll just work. I could be wrong though.

I think there is still one last snag though, if Reshade still tries to hook D3D9 as well as D3D11 it could very well crash the game. If this does happen it isn't anything I can fix and is a problem with Reshade's hooking logic.

Knight450 commented 5 years ago

Interesting. If that's the case with Reshade like you said about renaming Resahde to "d3d11.dll" than I should use the Reshade Directx 11 dll instead of the D3D9 dll. Thank you for the reply though, I understand why you don't use Reshade, it hasn't been good in recent years.

Knight450 commented 5 years ago

I decided to uninstall Reshade and another plugin I was using and an older shaderpatch, but now when I use the newest shaderpatch the game just crashes right away. I don't even get to the title screen. The shader patch log just says "Shader Patch log started. Shader Patch version is v1.0.0-rc.4 [ERROR] 07:06:07 Failed to create Direct3D 11.2 device!" Last I checked I do have Dirextx 11 installed (and played Directx 11 games) so I'm not really sure why I'm getting a Failed error.

PrismaticFlower commented 5 years ago

That's weird. I assume you're aware of the Windows 10 requirement (end of the first paragraph, probably should've made it more obvious) Shader Patch has? What GPU are you using? It's possible I've poorly selected the minimum required D3D feature level.

Knight450 commented 5 years ago

That could be the issue, I don't use Window 10 I use Windows 7 (guess I saw the mod updated and wanted to try it fast because of the shiny new features). Windows 7 is supposedly going to be extended with a fee or something so I don't think it's going to be discontinued soon. My GPU is a GTX 1080. The older Shader Patch works but not the new one.

PrismaticFlower commented 5 years ago

Yeah the OS is definitely the problem here.

The Extended Security Updates offer for Windows 7 seems to be targeted at enterprise customers (they've only announced it for Pro licenses and higher) and I'd guess will likely have a price point to match. Given that the people that I'd expect to be interested in SP will typically be running on a personal device support for Windows 7 will still end at the end of the year for them.

But in any event it's kind of moot. As you discovered Shader Patch already depends on and uses features from Windows 8 and Windows 10. Working around these missing features is possible but a few months ago after a conversation with folks on the Discord server and factoring in the impending end of support for Windows 7 I decided that it wasn't worth the (non inconsequential) time investment.

I am really sorry that this means you're unable to use SP; since I'd love another user (or perhaps more correctly, hate to lose one). But it is what is; Windows 7 is just outdated now sadly.

Knight450 commented 5 years ago

I understand, I don't know when support for Windows 7 will end but it will end eventually unlike Windows 10 which will just get updates from now on. I don't see myself upgrading to Windows 10 in the future, most likely I would upgrade to Linux because of Windows 10's layout being strange to me and the intrusive addons/spyware it has. If they would have an option to have Windows 10 function similar to Windows 7 and have the same UI than I may switch to it, but it doesn't have that. I've seen Linux have a feature like this. But the biggest issue I have with Windows 10 is that it doesn't always work with older games and almost every game I play is old such as Star Wars Battlefront 2 (Windows 10 updates often break older games even if they are working). Many older games I play I've seen users have issues with Windows 10 or 8, issues ranging from memory issues to just not even launching. But thank you for helping me out and taking time out of your schedule to reply to me. I just have one last question. Is it possible for Shader Patch to implement Soft Particles or Dynamic Shadows? I ask this because there is another plugin that someone has made for a game from 2004 which has these two features and more, but I guess in the end it all depends on the game's engine.

PrismaticFlower commented 5 years ago

I've never personally had a major issue with playing an old game on Windows 8 or Windows 10. (Any more so than I did with Windows 7.) But yeah there's nothing wrong with saying Windows is no longer for you and grabbing a Linux distro.

Is it possible for Shader Patch to implement Soft Particles or Dynamic Shadows? I ask this because there is another plugin that someone has made for a game from 2004 which has these two features and more, but I guess in the end it all depends on the game's engine.

Now you'll have to clarify what you mean by "Dynamic Shadows" because SWBFII already has shadows, and they seem reasonably dynamic to me. But I absolutely have thought about adding soft particles. The only big thing that worries me about adding them in some form is that it'd mean having to bind the depth buffer for reading, which can make all subsequent uses of the depth buffer slower for the rest of the frame. But we'll see maybe in a future version it'll be added as a feature that can be switched on or off.

Knight450 commented 5 years ago

I thought the shadows were a bit static, in a way that some objects that you expect to cast a shadow don't cast a shadow. Also I thought the shadows in SWBFII were built into the models themselves. Some games I've seen also have shadows just like this, where the shadows are built into the models. One of the games that I play which has Dynamic Shadows as a mod will cast the shadows more accurately based on the model, it won't use the shadow that is already built into the model. But your right I don't think shadows are really needed that much now. I think the two best features that can make Battlefront 2 look even better would be some type of SSAO and Soft Particles (maybe DOF or Motion Blur), but these two are also the most difficult I imagine since they involve the depth buffer.