diff options
Diffstat (limited to 'Minecraft.Client/Common/Consoles_App.cpp')
| -rw-r--r-- | Minecraft.Client/Common/Consoles_App.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index 0e02ab40..b476ca90 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -760,6 +760,43 @@ bool CMinecraftApp::LoadBeaconMenu(int iPad ,shared_ptr<Inventory> inventory, sh ////////////////////////////////////////////// // GAME SETTINGS ////////////////////////////////////////////// + +#ifdef _WINDOWS64 +static void Win64_GetSettingsPath(char *outPath, DWORD size) +{ + GetModuleFileNameA(NULL, outPath, size); + char *lastSlash = strrchr(outPath, '\\'); + if (lastSlash) *(lastSlash + 1) = '\0'; + strncat_s(outPath, size, "settings.dat", _TRUNCATE); +} +static void Win64_SaveSettings(GAME_SETTINGS *gs) +{ + if (!gs) return; + char filePath[MAX_PATH] = {}; + Win64_GetSettingsPath(filePath, MAX_PATH); + FILE *f = NULL; + if (fopen_s(&f, filePath, "wb") == 0 && f) + { + fwrite(gs, sizeof(GAME_SETTINGS), 1, f); + fclose(f); + } +} +static void Win64_LoadSettings(GAME_SETTINGS *gs) +{ + if (!gs) return; + char filePath[MAX_PATH] = {}; + Win64_GetSettingsPath(filePath, MAX_PATH); + FILE *f = NULL; + if (fopen_s(&f, filePath, "rb") == 0 && f) + { + GAME_SETTINGS temp = {}; + if (fread(&temp, sizeof(GAME_SETTINGS), 1, f) == 1) + memcpy(gs, &temp, sizeof(GAME_SETTINGS)); + fclose(f); + } +} +#endif + void CMinecraftApp::InitGameSettings() { for(int i=0;i<XUSER_MAX_COUNT;i++) @@ -780,6 +817,8 @@ void CMinecraftApp::InitGameSettings() // clear this for now - it will come from reading the system values memset(pProfileSettings,0,sizeof(C_4JProfile::PROFILESETTINGS)); SetDefaultOptions(pProfileSettings,i); + Win64_LoadSettings(GameSettingsA[i]); + ApplyGameSettingsChanged(i); #elif defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__ C4JStorage::PROFILESETTINGS *pProfileSettings=StorageManager.GetDashboardProfileSettings(i); // 4J-PB - don't cause an options write to happen here @@ -2372,6 +2411,9 @@ void CMinecraftApp::CheckGameSettingsChanged(bool bOverride5MinuteTimer, int iPa StorageManager.WriteToProfile(i,true, bOverride5MinuteTimer); #else ProfileManager.WriteToProfile(i,true, bOverride5MinuteTimer); +#ifdef _WINDOWS64 + Win64_SaveSettings(GameSettingsA[i]); +#endif #endif GameSettingsA[i]->bSettingsChanged=false; } @@ -2385,6 +2427,9 @@ void CMinecraftApp::CheckGameSettingsChanged(bool bOverride5MinuteTimer, int iPa StorageManager.WriteToProfile(iPad,true, bOverride5MinuteTimer); #else ProfileManager.WriteToProfile(iPad,true, bOverride5MinuteTimer); +#ifdef _WINDOWS64 + Win64_SaveSettings(GameSettingsA[iPad]); +#endif #endif GameSettingsA[iPad]->bSettingsChanged=false; } |
