diff options
Diffstat (limited to 'src/core/hle/service')
27 files changed, 92 insertions, 60 deletions
diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp index dc6a6b188..6831c0735 100644 --- a/src/core/hle/service/audio/audout_u.cpp +++ b/src/core/hle/service/audio/audout_u.cpp | |||
| @@ -68,12 +68,12 @@ public: | |||
| 68 | RegisterHandlers(functions); | 68 | RegisterHandlers(functions); |
| 69 | 69 | ||
| 70 | // This is the event handle used to check if the audio buffer was released | 70 | // This is the event handle used to check if the audio buffer was released |
| 71 | auto& kernel = Core::System::GetInstance().Kernel(); | 71 | auto& system = Core::System::GetInstance(); |
| 72 | buffer_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Sticky, | 72 | buffer_event = Kernel::WritableEvent::CreateEventPair( |
| 73 | "IAudioOutBufferReleased"); | 73 | system.Kernel(), Kernel::ResetType::Sticky, "IAudioOutBufferReleased"); |
| 74 | 74 | ||
| 75 | stream = audio_core.OpenStream(audio_params.sample_rate, audio_params.channel_count, | 75 | stream = audio_core.OpenStream(system.CoreTiming(), audio_params.sample_rate, |
| 76 | std::move(unique_name), | 76 | audio_params.channel_count, std::move(unique_name), |
| 77 | [=]() { buffer_event.writable->Signal(); }); | 77 | [=]() { buffer_event.writable->Signal(); }); |
| 78 | } | 78 | } |
| 79 | 79 | ||
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index 76cc48254..7e0cc64a8 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp | |||
| @@ -42,10 +42,11 @@ public: | |||
| 42 | // clang-format on | 42 | // clang-format on |
| 43 | RegisterHandlers(functions); | 43 | RegisterHandlers(functions); |
| 44 | 44 | ||
| 45 | auto& kernel = Core::System::GetInstance().Kernel(); | 45 | auto& system = Core::System::GetInstance(); |
| 46 | system_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Sticky, | 46 | system_event = Kernel::WritableEvent::CreateEventPair( |
| 47 | "IAudioRenderer:SystemEvent"); | 47 | system.Kernel(), Kernel::ResetType::Sticky, "IAudioRenderer:SystemEvent"); |
| 48 | renderer = std::make_unique<AudioCore::AudioRenderer>(audren_params, system_event.writable); | 48 | renderer = std::make_unique<AudioCore::AudioRenderer>(system.CoreTiming(), audren_params, |
| 49 | system_event.writable); | ||
| 49 | } | 50 | } |
| 50 | 51 | ||
| 51 | private: | 52 | private: |
diff --git a/src/core/hle/service/hid/controllers/controller_base.h b/src/core/hle/service/hid/controllers/controller_base.h index f0e092b1b..5e5097a03 100644 --- a/src/core/hle/service/hid/controllers/controller_base.h +++ b/src/core/hle/service/hid/controllers/controller_base.h | |||
| @@ -7,6 +7,10 @@ | |||
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | #include "common/swap.h" | 8 | #include "common/swap.h" |
| 9 | 9 | ||
| 10 | namespace Core::Timing { | ||
| 11 | class CoreTiming; | ||
| 12 | } | ||
| 13 | |||
| 10 | namespace Service::HID { | 14 | namespace Service::HID { |
| 11 | class ControllerBase { | 15 | class ControllerBase { |
| 12 | public: | 16 | public: |
| @@ -20,7 +24,8 @@ public: | |||
| 20 | virtual void OnRelease() = 0; | 24 | virtual void OnRelease() = 0; |
| 21 | 25 | ||
| 22 | // When the controller is requesting an update for the shared memory | 26 | // When the controller is requesting an update for the shared memory |
| 23 | virtual void OnUpdate(u8* data, std::size_t size) = 0; | 27 | virtual void OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, |
| 28 | std::size_t size) = 0; | ||
| 24 | 29 | ||
| 25 | // Called when input devices should be loaded | 30 | // Called when input devices should be loaded |
| 26 | virtual void OnLoadInputDevices() = 0; | 31 | virtual void OnLoadInputDevices() = 0; |
diff --git a/src/core/hle/service/hid/controllers/debug_pad.cpp b/src/core/hle/service/hid/controllers/debug_pad.cpp index b264c9503..c5c2e032a 100644 --- a/src/core/hle/service/hid/controllers/debug_pad.cpp +++ b/src/core/hle/service/hid/controllers/debug_pad.cpp | |||
| @@ -21,8 +21,9 @@ void Controller_DebugPad::OnInit() {} | |||
| 21 | 21 | ||
| 22 | void Controller_DebugPad::OnRelease() {} | 22 | void Controller_DebugPad::OnRelease() {} |
| 23 | 23 | ||
| 24 | void Controller_DebugPad::OnUpdate(u8* data, std::size_t size) { | 24 | void Controller_DebugPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, |
| 25 | shared_memory.header.timestamp = Core::Timing::GetTicks(); | 25 | std::size_t size) { |
| 26 | shared_memory.header.timestamp = core_timing.GetTicks(); | ||
| 26 | shared_memory.header.total_entry_count = 17; | 27 | shared_memory.header.total_entry_count = 17; |
| 27 | 28 | ||
| 28 | if (!IsControllerActivated()) { | 29 | if (!IsControllerActivated()) { |
diff --git a/src/core/hle/service/hid/controllers/debug_pad.h b/src/core/hle/service/hid/controllers/debug_pad.h index 68b734248..929035034 100644 --- a/src/core/hle/service/hid/controllers/debug_pad.h +++ b/src/core/hle/service/hid/controllers/debug_pad.h | |||
| @@ -26,7 +26,7 @@ public: | |||
| 26 | void OnRelease() override; | 26 | void OnRelease() override; |
| 27 | 27 | ||
| 28 | // When the controller is requesting an update for the shared memory | 28 | // When the controller is requesting an update for the shared memory |
| 29 | void OnUpdate(u8* data, std::size_t size) override; | 29 | void OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, std::size_t size) override; |
| 30 | 30 | ||
| 31 | // Called when input devices should be loaded | 31 | // Called when input devices should be loaded |
| 32 | void OnLoadInputDevices() override; | 32 | void OnLoadInputDevices() override; |
diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp index 6d21f1a7d..a179252e3 100644 --- a/src/core/hle/service/hid/controllers/gesture.cpp +++ b/src/core/hle/service/hid/controllers/gesture.cpp | |||
| @@ -17,8 +17,9 @@ void Controller_Gesture::OnInit() {} | |||
| 17 | 17 | ||
| 18 | void Controller_Gesture::OnRelease() {} | 18 | void Controller_Gesture::OnRelease() {} |
| 19 | 19 | ||
| 20 | void Controller_Gesture::OnUpdate(u8* data, std::size_t size) { | 20 | void Controller_Gesture::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, |
| 21 | shared_memory.header.timestamp = Core::Timing::GetTicks(); | 21 | std::size_t size) { |
| 22 | shared_memory.header.timestamp = core_timing.GetTicks(); | ||
| 22 | shared_memory.header.total_entry_count = 17; | 23 | shared_memory.header.total_entry_count = 17; |
| 23 | 24 | ||
| 24 | if (!IsControllerActivated()) { | 25 | if (!IsControllerActivated()) { |
diff --git a/src/core/hle/service/hid/controllers/gesture.h b/src/core/hle/service/hid/controllers/gesture.h index 1056ffbcd..f305fe90f 100644 --- a/src/core/hle/service/hid/controllers/gesture.h +++ b/src/core/hle/service/hid/controllers/gesture.h | |||
| @@ -22,7 +22,7 @@ public: | |||
| 22 | void OnRelease() override; | 22 | void OnRelease() override; |
| 23 | 23 | ||
| 24 | // When the controller is requesting an update for the shared memory | 24 | // When the controller is requesting an update for the shared memory |
| 25 | void OnUpdate(u8* data, size_t size) override; | 25 | void OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, size_t size) override; |
| 26 | 26 | ||
| 27 | // Called when input devices should be loaded | 27 | // Called when input devices should be loaded |
| 28 | void OnLoadInputDevices() override; | 28 | void OnLoadInputDevices() override; |
diff --git a/src/core/hle/service/hid/controllers/keyboard.cpp b/src/core/hle/service/hid/controllers/keyboard.cpp index 798f30436..92d7bfb52 100644 --- a/src/core/hle/service/hid/controllers/keyboard.cpp +++ b/src/core/hle/service/hid/controllers/keyboard.cpp | |||
| @@ -19,8 +19,9 @@ void Controller_Keyboard::OnInit() {} | |||
| 19 | 19 | ||
| 20 | void Controller_Keyboard::OnRelease() {} | 20 | void Controller_Keyboard::OnRelease() {} |
| 21 | 21 | ||
| 22 | void Controller_Keyboard::OnUpdate(u8* data, std::size_t size) { | 22 | void Controller_Keyboard::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, |
| 23 | shared_memory.header.timestamp = Core::Timing::GetTicks(); | 23 | std::size_t size) { |
| 24 | shared_memory.header.timestamp = core_timing.GetTicks(); | ||
| 24 | shared_memory.header.total_entry_count = 17; | 25 | shared_memory.header.total_entry_count = 17; |
| 25 | 26 | ||
| 26 | if (!IsControllerActivated()) { | 27 | if (!IsControllerActivated()) { |
diff --git a/src/core/hle/service/hid/controllers/keyboard.h b/src/core/hle/service/hid/controllers/keyboard.h index f52775456..73cd2c7bb 100644 --- a/src/core/hle/service/hid/controllers/keyboard.h +++ b/src/core/hle/service/hid/controllers/keyboard.h | |||
| @@ -25,7 +25,7 @@ public: | |||
| 25 | void OnRelease() override; | 25 | void OnRelease() override; |
| 26 | 26 | ||
| 27 | // When the controller is requesting an update for the shared memory | 27 | // When the controller is requesting an update for the shared memory |
| 28 | void OnUpdate(u8* data, std::size_t size) override; | 28 | void OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, std::size_t size) override; |
| 29 | 29 | ||
| 30 | // Called when input devices should be loaded | 30 | // Called when input devices should be loaded |
| 31 | void OnLoadInputDevices() override; | 31 | void OnLoadInputDevices() override; |
diff --git a/src/core/hle/service/hid/controllers/mouse.cpp b/src/core/hle/service/hid/controllers/mouse.cpp index 4985037be..11ab096d9 100644 --- a/src/core/hle/service/hid/controllers/mouse.cpp +++ b/src/core/hle/service/hid/controllers/mouse.cpp | |||
| @@ -17,8 +17,9 @@ Controller_Mouse::~Controller_Mouse() = default; | |||
| 17 | void Controller_Mouse::OnInit() {} | 17 | void Controller_Mouse::OnInit() {} |
| 18 | void Controller_Mouse::OnRelease() {} | 18 | void Controller_Mouse::OnRelease() {} |
| 19 | 19 | ||
| 20 | void Controller_Mouse::OnUpdate(u8* data, std::size_t size) { | 20 | void Controller_Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, |
| 21 | shared_memory.header.timestamp = Core::Timing::GetTicks(); | 21 | std::size_t size) { |
| 22 | shared_memory.header.timestamp = core_timing.GetTicks(); | ||
| 22 | shared_memory.header.total_entry_count = 17; | 23 | shared_memory.header.total_entry_count = 17; |
| 23 | 24 | ||
| 24 | if (!IsControllerActivated()) { | 25 | if (!IsControllerActivated()) { |
diff --git a/src/core/hle/service/hid/controllers/mouse.h b/src/core/hle/service/hid/controllers/mouse.h index 70b654d07..9d46eecbe 100644 --- a/src/core/hle/service/hid/controllers/mouse.h +++ b/src/core/hle/service/hid/controllers/mouse.h | |||
| @@ -24,7 +24,7 @@ public: | |||
| 24 | void OnRelease() override; | 24 | void OnRelease() override; |
| 25 | 25 | ||
| 26 | // When the controller is requesting an update for the shared memory | 26 | // When the controller is requesting an update for the shared memory |
| 27 | void OnUpdate(u8* data, std::size_t size) override; | 27 | void OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, std::size_t size) override; |
| 28 | 28 | ||
| 29 | // Called when input devices should be loaded | 29 | // Called when input devices should be loaded |
| 30 | void OnLoadInputDevices() override; | 30 | void OnLoadInputDevices() override; |
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index ffdd1c593..e7fc7a619 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -288,7 +288,8 @@ void Controller_NPad::RequestPadStateUpdate(u32 npad_id) { | |||
| 288 | rstick_entry.y = static_cast<s32>(stick_r_y_f * HID_JOYSTICK_MAX); | 288 | rstick_entry.y = static_cast<s32>(stick_r_y_f * HID_JOYSTICK_MAX); |
| 289 | } | 289 | } |
| 290 | 290 | ||
| 291 | void Controller_NPad::OnUpdate(u8* data, std::size_t data_len) { | 291 | void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, |
| 292 | std::size_t data_len) { | ||
| 292 | if (!IsControllerActivated()) | 293 | if (!IsControllerActivated()) |
| 293 | return; | 294 | return; |
| 294 | for (std::size_t i = 0; i < shared_memory_entries.size(); i++) { | 295 | for (std::size_t i = 0; i < shared_memory_entries.size(); i++) { |
| @@ -308,7 +309,7 @@ void Controller_NPad::OnUpdate(u8* data, std::size_t data_len) { | |||
| 308 | const auto& last_entry = | 309 | const auto& last_entry = |
| 309 | main_controller->npad[main_controller->common.last_entry_index]; | 310 | main_controller->npad[main_controller->common.last_entry_index]; |
| 310 | 311 | ||
| 311 | main_controller->common.timestamp = Core::Timing::GetTicks(); | 312 | main_controller->common.timestamp = core_timing.GetTicks(); |
| 312 | main_controller->common.last_entry_index = | 313 | main_controller->common.last_entry_index = |
| 313 | (main_controller->common.last_entry_index + 1) % 17; | 314 | (main_controller->common.last_entry_index + 1) % 17; |
| 314 | 315 | ||
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index 106cf58c8..18c7a94e6 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h | |||
| @@ -30,7 +30,7 @@ public: | |||
| 30 | void OnRelease() override; | 30 | void OnRelease() override; |
| 31 | 31 | ||
| 32 | // When the controller is requesting an update for the shared memory | 32 | // When the controller is requesting an update for the shared memory |
| 33 | void OnUpdate(u8* data, std::size_t size) override; | 33 | void OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, std::size_t size) override; |
| 34 | 34 | ||
| 35 | // Called when input devices should be loaded | 35 | // Called when input devices should be loaded |
| 36 | void OnLoadInputDevices() override; | 36 | void OnLoadInputDevices() override; |
diff --git a/src/core/hle/service/hid/controllers/stubbed.cpp b/src/core/hle/service/hid/controllers/stubbed.cpp index cca4dca1d..946948f5e 100644 --- a/src/core/hle/service/hid/controllers/stubbed.cpp +++ b/src/core/hle/service/hid/controllers/stubbed.cpp | |||
| @@ -16,13 +16,14 @@ void Controller_Stubbed::OnInit() {} | |||
| 16 | 16 | ||
| 17 | void Controller_Stubbed::OnRelease() {} | 17 | void Controller_Stubbed::OnRelease() {} |
| 18 | 18 | ||
| 19 | void Controller_Stubbed::OnUpdate(u8* data, std::size_t size) { | 19 | void Controller_Stubbed::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, |
| 20 | std::size_t size) { | ||
| 20 | if (!smart_update) { | 21 | if (!smart_update) { |
| 21 | return; | 22 | return; |
| 22 | } | 23 | } |
| 23 | 24 | ||
| 24 | CommonHeader header{}; | 25 | CommonHeader header{}; |
| 25 | header.timestamp = Core::Timing::GetTicks(); | 26 | header.timestamp = core_timing.GetTicks(); |
| 26 | header.total_entry_count = 17; | 27 | header.total_entry_count = 17; |
| 27 | header.entry_count = 0; | 28 | header.entry_count = 0; |
| 28 | header.last_entry_index = 0; | 29 | header.last_entry_index = 0; |
diff --git a/src/core/hle/service/hid/controllers/stubbed.h b/src/core/hle/service/hid/controllers/stubbed.h index 4a21c643e..24469f03e 100644 --- a/src/core/hle/service/hid/controllers/stubbed.h +++ b/src/core/hle/service/hid/controllers/stubbed.h | |||
| @@ -20,7 +20,7 @@ public: | |||
| 20 | void OnRelease() override; | 20 | void OnRelease() override; |
| 21 | 21 | ||
| 22 | // When the controller is requesting an update for the shared memory | 22 | // When the controller is requesting an update for the shared memory |
| 23 | void OnUpdate(u8* data, std::size_t size) override; | 23 | void OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, std::size_t size) override; |
| 24 | 24 | ||
| 25 | // Called when input devices should be loaded | 25 | // Called when input devices should be loaded |
| 26 | void OnLoadInputDevices() override; | 26 | void OnLoadInputDevices() override; |
diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index a7c8acc72..1a8445a43 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.cpp +++ b/src/core/hle/service/hid/controllers/touchscreen.cpp | |||
| @@ -20,8 +20,9 @@ void Controller_Touchscreen::OnInit() {} | |||
| 20 | 20 | ||
| 21 | void Controller_Touchscreen::OnRelease() {} | 21 | void Controller_Touchscreen::OnRelease() {} |
| 22 | 22 | ||
| 23 | void Controller_Touchscreen::OnUpdate(u8* data, std::size_t size) { | 23 | void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, |
| 24 | shared_memory.header.timestamp = Core::Timing::GetTicks(); | 24 | std::size_t size) { |
| 25 | shared_memory.header.timestamp = core_timing.GetTicks(); | ||
| 25 | shared_memory.header.total_entry_count = 17; | 26 | shared_memory.header.total_entry_count = 17; |
| 26 | 27 | ||
| 27 | if (!IsControllerActivated()) { | 28 | if (!IsControllerActivated()) { |
| @@ -48,7 +49,7 @@ void Controller_Touchscreen::OnUpdate(u8* data, std::size_t size) { | |||
| 48 | touch_entry.diameter_x = Settings::values.touchscreen.diameter_x; | 49 | touch_entry.diameter_x = Settings::values.touchscreen.diameter_x; |
| 49 | touch_entry.diameter_y = Settings::values.touchscreen.diameter_y; | 50 | touch_entry.diameter_y = Settings::values.touchscreen.diameter_y; |
| 50 | touch_entry.rotation_angle = Settings::values.touchscreen.rotation_angle; | 51 | touch_entry.rotation_angle = Settings::values.touchscreen.rotation_angle; |
| 51 | const u64 tick = Core::Timing::GetTicks(); | 52 | const u64 tick = core_timing.GetTicks(); |
| 52 | touch_entry.delta_time = tick - last_touch; | 53 | touch_entry.delta_time = tick - last_touch; |
| 53 | last_touch = tick; | 54 | last_touch = tick; |
| 54 | touch_entry.finger = Settings::values.touchscreen.finger; | 55 | touch_entry.finger = Settings::values.touchscreen.finger; |
diff --git a/src/core/hle/service/hid/controllers/touchscreen.h b/src/core/hle/service/hid/controllers/touchscreen.h index 94cd0eba9..012b6e0dd 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.h +++ b/src/core/hle/service/hid/controllers/touchscreen.h | |||
| @@ -24,7 +24,7 @@ public: | |||
| 24 | void OnRelease() override; | 24 | void OnRelease() override; |
| 25 | 25 | ||
| 26 | // When the controller is requesting an update for the shared memory | 26 | // When the controller is requesting an update for the shared memory |
| 27 | void OnUpdate(u8* data, std::size_t size) override; | 27 | void OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, std::size_t size) override; |
| 28 | 28 | ||
| 29 | // Called when input devices should be loaded | 29 | // Called when input devices should be loaded |
| 30 | void OnLoadInputDevices() override; | 30 | void OnLoadInputDevices() override; |
diff --git a/src/core/hle/service/hid/controllers/xpad.cpp b/src/core/hle/service/hid/controllers/xpad.cpp index eff03d14e..1a9da9576 100644 --- a/src/core/hle/service/hid/controllers/xpad.cpp +++ b/src/core/hle/service/hid/controllers/xpad.cpp | |||
| @@ -17,9 +17,10 @@ void Controller_XPad::OnInit() {} | |||
| 17 | 17 | ||
| 18 | void Controller_XPad::OnRelease() {} | 18 | void Controller_XPad::OnRelease() {} |
| 19 | 19 | ||
| 20 | void Controller_XPad::OnUpdate(u8* data, std::size_t size) { | 20 | void Controller_XPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, |
| 21 | std::size_t size) { | ||
| 21 | for (auto& xpad_entry : shared_memory.shared_memory_entries) { | 22 | for (auto& xpad_entry : shared_memory.shared_memory_entries) { |
| 22 | xpad_entry.header.timestamp = Core::Timing::GetTicks(); | 23 | xpad_entry.header.timestamp = core_timing.GetTicks(); |
| 23 | xpad_entry.header.total_entry_count = 17; | 24 | xpad_entry.header.total_entry_count = 17; |
| 24 | 25 | ||
| 25 | if (!IsControllerActivated()) { | 26 | if (!IsControllerActivated()) { |
diff --git a/src/core/hle/service/hid/controllers/xpad.h b/src/core/hle/service/hid/controllers/xpad.h index ff836989f..2864e6617 100644 --- a/src/core/hle/service/hid/controllers/xpad.h +++ b/src/core/hle/service/hid/controllers/xpad.h | |||
| @@ -22,7 +22,7 @@ public: | |||
| 22 | void OnRelease() override; | 22 | void OnRelease() override; |
| 23 | 23 | ||
| 24 | // When the controller is requesting an update for the shared memory | 24 | // When the controller is requesting an update for the shared memory |
| 25 | void OnUpdate(u8* data, std::size_t size) override; | 25 | void OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, std::size_t size) override; |
| 26 | 26 | ||
| 27 | // Called when input devices should be loaded | 27 | // Called when input devices should be loaded |
| 28 | void OnLoadInputDevices() override; | 28 | void OnLoadInputDevices() override; |
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 79c320d04..8a6de83a2 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -73,13 +73,15 @@ IAppletResource::IAppletResource() : ServiceFramework("IAppletResource") { | |||
| 73 | GetController<Controller_Stubbed>(HidController::Unknown3).SetCommonHeaderOffset(0x5000); | 73 | GetController<Controller_Stubbed>(HidController::Unknown3).SetCommonHeaderOffset(0x5000); |
| 74 | 74 | ||
| 75 | // Register update callbacks | 75 | // Register update callbacks |
| 76 | pad_update_event = Core::Timing::RegisterEvent( | 76 | auto& core_timing = Core::System::GetInstance().CoreTiming(); |
| 77 | "HID::UpdatePadCallback", | 77 | pad_update_event = |
| 78 | [this](u64 userdata, int cycles_late) { UpdateControllers(userdata, cycles_late); }); | 78 | core_timing.RegisterEvent("HID::UpdatePadCallback", [this](u64 userdata, int cycles_late) { |
| 79 | UpdateControllers(userdata, cycles_late); | ||
| 80 | }); | ||
| 79 | 81 | ||
| 80 | // TODO(shinyquagsire23): Other update callbacks? (accel, gyro?) | 82 | // TODO(shinyquagsire23): Other update callbacks? (accel, gyro?) |
| 81 | 83 | ||
| 82 | Core::Timing::ScheduleEvent(pad_update_ticks, pad_update_event); | 84 | core_timing.ScheduleEvent(pad_update_ticks, pad_update_event); |
| 83 | 85 | ||
| 84 | ReloadInputDevices(); | 86 | ReloadInputDevices(); |
| 85 | } | 87 | } |
| @@ -93,7 +95,7 @@ void IAppletResource::DeactivateController(HidController controller) { | |||
| 93 | } | 95 | } |
| 94 | 96 | ||
| 95 | IAppletResource ::~IAppletResource() { | 97 | IAppletResource ::~IAppletResource() { |
| 96 | Core::Timing::UnscheduleEvent(pad_update_event, 0); | 98 | Core::System::GetInstance().CoreTiming().UnscheduleEvent(pad_update_event, 0); |
| 97 | } | 99 | } |
| 98 | 100 | ||
| 99 | void IAppletResource::GetSharedMemoryHandle(Kernel::HLERequestContext& ctx) { | 101 | void IAppletResource::GetSharedMemoryHandle(Kernel::HLERequestContext& ctx) { |
| @@ -105,15 +107,17 @@ void IAppletResource::GetSharedMemoryHandle(Kernel::HLERequestContext& ctx) { | |||
| 105 | } | 107 | } |
| 106 | 108 | ||
| 107 | void IAppletResource::UpdateControllers(u64 userdata, int cycles_late) { | 109 | void IAppletResource::UpdateControllers(u64 userdata, int cycles_late) { |
| 110 | auto& core_timing = Core::System::GetInstance().CoreTiming(); | ||
| 111 | |||
| 108 | const bool should_reload = Settings::values.is_device_reload_pending.exchange(false); | 112 | const bool should_reload = Settings::values.is_device_reload_pending.exchange(false); |
| 109 | for (const auto& controller : controllers) { | 113 | for (const auto& controller : controllers) { |
| 110 | if (should_reload) { | 114 | if (should_reload) { |
| 111 | controller->OnLoadInputDevices(); | 115 | controller->OnLoadInputDevices(); |
| 112 | } | 116 | } |
| 113 | controller->OnUpdate(shared_mem->GetPointer(), SHARED_MEMORY_SIZE); | 117 | controller->OnUpdate(core_timing, shared_mem->GetPointer(), SHARED_MEMORY_SIZE); |
| 114 | } | 118 | } |
| 115 | 119 | ||
| 116 | Core::Timing::ScheduleEvent(pad_update_ticks - cycles_late, pad_update_event); | 120 | core_timing.ScheduleEvent(pad_update_ticks - cycles_late, pad_update_event); |
| 117 | } | 121 | } |
| 118 | 122 | ||
| 119 | class IActiveVibrationDeviceList final : public ServiceFramework<IActiveVibrationDeviceList> { | 123 | class IActiveVibrationDeviceList final : public ServiceFramework<IActiveVibrationDeviceList> { |
diff --git a/src/core/hle/service/hid/irs.cpp b/src/core/hle/service/hid/irs.cpp index b427d4068..2c4625c99 100644 --- a/src/core/hle/service/hid/irs.cpp +++ b/src/core/hle/service/hid/irs.cpp | |||
| @@ -98,7 +98,7 @@ void IRS::GetImageTransferProcessorState(Kernel::HLERequestContext& ctx) { | |||
| 98 | 98 | ||
| 99 | IPC::ResponseBuilder rb{ctx, 5}; | 99 | IPC::ResponseBuilder rb{ctx, 5}; |
| 100 | rb.Push(RESULT_SUCCESS); | 100 | rb.Push(RESULT_SUCCESS); |
| 101 | rb.PushRaw<u64>(Core::Timing::GetTicks()); | 101 | rb.PushRaw<u64>(Core::System::GetInstance().CoreTiming().GetTicks()); |
| 102 | rb.PushRaw<u32>(0); | 102 | rb.PushRaw<u32>(0); |
| 103 | } | 103 | } |
| 104 | 104 | ||
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp index 88d80ba06..45812d238 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <cstring> | 5 | #include <cstring> |
| 6 | #include "common/assert.h" | 6 | #include "common/assert.h" |
| 7 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 8 | #include "core/core.h" | ||
| 8 | #include "core/core_timing.h" | 9 | #include "core/core_timing.h" |
| 9 | #include "core/core_timing_util.h" | 10 | #include "core/core_timing_util.h" |
| 10 | #include "core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h" | 11 | #include "core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h" |
| @@ -184,7 +185,7 @@ u32 nvhost_ctrl_gpu::GetGpuTime(const std::vector<u8>& input, std::vector<u8>& o | |||
| 184 | 185 | ||
| 185 | IoctlGetGpuTime params{}; | 186 | IoctlGetGpuTime params{}; |
| 186 | std::memcpy(¶ms, input.data(), input.size()); | 187 | std::memcpy(¶ms, input.data(), input.size()); |
| 187 | params.gpu_time = Core::Timing::cyclesToNs(Core::Timing::GetTicks()); | 188 | params.gpu_time = Core::Timing::cyclesToNs(Core::System::GetInstance().CoreTiming().GetTicks()); |
| 188 | std::memcpy(output.data(), ¶ms, output.size()); | 189 | std::memcpy(output.data(), ¶ms, output.size()); |
| 189 | return 0; | 190 | return 0; |
| 190 | } | 191 | } |
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index ce1b59860..3babc3f7c 100644 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp | |||
| @@ -27,19 +27,19 @@ namespace Service::NVFlinger { | |||
| 27 | constexpr std::size_t SCREEN_REFRESH_RATE = 60; | 27 | constexpr std::size_t SCREEN_REFRESH_RATE = 60; |
| 28 | constexpr u64 frame_ticks = static_cast<u64>(Core::Timing::BASE_CLOCK_RATE / SCREEN_REFRESH_RATE); | 28 | constexpr u64 frame_ticks = static_cast<u64>(Core::Timing::BASE_CLOCK_RATE / SCREEN_REFRESH_RATE); |
| 29 | 29 | ||
| 30 | NVFlinger::NVFlinger() { | 30 | NVFlinger::NVFlinger(Core::Timing::CoreTiming& core_timing) : core_timing{core_timing} { |
| 31 | // Schedule the screen composition events | 31 | // Schedule the screen composition events |
| 32 | composition_event = | 32 | composition_event = |
| 33 | Core::Timing::RegisterEvent("ScreenComposition", [this](u64 userdata, int cycles_late) { | 33 | core_timing.RegisterEvent("ScreenComposition", [this](u64 userdata, int cycles_late) { |
| 34 | Compose(); | 34 | Compose(); |
| 35 | Core::Timing::ScheduleEvent(frame_ticks - cycles_late, composition_event); | 35 | this->core_timing.ScheduleEvent(frame_ticks - cycles_late, composition_event); |
| 36 | }); | 36 | }); |
| 37 | 37 | ||
| 38 | Core::Timing::ScheduleEvent(frame_ticks, composition_event); | 38 | core_timing.ScheduleEvent(frame_ticks, composition_event); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | NVFlinger::~NVFlinger() { | 41 | NVFlinger::~NVFlinger() { |
| 42 | Core::Timing::UnscheduleEvent(composition_event, 0); | 42 | core_timing.UnscheduleEvent(composition_event, 0); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | void NVFlinger::SetNVDrvInstance(std::shared_ptr<Nvidia::Module> instance) { | 45 | 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 6d8bcbd30..437aa592d 100644 --- a/src/core/hle/service/nvflinger/nvflinger.h +++ b/src/core/hle/service/nvflinger/nvflinger.h | |||
| @@ -15,8 +15,9 @@ | |||
| 15 | #include "core/hle/kernel/object.h" | 15 | #include "core/hle/kernel/object.h" |
| 16 | 16 | ||
| 17 | namespace Core::Timing { | 17 | namespace Core::Timing { |
| 18 | class CoreTiming; | ||
| 18 | struct EventType; | 19 | struct EventType; |
| 19 | } | 20 | } // namespace Core::Timing |
| 20 | 21 | ||
| 21 | namespace Kernel { | 22 | namespace Kernel { |
| 22 | class ReadableEvent; | 23 | class ReadableEvent; |
| @@ -52,7 +53,7 @@ struct Display { | |||
| 52 | 53 | ||
| 53 | class NVFlinger final { | 54 | class NVFlinger final { |
| 54 | public: | 55 | public: |
| 55 | NVFlinger(); | 56 | explicit NVFlinger(Core::Timing::CoreTiming& core_timing); |
| 56 | ~NVFlinger(); | 57 | ~NVFlinger(); |
| 57 | 58 | ||
| 58 | /// Sets the NVDrv module instance to use to send buffers to the GPU. | 59 | /// Sets the NVDrv module instance to use to send buffers to the GPU. |
| @@ -117,6 +118,9 @@ private: | |||
| 117 | 118 | ||
| 118 | /// Event that handles screen composition. | 119 | /// Event that handles screen composition. |
| 119 | Core::Timing::EventType* composition_event; | 120 | Core::Timing::EventType* composition_event; |
| 121 | |||
| 122 | /// Core timing instance for registering/unregistering the composition event. | ||
| 123 | Core::Timing::CoreTiming& core_timing; | ||
| 120 | }; | 124 | }; |
| 121 | 125 | ||
| 122 | } // namespace Service::NVFlinger | 126 | } // namespace Service::NVFlinger |
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index d25b80ab0..117f87a45 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -194,10 +194,11 @@ ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::HLERequestContext& co | |||
| 194 | // Module interface | 194 | // Module interface |
| 195 | 195 | ||
| 196 | /// Initialize ServiceManager | 196 | /// Initialize ServiceManager |
| 197 | void Init(std::shared_ptr<SM::ServiceManager>& sm, FileSys::VfsFilesystem& vfs) { | 197 | void Init(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system, |
| 198 | FileSys::VfsFilesystem& vfs) { | ||
| 198 | // NVFlinger needs to be accessed by several services like Vi and AppletOE so we instantiate it | 199 | // NVFlinger needs to be accessed by several services like Vi and AppletOE so we instantiate it |
| 199 | // here and pass it into the respective InstallInterfaces functions. | 200 | // here and pass it into the respective InstallInterfaces functions. |
| 200 | auto nv_flinger = std::make_shared<NVFlinger::NVFlinger>(); | 201 | auto nv_flinger = std::make_shared<NVFlinger::NVFlinger>(system.CoreTiming()); |
| 201 | 202 | ||
| 202 | SM::ServiceManager::InstallInterfaces(sm); | 203 | SM::ServiceManager::InstallInterfaces(sm); |
| 203 | 204 | ||
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 029533628..830790269 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h | |||
| @@ -14,6 +14,14 @@ | |||
| 14 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 14 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 15 | // Namespace Service | 15 | // Namespace Service |
| 16 | 16 | ||
| 17 | namespace Core { | ||
| 18 | class System; | ||
| 19 | } | ||
| 20 | |||
| 21 | namespace FileSys { | ||
| 22 | class VfsFilesystem; | ||
| 23 | } | ||
| 24 | |||
| 17 | namespace Kernel { | 25 | namespace Kernel { |
| 18 | class ClientPort; | 26 | class ClientPort; |
| 19 | class ServerPort; | 27 | class ServerPort; |
| @@ -21,10 +29,6 @@ class ServerSession; | |||
| 21 | class HLERequestContext; | 29 | class HLERequestContext; |
| 22 | } // namespace Kernel | 30 | } // namespace Kernel |
| 23 | 31 | ||
| 24 | namespace FileSys { | ||
| 25 | class VfsFilesystem; | ||
| 26 | } | ||
| 27 | |||
| 28 | namespace Service { | 32 | namespace Service { |
| 29 | 33 | ||
| 30 | namespace SM { | 34 | namespace SM { |
| @@ -178,7 +182,8 @@ private: | |||
| 178 | }; | 182 | }; |
| 179 | 183 | ||
| 180 | /// Initialize ServiceManager | 184 | /// Initialize ServiceManager |
| 181 | void Init(std::shared_ptr<SM::ServiceManager>& sm, FileSys::VfsFilesystem& vfs); | 185 | void Init(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system, |
| 186 | FileSys::VfsFilesystem& vfs); | ||
| 182 | 187 | ||
| 183 | /// Shutdown ServiceManager | 188 | /// Shutdown ServiceManager |
| 184 | void Shutdown(); | 189 | void Shutdown(); |
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp index efebd1b24..aa115935d 100644 --- a/src/core/hle/service/time/time.cpp +++ b/src/core/hle/service/time/time.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <chrono> | 5 | #include <chrono> |
| 6 | #include <ctime> | 6 | #include <ctime> |
| 7 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 8 | #include "core/core.h" | ||
| 8 | #include "core/core_timing.h" | 9 | #include "core/core_timing.h" |
| 9 | #include "core/core_timing_util.h" | 10 | #include "core/core_timing_util.h" |
| 10 | #include "core/hle/ipc_helpers.h" | 11 | #include "core/hle/ipc_helpers.h" |
| @@ -106,8 +107,9 @@ private: | |||
| 106 | void GetCurrentTimePoint(Kernel::HLERequestContext& ctx) { | 107 | void GetCurrentTimePoint(Kernel::HLERequestContext& ctx) { |
| 107 | LOG_DEBUG(Service_Time, "called"); | 108 | LOG_DEBUG(Service_Time, "called"); |
| 108 | 109 | ||
| 110 | const auto& core_timing = Core::System::GetInstance().CoreTiming(); | ||
| 109 | const SteadyClockTimePoint steady_clock_time_point{ | 111 | const SteadyClockTimePoint steady_clock_time_point{ |
| 110 | Core::Timing::cyclesToMs(Core::Timing::GetTicks()) / 1000}; | 112 | Core::Timing::cyclesToMs(core_timing.GetTicks()) / 1000}; |
| 111 | IPC::ResponseBuilder rb{ctx, (sizeof(SteadyClockTimePoint) / 4) + 2}; | 113 | IPC::ResponseBuilder rb{ctx, (sizeof(SteadyClockTimePoint) / 4) + 2}; |
| 112 | rb.Push(RESULT_SUCCESS); | 114 | rb.Push(RESULT_SUCCESS); |
| 113 | rb.PushRaw(steady_clock_time_point); | 115 | rb.PushRaw(steady_clock_time_point); |
| @@ -281,8 +283,9 @@ void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) { | |||
| 281 | return; | 283 | return; |
| 282 | } | 284 | } |
| 283 | 285 | ||
| 286 | const auto& core_timing = Core::System::GetInstance().CoreTiming(); | ||
| 284 | const SteadyClockTimePoint steady_clock_time_point{ | 287 | const SteadyClockTimePoint steady_clock_time_point{ |
| 285 | Core::Timing::cyclesToMs(Core::Timing::GetTicks()) / 1000, {}}; | 288 | Core::Timing::cyclesToMs(core_timing.GetTicks()) / 1000, {}}; |
| 286 | 289 | ||
| 287 | CalendarTime calendar_time{}; | 290 | CalendarTime calendar_time{}; |
| 288 | calendar_time.year = tm->tm_year + 1900; | 291 | calendar_time.year = tm->tm_year + 1900; |