mirror of
https://github.com/sal063/AC6_recomp
synced 2026-07-05 05:40:02 -04:00
51 lines
1.2 KiB
C++
51 lines
1.2 KiB
C++
#pragma once
|
|
/**
|
|
* ReXGlue runtime - AC6 Recompilation project
|
|
* Copyright (c) 2026 Tom Clay. All rights reserved.
|
|
*/
|
|
|
|
#include <rex/system/xobject.h>
|
|
#include <rex/system/xtypes.h>
|
|
#include <rex/thread.h>
|
|
|
|
namespace rex::system {
|
|
|
|
struct XDPC;
|
|
|
|
struct X_KTIMER {
|
|
X_DISPATCH_HEADER header; // 0x0
|
|
rex::be<uint64_t> due_time; // 0x10
|
|
X_LIST_ENTRY table_bucket_entry; // 0x18
|
|
TypedGuestPointer<XDPC> dpc; // 0x20
|
|
rex::be<uint32_t> period; // 0x24
|
|
};
|
|
static_assert_size(X_KTIMER, 0x28);
|
|
|
|
class XThread;
|
|
|
|
class XTimer : public XObject {
|
|
public:
|
|
static const XObject::Type kObjectType = XObject::Type::Timer;
|
|
|
|
explicit XTimer(KernelState* kernel_state);
|
|
~XTimer() override;
|
|
|
|
void Initialize(uint32_t timer_type);
|
|
|
|
X_STATUS SetTimer(int64_t due_time, uint32_t period_ms, uint32_t routine, uint32_t routine_arg,
|
|
bool resume);
|
|
X_STATUS Cancel();
|
|
|
|
protected:
|
|
rex::thread::WaitHandle* GetWaitHandle() override { return timer_.get(); }
|
|
|
|
private:
|
|
std::unique_ptr<rex::thread::Timer> timer_;
|
|
|
|
XThread* callback_thread_ = nullptr;
|
|
uint32_t callback_routine_ = 0;
|
|
uint32_t callback_routine_arg_ = 0;
|
|
};
|
|
|
|
} // namespace rex::system
|