mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-07-09 18:57:04 +00:00
Merge a58cf0cc39 into 09df8928ee
This commit is contained in:
commit
8c66037bb4
|
|
@ -178,6 +178,9 @@ enum eGameSetting
|
||||||
// PSVita
|
// PSVita
|
||||||
eGameSetting_PSVita_NetworkModeAdhoc,
|
eGameSetting_PSVita_NetworkModeAdhoc,
|
||||||
|
|
||||||
|
// Add setting data version
|
||||||
|
eGameSetting_SettingDataVersion,
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,8 @@ typedef struct
|
||||||
// was 192
|
// 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)];
|
//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
|
// 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];
|
unsigned char ucReservedSpace[192];
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,8 @@ int CMinecraftApp::s_iHTMLFontSizesA[eHTMLSize_COUNT] =
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// jvnpr -- update this anytime settingfixer needs to convert old settings to new settings!
|
||||||
|
const int currentSettingDataVersion = 1;
|
||||||
|
|
||||||
CMinecraftApp::CMinecraftApp()
|
CMinecraftApp::CMinecraftApp()
|
||||||
{
|
{
|
||||||
|
|
@ -814,10 +816,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++)
|
||||||
|
|
@ -926,6 +941,8 @@ int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS *pSettings,con
|
||||||
app.SetGameHostOption(eGameHostOption_NaturalRegeneration, 1 );
|
app.SetGameHostOption(eGameHostOption_NaturalRegeneration, 1 );
|
||||||
app.SetGameHostOption(eGameHostOption_DoDaylightCycle, 1 );
|
app.SetGameHostOption(eGameHostOption_DoDaylightCycle, 1 );
|
||||||
|
|
||||||
|
app.SetGameSettings(iPad, eGameSetting_SettingDataVersion, currentSettingDataVersion);
|
||||||
|
|
||||||
// 4J-PB - leave these in, or remove from everywhere they are referenced!
|
// 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
|
// 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__
|
//#ifdef __PS3__
|
||||||
|
|
@ -1381,6 +1398,7 @@ void CMinecraftApp::ApplyGameSettingsChanged(int iPad)
|
||||||
|
|
||||||
ActionGameSettings(iPad,eGameSetting_PS3_EULA_Read);
|
ActionGameSettings(iPad,eGameSetting_PS3_EULA_Read);
|
||||||
|
|
||||||
|
ActionGameSettings(iPad,eGameSetting_SettingDataVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
|
void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
|
||||||
|
|
@ -1615,6 +1633,40 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
|
||||||
case eGameSetting_PSVita_NetworkModeAdhoc:
|
case eGameSetting_PSVita_NetworkModeAdhoc:
|
||||||
//nothing to do here
|
//nothing to do here
|
||||||
break;
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2325,7 +2377,14 @@ void CMinecraftApp::SetGameSettings(int iPad,eGameSetting eVal,unsigned char ucV
|
||||||
GameSettingsA[iPad]->bSettingsChanged=true;
|
GameSettingsA[iPad]->bSettingsChanged=true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case eGameSetting_SettingDataVersion:
|
||||||
|
|
||||||
|
if (GameSettingsA[iPad]->uiSettingDataVersion != ucVal)
|
||||||
|
{
|
||||||
|
GameSettingsA[iPad]->uiSettingDataVersion = ucVal;
|
||||||
|
ActionGameSettings(iPad, eVal);
|
||||||
|
GameSettingsA[iPad]->bSettingsChanged = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2460,7 +2519,9 @@ unsigned char CMinecraftApp::GetGameSettings(int iPad,eGameSetting eVal)
|
||||||
|
|
||||||
case eGameSetting_PSVita_NetworkModeAdhoc:
|
case eGameSetting_PSVita_NetworkModeAdhoc:
|
||||||
return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_PSVITANETWORKMODEADHOC)>>17;
|
return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_PSVITANETWORKMODEADHOC)>>17;
|
||||||
|
|
||||||
|
case eGameSetting_SettingDataVersion:
|
||||||
|
return GameSettingsA[iPad]->uiSettingDataVersion;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -237,6 +237,11 @@ 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);
|
||||||
|
|
|
||||||
|
|
@ -1300,6 +1300,7 @@ static Minecraft* InitialiseMinecraftRuntime()
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
app.InitGameSettings();
|
app.InitGameSettings();
|
||||||
|
app.SettingFixer();
|
||||||
app.InitialiseTips();
|
app.InitialiseTips();
|
||||||
|
|
||||||
return pMinecraft;
|
return pMinecraft;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue