summaryrefslogtreecommitdiff
path: root/include/rvl/arc.h
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2011-03-12 23:17:12 +0100
committerTreeki <treeki@gmail.com>2011-03-12 23:17:12 +0100
commit7d4e4c0b34a613dd3c0220475ae4e448197522c1 (patch)
tree4f5cee367de3fdef4f9a7c84af59ffe76a2bb1c3 /include/rvl/arc.h
downloadkamek-7d4e4c0b34a613dd3c0220475ae4e448197522c1.tar.gz
kamek-7d4e4c0b34a613dd3c0220475ae4e448197522c1.zip
initial commit. now I can start playing with stuff!
Diffstat (limited to '')
-rwxr-xr-xinclude/rvl/arc.h115
1 files changed, 115 insertions, 0 deletions
diff --git a/include/rvl/arc.h b/include/rvl/arc.h
new file mode 100755
index 0000000..94d5d5b
--- /dev/null
+++ b/include/rvl/arc.h
@@ -0,0 +1,115 @@
+#ifndef __ARC_H__
+#define __ARC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct
+{
+ unsigned int magic;
+ int fstStart;
+ int fstSize;
+ int fileStart;
+ int reserve[4];
+
+} ARCHeader;
+
+#define DARCH_MAGIC 0x55aa382d
+
+typedef struct
+{
+ void* archiveStartAddr;
+ void* FSTStart;
+ void* fileStart;
+ u32 entryNum;
+ char* FSTStringStart;
+ u32 FSTLength;
+ u32 currDir;
+
+} ARCHandle;
+
+typedef struct
+{
+ ARCHandle* handle;
+ u32 startOffset;
+ u32 length;
+
+} ARCFileInfo;
+
+typedef struct
+{
+ ARCHandle* handle;
+ u32 entryNum;
+ u32 location;
+ u32 next;
+} ARCDir;
+
+typedef struct
+{
+ ARCHandle* handle;
+ u32 entryNum;
+ BOOL isDir;
+ char* name;
+} ARCDirEntry;
+
+
+BOOL ARCInitHandle(void* arcStart, ARCHandle* handle);
+BOOL ARCOpen(ARCHandle* handle, const char* fileName, ARCFileInfo* af);
+BOOL ARCFastOpen(ARCHandle* handle, s32 entrynum, ARCFileInfo* af);
+s32 ARCConvertPathToEntrynum(ARCHandle* handle, const char* pathPtr);
+void* ARCGetStartAddrInMem(ARCFileInfo* af);
+u32 ARCGetStartOffset(ARCFileInfo* af);
+u32 ARCGetLength(ARCFileInfo* af);
+BOOL ARCClose(ARCFileInfo* af);
+
+BOOL ARCChangeDir(ARCHandle* handle, const char* dirName);
+BOOL ARCGetCurrentDir(ARCHandle* handle, char* path, u32 maxlen);
+
+BOOL ARCOpenDir(ARCHandle* handle, const char* dirName, ARCDir* dir);
+BOOL ARCReadDir(ARCDir* dir, ARCDirEntry* dirent);
+BOOL ARCCloseDir(ARCDir* dir);
+
+/*---------------------------------------------------------------------------*
+ Name: ARCTellDir
+
+ Description: Returns the current location associated with the directory
+
+ Arguments: dir Pre-opened ARCDir* structure
+
+ Returns: current location
+ *---------------------------------------------------------------------------*/
+#define ARCTellDir(dir) ((dir)->location)
+
+/*---------------------------------------------------------------------------*
+ Name: ARCSeekDir
+
+ Description: Sets the position of the next ARCReadDir on the directory
+
+ Arguments: dir Pre-opened ARCDir* structure
+ loc location to set
+
+ Returns: None
+ *---------------------------------------------------------------------------*/
+#define ARCSeekDir(dir, loc) ((dir)->location = loc)
+
+/*---------------------------------------------------------------------------*
+ Name: ARCRewindDir
+
+ Description: Resets the position of the directory to the beginning
+
+ Arguments: dir Pre-opened ARCDir* structure
+
+ Returns: None
+ *---------------------------------------------------------------------------*/
+#define ARCRewindDir(dir) ((dir)->location = (dir)->entryNum + 1)
+
+#define ARCGetDirEntryName(dirent) ((dirent)->name)
+#define ARCDirEntryIsDir(dirent) ((dirent)->isDir)
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __ARC_H__