-
-
Notifications
You must be signed in to change notification settings - Fork 47
Description
Currently, thcrap_configure generates a single patch stack configuration for all games, which includes all base patches (at this time base_tsa and base_tasforo.
This allows users to e.g. only configure TSA games, and to then add tasforo games to games.js later on.
However, This creates a significant overhead for patches, since thcrap has to search through each patch in the current stack when a file is requested.
This seems to be especially noticable in tasforo games.
Once the game has been identified, we only need one base patch (the one that is relevant to the current game) to be loaded.
This would reduce the overhead and allow for the addition of more base patches without affecting the performance of the already existing patches.
I can think of three ways to accomplish this:
- Remove base patches irrelevant to the current game as soon as it has been identified
This was already implemented in thcrap previously (e9f126a) on a by-patch basis but later removed since wrapper patches (vpatch, thprac) cause thcrap to go through the patch-initialization step multiple times (9f9f95c).
However, we could do the patch stack pruning only once the game has been positively identified (which is after all of the wrapper patches are done, but before any of the plugins are loaded).
See e21eb67 (corresponding branch) for an example implementation of this.
This is definitely the easiest to implement, and doesn't require a reconfiguration. - Load base patches dynamically, instead of including them in the configuration
Since base patches are somewhat special, maybe they shouldn't be included in the patch configuration at all.
Instead, thcrap could look through all base patches when starting, and only adding a base patch to the stack if it identified the game by hash or size.
This also wouldn't be that hard to implement, but would require a reconfiguration of patches. It would also clash with the updater. - Create different patch configurations per base patch when configuring games
Since the main reason to keep every base patch in the stack is to allow users to change theirconfig.jslater on, maybe thcrap_configure could generate multiple configuration variants with different base patches (en-tsa.js,en-tasforo.js) etc. The user would then only need to change the patch stack depending on the game.
This would also require a reconfiguration.