Merge pull request #1276 from FearlessTobi/fix-stupid-stub

hid: Implement ReloadInputDevices
merge-requests/60/head
bunnei 2018-09-09 22:31:04 +07:00 committed by GitHub
commit 50c191439d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <atomic>
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/core.h" #include "core/core.h"
#include "core/core_timing.h" #include "core/core_timing.h"
@ -78,7 +77,7 @@ private:
SharedMemory mem{}; SharedMemory mem{};
std::memcpy(&mem, shared_mem->GetPointer(), sizeof(SharedMemory)); std::memcpy(&mem, shared_mem->GetPointer(), sizeof(SharedMemory));
if (is_device_reload_pending.exchange(false)) if (Settings::values.is_device_reload_pending.exchange(false))
LoadInputDevices(); LoadInputDevices();
// Set up controllers as neon red+blue Joy-Con attached to console // Set up controllers as neon red+blue Joy-Con attached to console
@ -267,7 +266,6 @@ private:
CoreTiming::EventType* pad_update_event; CoreTiming::EventType* pad_update_event;
// Stored input state info // Stored input state info
std::atomic<bool> is_device_reload_pending{true};
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> sticks; std::array<std::unique_ptr<Input::AnalogDevice>, Settings::NativeAnalog::NUM_STICKS_HID> sticks;
@ -797,7 +795,9 @@ public:
} }
}; };
void ReloadInputDevices() {} void ReloadInputDevices() {
Settings::values.is_device_reload_pending.store(true);
}
void InstallInterfaces(SM::ServiceManager& service_manager) { void InstallInterfaces(SM::ServiceManager& service_manager) {
std::make_shared<Hid>()->InstallAsService(service_manager); std::make_shared<Hid>()->InstallAsService(service_manager);

@ -5,6 +5,7 @@
#pragma once #pragma once
#include <array> #include <array>
#include <atomic>
#include <string> #include <string>
#include "common/common_types.h" #include "common/common_types.h"
@ -120,6 +121,7 @@ struct Values {
std::array<std::string, NativeAnalog::NumAnalogs> analogs; std::array<std::string, NativeAnalog::NumAnalogs> analogs;
std::string motion_device; std::string motion_device;
std::string touch_device; std::string touch_device;
std::atomic_bool is_device_reload_pending{true};
// Core // Core
bool use_cpu_jit; bool use_cpu_jit;