mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-04-27 01:17:19 +00:00
Merge a58cf0cc39 into d4ac3cd645
This commit is contained in:
commit
c772dd97b6
|
|
@ -178,6 +178,9 @@ enum eGameSetting
|
|||
// PSVita
|
||||
eGameSetting_PSVita_NetworkModeAdhoc,
|
||||
|
||||
// Add setting data version
|
||||
eGameSetting_SettingDataVersion,
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -108,6 +108,8 @@ typedef struct
|
|||
// was 192
|
||||
//unsigned char ucUnused[192-TUTORIAL_PROFILE_STORAGE_BYTES-sizeof(DWORD)-sizeof(char)-sizeof(char)-sizeof(char)-sizeof(char)-sizeof(LONG)-sizeof(LONG)-sizeof(DWORD)];
|
||||
// 4J-PB - don't need to define the padded space, the union with ucReservedSpace will make the sizeof GAME_SETTINGS correct
|
||||
|
||||
unsigned int uiSettingDataVersion;
|
||||
};
|
||||
|
||||
unsigned char ucReservedSpace[192];
|
||||
|
|
|
|||
|
|
@ -88,6 +88,8 @@ int CMinecraftApp::s_iHTMLFontSizesA[eHTMLSize_COUNT] =
|
|||
#endif
|
||||
};
|
||||
|
||||
// jvnpr -- update this anytime settingfixer needs to convert old settings to new settings!
|
||||
const int currentSettingDataVersion = 1;
|
||||
|
||||
CMinecraftApp::CMinecraftApp()
|
||||
{
|
||||
|
|
@ -814,10 +816,23 @@ static void Win64_LoadSettings(GAME_SETTINGS *gs)
|
|||
if (fread(&temp, sizeof(GAME_SETTINGS), 1, f) == 1)
|
||||
memcpy(gs, &temp, sizeof(GAME_SETTINGS));
|
||||
fclose(f);
|
||||
CMinecraftApp::SetSettingsFileLoaded(true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool CMinecraftApp::settingFileLoaded = false;
|
||||
|
||||
void CMinecraftApp::SetSettingsFileLoaded(bool loaded)
|
||||
{
|
||||
settingFileLoaded = loaded;
|
||||
}
|
||||
|
||||
bool CMinecraftApp::GetSettingsFileLoaded()
|
||||
{
|
||||
return settingFileLoaded;
|
||||
}
|
||||
|
||||
void CMinecraftApp::InitGameSettings()
|
||||
{
|
||||
for(int i=0;i<XUSER_MAX_COUNT;i++)
|
||||
|
|
@ -926,6 +941,8 @@ int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS *pSettings,con
|
|||
app.SetGameHostOption(eGameHostOption_NaturalRegeneration, 1 );
|
||||
app.SetGameHostOption(eGameHostOption_DoDaylightCycle, 1 );
|
||||
|
||||
app.SetGameSettings(iPad, eGameSetting_SettingDataVersion, currentSettingDataVersion);
|
||||
|
||||
// 4J-PB - leave these in, or remove from everywhere they are referenced!
|
||||
// Although probably best to leave in unless we split the profile settings into platform specific classes - having different meaning per platform for the same bitmask could get confusing
|
||||
//#ifdef __PS3__
|
||||
|
|
@ -1384,6 +1401,7 @@ void CMinecraftApp::ApplyGameSettingsChanged(int iPad)
|
|||
|
||||
ActionGameSettings(iPad,eGameSetting_PS3_EULA_Read);
|
||||
|
||||
ActionGameSettings(iPad,eGameSetting_SettingDataVersion);
|
||||
}
|
||||
|
||||
void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
|
||||
|
|
@ -1618,6 +1636,40 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
|
|||
case eGameSetting_PSVita_NetworkModeAdhoc:
|
||||
//nothing to do here
|
||||
break;
|
||||
case eGameSetting_SettingDataVersion:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CMinecraftApp::SettingFixer() // jvnpr -- used to convert settings data when necessary
|
||||
{
|
||||
int iPad = ProfileManager.GetPrimaryPad();
|
||||
|
||||
unsigned int version = GameSettingsA[iPad]->uiSettingDataVersion;
|
||||
|
||||
if (GetSettingsFileLoaded())
|
||||
{
|
||||
if (version != currentSettingDataVersion)
|
||||
{
|
||||
DebugPrintf("[SettingFixer]: Fixing Settings!\n");
|
||||
|
||||
// perform fixing up
|
||||
|
||||
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
|
||||
{
|
||||
DebugPrintf("[SettingFixer]: No settings file found, nothing to do.\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2328,7 +2380,14 @@ void CMinecraftApp::SetGameSettings(int iPad,eGameSetting eVal,unsigned char ucV
|
|||
GameSettingsA[iPad]->bSettingsChanged=true;
|
||||
}
|
||||
break;
|
||||
case eGameSetting_SettingDataVersion:
|
||||
|
||||
if (GameSettingsA[iPad]->uiSettingDataVersion != ucVal)
|
||||
{
|
||||
GameSettingsA[iPad]->uiSettingDataVersion = ucVal;
|
||||
ActionGameSettings(iPad, eVal);
|
||||
GameSettingsA[iPad]->bSettingsChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2463,7 +2522,9 @@ unsigned char CMinecraftApp::GetGameSettings(int iPad,eGameSetting eVal)
|
|||
|
||||
case eGameSetting_PSVita_NetworkModeAdhoc:
|
||||
return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_PSVITANETWORKMODEADHOC)>>17;
|
||||
|
||||
|
||||
case eGameSetting_SettingDataVersion:
|
||||
return GameSettingsA[iPad]->uiSettingDataVersion;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,6 +237,11 @@ public:
|
|||
#endif
|
||||
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);
|
||||
unsigned char GetGameSettings(int iPad,eGameSetting eVal);
|
||||
|
|
|
|||
|
|
@ -1300,6 +1300,7 @@ static Minecraft* InitialiseMinecraftRuntime()
|
|||
return nullptr;
|
||||
|
||||
app.InitGameSettings();
|
||||
app.SettingFixer();
|
||||
app.InitialiseTips();
|
||||
|
||||
return pMinecraft;
|
||||
|
|
|
|||
Loading…
Reference in a new issue