Core: pass down Core::System reference to all services (#4272)
* Core: pass down Core::System reference to all services This has to be done at once due to unified interface used by HLE/LLE switcher * apt: eliminate Core::System::GetInstance * gpu_gsp: eliminate Core::System::GetInstance in service * hid: eliminate Core::System::GetInstance * nwm: eliminate Core::System::GetInstance * err_f: eliminate Core::System::GetInstance
This commit is contained in:
parent
008242c5f3
commit
b163502744
77 changed files with 329 additions and 111 deletions
|
@ -219,7 +219,7 @@ void Module::UpdateGyroscopeCallback(u64 userdata, s64 cycles_late) {
|
|||
|
||||
Math::Vec3<float> gyro;
|
||||
std::tie(std::ignore, gyro) = motion_device->GetStatus();
|
||||
double stretch = Core::System::GetInstance().perf_stats.GetLastFrameTimeScale();
|
||||
double stretch = system.perf_stats.GetLastFrameTimeScale();
|
||||
gyro *= gyroscope_coef * static_cast<float>(stretch);
|
||||
gyroscope_entry.x = static_cast<s16>(gyro.x);
|
||||
gyroscope_entry.y = static_cast<s16>(gyro.y);
|
||||
|
@ -354,7 +354,7 @@ 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)) {}
|
||||
|
||||
Module::Module() {
|
||||
Module::Module(Core::System& system) : system(system) {
|
||||
using namespace Kernel;
|
||||
|
||||
shared_mem =
|
||||
|
@ -393,8 +393,9 @@ void ReloadInputDevices() {
|
|||
hid->ReloadInputDevices();
|
||||
}
|
||||
|
||||
void InstallInterfaces(SM::ServiceManager& service_manager) {
|
||||
auto hid = std::make_shared<Module>();
|
||||
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;
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
#include "core/hle/service/service.h"
|
||||
#include "core/settings.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Kernel {
|
||||
class Event;
|
||||
class SharedMemory;
|
||||
|
@ -198,7 +202,7 @@ DirectionState GetStickDirectionState(s16 circle_pad_x, s16 circle_pad_y);
|
|||
|
||||
class Module final {
|
||||
public:
|
||||
Module();
|
||||
explicit Module(Core::System& system);
|
||||
|
||||
class Interface : public ServiceFramework<Interface> {
|
||||
public:
|
||||
|
@ -299,6 +303,8 @@ private:
|
|||
void UpdateAccelerometerCallback(u64 userdata, s64 cycles_late);
|
||||
void UpdateGyroscopeCallback(u64 userdata, s64 cycles_late);
|
||||
|
||||
Core::System& system;
|
||||
|
||||
// Handle to shared memory region designated to HID_User service
|
||||
Kernel::SharedPtr<Kernel::SharedMemory> shared_mem;
|
||||
|
||||
|
@ -329,7 +335,7 @@ private:
|
|||
std::unique_ptr<Input::TouchDevice> touch_device;
|
||||
};
|
||||
|
||||
void InstallInterfaces(SM::ServiceManager& service_manager);
|
||||
void InstallInterfaces(Core::System& system);
|
||||
|
||||
/// Reload input devices. Used when input configuration changed
|
||||
void ReloadInputDevices();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue