wavelength 1.0.0
Loading...
Searching...
No Matches
memcard.h File Reference
Include dependency graph for memcard.h:

Go to the source code of this file.

Functions

void MemcardInit ()
 Start the memory card library and give slot 0 to port 0 and slot 1 to port 1.
void MemcardTerminate ()
 Stop the memory card library.
void MemcardAssignSlots (bool bPort0Multitap, bool bPort1Multitap)
 Give the memory card slots to the controller ports.
void MemcardPoll ()
 Advance the memory card command in flight.
void MemcardGetInfo (MemcardCBHandler *pHandler, int nPort, int *pnType, int *pnFree, int *pnFormat)
 Start reading the type, the free space, and the format of a card.
void MemcardOpen (MemcardCBHandler *pHandler, int nPort, const char *pszName, int nMode)
 Start opening a file.
void MemcardClose (MemcardCBHandler *pHandler, int nFd)
 Start closing a file.
void MemcardRead (MemcardCBHandler *pHandler, int nFd, void *pBuffer, int nSize)
 Start reading a file.
void MemcardWrite (MemcardCBHandler *pHandler, int nFd, const void *pData, int nSize)
 Start writing a file.
void MemcardSeek (MemcardCBHandler *pHandler, int nFd, int nOffset, int nMode)
 Start moving the position of a file.
void MemcardMkdir (MemcardCBHandler *pHandler, int nPort, const char *pszName)
 Start creating a directory.
void MemcardGetDir (MemcardCBHandler *pHandler, int nPort, const char *pszName, int nMaxEntries, int nMode)
 Start listing the entries that match a name.
void MemcardDelete (MemcardCBHandler *pHandler, int nPort, const char *pszName)
 Start deleting a file or an empty directory.
void MemcardFormat (MemcardCBHandler *pHandler, int nPort)
 Start formatting a card.
void MemcardUnformat (MemcardCBHandler *pHandler, int nPort)
 Start unformatting a card.
const char * MemcardGetSlotName (int nPort)
 Report the localisation token of the name of a memory card slot.

Variables

constexpr int kMemcardSlotCount = 4
 The number of memory card slots, four multitap slots of the first port.

Function Documentation

◆ MemcardInit()

void MemcardInit ( )

Start the memory card library and give slot 0 to port 0 and slot 1 to port 1.

Ghidra address:
NTSC-U/C: 0x0028b578
Ghidra address:
PAL: 0x00294d78

◆ MemcardTerminate()

void MemcardTerminate ( )

Stop the memory card library.

Ghidra address:
NTSC-U/C: 0x0028b5a0
Ghidra address:
PAL: 0x00294da0

◆ MemcardAssignSlots()

void MemcardAssignSlots ( bool bPort0Multitap,
bool bPort1Multitap )

Give the memory card slots to the controller ports.

With bPort0Multitap set, slots 0 to 3 are the four multitap slots of port 0. Otherwise slot 0 is port 0, slot 1 is port 1 unless bPort1Multitap is set, and the other slots are unused.

Parameters
bPort0MultitapWhether a multitap is connected to port 0.
bPort1MultitapWhether a multitap is connected to port 1.
Ghidra address:
NTSC-U/C: 0x0028bf28
Ghidra address:
PAL: 0x00295878

◆ MemcardPoll()

void MemcardPoll ( )

Advance the memory card command in flight.

Without waiting, the routine queries the library whether the command finished. A finished command reports its result to the handler that issued it, through the handler method for the command. A command the routine does not know is reported as Bad memcard func: d.

Ghidra address:
NTSC-U/C: 0x0028b5c0
Ghidra address:
PAL: 0x00294dc0

◆ MemcardGetInfo()

void MemcardGetInfo ( MemcardCBHandler * pHandler,
int nPort,
int * pnType,
int * pnFree,
int * pnFormat )

Start reading the type, the free space, and the format of a card.

MemcardCBHandler::OnGetInfo() receives the result.

Parameters
pHandlerThe handler of the result.
nPortThe memory card slot.
pnTypeReceives the card type.
pnFreeReceives the free space in kilobytes.
pnFormatReceives non-zero for a formatted card.
Ghidra address:
NTSC-U/C: 0x0028b8c8
Ghidra address:
PAL: 0x002950c8

◆ MemcardOpen()

void MemcardOpen ( MemcardCBHandler * pHandler,
int nPort,
const char * pszName,
int nMode )

Start opening a file.

MemcardCBHandler::OnOpen() receives the file descriptor or the error.

Parameters
pHandlerThe handler of the result.
nPortThe memory card slot.
pszNameThe file.
nModeThe library's open mode bits.
Ghidra address:
NTSC-U/C: 0x0028b928
Ghidra address:
PAL: 0x00295128

◆ MemcardClose()

void MemcardClose ( MemcardCBHandler * pHandler,
int nFd )

Start closing a file.

MemcardCBHandler::OnClose() receives the result.

Parameters
pHandlerThe handler of the result.
nFdThe file descriptor.
Ghidra address:
NTSC-U/C: 0x0028b980
Ghidra address:
PAL: 0x00295180

◆ MemcardRead()

void MemcardRead ( MemcardCBHandler * pHandler,
int nFd,
void * pBuffer,
int nSize )

Start reading a file.

MemcardCBHandler::OnRead() receives the result.

Parameters
pHandlerThe handler of the result.
nFdThe file descriptor.
pBufferReceives the bytes.
nSizeThe number of bytes.
Ghidra address:
NTSC-U/C: 0x0028b9c0
Ghidra address:
PAL: 0x002951c0

◆ MemcardWrite()

void MemcardWrite ( MemcardCBHandler * pHandler,
int nFd,
const void * pData,
int nSize )

Start writing a file.

MemcardCBHandler::OnWrite() receives the result.

Parameters
pHandlerThe handler of the result.
nFdThe file descriptor.
pDataThe bytes.
nSizeThe number of bytes.
Ghidra address:
NTSC-U/C: 0x0028ba08
Ghidra address:
PAL: 0x00295208

◆ MemcardSeek()

void MemcardSeek ( MemcardCBHandler * pHandler,
int nFd,
int nOffset,
int nMode )

Start moving the position of a file.

MemcardCBHandler::OnSeek() receives the result.

Parameters
pHandlerThe handler of the result.
nFdThe file descriptor.
nOffsetThe offset.
nModeThe origin of the offset.
Ghidra address:
NTSC-U/C: 0x0028ba50
Ghidra address:
PAL: 0x00295250

◆ MemcardMkdir()

void MemcardMkdir ( MemcardCBHandler * pHandler,
int nPort,
const char * pszName )

Start creating a directory.

MemcardCBHandler::OnMkdir() receives the result.

Parameters
pHandlerThe handler of the result.
nPortThe memory card slot.
pszNameThe directory.
Ghidra address:
NTSC-U/C: 0x0028ba98
Ghidra address:
PAL: 0x00295298

◆ MemcardGetDir()

void MemcardGetDir ( MemcardCBHandler * pHandler,
int nPort,
const char * pszName,
int nMaxEntries,
int nMode )

Start listing the entries that match a name.

At most 20 entries are listed, whatever nMaxEntries requests. MemcardCBHandler::OnGetDir() receives the count and the entries.

Parameters
pHandlerThe handler of the result.
nPortThe memory card slot.
pszNameThe name. It may include wildcards.
nMaxEntriesThe number of entries requested.
nModeThe library's listing mode.
Ghidra address:
NTSC-U/C: 0x0028baf0
Ghidra address:
PAL: 0x002952f0

◆ MemcardDelete()

void MemcardDelete ( MemcardCBHandler * pHandler,
int nPort,
const char * pszName )

Start deleting a file or an empty directory.

MemcardCBHandler::OnDelete() receives the result.

Parameters
pHandlerThe handler of the result.
nPortThe memory card slot.
pszNameThe file or directory.
Ghidra address:
NTSC-U/C: 0x0028bb80
Ghidra address:
PAL: 0x00295380

◆ MemcardFormat()

void MemcardFormat ( MemcardCBHandler * pHandler,
int nPort )

Start formatting a card.

MemcardCBHandler::OnFormat() receives the result.

Parameters
pHandlerThe handler of the result.
nPortThe memory card slot.
Ghidra address:
NTSC-U/C: 0x0028bbd8
Ghidra address:
PAL: 0x002953d8

◆ MemcardUnformat()

void MemcardUnformat ( MemcardCBHandler * pHandler,
int nPort )

Start unformatting a card.

MemcardCBHandler::OnUnformat() receives the result.

Parameters
pHandlerThe handler of the result.
nPortThe memory card slot.
Ghidra address:
NTSC-U/C: 0x0028bc30
Ghidra address:
PAL: 0x00295430

◆ MemcardGetSlotName()

const char * MemcardGetSlotName ( int nPort)

Report the localisation token of the name of a memory card slot.

Parameters
nPortThe memory card slot.
Returns
The token, or an empty string for a slot without a name.
Ghidra address:
NTSC-U/C: 0x0028bfa8
Ghidra address:
PAL: 0x002958f8

Variable Documentation

◆ kMemcardSlotCount

int kMemcardSlotCount = 4
constexpr

The number of memory card slots, four multitap slots of the first port.