Skip to content
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

Add option to install ReShade shaders #2

Closed
ultimatespirit opened this issue Feb 11, 2023 · 5 comments · Fixed by #3
Closed

Add option to install ReShade shaders #2

ultimatespirit opened this issue Feb 11, 2023 · 5 comments · Fixed by #3
Assignees
Labels
enhancement New feature or request

Comments

@ultimatespirit
Copy link

Hey again, just wanted to let you know that it seems like at least some preset/shader authors in the community (and probably all of them as time goes forward) are gearing their new releases around the assumption that the user just straight installed ReShade 5.6 while checking all the "install shaders" options. I.e. there's an assumption that reshade-shaders has everything in it that a normal ReShade 5.6 install would have (and only those to an extent).

As I've found, however, what GShade had is not necessarily the same as the above and so you may run into weird and exciting breakages from those differences.

So with that in mind, future-proofing wise it may be desirable to be able to only install the base reshade-shaders as done by the ReShade installation process. From here: https://github.com/kevinlekiller/reshade-steam-proton/blob/main/reshade-linux.sh#L305
It seems like a full installation wherein you checked all the optional shaders has the following repos merged into one reshade-shaders/{Shaders,Textures}, with some of the optional extras as sub-folders for the Shaders/ case.

https://github.com/CeeJayDK/SweetFX
https://github.com/martymcmodding/qUINT
https://github.com/BlueSkyDefender/AstrayFX
https://github.com/prod80/prod80-ReShade-Repository
https://github.com/crosire/reshade-shaders

I got a friend on Windows to do a fresh install to confirm the directory structure and at least by default it seems that reshade-shaders/Shaders does the following:

  • All files under Shaders in their respective git repos are copied directly to reshade-shaders/Shaders for the following:
    • SweetFX
    • reshade-shaders
  • All files under Shaders in their respective git repos are copied into a subdirectory within reshade-shaders/Shaders for the following:
    • qUINT - Subdirectory: reshade-shaders/Shaders/qUINT/
    • AstrayFX - Subdirectory: reshade-shaders/Shaders/AstrayFX (including another subdirect OneShot as in the repo)
    • prod80-ReShade-Repository - Subdirectory: reshade-shaders/Shaders/PD80/

The Textures directory remains flat, just a direct copy of all Textures/ folders from the above five repos.

If you wanted to be really fancy, as they're all git repositories, you could optionally depend upon git and git clone <url> all five of those repos (perhaps as shallow copies on first install), symlink them into the merged structure (as the kevinlekiller script does), and then use that structure accordingly. That way update operations can be as simple as git pull on all of them (or be even more fancy and setup the download area as a git repo that those 5 are subrepos of and then use a submodule recursive update to do all of them, that seems like overkill though).

Alternatively just straight zip download as per usual of course.

As a plus to all this, all involved repositories don't have asinine unenforceable provisions against downloading them, and some of them are even open source, so this can be automated.

Oh also as an additional bonus, here's the full text of the default ReShade.ini configuration file created for this type of installation (the subdirectories in reshade-shaders/Shaders are included explicitly rather than by using a wildcard catch all)

[APP]
ForceDefaultRefreshRate=0
ForceFullscreen=0
ForceVsync=0
ForceWindowed=0

[GENERAL]
EffectSearchPaths=.\reshade-shaders\Shaders,.\reshade-shaders\Shaders\qUINT,.\reshade-shaders\Shaders\PD80,.\reshade-shaders\Shaders\AstrayFX
PreprocessorDefinitions=RESHADE_DEPTH_LINEARIZATION_FAR_PLANE=1000.0,RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN=0,RESHADE_DEPTH_INPUT_IS_REVERSED=1,RESHADE_DEPTH_INPUT_IS_LOGARITHMIC=0
TextureSearchPaths=.\reshade-shaders\Textures

[INPUT]
GamepadNavigation=1
KeyOverlay=36,0,0,0
@cozyGalvinism
Copy link
Owner

Oh wow, thank you for bringing all of this together, this really makes my work a lot easier. I will probably get around to adding ReShade shaders either later today or some time during next week c: And like last issue, I agree with all of your points. We will most likely go down the same route the installer script uses:

  1. Clone the git repository
  2. Merge shaders and textures for updating
  3. When installing ReShade for a game, we can check if an ReShade.ini exists, if it doesn't we create one.

I wanted to do the INI part from the start, but I didn't have a good grasp on what a default INI looked like.

For git, I will probably end up using git2, since those are bindings to libgit2. If someone doesn't have libgit2 installed on their PC, the build script for git2 will compile it for them, or so the page of the crate says.

Although one improvement which could be done for the INI is to add the IntermediateCachePath and set it to ./reshade-shaders/Intermediate to have a consistent cache across runs. I don't know where ReShade keeps the intermediate cache by default, but setting it gives us control to not care about the default, even if it should change. Though I am open for input on that idea.

@cozyGalvinism cozyGalvinism self-assigned this Feb 12, 2023
@cozyGalvinism cozyGalvinism added the enhancement New feature or request label Feb 12, 2023
@cozyGalvinism cozyGalvinism changed the title May want to install / have the option to install the actual reshade-shaders defaults Add option to install ReShade shaders Feb 12, 2023
@ultimatespirit
Copy link
Author

It seems that the default it picks for IntermediateCachePath is: IntermediateCachePath=C:\users\steamuser\Temp\ReShade for a wine install. Which is basically just the windows equivalent of XDG_CACHE for the steamuser user.

So if we wanted to be in line with that we could use XDG_CACHE, or just keep it tossing into Temp (with the caveat that wine's Temp doesn't actually get deleted so you need to clean that area up now and then, I guess it could be setup to use the actual /tmp). However... I personally dislike wine tossing files outside of its own prefix by default, so I'm all for ignoring that and just setting IntermediateCachePath=.\reshade-shaders\Intermediate.

If modifying with sane defaults / being more in line with what gshade's defaults were, I'd also add that FileNaming=%Date%_%Time%_%PresetName% under the [SCREENSHOT] section should be in line with what gshade had by default I think. That or it was just my own personal default... Though I'd give my personal opinion that date + time + your preset in use is a much more sane default than ReShade's default which is just Application Name + Date + Time.

@cozyGalvinism
Copy link
Owner

I wouldn't put them into /tmp as that folder is cleared after a reboot (TMPTIME is set to 0 by default). If the default cache path is inside the temp folder of the prefix, that's fair game for me too, but since we symlink the shaders anyways, there's no need to recompile the intermediates on every installed game (unless that cache depends on the prefix/Wine version again, which would make the temp folder the best option).

And your file naming default is good, ReShade's %AppName% %Date% %Time% is... maybe not the best option, unless you only really play and take screenshots with the same preset. Though I think we should include %AppName% into it, so may I propose FileNaming=%Date%_%Time%_%AppName%_%PresetName% (although that makes the file name even longer...)

I'd love if you could specify these variables in the save path, so ReShade would save screenshots into a folder called [your save path]/%AppName%/%PresetName%/[screenshot file name], maybe it'd be a good feature request for ReShade.

@ultimatespirit
Copy link
Author

I mentioned /tmp solely because my understanding is on Windows \Temp functions the same as /tmp in that the files there are free game to be dumped after a reboot, though maybe I'm just misremembering and it's exactly what cache is in that it's okay to delete them, but won't be done automatically. It's a good point though about whether or not intermediate shaders are specific to the game, I'm not entirely sure as to the answer there though. I wouldn't expect them to be specific, and they certainly should not care about your wine version (maybe dxvk version, somehow, but that seems suspect) as they should be the compilations of the domain specific shader language .fx files for the chosen set of pre-processor definitions etc. Not really caring about game or runtime.

As for file name, if we're going to add the AppName may I propose having the AppName first then? I.e. %AppName%_%Date%_... I suspect if searching through a set of screenshots you will care first about which game it's from, and then the date, rather than strict chronological ordering across all game screenshots. That being said, personally, I'd end up just overwriting that default since I'd make a per-game ReShade.ini to be able to output the screenshots to an %AppName%/... directory....

Definitely agree that being able to specify at least the %AppName%, or perhaps an alias of it (introduce a new parameter that tells ReShade to override %AppName% to the alias, that way ffxiv_dx11 could be FFXIV or whatever is wanted), in the output path would be a great feature request... That being said I think we could make a.. somewhat cumbersome approximation by outright overriding the path in the Post-save command{, arguments} settings. Perhaps something like the following:

PostSaveCommand=optipng
PostSaveCommandArguments="-o 9 -preserve -quiet -out %TargetDir%\%AppName%\%TargetFileName %TargetPath%"

But I don't entirely trust the parameter quoting that the arguments variable will do, nor do I think it'll be as simple to just fork to a real Linux program from the wine run... I guess you could install into the directory a windows build and call that, or make a super simple program that just does the file system moves and nothing else. Honestly at that point probably easier to just setup a daemon watching the screenshot directory that asynchronously takes a %AppName%_%Date%... file, optimises it (if desired), and moves it to a proper %AppName%/... directory.

@ultimatespirit
Copy link
Author

ultimatespirit commented Feb 12, 2023

Unrelated to this issue directly, but since reshade has no issue tracker and I can't easily build it at the moment (not figuring out how to get the visual studio compilation working on Linux right now lol) to make a proper pull request, for your information... It seems that all that needs to be done is apply what's done here with expand_macro_string() to _screenshot_path before the screenshot_path construction step on line 4450 below. Basically same exact invocation too since we care about the same presets there.

Probably needs some change to an external facing documentation so that mouse over details you can use those macros like the way the other settings do currently, but getting the macro itself to work should be as simple as that. Would be a decently quick PR to make I guess, given being able to build ReShade easily in the first place haha.

EDIT: That being said looking at the code... screenshot_name may actually be allowed to be an outright path? It seems like it would get respected. May be worth trying FileNaming=%AppName%\%Date%_%Time%_%PresetName% with an appropriate _screenshot_path and just... see if it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants