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 <dol/mLib/m_dvd.h>
20 virtual void init(
const char *name) = 0;
28 virtual void *
execute(
void *data, u32 folderSig) = 0;
45 static void callback(
void *cbInfo,
void *file,
const ARCDirEntry *dirEntry,
const char *path);
77 bool set(
const char *arcName,
const char *containingFolder, u8 allocDirection,
EGG::Heap *heap);
87 const char *getName()
const {
return mName; }
88 int getRefCount()
const {
return mRefCount; }
89 void *getDvdCmd()
const {
return mpDvdCmd; }
139 bool setRes(
const char *arcName,
const char *containingFolder, u8 allocDir,
EGG::Heap *heap);
155 void *
getRes(
const char *arcName,
const char *resPath)
const;
165 void *
getRes(
const char *arcName,
const char *resPath,
unsigned long *size)
const;
178 void *
getRes(
const char *arcName,
const char *resPath,
unsigned long *size,
int *compressionType)
const;
182 void *
getResSilently(
const char *arcName,
const char *resPath)
const;
186 void *
getResSilently(
const char *arcName,
const char *resPath,
unsigned long *size)
const;
212 static void copyRes(
const void *from,
void *to,
int size);
215 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)=0
Executes the callback.
A class that holds information about an archive.
EGG::Archive * mpArchive
An EGG::Archive instance for this archive.
bool set(const char *arcName, const char *containingFolder, u8 allocDirection, EGG::Heap *heap)
Sets information about the archive to be loaded.
~info_c()
Destroys this info_c.
info_c()
Constructs a new info_c.
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.
void incRefCount()
Increments the reference count.
int setRes(callback_c *callback)
Attempts to load the archive into memory and load the resources with a callback.
EGG::FrmHeap * mDataHeap
The heap used for loading the resources of the archive. [No p because of the string "dRes_c::info_c::...
int loadRes(callback_c *callback)
Executes a callback on each file and folder of the archive.
u16 mRefCount
The number of references to this archive.
bool cleanup()
Unmounts the archive and frees the holder for use.
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.
A utility class for loading resource files (files contained within a .arc file).
~dRes_c()
Destroys this dRes_c.
info_c * newResInfo()
Gets a free info_c that can be used to store an archive reference.
u16 mNumArcs
The number of archive holders.
dRes_c()
Constructs a new dRes_c.
static void copyRes(const void *from, void *to, int size)
Copies an uncompressed resource.
info_c * getResInfoLoaded(const char *arcName) const
Gets the info_c for an archive, if it exists and has been loaded into memory.
static void(* mSetCallback)(const char *arcName, EGG::Heap *heap)
[Unused]. The callback for when dRes_c::info_c::set is called.
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 the archive as no longer needed.
void * getRes(const char *arcName, const char *resPath) const
Loads a resource.
info_c * mpArcInfos
An array of archive holders.
void * getResSilently(const char *arcName, const char *resPath) const
Loads 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)
Registers an archive to be loaded next.
bool init(u16 maxCount, callback_c *callback)
Initializes the dRes_c.
info_c * getResInfo(const char *arcName) const
Gets the info_c for an archive, if it exists.