remove GetCurrentModule() functions in HLE Services

This commit is contained in:
B3n30 2018-10-11 11:12:07 +02:00
parent 4ee914c7a8
commit 9d53136f20
14 changed files with 99 additions and 69 deletions

View file

@ -21,8 +21,6 @@
namespace Service::HID {
static std::weak_ptr<Module> current_module;
// Updating period for each HID device. These empirical values are measured from a 11.2 3DS.
constexpr u64 pad_update_ticks = BASE_CLOCK_RATE_ARM11 / 234;
constexpr u64 accelerometer_update_ticks = BASE_CLOCK_RATE_ARM11 / 104;
@ -354,6 +352,10 @@ void Module::Interface::GetSoundVolume(Kernel::HLERequestContext& ctx) {
Module::Interface::Interface(std::shared_ptr<Module> hid, const char* name, u32 max_session)
: ServiceFramework(name, max_session), hid(std::move(hid)) {}
std::shared_ptr<Module> Module::Interface::GetModule() const {
return hid;
}
Module::Module(Core::System& system) : system(system) {
using namespace Kernel;
@ -388,17 +390,11 @@ void Module::ReloadInputDevices() {
is_device_reload_pending.store(true);
}
void ReloadInputDevices() {
if (auto hid = current_module.lock())
hid->ReloadInputDevices();
}
void InstallInterfaces(Core::System& system) {
auto& service_manager = system.ServiceManager();
auto hid = std::make_shared<Module>(system);
std::make_shared<User>(hid)->InstallAsService(service_manager);
std::make_shared<Spvr>(hid)->InstallAsService(service_manager);
current_module = hid;
}
} // namespace Service::HID

View file

@ -208,6 +208,8 @@ public:
public:
Interface(std::shared_ptr<Module> hid, const char* name, u32 max_session);
std::shared_ptr<Module> GetModule() const;
protected:
/**
* HID::GetIPCHandles service function
@ -336,7 +338,4 @@ private:
};
void InstallInterfaces(Core::System& system);
/// Reload input devices. Used when input configuration changed
void ReloadInputDevices();
} // namespace Service::HID