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

Go to the source code of this file.

Enumerations

enum  HostMode { kHostModeHostOnly = 0 , kHostModeCdHost = 1 , kHostModeCdOnly = 2 }
 Media the game loads its data from. More...

Functions

HostMode GetHostMode ()
 The data source selected for this run.
int UsingArkFiles ()
 Whether data is read from ark archives rather than loose host files.
int UsingCdMedia ()
 Whether data is being read from the disc.
int MidiErrorLogEnabled ()
 Whether a MIDI conversion writes its error log.
int WarningsEnabled ()
 Whether Warn() reports anything.
int ScreenMessagesEnabled ()
 Whether a reported message also goes to the screen.
HxStr GetFreqRoot ()
 Root the game composes every data path against.
HxStr MakeFreqPath (const HxStr &name)
 Compose a data path against GetFreqRoot().
int DebugKeysEnabled ()
 Whether a pressed modifier turns a controller button into a debug script hook.
int MemAccountingEnabled ()
 Whether the asynchronous loader brackets each load with memory accounting.
int IntroMovieEnabled ()
 Whether the start-up sequence plays the intro movie ps2intro.pss.
HxStr GetVersionString ()
 Report the build version, "198" in the NTSC-U/C release and "197" in the PAL release.
bool CheckCDFile (const char *pszPath)
 Report whether a file can be opened for reading through the file service.
void TerminateBootConfig ()
 Release every zone, the counterpart of InitBootConfig().

Enumeration Type Documentation

◆ HostMode

enum HostMode

Media the game loads its data from.

These names come from the start-up banner. It prints the selected mode followed by " mode being used for IOP initialization.".

Enumerator
kHostModeHostOnly 

Everything is read over the host link.

kHostModeCdHost 

The disc is preferred, with the host link as a fallback.

kHostModeCdOnly 

Retail: the disc only.

Function Documentation

◆ GetHostMode()

HostMode GetHostMode ( )

The data source selected for this run.

Ghidra address:
NTSC-U/C: 0x0050ef90
Ghidra address:
PAL: 0x0054e508

◆ UsingArkFiles()

int UsingArkFiles ( )

Whether data is read from ark archives rather than loose host files.

The flag behind this accessor is a word rather than a byte. It is therefore returned as an int.

Returns
Non-zero when ark archives are in use.
Ghidra address:
NTSC-U/C: 0x0050efa0
Ghidra address:
PAL: 0x0054e518

◆ UsingCdMedia()

int UsingCdMedia ( )

Whether data is being read from the disc.

The flag is one word of a block of nine boot options at 0x0070bf10 that each have an accessor of this shape. The retail configurator at 0x0050f030 (InitIop() calls it first) writes the block in one pass and sets this word to 1 in the same instruction run that sets GetHostMode() to kHostModeCdOnly and UsingArkFiles() to 1. The .data default is zero, the host-development configuration. It is a separate word from the one UsingArkFiles() reads at 0x0070bf14.

Both uses agree with that reading. InitAsync() starts the worker thread only when this reports the disc, because a host-link read needs no latency hiding, and OpenArkObject::Open() searches the path for a device prefix only then, because a prefix such as cdrom0: does not exist on any host path.

Returns
Non-zero when data is read from the disc.
Ghidra address:
NTSC-U/C: 0x0050efd0
Ghidra address:
PAL: 0x0054e548

◆ MidiErrorLogEnabled()

int MidiErrorLogEnabled ( )

Whether a MIDI conversion writes its error log.

Another word of the same boot-option block, at 0x0070bf28. The retail configurator writes 0 there, and the .data default is also 0. LevelConverter is the only caller. It tests the word before it opens the log and before each line it writes. The title is inferred.

Returns
Non-zero when the error log is written.
Ghidra address:
NTSC-U/C: 0x0050eff0
Ghidra address:
PAL: 0x0054e568

◆ WarningsEnabled()

int WarningsEnabled ( )

Whether Warn() reports anything.

Another word of the same boot-option block, at 0x0070bf18. Warn() is the only reader of either the word or this accessor, and it does not report anything unless the value is 1. The test against 1 fixes the meaning of the word. The .data value is 1, and ConfigureRetailBoot() clears it.

