diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/frontend/applets/controller.cpp | 4 | ||||
| -rw-r--r-- | src/core/frontend/framebuffer_layout.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/am/applets/controller.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/apm/controller.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 42 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/vi/vi.cpp | 2 | ||||
| -rw-r--r-- | src/core/settings.cpp | 8 | ||||
| -rw-r--r-- | src/core/settings.h | 57 | ||||
| -rw-r--r-- | src/core/telemetry_session.cpp | 2 |
11 files changed, 89 insertions, 41 deletions
diff --git a/src/core/frontend/applets/controller.cpp b/src/core/frontend/applets/controller.cpp index 5582091f4..1ac2fb80c 100644 --- a/src/core/frontend/applets/controller.cpp +++ b/src/core/frontend/applets/controller.cpp | |||
| @@ -27,7 +27,7 @@ void DefaultControllerApplet::ReconfigureControllers(std::function<void()> callb | |||
| 27 | ->GetAppletResource() | 27 | ->GetAppletResource() |
| 28 | ->GetController<Service::HID::Controller_NPad>(Service::HID::HidController::NPad); | 28 | ->GetController<Service::HID::Controller_NPad>(Service::HID::HidController::NPad); |
| 29 | 29 | ||
| 30 | auto& players = Settings::values.players; | 30 | auto& players = Settings::values.players.GetValue(); |
| 31 | 31 | ||
| 32 | const std::size_t min_supported_players = | 32 | const std::size_t min_supported_players = |
| 33 | parameters.enable_single_mode ? 1 : parameters.min_players; | 33 | parameters.enable_single_mode ? 1 : parameters.min_players; |
| @@ -66,7 +66,7 @@ void DefaultControllerApplet::ReconfigureControllers(std::function<void()> callb | |||
| 66 | npad.MapSettingsTypeToNPad(Settings::ControllerType::RightJoycon), index); | 66 | npad.MapSettingsTypeToNPad(Settings::ControllerType::RightJoycon), index); |
| 67 | } | 67 | } |
| 68 | } else if (index == 0 && parameters.enable_single_mode && parameters.allow_handheld && | 68 | } else if (index == 0 && parameters.enable_single_mode && parameters.allow_handheld && |
| 69 | !Settings::values.use_docked_mode) { | 69 | !Settings::values.use_docked_mode.GetValue()) { |
| 70 | // We should *never* reach here under any normal circumstances. | 70 | // We should *never* reach here under any normal circumstances. |
| 71 | npad.AddNewControllerAt(npad.MapSettingsTypeToNPad(Settings::ControllerType::Handheld), | 71 | npad.AddNewControllerAt(npad.MapSettingsTypeToNPad(Settings::ControllerType::Handheld), |
| 72 | index); | 72 | index); |
diff --git a/src/core/frontend/framebuffer_layout.cpp b/src/core/frontend/framebuffer_layout.cpp index 1acc82497..b9a270a55 100644 --- a/src/core/frontend/framebuffer_layout.cpp +++ b/src/core/frontend/framebuffer_layout.cpp | |||
| @@ -47,7 +47,7 @@ FramebufferLayout DefaultFrameLayout(u32 width, u32 height) { | |||
| 47 | FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale) { | 47 | FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale) { |
| 48 | u32 width, height; | 48 | u32 width, height; |
| 49 | 49 | ||
| 50 | if (Settings::values.use_docked_mode) { | 50 | if (Settings::values.use_docked_mode.GetValue()) { |
| 51 | width = ScreenDocked::Width * res_scale; | 51 | width = ScreenDocked::Width * res_scale; |
| 52 | height = ScreenDocked::Height * res_scale; | 52 | height = ScreenDocked::Height * res_scale; |
| 53 | } else { | 53 | } else { |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 2ce742e35..eb097738a 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -751,7 +751,7 @@ void ICommonStateGetter::GetDefaultDisplayResolution(Kernel::HLERequestContext& | |||
| 751 | IPC::ResponseBuilder rb{ctx, 4}; | 751 | IPC::ResponseBuilder rb{ctx, 4}; |
| 752 | rb.Push(RESULT_SUCCESS); | 752 | rb.Push(RESULT_SUCCESS); |
| 753 | 753 | ||
| 754 | if (Settings::values.use_docked_mode) { | 754 | if (Settings::values.use_docked_mode.GetValue()) { |
| 755 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth) * | 755 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth) * |
| 756 | static_cast<u32>(Settings::values.resolution_factor.GetValue())); | 756 | static_cast<u32>(Settings::values.resolution_factor.GetValue())); |
| 757 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedHeight) * | 757 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedHeight) * |
| @@ -824,7 +824,7 @@ void IStorage::Open(Kernel::HLERequestContext& ctx) { | |||
| 824 | } | 824 | } |
| 825 | 825 | ||
| 826 | void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) { | 826 | void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) { |
| 827 | const bool use_docked_mode{Settings::values.use_docked_mode}; | 827 | const bool use_docked_mode{Settings::values.use_docked_mode.GetValue()}; |
| 828 | LOG_DEBUG(Service_AM, "called, use_docked_mode={}", use_docked_mode); | 828 | LOG_DEBUG(Service_AM, "called, use_docked_mode={}", use_docked_mode); |
| 829 | 829 | ||
| 830 | IPC::ResponseBuilder rb{ctx, 3}; | 830 | IPC::ResponseBuilder rb{ctx, 3}; |
diff --git a/src/core/hle/service/am/applets/controller.cpp b/src/core/hle/service/am/applets/controller.cpp index a0152b4ea..43b79412e 100644 --- a/src/core/hle/service/am/applets/controller.cpp +++ b/src/core/hle/service/am/applets/controller.cpp | |||
| @@ -222,7 +222,7 @@ void Controller::Execute() { | |||
| 222 | void Controller::ConfigurationComplete() { | 222 | void Controller::ConfigurationComplete() { |
| 223 | ControllerSupportResultInfo result_info{}; | 223 | ControllerSupportResultInfo result_info{}; |
| 224 | 224 | ||
| 225 | const auto& players = Settings::values.players; | 225 | const auto& players = Settings::values.players.GetValue(); |
| 226 | 226 | ||
| 227 | // If enable_single_mode is enabled, player_count is 1 regardless of any other parameters. | 227 | // If enable_single_mode is enabled, player_count is 1 regardless of any other parameters. |
| 228 | // Otherwise, only count connected players from P1-P8. | 228 | // Otherwise, only count connected players from P1-P8. |
diff --git a/src/core/hle/service/apm/controller.cpp b/src/core/hle/service/apm/controller.cpp index 25a886238..ce993bad3 100644 --- a/src/core/hle/service/apm/controller.cpp +++ b/src/core/hle/service/apm/controller.cpp | |||
| @@ -69,7 +69,8 @@ void Controller::SetFromCpuBoostMode(CpuBoostMode mode) { | |||
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | PerformanceMode Controller::GetCurrentPerformanceMode() const { | 71 | PerformanceMode Controller::GetCurrentPerformanceMode() const { |
| 72 | return Settings::values.use_docked_mode ? PerformanceMode::Docked : PerformanceMode::Handheld; | 72 | return Settings::values.use_docked_mode.GetValue() ? PerformanceMode::Docked |
| 73 | : PerformanceMode::Handheld; | ||
| 73 | } | 74 | } |
| 74 | 75 | ||
| 75 | PerformanceConfiguration Controller::GetCurrentPerformanceConfiguration(PerformanceMode mode) { | 76 | PerformanceConfiguration Controller::GetCurrentPerformanceConfiguration(PerformanceMode mode) { |
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index c4b26196a..15d5fa6e8 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -184,11 +184,14 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) { | |||
| 184 | controller.single_color.button_color = 0; | 184 | controller.single_color.button_color = 0; |
| 185 | 185 | ||
| 186 | controller.dual_color_error = ColorReadError::ReadOk; | 186 | controller.dual_color_error = ColorReadError::ReadOk; |
| 187 | controller.left_color.body_color = Settings::values.players[controller_idx].body_color_left; | 187 | controller.left_color.body_color = |
| 188 | controller.left_color.button_color = Settings::values.players[controller_idx].button_color_left; | 188 | Settings::values.players.GetValue()[controller_idx].body_color_left; |
| 189 | controller.right_color.body_color = Settings::values.players[controller_idx].body_color_right; | 189 | controller.left_color.button_color = |
| 190 | Settings::values.players.GetValue()[controller_idx].button_color_left; | ||
| 191 | controller.right_color.body_color = | ||
| 192 | Settings::values.players.GetValue()[controller_idx].body_color_right; | ||
| 190 | controller.right_color.button_color = | 193 | controller.right_color.button_color = |
| 191 | Settings::values.players[controller_idx].button_color_right; | 194 | Settings::values.players.GetValue()[controller_idx].button_color_right; |
| 192 | 195 | ||
| 193 | controller.battery_level[0] = BATTERY_FULL; | 196 | controller.battery_level[0] = BATTERY_FULL; |
| 194 | controller.battery_level[1] = BATTERY_FULL; | 197 | controller.battery_level[1] = BATTERY_FULL; |
| @@ -218,8 +221,9 @@ void Controller_NPad::OnInit() { | |||
| 218 | style.pokeball.Assign(1); | 221 | style.pokeball.Assign(1); |
| 219 | } | 222 | } |
| 220 | 223 | ||
| 221 | std::transform(Settings::values.players.begin(), Settings::values.players.end(), | 224 | std::transform(Settings::values.players.GetValue().begin(), |
| 222 | connected_controllers.begin(), [](const Settings::PlayerInput& player) { | 225 | Settings::values.players.GetValue().end(), connected_controllers.begin(), |
| 226 | [](const Settings::PlayerInput& player) { | ||
| 223 | return ControllerHolder{MapSettingsTypeToNPad(player.controller_type), | 227 | return ControllerHolder{MapSettingsTypeToNPad(player.controller_type), |
| 224 | player.connected}; | 228 | player.connected}; |
| 225 | }); | 229 | }); |
| @@ -227,12 +231,13 @@ void Controller_NPad::OnInit() { | |||
| 227 | // Connect the Player 1 or Handheld controller if none are connected. | 231 | // Connect the Player 1 or Handheld controller if none are connected. |
| 228 | if (std::none_of(connected_controllers.begin(), connected_controllers.end(), | 232 | if (std::none_of(connected_controllers.begin(), connected_controllers.end(), |
| 229 | [](const ControllerHolder& controller) { return controller.is_connected; })) { | 233 | [](const ControllerHolder& controller) { return controller.is_connected; })) { |
| 230 | const auto controller = MapSettingsTypeToNPad(Settings::values.players[0].controller_type); | 234 | const auto controller = |
| 235 | MapSettingsTypeToNPad(Settings::values.players.GetValue()[0].controller_type); | ||
| 231 | if (controller == NPadControllerType::Handheld) { | 236 | if (controller == NPadControllerType::Handheld) { |
| 232 | Settings::values.players[HANDHELD_INDEX].connected = true; | 237 | Settings::values.players.GetValue()[HANDHELD_INDEX].connected = true; |
| 233 | connected_controllers[HANDHELD_INDEX] = {controller, true}; | 238 | connected_controllers[HANDHELD_INDEX] = {controller, true}; |
| 234 | } else { | 239 | } else { |
| 235 | Settings::values.players[0].connected = true; | 240 | Settings::values.players.GetValue()[0].connected = true; |
| 236 | connected_controllers[0] = {controller, true}; | 241 | connected_controllers[0] = {controller, true}; |
| 237 | } | 242 | } |
| 238 | } | 243 | } |
| @@ -255,7 +260,7 @@ void Controller_NPad::OnInit() { | |||
| 255 | } | 260 | } |
| 256 | 261 | ||
| 257 | void Controller_NPad::OnLoadInputDevices() { | 262 | void Controller_NPad::OnLoadInputDevices() { |
| 258 | const auto& players = Settings::values.players; | 263 | const auto& players = Settings::values.players.GetValue(); |
| 259 | for (std::size_t i = 0; i < players.size(); ++i) { | 264 | for (std::size_t i = 0; i < players.size(); ++i) { |
| 260 | std::transform(players[i].buttons.begin() + Settings::NativeButton::BUTTON_HID_BEGIN, | 265 | std::transform(players[i].buttons.begin() + Settings::NativeButton::BUTTON_HID_BEGIN, |
| 261 | players[i].buttons.begin() + Settings::NativeButton::BUTTON_HID_END, | 266 | players[i].buttons.begin() + Settings::NativeButton::BUTTON_HID_END, |
| @@ -528,7 +533,7 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing | |||
| 528 | // Try to read sixaxis sensor states | 533 | // Try to read sixaxis sensor states |
| 529 | std::array<MotionDevice, 2> motion_devices; | 534 | std::array<MotionDevice, 2> motion_devices; |
| 530 | 535 | ||
| 531 | if (sixaxis_sensors_enabled && Settings::values.motion_enabled) { | 536 | if (sixaxis_sensors_enabled && Settings::values.motion_enabled.GetValue()) { |
| 532 | sixaxis_at_rest = true; | 537 | sixaxis_at_rest = true; |
| 533 | for (std::size_t e = 0; e < motion_devices.size(); ++e) { | 538 | for (std::size_t e = 0; e < motion_devices.size(); ++e) { |
| 534 | const auto& device = motions[i][e]; | 539 | const auto& device = motions[i][e]; |
| @@ -666,7 +671,7 @@ void Controller_NPad::VibrateController(const std::vector<u32>& controllers, | |||
| 666 | const std::vector<Vibration>& vibrations) { | 671 | const std::vector<Vibration>& vibrations) { |
| 667 | LOG_TRACE(Service_HID, "called"); | 672 | LOG_TRACE(Service_HID, "called"); |
| 668 | 673 | ||
| 669 | if (!Settings::values.vibration_enabled || !can_controllers_vibrate) { | 674 | if (!Settings::values.vibration_enabled.GetValue() || !can_controllers_vibrate) { |
| 670 | return; | 675 | return; |
| 671 | } | 676 | } |
| 672 | bool success = true; | 677 | bool success = true; |
| @@ -714,16 +719,17 @@ void Controller_NPad::UpdateControllerAt(NPadControllerType controller, std::siz | |||
| 714 | } | 719 | } |
| 715 | 720 | ||
| 716 | if (controller == NPadControllerType::Handheld) { | 721 | if (controller == NPadControllerType::Handheld) { |
| 717 | Settings::values.players[HANDHELD_INDEX].controller_type = | 722 | Settings::values.players.GetValue()[HANDHELD_INDEX].controller_type = |
| 718 | MapNPadToSettingsType(controller); | 723 | MapNPadToSettingsType(controller); |
| 719 | Settings::values.players[HANDHELD_INDEX].connected = true; | 724 | Settings::values.players.GetValue()[HANDHELD_INDEX].connected = true; |
| 720 | connected_controllers[HANDHELD_INDEX] = {controller, true}; | 725 | connected_controllers[HANDHELD_INDEX] = {controller, true}; |
| 721 | InitNewlyAddedController(HANDHELD_INDEX); | 726 | InitNewlyAddedController(HANDHELD_INDEX); |
| 722 | return; | 727 | return; |
| 723 | } | 728 | } |
| 724 | 729 | ||
| 725 | Settings::values.players[npad_index].controller_type = MapNPadToSettingsType(controller); | 730 | Settings::values.players.GetValue()[npad_index].controller_type = |
| 726 | Settings::values.players[npad_index].connected = true; | 731 | MapNPadToSettingsType(controller); |
| 732 | Settings::values.players.GetValue()[npad_index].connected = true; | ||
| 727 | connected_controllers[npad_index] = {controller, true}; | 733 | connected_controllers[npad_index] = {controller, true}; |
| 728 | InitNewlyAddedController(npad_index); | 734 | InitNewlyAddedController(npad_index); |
| 729 | } | 735 | } |
| @@ -733,7 +739,7 @@ void Controller_NPad::DisconnectNPad(u32 npad_id) { | |||
| 733 | } | 739 | } |
| 734 | 740 | ||
| 735 | void Controller_NPad::DisconnectNPadAtIndex(std::size_t npad_index) { | 741 | void Controller_NPad::DisconnectNPadAtIndex(std::size_t npad_index) { |
| 736 | Settings::values.players[npad_index].connected = false; | 742 | Settings::values.players.GetValue()[npad_index].connected = false; |
| 737 | connected_controllers[npad_index].is_connected = false; | 743 | connected_controllers[npad_index].is_connected = false; |
| 738 | 744 | ||
| 739 | auto& controller = shared_memory_entries[npad_index]; | 745 | auto& controller = shared_memory_entries[npad_index]; |
| @@ -895,7 +901,7 @@ bool Controller_NPad::IsControllerSupported(NPadControllerType controller) const | |||
| 895 | return false; | 901 | return false; |
| 896 | } | 902 | } |
| 897 | // Handheld should not be supported in docked mode | 903 | // Handheld should not be supported in docked mode |
| 898 | if (Settings::values.use_docked_mode) { | 904 | if (Settings::values.use_docked_mode.GetValue()) { |
| 899 | return false; | 905 | return false; |
| 900 | } | 906 | } |
| 901 | 907 | ||
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 50f709b25..fb57dec02 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -935,7 +935,7 @@ void Hid::CreateActiveVibrationDeviceList(Kernel::HLERequestContext& ctx) { | |||
| 935 | void Hid::PermitVibration(Kernel::HLERequestContext& ctx) { | 935 | void Hid::PermitVibration(Kernel::HLERequestContext& ctx) { |
| 936 | IPC::RequestParser rp{ctx}; | 936 | IPC::RequestParser rp{ctx}; |
| 937 | const auto can_vibrate{rp.Pop<bool>()}; | 937 | const auto can_vibrate{rp.Pop<bool>()}; |
| 938 | Settings::values.vibration_enabled = can_vibrate; | 938 | Settings::values.vibration_enabled.SetValue(can_vibrate); |
| 939 | 939 | ||
| 940 | LOG_DEBUG(Service_HID, "called, can_vibrate={}", can_vibrate); | 940 | LOG_DEBUG(Service_HID, "called, can_vibrate={}", can_vibrate); |
| 941 | 941 | ||
| @@ -948,7 +948,7 @@ void Hid::IsVibrationPermitted(Kernel::HLERequestContext& ctx) { | |||
| 948 | 948 | ||
| 949 | IPC::ResponseBuilder rb{ctx, 3}; | 949 | IPC::ResponseBuilder rb{ctx, 3}; |
| 950 | rb.Push(RESULT_SUCCESS); | 950 | rb.Push(RESULT_SUCCESS); |
| 951 | rb.Push(Settings::values.vibration_enabled); | 951 | rb.Push(Settings::values.vibration_enabled.GetValue()); |
| 952 | } | 952 | } |
| 953 | 953 | ||
| 954 | void Hid::ActivateConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) { | 954 | void Hid::ActivateConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) { |
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 5b0e371fe..55e00dd93 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -771,7 +771,7 @@ private: | |||
| 771 | IPC::ResponseBuilder rb{ctx, 6}; | 771 | IPC::ResponseBuilder rb{ctx, 6}; |
| 772 | rb.Push(RESULT_SUCCESS); | 772 | rb.Push(RESULT_SUCCESS); |
| 773 | 773 | ||
| 774 | if (Settings::values.use_docked_mode) { | 774 | if (Settings::values.use_docked_mode.GetValue()) { |
| 775 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth) * | 775 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth) * |
| 776 | static_cast<u32>(Settings::values.resolution_factor.GetValue())); | 776 | static_cast<u32>(Settings::values.resolution_factor.GetValue())); |
| 777 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedHeight) * | 777 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedHeight) * |
diff --git a/src/core/settings.cpp b/src/core/settings.cpp index 0587b9374..aadbc3932 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp | |||
| @@ -49,7 +49,7 @@ void LogSettings() { | |||
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | LOG_INFO(Config, "yuzu Configuration:"); | 51 | LOG_INFO(Config, "yuzu Configuration:"); |
| 52 | log_setting("Controls_UseDockedMode", values.use_docked_mode); | 52 | log_setting("Controls_UseDockedMode", values.use_docked_mode.GetValue()); |
| 53 | log_setting("System_RngSeed", values.rng_seed.GetValue().value_or(0)); | 53 | log_setting("System_RngSeed", values.rng_seed.GetValue().value_or(0)); |
| 54 | log_setting("System_CurrentUser", values.current_user); | 54 | log_setting("System_CurrentUser", values.current_user); |
| 55 | log_setting("System_LanguageIndex", values.language_index.GetValue()); | 55 | log_setting("System_LanguageIndex", values.language_index.GetValue()); |
| @@ -145,6 +145,12 @@ void RestoreGlobalState() { | |||
| 145 | values.rng_seed.SetGlobal(true); | 145 | values.rng_seed.SetGlobal(true); |
| 146 | values.custom_rtc.SetGlobal(true); | 146 | values.custom_rtc.SetGlobal(true); |
| 147 | values.sound_index.SetGlobal(true); | 147 | values.sound_index.SetGlobal(true); |
| 148 | |||
| 149 | // Controls | ||
| 150 | values.players.SetGlobal(true); | ||
| 151 | values.use_docked_mode.SetGlobal(true); | ||
| 152 | values.vibration_enabled.SetGlobal(true); | ||
| 153 | values.motion_enabled.SetGlobal(true); | ||
| 148 | } | 154 | } |
| 149 | 155 | ||
| 150 | void Sanitize() { | 156 | void Sanitize() { |
diff --git a/src/core/settings.h b/src/core/settings.h index 28616a574..edd2a00ca 100644 --- a/src/core/settings.h +++ b/src/core/settings.h | |||
| @@ -65,6 +65,38 @@ private: | |||
| 65 | Type local{}; | 65 | Type local{}; |
| 66 | }; | 66 | }; |
| 67 | 67 | ||
| 68 | /** | ||
| 69 | * The InputSetting class allows for getting a reference to either the global or local members. | ||
| 70 | * This is required as we cannot easily modify the values of user-defined types within containers | ||
| 71 | * using the SetValue() member function found in the Setting class. The primary purpose of this | ||
| 72 | * class is to store an array of 10 PlayerInput structs for both the global and local (per-game) | ||
| 73 | * setting and allows for easily accessing and modifying both settings. | ||
| 74 | */ | ||
| 75 | template <typename Type> | ||
| 76 | class InputSetting final { | ||
| 77 | public: | ||
| 78 | InputSetting() = default; | ||
| 79 | explicit InputSetting(Type val) : global{val} {} | ||
| 80 | ~InputSetting() = default; | ||
| 81 | void SetGlobal(bool to_global) { | ||
| 82 | use_global = to_global; | ||
| 83 | } | ||
| 84 | bool UsingGlobal() const { | ||
| 85 | return use_global; | ||
| 86 | } | ||
| 87 | Type& GetValue(bool need_global = false) { | ||
| 88 | if (use_global || need_global) { | ||
| 89 | return global; | ||
| 90 | } | ||
| 91 | return local; | ||
| 92 | } | ||
| 93 | |||
| 94 | private: | ||
| 95 | bool use_global = true; | ||
| 96 | Type global{}; | ||
| 97 | Type local{}; | ||
| 98 | }; | ||
| 99 | |||
| 68 | struct TouchFromButtonMap { | 100 | struct TouchFromButtonMap { |
| 69 | std::string name; | 101 | std::string name; |
| 70 | std::vector<std::string> buttons; | 102 | std::vector<std::string> buttons; |
| @@ -133,9 +165,17 @@ struct Values { | |||
| 133 | Setting<s32> sound_index; | 165 | Setting<s32> sound_index; |
| 134 | 166 | ||
| 135 | // Controls | 167 | // Controls |
| 136 | std::array<PlayerInput, 10> players; | 168 | InputSetting<std::array<PlayerInput, 10>> players; |
| 169 | |||
| 170 | Setting<bool> use_docked_mode; | ||
| 137 | 171 | ||
| 138 | bool use_docked_mode; | 172 | Setting<bool> vibration_enabled; |
| 173 | |||
| 174 | Setting<bool> motion_enabled; | ||
| 175 | std::string motion_device; | ||
| 176 | std::string udp_input_address; | ||
| 177 | u16 udp_input_port; | ||
| 178 | u8 udp_pad_index; | ||
| 139 | 179 | ||
| 140 | bool mouse_enabled; | 180 | bool mouse_enabled; |
| 141 | std::string mouse_device; | 181 | std::string mouse_device; |
| @@ -149,20 +189,15 @@ struct Values { | |||
| 149 | ButtonsRaw debug_pad_buttons; | 189 | ButtonsRaw debug_pad_buttons; |
| 150 | AnalogsRaw debug_pad_analogs; | 190 | AnalogsRaw debug_pad_analogs; |
| 151 | 191 | ||
| 152 | bool vibration_enabled; | ||
| 153 | |||
| 154 | bool motion_enabled; | ||
| 155 | std::string motion_device; | ||
| 156 | std::string touch_device; | ||
| 157 | TouchscreenInput touchscreen; | 192 | TouchscreenInput touchscreen; |
| 158 | std::atomic_bool is_device_reload_pending{true}; | 193 | |
| 159 | bool use_touch_from_button; | 194 | bool use_touch_from_button; |
| 195 | std::string touch_device; | ||
| 160 | int touch_from_button_map_index; | 196 | int touch_from_button_map_index; |
| 161 | std::string udp_input_address; | ||
| 162 | u16 udp_input_port; | ||
| 163 | u8 udp_pad_index; | ||
| 164 | std::vector<TouchFromButtonMap> touch_from_button_maps; | 197 | std::vector<TouchFromButtonMap> touch_from_button_maps; |
| 165 | 198 | ||
| 199 | std::atomic_bool is_device_reload_pending{true}; | ||
| 200 | |||
| 166 | // Data Storage | 201 | // Data Storage |
| 167 | bool use_virtual_sd; | 202 | bool use_virtual_sd; |
| 168 | bool gamecard_inserted; | 203 | bool gamecard_inserted; |
diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index ebc19e18a..e0908186b 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp | |||
| @@ -213,7 +213,7 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader) { | |||
| 213 | Settings::values.use_assembly_shaders.GetValue()); | 213 | Settings::values.use_assembly_shaders.GetValue()); |
| 214 | AddField(field_type, "Renderer_UseAsynchronousShaders", | 214 | AddField(field_type, "Renderer_UseAsynchronousShaders", |
| 215 | Settings::values.use_asynchronous_shaders.GetValue()); | 215 | Settings::values.use_asynchronous_shaders.GetValue()); |
| 216 | AddField(field_type, "System_UseDockedMode", Settings::values.use_docked_mode); | 216 | AddField(field_type, "System_UseDockedMode", Settings::values.use_docked_mode.GetValue()); |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | bool TelemetrySession::SubmitTestcase() { | 219 | bool TelemetrySession::SubmitTestcase() { |