


This tool has been made by HijackHornet and is now reworked and mantain by me under an MIT license. This 'mod' is actually an API for developers willing to implement an auto-update feature for their mod in only one function call. As a user of the mod, every other mod using Hj Updater API will be updated automatically while you are playing. As a developer, many options are available for you to decide how the update should behave. If you only want to warn the mod user that an update is available, Hj will provide you an easy way to do so.
I won't enter the details but BepInEx loads all of your mods into your RAM when you start the game. That means that while still playing, modification to the mods files are possible without impacting your gameplay experience. For mods that require runtime access to files resources (assets, sandbanks,etc.)., Hj will wait for you to close the game before deploying the changes.
About 5 minutes for one dll mods, maybe 10 for complex mods with multiple non embed ressources. The docs seems hard but just add the dependency and copypast one of the case study if you don't want to enter into the details.
Yes. Every update is logged, and every old mod version is kept into a Backup folder under BepInEx/plugin/HijackHornet-HjUpdaterAPI/Backup. Also, Hj create an interface between mods and the folder structure in which they exist. So no matter if a user put the dll file into the root of /plugin or into a folder inside another folder named pepeDontLikeToFeel : the mod will still update and keep this folder structure.
As a user, you can install this mod by unzipping the archive into the plugin folder. Don't forget to add BOTH dll next to each other.
However, this mod won't do anything if the other mods you are using aren't compatible with it. Some mods might put Hj as a dependency, forcing you to install it, while others might only suggest you install it because they made their mod compatible.
If a mod has been updated automatically but the update is broken and you would like to use the backup files (previous version), you should change values in the config file as you please. Just go to /BepInEx/config/hjupdaterapi.config and change things according to your preferences. You can even choose to overwriter modders decisions over what type of update should be performed.
As a modder, you can use Hj function to add an update behaviour for your mod. It's very simple to do and should provide enough flexibility to work with basically any mod. Here is how to setup Hj into your mods. It also ensures that if your mod end up being deprecated, it will be automatically deactivated on users’ computers. I'm available to help you getting it setup, just pm me on the modded discord : @Hijack Hornet.
In Visual Studio (or whatever IDE you use) add both dll included in the mod download link into your library folder, and add a reference to them into your project settings.
You can choose to HjUpdaterAPI as a dependency so that you are assured that everyone using it will get the latest version or at least be informed that a new version is available. However you can also choose to add it has an optional dependency and check in the awake function if the mod is installed and if so perform the command call. To add it as required dependency (recommanded) :
//manifest.json
{
"name": "MyModName",
"version_number": "1.2.1",
"website_url": "myWebSite",
"description": "Restart a run with a simple key !",
"dependencies": [
"bbepis-BepInExPack-3.0.0",
"HijackHornet-HjUpdaterAPI-1.2.0" <--- Add this !
]
}
//Your mod class
[BepInDependency(HjUpdaterAPI.GUID)] //Add this
No need to update the dependency version when HjUpdaterApi will be updated.
To add it as an optional dependency, just put a if statement arround the static function like this :
if (BepInEx.Bootstrap.Chainloader.PluginInfos.ContainsKey(HjUpdater.GUID)){
Register("MyModName");
}
First add the namespace usage at the beginning of your mods main class.
using Hj;
//your other namespace
Now go into your awake function (it has to be put into Awake and not into Start) and call the register function :
void Awake(){
HjUpdaterAPI.Register(
string packageName,
[enum flag],
[List<string> otherFilesLocationRelativeToTheDll],
[bool modUseRuntimeRessourceLoading]
);
}
Let's go through each parameter
Mandatory parameters
Optional parameters
By default, UpdateIfSameDependencyOnlyElseWarnOnly is used.
DO NOT use UpdateAlways except if you know what you are doing. It could be useful for instance if you know that the next dependency update will not break your mod, but it's risky and could end up breaking your mod.
That's it ! Your mod is now able to self-update at runtime when newer versions are uploaded on the thunderstore.
void Awake(){
Register("MyModNameAsInTheManifest");
//...your other function calls
}
void Awake(){
List<string> files = new List<string>();
files.Add('mySecondDll.dll');
Register(
"MyModNameAsInTheManifest",
HjUpdaterAPI.Flag.WarnOnly
);
//...your other function calls
}
void Awake(){
List<string> files = new List<string>();
files.Add('mySecondDll.dll');
Register(
"MyModNameAsInTheManifest",
HjUpdaterAPI.Flag.UpdateIfSameDependencyOnlyElseWarnOnly,
files
);
//...your other function calls
}
void Awake(){
List<string> files = new List<string>();
files.Add('/asset/myAssetPack.asset');
files.Add('/font/myFont.ttf');
files.Add('/sounds/mySoundBank.bnk');
Register(
"MyModNameAsInTheManifest",
HjUpdaterAPI.Flag.UpdateIfSameDependencyOnlyElseWarnOnly,
files,
true
);
//...your other function calls
}
I'm available on the ROR2 Official discord server (@Lodington).
Thanks to HijackHornet for making the base of this and letting me take it back after he left the modding community.