2012-11-01 15:19:01 +00:00
|
|
|
// Copyright (c) 2012- PPSSPP Project.
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
2012-11-04 22:01:49 +00:00
|
|
|
// the Free Software Foundation, version 2.0 or later versions.
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official git repository and contact information can be found at
|
|
|
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
|
|
|
|
|
|
|
|
2013-05-08 13:22:45 +00:00
|
|
|
#include "base/display.h"
|
2013-04-13 19:24:07 +00:00
|
|
|
#include "Common/FileUtil.h"
|
2012-11-01 15:19:01 +00:00
|
|
|
#include "Config.h"
|
2013-04-18 09:58:54 +00:00
|
|
|
#include "file/ini_file.h"
|
2013-01-20 09:50:05 +00:00
|
|
|
#include "HLE/sceUtility.h"
|
2013-05-01 12:08:01 +00:00
|
|
|
#include "Common/CPUDetect.h"
|
2012-11-01 15:19:01 +00:00
|
|
|
|
2013-03-24 19:03:42 +00:00
|
|
|
Config g_Config;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
2013-04-23 05:38:28 +00:00
|
|
|
#ifdef IOS
|
|
|
|
extern bool isJailed;
|
|
|
|
#endif
|
|
|
|
|
2013-06-17 18:28:22 +00:00
|
|
|
Config::Config() { }
|
|
|
|
Config::~Config() { }
|
2012-11-01 15:19:01 +00:00
|
|
|
|
2013-03-24 19:03:42 +00:00
|
|
|
void Config::Load(const char *iniFileName)
|
2012-11-01 15:19:01 +00:00
|
|
|
{
|
|
|
|
iniFilename_ = iniFileName;
|
2013-01-04 09:26:14 +00:00
|
|
|
INFO_LOG(LOADER, "Loading config: %s", iniFileName);
|
2012-11-01 15:19:01 +00:00
|
|
|
bSaveSettings = true;
|
|
|
|
|
|
|
|
IniFile iniFile;
|
2013-01-04 09:26:14 +00:00
|
|
|
if (!iniFile.Load(iniFileName)) {
|
|
|
|
ERROR_LOG(LOADER, "Failed to read %s. Setting config to default.", iniFileName);
|
|
|
|
// Continue anyway to initialize the config.
|
|
|
|
}
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
|
|
IniFile::Section *general = iniFile.GetOrCreateSection("General");
|
|
|
|
|
|
|
|
bSpeedLimit = false;
|
|
|
|
general->Get("FirstRun", &bFirstRun, true);
|
2013-06-10 20:06:51 +00:00
|
|
|
general->Get("NewUI", &bNewUI, false);
|
2012-11-01 15:19:01 +00:00
|
|
|
general->Get("AutoLoadLast", &bAutoLoadLast, false);
|
2013-01-04 09:26:14 +00:00
|
|
|
general->Get("AutoRun", &bAutoRun, true);
|
2013-02-17 19:39:31 +00:00
|
|
|
general->Get("Browse", &bBrowse, false);
|
2012-11-01 15:19:01 +00:00
|
|
|
general->Get("ConfirmOnQuit", &bConfirmOnQuit, false);
|
|
|
|
general->Get("IgnoreBadMemAccess", &bIgnoreBadMemAccess, true);
|
|
|
|
general->Get("CurrentDirectory", ¤tDirectory, "");
|
2012-12-04 16:04:24 +00:00
|
|
|
general->Get("ShowDebuggerOnLoad", &bShowDebuggerOnLoad, false);
|
2013-04-18 09:58:54 +00:00
|
|
|
general->Get("Language", &languageIni, "en_US");
|
2013-05-01 12:08:01 +00:00
|
|
|
general->Get("NumWorkerThreads", &iNumWorkerThreads, cpu_info.num_cores);
|
2013-05-23 11:10:39 +00:00
|
|
|
general->Get("EnableCheats", &bEnableCheats, false);
|
2013-06-27 14:52:14 +00:00
|
|
|
general->Get("MaxRecent", &iMaxRecent, 12);
|
2013-05-23 11:10:39 +00:00
|
|
|
|
2013-05-19 14:40:01 +00:00
|
|
|
// Fix issue from switching from uint (hex in .ini) to int (dec)
|
|
|
|
if (iMaxRecent == 0)
|
2013-06-27 14:52:14 +00:00
|
|
|
iMaxRecent = 12;
|
2013-04-18 09:58:54 +00:00
|
|
|
|
2013-03-01 16:51:01 +00:00
|
|
|
// "default" means let emulator decide, "" means disable.
|
|
|
|
general->Get("ReportHost", &sReportHost, "default");
|
2013-03-24 19:03:42 +00:00
|
|
|
general->Get("Recent", recentIsos);
|
2013-03-30 16:49:02 +00:00
|
|
|
general->Get("WindowX", &iWindowX, 40);
|
|
|
|
general->Get("WindowY", &iWindowY, 100);
|
2013-03-31 04:42:43 +00:00
|
|
|
general->Get("AutoSaveSymbolMap", &bAutoSaveSymbolMap, false);
|
2013-06-10 21:45:12 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
general->Get("TopMost", &bTopMost);
|
|
|
|
#endif
|
2013-03-30 16:49:02 +00:00
|
|
|
|
2013-05-16 00:51:15 +00:00
|
|
|
if (recentIsos.size() > iMaxRecent)
|
|
|
|
recentIsos.resize(iMaxRecent);
|
2012-12-21 15:49:02 +00:00
|
|
|
|
2012-11-23 11:42:35 +00:00
|
|
|
IniFile::Section *cpu = iniFile.GetOrCreateSection("CPU");
|
2013-04-23 05:38:28 +00:00
|
|
|
#ifdef IOS
|
2013-05-08 13:22:45 +00:00
|
|
|
cpu->Get("Jit", &bJit, !isJailed);
|
2013-04-23 05:38:28 +00:00
|
|
|
#else
|
2013-02-16 08:49:33 +00:00
|
|
|
cpu->Get("Jit", &bJit, true);
|
2013-04-23 05:38:28 +00:00
|
|
|
#endif
|
2013-02-24 21:22:01 +00:00
|
|
|
//FastMemory Default set back to True when solve UNIMPL _sceAtracGetContextAddress making game crash
|
|
|
|
cpu->Get("FastMemory", &bFastMemory, false);
|
2013-06-12 21:15:45 +00:00
|
|
|
cpu->Get("CPUSpeed", &iLockedCPUSpeed, false);
|
2012-11-23 11:42:35 +00:00
|
|
|
|
2012-11-20 09:59:23 +00:00
|
|
|
IniFile::Section *graphics = iniFile.GetOrCreateSection("Graphics");
|
2013-06-19 05:08:29 +00:00
|
|
|
graphics->Get("ShowFPSCounter", &iShowFPSCounter, false);
|
2012-11-20 09:59:23 +00:00
|
|
|
graphics->Get("DisplayFramebuffer", &bDisplayFramebuffer, false);
|
2013-03-30 07:34:27 +00:00
|
|
|
#ifdef _WIN32
|
2013-05-07 21:28:19 +00:00
|
|
|
graphics->Get("ResolutionScale", &iWindowZoom, 2);
|
2013-03-30 07:34:27 +00:00
|
|
|
#else
|
2013-05-07 21:28:19 +00:00
|
|
|
graphics->Get("ResolutionScale", &iWindowZoom, 1);
|
2013-03-30 07:34:27 +00:00
|
|
|
#endif
|
2012-11-20 09:59:23 +00:00
|
|
|
graphics->Get("BufferedRendering", &bBufferedRendering, true);
|
2013-01-02 20:00:10 +00:00
|
|
|
graphics->Get("HardwareTransform", &bHardwareTransform, true);
|
2013-06-30 06:48:50 +00:00
|
|
|
graphics->Get("TextureFiltering", &iTexFiltering, false);
|
2013-01-26 23:15:39 +00:00
|
|
|
graphics->Get("SSAA", &SSAntiAliasing, 0);
|
2013-01-20 20:52:54 +00:00
|
|
|
graphics->Get("VBO", &bUseVBO, false);
|
2013-05-02 14:48:28 +00:00
|
|
|
graphics->Get("FrameSkip", &iFrameSkip, 0);
|
2013-05-11 14:03:33 +00:00
|
|
|
graphics->Get("FrameRate", &iFpsLimit, 60);
|
2013-06-30 07:02:33 +00:00
|
|
|
graphics->Get("ForceMaxEmulatedFPS", &iForceMaxEmulatedFPS, 0);
|
2013-02-11 18:03:11 +00:00
|
|
|
#ifdef USING_GLES2
|
2013-05-02 14:48:28 +00:00
|
|
|
graphics->Get("AnisotropyLevel", &iAnisotropyLevel, 0);
|
2013-02-11 18:03:11 +00:00
|
|
|
#else
|
2013-05-02 14:48:28 +00:00
|
|
|
graphics->Get("AnisotropyLevel", &iAnisotropyLevel, 8);
|
2013-02-11 18:03:11 +00:00
|
|
|
#endif
|
2013-01-26 16:26:07 +00:00
|
|
|
graphics->Get("VertexCache", &bVertexCache, true);
|
2013-05-08 13:22:45 +00:00
|
|
|
graphics->Get("FullScreen", &bFullScreen, false);
|
2013-06-21 05:40:52 +00:00
|
|
|
#ifdef BLACKBERRY
|
2013-05-08 13:22:45 +00:00
|
|
|
graphics->Get("PartialStretch", &bPartialStretch, pixel_xres == pixel_yres);
|
|
|
|
#endif
|
2013-02-13 17:21:21 +00:00
|
|
|
graphics->Get("StretchToDisplay", &bStretchToDisplay, false);
|
2013-02-19 18:07:42 +00:00
|
|
|
graphics->Get("TrueColor", &bTrueColor, true);
|
2013-06-25 18:14:10 +00:00
|
|
|
graphics->Get("FramebuffersToMem", &bFramebuffersToMem, false);
|
2013-04-11 15:05:48 +00:00
|
|
|
graphics->Get("MipMap", &bMipMap, true);
|
2013-05-01 21:55:34 +00:00
|
|
|
graphics->Get("TexScalingLevel", &iTexScalingLevel, 1);
|
2013-05-03 08:29:29 +00:00
|
|
|
graphics->Get("TexScalingType", &iTexScalingType, 0);
|
2013-05-03 14:21:46 +00:00
|
|
|
graphics->Get("TexDeposterize", &bTexDeposterize, false);
|
2013-06-16 21:45:06 +00:00
|
|
|
graphics->Get("VSyncInterval", &iVSyncInterval, 0);
|
2013-04-30 01:46:27 +00:00
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
|
|
|
|
sound->Get("Enable", &bEnableSound, true);
|
2013-06-01 14:58:22 +00:00
|
|
|
sound->Get("EnableAtrac3plus", &bEnableAtrac3plus, true);
|
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
IniFile::Section *control = iniFile.GetOrCreateSection("Control");
|
|
|
|
control->Get("ShowStick", &bShowAnalogStick, false);
|
2013-06-21 05:40:52 +00:00
|
|
|
#ifdef BLACKBERRY
|
2013-05-08 13:22:45 +00:00
|
|
|
control->Get("ShowTouchControls", &bShowTouchControls, pixel_xres != pixel_yres);
|
|
|
|
#elif defined(USING_GLES2)
|
2013-04-11 15:05:48 +00:00
|
|
|
control->Get("ShowTouchControls", &bShowTouchControls, true);
|
2013-01-14 15:13:53 +00:00
|
|
|
#else
|
2013-04-11 15:05:48 +00:00
|
|
|
control->Get("ShowTouchControls", &bShowTouchControls,false);
|
2013-01-14 15:13:53 +00:00
|
|
|
#endif
|
2013-01-26 16:26:07 +00:00
|
|
|
control->Get("LargeControls", &bLargeControls, false);
|
2013-02-01 23:36:35 +00:00
|
|
|
control->Get("KeyMapping",iMappingMap);
|
2013-03-10 12:21:36 +00:00
|
|
|
control->Get("AccelerometerToAnalogHoriz", &bAccelerometerToAnalogHoriz, false);
|
2013-04-16 14:34:20 +00:00
|
|
|
control->Get("ForceInputDevice", &iForceInputDevice, -1);
|
2013-06-11 19:29:55 +00:00
|
|
|
control->Get("RightStickBind", &iRightStickBind, 0);
|
2013-07-05 23:09:16 +00:00
|
|
|
control->Get("SwapDInputRightAxes", &iSwapRightAxes, 0);
|
2013-06-17 18:28:22 +00:00
|
|
|
control->Get("TouchButtonOpacity", &iTouchButtonOpacity, 65);
|
2013-06-18 09:37:34 +00:00
|
|
|
control->Get("ButtonScale", &fButtonScale, 1.15);
|
2012-12-19 14:14:41 +00:00
|
|
|
|
2013-01-20 09:50:05 +00:00
|
|
|
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
|
2013-04-19 18:59:24 +00:00
|
|
|
pspConfig->Get("NickName", &sNickName, "shadow");
|
2013-01-20 09:50:05 +00:00
|
|
|
pspConfig->Get("Language", &ilanguage, PSP_SYSTEMPARAM_LANGUAGE_ENGLISH);
|
2013-06-19 05:08:29 +00:00
|
|
|
pspConfig->Get("TimeFormat", &iTimeFormat, PSP_SYSTEMPARAM_TIME_FORMAT_24HR);
|
2013-04-19 18:59:24 +00:00
|
|
|
pspConfig->Get("DateFormat", &iDateFormat, PSP_SYSTEMPARAM_DATE_FORMAT_YYYYMMDD);
|
|
|
|
pspConfig->Get("TimeZone", &iTimeZone, 0);
|
|
|
|
pspConfig->Get("DayLightSavings", &bDayLightSavings, PSP_SYSTEMPARAM_DAYLIGHTSAVINGS_STD);
|
2013-06-19 05:08:29 +00:00
|
|
|
pspConfig->Get("ButtonPreference", &iButtonPreference, PSP_SYSTEMPARAM_BUTTON_CROSS);
|
2013-04-20 16:01:03 +00:00
|
|
|
pspConfig->Get("LockParentalLevel", &iLockParentalLevel, 0);
|
2013-04-19 18:59:24 +00:00
|
|
|
pspConfig->Get("WlanAdhocChannel", &iWlanAdhocChannel, PSP_SYSTEMPARAM_ADHOC_CHANNEL_AUTOMATIC);
|
|
|
|
pspConfig->Get("WlanPowerSave", &bWlanPowerSave, PSP_SYSTEMPARAM_WLAN_POWERSAVE_OFF);
|
2013-01-28 23:11:02 +00:00
|
|
|
pspConfig->Get("EncryptSave", &bEncryptSave, true);
|
2013-01-20 09:50:05 +00:00
|
|
|
|
2013-06-26 07:15:16 +00:00
|
|
|
IniFile::Section *debugConfig = iniFile.GetOrCreateSection("Debugger");
|
|
|
|
debugConfig->Get("DisasmWindowX", &iDisasmWindowX, -1);
|
|
|
|
debugConfig->Get("DisasmWindowY", &iDisasmWindowY, -1);
|
|
|
|
debugConfig->Get("DisasmWindowW", &iDisasmWindowW, -1);
|
|
|
|
debugConfig->Get("DisasmWindowH", &iDisasmWindowH, -1);
|
2013-06-26 07:32:49 +00:00
|
|
|
debugConfig->Get("ConsoleWindowX", &iConsoleWindowX, -1);
|
|
|
|
debugConfig->Get("ConsoleWindowY", &iConsoleWindowY, -1);
|
2013-06-26 07:15:16 +00:00
|
|
|
|
2013-04-13 19:24:07 +00:00
|
|
|
CleanRecent();
|
2012-11-01 15:19:01 +00:00
|
|
|
}
|
|
|
|
|
2013-03-24 19:03:42 +00:00
|
|
|
void Config::Save()
|
2012-11-01 15:19:01 +00:00
|
|
|
{
|
2013-01-04 09:26:14 +00:00
|
|
|
if (iniFilename_.size() && g_Config.bSaveSettings) {
|
2013-04-13 19:24:07 +00:00
|
|
|
CleanRecent();
|
2012-11-01 15:19:01 +00:00
|
|
|
IniFile iniFile;
|
2013-01-04 09:26:14 +00:00
|
|
|
if (!iniFile.Load(iniFilename_.c_str())) {
|
|
|
|
ERROR_LOG(LOADER, "Error saving config - can't read ini %s", iniFilename_.c_str());
|
|
|
|
}
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
|
|
IniFile::Section *general = iniFile.GetOrCreateSection("General");
|
2013-06-01 17:01:43 +00:00
|
|
|
|
|
|
|
// Need to do this somewhere...
|
|
|
|
bFirstRun = false;
|
2012-11-01 15:19:01 +00:00
|
|
|
general->Set("FirstRun", bFirstRun);
|
2013-06-01 17:01:43 +00:00
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
general->Set("AutoLoadLast", bAutoLoadLast);
|
|
|
|
general->Set("AutoRun", bAutoRun);
|
2013-02-17 19:39:31 +00:00
|
|
|
general->Set("Browse", bBrowse);
|
2012-11-01 15:19:01 +00:00
|
|
|
general->Set("ConfirmOnQuit", bConfirmOnQuit);
|
|
|
|
general->Set("IgnoreBadMemAccess", bIgnoreBadMemAccess);
|
|
|
|
general->Set("CurrentDirectory", currentDirectory);
|
2012-12-04 16:04:24 +00:00
|
|
|
general->Set("ShowDebuggerOnLoad", bShowDebuggerOnLoad);
|
2013-03-01 16:51:01 +00:00
|
|
|
general->Set("ReportHost", sReportHost);
|
2013-03-24 19:03:42 +00:00
|
|
|
general->Set("Recent", recentIsos);
|
2013-03-30 16:49:02 +00:00
|
|
|
general->Set("WindowX", iWindowX);
|
|
|
|
general->Set("WindowY", iWindowY);
|
2013-03-31 04:42:43 +00:00
|
|
|
general->Set("AutoSaveSymbolMap", bAutoSaveSymbolMap);
|
2013-06-10 21:45:12 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
general->Set("TopMost", bTopMost);
|
|
|
|
#endif
|
2013-04-18 09:58:54 +00:00
|
|
|
general->Set("Language", languageIni);
|
2013-05-01 12:08:01 +00:00
|
|
|
general->Set("NumWorkerThreads", iNumWorkerThreads);
|
2013-05-16 00:51:15 +00:00
|
|
|
general->Set("MaxRecent", iMaxRecent);
|
2013-05-23 11:10:39 +00:00
|
|
|
general->Set("EnableCheats", bEnableCheats);
|
2013-03-01 16:51:01 +00:00
|
|
|
|
2012-11-23 11:42:35 +00:00
|
|
|
IniFile::Section *cpu = iniFile.GetOrCreateSection("CPU");
|
2013-02-16 08:49:33 +00:00
|
|
|
cpu->Set("Jit", bJit);
|
2012-12-21 15:49:02 +00:00
|
|
|
cpu->Set("FastMemory", bFastMemory);
|
2013-06-12 21:15:45 +00:00
|
|
|
cpu->Set("CPUSpeed", iLockedCPUSpeed);
|
2012-11-23 11:42:35 +00:00
|
|
|
|
2012-11-20 09:59:23 +00:00
|
|
|
IniFile::Section *graphics = iniFile.GetOrCreateSection("Graphics");
|
2013-06-19 05:08:29 +00:00
|
|
|
graphics->Set("ShowFPSCounter", iShowFPSCounter);
|
2012-11-20 09:59:23 +00:00
|
|
|
graphics->Set("DisplayFramebuffer", bDisplayFramebuffer);
|
2013-05-07 21:28:19 +00:00
|
|
|
graphics->Set("ResolutionScale", iWindowZoom);
|
2012-11-20 09:59:23 +00:00
|
|
|
graphics->Set("BufferedRendering", bBufferedRendering);
|
2012-12-21 10:08:54 +00:00
|
|
|
graphics->Set("HardwareTransform", bHardwareTransform);
|
2013-06-30 06:48:50 +00:00
|
|
|
graphics->Set("TextureFiltering", iTexFiltering);
|
2013-01-26 23:15:39 +00:00
|
|
|
graphics->Set("SSAA", SSAntiAliasing);
|
2013-01-10 11:51:18 +00:00
|
|
|
graphics->Set("VBO", bUseVBO);
|
2013-05-02 14:48:28 +00:00
|
|
|
graphics->Set("FrameSkip", iFrameSkip);
|
2013-05-11 14:03:33 +00:00
|
|
|
graphics->Set("FrameRate", iFpsLimit);
|
2013-06-30 07:02:33 +00:00
|
|
|
graphics->Set("ForceMaxEmulatedFPS", iForceMaxEmulatedFPS);
|
2013-05-02 14:48:28 +00:00
|
|
|
graphics->Set("AnisotropyLevel", iAnisotropyLevel);
|
2013-01-19 16:05:08 +00:00
|
|
|
graphics->Set("VertexCache", bVertexCache);
|
2013-01-27 13:05:09 +00:00
|
|
|
graphics->Set("FullScreen", bFullScreen);
|
2013-06-21 05:40:52 +00:00
|
|
|
#ifdef BLACKBERRY
|
2013-05-08 13:22:45 +00:00
|
|
|
graphics->Set("PartialStretch", bPartialStretch);
|
|
|
|
#endif
|
2013-02-13 17:21:21 +00:00
|
|
|
graphics->Set("StretchToDisplay", bStretchToDisplay);
|
2013-02-19 18:07:42 +00:00
|
|
|
graphics->Set("TrueColor", bTrueColor);
|
2013-06-25 18:14:10 +00:00
|
|
|
graphics->Set("FramebuffersToMem", bFramebuffersToMem);
|
2013-04-02 23:33:14 +00:00
|
|
|
graphics->Set("MipMap", bMipMap);
|
2013-05-01 21:55:34 +00:00
|
|
|
graphics->Set("TexScalingLevel", iTexScalingLevel);
|
|
|
|
graphics->Set("TexScalingType", iTexScalingType);
|
2013-05-03 14:21:46 +00:00
|
|
|
graphics->Set("TexDeposterize", bTexDeposterize);
|
2013-06-16 21:45:06 +00:00
|
|
|
graphics->Set("VSyncInterval", iVSyncInterval);
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
|
|
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
|
|
|
|
sound->Set("Enable", bEnableSound);
|
2013-06-01 14:58:22 +00:00
|
|
|
sound->Set("EnableAtrac3plus", bEnableAtrac3plus);
|
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
IniFile::Section *control = iniFile.GetOrCreateSection("Control");
|
|
|
|
control->Set("ShowStick", bShowAnalogStick);
|
2012-12-01 22:20:08 +00:00
|
|
|
control->Set("ShowTouchControls", bShowTouchControls);
|
2013-01-26 16:26:07 +00:00
|
|
|
control->Set("LargeControls", bLargeControls);
|
2013-02-01 23:36:35 +00:00
|
|
|
control->Set("KeyMapping",iMappingMap);
|
2013-03-10 12:21:36 +00:00
|
|
|
control->Set("AccelerometerToAnalogHoriz", bAccelerometerToAnalogHoriz);
|
2013-04-16 14:34:20 +00:00
|
|
|
control->Set("ForceInputDevice", iForceInputDevice);
|
2013-06-11 19:29:55 +00:00
|
|
|
control->Set("RightStickBind", iRightStickBind);
|
2013-06-17 18:28:22 +00:00
|
|
|
control->Set("TouchButtonOpacity", iTouchButtonOpacity);
|
2013-06-18 09:37:34 +00:00
|
|
|
control->Set("ButtonScale", fButtonScale);
|
2012-11-01 15:19:01 +00:00
|
|
|
|
2013-01-20 09:50:05 +00:00
|
|
|
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
|
2013-04-19 18:59:24 +00:00
|
|
|
pspConfig->Set("NickName", sNickName.c_str());
|
2013-01-20 09:50:05 +00:00
|
|
|
pspConfig->Set("Language", ilanguage);
|
2013-06-19 05:08:29 +00:00
|
|
|
pspConfig->Set("TimeFormat", iTimeFormat);
|
2013-04-19 18:59:24 +00:00
|
|
|
pspConfig->Set("DateFormat", iDateFormat);
|
|
|
|
pspConfig->Set("TimeZone", iTimeZone);
|
|
|
|
pspConfig->Set("DayLightSavings", bDayLightSavings);
|
2013-06-19 05:08:29 +00:00
|
|
|
pspConfig->Set("ButtonPreference", iButtonPreference);
|
2013-04-20 16:01:03 +00:00
|
|
|
pspConfig->Set("LockParentalLevel", iLockParentalLevel);
|
2013-04-19 18:59:24 +00:00
|
|
|
pspConfig->Set("WlanAdhocChannel", iWlanAdhocChannel);
|
|
|
|
pspConfig->Set("WlanPowerSave", bWlanPowerSave);
|
2013-01-28 23:11:02 +00:00
|
|
|
pspConfig->Set("EncryptSave", bEncryptSave);
|
2013-01-20 09:50:05 +00:00
|
|
|
|
2013-06-26 07:15:16 +00:00
|
|
|
IniFile::Section *debugConfig = iniFile.GetOrCreateSection("Debugger");
|
|
|
|
debugConfig->Set("DisasmWindowX", iDisasmWindowX);
|
|
|
|
debugConfig->Set("DisasmWindowY", iDisasmWindowY);
|
|
|
|
debugConfig->Set("DisasmWindowW", iDisasmWindowW);
|
|
|
|
debugConfig->Set("DisasmWindowH", iDisasmWindowH);
|
2013-06-26 07:32:49 +00:00
|
|
|
debugConfig->Set("ConsoleWindowX", iConsoleWindowX);
|
|
|
|
debugConfig->Set("ConsoleWindowY", iConsoleWindowY);
|
2013-06-26 07:15:16 +00:00
|
|
|
|
2013-01-04 09:26:14 +00:00
|
|
|
if (!iniFile.Save(iniFilename_.c_str())) {
|
|
|
|
ERROR_LOG(LOADER, "Error saving config - can't write ini %s", iniFilename_.c_str());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
INFO_LOG(LOADER, "Config saved: %s", iniFilename_.c_str());
|
2012-11-04 10:54:45 +00:00
|
|
|
} else {
|
2013-01-04 09:26:14 +00:00
|
|
|
INFO_LOG(LOADER, "Not saving config");
|
2012-11-01 15:19:01 +00:00
|
|
|
}
|
|
|
|
}
|
2013-03-24 19:03:42 +00:00
|
|
|
|
|
|
|
void Config::AddRecent(const std::string &file) {
|
|
|
|
for (auto str = recentIsos.begin(); str != recentIsos.end(); str++) {
|
|
|
|
if (*str == file) {
|
|
|
|
recentIsos.erase(str);
|
|
|
|
recentIsos.insert(recentIsos.begin(), file);
|
2013-05-16 00:51:15 +00:00
|
|
|
if (recentIsos.size() > iMaxRecent)
|
|
|
|
recentIsos.resize(iMaxRecent);
|
2013-03-24 19:03:42 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
recentIsos.insert(recentIsos.begin(), file);
|
2013-05-16 00:51:15 +00:00
|
|
|
if (recentIsos.size() > iMaxRecent)
|
|
|
|
recentIsos.resize(iMaxRecent);
|
2013-03-24 19:03:42 +00:00
|
|
|
}
|
2013-04-13 19:24:07 +00:00
|
|
|
|
|
|
|
void Config::CleanRecent() {
|
|
|
|
std::vector<std::string> cleanedRecent;
|
|
|
|
for (size_t i = 0; i < recentIsos.size(); i++) {
|
|
|
|
if (File::Exists(recentIsos[i]))
|
|
|
|
cleanedRecent.push_back(recentIsos[i]);
|
|
|
|
}
|
|
|
|
recentIsos = cleanedRecent;
|
|
|
|
|
2013-04-15 00:23:57 +00:00
|
|
|
}
|