wavelength 1.0.0
Loading...
Searching...
No Matches
ArkFile Class Reference

Read-only file of the main archive, read through the disc cache. More...

#include <arkfile.h>

Inheritance diagram for ArkFile:
Collaboration diagram for ArkFile:

Public Member Functions

 ArkFile (const char *pszFile, int nMode)
 Find a file in the main archive.
 ~ArkFile () override
 Drop the reads still waiting for the disc.
int Read (void *pBuffer, int nBytes) override
 Read bytes and wait for them.
bool ReadAsync (void *pBuffer, int nBytes) override
 Start reading bytes, one task for each block of the disc they cover.
int Write (const void *pBuffer, int nBytes) override
 Report that an archive file cannot be written.
int Seek (int nOffset, int nOrigin) override
 Move the position.
int Tell () override
 Report the position.
void Flush () override
 Do nothing.
bool Eof () override
 Report whether the position is at the end.
bool Fail () override
 Report whether the file was not found.
int Size () override
 Report the size.
int UncompressedSize () override
 Report the size before compression.
bool ReadDone (int *pnBytes) override
 Advance the disc cache and report whether every task of the read finished.
void TaskDone (int nBytes)
 Count a finished task of the read.
 ArkFile (const char *name, int mode)
 Find a file in the archive.
virtual ~ArkFile ()
 Drop the reads still waiting for blocks.
virtual int Read (void *data, int bytes)
 Read bytes and wait for them.
virtual bool ReadAsync (void *data, int bytes)
 Queue a read of each block the bytes cover, at most up to the end of the file.
virtual int Write (const void *data, int bytes)
 Fail, because the archive is read-only.
virtual int Seek (int offset, int origin)
 Move the position.
virtual int Tell ()
 Report the position.
virtual void Flush ()
 Do nothing.
virtual bool Eof ()
 Report whether the position is at the end.
virtual bool Fail ()
 Report whether the file was not found or was opened for writing.
virtual int Size ()
 Report the size in the archive.
virtual int UncompressedSize ()
 Report the size before compression.
virtual bool ReadDone (int *bytes)
 Poll the block manager and report whether every block of the read arrived.
void TaskDone (int bytes)
 Count the bytes one block delivered.
Public Member Functions inherited from File
virtual ~File ()
 Close the file.
virtual ~File ()
 Close the file.

Static Public Member Functions

static const char * ArchivePath (const char *pszPath)
 Express a path relative to the root of the game files, as the archive records it.
Static Public Member Functions inherited from File
static File * New (const char *pszPath, int nMode, int nFlags)
 Open a file.

Additional Inherited Members

Public Types inherited from File
enum  Mode { kModeRead = 1 , kModeWrite = 2 }
 Open modes of New(). More...
Static Public Attributes inherited from File
static constexpr int kFlagNoArchive = 1
 The open flags New() takes to read even a disc file through AsyncFile.

Detailed Description

Read-only file of the main archive, read through the disc cache.

Read-only file inside the archive, read through the block manager.

The RTTI includes the class name and records File as the base.

The RTTI records the class as deriving from File. The object is 0x40 bytes.

Constructor & Destructor Documentation

◆ ArkFile() [1/2]

ArkFile::ArkFile ( const char * pszFile,
int nMode )

Find a file in the main archive.

Parameters
pszFileThe file, relative to the root of the game files.
nModeThe open mode. A mode that writes fails.
Ghidra address:
NTSC-U/C: 0x0028e670
Ghidra address:
PAL: 0x00298038

◆ ~ArkFile() [1/2]

ArkFile::~ArkFile ( )
override

Drop the reads still waiting for the disc.

Ghidra address:
NTSC-U/C: 0x0028e720
Ghidra address:
PAL: 0x002980e8

◆ ArkFile() [2/2]

ArkFile::ArkFile ( const char * name,
int mode )

Find a file in the archive.

Writing fails.

Parameters
nameThe path.
modeThe open mode, a combination of FileOpenMode bits.
Ghidra address:
0x1000e590

◆ ~ArkFile() [2/2]

virtual ArkFile::~ArkFile ( )
virtual

Drop the reads still waiting for blocks.

Ghidra address:
0x1000e660

Member Function Documentation

◆ ArchivePath()

const char * ArkFile::ArchivePath ( const char * pszPath)
static

Express a path relative to the root of the game files, as the archive records it.

Parameters
pszPathThe path.
Returns
A shared buffer the next call replaces.
Ghidra address:
NTSC-U/C: 0x0028e5f0
Ghidra address:
PAL: 0x00297fb8

◆ Read() [1/2]

int ArkFile::Read ( void * pBuffer,
int nBytes )
overridevirtual

Read bytes and wait for them.

Parameters
pBufferReceives the bytes.
nBytesThe number of bytes.
Returns
The number of bytes read, or 0 when the read did not start.
Ghidra address:
NTSC-U/C: 0x0028e798
Ghidra address:
PAL: 0x00298160

Implements File.

◆ ReadAsync() [1/2]

bool ArkFile::ReadAsync ( void * pBuffer,
int nBytes )
overridevirtual

Start reading bytes, one task for each block of the disc they cover.

Parameters
pBufferReceives the bytes.
nBytesThe number of bytes, cut at the end of the file.
Returns
Whether the read started, false at the end or while a read is waiting.
Ghidra address:
NTSC-U/C: 0x0028e808
Ghidra address:
PAL: 0x002981d0

Implements File.

◆ Write() [1/2]

int ArkFile::Write ( const void * pBuffer,
int nBytes )
overridevirtual

Report that an archive file cannot be written.

Parameters
pBufferThe bytes.
nBytesThe number of bytes.
Returns
0.
Ghidra address:
NTSC-U/C: 0x0028e9c8
Ghidra address:
PAL: 0x00298390

Implements File.

◆ Seek() [1/2]

int ArkFile::Seek ( int nOffset,
int nOrigin )
overridevirtual

Move the position.

Parameters
nOffsetThe offset.
nOriginThe origin of the offset. Another value leaves the position unchanged.
Returns
The new position.
Ghidra address:
NTSC-U/C: 0x0028e9f0
Ghidra address:
PAL: 0x002983b8

Implements File.

◆ Tell() [1/2]

int ArkFile::Tell ( )
inlineoverridevirtual

Report the position.

Returns
The position.
Ghidra address:
NTSC-U/C: 0x0028ea40
Ghidra address:
PAL: 0x00298408

Implements File.

◆ Flush() [1/2]

void ArkFile::Flush ( )
inlineoverridevirtual

Do nothing.

Ghidra address:
NTSC-U/C: 0x003a7f00
Ghidra address:
PAL: 0x00416be0

Implements File.

◆ Eof() [1/2]

bool ArkFile::Eof ( )
inlineoverridevirtual

Report whether the position is at the end.

Returns
Whether the position equals the size.
Ghidra address:
NTSC-U/C: 0x0028ea48
Ghidra address:
PAL: 0x00298410

Implements File.

◆ Fail() [1/2]

bool ArkFile::Fail ( )
inlineoverridevirtual

Report whether the file was not found.

Returns
Whether the file failed.
Ghidra address:
NTSC-U/C: 0x0028ea60
Ghidra address:
PAL: 0x00298428

Implements File.

◆ Size() [1/2]

int ArkFile::Size ( )
inlineoverridevirtual

Report the size.

Returns
The size in bytes.
Ghidra address:
NTSC-U/C: 0x0028ea70
Ghidra address:
PAL: 0x00298438

Implements File.

◆ UncompressedSize() [1/2]

int ArkFile::UncompressedSize ( )
inlineoverridevirtual

Report the size before compression.

Returns
The size in bytes.
Ghidra address:
NTSC-U/C: 0x0028ea78
Ghidra address:
PAL: 0x00298440

Implements File.

◆ ReadDone() [1/2]

bool ArkFile::ReadDone ( int * pnBytes)
overridevirtual

Advance the disc cache and report whether every task of the read finished.

Parameters
pnBytesReceives the number of bytes read once the read finished.
Returns
Whether the read finished.
Ghidra address:
NTSC-U/C: 0x0028eaa8
Ghidra address:
PAL: 0x00298470

Implements File.

◆ TaskDone() [1/2]

void ArkFile::TaskDone ( int nBytes)

Count a finished task of the read.

Parameters
nBytesThe bytes the task copied.
Ghidra address:
NTSC-U/C: 0x0028ea80
Ghidra address:
PAL: 0x00298448

◆ Read() [2/2]

virtual int ArkFile::Read ( void * data,
int bytes )
virtual

Read bytes and wait for them.

Parameters
dataReceives the bytes.
bytesThe number of bytes.
Returns
The number of bytes read, or zero when the read did not start.
Ghidra address:
0x1000e6c0

Implements File.

◆ ReadAsync() [2/2]

virtual bool ArkFile::ReadAsync ( void * data,
int bytes )
virtual

Queue a read of each block the bytes cover, at most up to the end of the file.

Parameters
dataReceives the bytes.
bytesThe number of bytes.
Returns
Whether the read started. A read fails to start at the end of the file or while another read is in progress.
Ghidra address:
0x1000e710

Implements File.

◆ Write() [2/2]

virtual int ArkFile::Write ( const void * data,
int bytes )
virtual

Fail, because the archive is read-only.

Parameters
dataThe bytes.
bytesThe number of bytes.
Returns
Zero.
Ghidra address:
0x1000e8e0

Implements File.

◆ Seek() [2/2]

virtual int ArkFile::Seek ( int offset,
int origin )
virtual

Move the position.

The position is not clamped.

Parameters
offsetThe offset.
originThe origin, one of BinStream::SeekType.
Returns
The new position.
Ghidra address:
0x1000e900

Implements File.

◆ Tell() [2/2]

virtual int ArkFile::Tell ( )
virtual

Report the position.

Returns
The position.
Ghidra address:
0x1000e940

Implements File.

◆ Flush() [2/2]

virtual void ArkFile::Flush ( )
virtual

Do nothing.

The linker merged the body with DebugPrint().

Ghidra address:
0x1000fb60

Implements File.

◆ Eof() [2/2]

virtual bool ArkFile::Eof ( )
virtual

Report whether the position is at the end.

Returns
Whether the end was arrived at.
Ghidra address:
0x1000e950

Implements File.

◆ Fail() [2/2]

virtual bool ArkFile::Fail ( )
virtual

Report whether the file was not found or was opened for writing.

Returns
Whether the file failed.
Ghidra address:
0x1000e970

Implements File.

◆ Size() [2/2]

virtual int ArkFile::Size ( )
virtual

Report the size in the archive.

Returns
The size in bytes.
Ghidra address:
0x1000e980

Implements File.

◆ UncompressedSize() [2/2]

virtual int ArkFile::UncompressedSize ( )
virtual

Report the size before compression.

Returns
The size in bytes.
Ghidra address:
0x1000e990

Implements File.

◆ ReadDone() [2/2]

virtual bool ArkFile::ReadDone ( int * bytes)
virtual

Poll the block manager and report whether every block of the read arrived.

Parameters
bytesReceives the number of bytes read when the read is complete.
Returns
Whether the read is complete.
Ghidra address:
0x1000e9c0

Implements File.

◆ TaskDone() [2/2]

void ArkFile::TaskDone ( int bytes)

Count the bytes one block delivered.

Parameters
bytesThe number of bytes.
Ghidra address:
0x1000e9a0

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