-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ReShade bugs with DirectX version detection #873
Comments
Possibly related: #852.
I think the STL logic is working as intended but it sounds like this is breaking games, so the logic has to be specifically altered. I took a quick look and I don't think STL does any checks for which DLLs to copy, I think it deliberately copies them all.
Could you explain this a little bit more? I'm not too intimately familiar with the ReShade stuff. Is it always trying to copy files on each game launch? This is probably not desired, but I'm also wondering if it's causing any problems?
I think we may have briefly discussed this before, I'm very much in agreement. I think other similar options such as Auto-Bump GE only have the one checkbox - Similar as in, they both conditionally download files, and the GE checkbox doesn't have a higher level "enable" option. Removing this higher level checkbox is probably safe and relatively straightforward. I don't think it makes much sense to have a checkbox to enable ReShade, and then a separate checkbox to install it. I don't use ReShade but if I did, I would expect enabling ReShade to also install it, and disabling ReShade to uninstall it.
Yes, I'm unsure if there's a "universal" way to actually get the DirectX version. An override option is probably a good idea. In terms of the last point, mods can also be installed to So for the points in this issue to be resolved, we need to do the following:
Please correct me if I got anything wrong :-) I am not clear in my mind on the specifics of implementing this, but it should be possible. The UI change should hopefully be trivial. Thanks for staying on top of the ReShade-related stuff. I'll try my best to look into these when I can :-) |
Nah, I think #852 is, as you said, an upstream issue. I commented some more over there with my thoughts.
Exactly. This in itself shouldn't really be too big of an issue. The files are really small (a few kb I believe), so copying them on each launch isn't really time-consuming or anything, where a bigger issue is when you want to name
Exactly correct. I was calling it a "Bug" because I thought I remember there being logic in the ReShade functions for checking what API the game uses and copying the relevant files (I think the way the check worked is if the game is 32-bit use I vaguely remember someone once posted an issue about this very same problem, and Frostworx implemented a fix, and when I did the refactor adding the version override, I tweaked it further because it wasn't working for me or something. I actually knew about this issue for a while now but have been very lazy/busy 😅 (new job) and kept forgetting to post a bug report. Also never really was to big of a problem (never caused crashes or issues) until now with Tales. |
I did a bit more digging, I'll try break this down a little bit. It turns out you were right, there is an architecture check for ReShade, in if [ -d "$INSTDESTDIR" ]; then
#32bit:
if [ "$(getArch "$CHARCH")" == "32" ]; then
writelog "INFO" "${FUNCNAME[0]} - Installing 32bit ${RESH} as '$CHARCH' is 32bit"
#d3d47
installd3d47dll "$D3D47_32" "$INSTDESTDIR"
#dxgi:
installRSdll "$RS_DX_DEST" "0" "$RS_32"
#d3d9:
installRSdll "$RS_D9_DEST" "$NOD3D9" "$RS_32"
# 64bit:
elif [ "$(getArch "$CHARCH")" == "64" ]; then
writelog "INFO" "${FUNCNAME[0]} - Installing 64bit ${RESH} as '$CHARCH' is 64bit"
#d3d47
installd3d47dll "$D3D47_64" "$INSTDESTDIR"
#dxgi:
installRSdll "$RS_DX_DEST" "0" "$RS_64"
#d3d9:
installRSdll "$RS_D9_DEST" "$NOD3D9" "$RS_64"
else
writelog "SKIP" "${FUNCNAME[0]} - ERROR in ${RESH} installation - no file information detected for '$CHARCH' or any 'neighbor file' - setting USERESHADE=0 for this session"
export USERESHADE=0
fi
else
writelog "SKIP" "${FUNCNAME[0]} - INSTDESTDIR '$INSTDESTDIR' not found"
fi The From what I can tell by glancing at the code here, it looks like it moves some DLLs called cp "$RESHADESRCDIR/$RSVERS/$3" "$INSTDESTDIR/$1" >/dev/null 2>/dev/null Basically the line copies either the 32bit of 64bit ReShade DLL and copies it to the game EXE directory (where ReShade DLLs are meant to go afaik). It copies this DLL twice, identical files but with one copy called So the above code is what copies the relevant 32bit or 64bit ReShade DLL. And as you said, it creates both
The My understanding now is that while the code is explicitly creating both of these DLLs, this is not desirable behaviour. Therefore I'd like to ask a couple of things:
Hopefully my investigation on what's going on here makes sense. Sorry it took me so long to get around to this, I realise this is a bit of a blocker for some games. I'm not very well-versed in ReShade, I am just going by what the STL logic does, so please correct me if I'm talking nonsense :-) |
Yup, you are correct, except you only need one .dll. That's what I was trying to get it to do . the architecture checks servers two purposes (at least, that is how I was trying to use it when I was doing the rewrite) the first purpose was to determine if we need the 32-bit or 64 bit reshade the second purpose was if the game is 32bit, it is usually d3d9 or older, so use Normally it shouldn't really be a problem if you have multiple versions as normally the game will only load one But in the case of my game, having I think it may be easier to just have a dropdown with different names to use for the .dll the options being 1. sorry, I haven't had much time to look at this |
Out of curiosity, does enabling the "No D3D9" option in the Game Menu fix this for you? Since it shouldn't copy the D3D9 DLL if this option is disabled. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry for the delay. I Didin't know there was a "NoD3D9" option. Where in the game menu can I find it ? I only see "NoD3D10" and "NoD3D11" |
Huh, it looks like you're right. STL does track There is code that can also try to export this if EDIT: Relevant code block is here, in Proton also no longer seems to have a Sorry about that, but perhaps manually setting It is also probably not worth exposing this on the UI if the go-forward approach will be to let the user choose the name of the ReShade DLL, or to at least have an option to specify a name to override the current behavior. |
So I've been thinking about this (and a couple of other things I want to approach in STL loosely related to this) and essentially the changes needed for this issue to be closed are:
I think this is a good base summary, hopefully :-) Fixing the DLL issue might be the most straightforward to start with. I'd be very interested in hearing your thoughts on how best to approach it, I see two options:
I'll hack around when I have some time and motivation. No ETA but even though there hasn't been any code changes, I have been giving implementation on this a good bit of thought :-) |
Personally, I would go with option 1, have a dropdown with As for when the .dll already exists, I actually never tested that (thinking about it, I probably should of 😅 ), but I am pretty sure it just overwrites the current .dll right now (The correct way in my opinion, is to rename dll to As for wanting to have the option to have multiple dlls (such as having As for checking if reshade is installed, STL creates a ReShade.txt with the name of the .dlls to track. ( you will notice that it also tracks EDIT: Thinking further, I think the dropdown for the DLL names should have API names and not dll names (so Direct3D 9, Direct3D 10+, and OpenGL(I never tested if this works as I couldn't find an OpenGL game)). The reason being a user not immediately understand what to name the DLL from the linked wiki but they will see API name. And then ReShade in the background does Direct3D 9 --> Direct3D 10+ (meaning Direct3D 10 or higher) --> OpenGL --> custom name --> |
Going to take a look at proofing this out soon I think, it's taken a while to make some time for this, apologies!
I like this approach as well, especially if this is how it behaves on Windows.
I agree with you that the correct way is to create a backup at least by default. When ReShade is then disabled, the backup should be restored. Though this has implications for checking the DLLs in the game directory after ReShade has been disabled. Since STL already tracks when ReShade DLLs are installed as you mentioned later on, maybe this will be more straightforward than I'm thinking! I hope... I'll cross that bridge later I think. Having the option to control this also makes sense.
Yes, this should be possible I think. We could probably create an array by splitting the DLL names on a comma (DLL names probably can't contain commas, right? 😅) and then use loop to copy the ReShade DLLs that way.
I wonder if STL has logic to remove this when ReShade is no longer in use. If so, that would be very handy. If we can check when ReShade is installed, then it should be straightforward to stop moving the DLLs on each boot. I can foresee a scenario (which would also occur on Windows, in fairness), something like this:
The solution to this scenario is probably to further document a scenario like this on the ReShade wiki, and to let users know that selecting the ReShade DLL name is useful to avoid a scenario like this. But as noted this could happen on Windows too when mods which use DLL injection have a name that conflicts with the ReShade DLL. Though if we back up an existing DLL and then a mod is using that DLL, and then a user uninstalls ReShade... hmm, I think I am overcomplicating scenarios now. I think users should be somewhat responsible for managing DLL name conflicts, since they would have to do this on Windows too if they manually renamed a DLL, then installed a mod which used that DLL, then tried to restore the renamed DLL which would then override the mod DLL.
Mapping this might be a little tricky, but I will keep it in mind. We could also note some general guidance on the tooltip for which DLL name to choose, as well as noting on our wiki which names to choose. I do like the idea of having the API names which we then map them to the respective API names. For a minimal proof of concept I will work with the DLL names but will see if STL does this kind of mapping elsewhere (the GameScope menu might have some mapping, I did some whacky caffeine-fueled madness when I was refactoring that menu).
They are few and far between in my experience, the only games I know of which use OpenGL are games using idTech 4 (i.e. DOOM 3/DOOM 3: BFG Edition), and there is an OpenGL backend for DOOM 2016 I believe as well. I own these games so I can try to test in future if ReShade OpenGL works with them :-) |
I am working on this on a branch now ( It should hopefully be straightforward enough to implement this. I am not sure if we need to be concerned too much about existing ReShade installs? If a user is using d3d9 and dxgi DLLs, but a mod they installed overwrote the dxgi DLL, then now we're forcing ReShade to use dxgi by default, two things will happen:
I guess we can just tell users to check the changelog before updating? It will be noted there anyway, but I am moreso thinking for users on git packages like Pacstall or the AUR. Maybe changes like this should be considered "par for the course". If we fix/change the behaviour of STL copying the ReShade DLLs on each boot, though, maybe this wouldn't be a problem to begin with. |
Success! With commit 07140be, the selected ReShade DLL is copied into the game folder. There was even a little menu that appeared telling me that ReShade was installed and it asked me to go through a tutorial. I have no idea if shaders work, but the actual DLL appears to have been picked up by the game. I only tested with There are still a few outstanding todos:
I was able to verify that this new option worked even with the ReShade Override version (STL defaulted to 5.4.something, but I was able to force ReShade 5.9.1 and it worked great!) EDIT: I tested over DLL names as well as a custom DLL name, and they worked. So basically right now, for the "happy path" to work (as in, brand new user who has never used ReShade before, and sets the correct DLL name), we just need to support comma-separated DLL names. After that, we need to account for some problem cases:
|
Tested "DOOM 3: BFG Edition" with the I am not sure if we should set this override by default when OpenGL is selected. I think it may be a good idea but I am not sure if it could have any negative impacts... It is probably safe to simply do a little export for an override. I will test that now. If we do go the route of automatically setting a DLL override, we should note this on the wiki too in case it fails, or if the user wants to set a custom DLL override. |
Turns out we already had code to set the D3D DLL overrides for ReShade, so I was able to append the I am not sure how custom DLL names should work and if we should set this to n,b ourselves, but since it is a custom DLL it may be fine to leave it up to the exe to find this itself. We also have an STL option for passing DLL overrides. If this is a problem, we can deal with it when a user reports it. So now we should handle multiple comma-separated DLL names, then consider how best to handle problem cases like existing ReShade installs and existing DLLs. I am not sure the more I think about it, how much of a priority this is to handle since the existing code doesn't, but we can think about that later :-) |
Okay, comma-seperated DLLs have now been implemented in commit b6bc166! I also tested to ensure that the standard behaviour of only having one DLL selected still works without issue. So now the main thing left for implementation is handling some extra cases:
My thinking is that, because of the complexities around trying to manage this ourselves, we just leave it up to the user to remove any stray DLLs themselves. For managing overwriting DLLs, I'd be curious to know how ReShade handles this on Windows. |
PR is up to implement this, pending more testing and so on (#881). It implements the main functionality of this issue, which is to rename DLLs to resolve the core issue that the game "Tales of Arise" crashes because it tries to read one of the ReShade DLLs. Now we only copy one, and let the user decide the name. The UX portion of this issue will be tackled separately. In testing I have really come to appreciate how cumbersome this behaviour is, and I would like to change it :-) If anyone is free to test the PR, including how it impacts existing ReShade installs, please do test and report back. This should work at least for Dirct3D 9/10/11 games, OpenGL games should hopefully work too. Vulkan may not work due to how ReShade uses the Vulkan layering system and this probably doesn't play nice/probably isn't even read by the Linux system Vulkan (maybe an |
Awesome work! Sorry, I wasn't able to get back sooner. As for
I don't think there is much that can be done other than warning users in the release notes and wiki.
same for this. Most we can do is rename existing files to We should warn users in the wiki and maybe in tooltips as well that this will override any existing .dll with the name chosen (opengl32 64,
AFAIK no one has really tried and succeded getting the vulkan layer working (and I think even if it did it wouldn't work on linux games, it would still need to be through wine and I don't think you can run games in wine with vulkan) So I wouldn't worry about this use case, plus vkbasalt is recommend for this use case ( though its support of reshade features is not complete, mainly it lacks depth buffer access which is needed for most cool looking shaders) |
I'm ok with this approach 👍
Yeah, it might be extra complexity trying to manage renaming the files back. I'll look into dealing with existing DLLs before merging #881. Though having said that:
This might be the simplest approach 😄
It's very possible that ReShade Vulkan may not work, though Vulkan does actually work with games running through Wine 😄 Wine can point games to use the system OpenGL or Vulkan - at least afaik it's Wine that does it and not DXVK, Wine does have a ReShade would still not work with native Linux games though, because as far as I know, ReShade uses a Vulkan layer to try and inject the ReShade DLL into a game. For Proton games this might work depending on whether it's the system driver (i.e. mesa) responsible for handling the Vulkan layer. If that's the case it might get confused when it tries to read the ReShade DLL, but if it's read by the game (running via Proton) it may work. I am not sure to be honest, this is all out of my depth 😅 That's just my armchair understanding as of now. If there was a way to get ReShade Vulkan to work I'm sure someone closer to it than me would've figured it out by now, but I'll still mess around and see if there's a way to get the game to read the Vulkan layer, as it probably wouldn't pick this up by default. So to get #881 merged, I think I'll update the tooltip to note about how this will override any existing DLLs with the chosen name, look into perhaps making backups of those DLLs or having an option to (not sure, maybe I'll just default to backing them up, that might be much more straightforward), and then after that I'll prepare the updates to the wiki to note these changes to ReShade and the expected behaviour. Feel free to test the PR when you have some time, or if not I'll just merge it as-is and if I'm horribly broken something I'm sure I'll hear about it 😄 |
Okay, I did some more work on this tonight in #881. Here's a quick breakdown! When we have an existing DLL, I went with this approach:
I hope that breakdown made sense, it seems to work in my tests of doing fresh installs, removing the chosen DLL name(s) from the ReShade.txt folder, and messing around with the There is no notifier for any of this but plenty of logging. I am not sure if it's worth it to add this in a notifier to be honest, it might be too noisy (and we're already a bit noisy with the notifier). There is no dropdown to select this behaviour, I think just backing up existing DLLs is enough. We should never have a case where we back up an existing, STL-managed ReShade DLL, so if the game/a mod is using the chosen DLL name, the user should be able to go to the game files and rename the game/mod DLL that got backed up, back to the original name to restore functionality. This behaviour will be documented on the wiki too. I think this is as far as I'll go for managing existing DLLs, so the warnings we discussed will be added to the wiki. I updated the tooltip to be a bit more descriptive and helpful. I also added a quality of life feature to append On the subject of the legacy behaviour, I think simply documenting on the wiki and changelog that this behaviour has changed and that only ony DLL is copied, is good enough. I am also not going to do any work with "removing" superfluous DLLs, hopefully having that approximately 4mb eaten up is acceptable to most users :-) So with that, the following is currently implemented in #881:
I have tested the following games with these changes to ensure they launch and show the ReShade menu. I have not knowingly tested any DX10 games.
So with all that, and excluding the ReShade UX updates to reduce the number of checkboxes, all that's left for #881 is:
Once those three items are complete, #881 can be merged and the bulk of this issue will be resolved! I'll move onto tackling the ReShade checkboxes after it is merged, and maybe after #870 as well (just to clean up all loose ongoing threads of work first). If you have any time please feel free to test these. In the meantime I'll try to work on updating the wiki page, which may take a while depending on my motivation, so there is no hurry on this. We all have lives and jobs, and anyone else reading this is free to test and see if anything has broken with my hacking around with STL's ReShade implementation. Fingers crossed this will be all good and ready to merge soon! |
PR was closed by mistake when merging #881, sorry about that. There is some remaining work to be done from this issue:
The first point will require a bit of a refactor, but I will look into it. The second point should be much more straightforward... hopefully... 😅 |
Taking a look at migrating the |
I noticed an issue after #881 where the ReShade DLL name ends up getting duplicated in the dropdown list, I'll investigate this too. It seems difficult to reproduce though. |
#888 is up to implement the ReShade checkbox consolidation. In my tests it seems to work, but please do take care while testing in case any STL ReShade checkbox options get mangled :-) |
Decided to live on the edge and merge #888. This change is now in master. We can revert if there are any glaring issues. |
I have done some more testing since merging, I haven't been able to reproduce the issue of the duplicated DLL names in the DLL name box again, and the USERESHADE and INSTALL_RESHADE merging seems to be working fine in my tests. I am not very close to ReShade usage though so there could be other oddities I haven't had much time to look into the ReShade DLLs getting overwritten on each boot since before where I couldn't re-create that behaviour, but if it's still a problem I can look into fixing it again. Aside from that, this issue can be closed once those two outstanding points are resolved 🥳 (recreating the DLLs on each boot, and additional testing on the features implemented as part of this issue) |
Sorry, I didn't respond earlier, got sick with covid. Anyway, I have been playing Tales of Arise here and there since then, and I think the USERSHADE and INSTALL_RESHADE merging went fine. My settings seem to have migrated fine, and everything is working as expected as for the DLLs being recreated on each boot it seems it is still happening as every launch of the game seems to modify the you can see from the following line in the log it is saying the DLL is being updated
|
That's no fun, hope you get over it soon :-) Thanks for attaching a log, it seems like based on that and the line you pointed out, the ReShade version check is not working. The logic in STL right now checks the version of ReShade by parsing the DLL. It does this specifically: grep -q "$RSVERS" <<< "$(strings "$INSTDESTDIR/$1" | grep "^Initializing")" If you navigate to the game directory with the ReShade DLL and run It seems that for some reason, trying to |
Ah, so I think I figured it out. It isn't that the Addon DLL is returning the wrong version (it isn't, grep -q "5.9.2_Addon" <<< "$(strings "$INSTDESTDIR/$1" | grep "^Initializing")" And of course, the version in the ReShade DLL does not include if grep -q "5.9.2_Addon" <<< "$( strings dxgi.dll | grep "^Initializing" )"; then echo "reshade up to date"; else echo "reshade needs updating"; fi It will return The solution to this will probably be to create a "clean" ReShade version to check against, probably by using parameter expansion as the cleanest method as it should hopefully mean we don't have to create a temporary variable to store this. This is a lot simpler than trying to change how we store Should hopefully be an easy fix, and one I will be doing without any Dr Pepper or coffee as it is 2am, so here goes! 😅 |
Possible resolution for final part of #873
Pushed this one directly to master for giggles, 57cfc4e should hopefully resolve this version issue. I used |
Never thought about the issue being the Nice find and yeah your solution works perfectly it ignores the suffix because we don't care about that for our purposes here . I think this issue is ready for closing now ? |
Woohoo, this issue can be closed I think! Sorry it took over a month for me to get around to actually fixing everything outlined here, and thanks for all your input with it :-) I hope this makes the ReShade experience a bit easier! |
System Information
Issue Description
The logic for determining the direct version of the game is broken. It always installs both the d3d9.dll and dxgi.dll, which can sometimes cause the game to crash, such as in Tales of Arise.
Also, the installation function needs to be reworked. Currently, it is always reinstalling the ReShade files on boot.
Also, I feel having a check box for installing might be confusing. I think there should only be an enable, update, override version, and use with a custom command box.
Right now, the update box actually depends on the install box also being checked.
If the DirectX version can't be reliably acquired, one idea is to add a drop-down menu where you can specify the API (this might actually be useful anyway for overriding what the .dll is installed as ex: dx11 can actually be installed as
dxgi.dll
ord3d11.dll
in case you have a mod installed todxgi.dll
Logs
steamtinkerlaunch.log
TODO List
The text was updated successfully, but these errors were encountered: