resonance 1.0.1
Loading...
Searching...
No Matches
configquery.h File Reference
#include <vector>
#include "os/hxstr.h"
Include dependency graph for configquery.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int QueryConfigFlag (int nEventCode,...)
 Read one configuration value as a flag through the embedded interpreter.
int QueryConfigValue (int nEventCode,...)
 Read one configuration value as an integer through the embedded interpreter.
HxStr QueryConfigString (int nEventCode,...)
 Read one configuration value as a string through the embedded interpreter.
void QueryConfigVector (std::vector< int > *pResult, int nEventCode,...)
 Fill a vector of integers from one configuration value through the embedded interpreter.
void QueryConfigStrings (std::vector< HxStr > *pResult, int nEventCode,...)
 Fill a vector of strings from one configuration value through the embedded interpreter.

Function Documentation

◆ QueryConfigFlag()

int QueryConfigFlag ( int nEventCode,
... )

Read one configuration value as a flag through the embedded interpreter.

Every query here works the same way. The code selects a registered script call template through Resid2Str(), the trailing arguments are formatted into it by FmtImp(), and the text is evaluated as a Python expression through EvalScriptExpression(). A result the conversion rejects raises a Py::Exception that the query catches, reports through Fatal() with the expression text, and clears with PyErr_Clear().

This query converts the result to an integer and reports 1 when it is non-zero and 0 otherwise. The codes recovered so far are 0x39a for the async loader state, 0x3a1 and 0x3a4 for display mode, and 0x398 for one of the mixer flags.

Parameters
nEventCodeThe template identifier.
Returns
1 when the value is non-zero, and 0 otherwise or after a failed conversion.
Ghidra address:
NTSC-U/C: 0x005093e0
Ghidra address:
PAL: 0x00548628

◆ QueryConfigValue()

int QueryConfigValue ( int nEventCode,
... )

Read one configuration value as an integer through the embedded interpreter.

The same evaluation as QueryConfigFlag(), returning the integer itself.

Parameters
nEventCodeThe template identifier.
Returns
The value, or 0 after a failed conversion.
Ghidra address:
NTSC-U/C: 0x00509110
Ghidra address:
PAL: 0x00548308

◆ QueryConfigString()

HxStr QueryConfigString ( int nEventCode,
... )

Read one configuration value as a string through the embedded interpreter.

The same evaluation as QueryConfigFlag(), converting the result through Py::String. A failed conversion yields an empty string. Ps2HardSynth's three bank loaders each read a pair of bank paths this way, passing GetHostMode() as the one substituted argument.

Parameters
nEventCodeThe template identifier.
Returns
The value.
Ghidra address:
NTSC-U/C: 0x005096d0
Ghidra address:
PAL: 0x00548970

◆ QueryConfigVector()

void QueryConfigVector ( std::vector< int > * pResult,
int nEventCode,
... )

Fill a vector of integers from one configuration value through the embedded interpreter.

The result is taken as a Py::Sequence, the vector is cleared, and each element is converted through Py::Int and appended. Mixer's constructor reads its per-track table this way under code 0x39f, and GameEnableMgr passes a one-based track number as the substituted argument.

Parameters
pResultThe vector the values are written to.
nEventCodeThe template identifier.
Ghidra address:
NTSC-U/C: 0x0050a1a0
Ghidra address:
PAL: 0x00549528

◆ QueryConfigStrings()

void QueryConfigStrings ( std::vector< HxStr > * pResult,
int nEventCode,
... )

Fill a vector of strings from one configuration value through the embedded interpreter.

The same evaluation as QueryConfigVector(), converting each element through Py::String. The front end's song lists read their names this way under codes 0x276 and 0x27a. The title is inferred.

Parameters
pResultThe vector the values are written to.
nEventCodeThe template identifier.
Ghidra address:
NTSC-U/C: 0x00509b78
Ghidra address:
PAL: 0x00548ea0