2012-11-01 16:19:01 +01: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 23:01:49 +01:00
|
|
|
// the Free Software Foundation, version 2.0 or later versions.
|
2012-11-01 16:19:01 +01: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 23:22:45 +10:00
|
|
|
#include "base/display.h"
|
2013-08-20 15:41:19 +02:00
|
|
|
#include "base/NativeApp.h"
|
2013-11-26 14:04:29 +01:00
|
|
|
#include "ext/vjson/json.h"
|
|
|
|
#include "file/ini_file.h"
|
|
|
|
#include "i18n/i18n.h"
|
|
|
|
#include "gfx_es2/gpu_features.h"
|
|
|
|
#include "net/http_client.h"
|
|
|
|
#include "util/text/parsers.h"
|
|
|
|
|
|
|
|
#include "Common/CPUDetect.h"
|
2013-07-06 20:44:34 +02:00
|
|
|
#include "Common/KeyMap.h"
|
2013-04-13 21:24:07 +02:00
|
|
|
#include "Common/FileUtil.h"
|
2013-10-12 16:02:03 -07:00
|
|
|
#include "Common/StringUtils.h"
|
2012-11-01 16:19:01 +01:00
|
|
|
#include "Config.h"
|
2013-01-20 10:50:05 +01:00
|
|
|
#include "HLE/sceUtility.h"
|
2013-11-26 14:04:29 +01:00
|
|
|
|
2013-11-27 03:02:29 +10:00
|
|
|
#ifndef USING_QT_UI
|
2013-11-26 14:04:29 +01:00
|
|
|
extern const char *PPSSPP_GIT_VERSION;
|
2013-11-27 03:02:29 +10:00
|
|
|
#endif
|
2013-11-26 14:04:29 +01:00
|
|
|
|
|
|
|
// TODO: Find a better place for this.
|
|
|
|
http::Downloader g_DownloadManager;
|
2012-11-01 16:19:01 +01:00
|
|
|
|
2013-03-24 20:03:42 +01:00
|
|
|
Config g_Config;
|
2012-11-01 16:19:01 +01:00
|
|
|
|
2013-04-23 14:38:28 +09:00
|
|
|
#ifdef IOS
|
2013-12-02 03:28:20 +08:00
|
|
|
extern bool iosCanUseJit;
|
2013-04-23 14:38:28 +09:00
|
|
|
#endif
|
|
|
|
|
2014-02-09 15:46:49 -08:00
|
|
|
struct ConfigSetting {
|
|
|
|
enum Type
|
|
|
|
{
|
|
|
|
TYPE_TERMINATOR,
|
|
|
|
TYPE_BOOL,
|
|
|
|
TYPE_INT,
|
|
|
|
TYPE_STRING,
|
|
|
|
};
|
|
|
|
union Value
|
|
|
|
{
|
|
|
|
bool b;
|
|
|
|
int i;
|
|
|
|
const char *s;
|
|
|
|
};
|
|
|
|
|
|
|
|
ConfigSetting(bool v)
|
|
|
|
: ini_(""), type_(TYPE_TERMINATOR), report_(false), save_(false) {
|
|
|
|
ptr_ = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ConfigSetting(const char *ini, bool *v, bool def, bool save = true)
|
|
|
|
: ini_(ini), type_(TYPE_BOOL), report_(false), save_(save) {
|
|
|
|
ptr_ = (void *)v;
|
|
|
|
default_.b = def;
|
|
|
|
}
|
|
|
|
|
|
|
|
ConfigSetting(const char *ini, int *v, int def, bool save = true)
|
|
|
|
: ini_(ini), type_(TYPE_INT), report_(false), save_(save) {
|
|
|
|
ptr_ = (void *)v;
|
|
|
|
default_.i = def;
|
|
|
|
}
|
|
|
|
|
|
|
|
ConfigSetting(const char *ini, std::string *v, const char *def, bool save = true)
|
|
|
|
: ini_(ini), type_(TYPE_STRING), report_(false), save_(save) {
|
|
|
|
ptr_ = (void *)v;
|
|
|
|
default_.s = def;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool HasMore() {
|
|
|
|
return type_ != TYPE_TERMINATOR;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Get(IniFile::Section *section) {
|
|
|
|
switch (type_) {
|
|
|
|
case TYPE_BOOL:
|
|
|
|
return section->Get(ini_, (bool *)ptr_, default_.b);
|
|
|
|
case TYPE_INT:
|
|
|
|
return section->Get(ini_, (int *)ptr_, default_.i);
|
|
|
|
case TYPE_STRING:
|
|
|
|
return section->Get(ini_, (std::string *)ptr_, default_.s);
|
|
|
|
default:
|
|
|
|
_dbg_assert_msg_(LOADER, false, "Unexpected ini setting type");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Set(IniFile::Section *section) {
|
|
|
|
if (!save_)
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch (type_) {
|
|
|
|
case TYPE_BOOL:
|
|
|
|
return section->Set(ini_, *(bool *)ptr_);
|
|
|
|
case TYPE_INT:
|
|
|
|
return section->Set(ini_, *(int *)ptr_);
|
|
|
|
case TYPE_STRING:
|
|
|
|
return section->Set(ini_, *(std::string *)ptr_);
|
|
|
|
default:
|
|
|
|
_dbg_assert_msg_(LOADER, false, "Unexpected ini setting type");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *ini_;
|
|
|
|
Type type_;
|
|
|
|
bool report_;
|
|
|
|
bool save_;
|
|
|
|
void *ptr_;
|
|
|
|
Value default_;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ReportedConfigSetting : public ConfigSetting {
|
|
|
|
template <typename T>
|
|
|
|
ReportedConfigSetting(const char *ini, T *v, const T def, bool save = true)
|
|
|
|
: ConfigSetting(ini, v, def, save) {
|
|
|
|
report_ = true;
|
|
|
|
}
|
|
|
|
ReportedConfigSetting(const char *ini, std::string *v, const char *def, bool save = true)
|
|
|
|
: ConfigSetting(ini, v, def, save) {
|
|
|
|
report_ = true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct LangRegionSetting : public ReportedConfigSetting {
|
|
|
|
LangRegionSetting(const char *ini, std::string *v, bool save = true)
|
|
|
|
: ReportedConfigSetting(ini, v, "", save) {
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Get(IniFile::Section *section);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct NumWorkersSetting : public ReportedConfigSetting {
|
|
|
|
NumWorkersSetting(const char *ini, int *v, bool save = true)
|
|
|
|
: ReportedConfigSetting(ini, v, 0, save) {
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Get(IniFile::Section *section) {
|
|
|
|
default_.i = cpu_info.num_cores;
|
|
|
|
return ReportedConfigSetting::Get(section);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ConfigSectionSettings {
|
|
|
|
const char *section;
|
|
|
|
ConfigSetting *settings;
|
|
|
|
};
|
|
|
|
|
|
|
|
static ConfigSetting generalSettings[] = {
|
|
|
|
ConfigSetting("FirstRun", &g_Config.bFirstRun, true),
|
|
|
|
ConfigSetting("RunCount", &g_Config.iRunCount, 0),
|
|
|
|
ConfigSetting("Enable Logging", &g_Config.bEnableLogging, true),
|
|
|
|
ConfigSetting("AutoRun", &g_Config.bAutoRun, true),
|
|
|
|
ConfigSetting("Browse", &g_Config.bBrowse, false),
|
|
|
|
ConfigSetting("IgnoreBadMemAccess", &g_Config.bIgnoreBadMemAccess, true),
|
|
|
|
ConfigSetting("CurrentDirectory", &g_Config.currentDirectory, ""),
|
|
|
|
ConfigSetting("ShowDebuggerOnLoad", &g_Config.bShowDebuggerOnLoad, false),
|
|
|
|
ConfigSetting("HomebrewStore", &g_Config.bHomebrewStore, false, false),
|
|
|
|
ConfigSetting("CheckForNewVersion", &g_Config.bCheckForNewVersion, true),
|
|
|
|
LangRegionSetting("Language", &g_Config.sLanguageIni),
|
|
|
|
|
|
|
|
NumWorkersSetting("NumWorkerThreads", &g_Config.iNumWorkerThreads),
|
|
|
|
ConfigSetting("EnableAutoLoad", &g_Config.bEnableAutoLoad, false),
|
|
|
|
ReportedConfigSetting("EnableCheats", &g_Config.bEnableCheats, false),
|
|
|
|
ConfigSetting("ScreenshotsAsPNG", &g_Config.bScreenshotsAsPNG, false),
|
|
|
|
ConfigSetting("StateSlot", &g_Config.iCurrentStateSlot, 0),
|
|
|
|
ConfigSetting("RewindFlipFrequency", &g_Config.iRewindFlipFrequency, 0),
|
|
|
|
|
|
|
|
ConfigSetting("GridView1", &g_Config.bGridView1, true),
|
|
|
|
ConfigSetting("GridView2", &g_Config.bGridView2, true),
|
|
|
|
ConfigSetting("GridView3", &g_Config.bGridView3, false),
|
|
|
|
|
|
|
|
// "default" means let emulator decide, "" means disable.
|
|
|
|
ConfigSetting("ReportingHost", &g_Config.sReportHost, "default"),
|
|
|
|
ConfigSetting("AutoSaveSymbolMap", &g_Config.bAutoSaveSymbolMap, false),
|
|
|
|
|
|
|
|
#ifdef ANDROID
|
|
|
|
ConfigSetting("ScreenRotation", &g_Config.iScreenRotation, 1),
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(USING_WIN_UI)
|
|
|
|
ConfigSetting("TopMost", &g_Config.bTopMost, false),
|
|
|
|
ConfigSetting("WindowX", &g_Config.iWindowX, -1), // -1 tells us to center the window.
|
|
|
|
ConfigSetting("WindowY", &g_Config.iWindowY, -1),
|
|
|
|
ConfigSetting("WindowWidth", &g_Config.iWindowWidth, 0), // 0 will be automatically reset later (need to do the AdjustWindowRect dance).
|
|
|
|
ConfigSetting("WindowHeight", &g_Config.iWindowHeight, 0),
|
|
|
|
ConfigSetting("PauseOnLostFocus", &g_Config.bPauseOnLostFocus, false),
|
|
|
|
#endif
|
|
|
|
|
|
|
|
ConfigSetting(false),
|
|
|
|
};
|
|
|
|
|
|
|
|
static ConfigSectionSettings sections[] = {
|
|
|
|
{"General", generalSettings},
|
|
|
|
};
|
|
|
|
|
2013-06-17 20:28:22 +02:00
|
|
|
Config::Config() { }
|
|
|
|
Config::~Config() { }
|
2012-11-01 16:19:01 +01:00
|
|
|
|
2014-01-03 19:04:43 +01:00
|
|
|
std::map<std::string, std::pair<std::string, int>> GetLangValuesMapping() {
|
|
|
|
std::map<std::string, std::pair<std::string, int>> langValuesMapping;
|
|
|
|
IniFile mapping;
|
|
|
|
mapping.LoadFromVFS("langregion.ini");
|
|
|
|
std::vector<std::string> keys;
|
|
|
|
mapping.GetKeys("LangRegionNames", keys);
|
|
|
|
|
|
|
|
|
|
|
|
std::map<std::string, int> langCodeMapping;
|
|
|
|
langCodeMapping["JAPANESE"] = PSP_SYSTEMPARAM_LANGUAGE_JAPANESE;
|
|
|
|
langCodeMapping["ENGLISH"] = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH;
|
|
|
|
langCodeMapping["FRENCH"] = PSP_SYSTEMPARAM_LANGUAGE_FRENCH;
|
|
|
|
langCodeMapping["SPANISH"] = PSP_SYSTEMPARAM_LANGUAGE_SPANISH;
|
|
|
|
langCodeMapping["GERMAN"] = PSP_SYSTEMPARAM_LANGUAGE_GERMAN;
|
|
|
|
langCodeMapping["ITALIAN"] = PSP_SYSTEMPARAM_LANGUAGE_ITALIAN;
|
|
|
|
langCodeMapping["DUTCH"] = PSP_SYSTEMPARAM_LANGUAGE_DUTCH;
|
|
|
|
langCodeMapping["PORTUGUESE"] = PSP_SYSTEMPARAM_LANGUAGE_PORTUGUESE;
|
|
|
|
langCodeMapping["RUSSIAN"] = PSP_SYSTEMPARAM_LANGUAGE_RUSSIAN;
|
|
|
|
langCodeMapping["KOREAN"] = PSP_SYSTEMPARAM_LANGUAGE_KOREAN;
|
|
|
|
langCodeMapping["CHINESE_TRADITIONAL"] = PSP_SYSTEMPARAM_LANGUAGE_CHINESE_TRADITIONAL;
|
|
|
|
langCodeMapping["CHINESE_SIMPLIFIED"] = PSP_SYSTEMPARAM_LANGUAGE_CHINESE_SIMPLIFIED;
|
|
|
|
|
|
|
|
IniFile::Section *langRegionNames = mapping.GetOrCreateSection("LangRegionNames");
|
|
|
|
IniFile::Section *systemLanguage = mapping.GetOrCreateSection("SystemLanguage");
|
|
|
|
|
|
|
|
for (size_t i = 0; i < keys.size(); i++) {
|
|
|
|
std::string langName;
|
|
|
|
langRegionNames->Get(keys[i].c_str(), &langName, "ERROR");
|
|
|
|
std::string langCode;
|
|
|
|
systemLanguage->Get(keys[i].c_str(), &langCode, "ENGLISH");
|
|
|
|
int iLangCode = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH;
|
|
|
|
if (langCodeMapping.find(langCode) != langCodeMapping.end())
|
|
|
|
iLangCode = langCodeMapping[langCode];
|
|
|
|
langValuesMapping[keys[i]] = std::make_pair(langName, iLangCode);
|
|
|
|
}
|
|
|
|
return langValuesMapping;
|
|
|
|
}
|
|
|
|
|
2014-02-09 15:46:49 -08:00
|
|
|
bool LangRegionSetting::Get(IniFile::Section *section) {
|
|
|
|
static std::string defaultLangRegion = "en_US";
|
|
|
|
if (g_Config.bFirstRun) {
|
|
|
|
std::string langRegion = System_GetProperty(SYSPROP_LANGREGION);
|
|
|
|
if (i18nrepo.IniExists(langRegion))
|
|
|
|
defaultLangRegion = langRegion;
|
|
|
|
}
|
|
|
|
|
|
|
|
default_.s = defaultLangRegion.c_str();
|
|
|
|
return ReportedConfigSetting::Get(section);
|
|
|
|
}
|
|
|
|
|
2013-10-25 11:45:41 +02:00
|
|
|
void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
|
2013-10-12 16:02:03 -07:00
|
|
|
iniFilename_ = FindConfigFile(iniFileName != NULL ? iniFileName : "ppsspp.ini");
|
|
|
|
controllerIniFilename_ = FindConfigFile(controllerIniFilename != NULL ? controllerIniFilename : "controls.ini");
|
2013-09-15 12:50:42 -04:00
|
|
|
|
2013-09-15 16:01:46 -07:00
|
|
|
INFO_LOG(LOADER, "Loading config: %s", iniFilename_.c_str());
|
2012-11-01 16:19:01 +01:00
|
|
|
bSaveSettings = true;
|
|
|
|
|
|
|
|
IniFile iniFile;
|
2013-09-15 12:50:42 -04:00
|
|
|
if (!iniFile.Load(iniFilename_)) {
|
2013-09-15 16:01:46 -07:00
|
|
|
ERROR_LOG(LOADER, "Failed to read %s. Setting config to default.", iniFilename_.c_str());
|
2013-01-04 10:26:14 +01:00
|
|
|
// Continue anyway to initialize the config.
|
|
|
|
}
|
2012-11-01 16:19:01 +01:00
|
|
|
|
2014-02-09 15:46:49 -08:00
|
|
|
for (size_t i = 0; i < ARRAY_SIZE(sections); ++i) {
|
|
|
|
IniFile::Section *section = iniFile.GetOrCreateSection(sections[i].section);
|
|
|
|
for (auto setting = sections[i].settings; setting->HasMore(); ++setting) {
|
|
|
|
setting->Get(section);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-01 16:19:01 +01:00
|
|
|
IniFile::Section *general = iniFile.GetOrCreateSection("General");
|
|
|
|
|
2013-11-26 10:24:31 +01:00
|
|
|
iRunCount++;
|
2013-10-26 00:44:19 +08:00
|
|
|
if (!File::Exists(currentDirectory))
|
|
|
|
currentDirectory = "";
|
|
|
|
|
2014-01-03 14:47:33 +01:00
|
|
|
int defaultLang = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH;
|
2013-09-04 12:07:42 +02:00
|
|
|
std::string defaultLangRegion = "en_US";
|
|
|
|
if (bFirstRun) {
|
|
|
|
std::string langRegion = System_GetProperty(SYSPROP_LANGREGION);
|
|
|
|
if (i18nrepo.IniExists(langRegion))
|
|
|
|
defaultLangRegion = langRegion;
|
|
|
|
// TODO: Be smart about same language, different country
|
2014-01-03 18:50:06 +01:00
|
|
|
auto langValuesMapping = GetLangValuesMapping();
|
2014-01-03 14:32:33 +01:00
|
|
|
if (!defaultLangRegion.empty()) {
|
|
|
|
if (langValuesMapping.find(defaultLangRegion) != langValuesMapping.end()) {
|
2014-01-03 14:47:33 +01:00
|
|
|
defaultLang = langValuesMapping[defaultLangRegion].second;
|
2014-01-03 14:32:33 +01:00
|
|
|
}
|
|
|
|
}
|
2013-09-04 12:07:42 +02:00
|
|
|
}
|
|
|
|
|
2013-03-24 20:03:42 +01:00
|
|
|
general->Get("Recent", recentIsos);
|
2013-03-30 17:49:02 +01:00
|
|
|
|
2013-08-30 19:48:56 +02:00
|
|
|
IniFile::Section *recent = iniFile.GetOrCreateSection("Recent");
|
|
|
|
recent->Get("MaxRecent", &iMaxRecent, 30);
|
2013-10-25 11:45:41 +02:00
|
|
|
|
2013-08-30 19:48:56 +02:00
|
|
|
// Fix issue from switching from uint (hex in .ini) to int (dec)
|
|
|
|
if (iMaxRecent == 0)
|
|
|
|
iMaxRecent = 30;
|
|
|
|
|
|
|
|
recentIsos.clear();
|
|
|
|
for (int i = 0; i < iMaxRecent; i++)
|
|
|
|
{
|
|
|
|
char keyName[64];
|
|
|
|
std::string fileName;
|
|
|
|
|
|
|
|
sprintf(keyName,"FileName%d",i);
|
2013-09-05 18:45:41 +02:00
|
|
|
if (!recent->Get(keyName,&fileName,"") || fileName.length() == 0) {
|
|
|
|
// just skip it to get the next key
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
recentIsos.push_back(fileName);
|
|
|
|
}
|
2013-08-30 19:48:56 +02:00
|
|
|
}
|
2012-12-21 16:49:02 +01:00
|
|
|
|
2013-12-07 22:39:35 -08:00
|
|
|
auto pinnedPaths = iniFile.GetOrCreateSection("PinnedPaths")->ToMap();
|
|
|
|
vPinnedPaths.clear();
|
2014-02-10 01:11:16 +01:00
|
|
|
for (auto it = pinnedPaths.begin(), end = pinnedPaths.end(); it != end; ++it) {
|
|
|
|
vPinnedPaths.push_back(it->second);
|
2013-12-07 22:39:35 -08:00
|
|
|
}
|
|
|
|
|
2012-11-23 12:42:35 +01:00
|
|
|
IniFile::Section *cpu = iniFile.GetOrCreateSection("CPU");
|
2013-04-23 14:38:28 +09:00
|
|
|
#ifdef IOS
|
2013-12-02 03:28:20 +08:00
|
|
|
cpu->Get("Jit", &bJit, iosCanUseJit);
|
2013-04-23 14:38:28 +09:00
|
|
|
#else
|
2013-02-16 09:49:33 +01:00
|
|
|
cpu->Get("Jit", &bJit, true);
|
2013-04-23 14:38:28 +09:00
|
|
|
#endif
|
2013-08-08 01:09:43 -07:00
|
|
|
cpu->Get("SeparateCPUThread", &bSeparateCPUThread, false);
|
2013-10-15 11:36:37 +05:30
|
|
|
cpu->Get("AtomicAudioLocks", &bAtomicAudioLocks, false);
|
2013-10-25 11:45:41 +02:00
|
|
|
|
2013-08-21 21:06:02 +02:00
|
|
|
cpu->Get("SeparateIOThread", &bSeparateIOThread, true);
|
2013-11-29 11:50:07 +01:00
|
|
|
cpu->Get("FastMemoryAccess", &bFastMemory, true);
|
2013-08-18 19:51:40 +02:00
|
|
|
cpu->Get("CPUSpeed", &iLockedCPUSpeed, 0);
|
2012-11-23 12:42:35 +01:00
|
|
|
|
2012-11-20 10:59:23 +01:00
|
|
|
IniFile::Section *graphics = iniFile.GetOrCreateSection("Graphics");
|
2013-06-19 13:08:29 +08:00
|
|
|
graphics->Get("ShowFPSCounter", &iShowFPSCounter, false);
|
2013-10-25 11:45:41 +02:00
|
|
|
|
|
|
|
int renderingModeDefault = 1; // Buffered
|
|
|
|
if (System_GetProperty(SYSPROP_NAME) == "samsung:GT-S5360") {
|
|
|
|
renderingModeDefault = 0; // Non-buffered
|
|
|
|
}
|
|
|
|
|
|
|
|
graphics->Get("RenderingMode", &iRenderingMode, renderingModeDefault);
|
2013-08-16 21:48:30 +02:00
|
|
|
graphics->Get("SoftwareRendering", &bSoftwareRendering, false);
|
2013-01-02 21:00:10 +01:00
|
|
|
graphics->Get("HardwareTransform", &bHardwareTransform, true);
|
2013-11-13 19:55:20 +01:00
|
|
|
graphics->Get("SoftwareSkinning", &bSoftwareSkinning, true);
|
2013-07-18 10:26:29 +02:00
|
|
|
graphics->Get("TextureFiltering", &iTexFiltering, 1);
|
2013-11-21 16:29:56 +10:00
|
|
|
// Auto on Windows, 2x on large screens, 1x elsewhere.
|
2014-02-08 11:11:50 -08:00
|
|
|
#if defined(USING_WIN_UI)
|
2013-09-11 00:19:34 +02:00
|
|
|
graphics->Get("InternalResolution", &iInternalResolution, 0);
|
|
|
|
#else
|
2013-11-21 16:29:56 +10:00
|
|
|
graphics->Get("InternalResolution", &iInternalResolution, pixel_xres >= 1024 ? 2 : 1);
|
2013-09-11 00:19:34 +02:00
|
|
|
#endif
|
|
|
|
|
2013-05-02 07:48:28 -07:00
|
|
|
graphics->Get("FrameSkip", &iFrameSkip, 0);
|
2014-01-25 21:41:39 +05:00
|
|
|
graphics->Get("AutoFrameSkip", &bAutoFrameSkip, false);
|
2013-07-06 03:19:56 +08:00
|
|
|
graphics->Get("FrameRate", &iFpsLimit, 0);
|
2013-09-20 20:51:46 +08:00
|
|
|
#ifdef _WIN32
|
2013-09-20 13:57:46 +08:00
|
|
|
graphics->Get("FrameSkipUnthrottle", &bFrameSkipUnthrottle, false);
|
2013-09-20 20:51:46 +08:00
|
|
|
#else
|
|
|
|
graphics->Get("FrameSkipUnthrottle", &bFrameSkipUnthrottle, true);
|
|
|
|
#endif
|
2013-08-21 21:06:02 +02:00
|
|
|
graphics->Get("ForceMaxEmulatedFPS", &iForceMaxEmulatedFPS, 60);
|
2013-02-11 19:03:11 +01:00
|
|
|
#ifdef USING_GLES2
|
2013-05-02 07:48:28 -07:00
|
|
|
graphics->Get("AnisotropyLevel", &iAnisotropyLevel, 0);
|
2013-02-11 19:03:11 +01:00
|
|
|
#else
|
2013-05-02 07:48:28 -07:00
|
|
|
graphics->Get("AnisotropyLevel", &iAnisotropyLevel, 8);
|
2013-02-11 19:03:11 +01:00
|
|
|
#endif
|
2013-07-17 22:27:05 +02:00
|
|
|
if (iAnisotropyLevel > 4) {
|
|
|
|
iAnisotropyLevel = 4;
|
|
|
|
}
|
2013-01-26 17:26:07 +01:00
|
|
|
graphics->Get("VertexCache", &bVertexCache, true);
|
2013-12-29 15:26:09 -08:00
|
|
|
graphics->Get("TextureBackoffCache", &bTextureBackoffCache, false);
|
2013-12-29 14:43:45 -08:00
|
|
|
graphics->Get("TextureSecondaryCache", &bTextureSecondaryCache, false);
|
2013-12-02 03:28:20 +08:00
|
|
|
#ifdef IOS
|
|
|
|
graphics->Get("VertexDecJit", &bVertexDecoderJit, iosCanUseJit);
|
|
|
|
#else
|
2013-11-29 14:20:37 +01:00
|
|
|
graphics->Get("VertexDecJit", &bVertexDecoderJit, true);
|
2013-12-02 03:28:20 +08:00
|
|
|
#endif
|
2013-11-29 16:46:47 +01:00
|
|
|
|
2013-07-06 03:19:56 +08:00
|
|
|
#ifdef _WIN32
|
2013-05-08 23:22:45 +10:00
|
|
|
graphics->Get("FullScreen", &bFullScreen, false);
|
2013-07-06 03:19:56 +08:00
|
|
|
#endif
|
2013-11-30 12:50:41 +01:00
|
|
|
bool partialStretchDefault = false;
|
|
|
|
#ifdef BLACKBERRY
|
|
|
|
partialStretchDefault = pixel_xres < 1.3 * pixel_yres;
|
|
|
|
#endif
|
2014-01-16 00:17:41 +01:00
|
|
|
|
|
|
|
// TODO: Replace these settings with a list of options
|
2013-11-30 12:50:41 +01:00
|
|
|
graphics->Get("PartialStretch", &bPartialStretch, partialStretchDefault);
|
2013-02-13 18:21:21 +01:00
|
|
|
graphics->Get("StretchToDisplay", &bStretchToDisplay, false);
|
2014-01-16 00:17:41 +01:00
|
|
|
graphics->Get("SmallDisplay", &bSmallDisplay, false);
|
2014-02-09 23:16:08 +01:00
|
|
|
graphics->Get("ImmersiveMode", &bImmersiveMode, false);
|
2014-01-16 00:17:41 +01:00
|
|
|
|
2013-02-20 02:07:42 +08:00
|
|
|
graphics->Get("TrueColor", &bTrueColor, true);
|
2013-12-03 20:13:56 +01:00
|
|
|
|
2013-12-21 21:27:22 +08:00
|
|
|
graphics->Get("MipMap", &bMipMap, true);
|
2013-12-03 20:13:56 +01:00
|
|
|
|
2013-05-01 23:55:34 +02:00
|
|
|
graphics->Get("TexScalingLevel", &iTexScalingLevel, 1);
|
2013-05-03 10:29:29 +02:00
|
|
|
graphics->Get("TexScalingType", &iTexScalingType, 0);
|
2013-05-03 16:21:46 +02:00
|
|
|
graphics->Get("TexDeposterize", &bTexDeposterize, false);
|
2013-07-20 22:03:52 +08:00
|
|
|
graphics->Get("VSyncInterval", &bVSync, false);
|
2013-09-05 20:51:17 +08:00
|
|
|
graphics->Get("DisableStencilTest", &bDisableStencilTest, false);
|
|
|
|
graphics->Get("AlwaysDepthWrite", &bAlwaysDepthWrite, false);
|
2013-11-16 02:16:03 +10:00
|
|
|
// Has been in use on Symbian since v0.7. Preferred option.
|
|
|
|
#ifdef __SYMBIAN32__
|
|
|
|
graphics->Get("TimerHack", &bTimerHack, true);
|
|
|
|
#else
|
|
|
|
graphics->Get("TimerHack", &bTimerHack, false);
|
|
|
|
#endif
|
2013-09-24 11:14:04 +02:00
|
|
|
graphics->Get("LowQualitySplineBezier", &bLowQualitySplineBezier, false);
|
2013-10-12 02:05:55 +02:00
|
|
|
graphics->Get("PostShader", &sPostShaderName, "Off");
|
2013-04-30 03:46:27 +02:00
|
|
|
|
2012-11-01 16:19:01 +01:00
|
|
|
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
|
|
|
|
sound->Get("Enable", &bEnableSound, true);
|
2013-07-25 23:51:45 +02:00
|
|
|
sound->Get("VolumeBGM", &iBGMVolume, 7);
|
2013-08-09 08:04:13 -04:00
|
|
|
sound->Get("VolumeSFX", &iSFXVolume, 7);
|
2013-08-24 02:16:10 +02:00
|
|
|
sound->Get("LowLatency", &bLowLatencyAudio, false);
|
|
|
|
|
2012-11-01 16:19:01 +01:00
|
|
|
IniFile::Section *control = iniFile.GetOrCreateSection("Control");
|
2013-10-10 16:44:12 +02:00
|
|
|
control->Get("HapticFeedback", &bHapticFeedback, true);
|
2013-10-19 22:40:52 -04:00
|
|
|
control->Get("ShowAnalogStick", &bShowTouchAnalogStick, true);
|
2013-10-19 23:59:57 -04:00
|
|
|
control->Get("ShowTouchCross", &bShowTouchCross, true);
|
|
|
|
control->Get("ShowTouchCircle", &bShowTouchCircle, true);
|
|
|
|
control->Get("ShowTouchSquare", &bShowTouchSquare, true);
|
|
|
|
control->Get("ShowTouchTriangle", &bShowTouchTriangle, true);
|
|
|
|
control->Get("ShowTouchStart", &bShowTouchStart, true);
|
2013-10-20 12:02:19 -04:00
|
|
|
control->Get("ShowTouchSelect", &bShowTouchSelect, true);
|
2013-10-19 23:59:57 -04:00
|
|
|
control->Get("ShowTouchLTrigger", &bShowTouchLTrigger, true);
|
|
|
|
control->Get("ShowTouchRTrigger", &bShowTouchRTrigger, true);
|
|
|
|
control->Get("ShowAnalogStick", &bShowTouchAnalogStick, true);
|
2013-10-20 12:02:19 -04:00
|
|
|
control->Get("ShowTouchDpad", &bShowTouchDpad, true);
|
2013-10-19 23:59:57 -04:00
|
|
|
control->Get("ShowTouchUnthrottle", &bShowTouchUnthrottle, true);
|
2014-02-08 11:11:50 -08:00
|
|
|
#if defined(USING_WIN_UI)
|
2014-01-07 15:32:58 -05:00
|
|
|
control->Get("IgnoreWindowsKey", &bIgnoreWindowsKey, false);
|
|
|
|
#endif
|
2014-02-08 10:29:22 -08:00
|
|
|
#if defined(MOBILE_DEVICE)
|
2013-09-04 11:29:38 +02:00
|
|
|
std::string name = System_GetProperty(SYSPROP_NAME);
|
2013-09-07 11:05:27 +02:00
|
|
|
if (KeyMap::HasBuiltinController(name)) {
|
2013-08-20 15:40:19 +02:00
|
|
|
control->Get("ShowTouchControls", &bShowTouchControls, false);
|
|
|
|
} else {
|
|
|
|
control->Get("ShowTouchControls", &bShowTouchControls, true);
|
|
|
|
}
|
2013-01-15 01:13:53 +10:00
|
|
|
#else
|
2013-07-06 03:19:56 +08:00
|
|
|
control->Get("ShowTouchControls", &bShowTouchControls, false);
|
2013-01-15 01:13:53 +10:00
|
|
|
#endif
|
2013-07-06 19:08:59 +02:00
|
|
|
// control->Get("KeyMapping",iMappingMap);
|
2014-02-08 10:29:22 -08:00
|
|
|
#ifdef MOBILE_DEVICE
|
2013-10-27 23:28:47 +05:30
|
|
|
control->Get("TiltBaseX", &fTiltBaseX, 0);
|
|
|
|
control->Get("TiltBaseY", &fTiltBaseY, 0);
|
|
|
|
control->Get("InvertTiltX", &bInvertTiltX, false);
|
|
|
|
control->Get("InvertTiltY", &bInvertTiltY, true);
|
|
|
|
control->Get("TiltSensitivityX", &iTiltSensitivityX, 100);
|
|
|
|
control->Get("TiltSensitivityY", &iTiltSensitivityY, 100);
|
2013-11-11 17:22:04 +05:30
|
|
|
control->Get("DeadzoneRadius", &fDeadzoneRadius, 0.2);
|
|
|
|
control->Get("TiltInputType", &iTiltInputType, 0);
|
2013-10-27 23:28:47 +05:30
|
|
|
|
2013-09-30 00:45:06 +05:00
|
|
|
#endif
|
2013-12-02 15:50:09 +01:00
|
|
|
control->Get("DisableDpadDiagonals", &bDisableDpadDiagonals, false);
|
2013-12-11 09:35:27 +01:00
|
|
|
control->Get("TouchButtonStyle", &iTouchButtonStyle, 1);
|
2013-09-30 00:45:06 +05:00
|
|
|
control->Get("TouchButtonOpacity", &iTouchButtonOpacity, 65);
|
2013-10-10 01:45:56 +05:30
|
|
|
//set these to -1 if not initialized. initializing these
|
|
|
|
//requires pixel coordinates which is not known right now.
|
|
|
|
//will be initialized in GamepadEmu::CreatePadLayout
|
2013-12-02 15:15:19 +01:00
|
|
|
float defaultScale = 1.15f;
|
|
|
|
control->Get("ActionButtonSpacing2", &fActionButtonSpacing, 1.0f);
|
2013-11-05 14:52:31 +10:00
|
|
|
control->Get("ActionButtonCenterX", &fActionButtonCenterX, -1.0);
|
|
|
|
control->Get("ActionButtonCenterY", &fActionButtonCenterY, -1.0);
|
2013-12-02 15:15:19 +01:00
|
|
|
control->Get("ActionButtonScale", &fActionButtonScale, defaultScale);
|
2013-11-05 14:52:31 +10:00
|
|
|
control->Get("DPadX", &fDpadX, -1.0);
|
|
|
|
control->Get("DPadY", &fDpadY, -1.0);
|
2013-12-12 14:52:46 +01:00
|
|
|
|
|
|
|
// Check for an old dpad setting
|
|
|
|
float f;
|
|
|
|
control->Get("DPadRadius", &f, 0.0f);
|
|
|
|
if (f > 0.0f) {
|
|
|
|
ResetControlLayout();
|
|
|
|
} else {
|
|
|
|
control->Get("DPadScale", &fDpadScale, defaultScale);
|
|
|
|
control->Get("DPadSpacing", &fDpadSpacing, 1.0f);
|
|
|
|
control->Get("StartKeyX", &fStartKeyX, -1.0);
|
|
|
|
control->Get("StartKeyY", &fStartKeyY, -1.0);
|
|
|
|
control->Get("StartKeyScale", &fStartKeyScale, defaultScale);
|
|
|
|
control->Get("SelectKeyX", &fSelectKeyX, -1.0);
|
|
|
|
control->Get("SelectKeyY", &fSelectKeyY, -1.0);
|
|
|
|
control->Get("SelectKeyScale", &fSelectKeyScale, defaultScale);
|
|
|
|
control->Get("UnthrottleKeyX", &fUnthrottleKeyX, -1.0);
|
|
|
|
control->Get("UnthrottleKeyY", &fUnthrottleKeyY, -1.0);
|
|
|
|
control->Get("UnthrottleKeyScale", &fUnthrottleKeyScale, defaultScale);
|
|
|
|
control->Get("LKeyX", &fLKeyX, -1.0);
|
|
|
|
control->Get("LKeyY", &fLKeyY, -1.0);
|
|
|
|
control->Get("LKeyScale", &fLKeyScale, defaultScale);
|
|
|
|
control->Get("RKeyX", &fRKeyX, -1.0);
|
|
|
|
control->Get("RKeyY", &fRKeyY, -1.0);
|
|
|
|
control->Get("RKeyScale", &fRKeyScale, defaultScale);
|
|
|
|
control->Get("AnalogStickX", &fAnalogStickX, -1.0);
|
|
|
|
control->Get("AnalogStickY", &fAnalogStickY, -1.0);
|
|
|
|
control->Get("AnalogStickScale", &fAnalogStickScale, defaultScale);
|
|
|
|
}
|
2013-11-05 14:52:31 +10:00
|
|
|
|
|
|
|
// MIGRATION: For users who had the old static touch layout, aren't I nice?
|
|
|
|
if (fDpadX > 1.0 || fDpadY > 1.0) // Likely the rest are too!
|
|
|
|
{
|
|
|
|
fActionButtonCenterX /= dp_xres;
|
|
|
|
fActionButtonCenterY /= dp_yres;
|
|
|
|
fDpadX /= dp_xres;
|
|
|
|
fDpadY /= dp_yres;
|
|
|
|
fStartKeyX /= dp_xres;
|
|
|
|
fStartKeyY /= dp_yres;
|
|
|
|
fSelectKeyX /= dp_xres;
|
|
|
|
fSelectKeyY /= dp_yres;
|
|
|
|
fUnthrottleKeyX /= dp_xres;
|
|
|
|
fUnthrottleKeyY /= dp_yres;
|
|
|
|
fLKeyX /= dp_xres;
|
|
|
|
fLKeyY /= dp_yres;
|
|
|
|
fRKeyX /= dp_xres;
|
|
|
|
fRKeyY /= dp_yres;
|
|
|
|
fAnalogStickX /= dp_xres;
|
|
|
|
fAnalogStickY /= dp_yres;
|
|
|
|
}
|
2013-12-04 11:07:00 +01:00
|
|
|
|
|
|
|
IniFile::Section *network = iniFile.GetOrCreateSection("Network");
|
2013-12-04 17:28:20 -05:00
|
|
|
network->Get("EnableWlan", &bEnableWlan, false);
|
2013-12-09 12:49:08 +01:00
|
|
|
|
2013-01-20 10:50:05 +01:00
|
|
|
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
|
2013-12-13 13:06:44 -05:00
|
|
|
pspConfig->Get("PSPFirmwareVersion", &iFirmwareVersion, PSP_DEFAULT_FIRMWARE);
|
2014-02-08 11:14:07 -08:00
|
|
|
// TODO: Can probably default this on, but not sure about its memory differences.
|
2013-12-10 23:22:31 +10:00
|
|
|
#if !defined(_M_X64) && !defined(_WIN32) && !defined(__SYMBIAN32__)
|
2014-02-08 11:14:07 -08:00
|
|
|
pspConfig->Get("PSPModel", &iPSPModel, PSP_MODEL_FAT);
|
|
|
|
#else
|
|
|
|
pspConfig->Get("PSPModel", &iPSPModel, PSP_MODEL_SLIM);
|
2013-11-29 13:41:57 -05:00
|
|
|
#endif
|
2013-07-06 03:19:56 +08:00
|
|
|
pspConfig->Get("NickName", &sNickName, "PPSSPP");
|
2013-11-28 12:38:45 +01:00
|
|
|
pspConfig->Get("proAdhocServer", &proAdhocServer, "localhost");
|
|
|
|
pspConfig->Get("MacAddress", &localMacAddress, "01:02:03:04:05:06");
|
2014-01-03 14:47:33 +01:00
|
|
|
pspConfig->Get("Language", &iLanguage, defaultLang);
|
2013-06-19 13:08:29 +08:00
|
|
|
pspConfig->Get("TimeFormat", &iTimeFormat, PSP_SYSTEMPARAM_TIME_FORMAT_24HR);
|
2013-04-19 21:59:24 +03: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 13:08:29 +08:00
|
|
|
pspConfig->Get("ButtonPreference", &iButtonPreference, PSP_SYSTEMPARAM_BUTTON_CROSS);
|
2013-04-20 09:01:03 -07:00
|
|
|
pspConfig->Get("LockParentalLevel", &iLockParentalLevel, 0);
|
2013-04-19 21:59:24 +03:00
|
|
|
pspConfig->Get("WlanAdhocChannel", &iWlanAdhocChannel, PSP_SYSTEMPARAM_ADHOC_CHANNEL_AUTOMATIC);
|
2014-02-08 11:11:50 -08:00
|
|
|
#if defined(USING_WIN_UI)
|
2013-08-05 21:32:19 -04:00
|
|
|
pspConfig->Get("BypassOSKWithKeyboard", &bBypassOSKWithKeyboard, false);
|
|
|
|
#endif
|
2013-04-19 21:59:24 +03:00
|
|
|
pspConfig->Get("WlanPowerSave", &bWlanPowerSave, PSP_SYSTEMPARAM_WLAN_POWERSAVE_OFF);
|
2013-01-29 00:11:02 +01:00
|
|
|
pspConfig->Get("EncryptSave", &bEncryptSave, true);
|
2013-01-20 10:50:05 +01:00
|
|
|
|
2013-06-26 00:15:16 -07: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-09-28 16:04:56 +02:00
|
|
|
debugConfig->Get("GEWindowX", &iGEWindowX, -1);
|
|
|
|
debugConfig->Get("GEWindowY", &iGEWindowY, -1);
|
|
|
|
debugConfig->Get("GEWindowW", &iGEWindowW, -1);
|
|
|
|
debugConfig->Get("GEWindowH", &iGEWindowH, -1);
|
2013-06-26 00:32:49 -07:00
|
|
|
debugConfig->Get("ConsoleWindowX", &iConsoleWindowX, -1);
|
|
|
|
debugConfig->Get("ConsoleWindowY", &iConsoleWindowY, -1);
|
2013-07-09 11:17:57 +02:00
|
|
|
debugConfig->Get("FontWidth", &iFontWidth, 8);
|
|
|
|
debugConfig->Get("FontHeight", &iFontHeight, 12);
|
2013-07-30 17:06:37 +02:00
|
|
|
debugConfig->Get("DisplayStatusBar", &bDisplayStatusBar, true);
|
2013-09-30 21:42:05 +02:00
|
|
|
debugConfig->Get("ShowBottomTabTitles",&bShowBottomTabTitles,true);
|
2013-09-07 20:54:11 +02:00
|
|
|
debugConfig->Get("ShowDeveloperMenu", &bShowDeveloperMenu, false);
|
2013-10-29 23:02:05 -07:00
|
|
|
debugConfig->Get("SkipDeadbeefFilling", &bSkipDeadbeefFilling, false);
|
2013-12-06 00:11:49 -08:00
|
|
|
debugConfig->Get("FuncHashMap", &bFuncHashMap, false);
|
2013-06-26 00:15:16 -07:00
|
|
|
|
2013-10-08 22:59:40 +02:00
|
|
|
IniFile::Section *speedhacks = iniFile.GetOrCreateSection("SpeedHacks");
|
|
|
|
speedhacks->Get("PrescaleUV", &bPrescaleUV, false);
|
2013-10-22 13:00:19 +02:00
|
|
|
speedhacks->Get("DisableAlphaTest", &bDisableAlphaTest, false);
|
2013-07-27 23:21:48 +02:00
|
|
|
|
2013-11-08 12:30:31 +01:00
|
|
|
IniFile::Section *jitConfig = iniFile.GetOrCreateSection("JIT");
|
|
|
|
jitConfig->Get("DiscardRegsOnJRRA", &bDiscardRegsOnJRRA, false);
|
|
|
|
|
2013-11-26 14:04:29 +01:00
|
|
|
IniFile::Section *upgrade = iniFile.GetOrCreateSection("Upgrade");
|
|
|
|
upgrade->Get("UpgradeMessage", &upgradeMessage, "");
|
|
|
|
upgrade->Get("UpgradeVersion", &upgradeVersion, "");
|
|
|
|
upgrade->Get("DismissedVersion", &dismissedVersion, "");
|
|
|
|
|
|
|
|
if (dismissedVersion == upgradeVersion) {
|
|
|
|
upgradeMessage = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check for new version on every 5 runs.
|
|
|
|
// Sometimes the download may not be finished when the main screen shows (if the user dismisses the
|
|
|
|
// splash screen quickly), but then we'll just show the notification next time instead, we store the
|
|
|
|
// upgrade number in the ini.
|
2013-12-12 22:30:06 +01:00
|
|
|
if (iRunCount % 10 == 0 && bCheckForNewVersion) {
|
2013-12-10 13:14:32 +01:00
|
|
|
std::shared_ptr<http::Download> dl = g_DownloadManager.StartDownloadWithCallback(
|
2013-11-26 14:04:29 +01:00
|
|
|
"http://www.ppsspp.org/version.json", "", &DownloadCompletedCallback);
|
2013-12-10 13:14:32 +01:00
|
|
|
dl->SetHidden(true);
|
2013-11-26 14:04:29 +01:00
|
|
|
}
|
|
|
|
|
2013-09-15 16:01:46 -07:00
|
|
|
INFO_LOG(LOADER, "Loading controller config: %s", controllerIniFilename_.c_str());
|
2013-08-16 19:34:44 +02:00
|
|
|
bSaveSettings = true;
|
|
|
|
|
|
|
|
IniFile controllerIniFile;
|
2013-09-15 12:50:42 -04:00
|
|
|
if (!controllerIniFile.Load(controllerIniFilename_)) {
|
2013-09-15 16:01:46 -07:00
|
|
|
ERROR_LOG(LOADER, "Failed to read %s. Setting controller config to default.", controllerIniFilename_.c_str());
|
2013-08-20 16:06:43 +02:00
|
|
|
KeyMap::RestoreDefault();
|
|
|
|
} else {
|
|
|
|
// Continue anyway to initialize the config. It will just restore the defaults.
|
|
|
|
KeyMap::LoadFromIni(controllerIniFile);
|
2013-08-16 19:34:44 +02:00
|
|
|
}
|
|
|
|
|
2013-04-13 21:24:07 +02:00
|
|
|
CleanRecent();
|
2012-11-01 16:19:01 +01:00
|
|
|
}
|
|
|
|
|
2013-08-20 16:06:43 +02:00
|
|
|
void Config::Save() {
|
2013-01-04 10:26:14 +01:00
|
|
|
if (iniFilename_.size() && g_Config.bSaveSettings) {
|
2013-04-13 21:24:07 +02:00
|
|
|
CleanRecent();
|
2012-11-01 16:19:01 +01:00
|
|
|
IniFile iniFile;
|
2013-01-04 10:26:14 +01:00
|
|
|
if (!iniFile.Load(iniFilename_.c_str())) {
|
|
|
|
ERROR_LOG(LOADER, "Error saving config - can't read ini %s", iniFilename_.c_str());
|
|
|
|
}
|
2012-11-01 16:19:01 +01:00
|
|
|
|
|
|
|
IniFile::Section *general = iniFile.GetOrCreateSection("General");
|
2013-11-29 16:46:47 +01:00
|
|
|
|
2013-06-01 19:01:43 +02:00
|
|
|
// Need to do this somewhere...
|
|
|
|
bFirstRun = false;
|
2014-02-04 12:58:37 +01:00
|
|
|
|
2014-02-09 15:46:49 -08:00
|
|
|
for (size_t i = 0; i < ARRAY_SIZE(sections); ++i) {
|
|
|
|
IniFile::Section *section = iniFile.GetOrCreateSection(sections[i].section);
|
|
|
|
for (auto setting = sections[i].settings; setting->HasMore(); ++setting) {
|
|
|
|
setting->Set(section);
|
|
|
|
}
|
|
|
|
}
|
2013-11-29 14:20:37 +01:00
|
|
|
|
2013-08-30 19:48:56 +02:00
|
|
|
IniFile::Section *recent = iniFile.GetOrCreateSection("Recent");
|
|
|
|
recent->Set("MaxRecent", iMaxRecent);
|
2013-11-29 14:20:37 +01:00
|
|
|
|
2013-09-07 22:31:22 -07:00
|
|
|
for (int i = 0; i < iMaxRecent; i++) {
|
2013-08-30 19:48:56 +02:00
|
|
|
char keyName[64];
|
|
|
|
sprintf(keyName,"FileName%d",i);
|
2013-09-07 22:31:22 -07:00
|
|
|
if (i < (int)recentIsos.size()) {
|
2013-09-05 18:45:41 +02:00
|
|
|
recent->Set(keyName, recentIsos[i]);
|
2013-09-07 22:31:22 -07:00
|
|
|
} else {
|
2013-09-05 18:45:41 +02:00
|
|
|
recent->Delete(keyName); // delete the nonexisting FileName
|
2013-11-29 14:20:37 +01:00
|
|
|
}
|
2013-08-30 19:48:56 +02:00
|
|
|
}
|
2013-03-01 08:51:01 -08:00
|
|
|
|
2013-12-07 22:39:35 -08:00
|
|
|
IniFile::Section *pinnedPaths = iniFile.GetOrCreateSection("PinnedPaths");
|
|
|
|
pinnedPaths->Clear();
|
|
|
|
for (size_t i = 0; i < vPinnedPaths.size(); ++i) {
|
|
|
|
char keyName[64];
|
2013-12-29 16:08:06 -08:00
|
|
|
snprintf(keyName, sizeof(keyName), "Path%d", (int)i);
|
2013-12-07 22:39:35 -08:00
|
|
|
pinnedPaths->Set(keyName, vPinnedPaths[i]);
|
|
|
|
}
|
|
|
|
|
2012-11-23 12:42:35 +01:00
|
|
|
IniFile::Section *cpu = iniFile.GetOrCreateSection("CPU");
|
2013-02-16 09:49:33 +01:00
|
|
|
cpu->Set("Jit", bJit);
|
2013-08-08 01:09:43 -07:00
|
|
|
cpu->Set("SeparateCPUThread", bSeparateCPUThread);
|
2013-11-29 16:46:47 +01:00
|
|
|
cpu->Set("AtomicAudioLocks", bAtomicAudioLocks);
|
2013-08-11 11:51:36 -07:00
|
|
|
cpu->Set("SeparateIOThread", bSeparateIOThread);
|
2013-11-29 11:50:07 +01:00
|
|
|
cpu->Set("FastMemoryAccess", bFastMemory);
|
2013-06-12 17:15:45 -04:00
|
|
|
cpu->Set("CPUSpeed", iLockedCPUSpeed);
|
2012-11-23 12:42:35 +01:00
|
|
|
|
2012-11-20 10:59:23 +01:00
|
|
|
IniFile::Section *graphics = iniFile.GetOrCreateSection("Graphics");
|
2013-06-19 13:08:29 +08:00
|
|
|
graphics->Set("ShowFPSCounter", iShowFPSCounter);
|
2013-07-21 23:17:42 +08:00
|
|
|
graphics->Set("RenderingMode", iRenderingMode);
|
2013-08-16 21:48:30 +02:00
|
|
|
graphics->Set("SoftwareRendering", bSoftwareRendering);
|
2012-12-21 11:08:54 +01:00
|
|
|
graphics->Set("HardwareTransform", bHardwareTransform);
|
2013-11-10 13:18:52 +01:00
|
|
|
graphics->Set("SoftwareSkinning", bSoftwareSkinning);
|
2013-06-30 14:48:50 +08:00
|
|
|
graphics->Set("TextureFiltering", iTexFiltering);
|
2013-09-11 00:19:34 +02:00
|
|
|
graphics->Set("InternalResolution", iInternalResolution);
|
2013-05-02 07:48:28 -07:00
|
|
|
graphics->Set("FrameSkip", iFrameSkip);
|
2014-01-25 21:41:39 +05:00
|
|
|
graphics->Set("AutoFrameSkip", bAutoFrameSkip);
|
2013-05-11 09:03:33 -05:00
|
|
|
graphics->Set("FrameRate", iFpsLimit);
|
2013-09-17 11:36:09 +05:00
|
|
|
graphics->Set("FrameSkipUnthrottle", bFrameSkipUnthrottle);
|
2013-06-30 00:02:33 -07:00
|
|
|
graphics->Set("ForceMaxEmulatedFPS", iForceMaxEmulatedFPS);
|
2013-05-02 07:48:28 -07:00
|
|
|
graphics->Set("AnisotropyLevel", iAnisotropyLevel);
|
2013-01-19 17:05:08 +01:00
|
|
|
graphics->Set("VertexCache", bVertexCache);
|
2013-12-29 14:43:45 -08:00
|
|
|
graphics->Set("TextureBackoffCache", bTextureBackoffCache);
|
|
|
|
graphics->Set("TextureSecondaryCache", bTextureSecondaryCache);
|
2013-07-06 03:19:56 +08:00
|
|
|
#ifdef _WIN32
|
2013-01-27 21:05:09 +08:00
|
|
|
graphics->Set("FullScreen", bFullScreen);
|
2013-11-29 14:20:37 +01:00
|
|
|
#endif
|
2013-05-08 23:22:45 +10:00
|
|
|
graphics->Set("PartialStretch", bPartialStretch);
|
2013-02-13 18:21:21 +01:00
|
|
|
graphics->Set("StretchToDisplay", bStretchToDisplay);
|
2014-01-16 10:03:48 +01:00
|
|
|
graphics->Set("SmallDisplay", bSmallDisplay);
|
2014-02-09 23:16:08 +01:00
|
|
|
graphics->Set("ImmersiveMode", bImmersiveMode);
|
2013-02-20 02:07:42 +08:00
|
|
|
graphics->Set("TrueColor", bTrueColor);
|
2013-04-03 07:33:14 +08:00
|
|
|
graphics->Set("MipMap", bMipMap);
|
2013-05-01 23:55:34 +02:00
|
|
|
graphics->Set("TexScalingLevel", iTexScalingLevel);
|
|
|
|
graphics->Set("TexScalingType", iTexScalingType);
|
2013-05-03 16:21:46 +02:00
|
|
|
graphics->Set("TexDeposterize", bTexDeposterize);
|
2013-07-20 22:03:52 +08:00
|
|
|
graphics->Set("VSyncInterval", bVSync);
|
2013-09-05 20:51:17 +08:00
|
|
|
graphics->Set("DisableStencilTest", bDisableStencilTest);
|
|
|
|
graphics->Set("AlwaysDepthWrite", bAlwaysDepthWrite);
|
2013-11-16 02:16:03 +10:00
|
|
|
graphics->Set("TimerHack", bTimerHack);
|
2013-09-24 11:14:04 +02:00
|
|
|
graphics->Set("LowQualitySplineBezier", bLowQualitySplineBezier);
|
2013-10-12 02:05:55 +02:00
|
|
|
graphics->Set("PostShader", sPostShaderName);
|
2012-11-01 16:19:01 +01:00
|
|
|
|
|
|
|
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
|
|
|
|
sound->Set("Enable", bEnableSound);
|
2013-07-25 23:51:45 +02:00
|
|
|
sound->Set("VolumeBGM", iBGMVolume);
|
2013-08-09 08:04:13 -04:00
|
|
|
sound->Set("VolumeSFX", iSFXVolume);
|
2013-08-24 02:16:10 +02:00
|
|
|
sound->Set("LowLatency", bLowLatencyAudio);
|
2013-07-06 03:19:56 +08:00
|
|
|
|
2012-11-01 16:19:01 +01:00
|
|
|
IniFile::Section *control = iniFile.GetOrCreateSection("Control");
|
2013-10-10 16:44:12 +02:00
|
|
|
control->Set("HapticFeedback", bHapticFeedback);
|
2012-12-01 23:20:08 +01:00
|
|
|
control->Set("ShowTouchControls", bShowTouchControls);
|
2013-10-19 22:40:52 -04:00
|
|
|
control->Set("ShowTouchCross", bShowTouchCross);
|
|
|
|
control->Set("ShowTouchCircle", bShowTouchCircle);
|
|
|
|
control->Set("ShowTouchSquare", bShowTouchSquare);
|
|
|
|
control->Set("ShowTouchTriangle", bShowTouchTriangle);
|
|
|
|
control->Set("ShowTouchStart", bShowTouchStart);
|
|
|
|
control->Set("ShowTouchSelect", bShowTouchSelect);
|
|
|
|
control->Set("ShowTouchLTrigger", bShowTouchLTrigger);
|
|
|
|
control->Set("ShowTouchRTrigger", bShowTouchRTrigger);
|
|
|
|
control->Set("ShowAnalogStick", bShowTouchAnalogStick);
|
|
|
|
control->Set("ShowTouchUnthrottle", bShowTouchUnthrottle);
|
2013-10-20 12:02:19 -04:00
|
|
|
control->Set("ShowTouchDpad", bShowTouchDpad);
|
2013-10-19 22:40:52 -04:00
|
|
|
|
2014-02-08 10:29:22 -08:00
|
|
|
#ifdef MOBILE_DEVICE
|
2013-10-27 23:28:47 +05:30
|
|
|
control->Set("TiltBaseX", fTiltBaseX);
|
|
|
|
control->Set("TiltBaseY", fTiltBaseY);
|
|
|
|
control->Set("InvertTiltX", bInvertTiltX);
|
|
|
|
control->Set("InvertTiltY", bInvertTiltY);
|
|
|
|
control->Set("TiltSensitivityX", iTiltSensitivityX);
|
|
|
|
control->Set("TiltSensitivityY", iTiltSensitivityY);
|
2013-10-28 16:43:42 +05:30
|
|
|
control->Set("DeadzoneRadius", fDeadzoneRadius);
|
2013-11-11 17:22:04 +05:30
|
|
|
control->Set("TiltInputType", iTiltInputType);
|
2013-09-30 00:45:06 +05:00
|
|
|
#endif
|
2013-12-02 15:50:09 +01:00
|
|
|
control->Set("DisableDpadDiagonals", bDisableDpadDiagonals);
|
2013-12-10 23:19:37 +01:00
|
|
|
control->Set("TouchButtonStyle", iTouchButtonStyle);
|
2013-06-17 20:28:22 +02:00
|
|
|
control->Set("TouchButtonOpacity", iTouchButtonOpacity);
|
2013-12-02 15:15:19 +01:00
|
|
|
control->Set("ActionButtonScale", fActionButtonScale);
|
|
|
|
control->Set("ActionButtonSpacing2", fActionButtonSpacing);
|
2013-11-05 14:52:31 +10:00
|
|
|
control->Set("ActionButtonCenterX", fActionButtonCenterX);
|
|
|
|
control->Set("ActionButtonCenterY", fActionButtonCenterY);
|
|
|
|
control->Set("DPadX", fDpadX);
|
|
|
|
control->Set("DPadY", fDpadY);
|
2013-12-02 15:15:19 +01:00
|
|
|
control->Set("DPadScale", fDpadScale);
|
|
|
|
control->Set("DPadSpacing", fDpadSpacing);
|
2013-11-05 14:52:31 +10:00
|
|
|
control->Set("StartKeyX", fStartKeyX);
|
|
|
|
control->Set("StartKeyY", fStartKeyY);
|
2013-12-02 15:15:19 +01:00
|
|
|
control->Set("StartKeyScale", fStartKeyScale);
|
2013-11-05 14:52:31 +10:00
|
|
|
control->Set("SelectKeyX", fSelectKeyX);
|
|
|
|
control->Set("SelectKeyY", fSelectKeyY);
|
2013-12-02 15:15:19 +01:00
|
|
|
control->Set("SelectKeyScale", fSelectKeyScale);
|
2013-11-05 14:52:31 +10:00
|
|
|
control->Set("UnthrottleKeyX", fUnthrottleKeyX);
|
|
|
|
control->Set("UnthrottleKeyY", fUnthrottleKeyY);
|
2013-12-02 15:15:19 +01:00
|
|
|
control->Set("UnthrottleKeyScale", fUnthrottleKeyScale);
|
2013-11-05 14:52:31 +10:00
|
|
|
control->Set("LKeyX", fLKeyX);
|
|
|
|
control->Set("LKeyY", fLKeyY);
|
2013-12-02 15:15:19 +01:00
|
|
|
control->Set("LKeyScale", fLKeyScale);
|
2013-11-05 14:52:31 +10:00
|
|
|
control->Set("RKeyX", fRKeyX);
|
|
|
|
control->Set("RKeyY", fRKeyY);
|
2013-12-02 15:15:19 +01:00
|
|
|
control->Set("RKeyScale", fRKeyScale);
|
2013-11-05 14:52:31 +10:00
|
|
|
control->Set("AnalogStickX", fAnalogStickX);
|
|
|
|
control->Set("AnalogStickY", fAnalogStickY);
|
2013-12-02 15:15:19 +01:00
|
|
|
control->Set("AnalogStickScale", fAnalogStickScale);
|
2013-12-12 14:52:46 +01:00
|
|
|
control->Delete("DPadRadius");
|
2014-02-08 11:11:50 -08:00
|
|
|
#if defined(USING_WIN_UI)
|
2014-01-07 15:32:58 -05:00
|
|
|
control->Set("IgnoreWindowsKey", bIgnoreWindowsKey);
|
|
|
|
#endif
|
2012-11-01 16:19:01 +01:00
|
|
|
|
2013-12-04 11:07:00 +01:00
|
|
|
IniFile::Section *network = iniFile.GetOrCreateSection("Network");
|
2013-12-04 17:28:20 -05:00
|
|
|
network->Set("EnableWlan", bEnableWlan);
|
2013-12-04 11:07:00 +01:00
|
|
|
|
2013-01-20 10:50:05 +01:00
|
|
|
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
|
2013-11-28 12:35:15 -05:00
|
|
|
pspConfig->Set("PSPModel", iPSPModel);
|
2013-12-13 13:06:44 -05:00
|
|
|
pspConfig->Set("PSPFirmwareVersion", iFirmwareVersion);
|
2013-04-19 21:59:24 +03:00
|
|
|
pspConfig->Set("NickName", sNickName.c_str());
|
2013-12-02 15:15:19 +01:00
|
|
|
pspConfig->Set("proAdhocServer", proAdhocServer.c_str());
|
|
|
|
pspConfig->Set("MacAddress", localMacAddress.c_str());
|
2013-09-16 18:08:09 -04:00
|
|
|
pspConfig->Set("Language", iLanguage);
|
2013-06-19 13:08:29 +08:00
|
|
|
pspConfig->Set("TimeFormat", iTimeFormat);
|
2013-04-19 21:59:24 +03:00
|
|
|
pspConfig->Set("DateFormat", iDateFormat);
|
|
|
|
pspConfig->Set("TimeZone", iTimeZone);
|
|
|
|
pspConfig->Set("DayLightSavings", bDayLightSavings);
|
2013-06-19 13:08:29 +08:00
|
|
|
pspConfig->Set("ButtonPreference", iButtonPreference);
|
2013-04-20 09:01:03 -07:00
|
|
|
pspConfig->Set("LockParentalLevel", iLockParentalLevel);
|
2013-04-19 21:59:24 +03:00
|
|
|
pspConfig->Set("WlanAdhocChannel", iWlanAdhocChannel);
|
|
|
|
pspConfig->Set("WlanPowerSave", bWlanPowerSave);
|
2013-01-29 00:11:02 +01:00
|
|
|
pspConfig->Set("EncryptSave", bEncryptSave);
|
2014-02-08 11:11:50 -08:00
|
|
|
#if defined(USING_WIN_UI)
|
2013-08-05 21:32:19 -04:00
|
|
|
pspConfig->Set("BypassOSKWithKeyboard", bBypassOSKWithKeyboard);
|
|
|
|
#endif
|
2013-01-20 10:50:05 +01:00
|
|
|
|
2013-06-26 00:15:16 -07:00
|
|
|
IniFile::Section *debugConfig = iniFile.GetOrCreateSection("Debugger");
|
|
|
|
debugConfig->Set("DisasmWindowX", iDisasmWindowX);
|
|
|
|
debugConfig->Set("DisasmWindowY", iDisasmWindowY);
|
|
|
|
debugConfig->Set("DisasmWindowW", iDisasmWindowW);
|
|
|
|
debugConfig->Set("DisasmWindowH", iDisasmWindowH);
|
2013-09-28 16:04:56 +02:00
|
|
|
debugConfig->Set("GEWindowX", iGEWindowX);
|
|
|
|
debugConfig->Set("GEWindowY", iGEWindowY);
|
|
|
|
debugConfig->Set("GEWindowW", iGEWindowW);
|
|
|
|
debugConfig->Set("GEWindowH", iGEWindowH);
|
2013-06-26 00:32:49 -07:00
|
|
|
debugConfig->Set("ConsoleWindowX", iConsoleWindowX);
|
|
|
|
debugConfig->Set("ConsoleWindowY", iConsoleWindowY);
|
2013-07-09 11:17:57 +02:00
|
|
|
debugConfig->Set("FontWidth", iFontWidth);
|
|
|
|
debugConfig->Set("FontHeight", iFontHeight);
|
2013-07-30 17:06:37 +02:00
|
|
|
debugConfig->Set("DisplayStatusBar", bDisplayStatusBar);
|
2013-09-30 21:42:05 +02:00
|
|
|
debugConfig->Set("ShowBottomTabTitles",bShowBottomTabTitles);
|
2013-09-07 20:54:11 +02:00
|
|
|
debugConfig->Set("ShowDeveloperMenu", bShowDeveloperMenu);
|
2013-10-29 23:02:05 -07:00
|
|
|
debugConfig->Set("SkipDeadbeefFilling", bSkipDeadbeefFilling);
|
2013-12-06 00:11:49 -08:00
|
|
|
debugConfig->Set("FuncHashMap", bFuncHashMap);
|
2013-09-07 20:54:11 +02:00
|
|
|
|
2013-10-08 22:59:40 +02:00
|
|
|
IniFile::Section *speedhacks = iniFile.GetOrCreateSection("SpeedHacks");
|
|
|
|
speedhacks->Set("PrescaleUV", bPrescaleUV);
|
2013-10-22 13:00:19 +02:00
|
|
|
speedhacks->Set("DisableAlphaTest", bDisableAlphaTest);
|
2013-10-08 22:59:40 +02:00
|
|
|
|
2013-11-26 14:04:29 +01:00
|
|
|
// Save upgrade check state
|
|
|
|
IniFile::Section *upgrade = iniFile.GetOrCreateSection("Upgrade");
|
|
|
|
upgrade->Set("UpgradeMessage", upgradeMessage);
|
|
|
|
upgrade->Set("UpgradeVersion", upgradeVersion);
|
|
|
|
upgrade->Set("DismissedVersion", dismissedVersion);
|
|
|
|
|
2013-01-04 10:26:14 +01: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());
|
2013-08-16 19:34:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
IniFile controllerIniFile;
|
|
|
|
if (!controllerIniFile.Load(controllerIniFilename_.c_str())) {
|
|
|
|
ERROR_LOG(LOADER, "Error saving config - can't read ini %s", controllerIniFilename_.c_str());
|
|
|
|
}
|
2013-08-20 16:06:43 +02:00
|
|
|
KeyMap::SaveToIni(controllerIniFile);
|
2013-08-16 19:34:44 +02:00
|
|
|
if (!controllerIniFile.Save(controllerIniFilename_.c_str())) {
|
|
|
|
ERROR_LOG(LOADER, "Error saving config - can't write ini %s", controllerIniFilename_.c_str());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
INFO_LOG(LOADER, "Controller config saved: %s", controllerIniFilename_.c_str());
|
|
|
|
|
2012-11-04 11:54:45 +01:00
|
|
|
} else {
|
2013-01-04 10:26:14 +01:00
|
|
|
INFO_LOG(LOADER, "Not saving config");
|
2012-11-01 16:19:01 +01:00
|
|
|
}
|
|
|
|
}
|
2013-03-24 20:03:42 +01:00
|
|
|
|
2013-11-26 14:04:29 +01:00
|
|
|
// Use for debugging the version check without messing with the server
|
|
|
|
#if 0
|
|
|
|
#define PPSSPP_GIT_VERSION "v0.0.1-gaaaaaaaaa"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void Config::DownloadCompletedCallback(http::Download &download) {
|
|
|
|
if (download.ResultCode() != 200) {
|
|
|
|
ERROR_LOG(LOADER, "Failed to download version.json");
|
2013-11-26 20:10:35 +01:00
|
|
|
return;
|
2013-11-26 14:04:29 +01:00
|
|
|
}
|
|
|
|
std::string data;
|
|
|
|
download.buffer().TakeAll(&data);
|
2013-11-26 20:10:35 +01:00
|
|
|
if (data.empty()) {
|
|
|
|
ERROR_LOG(LOADER, "Version check: Empty data from server!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-11-26 14:04:29 +01:00
|
|
|
JsonReader reader(data.c_str(), data.size());
|
|
|
|
const json_value *root = reader.root();
|
|
|
|
std::string version = root->getString("version", "");
|
|
|
|
|
|
|
|
const char *gitVer = PPSSPP_GIT_VERSION;
|
|
|
|
Version installed(gitVer);
|
|
|
|
Version upgrade(version);
|
|
|
|
Version dismissed(g_Config.dismissedVersion);
|
|
|
|
|
|
|
|
if (!installed.IsValid()) {
|
|
|
|
ERROR_LOG(LOADER, "Version check: Local version string invalid. Build problems? %s", PPSSPP_GIT_VERSION);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!upgrade.IsValid()) {
|
|
|
|
ERROR_LOG(LOADER, "Version check: Invalid server version: %s", version.c_str());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (installed >= upgrade) {
|
|
|
|
INFO_LOG(LOADER, "Version check: Already up to date, erasing any upgrade message");
|
|
|
|
g_Config.upgradeMessage = "";
|
|
|
|
g_Config.upgradeVersion = upgrade.ToString();
|
|
|
|
g_Config.dismissedVersion = "";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (installed < upgrade && dismissed != upgrade) {
|
|
|
|
g_Config.upgradeMessage = "New version of PPSSPP available!";
|
|
|
|
g_Config.upgradeVersion = upgrade.ToString();
|
|
|
|
g_Config.dismissedVersion = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Config::DismissUpgrade() {
|
|
|
|
g_Config.dismissedVersion = g_Config.upgradeVersion;
|
|
|
|
}
|
|
|
|
|
2013-03-24 20:03:42 +01:00
|
|
|
void Config::AddRecent(const std::string &file) {
|
2013-11-24 03:11:33 +10:00
|
|
|
for (auto str = recentIsos.begin(); str != recentIsos.end(); ++str) {
|
2013-11-19 20:46:33 +08:00
|
|
|
#ifdef _WIN32
|
2013-11-24 03:11:33 +10:00
|
|
|
if (!strcmpIgnore((*str).c_str(), file.c_str(), "\\", "/")) {
|
2013-11-19 20:46:33 +08:00
|
|
|
#else
|
2013-11-24 03:11:33 +10:00
|
|
|
if (!strcmp((*str).c_str(), file.c_str())) {
|
2013-11-19 20:46:33 +08:00
|
|
|
#endif
|
2013-03-24 20:03:42 +01:00
|
|
|
recentIsos.erase(str);
|
|
|
|
recentIsos.insert(recentIsos.begin(), file);
|
2013-07-06 11:09:08 +02:00
|
|
|
if ((int)recentIsos.size() > iMaxRecent)
|
2013-05-15 19:51:15 -05:00
|
|
|
recentIsos.resize(iMaxRecent);
|
2013-03-24 20:03:42 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
recentIsos.insert(recentIsos.begin(), file);
|
2013-07-06 11:09:08 +02:00
|
|
|
if ((int)recentIsos.size() > iMaxRecent)
|
2013-05-15 19:51:15 -05:00
|
|
|
recentIsos.resize(iMaxRecent);
|
2013-03-24 20:03:42 +01:00
|
|
|
}
|
2013-04-13 21:24:07 +02:00
|
|
|
|
|
|
|
void Config::CleanRecent() {
|
|
|
|
std::vector<std::string> cleanedRecent;
|
|
|
|
for (size_t i = 0; i < recentIsos.size(); i++) {
|
2013-11-20 16:36:58 +01:00
|
|
|
if (File::Exists(recentIsos[i])) {
|
2013-09-05 00:04:24 +02:00
|
|
|
// clean the redundant recent games' list.
|
2013-11-20 16:36:58 +01:00
|
|
|
if (cleanedRecent.size()==0) { // add first one
|
|
|
|
cleanedRecent.push_back(recentIsos[i]);
|
2013-09-05 00:04:24 +02:00
|
|
|
}
|
2013-11-20 16:36:58 +01:00
|
|
|
for (size_t j = 0; j < cleanedRecent.size();j++) {
|
|
|
|
if (cleanedRecent[j] == recentIsos[i])
|
2013-09-05 00:04:24 +02:00
|
|
|
break; // skip if found redundant
|
2013-11-20 16:36:58 +01:00
|
|
|
if (j == cleanedRecent.size() - 1){ // add if no redundant found
|
2013-09-05 00:04:24 +02:00
|
|
|
cleanedRecent.push_back(recentIsos[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-04-13 21:24:07 +02:00
|
|
|
}
|
|
|
|
recentIsos = cleanedRecent;
|
2013-04-15 08:23:57 +08:00
|
|
|
}
|
2013-08-28 16:23:16 -04:00
|
|
|
|
2013-10-12 16:02:03 -07:00
|
|
|
void Config::SetDefaultPath(const std::string &defaultPath) {
|
|
|
|
defaultPath_ = defaultPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Config::AddSearchPath(const std::string &path) {
|
|
|
|
searchPath_.push_back(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::string Config::FindConfigFile(const std::string &baseFilename) {
|
|
|
|
// Don't search for an absolute path.
|
|
|
|
if (baseFilename.size() > 1 && baseFilename[0] == '/') {
|
|
|
|
return baseFilename;
|
|
|
|
}
|
2013-10-12 16:41:53 -07:00
|
|
|
#ifdef _WIN32
|
|
|
|
if (baseFilename.size() > 3 && baseFilename[1] == ':' && (baseFilename[2] == '/' || baseFilename[2] == '\\')) {
|
|
|
|
return baseFilename;
|
|
|
|
}
|
|
|
|
#endif
|
2013-10-12 16:02:03 -07:00
|
|
|
|
|
|
|
for (size_t i = 0; i < searchPath_.size(); ++i) {
|
|
|
|
std::string filename = searchPath_[i] + baseFilename;
|
|
|
|
if (File::Exists(filename)) {
|
|
|
|
return filename;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::string filename = defaultPath_.empty() ? baseFilename : defaultPath_ + baseFilename;
|
|
|
|
if (!File::Exists(filename)) {
|
|
|
|
std::string path;
|
|
|
|
SplitPath(filename, &path, NULL, NULL);
|
|
|
|
File::CreateFullPath(path);
|
|
|
|
}
|
|
|
|
return filename;
|
|
|
|
}
|
|
|
|
|
2013-08-28 16:23:16 -04:00
|
|
|
void Config::RestoreDefaults() {
|
2013-10-12 16:05:00 -07:00
|
|
|
if(File::Exists(iniFilename_))
|
|
|
|
File::Delete(iniFilename_);
|
2013-08-28 16:23:16 -04:00
|
|
|
recentIsos.clear();
|
|
|
|
currentDirectory = "";
|
|
|
|
Load();
|
|
|
|
}
|
2013-12-12 14:52:46 +01:00
|
|
|
|
|
|
|
void Config::ResetControlLayout() {
|
|
|
|
float defaultScale = 1.15f;
|
|
|
|
g_Config.fActionButtonScale = defaultScale;
|
|
|
|
g_Config.fActionButtonSpacing = 1.0f;
|
|
|
|
g_Config.fActionButtonCenterX = -1.0;
|
|
|
|
g_Config.fActionButtonCenterY = -1.0;
|
|
|
|
g_Config.fDpadScale = defaultScale;
|
|
|
|
g_Config.fDpadSpacing = 1.0f;
|
|
|
|
g_Config.fDpadX = -1.0;
|
|
|
|
g_Config.fDpadY = -1.0;
|
|
|
|
g_Config.fStartKeyX = -1.0;
|
|
|
|
g_Config.fStartKeyY = -1.0;
|
|
|
|
g_Config.fStartKeyScale = defaultScale;
|
|
|
|
g_Config.fSelectKeyX = -1.0;
|
|
|
|
g_Config.fSelectKeyY = -1.0;
|
|
|
|
g_Config.fSelectKeyScale = defaultScale;
|
|
|
|
g_Config.fUnthrottleKeyX = -1.0;
|
|
|
|
g_Config.fUnthrottleKeyY = -1.0;
|
|
|
|
g_Config.fUnthrottleKeyScale = defaultScale;
|
|
|
|
g_Config.fLKeyX = -1.0;
|
|
|
|
g_Config.fLKeyY = -1.0;
|
|
|
|
g_Config.fLKeyScale = defaultScale;
|
|
|
|
g_Config.fRKeyX = -1.0;
|
|
|
|
g_Config.fRKeyY = -1.0;
|
|
|
|
g_Config.fRKeyScale = defaultScale;
|
|
|
|
g_Config.fAnalogStickX = -1.0;
|
|
|
|
g_Config.fAnalogStickY = -1.0;
|
|
|
|
g_Config.fAnalogStickScale = defaultScale;
|
2013-12-07 22:39:35 -08:00
|
|
|
}
|