resonance 1.0.1
Loading...
Searching...
No Matches
assert.h File Reference

Go to the source code of this file.

Macros

#define HX_ASSERT(expression)

Functions

void HxAssertFailed (const char *pszFile, int nLine, const char *pszExpression)
 Report a failed check and stop the machine.

Macro Definition Documentation

◆ HX_ASSERT

#define HX_ASSERT ( expression)
Value:
if (!(expression)) { \
HxAssertFailed(__FILE__, __LINE__, #expression); \
}

Function Documentation

◆ HxAssertFailed()

void HxAssertFailed ( const char * pszFile,
int nLine,
const char * pszExpression )

Report a failed check and stop the machine.

The routine behaves as newlib's own __assert, toolchain C library linked as shipped. Its report goes to stderr, taken from the reentrancy structure at 0x007819cc, through the format assertion "s" failed: file "s", line d, which is that library's text verbatim. It then tail-calls abort, which raises signal 6, calls exit, and spins forever. This declaration exists because the game calls it.

The identification is strong rather than verified. The format string, the argument order, and the three-parameter signature were matched against newlib from knowledge of that library and not against a copy of its source. HX_ASSERT below therefore wraps the standard assert rather than any routine of the game's own.

Every call site in the binary falls through into the code the check was protecting. That is because the declaration the game compiled against did not mark the routine as never returning, and not because the routine returns. It does not return.

Parameters
pszFileThe reporting file, from __FILE__.
nLineThe reporting line, from __LINE__.
pszExpressionThe source text of the failed expression.
Ghidra address:
NTSC-U/C: 0x0055c548
Ghidra address:
PAL: 0x0059d768