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

Queue of memory-card operations, with one entry point per libmc call. More...

#include <memcard.h>

Inheritance diagram for Memcard:

Public Member Functions

 Memcard ()
 Construct an empty queue.
virtual ~Memcard ()
 Release the queue.
virtual void Update ()
 Advance the head of the queue by one step.
void CheckInfo (MemcardCBHandler *pHandler, int nPortSlot, int nCookie)
 Queue an enquiry about the card in one slot.
void EntSpace (MemcardCBHandler *pHandler, int nPortSlot, const HxStr &path, int nCookie)
 Queue an enquiry about the free directory entries under one path.
void Format (MemcardCBHandler *pHandler, int nPortSlot, int nCookie)
 Queue a format of the card in one slot.
void Unformat (MemcardCBHandler *pHandler, int nPortSlot, int nCookie)
 Queue an unformat of the card in one slot.
void CreateDir (MemcardCBHandler *pHandler, int nPortSlot, HxStr path, int nCookie)
 Queue the creation of one directory.
void ListDir (MemcardCBHandler *pHandler, int nPortSlot, const HxStr &path, int nCookie, unsigned nMode)
 Queue a listing of one directory.
void Read (MemcardCBHandler *pHandler, int nPortSlot, int nFile, void *pBuffer, int nLength, int nCookie)
 Queue a read from an open descriptor.
void Write (MemcardCBHandler *pHandler, int nPortSlot, int nFile, const void *pBuffer, int nLength, int nCookie)
 Queue a write to an open descriptor.
void Seek (MemcardCBHandler *pHandler, int nFile, int nOffset, int nOrigin, int nCookie)
 Queue a move of the position of an open descriptor.
void OpenWrite (MemcardCBHandler *pHandler, int nPortSlot, const HxStr &path, int nCookie)
 Queue an open for writing.
void OpenRead (MemcardCBHandler *pHandler, int nPortSlot, const HxStr &path, int nCookie)
 Queue an open for reading.
void Close (MemcardCBHandler *pHandler, int nFile, int nCookie)
 Queue a close of an open descriptor.
void DeleteFile (MemcardCBHandler *pHandler, int nPortSlot, const HxStr &path, int nCookie)
 Queue the deletion of one file or directory.
void RenameFile (MemcardCBHandler *pHandler, int nPortSlot, const HxStr &oldPath, const HxStr &newPath, int nCookie)
 Queue a rename.
void Cancel (int nCookie)
 Discard every queued operation that was queued with one tag.

Protected Attributes

std::list< MemcardOp * > mOps

Detailed Description

Queue of memory-card operations, with one entry point per libmc call.

Its RTTI descriptor is at 0x0086f630. It has no base class. The vptr therefore sits after the data at offset 4 rather than at offset 0. An instance is eight bytes and the vtable is at 0x0082c030, with three slots.

Every entry point below constructs one MemcardOp subclass on the heap and appends it to the queue. Nothing is issued at that moment. Update() drives the head of the queue, one libmc call at a time. A caller that queues an open, a write and a close in one turn therefore gets them serviced in order over the following frames. Ordering is what makes the queue rather than a set of direct calls necessary, because libmc services one command at a time.

Every entry point takes an nCookie ticket number, which the operation stores and Cancel() matches on. Every MemcardTask passes its own ticket. Abandoning a task therefore abandons exactly the operations that task queued, wherever they sit in the queue.

One instance exists. It is a MemcardPS2 built with new inside the constructor at 0x001f2960, which belongs to a singleton outside this subsystem.

Constructor & Destructor Documentation

◆ Memcard()

Memcard::Memcard ( )

Construct an empty queue.

The body default-constructs the queue and nothing else. The compiler inlined it into MemcardPS2::MemcardPS2(). No address of its own survives.

◆ ~Memcard()

virtual Memcard::~Memcard ( )
virtual

Release the queue.

Occupies vtable slot 1. Any operation still queued is discarded without being issued and without being destroyed, because the body clears the list rather than deleting through it.

