From f21ab654db620198b388bd25cd0db4c2085c4c8a Mon Sep 17 00:00:00 2001 From: David Marcec Date: Sun, 22 Sep 2019 16:35:43 +1000 Subject: Rebase --- src/core/hle/service/ns/ns.cpp | 6 ++++-- src/core/hle/service/ns/ns.h | 4 ++-- src/core/hle/service/ns/pl_u.cpp | 7 ++++--- src/core/hle/service/ns/pl_u.h | 3 ++- 4 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src/core/hle/service/ns') diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index 13121c4f1..dffd2eefe 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp @@ -617,7 +617,9 @@ public: } }; -void InstallInterfaces(SM::ServiceManager& service_manager, FileSystem::FileSystemController& fsc) { +void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system, + FileSystem::FileSystemController& fsc) { + std::make_shared("ns:am2")->InstallAsService(service_manager); std::make_shared("ns:ec")->InstallAsService(service_manager); std::make_shared("ns:rid")->InstallAsService(service_manager); @@ -628,7 +630,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager, FileSystem::FileSyst std::make_shared()->InstallAsService(service_manager); std::make_shared()->InstallAsService(service_manager); - std::make_shared(fsc)->InstallAsService(service_manager); + std::make_shared(system, fsc)->InstallAsService(service_manager); } } // namespace Service::NS diff --git a/src/core/hle/service/ns/ns.h b/src/core/hle/service/ns/ns.h index d067e7a9a..4a10c98f9 100644 --- a/src/core/hle/service/ns/ns.h +++ b/src/core/hle/service/ns/ns.h @@ -97,8 +97,8 @@ private: }; /// Registers all NS services with the specified service manager. -void InstallInterfaces(SM::ServiceManager& service_manager, FileSystem::FileSystemController& fsc); +void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system, + FileSystem::FileSystemController& fsc); } // namespace NS - } // namespace Service diff --git a/src/core/hle/service/ns/pl_u.cpp b/src/core/hle/service/ns/pl_u.cpp index 8f0c6bc07..4f9b843e6 100644 --- a/src/core/hle/service/ns/pl_u.cpp +++ b/src/core/hle/service/ns/pl_u.cpp @@ -145,8 +145,9 @@ struct PL_U::Impl { std::vector shared_font_regions; }; -PL_U::PL_U(FileSystem::FileSystemController& fsc) - : ServiceFramework("pl:u"), impl{std::make_unique()} { +PL_U::PL_U(Core::System& system, FileSystem::FileSystemController& fsc) + : ServiceFramework("pl:u"), impl{std::make_unique()}, system(system) { + static const FunctionInfo functions[] = { {0, &PL_U::RequestLoad, "RequestLoad"}, {1, &PL_U::GetLoadState, "GetLoadState"}, @@ -255,7 +256,7 @@ void PL_U::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) { Kernel::MemoryState::Shared); // Create shared font memory object - auto& kernel = Core::System::GetInstance().Kernel(); + auto& kernel = system.Kernel(); impl->shared_font_mem = Kernel::SharedMemory::Create( kernel, Core::CurrentProcess(), SHARED_FONT_MEM_SIZE, Kernel::MemoryPermission::ReadWrite, Kernel::MemoryPermission::Read, SHARED_FONT_MEM_VADDR, Kernel::MemoryRegion::BASE, diff --git a/src/core/hle/service/ns/pl_u.h b/src/core/hle/service/ns/pl_u.h index 7e9fe6220..0d38d7d36 100644 --- a/src/core/hle/service/ns/pl_u.h +++ b/src/core/hle/service/ns/pl_u.h @@ -20,7 +20,7 @@ void EncryptSharedFont(const std::vector& input, Kernel::PhysicalMemory& out class PL_U final : public ServiceFramework { public: - PL_U(FileSystem::FileSystemController& fsc); + PL_U(Core::System& system, FileSystem::FileSystemController& fsc); ~PL_U() override; private: @@ -33,6 +33,7 @@ private: struct Impl; std::unique_ptr impl; + Core::System& system; }; } // namespace NS -- cgit v1.2.3 From fcdbf0bc53d9361351ac8bae22d590e526fdb49d Mon Sep 17 00:00:00 2001 From: David Marcec Date: Sun, 22 Sep 2019 16:40:58 +1000 Subject: Rebase --- src/core/hle/service/ns/ns.cpp | 5 ++--- src/core/hle/service/ns/ns.h | 3 +-- src/core/hle/service/ns/pl_u.cpp | 5 ++++- src/core/hle/service/ns/pl_u.h | 2 +- src/core/hle/service/service.cpp | 26 +++++++++++++------------- 5 files changed, 21 insertions(+), 20 deletions(-) (limited to 'src/core/hle/service/ns') diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index dffd2eefe..15c156ce1 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp @@ -617,8 +617,7 @@ public: } }; -void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system, - FileSystem::FileSystemController& fsc) { +void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { std::make_shared("ns:am2")->InstallAsService(service_manager); std::make_shared("ns:ec")->InstallAsService(service_manager); @@ -630,7 +629,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system std::make_shared()->InstallAsService(service_manager); std::make_shared()->InstallAsService(service_manager); - std::make_shared(system, fsc)->InstallAsService(service_manager); + std::make_shared(system)->InstallAsService(service_manager); } } // namespace Service::NS diff --git a/src/core/hle/service/ns/ns.h b/src/core/hle/service/ns/ns.h index 4a10c98f9..13a64ad88 100644 --- a/src/core/hle/service/ns/ns.h +++ b/src/core/hle/service/ns/ns.h @@ -97,8 +97,7 @@ private: }; /// Registers all NS services with the specified service manager. -void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system, - FileSystem::FileSystemController& fsc); +void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system); } // namespace NS } // namespace Service diff --git a/src/core/hle/service/ns/pl_u.cpp b/src/core/hle/service/ns/pl_u.cpp index 4f9b843e6..c91cfa36e 100644 --- a/src/core/hle/service/ns/pl_u.cpp +++ b/src/core/hle/service/ns/pl_u.cpp @@ -145,7 +145,7 @@ struct PL_U::Impl { std::vector shared_font_regions; }; -PL_U::PL_U(Core::System& system, FileSystem::FileSystemController& fsc) +PL_U::PL_U(Core::System& system) : ServiceFramework("pl:u"), impl{std::make_unique()}, system(system) { static const FunctionInfo functions[] = { @@ -157,6 +157,9 @@ PL_U::PL_U(Core::System& system, FileSystem::FileSystemController& fsc) {5, &PL_U::GetSharedFontInOrderOfPriority, "GetSharedFontInOrderOfPriority"}, }; RegisterHandlers(functions); + + auto& fsc = system.GetFileSystemController(); + // Attempt to load shared font data from disk const auto* nand = fsc.GetSystemNANDContents(); std::size_t offset = 0; diff --git a/src/core/hle/service/ns/pl_u.h b/src/core/hle/service/ns/pl_u.h index 0d38d7d36..d2ef5bead 100644 --- a/src/core/hle/service/ns/pl_u.h +++ b/src/core/hle/service/ns/pl_u.h @@ -20,7 +20,7 @@ void EncryptSharedFont(const std::vector& input, Kernel::PhysicalMemory& out class PL_U final : public ServiceFramework { public: - PL_U(Core::System& system, FileSystem::FileSystemController& fsc); + PL_U(Core::System& system); ~PL_U() override; private: diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 906fdc415..b4e085502 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -198,50 +198,50 @@ ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::HLERequestContext& co void Init(std::shared_ptr& sm, Core::System& system) { // NVFlinger needs to be accessed by several services like Vi and AppletOE so we instantiate it // here and pass it into the respective InstallInterfaces functions. - auto nv_flinger = std::make_shared(system.CoreTiming()); + auto nv_flinger = std::make_shared(system.CoreTiming(), system); system.GetFileSystemController().CreateFactories(*system.GetFilesystem(), false); SM::ServiceManager::InstallInterfaces(sm); Account::InstallInterfaces(system); AM::InstallInterfaces(*sm, nv_flinger, system); - AOC::InstallInterfaces(*sm); + AOC::InstallInterfaces(*sm, system); APM::InstallInterfaces(system); Audio::InstallInterfaces(*sm, system); BCAT::InstallInterfaces(*sm); BPC::InstallInterfaces(*sm); - BtDrv::InstallInterfaces(*sm); - BTM::InstallInterfaces(*sm); + BtDrv::InstallInterfaces(*sm, system); + BTM::InstallInterfaces(*sm, system); Capture::InstallInterfaces(*sm); ERPT::InstallInterfaces(*sm); ES::InstallInterfaces(*sm); EUPLD::InstallInterfaces(*sm); - Fatal::InstallInterfaces(*sm); + Fatal::InstallInterfaces(*sm, system); FGM::InstallInterfaces(*sm); FileSystem::InstallInterfaces(system); - Friend::InstallInterfaces(*sm); + Friend::InstallInterfaces(*sm, system); Glue::InstallInterfaces(system); GRC::InstallInterfaces(*sm); - HID::InstallInterfaces(*sm); + HID::InstallInterfaces(*sm, system); LBL::InstallInterfaces(*sm); LDN::InstallInterfaces(*sm); - LDR::InstallInterfaces(*sm); + LDR::InstallInterfaces(*sm, system); LM::InstallInterfaces(*sm); Migration::InstallInterfaces(*sm); Mii::InstallInterfaces(*sm); MM::InstallInterfaces(*sm); NCM::InstallInterfaces(*sm); NFC::InstallInterfaces(*sm); - NFP::InstallInterfaces(*sm); - NIFM::InstallInterfaces(*sm); - NIM::InstallInterfaces(*sm); + NFP::InstallInterfaces(*sm, system); + NIFM::InstallInterfaces(*sm, system); + NIM::InstallInterfaces(*sm, system); NPNS::InstallInterfaces(*sm); - NS::InstallInterfaces(*sm, system.GetFileSystemController()); + NS::InstallInterfaces(*sm, system); Nvidia::InstallInterfaces(*sm, *nv_flinger, system); PCIe::InstallInterfaces(*sm); PCTL::InstallInterfaces(*sm); PCV::InstallInterfaces(*sm); - PlayReport::InstallInterfaces(system); + PlayReport::InstallInterfaces(*sm, system); PM::InstallInterfaces(system); PSC::InstallInterfaces(*sm); PSM::InstallInterfaces(*sm); -- cgit v1.2.3 From bd1c4ec9a008af9654385ce4f7a96b81a52c9ff6 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Sun, 22 Sep 2019 16:41:34 +1000 Subject: Rebase --- src/core/hle/service/aoc/aoc_u.h | 2 +- .../service/hid/controllers/controller_base.cpp | 6 +++--- .../hle/service/hid/controllers/controller_base.h | 8 +++++--- src/core/hle/service/hid/controllers/debug_pad.cpp | 5 +++-- src/core/hle/service/hid/controllers/debug_pad.h | 5 +++-- src/core/hle/service/hid/controllers/gesture.cpp | 5 +++-- src/core/hle/service/hid/controllers/gesture.h | 5 +++-- src/core/hle/service/hid/controllers/keyboard.cpp | 5 +++-- src/core/hle/service/hid/controllers/keyboard.h | 5 +++-- src/core/hle/service/hid/controllers/mouse.cpp | 4 ++-- src/core/hle/service/hid/controllers/mouse.h | 5 +++-- src/core/hle/service/hid/controllers/npad.cpp | 4 ++-- src/core/hle/service/hid/controllers/npad.h | 5 +++-- src/core/hle/service/hid/controllers/stubbed.cpp | 5 +++-- src/core/hle/service/hid/controllers/stubbed.h | 5 +++-- .../hle/service/hid/controllers/touchscreen.cpp | 5 +++-- src/core/hle/service/hid/controllers/touchscreen.h | 5 +++-- src/core/hle/service/hid/controllers/xpad.cpp | 4 ++-- src/core/hle/service/hid/controllers/xpad.h | 5 +++-- src/core/hle/service/hid/hid.cpp | 6 +++--- src/core/hle/service/hid/hid.h | 6 +++--- src/core/hle/service/nim/nim.cpp | 2 +- src/core/hle/service/ns/pl_u.h | 2 +- src/core/hle/service/nvflinger/nvflinger.cpp | 23 +++++++++++----------- src/core/hle/service/nvflinger/nvflinger.h | 5 +---- 25 files changed, 75 insertions(+), 62 deletions(-) (limited to 'src/core/hle/service/ns') diff --git a/src/core/hle/service/aoc/aoc_u.h b/src/core/hle/service/aoc/aoc_u.h index e20f90a76..848b2f416 100644 --- a/src/core/hle/service/aoc/aoc_u.h +++ b/src/core/hle/service/aoc/aoc_u.h @@ -14,7 +14,7 @@ namespace Service::AOC { class AOC_U final : public ServiceFramework { public: - AOC_U(Core::System& system); + explicit AOC_U(Core::System& system); ~AOC_U() override; private: diff --git a/src/core/hle/service/hid/controllers/controller_base.cpp b/src/core/hle/service/hid/controllers/controller_base.cpp index cc935b031..2ea9b78d8 100644 --- a/src/core/hle/service/hid/controllers/controller_base.cpp +++ b/src/core/hle/service/hid/controllers/controller_base.cpp @@ -6,15 +6,15 @@ namespace Service::HID { -ControllerBase::ControllerBase() = default; +ControllerBase::ControllerBase(Core::System& system) : system(system){}; ControllerBase::~ControllerBase() = default; -void ControllerBase::ActivateController(Core::System& system) { +void ControllerBase::ActivateController() { if (is_activated) { OnRelease(); } is_activated = true; - OnInit(system); + OnInit(); } void ControllerBase::DeactivateController() { diff --git a/src/core/hle/service/hid/controllers/controller_base.h b/src/core/hle/service/hid/controllers/controller_base.h index 7abe24f1d..47972f5fc 100644 --- a/src/core/hle/service/hid/controllers/controller_base.h +++ b/src/core/hle/service/hid/controllers/controller_base.h @@ -18,11 +18,11 @@ class System; namespace Service::HID { class ControllerBase { public: - ControllerBase(); + ControllerBase(Core::System& system); virtual ~ControllerBase(); // Called when the controller is initialized - virtual void OnInit(Core::System& system) = 0; + virtual void OnInit() = 0; // When the controller is released virtual void OnRelease() = 0; @@ -34,7 +34,7 @@ public: // Called when input devices should be loaded virtual void OnLoadInputDevices() = 0; - void ActivateController(Core::System& system); + void ActivateController(); void DeactivateController(); @@ -50,5 +50,7 @@ protected: s64_le entry_count; }; static_assert(sizeof(CommonHeader) == 0x20, "CommonHeader is an invalid size"); + + Core::System& system; }; } // namespace Service::HID diff --git a/src/core/hle/service/hid/controllers/debug_pad.cpp b/src/core/hle/service/hid/controllers/debug_pad.cpp index 2c5528b67..8e8263f5b 100644 --- a/src/core/hle/service/hid/controllers/debug_pad.cpp +++ b/src/core/hle/service/hid/controllers/debug_pad.cpp @@ -14,10 +14,11 @@ constexpr s32 HID_JOYSTICK_MAX = 0x7fff; constexpr s32 HID_JOYSTICK_MIN = -0x7fff; enum class JoystickId : std::size_t { Joystick_Left, Joystick_Right }; -Controller_DebugPad::Controller_DebugPad() = default; +Controller_DebugPad::Controller_DebugPad(Core::System& system) + : ControllerBase(system), system(system) {} Controller_DebugPad::~Controller_DebugPad() = default; -void Controller_DebugPad::OnInit(Core::System& system) {} +void Controller_DebugPad::OnInit() {} void Controller_DebugPad::OnRelease() {} diff --git a/src/core/hle/service/hid/controllers/debug_pad.h b/src/core/hle/service/hid/controllers/debug_pad.h index 629d6d582..6c4de817e 100644 --- a/src/core/hle/service/hid/controllers/debug_pad.h +++ b/src/core/hle/service/hid/controllers/debug_pad.h @@ -16,11 +16,11 @@ namespace Service::HID { class Controller_DebugPad final : public ControllerBase { public: - Controller_DebugPad(); + explicit Controller_DebugPad(Core::System& system); ~Controller_DebugPad() override; // Called when the controller is initialized - void OnInit(Core::System& system) override; + void OnInit() override; // When the controller is released void OnRelease() override; @@ -89,5 +89,6 @@ private: buttons; std::array, Settings::NativeAnalog::NUM_STICKS_HID> analogs; + Core::System& system; }; } // namespace Service::HID diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp index c01fd6d4e..80da0a0d3 100644 --- a/src/core/hle/service/hid/controllers/gesture.cpp +++ b/src/core/hle/service/hid/controllers/gesture.cpp @@ -10,10 +10,11 @@ namespace Service::HID { constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3BA00; -Controller_Gesture::Controller_Gesture() = default; +Controller_Gesture::Controller_Gesture(Core::System& system) + : ControllerBase(system), system(system) {} Controller_Gesture::~Controller_Gesture() = default; -void Controller_Gesture::OnInit(Core::System& system) {} +void Controller_Gesture::OnInit() {} void Controller_Gesture::OnRelease() {} diff --git a/src/core/hle/service/hid/controllers/gesture.h b/src/core/hle/service/hid/controllers/gesture.h index c3827fa00..b0f8794ba 100644 --- a/src/core/hle/service/hid/controllers/gesture.h +++ b/src/core/hle/service/hid/controllers/gesture.h @@ -12,11 +12,11 @@ namespace Service::HID { class Controller_Gesture final : public ControllerBase { public: - Controller_Gesture(); + Controller_Gesture(Core::System& system); ~Controller_Gesture() override; // Called when the controller is initialized - void OnInit(Core::System& system) override; + void OnInit() override; // When the controller is released void OnRelease() override; @@ -59,5 +59,6 @@ private: std::array gesture_states; }; SharedMemory shared_memory{}; + Core::System& system; }; } // namespace Service::HID diff --git a/src/core/hle/service/hid/controllers/keyboard.cpp b/src/core/hle/service/hid/controllers/keyboard.cpp index b3fbb7962..e587b2e15 100644 --- a/src/core/hle/service/hid/controllers/keyboard.cpp +++ b/src/core/hle/service/hid/controllers/keyboard.cpp @@ -12,10 +12,11 @@ namespace Service::HID { constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3800; constexpr u8 KEYS_PER_BYTE = 8; -Controller_Keyboard::Controller_Keyboard() = default; +Controller_Keyboard::Controller_Keyboard(Core::System& system) + : ControllerBase(system), system(system) {} Controller_Keyboard::~Controller_Keyboard() = default; -void Controller_Keyboard::OnInit(Core::System& system) {} +void Controller_Keyboard::OnInit() {} void Controller_Keyboard::OnRelease() {} diff --git a/src/core/hle/service/hid/controllers/keyboard.h b/src/core/hle/service/hid/controllers/keyboard.h index a594706a9..37ff075b1 100644 --- a/src/core/hle/service/hid/controllers/keyboard.h +++ b/src/core/hle/service/hid/controllers/keyboard.h @@ -15,11 +15,11 @@ namespace Service::HID { class Controller_Keyboard final : public ControllerBase { public: - Controller_Keyboard(); + Controller_Keyboard(Core::System& system); ~Controller_Keyboard() override; // Called when the controller is initialized - void OnInit(Core::System& system) override; + void OnInit() override; // When the controller is released void OnRelease() override; @@ -53,5 +53,6 @@ private: keyboard_keys; std::array, Settings::NativeKeyboard::NumKeyboardMods> keyboard_mods; + Core::System& system; }; } // namespace Service::HID diff --git a/src/core/hle/service/hid/controllers/mouse.cpp b/src/core/hle/service/hid/controllers/mouse.cpp index fd3f91e65..88f2ca4c1 100644 --- a/src/core/hle/service/hid/controllers/mouse.cpp +++ b/src/core/hle/service/hid/controllers/mouse.cpp @@ -11,10 +11,10 @@ namespace Service::HID { constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3400; -Controller_Mouse::Controller_Mouse() = default; +Controller_Mouse::Controller_Mouse(Core::System& system) : ControllerBase(system), system(system) {} Controller_Mouse::~Controller_Mouse() = default; -void Controller_Mouse::OnInit(Core::System& system) {} +void Controller_Mouse::OnInit() {} void Controller_Mouse::OnRelease() {} void Controller_Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, diff --git a/src/core/hle/service/hid/controllers/mouse.h b/src/core/hle/service/hid/controllers/mouse.h index df3a17491..67e2647ad 100644 --- a/src/core/hle/service/hid/controllers/mouse.h +++ b/src/core/hle/service/hid/controllers/mouse.h @@ -14,11 +14,11 @@ namespace Service::HID { class Controller_Mouse final : public ControllerBase { public: - Controller_Mouse(); + Controller_Mouse(Core::System& system); ~Controller_Mouse() override; // Called when the controller is initialized - void OnInit(Core::System& system) override; + void OnInit() override; // When the controller is released void OnRelease() override; @@ -53,5 +53,6 @@ private: std::unique_ptr mouse_device; std::array, Settings::NativeMouseButton::NumMouseButtons> mouse_button_devices; + Core::System& system; }; } // namespace Service::HID diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 104924d03..f7a0aa4ff 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -93,7 +93,7 @@ u32 Controller_NPad::IndexToNPad(std::size_t index) { }; } -Controller_NPad::Controller_NPad() = default; +Controller_NPad::Controller_NPad(Core::System& system) : ControllerBase(system), system(system) {} Controller_NPad::~Controller_NPad() = default; void Controller_NPad::InitNewlyAddedControler(std::size_t controller_idx) { @@ -167,7 +167,7 @@ void Controller_NPad::InitNewlyAddedControler(std::size_t controller_idx) { controller.battery_level[2] = BATTERY_FULL; } -void Controller_NPad::OnInit(Core::System& system) { +void Controller_NPad::OnInit() { auto& kernel = system.Kernel(); styleset_changed_event = Kernel::WritableEvent::CreateEventPair( kernel, Kernel::ResetType::Automatic, "npad:NpadStyleSetChanged"); diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index 755739700..3552c248e 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h @@ -20,11 +20,11 @@ constexpr u32 NPAD_UNKNOWN = 16; // TODO(ogniK): What is this? class Controller_NPad final : public ControllerBase { public: - Controller_NPad(); + Controller_NPad(Core::System& system); ~Controller_NPad() override; // Called when the controller is initialized - void OnInit(Core::System& system) override; + void OnInit() override; // When the controller is released void OnRelease() override; @@ -327,5 +327,6 @@ private: std::array npad_pad_states{}; bool IsControllerSupported(NPadControllerType controller); bool is_in_lr_assignment_mode{false}; + Core::System& system; }; } // namespace Service::HID diff --git a/src/core/hle/service/hid/controllers/stubbed.cpp b/src/core/hle/service/hid/controllers/stubbed.cpp index 5de75c958..9b829341e 100644 --- a/src/core/hle/service/hid/controllers/stubbed.cpp +++ b/src/core/hle/service/hid/controllers/stubbed.cpp @@ -9,10 +9,11 @@ namespace Service::HID { -Controller_Stubbed::Controller_Stubbed() = default; +Controller_Stubbed::Controller_Stubbed(Core::System& system) + : ControllerBase(system), system(system) {} Controller_Stubbed::~Controller_Stubbed() = default; -void Controller_Stubbed::OnInit(Core::System& system) {} +void Controller_Stubbed::OnInit() {} void Controller_Stubbed::OnRelease() {} diff --git a/src/core/hle/service/hid/controllers/stubbed.h b/src/core/hle/service/hid/controllers/stubbed.h index af636bae3..96dec4872 100644 --- a/src/core/hle/service/hid/controllers/stubbed.h +++ b/src/core/hle/service/hid/controllers/stubbed.h @@ -10,11 +10,11 @@ namespace Service::HID { class Controller_Stubbed final : public ControllerBase { public: - Controller_Stubbed(); + Controller_Stubbed(Core::System& system); ~Controller_Stubbed() override; // Called when the controller is initialized - void OnInit(Core::System& system) override; + void OnInit() override; // When the controller is released void OnRelease() override; @@ -30,5 +30,6 @@ public: private: bool smart_update{}; std::size_t common_offset{}; + Core::System& system; }; } // namespace Service::HID diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index ea8dffaab..25912fd69 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.cpp +++ b/src/core/hle/service/hid/controllers/touchscreen.cpp @@ -13,10 +13,11 @@ namespace Service::HID { constexpr std::size_t SHARED_MEMORY_OFFSET = 0x400; -Controller_Touchscreen::Controller_Touchscreen() = default; +Controller_Touchscreen::Controller_Touchscreen(Core::System& system) + : ControllerBase(system), system(system) {} Controller_Touchscreen::~Controller_Touchscreen() = default; -void Controller_Touchscreen::OnInit(Core::System& system) {} +void Controller_Touchscreen::OnInit() {} void Controller_Touchscreen::OnRelease() {} diff --git a/src/core/hle/service/hid/controllers/touchscreen.h b/src/core/hle/service/hid/controllers/touchscreen.h index fdb45fd85..2e8383b80 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.h +++ b/src/core/hle/service/hid/controllers/touchscreen.h @@ -14,11 +14,11 @@ namespace Service::HID { class Controller_Touchscreen final : public ControllerBase { public: - Controller_Touchscreen(); + Controller_Touchscreen(Core::System& system); ~Controller_Touchscreen() override; // Called when the controller is initialized - void OnInit(Core::System& system) override; + void OnInit() override; // When the controller is released void OnRelease() override; @@ -69,5 +69,6 @@ private: TouchScreenSharedMemory shared_memory{}; std::unique_ptr touch_device; s64_le last_touch{}; + Core::System& system; }; } // namespace Service::HID diff --git a/src/core/hle/service/hid/controllers/xpad.cpp b/src/core/hle/service/hid/controllers/xpad.cpp index 22ee0c7d7..1bce044b4 100644 --- a/src/core/hle/service/hid/controllers/xpad.cpp +++ b/src/core/hle/service/hid/controllers/xpad.cpp @@ -10,10 +10,10 @@ namespace Service::HID { constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3C00; -Controller_XPad::Controller_XPad() = default; +Controller_XPad::Controller_XPad(Core::System& system) : ControllerBase(system), system(system) {} Controller_XPad::~Controller_XPad() = default; -void Controller_XPad::OnInit(Core::System& system) {} +void Controller_XPad::OnInit() {} void Controller_XPad::OnRelease() {} diff --git a/src/core/hle/service/hid/controllers/xpad.h b/src/core/hle/service/hid/controllers/xpad.h index 8522efd50..813cb7755 100644 --- a/src/core/hle/service/hid/controllers/xpad.h +++ b/src/core/hle/service/hid/controllers/xpad.h @@ -12,11 +12,11 @@ namespace Service::HID { class Controller_XPad final : public ControllerBase { public: - Controller_XPad(); + Controller_XPad(Core::System& system); ~Controller_XPad() override; // Called when the controller is initialized - void OnInit(Core::System& system) override; + void OnInit() override; // When the controller is released void OnRelease() override; @@ -56,5 +56,6 @@ private: }; static_assert(sizeof(SharedMemory) == 0x1000, "SharedMemory is an invalid size"); SharedMemory shared_memory{}; + Core::System& system; }; } // namespace Service::HID diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index cd88696cd..33145b891 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -67,8 +67,8 @@ IAppletResource::IAppletResource(Core::System& system) MakeController(HidController::Gesture); // Homebrew doesn't try to activate some controllers, so we activate them by default - GetController(HidController::NPad).ActivateController(system); - GetController(HidController::Touchscreen).ActivateController(system); + GetController(HidController::NPad).ActivateController(); + GetController(HidController::Touchscreen).ActivateController(); GetController(HidController::Unknown1).SetCommonHeaderOffset(0x4c00); GetController(HidController::Unknown2).SetCommonHeaderOffset(0x4e00); @@ -89,7 +89,7 @@ IAppletResource::IAppletResource(Core::System& system) } void IAppletResource::ActivateController(HidController controller) { - controllers[static_cast(controller)]->ActivateController(system); + controllers[static_cast(controller)]->ActivateController(); } void IAppletResource::DeactivateController(HidController controller) { diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index bf8dbdc0e..35b663679 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h @@ -42,7 +42,7 @@ enum class HidController : std::size_t { class IAppletResource final : public ServiceFramework { public: - IAppletResource(Core::System& system); + explicit IAppletResource(Core::System& system); ~IAppletResource() override; void ActivateController(HidController controller); @@ -61,7 +61,7 @@ public: private: template void MakeController(HidController controller) { - controllers[static_cast(controller)] = std::make_unique(); + controllers[static_cast(controller)] = std::make_unique(system); } void GetSharedMemoryHandle(Kernel::HLERequestContext& ctx); @@ -78,7 +78,7 @@ private: class Hid final : public ServiceFramework { public: - Hid(Core::System& system); + explicit Hid(Core::System& system); ~Hid() override; std::shared_ptr GetAppletResource(); diff --git a/src/core/hle/service/nim/nim.cpp b/src/core/hle/service/nim/nim.cpp index 8c47b2d75..75d414952 100644 --- a/src/core/hle/service/nim/nim.cpp +++ b/src/core/hle/service/nim/nim.cpp @@ -126,7 +126,7 @@ public: class IEnsureNetworkClockAvailabilityService final : public ServiceFramework { public: - IEnsureNetworkClockAvailabilityService(Core::System& system) + explicit IEnsureNetworkClockAvailabilityService(Core::System& system) : ServiceFramework("IEnsureNetworkClockAvailabilityService") { static const FunctionInfo functions[] = { {0, &IEnsureNetworkClockAvailabilityService::StartTask, "StartTask"}, diff --git a/src/core/hle/service/ns/pl_u.h b/src/core/hle/service/ns/pl_u.h index d2ef5bead..a843d569e 100644 --- a/src/core/hle/service/ns/pl_u.h +++ b/src/core/hle/service/ns/pl_u.h @@ -20,7 +20,7 @@ void EncryptSharedFont(const std::vector& input, Kernel::PhysicalMemory& out class PL_U final : public ServiceFramework { public: - PL_U(Core::System& system); + explicit PL_U(Core::System& system); ~PL_U() override; private: diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index 9217ef040..2e4d707b9 100644 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp @@ -29,8 +29,7 @@ namespace Service::NVFlinger { constexpr s64 frame_ticks = static_cast(Core::Timing::BASE_CLOCK_RATE / 60); constexpr s64 frame_ticks_30fps = static_cast(Core::Timing::BASE_CLOCK_RATE / 30); -NVFlinger::NVFlinger(Core::Timing::CoreTiming& core_timing, Core::System& system) - : core_timing{core_timing}, system(system) { +NVFlinger::NVFlinger(Core::System& system) : system(system) { displays.emplace_back(0, "Default", system); displays.emplace_back(1, "External", system); displays.emplace_back(2, "Edid", system); @@ -38,18 +37,20 @@ NVFlinger::NVFlinger(Core::Timing::CoreTiming& core_timing, Core::System& system displays.emplace_back(4, "Null", system); // Schedule the screen composition events - composition_event = core_timing.RegisterEvent("ScreenComposition", [this](u64 userdata, - s64 cycles_late) { - Compose(); - const auto ticks = Settings::values.force_30fps_mode ? frame_ticks_30fps : GetNextTicks(); - this->core_timing.ScheduleEvent(std::max(0LL, ticks - cycles_late), composition_event); - }); - - core_timing.ScheduleEvent(frame_ticks, composition_event); + composition_event = system.CoreTiming().RegisterEvent( + "ScreenComposition", [this](u64 userdata, s64 cycles_late) { + Compose(); + const auto ticks = + Settings::values.force_30fps_mode ? frame_ticks_30fps : GetNextTicks(); + this->system.CoreTiming().ScheduleEvent(std::max(0LL, ticks - cycles_late), + composition_event); + }); + + system.CoreTiming().ScheduleEvent(frame_ticks, composition_event); } NVFlinger::~NVFlinger() { - core_timing.UnscheduleEvent(composition_event, 0); + system.CoreTiming().UnscheduleEvent(composition_event, 0); } void NVFlinger::SetNVDrvInstance(std::shared_ptr instance) { diff --git a/src/core/hle/service/nvflinger/nvflinger.h b/src/core/hle/service/nvflinger/nvflinger.h index 85aae725c..5d7e3bfb8 100644 --- a/src/core/hle/service/nvflinger/nvflinger.h +++ b/src/core/hle/service/nvflinger/nvflinger.h @@ -38,7 +38,7 @@ class BufferQueue; class NVFlinger final { public: - explicit NVFlinger(Core::Timing::CoreTiming& core_timing, Core::System& system); + explicit NVFlinger(Core::System& system); ~NVFlinger(); /// Sets the NVDrv module instance to use to send buffers to the GPU. @@ -105,9 +105,6 @@ private: /// Event that handles screen composition. Core::Timing::EventType* composition_event; - /// Core timing instance for registering/unregistering the composition event. - Core::Timing::CoreTiming& core_timing; - Core::System& system; }; -- cgit v1.2.3