Fix issue with game settings breaking new saves.

This commit is contained in:
MichaelTheShifter 2016-07-05 19:30:28 -04:00
parent b2b7d4c442
commit 73ec1f27ba

View file

@ -54,17 +54,6 @@ static void Main(string[] args)
poolThread.Start();
//Start the Windows Forms backend
Paths.RegisterPaths(); //Sets ShiftOS path variables based on the current OS.
if (File.Exists(Paths.SystemDir + "settings.json"))
{
API.LoadedSettings = JsonConvert.DeserializeObject<Settings>(File.ReadAllText(Paths.SystemDir + "settings.json"));
}
else
{
API.LoadedSettings = new Settings();
API.LoadedSettings.MusicVolume = 50;
File.WriteAllText(Paths.SystemDir + "settings.json", JsonConvert.SerializeObject(API.LoadedSettings));
}
Audio.LoadAudioData();
SaveSystem.Utilities.CheckForOlderSaves(); //Backs up C:\ShiftOS on Windows systems if it exists and doesn't contain a _engineInfo.txt file telling ShiftOS what engine created it.
//If there isn't a save folder at the directory specified by ShiftOS.Paths.SaveRoot, create a new save.
//If not, load that save.
@ -76,6 +65,17 @@ static void Main(string[] args)
{
SaveSystem.Utilities.NewGame();
}
if (File.Exists(Paths.SystemDir + "settings.json"))
{
API.LoadedSettings = JsonConvert.DeserializeObject<Settings>(File.ReadAllText(Paths.SystemDir + "settings.json"));
}
else
{
API.LoadedSettings = new Settings();
API.LoadedSettings.MusicVolume = 50;
File.WriteAllText(Paths.SystemDir + "settings.json", JsonConvert.SerializeObject(API.LoadedSettings));
}
Audio.LoadAudioData();
//Load ShiftOS skin
Skinning.Utilities.loadskin();
SaveSystem.ShiftoriumRegistry.UpdateShiftorium();