mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 09:50:43 -05:00
Save virtual registry on application quit (#22)
- Explicitly call PlayerPrefs.Save on application quit, since Unity doesn't seem to do it (any more?) - Remove previously added Save calls from Set methods
This commit is contained in:
commit
77aa9496a0
@ -61,6 +61,9 @@ namespace SPT.Custom.Patches
|
|||||||
{
|
{
|
||||||
ConsoleScreen.LogError($"Unable to parse registry file, defaulting to empty: {e.Message}");
|
ConsoleScreen.LogError($"Unable to parse registry file, defaulting to empty: {e.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure we save the registry on exit, for some reason this isn't triggering by Unity itself
|
||||||
|
Application.quitting += PlayerPrefs.Save;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PatchPlayerPrefsSetInt : ModulePatch
|
public class PatchPlayerPrefsSetInt : ModulePatch
|
||||||
@ -75,7 +78,6 @@ namespace SPT.Custom.Patches
|
|||||||
private static bool PatchPrefix(string key, int value)
|
private static bool PatchPrefix(string key, int value)
|
||||||
{
|
{
|
||||||
_sptRegistry[key] = value;
|
_sptRegistry[key] = value;
|
||||||
PlayerPrefs.Save();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -92,7 +94,6 @@ namespace SPT.Custom.Patches
|
|||||||
private static bool PatchPrefix(string key, float value)
|
private static bool PatchPrefix(string key, float value)
|
||||||
{
|
{
|
||||||
_sptRegistry[key] = value;
|
_sptRegistry[key] = value;
|
||||||
PlayerPrefs.Save();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -109,7 +110,6 @@ namespace SPT.Custom.Patches
|
|||||||
private static bool PatchPrefix(string key, string value)
|
private static bool PatchPrefix(string key, string value)
|
||||||
{
|
{
|
||||||
_sptRegistry[key] = value;
|
_sptRegistry[key] = value;
|
||||||
PlayerPrefs.Save();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user