resonance 1.0.1
Loading...
Searching...
No Matches
Sch::SystemTime Class Reference

Clock the scheduler reads its due times from, in nanoseconds. More...

#include <systemtime.h>

Public Member Functions

 SystemTime ()
long long Now ()
 Read the clock.
void Mark (long long nNanoseconds)
 Record a reference reading for the next comparison.
void Pause ()
 Stop the clock, remembering how far it had run.
void Resume ()
 Restart a stopped clock from where it stopped.
void Advance (int nAmount)
 Stop the clock and move its paused running time forward.

Public Attributes

long long mOriginMs
 The millisecond reading the current run started at.

Detailed Description

Clock the scheduler reads its due times from, in nanoseconds.

The class is not polymorphic and has no RTTI. Its name comes from the debugging symbols of the North American demo release. The demo's Pause() and Resume() have the same instructions as this class's Pause() and Resume(). Only the member this reconstruction reads is recovered; the rest of the 0x28-byte layout is recorded as unknown words to preserve the offsets.

The clock's own reading is in milliseconds and Now() returns nanoseconds. The scale is not a mystery constant: it is the double at 0x008263f8 divided by the 1000 that 0x00466360 returns, which is one million nanoseconds to the millisecond.

mOriginMs is public because MainLoop::Poll() reads it directly and the image has no accessor for it. It sits amid unrecovered words, so the members below are grouped by access rather than by offset, and each trailing comment records the real offset.

Constructor & Destructor Documentation

◆ SystemTime()

Sch::SystemTime::SystemTime ( )
Ghidra address:
NTSC-U/C: 0x00512498
Ghidra address:
PAL: 0x00552780

Member Function Documentation

◆ Now()

long long Sch::SystemTime::Now ( )

Read the clock.

Returns
The current reading in nanoseconds.
Ghidra address:
NTSC-U/C: 0x005125e0
Ghidra address:
PAL: 0x005528c8

◆ Mark()

void Sch::SystemTime::Mark ( long long nNanoseconds)

Record a reference reading for the next comparison.

Parameters
nNanosecondsThe reading to record.
Ghidra address:
NTSC-U/C: 0x00512538
Ghidra address:
PAL: 0x00552820

◆ Pause()

void Sch::SystemTime::Pause ( )

Stop the clock, remembering how far it had run.

Does nothing while the clock is already stopped. GameManagerImpl's pause handler is the caller. The title is inferred.

Ghidra address:
NTSC-U/C: 0x00512680
Ghidra address:
PAL: 0x00552968

◆ Resume()

void Sch::SystemTime::Resume ( )

Restart a stopped clock from where it stopped.

Moves mStartMs so that the elapsed time excludes the pause. Does nothing while the clock is running. GameManagerImpl's unpause handler is the caller. The title is inferred.

Ghidra address:
NTSC-U/C: 0x00512700
Ghidra address:
PAL: 0x005529e8

◆ Advance()

void Sch::SystemTime::Advance ( int nAmount)

Stop the clock and move its paused running time forward.

Pause() is inlined first. The running time then grows by nAmount times one million divided by mNsPerUnit. HxScript::Clock() is the caller. The title is inferred.

Parameters
nAmountThe amount to advance by.
Ghidra address:
NTSC-U/C: 0x00512788
Ghidra address:
PAL: 0x00552a70

Member Data Documentation

◆ mOriginMs

long long Sch::SystemTime::mOriginMs

The millisecond reading the current run started at.

+0x10


The documentation for this class was generated from the following file: