void InputMapper::SaveMappingsToDisk() { IniFile ini; ini.ReadFile( KEYMAPS_PATH ); const Game* pGame = GAMESTATE->GetCurrentGame(); // erase the key so that we overwrite everything for this game ini.DeleteKey( pGame->m_szName ); // iterate over our input map and write all mappings to the ini file FOREACH_GameController( i ) { for( int j=0; j<pGame->m_iButtonsPerController; j++ ) { GameInput GameI( i, (GameButton)j ); CString sNameString = GameI.toString( pGame ); vector<CString> asValues; for( int button = 0; button < NUM_GAME_TO_DEVICE_SLOTS; ++button ) asValues.push_back( m_GItoDI[i][j][button].toString() ); while( asValues.size() && asValues.back() == "" ) asValues.erase( asValues.begin()+asValues.size()-1 ); CString sValueString = join( ",", asValues ); ini.SetValue( pGame->m_szName, sNameString, sValueString ); } } ini.WriteFile( KEYMAPS_PATH ); }
void SConfig::SaveGeneralSettings(IniFile& ini) { IniFile::Section* general = ini.GetOrCreateSection("General"); // General general->Set("LastFilename", m_LastFilename); general->Set("ShowLag", m_ShowLag); general->Set("ShowFrameCount", m_ShowFrameCount); // ISO folders // Clear removed folders int oldPaths; int numPaths = (int)m_ISOFolder.size(); general->Get("ISOPaths", &oldPaths, 0); for (int i = numPaths; i < oldPaths; i++) { ini.DeleteKey("General", StringFromFormat("ISOPath%i", i)); } general->Set("ISOPaths", numPaths); for (int i = 0; i < numPaths; i++) { general->Set(StringFromFormat("ISOPath%i", i), m_ISOFolder[i]); } general->Set("RecursiveISOPaths", m_RecursiveISOFolder); general->Set("NANDRootPath", m_NANDPath); general->Set("WirelessMac", m_WirelessMac); #ifdef USE_GDBSTUB general->Set("GDBPort", m_LocalCoreStartupParameter.iGDBPort); #endif }
void SConfig::SaveGeneralSettings(IniFile& ini) { IniFile::Section* general = ini.GetOrCreateSection("General"); // General general->Set("ShowLag", m_ShowLag); general->Set("ShowFrameCount", m_ShowFrameCount); // ISO folders // Clear removed folders int oldPaths; int numPaths = (int)m_ISOFolder.size(); general->Get("ISOPaths", &oldPaths, 0); for (int i = numPaths; i < oldPaths; i++) { ini.DeleteKey("General", StringFromFormat("ISOPath%i", i)); } general->Set("ISOPaths", numPaths); for (int i = 0; i < numPaths; i++) { general->Set(StringFromFormat("ISOPath%i", i), m_ISOFolder[i]); } general->Set("RecursiveISOPaths", m_RecursiveISOFolder); general->Set("WirelessMac", m_WirelessMac); #ifdef USE_GDBSTUB #ifndef _WIN32 general->Set("GDBSocket", gdb_socket); #endif general->Set("GDBPort", iGDBPort); #endif }
void InputMapper::SaveMappingsToDisk() { IniFile ini; ini.ReadFile( KEYMAPS_PATH ); // erase the key so that we overwrite everything for this game ini.DeleteKey( GAMESTATE->GetCurrentGame()->m_szName ); // iterate over our input map and write all mappings to the ini file for( int i=0; i<MAX_GAME_CONTROLLERS; i++ ) { for( int j=0; j<MAX_GAME_BUTTONS; j++ ) { CString sNameString, sValueString; GameInput GameI( (GameController)i, (GameButton)j ); sNameString = GameI.toString(); sValueString = ssprintf( "%s,%s,%s", m_GItoDI[i][j][0].toString().c_str(), m_GItoDI[i][j][1].toString().c_str(), m_GItoDI[i][j][2].toString().c_str() ); ini.SetValue( GAMESTATE->GetCurrentGame()->m_szName, sNameString, sValueString ); } } ini.WriteFile( KEYMAPS_PATH ); }
void INIGameConfigLayerLoader::Save(Config::Layer* layer) { if (layer->GetLayer() != Config::LayerType::LocalGame) return; IniFile ini; for (const std::string& file_name : GetGameIniFilenames(m_id, m_revision)) ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + file_name, true); for (const auto& config : layer->GetLayerMap()) { const Config::ConfigLocation& location = config.first; const std::optional<std::string>& value = config.second; if (!IsSettingSaveable(location)) continue; const auto ini_location = GetINILocationFromConfig(location); if (ini_location.first.empty() && ini_location.second.empty()) continue; if (value) { IniFile::Section* ini_section = ini.GetOrCreateSection(ini_location.first); ini_section->Set(ini_location.second, *value); } else { ini.DeleteKey(ini_location.first, ini_location.second); } } // Try to save to the revision specific INI first, if it exists. const std::string gameini_with_rev = File::GetUserPath(D_GAMESETTINGS_IDX) + m_id + StringFromFormat("r%d", m_revision) + ".ini"; if (File::Exists(gameini_with_rev)) { ini.Save(gameini_with_rev); return; } // Otherwise, save to the game INI. We don't try any INI broader than that because it will // likely cause issues with cheat codes and game patches. const std::string gameini = File::GetUserPath(D_GAMESETTINGS_IDX) + m_id + ".ini"; ini.Save(gameini); }
void SConfig::SaveSettings() { NOTICE_LOG(BOOT, "Saving settings to %s", File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str()); IniFile ini; ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); // load first to not kill unknown stuff // General ini.Set("General", "LastFilename", m_LastFilename); ini.Set("General", "ShowLag", m_ShowLag); // ISO folders // clear removed folders int oldPaths, numPaths = (int)m_ISOFolder.size(); ini.Get("General", "GCMPathes", &oldPaths, 0); for (int i = numPaths; i < oldPaths; i++) { ini.DeleteKey("General", StringFromFormat("GCMPath%i", i)); } ini.Set("General", "GCMPathes", numPaths); for (int i = 0; i < numPaths; i++) { ini.Set("General", StringFromFormat("GCMPath%i", i), m_ISOFolder[i]); } ini.Set("General", "RecursiveGCMPaths", m_RecursiveISOFolder); ini.Set("General", "NANDRootPath", m_NANDPath); ini.Set("General", "WirelessMac", m_WirelessMac); #ifdef USE_GDBSTUB ini.Set("General", "GDBPort", m_LocalCoreStartupParameter.iGDBPort); #endif // Interface ini.Set("Interface", "ConfirmStop", m_LocalCoreStartupParameter.bConfirmStop); ini.Set("Interface", "UsePanicHandlers", m_LocalCoreStartupParameter.bUsePanicHandlers); ini.Set("Interface", "OnScreenDisplayMessages", m_LocalCoreStartupParameter.bOnScreenDisplayMessages); ini.Set("Interface", "HideCursor", m_LocalCoreStartupParameter.bHideCursor); ini.Set("Interface", "AutoHideCursor", m_LocalCoreStartupParameter.bAutoHideCursor); ini.Set("Interface", "MainWindowPosX", (m_LocalCoreStartupParameter.iPosX == -32000) ? 0 : m_LocalCoreStartupParameter.iPosX); // TODO - HAX ini.Set("Interface", "MainWindowPosY", (m_LocalCoreStartupParameter.iPosY == -32000) ? 0 : m_LocalCoreStartupParameter.iPosY); // TODO - HAX ini.Set("Interface", "MainWindowWidth", m_LocalCoreStartupParameter.iWidth); ini.Set("Interface", "MainWindowHeight", m_LocalCoreStartupParameter.iHeight); ini.Set("Interface", "Language", m_InterfaceLanguage); ini.Set("Interface", "ShowToolbar", m_InterfaceToolbar); ini.Set("Interface", "ShowStatusbar", m_InterfaceStatusbar); ini.Set("Interface", "ShowLogWindow", m_InterfaceLogWindow); ini.Set("Interface", "ShowLogConfigWindow", m_InterfaceLogConfigWindow); ini.Set("Interface", "ThemeName40", m_LocalCoreStartupParameter.theme_name); // Hotkeys for (int i = 0; i < NUM_HOTKEYS; i++) { ini.Set("Hotkeys", g_HKData[i].IniText, m_LocalCoreStartupParameter.iHotkey[i]); ini.Set("Hotkeys", std::string(g_HKData[i].IniText) + "Modifier", m_LocalCoreStartupParameter.iHotkeyModifier[i]); } // Display ini.Set("Display", "FullscreenResolution", m_LocalCoreStartupParameter.strFullscreenResolution); ini.Set("Display", "Fullscreen", m_LocalCoreStartupParameter.bFullscreen); ini.Set("Display", "RenderToMain", m_LocalCoreStartupParameter.bRenderToMain); ini.Set("Display", "RenderWindowXPos", m_LocalCoreStartupParameter.iRenderWindowXPos); ini.Set("Display", "RenderWindowYPos", m_LocalCoreStartupParameter.iRenderWindowYPos); ini.Set("Display", "RenderWindowWidth", m_LocalCoreStartupParameter.iRenderWindowWidth); ini.Set("Display", "RenderWindowHeight", m_LocalCoreStartupParameter.iRenderWindowHeight); ini.Set("Display", "RenderWindowAutoSize", m_LocalCoreStartupParameter.bRenderWindowAutoSize); ini.Set("Display", "KeepWindowOnTop", m_LocalCoreStartupParameter.bKeepWindowOnTop); ini.Set("Display", "ProgressiveScan", m_LocalCoreStartupParameter.bProgressive); ini.Set("Display", "DisableScreenSaver", m_LocalCoreStartupParameter.bDisableScreenSaver); ini.Set("Display", "ForceNTSCJ", m_LocalCoreStartupParameter.bForceNTSCJ); // Game List Control ini.Set("GameList", "ListDrives", m_ListDrives); ini.Set("GameList", "ListWad", m_ListWad); ini.Set("GameList", "ListWii", m_ListWii); ini.Set("GameList", "ListGC", m_ListGC); ini.Set("GameList", "ListJap", m_ListJap); ini.Set("GameList", "ListPal", m_ListPal); ini.Set("GameList", "ListUsa", m_ListUsa); ini.Set("GameList", "ListFrance", m_ListFrance); ini.Set("GameList", "ListItaly", m_ListItaly); ini.Set("GameList", "ListKorea", m_ListKorea); ini.Set("GameList", "ListTaiwan", m_ListTaiwan); ini.Set("GameList", "ListUnknown", m_ListUnknown); ini.Set("GameList", "ListSort", m_ListSort); ini.Set("GameList", "ListSortSecondary", m_ListSort2); // Core ini.Set("Core", "HLE_BS2", m_LocalCoreStartupParameter.bHLE_BS2); ini.Set("Core", "CPUCore", m_LocalCoreStartupParameter.iCPUCore); ini.Set("Core", "Fastmem", m_LocalCoreStartupParameter.bFastmem); ini.Set("Core", "CPUThread", m_LocalCoreStartupParameter.bCPUThread); ini.Set("Core", "DSPThread", m_LocalCoreStartupParameter.bDSPThread); ini.Set("Core", "DSPHLE", m_LocalCoreStartupParameter.bDSPHLE); ini.Set("Core", "SkipIdle", m_LocalCoreStartupParameter.bSkipIdle); ini.Set("Core", "DefaultGCM", m_LocalCoreStartupParameter.m_strDefaultGCM); ini.Set("Core", "DVDRoot", m_LocalCoreStartupParameter.m_strDVDRoot); ini.Set("Core", "Apploader", m_LocalCoreStartupParameter.m_strApploader); ini.Set("Core", "EnableCheats", m_LocalCoreStartupParameter.bEnableCheats); ini.Set("Core", "SelectedLanguage", m_LocalCoreStartupParameter.SelectedLanguage); ini.Set("Core", "DPL2Decoder", m_LocalCoreStartupParameter.bDPL2Decoder); ini.Set("Core", "Latency", m_LocalCoreStartupParameter.iLatency); ini.Set("Core", "MemcardAPath", m_strMemoryCardA); ini.Set("Core", "MemcardBPath", m_strMemoryCardB); ini.Set("Core", "SlotA", m_EXIDevice[0]); ini.Set("Core", "SlotB", m_EXIDevice[1]); ini.Set("Core", "SerialPort1", m_EXIDevice[2]); ini.Set("Core", "BBA_MAC", m_bba_mac); for (int i = 0; i < MAX_SI_CHANNELS; ++i) { ini.Set("Core", StringFromFormat("SIDevice%i", i), m_SIDevice[i]); } ini.Set("Core", "WiiSDCard", m_WiiSDCard); ini.Set("Core", "WiiKeyboard", m_WiiKeyboard); ini.Set("Core", "WiimoteContinuousScanning", m_WiimoteContinuousScanning); ini.Set("Core", "WiimoteEnableSpeaker", m_WiimoteEnableSpeaker); ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer); ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient); ini.Set("Core", "FrameLimit", m_Framelimit); ini.Set("Core", "FrameSkip", m_FrameSkip); // GFX Backend ini.Set("Core", "GFXBackend", m_LocalCoreStartupParameter.m_strVideoBackend); // Movie ini.Set("Movie", "PauseMovie", m_PauseMovie); ini.Set("Movie", "Author", m_strMovieAuthor); // DSP ini.Set("DSP", "EnableJIT", m_DSPEnableJIT); ini.Set("DSP", "DumpAudio", m_DumpAudio); ini.Set("DSP", "Backend", sBackend); ini.Set("DSP", "Volume", m_Volume); // Fifo Player ini.Set("FifoPlayer", "LoopReplay", m_LocalCoreStartupParameter.bLoopFifoReplay); ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX)); m_SYSCONF->Save(); }
void SConfig::SaveSettings() { NOTICE_LOG(BOOT, "Saving settings to %s", File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str()); IniFile ini; ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); // load first to not kill unknown stuff // General ini.Set("General", "LastFilename", m_LastFilename); // ISO folders // clear removed folders int oldPaths, numPaths = (int)m_ISOFolder.size(); ini.Get("General", "GCMPathes", &oldPaths, 0); for (int i = numPaths; i < oldPaths; i++) { TCHAR tmp[16]; sprintf(tmp, "GCMPath%i", i); ini.DeleteKey("General", tmp); } ini.Set("General", "GCMPathes", numPaths); for (int i = 0; i < numPaths; i++) { TCHAR tmp[16]; sprintf(tmp, "GCMPath%i", i); ini.Set("General", tmp, m_ISOFolder[i]); } ini.Set("General", "RecursiveGCMPaths", m_RecursiveISOFolder); ini.Set("General", "NANDRoot", m_NANDPath); // Interface ini.Set("Interface", "ConfirmStop", m_LocalCoreStartupParameter.bConfirmStop); ini.Set("Interface", "UsePanicHandlers", m_LocalCoreStartupParameter.bUsePanicHandlers); ini.Set("Interface", "HideCursor", m_LocalCoreStartupParameter.bHideCursor); ini.Set("Interface", "AutoHideCursor", m_LocalCoreStartupParameter.bAutoHideCursor); ini.Set("Interface", "Theme", m_LocalCoreStartupParameter.iTheme); ini.Set("Interface", "MainWindowPosX", (m_LocalCoreStartupParameter.iPosX == -32000) ? 0 : m_LocalCoreStartupParameter.iPosX); // TODO - HAX ini.Set("Interface", "MainWindowPosY", (m_LocalCoreStartupParameter.iPosY == -32000) ? 0 : m_LocalCoreStartupParameter.iPosY); // TODO - HAX ini.Set("Interface", "MainWindowWidth", m_LocalCoreStartupParameter.iWidth); ini.Set("Interface", "MainWindowHeight", m_LocalCoreStartupParameter.iHeight); ini.Set("Interface", "Language", m_InterfaceLanguage); ini.Set("Interface", "ShowToolbar", m_InterfaceToolbar); ini.Set("Interface", "ShowStatusbar", m_InterfaceStatusbar); ini.Set("Interface", "ShowLogWindow", m_InterfaceLogWindow); ini.Set("Interface", "ShowLogConfigWindow", m_InterfaceLogConfigWindow); ini.Set("Interface", "ShowConsole", m_InterfaceConsole); // Hotkeys for (int i = 0; i < NUM_HOTKEYS; i++) { ini.Set("Hotkeys", g_HKData[i].IniText, m_LocalCoreStartupParameter.iHotkey[i]); ini.Set("Hotkeys", (std::string(g_HKData[i].IniText) + "Modifier").c_str(), m_LocalCoreStartupParameter.iHotkeyModifier[i]); } // Display ini.Set("Display", "FullscreenResolution", m_LocalCoreStartupParameter.strFullscreenResolution); ini.Set("Display", "Fullscreen", m_LocalCoreStartupParameter.bFullscreen); ini.Set("Display", "RenderToMain", m_LocalCoreStartupParameter.bRenderToMain); ini.Set("Display", "RenderWindowXPos", m_LocalCoreStartupParameter.iRenderWindowXPos); ini.Set("Display", "RenderWindowYPos", m_LocalCoreStartupParameter.iRenderWindowYPos); ini.Set("Display", "RenderWindowWidth", m_LocalCoreStartupParameter.iRenderWindowWidth); ini.Set("Display", "RenderWindowHeight", m_LocalCoreStartupParameter.iRenderWindowHeight); ini.Set("Display", "RenderWindowAutoSize", m_LocalCoreStartupParameter.bRenderWindowAutoSize); ini.Set("Display", "KeepWindowOnTop", m_LocalCoreStartupParameter.bKeepWindowOnTop); ini.Set("Display", "ProgressiveScan", m_LocalCoreStartupParameter.bProgressive); ini.Set("Display", "DisableScreenSaver", m_LocalCoreStartupParameter.bDisableScreenSaver); ini.Set("Display", "ForceNTSCJ", m_LocalCoreStartupParameter.bForceNTSCJ); // Game List Control ini.Set("GameList", "ListDrives", m_ListDrives); ini.Set("GameList", "ListWad", m_ListWad); ini.Set("GameList", "ListWii", m_ListWii); ini.Set("GameList", "ListGC", m_ListGC); ini.Set("GameList", "ListJap", m_ListJap); ini.Set("GameList", "ListPal", m_ListPal); ini.Set("GameList", "ListUsa", m_ListUsa); ini.Set("GameList", "ListFrance", m_ListFrance); ini.Set("GameList", "ListItaly", m_ListItaly); ini.Set("GameList", "ListKorea", m_ListKorea); ini.Set("GameList", "ListTaiwan", m_ListTaiwan); ini.Set("GameList", "ListUnknown", m_ListUnknown); // Core ini.Set("Core", "HLE_BS2", m_LocalCoreStartupParameter.bHLE_BS2); ini.Set("Core", "CPUCore", m_LocalCoreStartupParameter.iCPUCore); ini.Set("Core", "CPUThread", m_LocalCoreStartupParameter.bCPUThread); ini.Set("Core", "DSPThread", m_LocalCoreStartupParameter.bDSPThread); ini.Set("Core", "DSPHLE", m_LocalCoreStartupParameter.bDSPHLE); ini.Set("Core", "SkipIdle", m_LocalCoreStartupParameter.bSkipIdle); ini.Set("Core", "LockThreads", m_LocalCoreStartupParameter.bLockThreads); ini.Set("Core", "DefaultGCM", m_LocalCoreStartupParameter.m_strDefaultGCM); ini.Set("Core", "DVDRoot", m_LocalCoreStartupParameter.m_strDVDRoot); ini.Set("Core", "Apploader", m_LocalCoreStartupParameter.m_strApploader); ini.Set("Core", "EnableCheats", m_LocalCoreStartupParameter.bEnableCheats); ini.Set("Core", "SelectedLanguage", m_LocalCoreStartupParameter.SelectedLanguage); ini.Set("Core", "MemcardA", m_strMemoryCardA); ini.Set("Core", "MemcardB", m_strMemoryCardB); ini.Set("Core", "SlotA", m_EXIDevice[0]); ini.Set("Core", "SlotB", m_EXIDevice[1]); ini.Set("Core", "SerialPort1", m_EXIDevice[2]); ini.Set("Core", "BBA_MAC", m_bba_mac); char sidevicenum[16]; for (int i = 0; i < 4; ++i) { sprintf(sidevicenum, "SIDevice%i", i); ini.Set("Core", sidevicenum, m_SIDevice[i]); } ini.Set("Core", "WiiSDCard", m_WiiSDCard); ini.Set("Core", "WiiKeyboard", m_WiiKeyboard); ini.Set("Core", "WiimoteReconnectOnLoad", m_WiimoteReconnectOnLoad); ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer); ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient); ini.Set("Core", "FrameLimit", m_Framelimit); ini.Set("Core", "UseFPS", b_UseFPS); // GFX Backend ini.Set("Core", "GFXBackend", m_LocalCoreStartupParameter.m_strVideoBackend); ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX)); m_SYSCONF->Save(); }