[Xam/Info] - Implement GetSystemTimeAsFileTime & QueryPerformanceFrequency

- Implement QueryPerformanceFrequency, GetSystemTimeAsFileTime
- Used in Aurora and dash launch
This commit is contained in:
The-Little-Wolf
2026-03-20 14:49:03 -07:00
committed by Radosław Gliński
parent 7928966bab
commit c4f4412df9

View File

@@ -7,6 +7,7 @@
******************************************************************************
*/
#include "xenia/base/clock.h"
#include "xenia/base/cvar.h"
#include "xenia/base/logging.h"
#include "xenia/base/string_util.h"
@@ -808,6 +809,32 @@ DECLARE_XAM_EXPORT1(XamDoesOmniNeedConfiguration, kNone, kStub);
dword_result_t XamFirstRunExperienceShouldRun_entry() { return 0; }
DECLARE_XAM_EXPORT1(XamFirstRunExperienceShouldRun, kNone, kStub);
dword_result_t QueryPerformanceFrequency_entry(lpqword_t query) {
// Copied from KeQueryPerformanceFrequency
uint64_t result = Clock::guest_tick_frequency();
*query = static_cast<uint32_t>(result);
return 1;
}
DECLARE_XAM_EXPORT1(QueryPerformanceFrequency, kNone, kImplemented);
void GetSystemTimeAsFileTime_entry(lpqword_t time_ptr,
const ppc_context_t& ctx) {
if (time_ptr) {
// Copied from KeQuerySystemTime
// update the timestamp bundle to the time we queried.
// this is a race, but i don't of any sw that requires it, it just seems
// like we ought to keep it consistent with ketimestampbundle in case
// something uses this function, but also reads it directly
uint32_t ts_bundle = ctx->kernel_state->GetKeTimestampBundle();
uint64_t time = Clock::QueryGuestSystemTime();
// todo: cmpxchg?
ctx->TranslateVirtual<X_TIME_STAMP_BUNDLE*>(ts_bundle)->system_time =
xe::byte_swap(time);
*time_ptr = time;
}
}
DECLARE_XAM_EXPORT1(GetSystemTimeAsFileTime, kNone, kImplemented);
} // namespace xam
} // namespace kernel
} // namespace xe