mirror of
https://github.com/zeldaret/tww.git
synced 2026-07-07 13:23:27 -04:00
JKRFileFinder
This commit is contained in:
+1
-1
@@ -767,7 +767,7 @@ config.libs = [
|
||||
Object(Matching, "JSystem/JKernel/JKRAramPiece.cpp"),
|
||||
Object(NonMatching, "JSystem/JKernel/JKRAramStream.cpp"),
|
||||
Object(Matching, "JSystem/JKernel/JKRFileLoader.cpp"),
|
||||
Object(NonMatching, "JSystem/JKernel/JKRFileFinder.cpp"),
|
||||
Object(Matching, "JSystem/JKernel/JKRFileFinder.cpp"),
|
||||
Object(NonMatching, "JSystem/JKernel/JKRFileCache.cpp"),
|
||||
Object(NonMatching, "JSystem/JKernel/JKRArchivePub.cpp"),
|
||||
Object(NonMatching, "JSystem/JKernel/JKRArchivePri.cpp"),
|
||||
|
||||
@@ -16,7 +16,7 @@ public:
|
||||
mIsAvailable = false;
|
||||
mIsFileOrDirectory = false;
|
||||
}
|
||||
inline virtual ~JKRFileFinder();
|
||||
inline virtual ~JKRFileFinder() {};
|
||||
|
||||
bool isAvailable() const { return mIsAvailable; }
|
||||
bool isFile() const { return mIsFileOrDirectory; }
|
||||
@@ -37,7 +37,7 @@ class JKRArchive;
|
||||
class JKRArcFinder : public JKRFileFinder {
|
||||
public:
|
||||
JKRArcFinder(JKRArchive*, s32, s32);
|
||||
inline virtual ~JKRArcFinder();
|
||||
inline virtual ~JKRArcFinder() {};
|
||||
|
||||
public:
|
||||
/* vt[3] */ virtual bool findNextFile(void); /* override */
|
||||
|
||||
@@ -4,34 +4,73 @@
|
||||
//
|
||||
|
||||
#include "JSystem/JKernel/JKRFileFinder.h"
|
||||
#include "JSystem/JKernel/JKRArchive.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
/* 802B6CB8-802B6D44 .text __ct__12JKRArcFinderFP10JKRArchivell */
|
||||
JKRArcFinder::JKRArcFinder(JKRArchive*, long, long) {
|
||||
/* Nonmatching */
|
||||
JKRArcFinder::JKRArcFinder(JKRArchive* archive, s32 startIndex, s32 numEntries) {
|
||||
mArchive = archive;
|
||||
mIsAvailable = numEntries > 0;
|
||||
mStartIndex = startIndex;
|
||||
mEndIndex = startIndex + numEntries - 1;
|
||||
mNextIndex = mStartIndex;
|
||||
findNextFile();
|
||||
}
|
||||
|
||||
/* 802B6D44-802B6DF0 .text findNextFile__12JKRArcFinderFv */
|
||||
void JKRArcFinder::findNextFile() {
|
||||
/* Nonmatching */
|
||||
bool JKRArcFinder::findNextFile() {
|
||||
JKRArchive::SDirEntry entry;
|
||||
|
||||
if (mIsAvailable) {
|
||||
mIsAvailable = !(mNextIndex > mEndIndex);
|
||||
if (mIsAvailable) {
|
||||
mIsAvailable = mArchive->getDirEntry(&entry, mNextIndex);
|
||||
mEntryName = entry.name;
|
||||
mEntryFileIndex = mNextIndex;
|
||||
mEntryId = entry.id;
|
||||
mEntryTypeFlags = entry.flags;
|
||||
mIsFileOrDirectory = (mEntryTypeFlags >> 1) & 1;
|
||||
mNextIndex++;
|
||||
}
|
||||
}
|
||||
return mIsAvailable;
|
||||
}
|
||||
|
||||
/* 802B6DF0-802B6E74 .text __ct__12JKRDvdFinderFPCc */
|
||||
JKRDvdFinder::JKRDvdFinder(const char*) {
|
||||
/* Nonmatching */
|
||||
JKRDvdFinder::JKRDvdFinder(const char* directory) {
|
||||
mDvdIsOpen = DVDOpenDir(directory, &mDvdDirectory);
|
||||
mIsAvailable = mDvdIsOpen;
|
||||
findNextFile();
|
||||
}
|
||||
|
||||
/* 802B6E74-802B6EF4 .text __dt__12JKRDvdFinderFv */
|
||||
JKRDvdFinder::~JKRDvdFinder() {
|
||||
/* Nonmatching */
|
||||
if (mDvdIsOpen) {
|
||||
DVDCloseDir(&mDvdDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
/* 802B6EF4-802B6F90 .text findNextFile__12JKRDvdFinderFv */
|
||||
void JKRDvdFinder::findNextFile() {
|
||||
/* Nonmatching */
|
||||
}
|
||||
bool JKRDvdFinder::findNextFile() {
|
||||
if (mIsAvailable) {
|
||||
DVDDirectoryEntry directoryEntry;
|
||||
mIsAvailable = DVDReadDir(&mDvdDirectory, &directoryEntry);
|
||||
|
||||
/* 802B6F90-802B6FEC .text __dt__12JKRArcFinderFv */
|
||||
JKRArcFinder::~JKRArcFinder() {
|
||||
/* Nonmatching */
|
||||
if (mIsAvailable) {
|
||||
mIsFileOrDirectory = directoryEntry.is_directory != 0;
|
||||
mEntryName = directoryEntry.name;
|
||||
mEntryFileIndex = directoryEntry.entry_number;
|
||||
mEntryId = 0;
|
||||
|
||||
// only matches with enum
|
||||
// TODO: placeholder
|
||||
enum EntryTypeFlags {
|
||||
EntryTypeFlags1 = 1,
|
||||
EntryTypeFlags2 = 2,
|
||||
};
|
||||
mEntryTypeFlags = mIsFileOrDirectory ? EntryTypeFlags2 : EntryTypeFlags1;
|
||||
}
|
||||
}
|
||||
|
||||
return mIsAvailable;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user