1
0
Fork 0
forked from suyu/suyu

settings: Cleanup settings

This commit is contained in:
german77 2021-09-20 20:18:26 -05:00 committed by Narr the Reg
parent 456397ed39
commit 6e2c84042d
6 changed files with 16 additions and 9 deletions

View file

@ -572,7 +572,6 @@ struct Values {
BasicSetting<bool> mouse_panning{false, "mouse_panning"}; BasicSetting<bool> mouse_panning{false, "mouse_panning"};
BasicRangedSetting<u8> mouse_panning_sensitivity{10, 1, 100, "mouse_panning_sensitivity"}; BasicRangedSetting<u8> mouse_panning_sensitivity{10, 1, 100, "mouse_panning_sensitivity"};
BasicSetting<bool> mouse_enabled{false, "mouse_enabled"}; BasicSetting<bool> mouse_enabled{false, "mouse_enabled"};
std::string mouse_device;
MouseButtonsRaw mouse_buttons; MouseButtonsRaw mouse_buttons;
BasicSetting<bool> emulate_analog_keyboard{false, "emulate_analog_keyboard"}; BasicSetting<bool> emulate_analog_keyboard{false, "emulate_analog_keyboard"};
@ -592,8 +591,6 @@ struct Values {
BasicSetting<int> touch_from_button_map_index{0, "touch_from_button_map"}; BasicSetting<int> touch_from_button_map_index{0, "touch_from_button_map"};
std::vector<TouchFromButtonMap> touch_from_button_maps; std::vector<TouchFromButtonMap> touch_from_button_maps;
std::atomic_bool is_device_reload_pending{true};
// Data Storage // Data Storage
BasicSetting<bool> use_virtual_sd{true, "use_virtual_sd"}; BasicSetting<bool> use_virtual_sd{true, "use_virtual_sd"};
BasicSetting<bool> gamecard_inserted{false, "gamecard_inserted"}; BasicSetting<bool> gamecard_inserted{false, "gamecard_inserted"};

View file

@ -62,11 +62,22 @@ enum Values : int {
constexpr int STICK_HID_BEGIN = LStick; constexpr int STICK_HID_BEGIN = LStick;
constexpr int STICK_HID_END = NumAnalogs; constexpr int STICK_HID_END = NumAnalogs;
constexpr int NUM_STICKS_HID = NumAnalogs;
extern const std::array<const char*, NumAnalogs> mapping; extern const std::array<const char*, NumAnalogs> mapping;
} // namespace NativeAnalog } // namespace NativeAnalog
namespace NativeTrigger {
enum Values : int {
LTrigger,
RTrigger,
NumTriggers,
};
constexpr int TRIGGER_HID_BEGIN = LTrigger;
constexpr int TRIGGER_HID_END = NumTriggers;
} // namespace NativeTrigger
namespace NativeVibration { namespace NativeVibration {
enum Values : int { enum Values : int {
LeftVibrationDevice, LeftVibrationDevice,

View file

@ -87,7 +87,7 @@ private:
std::array<std::unique_ptr<Input::ButtonDevice>, Settings::NativeButton::NUM_BUTTONS_HID> std::array<std::unique_ptr<Input::ButtonDevice>, Settings::NativeButton::NUM_BUTTONS_HID>
buttons; buttons;
std::array<std::unique_ptr<Input::AnalogDevice>, Settings::NativeAnalog::NUM_STICKS_HID> std::array<std::unique_ptr<Input::AnalogDevice>, Settings::NativeAnalog::NumAnalogs>
analogs; analogs;
}; };
} // namespace Service::HID } // namespace Service::HID

View file

@ -61,7 +61,7 @@ void Controller_Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
} }
void Controller_Mouse::OnLoadInputDevices() { void Controller_Mouse::OnLoadInputDevices() {
mouse_device = Input::CreateDevice<Input::MouseDevice>(Settings::values.mouse_device); //mouse_device = Input::CreateDevice<Input::MouseDevice>(Settings::values.mouse_device);
std::transform(Settings::values.mouse_buttons.begin(), Settings::values.mouse_buttons.end(), std::transform(Settings::values.mouse_buttons.begin(), Settings::values.mouse_buttons.end(),
mouse_button_devices.begin(), Input::CreateDevice<Input::ButtonDevice>); mouse_button_devices.begin(), Input::CreateDevice<Input::ButtonDevice>);
} }

View file

@ -563,7 +563,7 @@ private:
std::array<std::unique_ptr<Input::ButtonDevice>, Settings::NativeButton::NUM_BUTTONS_HID>, std::array<std::unique_ptr<Input::ButtonDevice>, Settings::NativeButton::NUM_BUTTONS_HID>,
10>; 10>;
using StickArray = std::array< using StickArray = std::array<
std::array<std::unique_ptr<Input::AnalogDevice>, Settings::NativeAnalog::NUM_STICKS_HID>, std::array<std::unique_ptr<Input::AnalogDevice>, Settings::NativeAnalog::NumAnalogs>,
10>; 10>;
using VibrationArray = std::array<std::array<std::unique_ptr<Input::VibrationDevice>, using VibrationArray = std::array<std::array<std::unique_ptr<Input::VibrationDevice>,
Settings::NativeVibration::NUM_VIBRATIONS_HID>, Settings::NativeVibration::NUM_VIBRATIONS_HID>,

View file

@ -117,7 +117,7 @@ void IAppletResource::UpdateControllers(std::uintptr_t user_data,
std::chrono::nanoseconds ns_late) { std::chrono::nanoseconds ns_late) {
auto& core_timing = system.CoreTiming(); auto& core_timing = system.CoreTiming();
const bool should_reload = Settings::values.is_device_reload_pending.exchange(false); const bool should_reload = false;
for (const auto& controller : controllers) { for (const auto& controller : controllers) {
if (should_reload) { if (should_reload) {
controller->OnLoadInputDevices(); controller->OnLoadInputDevices();
@ -2038,7 +2038,6 @@ public:
}; };
void ReloadInputDevices() { void ReloadInputDevices() {
Settings::values.is_device_reload_pending.store(true);
} }
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {