JKRStdHeap, JKRArchive match

This commit is contained in:
Jasper St. Pierre
2023-09-24 12:14:12 -07:00
parent 76f4e19cdc
commit a13590ff21
7 changed files with 21 additions and 30 deletions
+3 -3
View File
@@ -756,7 +756,7 @@ config.libs = [
"JKernel",
[
Object(Matching, "JSystem/JKernel/JKRHeap.cpp"),
Object(NonMatching, "JSystem/JKernel/JKRStdHeap.cpp"),
Object(Matching, "JSystem/JKernel/JKRStdHeap.cpp"),
Object(NonMatching, "JSystem/JKernel/JKRExpHeap.cpp"),
Object(Matching, "JSystem/JKernel/JKRSolidHeap.cpp"),
Object(Matching, "JSystem/JKernel/JKRDisposer.cpp"),
@@ -769,8 +769,8 @@ config.libs = [
Object(Matching, "JSystem/JKernel/JKRFileLoader.cpp"),
Object(Matching, "JSystem/JKernel/JKRFileFinder.cpp"),
Object(Matching, "JSystem/JKernel/JKRFileCache.cpp"),
Object(NonMatching, "JSystem/JKernel/JKRArchivePub.cpp"),
Object(NonMatching, "JSystem/JKernel/JKRArchivePri.cpp"),
Object(Matching, "JSystem/JKernel/JKRArchivePub.cpp"),
Object(Matching, "JSystem/JKernel/JKRArchivePri.cpp"),
Object(Matching, "JSystem/JKernel/JKRMemArchive.cpp"),
Object(NonMatching, "JSystem/JKernel/JKRAramArchive.cpp"),
Object(NonMatching, "JSystem/JKernel/JKRDvdArchive.cpp"),
+4 -4
View File
@@ -41,8 +41,6 @@ inline u16 read_big_endian_u16(void* ptr) {
return ((u16)uptr[0] << 8) | ((u16)uptr[1]);
}
extern u32 sCurrentDirID__10JKRArchive; // JKRArchive::sCurrentDirID
class JKRArchive : public JKRFileLoader {
public:
struct SDirEntry {
@@ -118,7 +116,6 @@ public:
protected:
JKRArchive();
JKRArchive(long, EMountMode);
virtual ~JKRArchive();
public:
bool getDirEntry(SDirEntry*, u32) const;
@@ -165,6 +162,9 @@ public:
u8 getMountMode() const { return mMountMode; }
bool isFileEntry(u32 param_0) { return getFileAttribute(param_0) & 1; }
protected:
virtual ~JKRArchive();
public:
/* 0x00 */ // vtable
/* 0x04 */ // JKRFileLoader
@@ -189,7 +189,7 @@ public:
static JKRArchive* mount(void*, JKRHeap*, EMountDirection);
static JKRArchive* mount(s32, EMountMode, JKRHeap*, EMountDirection);
static void* getGlbResource(u32, const char*, JKRArchive*);
static void readTypeResource(void*, u32, u32, const char*, JKRArchive*);
static u32 readTypeResource(void*, u32, u32, const char*, JKRArchive*);
static JKRCompression convertAttrToCompressionType(u32 attr) {
#define JKRARCHIVE_ATTR_COMPRESSION 0x04
-5
View File
@@ -1,5 +0,0 @@
#ifndef JKRARCHIVEPRI_H
#define JKRARCHIVEPRI_H
#endif /* JKRARCHIVEPRI_H */
-5
View File
@@ -1,5 +0,0 @@
#ifndef JKRARCHIVEPUB_H
#define JKRARCHIVEPUB_H
#endif /* JKRARCHIVEPUB_H */
+1 -1
View File
@@ -16,7 +16,7 @@ public:
/* vt[09] */ void removeResourceAll(void); /* override */
/* vt[10] */ bool removeResource(void*); /* override */
/* vt[15] */ u32 getExpandedResSize(const void*) const; /* override */
/* vt[15] */ u32 getExpandedResSize(const void*) const; /* override */
/* vt[16] */ void* fetchResource(SDIFileEntry*, u32*); /* override */
/* vt[17] */ void* fetchResource(void*, u32, SDIFileEntry*, u32*); /* override */
+12 -11
View File
@@ -168,21 +168,22 @@ void* JKRArchive::getResource(u32 type, const char* path) {
/* 802B8528-802B85F0 .text readTypeResource__10JKRArchiveFPvUlUlPCcP10JKRArchive */
// missing instructions
void JKRArchive::readTypeResource(void* buffer, u32 bufferSize, u32 type, const char* path, JKRArchive* archive) {
/* Nonmatching */
u32 JKRArchive::readTypeResource(void* buffer, u32 bufferSize, u32 type, const char* path, JKRArchive* archive) {
u32 ret = 0;
if (archive) {
archive->readResource(buffer, bufferSize, type, path);
return;
}
JSUListIterator<JKRFileLoader> iterator;
for (iterator = sVolumeList.getFirst(); iterator != sVolumeList.getEnd(); iterator++) {
if (iterator->getVolumeType() == 'RARC') {
u32 result = iterator->readResource(buffer, bufferSize, type, path);
if (result != 0) {
return;
ret = archive->readResource(buffer, bufferSize, type, path);
} else {
for (JSUListIterator<JKRFileLoader> it = sVolumeList.getFirst(); it != sVolumeList.getEnd(); it++) {
if (it->getVolumeType() == 'RARC') {
ret = it->readResource(buffer, bufferSize, type, path);
if (ret != 0)
break;
}
}
}
return ret;
}
/* 802B85F0-802B86DC .text readResource__10JKRArchiveFPvUlUlPCc */
+1 -1
View File
@@ -24,10 +24,10 @@ JKRStdHeap* JKRStdHeap::create(u32 size, JKRHeap* parent, bool errorFlag) {
}
u8* memory = (u8*)JKRAllocFromHeap(parent, alignedSize, 0x20);
u32 stdHeapSize = ALIGN_NEXT(sizeof(JKRStdHeap), 0x20);
u8* dataPtr = (memory + stdHeapSize);
if (!memory) {
return NULL;
}
u8* dataPtr = (memory + stdHeapSize);
JKRStdHeap* newHeap = new(memory) JKRStdHeap(dataPtr, alignedSize - stdHeapSize, parent, errorFlag);
return newHeap;
}