Common/IniFile: Move interface into Common namespace
Gets this out of the global namespace and into the Common namespace
This commit is contained in:
parent
5c03b8af88
commit
e4caace6bb
|
@ -137,12 +137,12 @@ Java_org_dolphinemu_dolphinemu_features_cheats_model_ARCheat_loadCodes(JNIEnv* e
|
||||||
jint revision)
|
jint revision)
|
||||||
{
|
{
|
||||||
const std::string game_id = GetJString(env, jGameID);
|
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
|
// We don't use LoadLocalGameIni() here because user cheat codes that are installed via the UI
|
||||||
// will always be stored in GS/${GAMEID}.ini
|
// will always be stored in GS/${GAMEID}.ini
|
||||||
game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + game_id + ".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 =
|
const std::vector<ActionReplay::ARCode> codes =
|
||||||
ActionReplay::LoadCodes(game_ini_default, game_ini_local);
|
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 game_id = GetJString(env, jGameID);
|
||||||
const std::string ini_path = File::GetUserPath(D_GAMESETTINGS_IDX) + game_id + ".ini";
|
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);
|
game_ini_local.Load(ini_path);
|
||||||
ActionReplay::SaveCodes(&game_ini_local, vector);
|
ActionReplay::SaveCodes(&game_ini_local, vector);
|
||||||
game_ini_local.Save(ini_path);
|
game_ini_local.Save(ini_path);
|
||||||
|
|
|
@ -146,12 +146,12 @@ Java_org_dolphinemu_dolphinemu_features_cheats_model_GeckoCheat_loadCodes(JNIEnv
|
||||||
jint revision)
|
jint revision)
|
||||||
{
|
{
|
||||||
const std::string game_id = GetJString(env, jGameID);
|
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
|
// We don't use LoadLocalGameIni() here because user cheat codes that are installed via the UI
|
||||||
// will always be stored in GS/${GAMEID}.ini
|
// will always be stored in GS/${GAMEID}.ini
|
||||||
game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + game_id + ".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);
|
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 game_id = GetJString(env, jGameID);
|
||||||
const std::string ini_path = File::GetUserPath(D_GAMESETTINGS_IDX) + game_id + ".ini";
|
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);
|
game_ini_local.Load(ini_path);
|
||||||
Gecko::SaveCodes(game_ini_local, vector);
|
Gecko::SaveCodes(game_ini_local, vector);
|
||||||
game_ini_local.Save(ini_path);
|
game_ini_local.Save(ini_path);
|
||||||
|
|
|
@ -124,12 +124,12 @@ Java_org_dolphinemu_dolphinemu_features_cheats_model_PatchCheat_loadCodes(JNIEnv
|
||||||
jint revision)
|
jint revision)
|
||||||
{
|
{
|
||||||
const std::string game_id = GetJString(env, jGameID);
|
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
|
// We don't use LoadLocalGameIni() here because user cheat codes that are installed via the UI
|
||||||
// will always be stored in GS/${GAMEID}.ini
|
// will always be stored in GS/${GAMEID}.ini
|
||||||
game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + game_id + ".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;
|
std::vector<PatchEngine::Patch> patches;
|
||||||
PatchEngine::LoadPatchSection("OnFrame", &patches, game_ini_default, game_ini_local);
|
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 game_id = GetJString(env, jGameID);
|
||||||
const std::string ini_path = File::GetUserPath(D_GAMESETTINGS_IDX) + game_id + ".ini";
|
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);
|
game_ini_local.Load(ini_path);
|
||||||
PatchEngine::SavePatchSection(&game_ini_local, vector);
|
PatchEngine::SavePatchSection(&game_ini_local, vector);
|
||||||
game_ini_local.Save(ini_path);
|
game_ini_local.Save(ini_path);
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include "jni/AndroidCommon/AndroidCommon.h"
|
#include "jni/AndroidCommon/AndroidCommon.h"
|
||||||
#include "jni/AndroidCommon/IDCache.h"
|
#include "jni/AndroidCommon/IDCache.h"
|
||||||
|
|
||||||
|
using Common::IniFile;
|
||||||
|
|
||||||
static IniFile::Section* GetSectionPointer(JNIEnv* env, jobject obj)
|
static IniFile::Section* GetSectionPointer(JNIEnv* env, jobject obj)
|
||||||
{
|
{
|
||||||
return reinterpret_cast<IniFile::Section*>(
|
return reinterpret_cast<IniFile::Section*>(
|
||||||
|
|
|
@ -91,7 +91,7 @@ Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedContro
|
||||||
ControllerEmu::EmulatedController* controller = EmulatedControllerFromJava(env, obj);
|
ControllerEmu::EmulatedController* controller = EmulatedControllerFromJava(env, obj);
|
||||||
|
|
||||||
// Loading an empty IniFile section clears everything.
|
// Loading an empty IniFile section clears everything.
|
||||||
IniFile::Section section;
|
Common::IniFile::Section section;
|
||||||
|
|
||||||
controller->LoadConfig(§ion);
|
controller->LoadConfig(§ion);
|
||||||
controller->UpdateReferences(g_controller_interface);
|
controller->UpdateReferences(g_controller_interface);
|
||||||
|
@ -103,7 +103,7 @@ Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedContro
|
||||||
{
|
{
|
||||||
ControllerEmu::EmulatedController* controller = EmulatedControllerFromJava(env, obj);
|
ControllerEmu::EmulatedController* controller = EmulatedControllerFromJava(env, obj);
|
||||||
|
|
||||||
IniFile ini;
|
Common::IniFile ini;
|
||||||
ini.Load(GetJString(env, j_path));
|
ini.Load(GetJString(env, j_path));
|
||||||
|
|
||||||
controller->LoadConfig(ini.GetOrCreateSection("Profile"));
|
controller->LoadConfig(ini.GetOrCreateSection("Profile"));
|
||||||
|
@ -118,7 +118,7 @@ Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedContro
|
||||||
|
|
||||||
File::CreateFullPath(path);
|
File::CreateFullPath(path);
|
||||||
|
|
||||||
IniFile ini;
|
Common::IniFile ini;
|
||||||
|
|
||||||
EmulatedControllerFromJava(env, obj)->SaveConfig(ini.GetOrCreateSection("Profile"));
|
EmulatedControllerFromJava(env, obj)->SaveConfig(ini.GetOrCreateSection("Profile"));
|
||||||
ini.Save(path);
|
ini.Save(path);
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
|
|
||||||
|
namespace Common
|
||||||
|
{
|
||||||
void IniFile::ParseLine(std::string_view line, std::string* keyOut, std::string* valueOut)
|
void IniFile::ParseLine(std::string_view line, std::string* keyOut, std::string* valueOut)
|
||||||
{
|
{
|
||||||
if (line.empty() || line.front() == '#')
|
if (line.empty() || line.front() == '#')
|
||||||
|
@ -369,3 +371,4 @@ bool IniFile::Save(const std::string& filename)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
} // namespace Common
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
|
|
||||||
|
namespace Common
|
||||||
|
{
|
||||||
struct CaseInsensitiveStringCompare
|
struct CaseInsensitiveStringCompare
|
||||||
{
|
{
|
||||||
// Allow heterogenous lookup.
|
// Allow heterogenous lookup.
|
||||||
|
@ -166,3 +168,4 @@ private:
|
||||||
|
|
||||||
static const std::string& NULL_STRING;
|
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));
|
ApplyCodes(LoadCodes(global_ini, local_ini));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parses the Action Replay section of a game ini file.
|
// 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;
|
std::vector<ARCode> codes;
|
||||||
|
|
||||||
const IniFile* inis[2] = {&global_ini, &local_ini};
|
for (const auto* ini : {&global_ini, &local_ini})
|
||||||
for (const IniFile* ini : inis)
|
|
||||||
{
|
{
|
||||||
std::vector<std::string> lines;
|
std::vector<std::string> lines;
|
||||||
std::vector<std::string> encrypted_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;
|
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> lines;
|
||||||
std::vector<std::string> enabled_lines;
|
std::vector<std::string> enabled_lines;
|
||||||
|
|
|
@ -10,7 +10,10 @@
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
|
namespace Common
|
||||||
|
{
|
||||||
class IniFile;
|
class IniFile;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Core
|
namespace Core
|
||||||
{
|
{
|
||||||
|
@ -47,10 +50,10 @@ void SetSyncedCodesAsActive();
|
||||||
void UpdateSyncedCodes(std::span<const ARCode> codes);
|
void UpdateSyncedCodes(std::span<const ARCode> codes);
|
||||||
std::vector<ARCode> ApplyAndReturnCodes(std::span<const ARCode> codes);
|
std::vector<ARCode> ApplyAndReturnCodes(std::span<const ARCode> codes);
|
||||||
void AddCode(ARCode new_code);
|
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);
|
std::vector<ARCode> LoadCodes(const Common::IniFile& global_ini, const Common::IniFile& local_ini);
|
||||||
void SaveCodes(IniFile* local_ini, std::span<const ARCode> codes);
|
void SaveCodes(Common::IniFile* local_ini, std::span<const ARCode> codes);
|
||||||
|
|
||||||
using EncryptedLine = std::string;
|
using EncryptedLine = std::string;
|
||||||
std::variant<std::monostate, AREntry, EncryptedLine> DeserializeLine(const std::string& line);
|
std::variant<std::monostate, AREntry, EncryptedLine> DeserializeLine(const std::string& line);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "Common/IniFile.h"
|
#include "Common/IniFile.h"
|
||||||
|
|
||||||
template <typename T>
|
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<T>* codes)
|
||||||
{
|
{
|
||||||
std::vector<std::string> lines;
|
std::vector<std::string> lines;
|
||||||
|
@ -30,7 +30,8 @@ void ReadEnabledOrDisabled(const IniFile& ini, const std::string& section, bool
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
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 + "_Enabled", true, codes);
|
||||||
ReadEnabledOrDisabled(ini, section + "_Disabled", false, codes);
|
ReadEnabledOrDisabled(ini, section + "_Disabled", false, codes);
|
||||||
|
|
|
@ -113,14 +113,14 @@ public:
|
||||||
LoadFromSYSCONF(layer);
|
LoadFromSYSCONF(layer);
|
||||||
for (const auto& system : system_to_ini)
|
for (const auto& system : system_to_ini)
|
||||||
{
|
{
|
||||||
IniFile ini;
|
Common::IniFile ini;
|
||||||
ini.Load(File::GetUserPath(system.second));
|
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)
|
for (const auto& section : system_sections)
|
||||||
{
|
{
|
||||||
const std::string section_name = section.GetName();
|
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)
|
for (const auto& value : section_map)
|
||||||
{
|
{
|
||||||
|
@ -141,7 +141,7 @@ public:
|
||||||
{
|
{
|
||||||
SaveToSYSCONF(layer->GetLayer());
|
SaveToSYSCONF(layer->GetLayer());
|
||||||
|
|
||||||
std::map<Config::System, IniFile> inis;
|
std::map<Config::System, Common::IniFile> inis;
|
||||||
|
|
||||||
for (const auto& system : system_to_ini)
|
for (const auto& system : system_to_ini)
|
||||||
{
|
{
|
||||||
|
@ -176,7 +176,7 @@ public:
|
||||||
|
|
||||||
if (value)
|
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);
|
ini_section->Set(location.key, *value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -175,7 +175,7 @@ public:
|
||||||
|
|
||||||
void Load(Config::Layer* layer) override
|
void Load(Config::Layer* layer) override
|
||||||
{
|
{
|
||||||
IniFile ini;
|
Common::IniFile ini;
|
||||||
if (layer->GetLayer() == Config::LayerType::GlobalGame)
|
if (layer->GetLayer() == Config::LayerType::GlobalGame)
|
||||||
{
|
{
|
||||||
for (const std::string& filename : GetGameIniFilenames(m_id, m_revision))
|
for (const std::string& filename : GetGameIniFilenames(m_id, m_revision))
|
||||||
|
@ -187,7 +187,7 @@ public:
|
||||||
ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + filename, true);
|
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)
|
for (const auto& section : system_sections)
|
||||||
{
|
{
|
||||||
|
@ -234,11 +234,11 @@ private:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
IniFile profile_ini;
|
Common::IniFile profile_ini;
|
||||||
profile_ini.Load(ini_path);
|
profile_ini.Load(ini_path);
|
||||||
|
|
||||||
const IniFile::Section* ini_section = profile_ini.GetOrCreateSection("Profile");
|
const auto* ini_section = profile_ini.GetOrCreateSection("Profile");
|
||||||
const IniFile::Section::SectionMap& section_map = ini_section->GetValues();
|
const auto& section_map = ini_section->GetValues();
|
||||||
for (const auto& value : section_map)
|
for (const auto& value : section_map)
|
||||||
{
|
{
|
||||||
Config::Location location{std::get<2>(use_data), std::get<1>(use_data) + num,
|
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();
|
const std::string section_name = section.GetName();
|
||||||
|
|
||||||
// Regular key,value pairs
|
// Regular key,value pairs
|
||||||
const IniFile::Section::SectionMap& section_map = section.GetValues();
|
const auto& section_map = section.GetValues();
|
||||||
|
|
||||||
for (const auto& value : section_map)
|
for (const auto& value : section_map)
|
||||||
{
|
{
|
||||||
|
@ -280,7 +280,7 @@ void INIGameConfigLayerLoader::Save(Config::Layer* layer)
|
||||||
if (layer->GetLayer() != Config::LayerType::LocalGame)
|
if (layer->GetLayer() != Config::LayerType::LocalGame)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IniFile ini;
|
Common::IniFile ini;
|
||||||
for (const std::string& file_name : GetGameIniFilenames(m_id, m_revision))
|
for (const std::string& file_name : GetGameIniFilenames(m_id, m_revision))
|
||||||
ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + file_name, true);
|
ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + file_name, true);
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ void INIGameConfigLayerLoader::Save(Config::Layer* layer)
|
||||||
|
|
||||||
if (value)
|
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);
|
ini_section->Set(ini_location.second, *value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -393,40 +393,40 @@ DiscIO::Language SConfig::GetLanguageAdjustedForRegion(bool wii, DiscIO::Region
|
||||||
return language;
|
return language;
|
||||||
}
|
}
|
||||||
|
|
||||||
IniFile SConfig::LoadDefaultGameIni() const
|
Common::IniFile SConfig::LoadDefaultGameIni() const
|
||||||
{
|
{
|
||||||
return LoadDefaultGameIni(GetGameID(), m_revision);
|
return LoadDefaultGameIni(GetGameID(), m_revision);
|
||||||
}
|
}
|
||||||
|
|
||||||
IniFile SConfig::LoadLocalGameIni() const
|
Common::IniFile SConfig::LoadLocalGameIni() const
|
||||||
{
|
{
|
||||||
return LoadLocalGameIni(GetGameID(), m_revision);
|
return LoadLocalGameIni(GetGameID(), m_revision);
|
||||||
}
|
}
|
||||||
|
|
||||||
IniFile SConfig::LoadGameIni() const
|
Common::IniFile SConfig::LoadGameIni() const
|
||||||
{
|
{
|
||||||
return LoadGameIni(GetGameID(), m_revision);
|
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))
|
for (const std::string& filename : ConfigLoaders::GetGameIniFilenames(id, revision))
|
||||||
game_ini.Load(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + filename, true);
|
game_ini.Load(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + filename, true);
|
||||||
return game_ini;
|
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))
|
for (const std::string& filename : ConfigLoaders::GetGameIniFilenames(id, revision))
|
||||||
game_ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + filename, true);
|
game_ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + filename, true);
|
||||||
return game_ini;
|
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))
|
for (const std::string& filename : ConfigLoaders::GetGameIniFilenames(id, revision))
|
||||||
game_ini.Load(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + filename, true);
|
game_ini.Load(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + filename, true);
|
||||||
for (const std::string& filename : ConfigLoaders::GetGameIniFilenames(id, revision))
|
for (const std::string& filename : ConfigLoaders::GetGameIniFilenames(id, revision))
|
||||||
|
|
|
@ -14,7 +14,10 @@
|
||||||
#include "Common/Common.h"
|
#include "Common/Common.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
|
namespace Common
|
||||||
|
{
|
||||||
class IniFile;
|
class IniFile;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Core
|
namespace Core
|
||||||
{
|
{
|
||||||
|
@ -81,13 +84,13 @@ struct SConfig
|
||||||
DiscIO::Language GetCurrentLanguage(bool wii) const;
|
DiscIO::Language GetCurrentLanguage(bool wii) const;
|
||||||
DiscIO::Language GetLanguageAdjustedForRegion(bool wii, DiscIO::Region region) const;
|
DiscIO::Language GetLanguageAdjustedForRegion(bool wii, DiscIO::Region region) const;
|
||||||
|
|
||||||
IniFile LoadDefaultGameIni() const;
|
Common::IniFile LoadDefaultGameIni() const;
|
||||||
IniFile LoadLocalGameIni() const;
|
Common::IniFile LoadLocalGameIni() const;
|
||||||
IniFile LoadGameIni() const;
|
Common::IniFile LoadGameIni() const;
|
||||||
|
|
||||||
static IniFile LoadDefaultGameIni(const std::string& id, std::optional<u16> revision);
|
static Common::IniFile LoadDefaultGameIni(const std::string& id, std::optional<u16> revision);
|
||||||
static IniFile LoadLocalGameIni(const std::string& id, std::optional<u16> revision);
|
static Common::IniFile LoadLocalGameIni(const std::string& id, std::optional<u16> revision);
|
||||||
static IniFile LoadGameIni(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(const SConfig&) = delete;
|
||||||
SConfig& operator=(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;
|
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;
|
std::vector<GeckoCode> gcodes;
|
||||||
|
|
||||||
for (const IniFile* ini : {&globalIni, &localIni})
|
for (const auto* ini : {&globalIni, &localIni})
|
||||||
{
|
{
|
||||||
std::vector<std::string> lines;
|
std::vector<std::string> lines;
|
||||||
ini->GetLines("Gecko", &lines, false);
|
ini->GetLines("Gecko", &lines, false);
|
||||||
|
@ -239,7 +239,7 @@ static void SaveGeckoCode(std::vector<std::string>& lines, const GeckoCode& gcod
|
||||||
lines.push_back('*' + note);
|
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> lines;
|
||||||
std::vector<std::string> enabled_lines;
|
std::vector<std::string> enabled_lines;
|
||||||
|
|
|
@ -9,14 +9,17 @@
|
||||||
|
|
||||||
#include "Core/GeckoCode.h"
|
#include "Core/GeckoCode.h"
|
||||||
|
|
||||||
|
namespace Common
|
||||||
|
{
|
||||||
class IniFile;
|
class IniFile;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Gecko
|
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,
|
std::vector<GeckoCode> DownloadCodes(std::string gametdb_id, bool* succeeded,
|
||||||
bool use_https = true);
|
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);
|
std::optional<GeckoCode::Code> DeserializeLine(const std::string& line);
|
||||||
} // namespace Gecko
|
} // 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.
|
// TODO: Remove this at a future date when we're confident most configs are migrated.
|
||||||
static void LoadLegacyConfig(ControllerEmu::EmulatedController* controller)
|
static void LoadLegacyConfig(ControllerEmu::EmulatedController* controller)
|
||||||
{
|
{
|
||||||
IniFile inifile;
|
Common::IniFile inifile;
|
||||||
if (inifile.Load(File::GetUserPath(D_CONFIG_IDX) + "Hotkeys.ini"))
|
if (inifile.Load(File::GetUserPath(D_CONFIG_IDX) + "Hotkeys.ini"))
|
||||||
{
|
{
|
||||||
if (!inifile.Exists("Hotkeys") && inifile.Exists("Hotkeys1"))
|
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)
|
std::optional<IPCReply> USB_KBD::Open(const OpenRequest& request)
|
||||||
{
|
{
|
||||||
INFO_LOG_FMT(IOS, "USB_KBD: Open");
|
INFO_LOG_FMT(IOS, "USB_KBD: Open");
|
||||||
IniFile ini;
|
Common::IniFile ini;
|
||||||
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
|
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
|
||||||
ini.GetOrCreateSection("USB Keyboard")->Get("Layout", &m_keyboard_layout, KBD_LAYOUT_QWERTY);
|
ini.GetOrCreateSection("USB Keyboard")->Get("Layout", &m_keyboard_layout, KBD_LAYOUT_QWERTY);
|
||||||
|
|
||||||
|
|
|
@ -2027,10 +2027,10 @@ bool NetPlayServer::SyncCodes()
|
||||||
// Find all INI files
|
// Find all INI files
|
||||||
const auto game_id = game->GetGameID();
|
const auto game_id = game->GetGameID();
|
||||||
const auto revision = game->GetRevision();
|
const auto revision = game->GetRevision();
|
||||||
IniFile globalIni;
|
Common::IniFile globalIni;
|
||||||
for (const std::string& filename : ConfigLoaders::GetGameIniFilenames(game_id, revision))
|
for (const std::string& filename : ConfigLoaders::GetGameIniFilenames(game_id, revision))
|
||||||
globalIni.Load(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + filename, true);
|
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))
|
for (const std::string& filename : ConfigLoaders::GetGameIniFilenames(game_id, revision))
|
||||||
localIni.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + filename, true);
|
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,
|
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 auto* ini : {&globalIni, &localIni})
|
||||||
|
|
||||||
for (const IniFile* ini : inis)
|
|
||||||
{
|
{
|
||||||
std::vector<std::string> lines;
|
std::vector<std::string> lines;
|
||||||
Patch currentPatch;
|
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;
|
||||||
std::vector<std::string> lines_enabled;
|
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);
|
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;
|
std::vector<std::string> keys;
|
||||||
ini.GetKeys(section, &keys);
|
ini.GetKeys(section, &keys);
|
||||||
|
@ -210,9 +208,10 @@ int GetSpeedhackCycles(const u32 addr)
|
||||||
|
|
||||||
void LoadPatches()
|
void LoadPatches()
|
||||||
{
|
{
|
||||||
IniFile merged = SConfig::GetInstance().LoadGameIni();
|
const auto& sconfig = SConfig::GetInstance();
|
||||||
IniFile globalIni = SConfig::GetInstance().LoadDefaultGameIni();
|
Common::IniFile merged = sconfig.LoadGameIni();
|
||||||
IniFile localIni = SConfig::GetInstance().LoadLocalGameIni();
|
Common::IniFile globalIni = sconfig.LoadDefaultGameIni();
|
||||||
|
Common::IniFile localIni = sconfig.LoadLocalGameIni();
|
||||||
|
|
||||||
LoadPatchSection("OnFrame", &s_on_frame, globalIni, localIni);
|
LoadPatchSection("OnFrame", &s_on_frame, globalIni, localIni);
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,10 @@
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
|
namespace Common
|
||||||
|
{
|
||||||
class IniFile;
|
class IniFile;
|
||||||
|
}
|
||||||
|
|
||||||
namespace PatchEngine
|
namespace PatchEngine
|
||||||
{
|
{
|
||||||
|
@ -47,8 +50,8 @@ int GetSpeedhackCycles(const u32 addr);
|
||||||
std::optional<PatchEntry> DeserializeLine(std::string line);
|
std::optional<PatchEntry> DeserializeLine(std::string line);
|
||||||
std::string SerializeLine(const PatchEntry& entry);
|
std::string SerializeLine(const PatchEntry& entry);
|
||||||
void LoadPatchSection(const std::string& section, std::vector<Patch>* patches,
|
void LoadPatchSection(const std::string& section, std::vector<Patch>* patches,
|
||||||
const IniFile& globalIni, const IniFile& localIni);
|
const Common::IniFile& globalIni, const Common::IniFile& localIni);
|
||||||
void SavePatchSection(IniFile* local_ini, const std::vector<Patch>& patches);
|
void SavePatchSection(Common::IniFile* local_ini, const std::vector<Patch>& patches);
|
||||||
void LoadPatches();
|
void LoadPatches();
|
||||||
|
|
||||||
void AddMemoryPatch(std::size_t index);
|
void AddMemoryPatch(std::size_t index);
|
||||||
|
|
|
@ -33,13 +33,14 @@ ARCodeWidget::ARCodeWidget(std::string game_id, u16 game_revision, bool restart_
|
||||||
|
|
||||||
if (!m_game_id.empty())
|
if (!m_game_id.empty())
|
||||||
{
|
{
|
||||||
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
|
// We don't use LoadLocalGameIni() here because user cheat codes that are installed via the UI
|
||||||
// will always be stored in GS/${GAMEID}.ini
|
// will always be stored in GS/${GAMEID}.ini
|
||||||
game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + m_game_id + ".ini");
|
game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + m_game_id + ".ini");
|
||||||
|
|
||||||
const IniFile game_ini_default = SConfig::LoadDefaultGameIni(m_game_id, m_game_revision);
|
const Common::IniFile game_ini_default =
|
||||||
|
SConfig::LoadDefaultGameIni(m_game_id, m_game_revision);
|
||||||
m_ar_codes = ActionReplay::LoadCodes(game_ini_default, game_ini_local);
|
m_ar_codes = ActionReplay::LoadCodes(game_ini_default, game_ini_local);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +186,7 @@ void ARCodeWidget::SaveCodes()
|
||||||
const auto ini_path =
|
const auto ini_path =
|
||||||
std::string(File::GetUserPath(D_GAMESETTINGS_IDX)).append(m_game_id).append(".ini");
|
std::string(File::GetUserPath(D_GAMESETTINGS_IDX)).append(m_game_id).append(".ini");
|
||||||
|
|
||||||
IniFile game_ini_local;
|
Common::IniFile game_ini_local;
|
||||||
game_ini_local.Load(ini_path);
|
game_ini_local.Load(ini_path);
|
||||||
ActionReplay::SaveCodes(&game_ini_local, m_ar_codes);
|
ActionReplay::SaveCodes(&game_ini_local, m_ar_codes);
|
||||||
game_ini_local.Save(ini_path);
|
game_ini_local.Save(ini_path);
|
||||||
|
|
|
@ -63,6 +63,6 @@ private:
|
||||||
const UICommon::GameFile& m_game;
|
const UICommon::GameFile& m_game;
|
||||||
std::string m_game_id;
|
std::string m_game_id;
|
||||||
|
|
||||||
IniFile m_gameini_local;
|
Common::IniFile m_gameini_local;
|
||||||
IniFile m_gameini_default;
|
Common::IniFile m_gameini_default;
|
||||||
};
|
};
|
||||||
|
|
|
@ -40,13 +40,14 @@ GeckoCodeWidget::GeckoCodeWidget(std::string game_id, std::string gametdb_id, u1
|
||||||
|
|
||||||
if (!m_game_id.empty())
|
if (!m_game_id.empty())
|
||||||
{
|
{
|
||||||
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
|
// We don't use LoadLocalGameIni() here because user cheat codes that are installed via the UI
|
||||||
// will always be stored in GS/${GAMEID}.ini
|
// will always be stored in GS/${GAMEID}.ini
|
||||||
game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + m_game_id + ".ini");
|
game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + m_game_id + ".ini");
|
||||||
|
|
||||||
const IniFile game_ini_default = SConfig::LoadDefaultGameIni(m_game_id, m_game_revision);
|
const Common::IniFile game_ini_default =
|
||||||
|
SConfig::LoadDefaultGameIni(m_game_id, m_game_revision);
|
||||||
m_gecko_codes = Gecko::LoadCodes(game_ini_default, game_ini_local);
|
m_gecko_codes = Gecko::LoadCodes(game_ini_default, game_ini_local);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +246,7 @@ void GeckoCodeWidget::SaveCodes()
|
||||||
const auto ini_path =
|
const auto ini_path =
|
||||||
std::string(File::GetUserPath(D_GAMESETTINGS_IDX)).append(m_game_id).append(".ini");
|
std::string(File::GetUserPath(D_GAMESETTINGS_IDX)).append(m_game_id).append(".ini");
|
||||||
|
|
||||||
IniFile game_ini_local;
|
Common::IniFile game_ini_local;
|
||||||
game_ini_local.Load(ini_path);
|
game_ini_local.Load(ini_path);
|
||||||
Gecko::SaveCodes(game_ini_local, m_gecko_codes);
|
Gecko::SaveCodes(game_ini_local, m_gecko_codes);
|
||||||
game_ini_local.Save(ini_path);
|
game_ini_local.Save(ini_path);
|
||||||
|
|
|
@ -299,7 +299,7 @@ void MappingWindow::OnLoadProfilePressed()
|
||||||
|
|
||||||
const QString profile_path = m_profiles_combo->currentData().toString();
|
const QString profile_path = m_profiles_combo->currentData().toString();
|
||||||
|
|
||||||
IniFile ini;
|
Common::IniFile ini;
|
||||||
ini.Load(profile_path.toStdString());
|
ini.Load(profile_path.toStdString());
|
||||||
|
|
||||||
m_controller->LoadConfig(ini.GetOrCreateSection("Profile"));
|
m_controller->LoadConfig(ini.GetOrCreateSection("Profile"));
|
||||||
|
@ -322,7 +322,7 @@ void MappingWindow::OnSaveProfilePressed()
|
||||||
|
|
||||||
File::CreateFullPath(profile_path);
|
File::CreateFullPath(profile_path);
|
||||||
|
|
||||||
IniFile ini;
|
Common::IniFile ini;
|
||||||
|
|
||||||
m_controller->SaveConfig(ini.GetOrCreateSection("Profile"));
|
m_controller->SaveConfig(ini.GetOrCreateSection("Profile"));
|
||||||
ini.Save(profile_path);
|
ini.Save(profile_path);
|
||||||
|
@ -542,7 +542,7 @@ void MappingWindow::OnDefaultFieldsPressed()
|
||||||
void MappingWindow::OnClearFieldsPressed()
|
void MappingWindow::OnClearFieldsPressed()
|
||||||
{
|
{
|
||||||
// Loading an empty inifile section clears everything.
|
// Loading an empty inifile section clears everything.
|
||||||
IniFile::Section sec;
|
Common::IniFile::Section sec;
|
||||||
|
|
||||||
// Keep the currently selected device.
|
// Keep the currently selected device.
|
||||||
const auto default_device = m_controller->GetDefaultDevice();
|
const auto default_device = m_controller->GetDefaultDevice();
|
||||||
|
|
|
@ -21,10 +21,11 @@
|
||||||
PatchesWidget::PatchesWidget(const UICommon::GameFile& game)
|
PatchesWidget::PatchesWidget(const UICommon::GameFile& game)
|
||||||
: m_game_id(game.GetGameID()), m_game_revision(game.GetRevision())
|
: m_game_id(game.GetGameID()), m_game_revision(game.GetRevision())
|
||||||
{
|
{
|
||||||
IniFile game_ini_local;
|
Common::IniFile game_ini_local;
|
||||||
game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + m_game_id + ".ini");
|
game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + m_game_id + ".ini");
|
||||||
|
|
||||||
IniFile game_ini_default = SConfig::GetInstance().LoadDefaultGameIni(m_game_id, m_game_revision);
|
Common::IniFile game_ini_default =
|
||||||
|
SConfig::GetInstance().LoadDefaultGameIni(m_game_id, m_game_revision);
|
||||||
|
|
||||||
PatchEngine::LoadPatchSection("OnFrame", &m_patches, game_ini_default, game_ini_local);
|
PatchEngine::LoadPatchSection("OnFrame", &m_patches, game_ini_default, game_ini_local);
|
||||||
|
|
||||||
|
@ -128,7 +129,7 @@ void PatchesWidget::SavePatches()
|
||||||
{
|
{
|
||||||
const std::string ini_path = File::GetUserPath(D_GAMESETTINGS_IDX) + m_game_id + ".ini";
|
const std::string ini_path = File::GetUserPath(D_GAMESETTINGS_IDX) + m_game_id + ".ini";
|
||||||
|
|
||||||
IniFile game_ini_local;
|
Common::IniFile game_ini_local;
|
||||||
game_ini_local.Load(ini_path);
|
game_ini_local.Load(ini_path);
|
||||||
PatchEngine::SavePatchSection(&game_ini_local, m_patches);
|
PatchEngine::SavePatchSection(&game_ini_local, m_patches);
|
||||||
game_ini_local.Save(ini_path);
|
game_ini_local.Save(ini_path);
|
||||||
|
|
|
@ -337,7 +337,7 @@ void BreakpointWidget::OnEditBreakpoint(u32 address, bool is_instruction_bp)
|
||||||
|
|
||||||
void BreakpointWidget::OnLoad()
|
void BreakpointWidget::OnLoad()
|
||||||
{
|
{
|
||||||
IniFile ini;
|
Common::IniFile ini;
|
||||||
if (!ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().GetGameID() + ".ini",
|
if (!ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().GetGameID() + ".ini",
|
||||||
false))
|
false))
|
||||||
{
|
{
|
||||||
|
@ -367,7 +367,7 @@ void BreakpointWidget::OnLoad()
|
||||||
|
|
||||||
void BreakpointWidget::OnSave()
|
void BreakpointWidget::OnSave()
|
||||||
{
|
{
|
||||||
IniFile ini;
|
Common::IniFile ini;
|
||||||
ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().GetGameID() + ".ini",
|
ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().GetGameID() + ".ini",
|
||||||
false);
|
false);
|
||||||
ini.SetLines("BreakPoints", m_system.GetPowerPC().GetBreakPoints().GetStrings());
|
ini.SetLines("BreakPoints", m_system.GetPowerPC().GetBreakPoints().GetStrings());
|
||||||
|
|
|
@ -289,7 +289,7 @@ void WatchWidget::OnNewWatch()
|
||||||
|
|
||||||
void WatchWidget::OnLoad()
|
void WatchWidget::OnLoad()
|
||||||
{
|
{
|
||||||
IniFile ini;
|
Common::IniFile ini;
|
||||||
|
|
||||||
std::vector<std::string> watches;
|
std::vector<std::string> watches;
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ void WatchWidget::OnLoad()
|
||||||
|
|
||||||
void WatchWidget::OnSave()
|
void WatchWidget::OnSave()
|
||||||
{
|
{
|
||||||
IniFile ini;
|
Common::IniFile ini;
|
||||||
ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().GetGameID() + ".ini",
|
ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().GetGameID() + ".ini",
|
||||||
false);
|
false);
|
||||||
ini.SetLines("Watches", m_system.GetPowerPC().GetDebugInterface().SaveWatchesToStrings());
|
ini.SetLines("Watches", m_system.GetPowerPC().GetDebugInterface().SaveWatchesToStrings());
|
||||||
|
|
|
@ -353,7 +353,7 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : TASInputWindow(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IniFile ini;
|
Common::IniFile ini;
|
||||||
ini.Load(File::GetUserPath(D_CONFIG_IDX) + "WiimoteNew.ini");
|
ini.Load(File::GetUserPath(D_CONFIG_IDX) + "WiimoteNew.ini");
|
||||||
const std::string section_name = "Wiimote" + std::to_string(num + 1);
|
const std::string section_name = "Wiimote" + std::to_string(num + 1);
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ void ControlGroup::AddDeadzoneSetting(SettingValue<double>* value, double maximu
|
||||||
|
|
||||||
ControlGroup::~ControlGroup() = default;
|
ControlGroup::~ControlGroup() = default;
|
||||||
|
|
||||||
void ControlGroup::LoadConfig(IniFile::Section* sec, const std::string& defdev,
|
void ControlGroup::LoadConfig(Common::IniFile::Section* sec, const std::string& defdev,
|
||||||
const std::string& base)
|
const std::string& base)
|
||||||
{
|
{
|
||||||
const std::string group(base + name + "/");
|
const std::string group(base + name + "/");
|
||||||
|
@ -103,7 +103,7 @@ void ControlGroup::LoadConfig(IniFile::Section* sec, const std::string& defdev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlGroup::SaveConfig(IniFile::Section* sec, const std::string& defdev,
|
void ControlGroup::SaveConfig(Common::IniFile::Section* sec, const std::string& defdev,
|
||||||
const std::string& base)
|
const std::string& base)
|
||||||
{
|
{
|
||||||
const std::string group(base + name + "/");
|
const std::string group(base + name + "/");
|
||||||
|
|
|
@ -68,9 +68,9 @@ public:
|
||||||
DefaultValue default_value = DefaultValue::AlwaysEnabled);
|
DefaultValue default_value = DefaultValue::AlwaysEnabled);
|
||||||
virtual ~ControlGroup();
|
virtual ~ControlGroup();
|
||||||
|
|
||||||
virtual void LoadConfig(IniFile::Section* sec, const std::string& defdev = "",
|
virtual void LoadConfig(Common::IniFile::Section* sec, const std::string& defdev = "",
|
||||||
const std::string& base = "");
|
const std::string& base = "");
|
||||||
virtual void SaveConfig(IniFile::Section* sec, const std::string& defdev = "",
|
virtual void SaveConfig(Common::IniFile::Section* sec, const std::string& defdev = "",
|
||||||
const std::string& base = "");
|
const std::string& base = "");
|
||||||
|
|
||||||
void SetControlExpression(int index, const std::string& expression);
|
void SetControlExpression(int index, const std::string& expression);
|
||||||
|
|
|
@ -139,7 +139,7 @@ void EmulatedController::SetDefaultDevice(ciface::Core::DeviceQualifier devq)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmulatedController::LoadConfig(IniFile::Section* sec, const std::string& base)
|
void EmulatedController::LoadConfig(Common::IniFile::Section* sec, const std::string& base)
|
||||||
{
|
{
|
||||||
const auto lock = GetStateLock();
|
const auto lock = GetStateLock();
|
||||||
std::string defdev = GetDefaultDevice().ToString();
|
std::string defdev = GetDefaultDevice().ToString();
|
||||||
|
@ -153,7 +153,7 @@ void EmulatedController::LoadConfig(IniFile::Section* sec, const std::string& ba
|
||||||
cg->LoadConfig(sec, defdev, base);
|
cg->LoadConfig(sec, defdev, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmulatedController::SaveConfig(IniFile::Section* sec, const std::string& base)
|
void EmulatedController::SaveConfig(Common::IniFile::Section* sec, const std::string& base)
|
||||||
{
|
{
|
||||||
const auto lock = GetStateLock();
|
const auto lock = GetStateLock();
|
||||||
const std::string defdev = GetDefaultDevice().ToString();
|
const std::string defdev = GetDefaultDevice().ToString();
|
||||||
|
@ -168,7 +168,7 @@ void EmulatedController::LoadDefaults(const ControllerInterface& ciface)
|
||||||
{
|
{
|
||||||
const auto lock = GetStateLock();
|
const auto lock = GetStateLock();
|
||||||
// load an empty inifile section, clears everything
|
// load an empty inifile section, clears everything
|
||||||
IniFile::Section sec;
|
Common::IniFile::Section sec;
|
||||||
LoadConfig(&sec);
|
LoadConfig(&sec);
|
||||||
|
|
||||||
const std::string& default_device_string = ciface.GetDefaultDeviceString();
|
const std::string& default_device_string = ciface.GetDefaultDeviceString();
|
||||||
|
|
|
@ -182,8 +182,8 @@ public:
|
||||||
|
|
||||||
virtual void LoadDefaults(const ControllerInterface& ciface);
|
virtual void LoadDefaults(const ControllerInterface& ciface);
|
||||||
|
|
||||||
virtual void LoadConfig(IniFile::Section* sec, const std::string& base = "");
|
virtual void LoadConfig(Common::IniFile::Section* sec, const std::string& base = "");
|
||||||
virtual void SaveConfig(IniFile::Section* sec, const std::string& base = "");
|
virtual void SaveConfig(Common::IniFile::Section* sec, const std::string& base = "");
|
||||||
|
|
||||||
bool IsDefaultDeviceConnected() const;
|
bool IsDefaultDeviceConnected() const;
|
||||||
const ciface::Core::DeviceQualifier& GetDefaultDevice() const;
|
const ciface::Core::DeviceQualifier& GetDefaultDevice() const;
|
||||||
|
|
|
@ -60,8 +60,10 @@ public:
|
||||||
|
|
||||||
virtual ~NumericSettingBase() = default;
|
virtual ~NumericSettingBase() = default;
|
||||||
|
|
||||||
virtual void LoadFromIni(const IniFile::Section& section, const std::string& group_name) = 0;
|
virtual void LoadFromIni(const Common::IniFile::Section& section,
|
||||||
virtual void SaveToIni(IniFile::Section& section, const std::string& group_name) const = 0;
|
const std::string& group_name) = 0;
|
||||||
|
virtual void SaveToIni(Common::IniFile::Section& section,
|
||||||
|
const std::string& group_name) const = 0;
|
||||||
|
|
||||||
virtual InputReference& GetInputReference() = 0;
|
virtual InputReference& GetInputReference() = 0;
|
||||||
virtual const InputReference& GetInputReference() const = 0;
|
virtual const InputReference& GetInputReference() const = 0;
|
||||||
|
@ -111,7 +113,7 @@ public:
|
||||||
|
|
||||||
void SetToDefault() override { m_value.SetValue(m_default_value); }
|
void SetToDefault() override { m_value.SetValue(m_default_value); }
|
||||||
|
|
||||||
void LoadFromIni(const IniFile::Section& section, const std::string& group_name) override
|
void LoadFromIni(const Common::IniFile::Section& section, const std::string& group_name) override
|
||||||
{
|
{
|
||||||
std::string str_value;
|
std::string str_value;
|
||||||
if (section.Get(group_name + m_details.ini_name, &str_value))
|
if (section.Get(group_name + m_details.ini_name, &str_value))
|
||||||
|
@ -125,7 +127,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveToIni(IniFile::Section& section, const std::string& group_name) const override
|
void SaveToIni(Common::IniFile::Section& section, const std::string& group_name) const override
|
||||||
{
|
{
|
||||||
if (IsSimpleValue())
|
if (IsSimpleValue())
|
||||||
{
|
{
|
||||||
|
|
|
@ -226,8 +226,8 @@ void ReshapableInput::SetCenter(ReshapableInput::ReshapeData center)
|
||||||
m_center = center;
|
m_center = center;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReshapableInput::LoadConfig(IniFile::Section* section, const std::string& default_device,
|
void ReshapableInput::LoadConfig(Common::IniFile::Section* section,
|
||||||
const std::string& base_name)
|
const std::string& default_device, const std::string& base_name)
|
||||||
{
|
{
|
||||||
ControlGroup::LoadConfig(section, default_device, base_name);
|
ControlGroup::LoadConfig(section, default_device, base_name);
|
||||||
|
|
||||||
|
@ -269,8 +269,8 @@ void ReshapableInput::LoadConfig(IniFile::Section* section, const std::string& d
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReshapableInput::SaveConfig(IniFile::Section* section, const std::string& default_device,
|
void ReshapableInput::SaveConfig(Common::IniFile::Section* section,
|
||||||
const std::string& base_name)
|
const std::string& default_device, const std::string& base_name)
|
||||||
{
|
{
|
||||||
ControlGroup::SaveConfig(section, default_device, base_name);
|
ControlGroup::SaveConfig(section, default_device, base_name);
|
||||||
|
|
||||||
|
|
|
@ -117,8 +117,8 @@ protected:
|
||||||
virtual Control* GetModifierInput() const;
|
virtual Control* GetModifierInput() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void LoadConfig(IniFile::Section*, const std::string&, const std::string&) override;
|
void LoadConfig(Common::IniFile::Section*, const std::string&, const std::string&) override;
|
||||||
void SaveConfig(IniFile::Section*, const std::string&, const std::string&) override;
|
void SaveConfig(Common::IniFile::Section*, const std::string&, const std::string&) override;
|
||||||
|
|
||||||
CalibrationData m_calibration;
|
CalibrationData m_calibration;
|
||||||
SettingValue<double> m_deadzone_setting;
|
SettingValue<double> m_deadzone_setting;
|
||||||
|
|
|
@ -39,7 +39,7 @@ void DynamicInputTextureManager::Load()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicInputTextureManager::GenerateTextures(const IniFile& file,
|
void DynamicInputTextureManager::GenerateTextures(const Common::IniFile& file,
|
||||||
const std::vector<std::string>& controller_names)
|
const std::vector<std::string>& controller_names)
|
||||||
{
|
{
|
||||||
bool any_dirty = false;
|
bool any_dirty = false;
|
||||||
|
|
|
@ -20,7 +20,8 @@ public:
|
||||||
DynamicInputTextureManager();
|
DynamicInputTextureManager();
|
||||||
~DynamicInputTextureManager();
|
~DynamicInputTextureManager();
|
||||||
void Load();
|
void Load();
|
||||||
void GenerateTextures(const IniFile& file, const std::vector<std::string>& controller_names);
|
void GenerateTextures(const Common::IniFile& file,
|
||||||
|
const std::vector<std::string>& controller_names);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<DynamicInputTextures::Configuration> m_configuration;
|
std::vector<DynamicInputTextures::Configuration> m_configuration;
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include "Common/CommonPaths.h"
|
#include "Common/CommonPaths.h"
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
|
#include "Common/IniFile.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
|
@ -86,7 +87,7 @@ Configuration::Configuration(const std::string& json_file)
|
||||||
|
|
||||||
Configuration::~Configuration() = default;
|
Configuration::~Configuration() = default;
|
||||||
|
|
||||||
bool Configuration::GenerateTextures(const IniFile& file,
|
bool Configuration::GenerateTextures(const Common::IniFile& file,
|
||||||
const std::vector<std::string>& controller_names) const
|
const std::vector<std::string>& controller_names) const
|
||||||
{
|
{
|
||||||
bool any_dirty = false;
|
bool any_dirty = false;
|
||||||
|
@ -98,7 +99,7 @@ bool Configuration::GenerateTextures(const IniFile& file,
|
||||||
return any_dirty;
|
return any_dirty;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Configuration::GenerateTexture(const IniFile& file,
|
bool Configuration::GenerateTexture(const Common::IniFile& file,
|
||||||
const std::vector<std::string>& controller_names,
|
const std::vector<std::string>& controller_names,
|
||||||
const Data& texture_data) const
|
const Data& texture_data) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,13 +4,16 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/IniFile.h"
|
|
||||||
#include "InputCommon/DynamicInputTextures/DITData.h"
|
#include "InputCommon/DynamicInputTextures/DITData.h"
|
||||||
|
|
||||||
|
namespace Common
|
||||||
|
{
|
||||||
|
class IniFile;
|
||||||
|
}
|
||||||
|
|
||||||
namespace InputCommon::DynamicInputTextures
|
namespace InputCommon::DynamicInputTextures
|
||||||
{
|
{
|
||||||
class Configuration
|
class Configuration
|
||||||
|
@ -18,11 +21,12 @@ class Configuration
|
||||||
public:
|
public:
|
||||||
explicit Configuration(const std::string& json_file);
|
explicit Configuration(const std::string& json_file);
|
||||||
~Configuration();
|
~Configuration();
|
||||||
bool GenerateTextures(const IniFile& file,
|
bool GenerateTextures(const Common::IniFile& file,
|
||||||
const std::vector<std::string>& controller_names) const;
|
const std::vector<std::string>& controller_names) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool GenerateTexture(const IniFile& file, const std::vector<std::string>& controller_names,
|
bool GenerateTexture(const Common::IniFile& file,
|
||||||
|
const std::vector<std::string>& controller_names,
|
||||||
const Data& texture_data) const;
|
const Data& texture_data) const;
|
||||||
|
|
||||||
std::vector<Data> m_dynamic_input_textures;
|
std::vector<Data> m_dynamic_input_textures;
|
||||||
|
|
|
@ -29,7 +29,7 @@ InputConfig::~InputConfig() = default;
|
||||||
|
|
||||||
bool InputConfig::LoadConfig(InputClass type)
|
bool InputConfig::LoadConfig(InputClass type)
|
||||||
{
|
{
|
||||||
IniFile inifile;
|
Common::IniFile inifile;
|
||||||
bool useProfile[MAX_BBMOTES] = {false, false, false, false, false};
|
bool useProfile[MAX_BBMOTES] = {false, false, false, false, false};
|
||||||
static constexpr std::array<std::string_view, MAX_BBMOTES> num = {"1", "2", "3", "4", "BB"};
|
static constexpr std::array<std::string_view, MAX_BBMOTES> num = {"1", "2", "3", "4", "BB"};
|
||||||
std::string profile[MAX_BBMOTES];
|
std::string profile[MAX_BBMOTES];
|
||||||
|
@ -57,8 +57,8 @@ bool InputConfig::LoadConfig(InputClass type)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
IniFile game_ini = SConfig::GetInstance().LoadGameIni();
|
Common::IniFile game_ini = SConfig::GetInstance().LoadGameIni();
|
||||||
IniFile::Section* control_section = game_ini.GetOrCreateSection("Controls");
|
auto* control_section = game_ini.GetOrCreateSection("Controls");
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
|
@ -95,7 +95,7 @@ bool InputConfig::LoadConfig(InputClass type)
|
||||||
std::vector<std::string> controller_names;
|
std::vector<std::string> controller_names;
|
||||||
for (auto& controller : m_controllers)
|
for (auto& controller : m_controllers)
|
||||||
{
|
{
|
||||||
IniFile::Section config;
|
Common::IniFile::Section config;
|
||||||
// Load settings from ini
|
// Load settings from ini
|
||||||
if (useProfile[n])
|
if (useProfile[n])
|
||||||
{
|
{
|
||||||
|
@ -146,7 +146,7 @@ void InputConfig::SaveConfig()
|
||||||
{
|
{
|
||||||
std::string ini_filename = File::GetUserPath(D_CONFIG_IDX) + m_ini_name + ".ini";
|
std::string ini_filename = File::GetUserPath(D_CONFIG_IDX) + m_ini_name + ".ini";
|
||||||
|
|
||||||
IniFile inifile;
|
Common::IniFile inifile;
|
||||||
inifile.Load(ini_filename);
|
inifile.Load(ini_filename);
|
||||||
|
|
||||||
std::vector<std::string> controller_names;
|
std::vector<std::string> controller_names;
|
||||||
|
@ -212,7 +212,7 @@ bool InputConfig::IsControllerControlledByGamepadDevice(int index) const
|
||||||
controller.name == "Keyboard Mouse")); // Windows Keyboard/Mouse
|
controller.name == "Keyboard Mouse")); // Windows Keyboard/Mouse
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputConfig::GenerateControllerTextures(const IniFile& file)
|
void InputConfig::GenerateControllerTextures(const Common::IniFile& file)
|
||||||
{
|
{
|
||||||
std::vector<std::string> controller_names;
|
std::vector<std::string> controller_names;
|
||||||
for (auto& controller : m_controllers)
|
for (auto& controller : m_controllers)
|
||||||
|
|
|
@ -11,6 +11,11 @@
|
||||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||||
#include "InputCommon/DynamicInputTextureManager.h"
|
#include "InputCommon/DynamicInputTextureManager.h"
|
||||||
|
|
||||||
|
namespace Common
|
||||||
|
{
|
||||||
|
class IniFile;
|
||||||
|
}
|
||||||
|
|
||||||
namespace ControllerEmu
|
namespace ControllerEmu
|
||||||
{
|
{
|
||||||
class EmulatedController;
|
class EmulatedController;
|
||||||
|
@ -53,7 +58,7 @@ public:
|
||||||
void RegisterHotplugCallback();
|
void RegisterHotplugCallback();
|
||||||
void UnregisterHotplugCallback();
|
void UnregisterHotplugCallback();
|
||||||
|
|
||||||
void GenerateControllerTextures(const IniFile& file);
|
void GenerateControllerTextures(const Common::IniFile& file);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ControllerInterface::HotplugCallbackHandle m_hotplug_callback_handle;
|
ControllerInterface::HotplugCallbackHandle m_hotplug_callback_handle;
|
||||||
|
|
|
@ -78,7 +78,7 @@ void ProfileCycler::UpdateToProfile(const std::string& profile_filename,
|
||||||
std::string base;
|
std::string base;
|
||||||
SplitPath(profile_filename, nullptr, &base, nullptr);
|
SplitPath(profile_filename, nullptr, &base, nullptr);
|
||||||
|
|
||||||
IniFile ini_file;
|
Common::IniFile ini_file;
|
||||||
if (ini_file.Load(profile_filename))
|
if (ini_file.Load(profile_filename))
|
||||||
{
|
{
|
||||||
Core::DisplayMessage("Loading input profile '" + base + "' for device '" +
|
Core::DisplayMessage("Loading input profile '" + base + "' for device '" +
|
||||||
|
@ -180,8 +180,8 @@ void ProfileCycler::CycleProfileForGame(CycleDirection cycle_direction,
|
||||||
|
|
||||||
std::string ProfileCycler::GetWiimoteInputProfilesForGame(int controller_index)
|
std::string ProfileCycler::GetWiimoteInputProfilesForGame(int controller_index)
|
||||||
{
|
{
|
||||||
IniFile game_ini = SConfig::GetInstance().LoadGameIni();
|
Common::IniFile game_ini = SConfig::GetInstance().LoadGameIni();
|
||||||
const IniFile::Section* const control_section = game_ini.GetOrCreateSection("Controls");
|
const auto* const control_section = game_ini.GetOrCreateSection("Controls");
|
||||||
|
|
||||||
std::string result;
|
std::string result;
|
||||||
control_section->Get(fmt::format("WiimoteProfile{}", controller_index + 1), &result);
|
control_section->Get(fmt::format("WiimoteProfile{}", controller_index + 1), &result);
|
||||||
|
|
|
@ -17,11 +17,11 @@ namespace
|
||||||
std::vector<ResourcePack> packs;
|
std::vector<ResourcePack> packs;
|
||||||
std::string packs_path;
|
std::string packs_path;
|
||||||
|
|
||||||
IniFile GetPackConfig()
|
Common::IniFile GetPackConfig()
|
||||||
{
|
{
|
||||||
packs_path = File::GetUserPath(D_RESOURCEPACK_IDX) + "/Packs.ini";
|
packs_path = File::GetUserPath(D_RESOURCEPACK_IDX) + "/Packs.ini";
|
||||||
|
|
||||||
IniFile file;
|
Common::IniFile file;
|
||||||
file.Load(packs_path);
|
file.Load(packs_path);
|
||||||
|
|
||||||
return file;
|
return file;
|
||||||
|
@ -34,7 +34,7 @@ bool Init()
|
||||||
const std::vector<std::string> pack_list =
|
const std::vector<std::string> pack_list =
|
||||||
Common::DoFileSearch({File::GetUserPath(D_RESOURCEPACK_IDX)}, {".zip"});
|
Common::DoFileSearch({File::GetUserPath(D_RESOURCEPACK_IDX)}, {".zip"});
|
||||||
|
|
||||||
IniFile file = GetPackConfig();
|
Common::IniFile file = GetPackConfig();
|
||||||
|
|
||||||
auto* order = file.GetOrCreateSection("Order");
|
auto* order = file.GetOrCreateSection("Order");
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ ResourcePack* Add(const std::string& path, int offset)
|
||||||
if (!pack.IsValid())
|
if (!pack.IsValid())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
IniFile file = GetPackConfig();
|
Common::IniFile file = GetPackConfig();
|
||||||
|
|
||||||
auto* order = file.GetOrCreateSection("Order");
|
auto* order = file.GetOrCreateSection("Order");
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ bool Remove(ResourcePack& pack)
|
||||||
if (pack_iterator == packs.end())
|
if (pack_iterator == packs.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
IniFile file = GetPackConfig();
|
Common::IniFile file = GetPackConfig();
|
||||||
|
|
||||||
auto* order = file.GetOrCreateSection("Order");
|
auto* order = file.GetOrCreateSection("Order");
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ bool Remove(ResourcePack& pack)
|
||||||
|
|
||||||
void SetInstalled(const ResourcePack& pack, bool installed)
|
void SetInstalled(const ResourcePack& pack, bool installed)
|
||||||
{
|
{
|
||||||
IniFile file = GetPackConfig();
|
Common::IniFile file = GetPackConfig();
|
||||||
|
|
||||||
auto* install = file.GetOrCreateSection("Installed");
|
auto* install = file.GetOrCreateSection("Installed");
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ void SetInstalled(const ResourcePack& pack, bool installed)
|
||||||
|
|
||||||
bool IsInstalled(const ResourcePack& pack)
|
bool IsInstalled(const ResourcePack& pack)
|
||||||
{
|
{
|
||||||
IniFile file = GetPackConfig();
|
Common::IniFile file = GetPackConfig();
|
||||||
|
|
||||||
auto* install = file.GetOrCreateSection("Installed");
|
auto* install = file.GetOrCreateSection("Installed");
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ void PostProcessingConfiguration::LoadOptions(const std::string& code)
|
||||||
if (current_strings)
|
if (current_strings)
|
||||||
{
|
{
|
||||||
std::string key, value;
|
std::string key, value;
|
||||||
IniFile::ParseLine(line, &key, &value);
|
Common::IniFile::ParseLine(line, &key, &value);
|
||||||
|
|
||||||
if (!(key.empty() && value.empty()))
|
if (!(key.empty() && value.empty()))
|
||||||
current_strings->m_options.emplace_back(key, value);
|
current_strings->m_options.emplace_back(key, value);
|
||||||
|
@ -238,7 +238,7 @@ void PostProcessingConfiguration::LoadOptions(const std::string& code)
|
||||||
|
|
||||||
void PostProcessingConfiguration::LoadOptionsConfiguration()
|
void PostProcessingConfiguration::LoadOptionsConfiguration()
|
||||||
{
|
{
|
||||||
IniFile ini;
|
Common::IniFile ini;
|
||||||
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
|
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
|
||||||
std::string section = m_current_shader + "-options";
|
std::string section = m_current_shader + "-options";
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ void PostProcessingConfiguration::LoadOptionsConfiguration()
|
||||||
|
|
||||||
void PostProcessingConfiguration::SaveOptionsConfiguration()
|
void PostProcessingConfiguration::SaveOptionsConfiguration()
|
||||||
{
|
{
|
||||||
IniFile ini;
|
Common::IniFile ini;
|
||||||
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
|
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
|
||||||
std::string section = m_current_shader + "-options";
|
std::string section = m_current_shader + "-options";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue