resonance 1.0.1
Loading...
Searching...
No Matches
Timer Class Reference

The EE cycle clock the engine times itself against. More...

#include <timer.h>

Static Public Member Functions

static void Init ()
 Start the clock from the current counter reading.

Static Public Attributes

static float sClock2Ms
 Milliseconds per EE cycle, the reciprocal of kCyclesPerMillisecond.
static int sElapsedMs
 Word Init() clears beside the cycle state.
static long long sElapsedCycles
 Cycles accumulated across every read.
static unsigned sElapsedTimer
 The counter reading the last call took.
static unsigned sLastCycleDelta
 The difference the last call added to the total.

Detailed Description

The EE cycle clock the engine times itself against.

Every member is static, and the class emits no RTTI. Its name comes from the debugging symbols of the North American demo release. GetElapsedMilliseconds() accumulates into the members, and around thirty routines across the engine inline GetElapsedMilliseconds().

Member Function Documentation

◆ Init()

void Timer::Init ( )
static

Start the clock from the current counter reading.

The total and the last difference become zero and the last reading becomes the counter. The counter is read twice and the first reading is discarded. The static initialiser at 0x004662d0, in the unit that defines the out-of-line GetElapsedMilliseconds(), is the one caller.

Ghidra address:
NTSC-U/C: 0x004fefb0
Ghidra address:
PAL: 0x0053dd60

Member Data Documentation

◆ sClock2Ms

float Timer::sClock2Ms
static

Milliseconds per EE cycle, the reciprocal of kCyclesPerMillisecond.

Init() writes it and no routine in the image reads it.

Ghidra address:
NTSC-U/C: 0x007082b4
Ghidra address:
PAL: 0x0074bde4

◆ sElapsedMs

int Timer::sElapsedMs
static

Word Init() clears beside the cycle state.

No routine in the image reads it.

Ghidra address:
NTSC-U/C: 0x007082b8
Ghidra address:
PAL: 0x0074bde8

◆ sElapsedCycles

long long Timer::sElapsedCycles
static

Cycles accumulated across every read.

Accumulating differences rather than counter readings makes the total correct across a wrap of the 32-bit counter.

Ghidra address:
NTSC-U/C: 0x007082c0
Ghidra address:
PAL: 0x0074bdf0

◆ sElapsedTimer

unsigned Timer::sElapsedTimer
static

The counter reading the last call took.

Ghidra address:
NTSC-U/C: 0x007082c8
Ghidra address:
PAL: 0x0074bdf8

◆ sLastCycleDelta

unsigned Timer::sLastCycleDelta
static

The difference the last call added to the total.

The word follows sElapsedTimer, and Init() addresses it through that member's base. Every caller writes this word and none reads it.

Ghidra address:
NTSC-U/C: 0x007082cc
Ghidra address:
PAL: 0x0074bdfc

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