mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
create check for existing setting file, write new data version to file after fix-up
This commit is contained in:
parent
6449cd82c3
commit
a58cf0cc39
|
|
@ -794,10 +794,23 @@ static void Win64_LoadSettings(GAME_SETTINGS *gs)
|
||||||
if (fread(&temp, sizeof(GAME_SETTINGS), 1, f) == 1)
|
if (fread(&temp, sizeof(GAME_SETTINGS), 1, f) == 1)
|
||||||
memcpy(gs, &temp, sizeof(GAME_SETTINGS));
|
memcpy(gs, &temp, sizeof(GAME_SETTINGS));
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
CMinecraftApp::SetSettingsFileLoaded(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool CMinecraftApp::settingFileLoaded = false;
|
||||||
|
|
||||||
|
void CMinecraftApp::SetSettingsFileLoaded(bool loaded)
|
||||||
|
{
|
||||||
|
settingFileLoaded = loaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CMinecraftApp::GetSettingsFileLoaded()
|
||||||
|
{
|
||||||
|
return settingFileLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
void CMinecraftApp::InitGameSettings()
|
void CMinecraftApp::InitGameSettings()
|
||||||
{
|
{
|
||||||
for(int i=0;i<XUSER_MAX_COUNT;i++)
|
for(int i=0;i<XUSER_MAX_COUNT;i++)
|
||||||
|
|
@ -1606,26 +1619,36 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMinecraftApp::SettingFixer()
|
void CMinecraftApp::SettingFixer() // jvnpr -- used to convert settings data when necessary
|
||||||
{
|
{
|
||||||
unsigned int version = ProfileManager.GetPrimaryPad()]->uiSettingDataVersion
|
int iPad = ProfileManager.GetPrimaryPad();
|
||||||
|
|
||||||
if (GameSettingsA[version != currentSettingDataVersion)
|
unsigned int version = GameSettingsA[iPad]->uiSettingDataVersion;
|
||||||
|
|
||||||
|
if (GetSettingsFileLoaded())
|
||||||
{
|
{
|
||||||
DebugPrintf("[SettingFixer]: Fixing Settings!\n");
|
if (version != currentSettingDataVersion)
|
||||||
|
{
|
||||||
|
DebugPrintf("[SettingFixer]: Fixing Settings!\n");
|
||||||
|
|
||||||
/* ex:
|
// perform fixing up
|
||||||
if (version < 1) fix v1 setting changes;
|
|
||||||
if (version < 2) fix v2 setting changes;
|
GameSettingsA[iPad]->uiSettingDataVersion = currentSettingDataVersion;
|
||||||
...
|
GameSettingsA[iPad]->bSettingsChanged = true;
|
||||||
*/
|
CheckGameSettingsChanged(true, iPad);
|
||||||
|
|
||||||
|
DebugPrintf("[SettingFixer]: Settings fixed and saved.\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DebugPrintf("[SettingFixer]: Nothing to do.\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DebugPrintf("[SettingFixer]: Nothing to do.\n");
|
DebugPrintf("[SettingFixer]: No settings file found, nothing to do.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
GameSettingsA[ProfileManager.GetPrimaryPad()]->uiSettingDataVersion = currentSettingDataVersion;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMinecraftApp::SetPlayerSkin(int iPad,const wstring &name)
|
void CMinecraftApp::SetPlayerSkin(int iPad,const wstring &name)
|
||||||
|
|
|
||||||
|
|
@ -237,11 +237,15 @@ public:
|
||||||
#endif
|
#endif
|
||||||
virtual void SetRichPresenceContext(int iPad, int contextId) = 0;
|
virtual void SetRichPresenceContext(int iPad, int contextId) = 0;
|
||||||
|
|
||||||
|
// jvnpr -- SettingFixer & related checks
|
||||||
|
void SettingFixer();
|
||||||
|
static void SetSettingsFileLoaded(bool loaded);
|
||||||
|
static bool GetSettingsFileLoaded();
|
||||||
|
static bool settingFileLoaded;
|
||||||
|
|
||||||
void SetGameSettings(int iPad,eGameSetting eVal,unsigned char ucVal);
|
void SetGameSettings(int iPad,eGameSetting eVal,unsigned char ucVal);
|
||||||
unsigned char GetGameSettings(int iPad,eGameSetting eVal);
|
unsigned char GetGameSettings(int iPad,eGameSetting eVal);
|
||||||
unsigned char GetGameSettings(eGameSetting eVal); // for the primary pad
|
unsigned char GetGameSettings(eGameSetting eVal); // for the primary pad
|
||||||
void SettingFixer(); // jvnpr -- used to convert any old settings values to new settings based on uiSettingDataVersion / eGameSetting_SettingDataVersion
|
|
||||||
void SetPlayerSkin(int iPad,const wstring &name);
|
void SetPlayerSkin(int iPad,const wstring &name);
|
||||||
void SetPlayerSkin(int iPad,DWORD dwSkinId);
|
void SetPlayerSkin(int iPad,DWORD dwSkinId);
|
||||||
void SetPlayerCape(int iPad,const wstring &name);
|
void SetPlayerCape(int iPad,const wstring &name);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue