Closed liuxd17thu closed 1 year ago
Thanks for the fix! I inlined the variable usage which are used once in DllMain() pre-merge :)
Note that crosire himself recommends using get_reshade_base_path() for this.
Hmm that would have been a better choice indeed. Will add a comment to the code. It's not a big deal as the code merged is copied from reshade it seems (and uses win32 to get the file path) but it's more code than this call would have been.
Just found a real-world use case for get_reshade_base_path()
: I tried centralizing my add-ons in one folder using the folder selector at the top of the add-ons tab so I don't have to go around and replace all copies of all add-ons for each game when a new version is released. In this configuration and with this PR, ShaderToggler.ini
predictably ends up in the centralized add-ons folder, meaning you can't have separate profiles for each game. The correct logic would be to store ShaderToggler.ini
next to ReShade.ini
wherever that's located, which get_reshade_base_path()
should accomplish.
I didn't realize there was a way to have all addons in a central place! that's great, because I have all my shaders in a central place but the addons are copied around to each game.
Good point!
@blackwind See #18 I can't use the api method as in DllMain the runtime object isn't available and the ini file has to be read at startup. However using the host exe's path works fine with a central location of the addons: the ini file is stored at the right location, where the dxgi file is located as well (or the exe file, in case of vulkan with centralized storage of the reshade dll)
Note, though, that the RESHADE_BASE_PATH_OVERRIDE
environment variable exists. This is how Special K makes ReShade dump its files into Special K's per-game profile folder, and that's where I expect add-on data to be stored as well. If the API can't be used, perhaps the environment variable itself could be checked for an override instead?
How nice I get info fed one info bit at a time so I can fix a fix on a fix. :(
Will think about it
(edit) The ini file for shadertoggler is stored in the exe's folder, where it normally would reside, using special K or not. So I think that's enough for now.
When using shader toggler in some games with a launcher, the ini file goes into the directory of launcher, instead of the same directory as the addon itself. I made a easy fix, generally the same way as what REST did.