diff options
author | David Marcec <dmarcecguzman@gmail.com> | 2019-09-22 08:41:34 +0200 |
---|---|---|
committer | David Marcec <dmarcecguzman@gmail.com> | 2019-09-22 08:41:34 +0200 |
commit | bd1c4ec9a008af9654385ce4f7a96b81a52c9ff6 (patch) | |
tree | b432d1cdfe0c5d40af58717f126c91a5d7fd2ab4 /src | |
parent | Rebase (diff) | |
download | yuzu-bd1c4ec9a008af9654385ce4f7a96b81a52c9ff6.tar yuzu-bd1c4ec9a008af9654385ce4f7a96b81a52c9ff6.tar.gz yuzu-bd1c4ec9a008af9654385ce4f7a96b81a52c9ff6.tar.bz2 yuzu-bd1c4ec9a008af9654385ce4f7a96b81a52c9ff6.tar.lz yuzu-bd1c4ec9a008af9654385ce4f7a96b81a52c9ff6.tar.xz yuzu-bd1c4ec9a008af9654385ce4f7a96b81a52c9ff6.tar.zst yuzu-bd1c4ec9a008af9654385ce4f7a96b81a52c9ff6.zip |
Diffstat (limited to 'src')
25 files changed, 75 insertions, 62 deletions
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<AOC_U> { 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<std::unique_ptr<Input::AnalogDevice>, 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<GestureState, 17> 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<std::unique_ptr<Input::ButtonDevice>, 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<Input::MouseDevice> mouse_device; std::array<std::unique_ptr<Input::ButtonDevice>, 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<ControllerPad, 10> 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<Input::TouchDevice> 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<Controller_Gesture>(HidController::Gesture); // Homebrew doesn't try to activate some controllers, so we activate them by default - GetController<Controller_NPad>(HidController::NPad).ActivateController(system); - GetController<Controller_Touchscreen>(HidController::Touchscreen).ActivateController(system); + GetController<Controller_NPad>(HidController::NPad).ActivateController(); + GetController<Controller_Touchscreen>(HidController::Touchscreen).ActivateController(); GetController<Controller_Stubbed>(HidController::Unknown1).SetCommonHeaderOffset(0x4c00); GetController<Controller_Stubbed>(HidController::Unknown2).SetCommonHeaderOffset(0x4e00); @@ -89,7 +89,7 @@ IAppletResource::IAppletResource(Core::System& system) } void IAppletResource::ActivateController(HidController controller) { - controllers[static_cast<size_t>(controller)]->ActivateController(system); + controllers[static_cast<size_t>(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<IAppletResource> { public: - IAppletResource(Core::System& system); + explicit IAppletResource(Core::System& system); ~IAppletResource() override; void ActivateController(HidController controller); @@ -61,7 +61,7 @@ public: private: template <typename T> void MakeController(HidController controller) { - controllers[static_cast<std::size_t>(controller)] = std::make_unique<T>(); + controllers[static_cast<std::size_t>(controller)] = std::make_unique<T>(system); } void GetSharedMemoryHandle(Kernel::HLERequestContext& ctx); @@ -78,7 +78,7 @@ private: class Hid final : public ServiceFramework<Hid> { public: - Hid(Core::System& system); + explicit Hid(Core::System& system); ~Hid() override; std::shared_ptr<IAppletResource> 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<IEnsureNetworkClockAvailabilityService> { 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<u8>& input, Kernel::PhysicalMemory& out class PL_U final : public ServiceFramework<PL_U> { 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<s64>(Core::Timing::BASE_CLOCK_RATE / 60); constexpr s64 frame_ticks_30fps = static_cast<s64>(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<s64>(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<s64>(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<Nvidia::Module> 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; }; |