resonance 1.0.1
Loading...
Searching...
No Matches
Rnd::Dbg Class Reference

Sink that the engine formats its diagnostic and failure text into. More...

#include <dbg.h>

Public Member Functions

 Dbg ()
 Install the built-in report handler with no log open and a dump level of zero.
 ~Dbg ()
 Delete the log stream, without flushing it first.
void OpenLog (const HxStr &path)
 Replace the log with a file opened for writing.
void CloseLog ()
 Flush and delete the log stream, if one is open.
void SetNotify (FailReportProc pfnReport)
 Install the handler that receives formatted failure text.
void Notify (const char *pszFormat,...)
 Format a failure message and pass it to the installed report handler.
Dbg * Format (const char *pszFormat,...)
 Format text into the secondary buffer without dispatching it.
Dbg * Print (const char *pszText)
 Write literal text.

Public Attributes

FailAbortProc mAbortProc
 Handler that finishes a failure report.
int mDumpLevel
 Detail level a dump routine tests before writing its optional sections.

Detailed Description

Sink that the engine formats its diagnostic and failure text into.

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 Notify() and SetNotify() have the same instructions as this class's Notify() and SetNotify().

Only Notify() reaches the outside world in the shipped build. Print() returns without doing anything, and Format() writes into a static buffer that nothing then reads. The roughly four hundred call sites of each are the object dump routines across the whole engine, every DumpText among them, so a reconstructed DumpText produces no output on this target. The string literals it passes survive in .rodata regardless, which is where many recovered member names come from. Reconstruct those calls as written rather than omitting them.

The sink can also own a log file, opened by OpenLog(). No routine in the shipped image calls OpenLog(), and neither Notify() nor Format() writes to the log.

Constructor & Destructor Documentation

◆ Dbg()

Rnd::Dbg::Dbg ( )

Install the built-in report handler with no log open and a dump level of zero.

mInitializedFlag starts at 1, and mAbortProc is not written. The body is inlined into the unit's static initialiser at 0x004ddef8.

◆ ~Dbg()

Rnd::Dbg::~Dbg ( )

Delete the log stream, without flushing it first.

The body is inlined into the static initialiser at 0x004ddef8.

Member Function Documentation

◆ OpenLog()

void Rnd::Dbg::OpenLog ( const HxStr & path)

Replace the log with a file opened for writing.

The previous log is closed first. A file that fails to open is reported as "Couldn't open log %s" and leaves no log open. No call site survives in the shipped program, and the name is inferred from the report text.

Parameters
pathThe file to write the log to.
Ghidra address:
NTSC-U/C: 0x004ddfb8
Ghidra address:
PAL: 0x0051c570

◆ CloseLog()

void Rnd::Dbg::CloseLog ( )

Flush and delete the log stream, if one is open.

OpenLog() is the one caller. The name is inferred.

Ghidra address:
NTSC-U/C: 0x004de0a0
Ghidra address:
PAL: 0x0051c658

◆ SetNotify()

void Rnd::Dbg::SetNotify ( FailReportProc pfnReport)

Install the handler that receives formatted failure text.

A null handler restores the built-in handler at 0x004ddf68.

Parameters
pfnReportThe handler to install, or null for the built-in handler.
Ghidra address:
NTSC-U/C: 0x004ddf90
Ghidra address:
PAL: 0x0051c548

◆ Notify()

void Rnd::Dbg::Notify ( const char * pszFormat,
... )

Format a failure message and pass it to the installed report handler.

This is the only member that produces output.

Parameters
pszFormatA printf-style format string.
Ghidra address:
NTSC-U/C: 0x004dde28
Ghidra address:
PAL: 0x0051c3e0

◆ Format()

Dbg * Rnd::Dbg::Format ( const char * pszFormat,
... )

Format text into the secondary buffer without dispatching it.

Parameters
pszFormatA printf-style format string.
Returns
This sink, allowing calls to be chained.
Ghidra address:
NTSC-U/C: 0x004dde98
Ghidra address:
PAL: 0x0051c450

◆ Print()

Dbg * Rnd::Dbg::Print ( const char * pszText)

Write literal text.

The body is two instructions that return the sink, so the text is discarded.

Parameters
pszTextThe text to write.
Returns
This sink, allowing calls to be chained.
Ghidra address:
NTSC-U/C: 0x004ddfb0
Ghidra address:
PAL: 0x0051c568

Member Data Documentation

◆ mAbortProc

FailAbortProc Rnd::Dbg::mAbortProc

Handler that finishes a failure report.

Public because main assigns it directly and the image has no accessor for it, unlike the report handler.

+0x00

◆ mDumpLevel

int Rnd::Dbg::mDumpLevel

Detail level a dump routine tests before writing its optional sections.

Public because Rnd::Object::DumpText reads it directly from a sink it does not own, at 0x0053e6d4, and the image exposes no accessor. A positive value adds the referrer list.

+0x0c


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