Ghidra address:
NTSC-U/C: 0x001f6140
Ghidra address:
PAL: 0x001fcb50

Member Function Documentation

◆ Update()

virtual void Memcard::Update ( )
virtual

Advance the head of the queue by one step.

Occupies vtable slot 2. The body of this class is empty, and MemcardPS2 supplies the PlayStation 2 implementation. The method title is inferred.

Ghidra address:
NTSC-U/C: 0x001f61a8
Ghidra address:
PAL: 0x001fcbb8

Reimplemented in MemcardPS2.

◆ CheckInfo()

void Memcard::CheckInfo ( MemcardCBHandler * pHandler,
int nPortSlot,
int nCookie )

Queue an enquiry about the card in one slot.

Parameters
pHandlerThe receiver the finished operation reports to.
nPortSlotThe packed port and slot.
nCookieThe tag Cancel() matches on.
Ghidra address:
NTSC-U/C: 0x0047e370
Ghidra address:
PAL: 0x004bc048

◆ EntSpace()

void Memcard::EntSpace ( MemcardCBHandler * pHandler,
int nPortSlot,
const HxStr & path,
int nCookie )

Queue an enquiry about the free directory entries under one path.

No caller exists in the image.

Parameters
pHandlerThe receiver the finished operation reports to.
nPortSlotThe packed port and slot.
pathThe directory to measure.
nCookieThe tag Cancel() matches on.
Ghidra address:
NTSC-U/C: 0x0047e498
Ghidra address:
PAL: 0x004bc170

◆ Format()

void Memcard::Format ( MemcardCBHandler * pHandler,
int nPortSlot,
int nCookie )

Queue a format of the card in one slot.

Parameters
pHandlerThe receiver the finished operation reports to.
nPortSlotThe packed port and slot.
nCookieThe tag Cancel() matches on.
Ghidra address:
NTSC-U/C: 0x0047e5d0
Ghidra address:
PAL: 0x004bc2a8

◆ Unformat()

void Memcard::Unformat ( MemcardCBHandler * pHandler,
int nPortSlot,
int nCookie )

Queue an unformat of the card in one slot.

Parameters
pHandlerThe receiver the finished operation reports to.
nPortSlotThe packed port and slot.
nCookieThe tag Cancel() matches on.
Ghidra address:
NTSC-U/C: 0x0047e6f8
Ghidra address:
PAL: 0x004bc3d0

◆ CreateDir()

void Memcard::CreateDir ( MemcardCBHandler * pHandler,
int nPortSlot,
HxStr path,
int nCookie )

Queue the creation of one directory.

Parameters
pHandlerThe receiver the finished operation reports to.
nPortSlotThe packed port and slot.
pathThe directory to create, taken by value and destroyed on return.
nCookieThe tag Cancel() matches on.
Ghidra address:
NTSC-U/C: 0x0047e820
Ghidra address:
PAL: 0x004bc4f8

◆ ListDir()

void Memcard::ListDir ( MemcardCBHandler * pHandler,
int nPortSlot,
const HxStr & path,
int nCookie,
unsigned nMode )

Queue a listing of one directory.

Parameters
pHandlerThe receiver the finished operation reports to.
nPortSlotThe packed port and slot.
pathThe directory to list.
nCookieThe tag Cancel() matches on.
nModeThe sceMcGetDir() mode.
Ghidra address:
NTSC-U/C: 0x0047e990
Ghidra address:
PAL: 0x004bc688

◆ Read()

void Memcard::Read ( MemcardCBHandler * pHandler,
int nPortSlot,
int nFile,
void * pBuffer,
int nLength,
int nCookie )

Queue a read from an open descriptor.

Parameters
pHandlerThe receiver the finished operation reports to.
nPortSlotThe packed port and slot, which the operation records and never uses.
nFileThe descriptor to read from.
pBufferThe destination.
nLengthThe number of bytes to read.
nCookieThe tag Cancel() matches on.
Ghidra address:
NTSC-U/C: 0x0047ead8
Ghidra address:
PAL: 0x004bc7d0

◆ Write()

void Memcard::Write ( MemcardCBHandler * pHandler,
int nPortSlot,
int nFile,
const void * pBuffer,
int nLength,
int nCookie )

Queue a write to an open descriptor.

Parameters
pHandlerThe receiver the finished operation reports to.
nPortSlotThe packed port and slot, which the operation records and never uses.
nFileThe descriptor to write to.
pBufferThe source.
nLengthThe number of bytes to write.
nCookieThe tag Cancel() matches on.
Ghidra address:
NTSC-U/C: 0x0047ec30
Ghidra address:
PAL: 0x004bc928

◆ Seek()

void Memcard::Seek ( MemcardCBHandler * pHandler,
int nFile,
int nOffset,
int nOrigin,
int nCookie )

Queue a move of the position of an open descriptor.

No caller exists in the image.

Parameters
pHandlerThe receiver the finished operation reports to.
nFileThe descriptor to move.
nOffsetThe offset to move by.
nOriginThe origin the offset is measured from.
nCookieThe tag Cancel() matches on.
Ghidra address:
NTSC-U/C: 0x0047ed88
Ghidra address:
PAL: 0x004bca80

◆ OpenWrite()

void Memcard::OpenWrite ( MemcardCBHandler * pHandler,
int nPortSlot,
const HxStr & path,
int nCookie )

Queue an open for writing.

Parameters
pHandlerThe receiver the finished operation reports to.
nPortSlotThe packed port and slot.
pathThe file to open.
nCookieThe tag Cancel() matches on.
Ghidra address:
NTSC-U/C: 0x0047eed0
Ghidra address:
PAL: 0x004bcbc8

◆ OpenRead()

void Memcard::OpenRead ( MemcardCBHandler * pHandler,
int nPortSlot,
const HxStr & path,
int nCookie )

Queue an open for reading.

Parameters
pHandlerThe receiver the finished operation reports to.
nPortSlotThe packed port and slot.
pathThe file to open.
nCookieThe tag Cancel() matches on.
Ghidra address:
NTSC-U/C: 0x0047f008
Ghidra address:
PAL: 0x004bcd00

◆ Close()

void Memcard::Close ( MemcardCBHandler * pHandler,
int nFile,
int nCookie )

Queue a close of an open descriptor.

Parameters
pHandlerThe receiver the finished operation reports to.
nFileThe descriptor to close.
nCookieThe tag Cancel() matches on.
Ghidra address:
NTSC-U/C: 0x0047f140
Ghidra address:
PAL: 0x004bce38

◆ DeleteFile()

void Memcard::DeleteFile ( MemcardCBHandler * pHandler,
int nPortSlot,
const HxStr & path,
int nCookie )

Queue the deletion of one file or directory.

Parameters
pHandlerThe receiver the finished operation reports to.
nPortSlotThe packed port and slot.
pathThe file or directory to delete.
nCookieThe tag Cancel() matches on.
Ghidra address:
NTSC-U/C: 0x0047f268
Ghidra address:
PAL: 0x004bcf60

◆ RenameFile()

void Memcard::RenameFile ( MemcardCBHandler * pHandler,
int nPortSlot,
const HxStr & oldPath,
const HxStr & newPath,
int nCookie )

Queue a rename.

No caller exists in the image.

Parameters
pHandlerThe receiver the finished operation reports to.
nPortSlotThe packed port and slot.
oldPathThe existing name.
newPathThe replacement name.
nCookieThe tag Cancel() matches on.
Ghidra address:
NTSC-U/C: 0x0047f3a0
Ghidra address:
PAL: 0x004bd098

◆ Cancel()

void Memcard::Cancel ( int nCookie)

Discard every queued operation that was queued with one tag.

An operation already in flight is discarded along with the rest, and its libmc call is not waited for.

Parameters
nCookieThe tag to match.
Ghidra address:
NTSC-U/C: 0x0047f4e8
Ghidra address:
PAL: 0x004bd1e0

Member Data Documentation

◆ mOps

std::list<MemcardOp *> Memcard::mOps
protected

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