mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Common/IniFile: Move interface into Common namespace
Gets this out of the global namespace and into the Common namespace
This commit is contained in:
@@ -137,12 +137,12 @@ Java_org_dolphinemu_dolphinemu_features_cheats_model_ARCheat_loadCodes(JNIEnv* e
|
||||
jint revision)
|
||||
{
|
||||
const std::string game_id = GetJString(env, jGameID);
|
||||
IniFile game_ini_local;
|
||||
Common::IniFile game_ini_local;
|
||||
|
||||
// We don't use LoadLocalGameIni() here because user cheat codes that are installed via the UI
|
||||
// will always be stored in GS/${GAMEID}.ini
|
||||
game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + game_id + ".ini");
|
||||
const IniFile game_ini_default = SConfig::LoadDefaultGameIni(game_id, revision);
|
||||
const Common::IniFile game_ini_default = SConfig::LoadDefaultGameIni(game_id, revision);
|
||||
|
||||
const std::vector<ActionReplay::ARCode> codes =
|
||||
ActionReplay::LoadCodes(game_ini_default, game_ini_local);
|
||||
@@ -167,7 +167,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_features_cheats_model_ARCh
|
||||
const std::string game_id = GetJString(env, jGameID);
|
||||
const std::string ini_path = File::GetUserPath(D_GAMESETTINGS_IDX) + game_id + ".ini";
|
||||
|
||||
IniFile game_ini_local;
|
||||
Common::IniFile game_ini_local;
|
||||
game_ini_local.Load(ini_path);
|
||||
ActionReplay::SaveCodes(&game_ini_local, vector);
|
||||
game_ini_local.Save(ini_path);
|
||||
|
||||
@@ -146,12 +146,12 @@ Java_org_dolphinemu_dolphinemu_features_cheats_model_GeckoCheat_loadCodes(JNIEnv
|
||||
jint revision)
|
||||
{
|
||||
const std::string game_id = GetJString(env, jGameID);
|
||||
IniFile game_ini_local;
|
||||
Common::IniFile game_ini_local;
|
||||
|
||||
// We don't use LoadLocalGameIni() here because user cheat codes that are installed via the UI
|
||||
// will always be stored in GS/${GAMEID}.ini
|
||||
game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + game_id + ".ini");
|
||||
const IniFile game_ini_default = SConfig::LoadDefaultGameIni(game_id, revision);
|
||||
const Common::IniFile game_ini_default = SConfig::LoadDefaultGameIni(game_id, revision);
|
||||
|
||||
const std::vector<Gecko::GeckoCode> codes = Gecko::LoadCodes(game_ini_default, game_ini_local);
|
||||
|
||||
@@ -175,7 +175,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_features_cheats_model_Geck
|
||||
const std::string game_id = GetJString(env, jGameID);
|
||||
const std::string ini_path = File::GetUserPath(D_GAMESETTINGS_IDX) + game_id + ".ini";
|
||||
|
||||
IniFile game_ini_local;
|
||||
Common::IniFile game_ini_local;
|
||||
game_ini_local.Load(ini_path);
|
||||
Gecko::SaveCodes(game_ini_local, vector);
|
||||
game_ini_local.Save(ini_path);
|
||||
|
||||
@@ -124,12 +124,12 @@ Java_org_dolphinemu_dolphinemu_features_cheats_model_PatchCheat_loadCodes(JNIEnv
|
||||
jint revision)
|
||||
{
|
||||
const std::string game_id = GetJString(env, jGameID);
|
||||
IniFile game_ini_local;
|
||||
Common::IniFile game_ini_local;
|
||||
|
||||
// We don't use LoadLocalGameIni() here because user cheat codes that are installed via the UI
|
||||
// will always be stored in GS/${GAMEID}.ini
|
||||
game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + game_id + ".ini");
|
||||
const IniFile game_ini_default = SConfig::LoadDefaultGameIni(game_id, revision);
|
||||
const Common::IniFile game_ini_default = SConfig::LoadDefaultGameIni(game_id, revision);
|
||||
|
||||
std::vector<PatchEngine::Patch> patches;
|
||||
PatchEngine::LoadPatchSection("OnFrame", &patches, game_ini_default, game_ini_local);
|
||||
@@ -154,7 +154,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_features_cheats_model_Patc
|
||||
const std::string game_id = GetJString(env, jGameID);
|
||||
const std::string ini_path = File::GetUserPath(D_GAMESETTINGS_IDX) + game_id + ".ini";
|
||||
|
||||
IniFile game_ini_local;
|
||||
Common::IniFile game_ini_local;
|
||||
game_ini_local.Load(ini_path);
|
||||
PatchEngine::SavePatchSection(&game_ini_local, vector);
|
||||
game_ini_local.Save(ini_path);
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "jni/AndroidCommon/AndroidCommon.h"
|
||||
#include "jni/AndroidCommon/IDCache.h"
|
||||
|
||||
using Common::IniFile;
|
||||
|
||||
static IniFile::Section* GetSectionPointer(JNIEnv* env, jobject obj)
|
||||
{
|
||||
return reinterpret_cast<IniFile::Section*>(
|
||||
|
||||
@@ -91,7 +91,7 @@ Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedContro
|
||||
ControllerEmu::EmulatedController* controller = EmulatedControllerFromJava(env, obj);
|
||||
|
||||
// Loading an empty IniFile section clears everything.
|
||||
IniFile::Section section;
|
||||
Common::IniFile::Section section;
|
||||
|
||||
controller->LoadConfig(§ion);
|
||||
controller->UpdateReferences(g_controller_interface);
|
||||
@@ -103,7 +103,7 @@ Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedContro
|
||||
{
|
||||
ControllerEmu::EmulatedController* controller = EmulatedControllerFromJava(env, obj);
|
||||
|
||||
IniFile ini;
|
||||
Common::IniFile ini;
|
||||
ini.Load(GetJString(env, j_path));
|
||||
|
||||
controller->LoadConfig(ini.GetOrCreateSection("Profile"));
|
||||
@@ -118,7 +118,7 @@ Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedContro
|
||||
|
||||
File::CreateFullPath(path);
|
||||
|
||||
IniFile ini;
|
||||
Common::IniFile ini;
|
||||
|
||||
EmulatedControllerFromJava(env, obj)->SaveConfig(ini.GetOrCreateSection("Profile"));
|
||||
ini.Save(path);
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
void IniFile::ParseLine(std::string_view line, std::string* keyOut, std::string* valueOut)
|
||||
{
|
||||
if (line.empty() || line.front() == '#')
|
||||
@@ -369,3 +371,4 @@ bool IniFile::Save(const std::string& filename)
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
} // namespace Common
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
struct CaseInsensitiveStringCompare
|
||||
{
|
||||
// Allow heterogenous lookup.
|
||||
@@ -166,3 +168,4 @@ private:
|
||||
|
||||
static const std::string& NULL_STRING;
|
||||
};
|
||||
} // namespace Common
|
||||
|
||||
@@ -169,18 +169,17 @@ void AddCode(ARCode code)
|
||||
}
|
||||
}
|
||||
|
||||
void LoadAndApplyCodes(const IniFile& global_ini, const IniFile& local_ini)
|
||||
void LoadAndApplyCodes(const Common::IniFile& global_ini, const Common::IniFile& local_ini)
|
||||
{
|
||||
ApplyCodes(LoadCodes(global_ini, local_ini));
|
||||
}
|
||||
|
||||
// Parses the Action Replay section of a game ini file.
|
||||
std::vector<ARCode> LoadCodes(const IniFile& global_ini, const IniFile& local_ini)
|
||||
std::vector<ARCode> LoadCodes(const Common::IniFile& global_ini, const Common::IniFile& local_ini)
|
||||
{
|
||||
std::vector<ARCode> codes;
|
||||
|
||||
const IniFile* inis[2] = {&global_ini, &local_ini};
|
||||
for (const IniFile* ini : inis)
|
||||
for (const auto* ini : {&global_ini, &local_ini})
|
||||
{
|
||||
std::vector<std::string> lines;
|
||||
std::vector<std::string> encrypted_lines;
|
||||
@@ -250,7 +249,7 @@ std::vector<ARCode> LoadCodes(const IniFile& global_ini, const IniFile& local_in
|
||||
return codes;
|
||||
}
|
||||
|
||||
void SaveCodes(IniFile* local_ini, std::span<const ARCode> codes)
|
||||
void SaveCodes(Common::IniFile* local_ini, std::span<const ARCode> codes)
|
||||
{
|
||||
std::vector<std::string> lines;
|
||||
std::vector<std::string> enabled_lines;
|
||||
|
||||
@@ -10,7 +10,10 @@
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
class IniFile;
|
||||
}
|
||||
|
||||
namespace Core
|
||||
{
|
||||
@@ -47,10 +50,10 @@ void SetSyncedCodesAsActive();
|
||||
void UpdateSyncedCodes(std::span<const ARCode> codes);
|
||||
std::vector<ARCode> ApplyAndReturnCodes(std::span<const ARCode> codes);
|
||||
void AddCode(ARCode new_code);
|
||||
void LoadAndApplyCodes(const IniFile& global_ini, const IniFile& local_ini);
|
||||
void LoadAndApplyCodes(const Common::IniFile& global_ini, const Common::IniFile& local_ini);
|
||||
|
||||
std::vector<ARCode> LoadCodes(const IniFile& global_ini, const IniFile& local_ini);
|
||||
void SaveCodes(IniFile* local_ini, std::span<const ARCode> codes);
|
||||
std::vector<ARCode> LoadCodes(const Common::IniFile& global_ini, const Common::IniFile& local_ini);
|
||||
void SaveCodes(Common::IniFile* local_ini, std::span<const ARCode> codes);
|
||||
|
||||
using EncryptedLine = std::string;
|
||||
std::variant<std::monostate, AREntry, EncryptedLine> DeserializeLine(const std::string& line);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "Common/IniFile.h"
|
||||
|
||||
template <typename T>
|
||||
void ReadEnabledOrDisabled(const IniFile& ini, const std::string& section, bool enabled,
|
||||
void ReadEnabledOrDisabled(const Common::IniFile& ini, const std::string& section, bool enabled,
|
||||
std::vector<T>* codes)
|
||||
{
|
||||
std::vector<std::string> lines;
|
||||
@@ -30,7 +30,8 @@ void ReadEnabledOrDisabled(const IniFile& ini, const std::string& section, bool
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void ReadEnabledAndDisabled(const IniFile& ini, const std::string& section, std::vector<T>* codes)
|
||||
void ReadEnabledAndDisabled(const Common::IniFile& ini, const std::string& section,
|
||||
std::vector<T>* codes)
|
||||
{
|
||||
ReadEnabledOrDisabled(ini, section + "_Enabled", true, codes);
|
||||
ReadEnabledOrDisabled(ini, section + "_Disabled", false, codes);
|
||||
|
||||
@@ -113,14 +113,14 @@ public:
|
||||
LoadFromSYSCONF(layer);
|
||||
for (const auto& system : system_to_ini)
|
||||
{
|
||||
IniFile ini;
|
||||
Common::IniFile ini;
|
||||
ini.Load(File::GetUserPath(system.second));
|
||||
const std::list<IniFile::Section>& system_sections = ini.GetSections();
|
||||
const auto& system_sections = ini.GetSections();
|
||||
|
||||
for (const auto& section : system_sections)
|
||||
{
|
||||
const std::string section_name = section.GetName();
|
||||
const IniFile::Section::SectionMap& section_map = section.GetValues();
|
||||
const auto& section_map = section.GetValues();
|
||||
|
||||
for (const auto& value : section_map)
|
||||
{
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
{
|
||||
SaveToSYSCONF(layer->GetLayer());
|
||||
|
||||
std::map<Config::System, IniFile> inis;
|
||||
std::map<Config::System, Common::IniFile> inis;
|
||||
|
||||
for (const auto& system : system_to_ini)
|
||||
{
|
||||
@@ -176,7 +176,7 @@ public:
|
||||
|
||||
if (value)
|
||||
{
|
||||
IniFile::Section* ini_section = ini->second.GetOrCreateSection(location.section);
|
||||
auto* ini_section = ini->second.GetOrCreateSection(location.section);
|
||||
ini_section->Set(location.key, *value);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -175,7 +175,7 @@ public:
|
||||
|
||||
void Load(Config::Layer* layer) override
|
||||
{
|
||||
IniFile ini;
|
||||
Common::IniFile ini;
|
||||
if (layer->GetLayer() == Config::LayerType::GlobalGame)
|
||||
{
|
||||
for (const std::string& filename : GetGameIniFilenames(m_id, m_revision))
|
||||
@@ -187,7 +187,7 @@ public:
|
||||
ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + filename, true);
|
||||
}
|
||||
|
||||
const std::list<IniFile::Section>& system_sections = ini.GetSections();
|
||||
const auto& system_sections = ini.GetSections();
|
||||
|
||||
for (const auto& section : system_sections)
|
||||
{
|
||||
@@ -234,11 +234,11 @@ private:
|
||||
continue;
|
||||
}
|
||||
|
||||
IniFile profile_ini;
|
||||
Common::IniFile profile_ini;
|
||||
profile_ini.Load(ini_path);
|
||||
|
||||
const IniFile::Section* ini_section = profile_ini.GetOrCreateSection("Profile");
|
||||
const IniFile::Section::SectionMap& section_map = ini_section->GetValues();
|
||||
const auto* ini_section = profile_ini.GetOrCreateSection("Profile");
|
||||
const auto& section_map = ini_section->GetValues();
|
||||
for (const auto& value : section_map)
|
||||
{
|
||||
Config::Location location{std::get<2>(use_data), std::get<1>(use_data) + num,
|
||||
@@ -250,12 +250,12 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
void LoadFromSystemSection(Config::Layer* layer, const IniFile::Section& section) const
|
||||
void LoadFromSystemSection(Config::Layer* layer, const Common::IniFile::Section& section) const
|
||||
{
|
||||
const std::string section_name = section.GetName();
|
||||
|
||||
// Regular key,value pairs
|
||||
const IniFile::Section::SectionMap& section_map = section.GetValues();
|
||||
const auto& section_map = section.GetValues();
|
||||
|
||||
for (const auto& value : section_map)
|
||||
{
|
||||
@@ -280,7 +280,7 @@ void INIGameConfigLayerLoader::Save(Config::Layer* layer)
|
||||
if (layer->GetLayer() != Config::LayerType::LocalGame)
|
||||
return;
|
||||
|
||||
IniFile ini;
|
||||
Common::IniFile ini;
|
||||
for (const std::string& file_name : GetGameIniFilenames(m_id, m_revision))
|
||||
ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + file_name, true);
|
||||
|
||||
@@ -298,7 +298,7 @@ void INIGameConfigLayerLoader::Save(Config::Layer* layer)
|
||||
|
||||
if (value)
|
||||
{
|
||||
IniFile::Section* ini_section = ini.GetOrCreateSection(ini_location.first);
|
||||
auto* ini_section = ini.GetOrCreateSection(ini_location.first);
|
||||
ini_section->Set(ini_location.second, *value);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -393,40 +393,40 @@ DiscIO::Language SConfig::GetLanguageAdjustedForRegion(bool wii, DiscIO::Region
|
||||
return language;
|
||||
}
|
||||
|
||||
IniFile SConfig::LoadDefaultGameIni() const
|
||||
Common::IniFile SConfig::LoadDefaultGameIni() const
|
||||
{
|
||||
return LoadDefaultGameIni(GetGameID(), m_revision);
|
||||
}
|
||||
|
||||
IniFile SConfig::LoadLocalGameIni() const
|
||||
Common::IniFile SConfig::LoadLocalGameIni() const
|
||||
{
|
||||
return LoadLocalGameIni(GetGameID(), m_revision);
|
||||
}
|
||||
|
||||
IniFile SConfig::LoadGameIni() const
|
||||
Common::IniFile SConfig::LoadGameIni() const
|
||||
{
|
||||
return LoadGameIni(GetGameID(), m_revision);
|
||||
}
|
||||
|
||||
IniFile SConfig::LoadDefaultGameIni(const std::string& id, std::optional<u16> revision)
|
||||
Common::IniFile SConfig::LoadDefaultGameIni(const std::string& id, std::optional<u16> revision)
|
||||
{
|
||||
IniFile game_ini;
|
||||
Common::IniFile game_ini;
|
||||
for (const std::string& filename : ConfigLoaders::GetGameIniFilenames(id, revision))
|
||||
game_ini.Load(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + filename, true);
|
||||
return game_ini;
|
||||
}
|
||||
|
||||
IniFile SConfig::LoadLocalGameIni(const std::string& id, std::optional<u16> revision)
|
||||
Common::IniFile SConfig::LoadLocalGameIni(const std::string& id, std::optional<u16> revision)
|
||||
{
|
||||
IniFile game_ini;
|
||||
Common::IniFile game_ini;
|
||||
for (const std::string& filename : ConfigLoaders::GetGameIniFilenames(id, revision))
|
||||
game_ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + filename, true);
|
||||
return game_ini;
|
||||
}
|
||||
|
||||
IniFile SConfig::LoadGameIni(const std::string& id, std::optional<u16> revision)
|
||||
Common::IniFile SConfig::LoadGameIni(const std::string& id, std::optional<u16> revision)
|
||||
{
|
||||
IniFile game_ini;
|
||||
Common::IniFile game_ini;
|
||||
for (const std::string& filename : ConfigLoaders::GetGameIniFilenames(id, revision))
|
||||
game_ini.Load(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + filename, true);
|
||||
for (const std::string& filename : ConfigLoaders::GetGameIniFilenames(id, revision))
|
||||
|
||||
@@ -14,7 +14,10 @@
|
||||
#include "Common/Common.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
class IniFile;
|
||||
}
|
||||
|
||||
namespace Core
|
||||
{
|
||||
@@ -81,13 +84,13 @@ struct SConfig
|
||||
DiscIO::Language GetCurrentLanguage(bool wii) const;
|
||||
DiscIO::Language GetLanguageAdjustedForRegion(bool wii, DiscIO::Region region) const;
|
||||
|
||||
IniFile LoadDefaultGameIni() const;
|
||||
IniFile LoadLocalGameIni() const;
|
||||
IniFile LoadGameIni() const;
|
||||
Common::IniFile LoadDefaultGameIni() const;
|
||||
Common::IniFile LoadLocalGameIni() const;
|
||||
Common::IniFile LoadGameIni() const;
|
||||
|
||||
static IniFile LoadDefaultGameIni(const std::string& id, std::optional<u16> revision);
|
||||
static IniFile LoadLocalGameIni(const std::string& id, std::optional<u16> revision);
|
||||
static IniFile LoadGameIni(const std::string& id, std::optional<u16> revision);
|
||||
static Common::IniFile LoadDefaultGameIni(const std::string& id, std::optional<u16> revision);
|
||||
static Common::IniFile LoadLocalGameIni(const std::string& id, std::optional<u16> revision);
|
||||
static Common::IniFile LoadGameIni(const std::string& id, std::optional<u16> revision);
|
||||
|
||||
SConfig(const SConfig&) = delete;
|
||||
SConfig& operator=(const SConfig&) = delete;
|
||||
|
||||
@@ -127,11 +127,11 @@ std::vector<GeckoCode> DownloadCodes(std::string gametdb_id, bool* succeeded, bo
|
||||
return gcodes;
|
||||
}
|
||||
|
||||
std::vector<GeckoCode> LoadCodes(const IniFile& globalIni, const IniFile& localIni)
|
||||
std::vector<GeckoCode> LoadCodes(const Common::IniFile& globalIni, const Common::IniFile& localIni)
|
||||
{
|
||||
std::vector<GeckoCode> gcodes;
|
||||
|
||||
for (const IniFile* ini : {&globalIni, &localIni})
|
||||
for (const auto* ini : {&globalIni, &localIni})
|
||||
{
|
||||
std::vector<std::string> lines;
|
||||
ini->GetLines("Gecko", &lines, false);
|
||||
@@ -239,7 +239,7 @@ static void SaveGeckoCode(std::vector<std::string>& lines, const GeckoCode& gcod
|
||||
lines.push_back('*' + note);
|
||||
}
|
||||
|
||||
void SaveCodes(IniFile& inifile, const std::vector<GeckoCode>& gcodes)
|
||||
void SaveCodes(Common::IniFile& inifile, const std::vector<GeckoCode>& gcodes)
|
||||
{
|
||||
std::vector<std::string> lines;
|
||||
std::vector<std::string> enabled_lines;
|
||||
|
||||
@@ -9,14 +9,17 @@
|
||||
|
||||
#include "Core/GeckoCode.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
class IniFile;
|
||||
}
|
||||
|
||||
namespace Gecko
|
||||
{
|
||||
std::vector<GeckoCode> LoadCodes(const IniFile& globalIni, const IniFile& localIni);
|
||||
std::vector<GeckoCode> LoadCodes(const Common::IniFile& globalIni, const Common::IniFile& localIni);
|
||||
std::vector<GeckoCode> DownloadCodes(std::string gametdb_id, bool* succeeded,
|
||||
bool use_https = true);
|
||||
void SaveCodes(IniFile& inifile, const std::vector<GeckoCode>& gcodes);
|
||||
void SaveCodes(Common::IniFile& inifile, const std::vector<GeckoCode>& gcodes);
|
||||
|
||||
std::optional<GeckoCode::Code> DeserializeLine(const std::string& line);
|
||||
} // namespace Gecko
|
||||
|
||||
@@ -251,7 +251,7 @@ bool IsPressed(int id, bool held)
|
||||
// TODO: Remove this at a future date when we're confident most configs are migrated.
|
||||
static void LoadLegacyConfig(ControllerEmu::EmulatedController* controller)
|
||||
{
|
||||
IniFile inifile;
|
||||
Common::IniFile inifile;
|
||||
if (inifile.Load(File::GetUserPath(D_CONFIG_IDX) + "Hotkeys.ini"))
|
||||
{
|
||||
if (!inifile.Exists("Hotkeys") && inifile.Exists("Hotkeys1"))
|
||||
|
||||
@@ -191,7 +191,7 @@ USB_KBD::USB_KBD(Kernel& ios, const std::string& device_name) : Device(ios, devi
|
||||
std::optional<IPCReply> USB_KBD::Open(const OpenRequest& request)
|
||||
{
|
||||
INFO_LOG_FMT(IOS, "USB_KBD: Open");
|
||||
IniFile ini;
|
||||
Common::IniFile ini;
|
||||
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
|
||||
ini.GetOrCreateSection("USB Keyboard")->Get("Layout", &m_keyboard_layout, KBD_LAYOUT_QWERTY);
|
||||
|
||||
|
||||
@@ -2027,10 +2027,10 @@ bool NetPlayServer::SyncCodes()
|
||||
// Find all INI files
|
||||
const auto game_id = game->GetGameID();
|
||||
const auto revision = game->GetRevision();
|
||||
IniFile globalIni;
|
||||
Common::IniFile globalIni;
|
||||
for (const std::string& filename : ConfigLoaders::GetGameIniFilenames(game_id, revision))
|
||||
globalIni.Load(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + filename, true);
|
||||
IniFile localIni;
|
||||
Common::IniFile localIni;
|
||||
for (const std::string& filename : ConfigLoaders::GetGameIniFilenames(game_id, revision))
|
||||
localIni.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + filename, true);
|
||||
|
||||
|
||||
@@ -101,11 +101,9 @@ std::string SerializeLine(const PatchEntry& entry)
|
||||
}
|
||||
|
||||
void LoadPatchSection(const std::string& section, std::vector<Patch>* patches,
|
||||
const IniFile& globalIni, const IniFile& localIni)
|
||||
const Common::IniFile& globalIni, const Common::IniFile& localIni)
|
||||
{
|
||||
const IniFile* inis[2] = {&globalIni, &localIni};
|
||||
|
||||
for (const IniFile* ini : inis)
|
||||
for (const auto* ini : {&globalIni, &localIni})
|
||||
{
|
||||
std::vector<std::string> lines;
|
||||
Patch currentPatch;
|
||||
@@ -151,7 +149,7 @@ void LoadPatchSection(const std::string& section, std::vector<Patch>* patches,
|
||||
}
|
||||
}
|
||||
|
||||
void SavePatchSection(IniFile* local_ini, const std::vector<Patch>& patches)
|
||||
void SavePatchSection(Common::IniFile* local_ini, const std::vector<Patch>& patches)
|
||||
{
|
||||
std::vector<std::string> lines;
|
||||
std::vector<std::string> lines_enabled;
|
||||
@@ -176,7 +174,7 @@ void SavePatchSection(IniFile* local_ini, const std::vector<Patch>& patches)
|
||||
local_ini->SetLines("OnFrame", lines);
|
||||
}
|
||||
|
||||
static void LoadSpeedhacks(const std::string& section, IniFile& ini)
|
||||
static void LoadSpeedhacks(const std::string& section, Common::IniFile& ini)
|
||||
{
|
||||
std::vector<std::string> keys;
|
||||
ini.GetKeys(section, &keys);
|
||||
@@ -210,9 +208,10 @@ int GetSpeedhackCycles(const u32 addr)
|
||||
|
||||
void LoadPatches()
|
||||
{
|
||||
IniFile merged = SConfig::GetInstance().LoadGameIni();
|
||||
IniFile globalIni = SConfig::GetInstance().LoadDefaultGameIni();
|
||||
IniFile localIni = SConfig::GetInstance().LoadLocalGameIni();
|
||||
const auto& sconfig = SConfig::GetInstance();
|
||||
Common::IniFile merged = sconfig.LoadGameIni();
|
||||
Common::IniFile globalIni = sconfig.LoadDefaultGameIni();
|
||||
Common::IniFile localIni = sconfig.LoadLocalGameIni();
|
||||
|
||||
LoadPatchSection("OnFrame", &s_on_frame, globalIni, localIni);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user