CoreTiming: wrap into class
This commit is contained in:
parent
7c3d325aff
commit
9458e4d8ec
34 changed files with 413 additions and 413 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "common/alignment.h"
|
||||
#include "common/string_util.h"
|
||||
#include "core/core.h"
|
||||
#include "core/core_timing.h"
|
||||
#include "core/hle/service/ir/extra_hid.h"
|
||||
#include "core/movie.h"
|
||||
|
@ -144,11 +145,11 @@ ExtraHID::ExtraHID(SendFunc send_func) : IRDevice(send_func) {
|
|||
0x65,
|
||||
}};
|
||||
|
||||
hid_polling_callback_id =
|
||||
CoreTiming::RegisterEvent("ExtraHID::SendHIDStatus", [this](u64, s64 cycles_late) {
|
||||
hid_polling_callback_id = Core::System::GetInstance().CoreTiming().RegisterEvent(
|
||||
"ExtraHID::SendHIDStatus", [this](u64, s64 cycles_late) {
|
||||
SendHIDStatus();
|
||||
CoreTiming::ScheduleEvent(msToCycles(hid_period) - cycles_late,
|
||||
hid_polling_callback_id);
|
||||
Core::System::GetInstance().CoreTiming().ScheduleEvent(
|
||||
msToCycles(hid_period) - cycles_late, hid_polling_callback_id);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -159,7 +160,7 @@ ExtraHID::~ExtraHID() {
|
|||
void ExtraHID::OnConnect() {}
|
||||
|
||||
void ExtraHID::OnDisconnect() {
|
||||
CoreTiming::UnscheduleEvent(hid_polling_callback_id, 0);
|
||||
Core::System::GetInstance().CoreTiming().UnscheduleEvent(hid_polling_callback_id, 0);
|
||||
}
|
||||
|
||||
void ExtraHID::HandleConfigureHIDPollingRequest(const std::vector<u8>& request) {
|
||||
|
@ -170,9 +171,10 @@ void ExtraHID::HandleConfigureHIDPollingRequest(const std::vector<u8>& request)
|
|||
}
|
||||
|
||||
// Change HID input polling interval
|
||||
CoreTiming::UnscheduleEvent(hid_polling_callback_id, 0);
|
||||
Core::System::GetInstance().CoreTiming().UnscheduleEvent(hid_polling_callback_id, 0);
|
||||
hid_period = request[1];
|
||||
CoreTiming::ScheduleEvent(msToCycles(hid_period), hid_polling_callback_id);
|
||||
Core::System::GetInstance().CoreTiming().ScheduleEvent(msToCycles(hid_period),
|
||||
hid_polling_callback_id);
|
||||
}
|
||||
|
||||
void ExtraHID::HandleReadCalibrationDataRequest(const std::vector<u8>& request_buf) {
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
#include "core/frontend/input.h"
|
||||
#include "core/hle/service/ir/ir_user.h"
|
||||
|
||||
namespace CoreTiming {
|
||||
struct EventType;
|
||||
} // namespace CoreTiming
|
||||
namespace Core {
|
||||
struct TimingEventType;
|
||||
} // namespace Core
|
||||
|
||||
namespace Service::IR {
|
||||
|
||||
|
@ -57,7 +57,7 @@ private:
|
|||
void LoadInputDevices();
|
||||
|
||||
u8 hid_period;
|
||||
CoreTiming::EventType* hid_polling_callback_id;
|
||||
Core::TimingEventType* hid_polling_callback_id;
|
||||
std::array<u8, 0x40> calibration_data;
|
||||
std::unique_ptr<Input::ButtonDevice> zl;
|
||||
std::unique_ptr<Input::ButtonDevice> zr;
|
||||
|
|
|
@ -100,13 +100,13 @@ void IR_RST::UpdateCallback(u64 userdata, s64 cycles_late) {
|
|||
// If we just updated index 0, provide a new timestamp
|
||||
if (mem->index == 0) {
|
||||
mem->index_reset_ticks_previous = mem->index_reset_ticks;
|
||||
mem->index_reset_ticks = CoreTiming::GetTicks();
|
||||
mem->index_reset_ticks = system.CoreTiming().GetTicks();
|
||||
}
|
||||
|
||||
update_event->Signal();
|
||||
|
||||
// Reschedule recurrent event
|
||||
CoreTiming::ScheduleEvent(msToCycles(update_period) - cycles_late, update_callback_id);
|
||||
system.CoreTiming().ScheduleEvent(msToCycles(update_period) - cycles_late, update_callback_id);
|
||||
}
|
||||
|
||||
void IR_RST::GetHandles(Kernel::HLERequestContext& ctx) {
|
||||
|
@ -126,7 +126,7 @@ void IR_RST::Initialize(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
next_pad_index = 0;
|
||||
is_device_reload_pending.store(true);
|
||||
CoreTiming::ScheduleEvent(msToCycles(update_period), update_callback_id);
|
||||
system.CoreTiming().ScheduleEvent(msToCycles(update_period), update_callback_id);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
|
@ -137,7 +137,7 @@ void IR_RST::Initialize(Kernel::HLERequestContext& ctx) {
|
|||
void IR_RST::Shutdown(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx, 0x03, 0, 0);
|
||||
|
||||
CoreTiming::UnscheduleEvent(update_callback_id, 0);
|
||||
system.CoreTiming().UnscheduleEvent(update_callback_id, 0);
|
||||
UnloadInputDevices();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
|
@ -145,7 +145,7 @@ void IR_RST::Shutdown(Kernel::HLERequestContext& ctx) {
|
|||
LOG_DEBUG(Service_IR, "called");
|
||||
}
|
||||
|
||||
IR_RST::IR_RST(Core::System& system) : ServiceFramework("ir:rst", 1) {
|
||||
IR_RST::IR_RST(Core::System& system) : ServiceFramework("ir:rst", 1), system(system) {
|
||||
using namespace Kernel;
|
||||
// Note: these two kernel objects are even available before Initialize service function is
|
||||
// called.
|
||||
|
@ -154,10 +154,9 @@ IR_RST::IR_RST(Core::System& system) : ServiceFramework("ir:rst", 1) {
|
|||
MemoryRegion::BASE, "IRRST:SharedMemory");
|
||||
update_event = system.Kernel().CreateEvent(ResetType::OneShot, "IRRST:UpdateEvent");
|
||||
|
||||
update_callback_id =
|
||||
CoreTiming::RegisterEvent("IRRST:UpdateCallBack", [this](u64 userdata, s64 cycles_late) {
|
||||
UpdateCallback(userdata, cycles_late);
|
||||
});
|
||||
update_callback_id = system.CoreTiming().RegisterEvent(
|
||||
"IRRST:UpdateCallBack",
|
||||
[this](u64 userdata, s64 cycles_late) { UpdateCallback(userdata, cycles_late); });
|
||||
|
||||
static const FunctionInfo functions[] = {
|
||||
{0x00010000, &IR_RST::GetHandles, "GetHandles"},
|
||||
|
|
|
@ -18,8 +18,8 @@ class Event;
|
|||
class SharedMemory;
|
||||
} // namespace Kernel
|
||||
|
||||
namespace CoreTiming {
|
||||
struct EventType;
|
||||
namespace Core {
|
||||
struct TimingEventType;
|
||||
};
|
||||
|
||||
namespace Service::IR {
|
||||
|
@ -77,10 +77,11 @@ private:
|
|||
void UnloadInputDevices();
|
||||
void UpdateCallback(u64 userdata, s64 cycles_late);
|
||||
|
||||
Core::System& system;
|
||||
Kernel::SharedPtr<Kernel::Event> update_event;
|
||||
Kernel::SharedPtr<Kernel::SharedMemory> shared_memory;
|
||||
u32 next_pad_index{0};
|
||||
CoreTiming::EventType* update_callback_id;
|
||||
Core::TimingEventType* update_callback_id;
|
||||
std::unique_ptr<Input::ButtonDevice> zl_button;
|
||||
std::unique_ptr<Input::ButtonDevice> zr_button;
|
||||
std::unique_ptr<Input::AnalogDevice> c_stick;
|
||||
|
|
|
@ -14,10 +14,6 @@ class Event;
|
|||
class SharedMemory;
|
||||
} // namespace Kernel
|
||||
|
||||
namespace CoreTiming {
|
||||
struct EventType;
|
||||
};
|
||||
|
||||
namespace Service::IR {
|
||||
|
||||
class BufferManager;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue