PrivateProfileRedirector LE – Faster game start (INI file cacher)

Skyrim Mods |

PrivateProfileRedirector LE – Faster game start (INI file cacher)

Speeds up game start by storing INI files in memory instead of opening, parsing and closing the file each time some value from it is needed.

Problem
The problem this plugin tries to solve comes from the fact that the game uses an old, deprecated and extremely inefficient function to load values from INI files. The function in question is GetPrivateProfileString, a relic of 16 bit operating systems. But do you know what is worse than using such a function? Using it hundreds of thousands of times.Apparently the game uses that function for every game setting individually, which means that the same ini file is opened and closed hundreds of times. What really makes this terrible is the fact that for each enabled plugin the game will attempt to read all the same settings from a hypothetical INI file that that plugin might or might not be loading. So you end up with an insane amount of incredibly inefficient calls for each enabled mod plugin. As a solution this mod will hook the functions involved and load the target INI files in memory so that each following call to the same INI file will be much faster as it will read directly from memory and will not require opening the file from scratch again.

The amount of seconds that this mod will reduce your start time by depends on the amount of enabled plugins you have, as well as other things using INI files such as ENB (though ENB comes with it’s own loading issues that this mod can’t fix). It will be basically imperceptible when used on the vanilla game and will go up from there, shaving off 6 seconds for 50 or so plugins, up to 20+ seconds for 250+ plugins.

Solution
When the game, ENB or something else calls GetPrivateProfileString first time this plugin will load requested file in memory and return required data. Next time, no file will be loaded and data will be fetched from memory as well. Same thing happens when process tries to write a value to file. Instead of opening file again, parse and save to disk the plugin will write data it to in-memory file and then saves to disk (if allowed). Also all files is saved on game close, if game won’t crash in process.

Plugin source is available on GitHub.

Requirements
SKSE, SKSE Plugin Preloader.

Installation
It’s an SKSE plugin, so install like any other SKSE plugin. Extract archive in your game folder or use a mod manager.

Uninstallation
Use mod manager or remove all installed files.

Covered functions
GetPrivateProfileStringA
GetPrivateProfileStringW
WritePrivateProfileStringA
WritePrivateProfileStringW
GetPrivateProfileIntA
GetPrivateProfileIntW
GetPrivateProfileSectionNamesA
GetPrivateProfileSectionNamesW
GetPrivateProfileSectionA
GetPrivateProfileSectionW

Configuration
Plugin can be configures in its own INI file (PrivateProfileRedirector.ini), each parameter is described inside this file.

Q&A
Q: Do I really need this?
A: It depends. If your game starts from shortcut to main menu in split second then no. If it takes longer, this plugin can help. How much time you will save depends on your setup.

Q: Will this work with MO/NMM/Vortex/Kortex (yeah, I had to mention it) or any other mod manager?
A: It was tested with MO2, Vortex and Kortex and no problems was found. NMM have not been tested yet but are expected to work just fine. I can’t say anything about compatibility with other mod managers.

Q: I’ve installed it and game crashes at startup (or you have any other problem).
A: Enable log in config file and reproduce your crash. Go to My Games\Skyrim\SKSE directory, look for file PrivateProfileRedirector.log, zip it, upload it somewhere and post a link to it in your issue report. Log file can be more that 100 MB, so don’t upload it as is, be sure to compress it.

Q: There is new version of Skyrim and/or SKSE, can I use this version with new game/SKSE version?
A: Redirector itself doesn’t need Script Extender to function. The only thing that depends on SKSE is overriding of “RefreshINI” console command to reload files from disk to update cached INI files. If you load Redirector without SKSE or with newer or older version of SKSE the Redirector will not override “RefreshINI” but still will function as usual. So you can use this plugin with any game and SKSE version.

If you absolutely need “RefreshINI” command to work with this plugin and I haven’t had time to update it, you can disable Script Extender version check in PrivateProfileRedirector.ini file. Open it, find option AllowSEVersionMismatch and change its value to 1.

Thanks to everyone who helped test the plugin, especially AL12.


Author: Karandra
This content was uploaded by website visitors. If you notice any mistake, please let us know.



Useful Information:

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *