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

Disc exchange that MetExpansionPakScreen runs to swap the game disc for the expansion disc. More...

#include <discswap.h>

Public Types

enum  Step {
  kStepEjecting = 2 , kStepEjectFailed = 3 , kStepTrayOpen = 4 , kStepClosing = 5 ,
  kStepCloseFailed = 6 , kStepDiscReady = 7 , kStepNotReady = 9 , kStepMounted = 10 ,
  kStepBadDisc = 11 , kStepNoDisc = 12
}
 A screen state that a polling routine returns. More...

Public Member Functions

void Reset ()
 Prepare a new exchange.
int ReleaseDisc ()
 Let go of the current disc once the asynchronous reader is idle.
void BeginEject ()
 Restart the eject sequence.
int PollEject ()
 Advance the eject sequence by one poll.
void BeginInsert ()
 Restart the insert sequence.
int PollInsert ()
 Advance the insert sequence by one poll.
int CheckDisc ()
 Classify the disc once the drive is ready, without moving the tray.
int MountDisc ()
 Mount the archives from the new disc and run script template 205.

Detailed Description

Disc exchange that MetExpansionPakScreen runs to swap the game disc for the expansion disc.

The record is 0x18 bytes, embedded in the screen at +0x90. It has no vtable, no RTTI, and no literal of its own, so the title is inferred from what the routines do. They stop the drive and open the tray, close the tray and wait for the drive, classify the inserted disc, and remount the archives.

Each polling routine returns the screen's next state, a Step value, and the screen stores the result as its state without translating it. When the game is not reading from the disc alone, the polling routines report their final step without touching the drive.

Member Enumeration Documentation

◆ Step

A screen state that a polling routine returns.

The names are inferred.

Enumerator
kStepEjecting 

The drive is stopping or the tray is opening.

kStepEjectFailed 

The stop or the tray-open request was refused.

kStepTrayOpen 

The tray is open, or the drive is not ready yet.

kStepClosing 

The tray is closing, or the drive is spinning up.

kStepCloseFailed 

The tray-close request was refused.

kStepDiscReady 

A PlayStation 2 disc is ready to mount.

kStepNotReady 

The drive was not ready when the mount was attempted.

kStepMounted 

The archives are mounted again.

kStepBadDisc 

The disc is not a PlayStation 2 disc, or the mount failed.

kStepNoDisc 

The tray closed with no disc in it.

Member Function Documentation

◆ Reset()

void DiscSwap::Reset ( )

Prepare a new exchange.

Clears the poll count, sets the poll limit to 1800, records whether the game reads from the disc alone, clears the no-disc flag, and caches configuration value 0x514.

Ghidra address:
NTSC-U/C: 0x0016a048
Ghidra address:
PAL: 0x0016c248

◆ ReleaseDisc()

int DiscSwap::ReleaseDisc ( )

Let go of the current disc once the asynchronous reader is idle.

While requests are still queued this pumps the finished ones and reports zero. Otherwise it unmounts the session archives through CloseArk(). A call that unmounts them reports zero, so the screen calls again on the next frame, and that call finds nothing mounted and reports one. The record itself is not read.

Returns
Non-zero when no archive was left to unmount.
Ghidra address:
NTSC-U/C: 0x0016a098
Ghidra address:
PAL: 0x0016c298

◆ BeginEject()

void DiscSwap::BeginEject ( )

Restart the eject sequence.

Ghidra address:
NTSC-U/C: 0x0016a168
Ghidra address:
PAL: 0x0016c368

◆ PollEject()

int DiscSwap::PollEject ( )

Advance the eject sequence by one poll.

An empty drive skips the stop. Otherwise the drive is stopped, then the routine waits for the drive to go idle and requests the tray open.

Returns
kStepEjecting while the sequence runs, kStepEjectFailed when a request is refused, and kStepTrayOpen once the tray is open.
Ghidra address:
NTSC-U/C: 0x00169e50
Ghidra address:
PAL: 0x0016c050

◆ BeginInsert()

void DiscSwap::BeginInsert ( )

Restart the insert sequence.

The body is identical to BeginEject(), but the two are separate routines in the image.

Ghidra address:
NTSC-U/C: 0x0016a170
Ghidra address:
PAL: 0x0016c370

◆ PollInsert()

int DiscSwap::PollInsert ( )

Advance the insert sequence by one poll.

Waits for the drive to go idle, requests the tray closed, and then waits for the drive to report ready. After the poll limit passes, the disc is classified anyway.

Returns
kStepClosing while the sequence runs, kStepCloseFailed when the tray-close request is refused, and the classification once the drive is ready.
Ghidra address:
NTSC-U/C: 0x00169f08
Ghidra address:
PAL: 0x0016c108

◆ CheckDisc()

int DiscSwap::CheckDisc ( )

Classify the disc once the drive is ready, without moving the tray.

Returns
kStepTrayOpen while the drive is not ready, otherwise the classification.
Ghidra address:
NTSC-U/C: 0x0016a0e8
Ghidra address:
PAL: 0x0016c2e8

◆ MountDisc()

int DiscSwap::MountDisc ( )

Mount the archives from the new disc and run script template 205.

Returns
kStepNotReady when the drive is not ready, kStepBadDisc when the mount fails, and kStepMounted otherwise.
Ghidra address:
NTSC-U/C: 0x0016a178
Ghidra address:
PAL: 0x0016c378

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