146 static int Open(
const char *pszPath);
168 static int Close(
const char *pszPath);
282 static int MapPathToArkIndex(
const char *pszPath,
char *pszName,
char *pszRelPath);
302 const char *pszRelPath)
const;
317 int mStringTabOffset;
322 int mOptimizedOffset;
324 int mHeaderReserved40;
325 int mHeaderReserved44;
326 int mHeaderReserved48;
333 void *mOptimizedTable;
334 int mOptimizedCursor;
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Mounted ark archive.
Definition openarkobject.h:136
friend int ArkfileLogicalToPhysicalSector(int nFile, int nSector)
Map a chunk of an archive to the chunk position the disc stores it at.
OpenArkObject()
Construct an unmounted archive.
void PrintHeader() const
Write every field of the copied archive header to standard output.
friend int ArkfileGetBaseSector(int nFile)
Report the disc sector a mounted archive starts at.
static int Close(const char *pszPath)
Unmount a previously mounted archive.
static ArkFileEntry * FindFileEntryByPath(const char *pszPath, char *pszName, char *pszRelPath, int *pnArk)
Find the entry of a file in whichever mounted archive the path maps to.
int OpenStream(ArkFileEntry *pEntry)
Open a stream on one file of this archive.
friend int SeekArkStream(int nStream, int nOffset, int nOrigin)
Move an ark stream's read position.
void PrintRelPaths() const
Write every entry of the relative path table to standard output.
void PrintFiles() const
Write every entry of the file table to standard output.
void DumpStrings() const
Write every file name and every relative path to standard output.
~OpenArkObject()
Release the tables the mount allocated.
void PrintAll() const
Write the header, the file table, the relative path table, and the strings, in that order.
static int Open(const char *pszPath)
Mount an ark archive by path.
constexpr int kArkRelPathBufferSize
Bytes every caller of OpenArkObject::FindFileEntryByPath() reserves for the relative path.
Definition openarkobject.h:38
short HashArkString(const char *pszName)
Hash a file name or a relative path for the table searches.
int ReadArkStreamThroughCache(int nHandle, void *pBuffer, unsigned nBytes)
Read from an ark stream through the sector cache.
int ArkfileLogicalToPhysicalSector(int nFile, int nSector)
Map a chunk of an archive to the chunk position the disc stores it at.
int CloseArk()
Unmount the archives InitArk() mounted.
constexpr int kArkMountPointSize
The number of bytes the mount point occupies, which is the rest of the record.
Definition openarkobject.h:14
constexpr char kArkRunComponent[]
Path component of the archive header that fixes the mount point.
Definition openarkobject.h:29
int ArkfileGetBaseSector(int nFile)
Report the disc sector a mounted archive starts at.
int IoctlFile(int nFile, int nRequest, void *pArg)
Forward a control request to sceIoctl().
constexpr char kArkDiscRoot[]
Directory the archives live in on the disc.
Definition openarkobject.h:23
constexpr int kArkNameBufferSize
Bytes every caller of OpenArkObject::FindFileEntryByPath() reserves for the file name.
Definition openarkobject.h:35
ArkFileEntry * FindOpenFileInArk(int nHandle)
Report the file entry a stream reads.
void WaitForFileIdle(int nFile)
Wait until no asynchronous operation is running on a file.
int OpenFileInArk(const char *pszPath)
Open a stream on a file inside a mounted archive.
constexpr int kArkSectorCacheRows
Rows the sector cache is asked for on the first mount.
Definition openarkobject.h:17
const char *const g_apSessionArkPaths[kSessionArkCount]
The archives InitArk() mounts for the session and CloseArk() unmounts: ark/root.ark,...
int GetArkfileIdFromFileFd(int nHandle)
Report the archive a stream reads from.
constexpr int kArkDevicePathSize
The number of bytes of the device path Open() builds on its stack.
Definition openarkobject.h:20
constexpr int kArkIndexAny
Archive index that asks OpenArkObject::FindFileEntryByPath() to search every mounted archive.
Definition openarkobject.h:45
std::vector< ArkStream > gOpenArkFileTable
Every stream open on a mounted archive.
constexpr char kArkHostRoot[]
Prefix that reads an archive over the host link instead.
Definition openarkobject.h:26
constexpr int kArkHeaderSize
The number of bytes of the archive header the mount copies into the record.
Definition openarkobject.h:8
constexpr int kArkVersion
The archive header version the mount accepts.
Definition openarkobject.h:11
ArkStream * LookupOpenFile(int nHandle)
Find the record of an open stream.
std::vector< OpenArkObject * > g_apMountedArks
Every archive mounted right now.
int InitArk()
Mount the archives the game needs for the whole session.
int EraseArkStream(int nHandle)
Erase a stream record by handle.
constexpr int kSessionArkCount
The number of archives in g_apSessionArkPaths.
Definition openarkobject.h:516
constexpr int kArkPathBufferSize
Bytes of the lowercased path copy OpenArkObject::FindFileEntryByPath() builds on its stack.
Definition openarkobject.h:32
int gOpenFileIndex
Handle OpenArkObject::OpenStream() gives the next stream, incremented after every open.
int GetArkFileLengthByPath(const char *pszPath)
Report the stored length of a file inside a mounted archive.
One entry of the archive's file table.
Definition openarkobject.h:56
int mSize
Definition openarkobject.h:64
unsigned short mNameHash
Definition openarkobject.h:57
unsigned short mSectorOffset
Definition openarkobject.h:61
short mRelPathIndex
Definition openarkobject.h:60
unsigned short mFlags
Definition openarkobject.h:58
int mLength
Definition openarkobject.h:63
int mNameOffset
Definition openarkobject.h:59
int mSector
Definition openarkobject.h:62
One entry of the archive's relative path table, which lists the directories the files are in.
Definition openarkobject.h:74
unsigned short mFlags
Definition openarkobject.h:76
int mPathOffset
Definition openarkobject.h:77
unsigned short mPathHash
Definition openarkobject.h:75
One open stream on a mounted archive.
Definition openarkobject.h:100
int mArkPosition
Definition openarkobject.h:110
int mPosition
Definition openarkobject.h:111
int mHandle
Definition openarkobject.h:113
OpenArkObject * FindArk() const
Find the mounted archive this stream reads from.
ArkFileEntry * mEntry
Definition openarkobject.h:114
int mFile
Definition openarkobject.h:112