File saved with full of zeros
Posted: Sat Sep 23, 2023 3:04 am
I received reports from players that their save file is corrupted, and I found one of the save file is full of zeros instead of normal json format.
There are currently two save slots, one is normal and one is auto save, the auto save appears to be fine.
The attached zip file contains the save file with all zeros and the auto save file that is normal.
The code related to saving is
There are currently two save slots, one is normal and one is auto save, the auto save appears to be fine.
The attached zip file contains the save file with all zeros and the auto save file that is normal.
The code related to saving is
Code: Select all
private async UniTask SaveWorldAsync(bool useAutoSave = false)
{
this.Log($"SaveWorldAsync".ColorRed(), "Start Saving", $"IsAutoSave {useAutoSave}",
"World Identifier: " + CurrentWorldIdentifier);
if (!Global.code)
{
this.LogWarning("Not in Game Scene, returning");
return;
}
var worldSaveFilePath = GetWorldSaveFilePath(useAutoSave);
var es3Settings = new ES3Settings(worldSaveFilePath, ES3.Location.Cache);
await SaveApplicationVersionAsync(es3Settings);
await SaveEnemyAsync(es3Settings);
await SaveEnviroTimeAsync(es3Settings);
await SaveWeatherAsync(es3Settings);
await SaveItemSpawnersAsync(es3Settings);
await SaveFishSpawnersAsync(es3Settings);
await SaveArmyAsync(es3Settings);
await SaveSleepStateAsync(es3Settings);
await SaveDestroyedObjectsAsync(es3Settings);
await SaveLearnedItemsAsync(es3Settings);
await SaveUnlockItemsAsync(es3Settings);
await SaveDiscardItemsAsync(es3Settings);
await SaveDropBagsAsync(es3Settings);
await SaveCollectableAsync(es3Settings);
await SaveRadioSystemAsync(es3Settings);
await SaveLocationsAsync(es3Settings);
await SaveBuildingAsync(es3Settings);
try
{
await Task.Run(() => { ES3.StoreCachedFile(worldSaveFilePath); });
}
catch (Exception e)
{
HandleException($"{LocalizedHints.SaveErrorHint}_{Application.version}", e.Message, e);
}
this.LogSuccess($"SaveWorldAsync".ColorRed(), "Finished Saving",
"World Identifier: " + CurrentWorldIdentifier);
}