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

The archive on the disc that the game files are read from. More...

#include <archive.h>

Public Member Functions

 Archive (const char *pszBasename)
 Find an archive on the disc and read its header from the host or disc file system.
bool GetFileInfo (const char *pszFile, long long *pnOffset, int *pnSize, int *pnUncompressedSize)
 Find a file in the archive.
void ReadHeader ()
 Read the file records and the name table of the archive.
const std::vector< FileEntry > & GetFileEntries () const
const String & GetBasename () const
 Archive (const char *basename)
 Open an archive and read its header.
bool GetFileInfo (const char *name, __int64 &offset, int &size, int &ucSize)
 Find a file.
void Read ()
 Read the header.

Static Public Member Functions

static void Init ()
 Open the main archive when the game runs from the disc, and build the disc cache.
static bool Locate (const char *pszFile, long long *pnOffset, int *pnSize, int *pnUncompressedSize)
 Find a file in the main archive.

Public Attributes

__int64 mArcBase

Detailed Description

The archive on the disc that the game files are read from.

Archive of the game files on the disc, gen/main.ark.

The class is not polymorphic and emits no RTTI, and the name is inferred.

The object is 0x48 bytes. The header stores the version, the file table, and the string hash table of the file and directory names.

Constructor & Destructor Documentation

◆ Archive() [1/2]

Archive::Archive ( const char * pszBasename)
explicit

Find an archive on the disc and read its header from the host or disc file system.

Parameters
pszBasenameThe archive, relative to the root of the game files.
Ghidra address:
NTSC-U/C: 0x0028e158
Ghidra address:
PAL: 0x00297b20

◆ Archive() [2/2]

Archive::Archive ( const char * basename)
explicit

Open an archive and read its header.

Parameters
basenameThe path of the archive.
Ghidra address:
0x1000d530

Member Function Documentation

◆ Init()

void Archive::Init ( )
static

Open the main archive when the game runs from the disc, and build the disc cache.

Ghidra address:
NTSC-U/C: 0x0028deb0
Ghidra address:
PAL: 0x00297890

◆ Locate()

bool Archive::Locate ( const char * pszFile,
long long * pnOffset,
int * pnSize,
int * pnUncompressedSize )
static

Find a file in the main archive.

Parameters
pszFileThe file, as ArkFile::ArchivePath() reports it.
pnOffsetReceives the byte of the disc the file starts at.
pnSizeReceives the size.
pnUncompressedSizeReceives the size before compression.
Returns
Whether the file was found, false without a main archive.
Ghidra address:
NTSC-U/C: 0x0028df10
Ghidra address:
PAL: 0x002978f0

◆ GetFileInfo() [1/2]

bool Archive::GetFileInfo ( const char * pszFile,
long long * pnOffset,
int * pnSize,
int * pnUncompressedSize )

Find a file in the archive.

Parameters
pszFileThe file, as ArkFile::ArchivePath() reports it.
pnOffsetReceives the byte of the disc the file starts at, or 0.
pnSizeReceives the size, or 0.
pnUncompressedSizeReceives the size before compression, or 0.
Returns
Whether the file was found.
Ghidra address:
NTSC-U/C: 0x0028e2a0
Ghidra address:
PAL: 0x00297c68

◆ ReadHeader()

void Archive::ReadHeader ( )

Read the file records and the name table of the archive.

Ghidra address:
NTSC-U/C: 0x0028e488
Ghidra address:
PAL: 0x00297e50

◆ GetFileEntries()

const std::vector< FileEntry > & Archive::GetFileEntries ( ) const
inline
Returns
The file records.

◆ GetBasename()

const String & Archive::GetBasename ( ) const
inline
Returns
The archive, relative to the root of the game files.

◆ GetFileInfo() [2/2]

bool Archive::GetFileInfo ( const char * name,
__int64 & offset,
int & size,
int & ucSize )

Find a file.

Parameters
nameThe file's path relative to the root.
offsetReceives the offset of the file in the archive.
sizeReceives the size of the file.
ucSizeReceives the size of the file before compression.
Returns
Whether the archive has the file. When the names hash but no entry matches, the outputs are cleared.
Ghidra address:
0x1000d5a0

◆ Read()

void Archive::Read ( )

Read the header.

Any version other than 2 is a failure.

Ghidra address:
0x1000d750

Member Data Documentation

◆ mArcBase

__int64 Archive::mArcBase

Offset added to every file offset.


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