3#include <lib/rvl/arc/ARC.h>
4#include <lib/egg/heap/eggHeap.hpp>
5#include <lib/egg/heap/eggFrmHeap.hpp>
6#include <lib/egg/archive.hpp>
7#include <game/mLib/m_dvd.h>
85 virtual void init(
const char *name) = 0;
94 virtual void *
execute(
void *data, u32 folderSig,
const char* path) = 0;
111 static void callback(
void *cbInfo,
void *file,
const ARCDirEntry *dirEntry,
const char *path);
173 bool set(
const char *arcName,
const char *containingFolder, u8 allocDirection,
EGG::Heap *heap);
183 const char *getName()
const {
return mName; }
184 int getRefCount()
const {
return mRefCount; }
243 bool setRes(
const char *arcName,
const char *containingFolder, u8 allocDir,
EGG::Heap *heap);
260 void *
getRes(
const char *arcName,
const char *resPath)
const;
270 void *
getRes(
const char *arcName,
const char *resPath,
unsigned long *size)
const;
285 void *
getRes(
const char *arcName,
const char *resPath,
unsigned long *size,
int *compressionType)
const;
289 void *
getResSilently(
const char *arcName,
const char *resPath)
const;
293 void *
getResSilently(
const char *arcName,
const char *resPath,
unsigned long *size)
const;
321 static void copyRes(
const void *from,
void *to,
int size);
326 static void copyRes(
const void *from,
void *to,
int size,
int compressionType);
A callback class for processing resources.
virtual void init(const char *name)=0
Initializes the callback with the resource name.
virtual void * execute(void *data, u32 folderSig, const char *path)=0
Executes the callback.
EGG::Archive * mpArchive
The accessor for this archive.
bool set(const char *arcName, const char *containingFolder, u8 allocDirection, EGG::Heap *heap)
Sets information about the archive to be loaded.
mDvd_mountMemArchive_c * getDvdCmd() const
Gets the file loading command.
~info_c()
Destroys the archive holder.
LOAD_STATUS_e
The loading status of the archive.
@ LOAD_IN_PROGRESS
The archive is currently being loaded.
@ LOAD_SUCCESS
The archive was loaded successfully.
@ LOAD_ERROR
An error occurred while loading the archive.
info_c()
Constructs a new archive holder.
EGG::Heap * mpMountHeap
The heap used for mounting the archive.
mDvd_mountMemArchive_c * mpDvdCmd
The DVD command for mounting the archive.
void decRefCount()
Decrements the reference count.
char mName[0x20]
The name of the archive.
void * mpArcBinary
The raw archive data.
u8 ** mpFiles
An array of pointers to the data of each loaded resource.
int mArchiveSize
The archive size.
void incRefCount()
Increments the reference count.
LOAD_STATUS_e loadRes(callback_c *callback)
Builds the resource list and executes a callback on each file and directory.
EGG::FrmHeap * mDataHeap
The heap used for loading the resources of the archive.
u16 mRefCount
The number of references to this archive.
EGG::Archive * getArchive() const
Gets the archive accessor.
bool cleanup()
Unmounts the archive and frees the holder for use.
LOAD_STATUS_e setRes(callback_c *callback)
Attempts to load the archive into memory and load the resources with a callback.
A callback class for EGG::Archive::searchInside.
searchCallback_c(callback_c *callback, u8 **files, int numFiles, int fileIdx, u32 folderSig)
Constructs a new searchCallback_c.
unsigned int mFileIdx
The index of the current file in mpFiles.
callback_c * mpCallback
The file processing callback.
u32 mFolderSig
The first 4 characters of the current folder.
u8 ** mpFiles
An array of pointers to the data of each loaded resource.
static void callback(void *cbInfo, void *file, const ARCDirEntry *dirEntry, const char *path)
The callback function.
int mNumFiles
The number of files in mpFiles.
An archive resource management class.
~dRes_c()
Destroys the manager.
info_c * newResInfo()
Gets a free archive holder that can be used to store an archive reference.
u16 mNumArcs
The number of archive holders.
dRes_c()
Constructs a new manager.
static void copyRes(const void *from, void *to, int size)
Copies an uncompressed resource.
info_c * getResInfoLoaded(const char *arcName) const
Gets the holder for a loaded archive.
static void(* mSetCallback)(const char *arcName, EGG::Heap *heap)
[Unused]. The callback for when an archive is scheduled for loading.
callback_c * mpCallback
The callback for when a resource is loaded.
bool syncAllRes()
Attempts to load the resources of an archive that has finished loading since the last call to this fu...
bool deleteRes(const char *arcName)
Marks an archive as no longer needed.
void * getRes(const char *arcName, const char *resPath) const
Gets a resource.
info_c * mpArcInfos
An array of archive holders.
void * getResSilently(const char *arcName, const char *resPath) const
Gets a resource without logging a message if the resource is not found.
bool setRes(const char *arcName, const char *containingFolder, u8 allocDir, EGG::Heap *heap)
Schedules an archive for loading.
bool init(u16 maxCount, callback_c *callback)
Initializes the manager by allocating the archive holders and setting the callback.
info_c * getResInfo(const char *arcName) const
Gets the holder for an archive.