#pragma once /** ****************************************************************************** * Xenia : Xbox 360 Emulator Research Project * ****************************************************************************** * Copyright 2013 Ben Vanik. All rights reserved. * * Released under the BSD license - see LICENSE in the root for more details. * ****************************************************************************** * * @modified Tom Clay, 2026 - Adapted for ReXGlue runtime */ #include #include #include namespace rex::system { struct XDPC; struct X_KTIMER { X_DISPATCH_HEADER header; // 0x0 rex::be due_time; // 0x10 X_LIST_ENTRY table_bucket_entry; // 0x18 TypedGuestPointer dpc; // 0x20 rex::be 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 timer_; XThread* callback_thread_ = nullptr; uint32_t callback_routine_ = 0; uint32_t callback_routine_arg_ = 0; }; } // namespace rex::system