Returns
1 when warnings are reported.
Ghidra address:
NTSC-U/C: 0x0050efb0
Ghidra address:
PAL: 0x0054e528

◆ ScreenMessagesEnabled()

int ScreenMessagesEnabled ( )

Whether a reported message also goes to the screen.

Another word of the same boot-option block, at 0x0070bf1c. ReportMessage() is the only reader of either the word or this accessor, and it skips the on-screen half unless the value is 1. No routine writes the word, and its .data value is 1.

Returns
1 when messages go to the screen.
Ghidra address:
NTSC-U/C: 0x0050efc0
Ghidra address:
PAL: 0x0054e538

◆ GetFreqRoot()

HxStr GetFreqRoot ( )

Root the game composes every data path against.

The shipped build returns the empty string. Every composed path is therefore relative. The routine shares a translation unit with GetHostMode() and UsingArkFiles().

Returns
The root, empty in the shipped build.
Ghidra address:
NTSC-U/C: 0x0050ef30
Ghidra address:
PAL: 0x0054e4a8

◆ MakeFreqPath()

HxStr MakeFreqPath ( const HxStr & name)

Compose a data path against GetFreqRoot().

The routine sits in the same translation unit as GetFreqRoot(). Its callers include the asynchronous loader, the save_rnd script command, and GamePlaybacker, each of which opens the returned path. The title is inferred.

Parameters
nameThe path below the root.
Returns
The root followed by name.
Ghidra address:
NTSC-U/C: 0x0050d9f0
Ghidra address:
PAL: 0x0054cea8

◆ DebugKeysEnabled()

int DebugKeysEnabled ( )

Whether a pressed modifier turns a controller button into a debug script hook.

The boot-option word at 0x0070bf24. InputPoller::Poll() is the one reader. While it reports non-zero, a button pressed with the modifier bits runs script template 0x3f2 instead of the usual 'joy ' message. ConfigureRetailBoot() clears it. The name is inferred.

Returns
Non-zero when the debug hooks are active.
Ghidra address:
NTSC-U/C: 0x0050efe0
Ghidra address:
PAL: 0x0054e558

◆ MemAccountingEnabled()

int MemAccountingEnabled ( )

Whether the asynchronous loader brackets each load with memory accounting.

The boot-option word at 0x0070bf2c. RndAsyncLoader::PollAsyncLoads() calls MemLogBeginCount() before reading a completed load and reports the accounting afterwards while it is non-zero. ConfigureRetailBoot() clears it. The name is inferred.

Returns
Non-zero when loads are accounted.
Ghidra address:
NTSC-U/C: 0x0050f000
Ghidra address:
PAL: 0x0054e578

◆ IntroMovieEnabled()

int IntroMovieEnabled ( )

Whether the start-up sequence plays the intro movie ps2intro.pss.

The boot-option word at 0x0070bf30. MetSonyScreen is the one reader. ConfigureRetailBoot() sets it. The name is inferred.

Returns
Non-zero when the intro movie plays.
Ghidra address:
NTSC-U/C: 0x0050f010
Ghidra address:
PAL: 0x0054e588

◆ GetVersionString()

HxStr GetVersionString ( )

Report the build version, "198" in the NTSC-U/C release and "197" in the PAL release.

The title screen shows it after "Version:". The unit's static initialiser builds the string, the HxStr at 0x0070bf38 (PAL 0x0074fac8). The name is inferred.

Returns
A copy of the version string.
Ghidra address:
NTSC-U/C: 0x0050ef60
Ghidra address:
PAL: 0x0054e4d8

◆ CheckCDFile()

bool CheckCDFile ( const char * pszPath)

Report whether a file can be opened for reading through the file service.

The file is opened read-only and closed again at once. The shipped program has no call site.

Parameters
pszPathThe path to test.
Returns
True when the open succeeded.
Ghidra address:
NTSC-U/C: 0x0050f0c8
Ghidra address:
PAL: 0x0054e670

◆ TerminateBootConfig()

void TerminateBootConfig ( )

Release every zone, the counterpart of InitBootConfig().

The body is one call to ReleaseAllZoneSlots(). The shipped program has no call site, and the name is inferred from the counterpart.

Ghidra address:
NTSC-U/C: 0x0050f0a8
Ghidra address:
PAL: 0x0054e650