mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-27 20:14:17 +01:00
Merge Config::ReadXYZs
This commit is contained in:
parent
4409fa8798
commit
06c9712bc7
@ -36,7 +36,8 @@ bool Config::LoadINI(INIReader* config, const char* location, const std::string&
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::ReadControls() {
|
void Config::ReadValues() {
|
||||||
|
// Controls
|
||||||
Settings::values.pad_a_key = glfw_config->GetInteger("Controls", "pad_a", GLFW_KEY_A);
|
Settings::values.pad_a_key = glfw_config->GetInteger("Controls", "pad_a", GLFW_KEY_A);
|
||||||
Settings::values.pad_b_key = glfw_config->GetInteger("Controls", "pad_b", GLFW_KEY_S);
|
Settings::values.pad_b_key = glfw_config->GetInteger("Controls", "pad_b", GLFW_KEY_S);
|
||||||
Settings::values.pad_x_key = glfw_config->GetInteger("Controls", "pad_x", GLFW_KEY_Z);
|
Settings::values.pad_x_key = glfw_config->GetInteger("Controls", "pad_x", GLFW_KEY_Z);
|
||||||
@ -54,27 +55,21 @@ void Config::ReadControls() {
|
|||||||
Settings::values.pad_sdown_key = glfw_config->GetInteger("Controls", "pad_sdown", GLFW_KEY_DOWN);
|
Settings::values.pad_sdown_key = glfw_config->GetInteger("Controls", "pad_sdown", GLFW_KEY_DOWN);
|
||||||
Settings::values.pad_sleft_key = glfw_config->GetInteger("Controls", "pad_sleft", GLFW_KEY_LEFT);
|
Settings::values.pad_sleft_key = glfw_config->GetInteger("Controls", "pad_sleft", GLFW_KEY_LEFT);
|
||||||
Settings::values.pad_sright_key = glfw_config->GetInteger("Controls", "pad_sright", GLFW_KEY_RIGHT);
|
Settings::values.pad_sright_key = glfw_config->GetInteger("Controls", "pad_sright", GLFW_KEY_RIGHT);
|
||||||
}
|
|
||||||
|
|
||||||
void Config::ReadCore() {
|
// Core
|
||||||
Settings::values.cpu_core = glfw_config->GetInteger("Core", "cpu_core", Core::CPU_Interpreter);
|
Settings::values.cpu_core = glfw_config->GetInteger("Core", "cpu_core", Core::CPU_Interpreter);
|
||||||
Settings::values.gpu_refresh_rate = glfw_config->GetInteger("Core", "gpu_refresh_rate", 60);
|
Settings::values.gpu_refresh_rate = glfw_config->GetInteger("Core", "gpu_refresh_rate", 60);
|
||||||
}
|
|
||||||
|
|
||||||
void Config::ReadData() {
|
// Data Storage
|
||||||
Settings::values.use_virtual_sd = glfw_config->GetBoolean("Data Storage", "use_virtual_sd", true);
|
Settings::values.use_virtual_sd = glfw_config->GetBoolean("Data Storage", "use_virtual_sd", true);
|
||||||
}
|
|
||||||
|
|
||||||
void Config::ReadMiscellaneous() {
|
// Miscellaneous
|
||||||
Settings::values.enable_log = glfw_config->GetBoolean("Miscellaneous", "enable_log", true);
|
Settings::values.enable_log = glfw_config->GetBoolean("Miscellaneous", "enable_log", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::Reload() {
|
void Config::Reload() {
|
||||||
LoadINI(glfw_config, glfw_config_loc.c_str(), DefaultINI::glfw_config_file);
|
LoadINI(glfw_config, glfw_config_loc.c_str(), DefaultINI::glfw_config_file);
|
||||||
ReadControls();
|
ReadValues();
|
||||||
ReadCore();
|
|
||||||
ReadData();
|
|
||||||
ReadMiscellaneous();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Config::~Config() {
|
Config::~Config() {
|
||||||
|
@ -15,10 +15,7 @@ class Config {
|
|||||||
std::string glfw_config_loc;
|
std::string glfw_config_loc;
|
||||||
|
|
||||||
bool LoadINI(INIReader* config, const char* location, const std::string& default_contents="", bool retry=true);
|
bool LoadINI(INIReader* config, const char* location, const std::string& default_contents="", bool retry=true);
|
||||||
void ReadControls();
|
void ReadValues();
|
||||||
void ReadCore();
|
|
||||||
void ReadData();
|
|
||||||
void ReadMiscellaneous();
|
|
||||||
public:
|
public:
|
||||||
Config();
|
Config();
|
||||||
~Config();
|
~Config();
|
||||||
|
@ -21,7 +21,7 @@ Config::Config() {
|
|||||||
Reload();
|
Reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::ReadControls() {
|
void Config::ReadValues() {
|
||||||
qt_config->beginGroup("Controls");
|
qt_config->beginGroup("Controls");
|
||||||
Settings::values.pad_a_key = qt_config->value("pad_a", Qt::Key_A).toInt();
|
Settings::values.pad_a_key = qt_config->value("pad_a", Qt::Key_A).toInt();
|
||||||
Settings::values.pad_b_key = qt_config->value("pad_b", Qt::Key_S).toInt();
|
Settings::values.pad_b_key = qt_config->value("pad_b", Qt::Key_S).toInt();
|
||||||
@ -41,9 +41,22 @@ void Config::ReadControls() {
|
|||||||
Settings::values.pad_sleft_key = qt_config->value("pad_sleft", Qt::Key_Left).toInt();
|
Settings::values.pad_sleft_key = qt_config->value("pad_sleft", Qt::Key_Left).toInt();
|
||||||
Settings::values.pad_sright_key = qt_config->value("pad_sright", Qt::Key_Right).toInt();
|
Settings::values.pad_sright_key = qt_config->value("pad_sright", Qt::Key_Right).toInt();
|
||||||
qt_config->endGroup();
|
qt_config->endGroup();
|
||||||
|
|
||||||
|
qt_config->beginGroup("Core");
|
||||||
|
Settings::values.cpu_core = qt_config->value("cpu_core", Core::CPU_Interpreter).toInt();
|
||||||
|
Settings::values.gpu_refresh_rate = qt_config->value("gpu_refresh_rate", 60).toInt();
|
||||||
|
qt_config->endGroup();
|
||||||
|
|
||||||
|
qt_config->beginGroup("Data Storage");
|
||||||
|
Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool();
|
||||||
|
qt_config->endGroup();
|
||||||
|
|
||||||
|
qt_config->beginGroup("Miscellaneous");
|
||||||
|
Settings::values.enable_log = qt_config->value("enable_log", true).toBool();
|
||||||
|
qt_config->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::SaveControls() {
|
void Config::SaveValues() {
|
||||||
qt_config->beginGroup("Controls");
|
qt_config->beginGroup("Controls");
|
||||||
qt_config->setValue("pad_a", Settings::values.pad_a_key);
|
qt_config->setValue("pad_a", Settings::values.pad_a_key);
|
||||||
qt_config->setValue("pad_b", Settings::values.pad_b_key);
|
qt_config->setValue("pad_b", Settings::values.pad_b_key);
|
||||||
@ -63,58 +76,27 @@ void Config::SaveControls() {
|
|||||||
qt_config->setValue("pad_sleft", Settings::values.pad_sleft_key);
|
qt_config->setValue("pad_sleft", Settings::values.pad_sleft_key);
|
||||||
qt_config->setValue("pad_sright", Settings::values.pad_sright_key);
|
qt_config->setValue("pad_sright", Settings::values.pad_sright_key);
|
||||||
qt_config->endGroup();
|
qt_config->endGroup();
|
||||||
}
|
|
||||||
|
|
||||||
void Config::ReadCore() {
|
|
||||||
qt_config->beginGroup("Core");
|
|
||||||
Settings::values.cpu_core = qt_config->value("cpu_core", Core::CPU_Interpreter).toInt();
|
|
||||||
Settings::values.gpu_refresh_rate = qt_config->value("gpu_refresh_rate", 60).toInt();
|
|
||||||
qt_config->endGroup();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Config::SaveCore() {
|
|
||||||
qt_config->beginGroup("Core");
|
qt_config->beginGroup("Core");
|
||||||
qt_config->setValue("cpu_core", Settings::values.cpu_core);
|
qt_config->setValue("cpu_core", Settings::values.cpu_core);
|
||||||
qt_config->setValue("gpu_refresh_rate", Settings::values.gpu_refresh_rate);
|
qt_config->setValue("gpu_refresh_rate", Settings::values.gpu_refresh_rate);
|
||||||
qt_config->endGroup();
|
qt_config->endGroup();
|
||||||
}
|
|
||||||
|
|
||||||
void Config::ReadData() {
|
|
||||||
qt_config->beginGroup("Data Storage");
|
|
||||||
Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool();
|
|
||||||
qt_config->endGroup();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Config::SaveData() {
|
|
||||||
qt_config->beginGroup("Data Storage");
|
qt_config->beginGroup("Data Storage");
|
||||||
qt_config->setValue("use_virtual_sd", Settings::values.use_virtual_sd);
|
qt_config->setValue("use_virtual_sd", Settings::values.use_virtual_sd);
|
||||||
qt_config->endGroup();
|
qt_config->endGroup();
|
||||||
}
|
|
||||||
|
|
||||||
void Config::ReadMiscellaneous() {
|
|
||||||
qt_config->beginGroup("Miscellaneous");
|
|
||||||
Settings::values.enable_log = qt_config->value("enable_log", true).toBool();
|
|
||||||
qt_config->endGroup();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Config::SaveMiscellaneous() {
|
|
||||||
qt_config->beginGroup("Miscellaneous");
|
qt_config->beginGroup("Miscellaneous");
|
||||||
qt_config->setValue("enable_log", Settings::values.enable_log);
|
qt_config->setValue("enable_log", Settings::values.enable_log);
|
||||||
qt_config->endGroup();
|
qt_config->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::Reload() {
|
void Config::Reload() {
|
||||||
ReadControls();
|
ReadValues();
|
||||||
ReadCore();
|
|
||||||
ReadData();
|
|
||||||
ReadMiscellaneous();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::Save() {
|
void Config::Save() {
|
||||||
SaveControls();
|
SaveValues();
|
||||||
SaveCore();
|
|
||||||
SaveData();
|
|
||||||
SaveMiscellaneous();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Config::~Config() {
|
Config::~Config() {
|
||||||
|
@ -12,15 +12,8 @@ class Config {
|
|||||||
QSettings* qt_config;
|
QSettings* qt_config;
|
||||||
std::string qt_config_loc;
|
std::string qt_config_loc;
|
||||||
|
|
||||||
void ReadControls();
|
void ReadValues();
|
||||||
void SaveControls();
|
void SaveValues();
|
||||||
void ReadCore();
|
|
||||||
void SaveCore();
|
|
||||||
void ReadData();
|
|
||||||
void SaveData();
|
|
||||||
|
|
||||||
void ReadMiscellaneous();
|
|
||||||
void SaveMiscellaneous();
|
|
||||||
public:
|
public:
|
||||||
Config();
|
Config();
|
||||||
~Config();
|
~Config();
|
||||||
|
Loading…
Reference in New Issue
Block a user