Automatic retrieval of requested shaders at run time

More
6 months 2 weeks ago #1 by lufusol
One of the major flaws with ReShade at the time you run the setup file to install it to a specific executable's directory is that the user must choose from a list of default repositories, without knowing exactly which shaders are contained in those repositories before proceeding to the next step.  After proceeding, the user can then select which shaders to include per each repository, but there's no going back to the previous step.  If a mistake is made or the needed shaders aren't found, the user must complete the setup process and then start it over from the beginning, to make new choices.

Rather than requiring them to manually select ANY repositories during the setup stage, wouldn't it be great if the first time ReShade loads (within the game) and a preset is selected, it enumerates the requested shaders defined in the preset .INI and, if any are not found, calls back the setup tool to go and download these shaders from the corresponding repository, in realtime, then reload itself, in realtime?  With a friendly little status message to let you know it's doing just that?

Of course, not every shader that will be called for can be found among the default group of repositories.  Currently, the setup tool allows you to manually add links custom repositories which will then be pulled and added to the configuration as normal.  However, wouldn't it be great if preset creators could define links to any custom repositories needed within their preset file, so that ReShade could then send this information back to the setup tool if the setup tool reports that any requested shaders were not found amongst the default repositories?

This would make ReShade a very user-friendly and painless experience.  It would also give consistent results for people per-preset, regardless of how they initially chose to configure their setup.

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

More
6 months 2 weeks ago #2 by lufusol
Here's how I imagine this working (the broad strokes)

The setup tool is given a semi-permanent location where it can live, instead of being entirely disposable as it is now.

Any time the setup tool is run against an executable (to create a new ReShade instance), the location of the setup tool is added to that instance's configuration file. Also, the location of that instance is added to an array file stored with the setup tool. This gives the setup tool the dual abilities of caching info about which executables ReShade instances have been installed to, which can be shown in the UI for easy management of existing installations, as well as each time the setup tool is launched it can check to see that each ReShade instance is still where it left it, and moreover, if the user has changed the location of the setup tool, the tool can update the configuration file of each ReShade instance listed in the array with its new location. This is just for user friendly fault tolerance, because people like to rearrange things.

The setup tool then behaves as usual, however making the shader selection step(s) completely optional. Advanced users can do as they please, novice users can simply be done with it. However, shaders that are installed to the instance during setup time are also cached in a subfolder local to the setup tool.

When an instance of ReShade is loaded, and then a preset selected, this is where the new magic happens.  ReShade quickly checks to see that every shader called for in the preset is present under the reshade-shaders folder structure. If any are not, it looks to see if the setup tool exists in the location defined in its configuration file.  If not, it prompts the user to locate it, otherwise it calls for the setup tool to be run, and communicates which shaders it wants.

The setup tool then first checks its local cache for the requested shaders and delivers any back to the location of the ReShade instance which requested it, using the instance's location in the setup tool's array.  Then, any shaders not found in the tool's local cache are first sought from the default shader repositories, which are then downloaded and passed into the reshade-shaders folder of the requesting instance. Any remaining shaders that have been requested will need their respository's URI defined in the preset by its creator, so that the setup tool can be told where to grab them. If they are not, the user is informed that they could not be located.  The tool then does its thing, and the ReShade instance should now be able to find all the necessary shaders for that preset in its reshade-shaders folder. Mind you, the setup tool has also cached every shader it's grabbed during this process.

The next time any preset is loaded, the same process occurs but whether or how long there will be a delay before ReShade can load and apply the preset will depend on whether all shaders were found in the local instance, all shaders were cached by the setup tool and able to be passed to the instance immediately, or the setup tool has to go retrieve additional shaders over the interballs. All with status messages for the user while this process occurs.

If a new version of ReShade setup tool is installed, it ought to first look for the array of existing instances and read that, if possible. Otherwise the user will have to point it to the executable they want to setup, as they do now, and it will simply update the instance's configuration file and its own array automatically. This way, if users replace the setup tool with a newer version or delete the setup tool after installing instances and then later download and reinstall it, the most a user has to do is point it each time they change an instance's config (as they already do now), and wait for it to rebuild its cache of shaders if that was lost.

Okay, while I was writing this I thought of a couple other possible iimprovements:
1- the setup tool could also check other known reshade instances stored in its array for the requested shaders, if for some reason they exist there but not in its own cache, before going online to download them.
2- wait, why are copies of shaders being stored with each instance of ReShade anyway? Could they not ALL exist along with the setup tool, and just use symbolic links within each instance?

I know, I'm crazy.

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