I'm unable to get saving working correctly after turning on AES encryption to my save files (I'm doing this to prevent direct edits to the local save).
Here is the code that is called:
Code: Select all
if (!GameServices.IsInitialized()) {
try {
// Cache a local file and load from it.
ES3Settings settings = new ES3Settings(ES3.EncryptionType.AES, "<REDACTED>");
ES3.CacheFile("progress.dat", settings);
} catch (System.IO.FileNotFoundException e) {
Debug.LogWarning("Could not cache file progress.dat because it does not exist");
}
}
If I start the game fresh (no save files), do some actions in a level, and then save the game, and then reload that level, I get this error:
Code: Select all
ArgumentException: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
ES3Internal.ES3Stream.CreateStream (System.IO.Stream stream, ES3Settings settings, ES3Internal.ES3FileMode fileMode) (at Assets/Plugins/Easy Save 3/Scripts/Streams/ES3Stream.cs:102)
ES3Reader.Create (System.Byte[] bytes, ES3Settings settings) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:348)
ES3File.SaveRaw (System.Byte[] bytes, ES3Settings settings) (at Assets/Plugins/Easy Save 3/Scripts/ES3File.cs:167)
ES3File..ctor (System.Byte[] bytes, ES3Settings settings) (at Assets/Plugins/Easy Save 3/Scripts/ES3File.cs:83)
ES3File.CacheFile (ES3Settings settings) (at Assets/Plugins/Easy Save 3/Scripts/ES3File.cs:355)
ES3.CacheFile (ES3Settings settings) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:1049)
ES3.CacheFile (System.String filePath, ES3Settings settings) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:1039)
VisionBreak.Sunsear.GameCore.GameManager.LoadPlayerDataFromMemory () (at Assets/Raptor Combat/Scripts/Game Manager/GameManager.cs:389)
VisionBreak.Sunsear.Core.StageLoader+<LoadStageAsynchronously>d__27.MoveNext () (at Assets/Sunsear/Scripts/StageLoader.cs:287)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)