hid: Port better HID to per game config

This commit is contained in:
Zach Hilman
2018-10-17 21:44:03 -04:00
parent edcb75a037
commit af2d90696e
5 changed files with 12 additions and 15 deletions

View File

@@ -131,11 +131,11 @@ void Controller_NPad::OnInit() {
}
void Controller_NPad::OnLoadInputDevices() {
std::transform(Settings::values.buttons.begin() + Settings::NativeButton::BUTTON_HID_BEGIN,
Settings::values.buttons.begin() + Settings::NativeButton::BUTTON_HID_END,
std::transform(Settings::values->buttons.begin() + Settings::NativeButton::BUTTON_HID_BEGIN,
Settings::values->buttons.begin() + Settings::NativeButton::BUTTON_HID_END,
buttons.begin(), Input::CreateDevice<Input::ButtonDevice>);
std::transform(Settings::values.analogs.begin() + Settings::NativeAnalog::STICK_HID_BEGIN,
Settings::values.analogs.begin() + Settings::NativeAnalog::STICK_HID_END,
std::transform(Settings::values->analogs.begin() + Settings::NativeAnalog::STICK_HID_BEGIN,
Settings::values->analogs.begin() + Settings::NativeAnalog::STICK_HID_END,
sticks.begin(), Input::CreateDevice<Input::AnalogDevice>);
}
@@ -289,7 +289,7 @@ void Controller_NPad::OnUpdate(u8* data, std::size_t data_len) {
case NPadControllerType::Handheld:
handheld_entry.connection_status.raw = 0;
handheld_entry.connection_status.IsConnected.Assign(1);
if (!Settings::values.use_docked_mode) {
if (!Settings::values->use_docked_mode) {
handheld_entry.connection_status.IsWired.Assign(1);
}
handheld_entry.pad_states.raw = pad_state.raw;

View File

@@ -60,6 +60,6 @@ void Controller_Touchscreen::OnUpdate(u8* data, std::size_t size) {
}
void Controller_Touchscreen::OnLoadInputDevices() {
touch_device = Input::CreateDevice<Input::TouchDevice>(Settings::values.touch_device);
touch_device = Input::CreateDevice<Input::TouchDevice>(Settings::values->touch_device);
}
} // namespace Service::HID

View File

@@ -165,8 +165,6 @@ void Config::ReadPerGameSettings(Settings::PerGameValues& values) {
values.resolution_factor = qt_config->value("resolution_factor", 1.0).toFloat();
values.use_frame_limit = qt_config->value("use_frame_limit", true).toBool();
values.frame_limit = qt_config->value("frame_limit", 100).toInt();
Settings::values.use_accurate_gpu_emulation =
qt_config->value("use_accurate_gpu_emulation", false).toBool();
values.bg_red = qt_config->value("bg_red", 0.0).toFloat();
values.bg_green = qt_config->value("bg_green", 0.0).toFloat();
@@ -316,8 +314,8 @@ void Config::ReadValues() {
qt_config->endGroup();
qt_config->beginGroup("Renderer");
Settings::values.use_accurate_framebuffers =
qt_config->value("use_accurate_framebuffers", false).toBool();
Settings::values.use_accurate_gpu_emulation =
qt_config->value("use_accurate_gpu_emulation", false).toBool();
qt_config->endGroup();
qt_config->beginGroup("Miscellaneous");
@@ -425,7 +423,6 @@ void Config::SavePerGameSettings(const Settings::PerGameValues& values) {
qt_config->setValue("resolution_factor", (double)values.resolution_factor);
qt_config->setValue("use_frame_limit", values.use_frame_limit);
qt_config->setValue("frame_limit", values.frame_limit);
qt_config->setValue("use_accurate_gpu_emulation", Settings::values.use_accurate_gpu_emulation);
// Cast to double because Qt's written float values are not human-readable
qt_config->setValue("bg_red", (double)values.bg_red);
@@ -550,7 +547,7 @@ void Config::SaveValues() {
qt_config->endGroup();
qt_config->beginGroup("Renderer");
qt_config->setValue("use_accurate_framebuffers", Settings::values.use_accurate_framebuffers);
qt_config->setValue("use_accurate_gpu_emulation", Settings::values.use_accurate_gpu_emulation);
qt_config->endGroup();
qt_config->beginGroup("Miscellaneous");

View File

@@ -86,7 +86,7 @@ void ConfigureGraphics::setConfiguration() {
void ConfigureGraphics::setPerGame(bool per_game) {
ui->bg_checkbox->setHidden(!per_game);
ui->resolution_factor_checkbox->setHidden(!per_game);
ui->use_accurate_framebuffers->setHidden(per_game);
ui->use_accurate_gpu_emulation->setHidden(per_game);
ui->override_label->setHidden(!per_game);
ui->toggle_frame_limit->setTristate(per_game);
}

View File

@@ -180,8 +180,8 @@ void Config::ReadValues() {
sdl2_config->GetInteger("System", "current_user", 0), 0, Service::Account::MAX_USERS - 1);
// Renderer
Settings::values.use_accurate_framebuffers =
sdl2_config->GetBoolean("Renderer", "use_accurate_framebuffers", false);
Settings::values.use_accurate_gpu_emulation =
sdl2_config->GetBoolean("Renderer", "use_accurate_gpu_emulation", false);
// Miscellaneous
Settings::values.log_filter = sdl2_config->Get("Miscellaneous", "log_filter", "*:Trace");