mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-11 13:08:33 -04:00
JKRFileLoader, JKRFileFinder, and JKRThread (#60)
* JKRFileLoader OK * JKRFileFinder progress * JKRFileFinder OK * JKRFileCache fix virtual function signatures * added OSThread and OSContext types * JKRThread fixed nonmatching functions Co-authored-by: Julgodis <> Co-authored-by: Pheenoh <pheenoh@gmail.com>
This commit is contained in:
@@ -1,38 +1,96 @@
|
||||
#include "JSystem/JKernel/JKRFileFinder/JKRFileFinder.h"
|
||||
#include "JSystem/JKernel/JKRArchive/JKRArchive.h"
|
||||
#include "dvd/dvd.h"
|
||||
#include "global.h"
|
||||
|
||||
asm JKRArcFinder::JKRArcFinder(JKRArchive*, long, long) {
|
||||
nofralloc
|
||||
#include "JSystem/JKernel/JKRFileFinder/asm/func_802D4638.s"
|
||||
JKRArcFinder::JKRArcFinder(JKRArchive* archive, long startIndex, long numEntries)
|
||||
: JKRFileFinder() {
|
||||
mArchive = archive;
|
||||
mIsAvailable = numEntries > 0;
|
||||
mStartIndex = startIndex;
|
||||
mEndIndex = startIndex + numEntries - 1;
|
||||
mNextIndex = mStartIndex;
|
||||
findNextFile();
|
||||
}
|
||||
|
||||
asm bool JKRArcFinder::findNextFile(void) {
|
||||
nofralloc
|
||||
#include "JSystem/JKernel/JKRFileFinder/asm/func_802D46C4.s"
|
||||
bool JKRArcFinder::findNextFile(void) {
|
||||
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.type_flags;
|
||||
mIsFileOrDirectory = (mEntryTypeFlags >> 1) & 1;
|
||||
mNextIndex++;
|
||||
}
|
||||
}
|
||||
return mIsAvailable;
|
||||
}
|
||||
|
||||
asm JKRDvdFinder::JKRDvdFinder(char const*) {
|
||||
nofralloc
|
||||
#include "JSystem/JKernel/JKRFileFinder/asm/func_802D4770.s"
|
||||
JKRDvdFinder::JKRDvdFinder(const char* directory) : JKRFileFinder() {
|
||||
mDvdIsOpen = DVDOpenDir(directory, &mDvdDirectory);
|
||||
mIsAvailable = mDvdIsOpen;
|
||||
findNextFile();
|
||||
}
|
||||
|
||||
// JKRFileFinder::~JKRFileFinder is not inlined
|
||||
#ifdef NONMATCHING
|
||||
JKRDvdFinder::~JKRDvdFinder() {
|
||||
if (mDvdIsOpen) {
|
||||
DVDCloseDir(&mDvdDirectory);
|
||||
}
|
||||
}
|
||||
#else
|
||||
asm JKRDvdFinder::~JKRDvdFinder() {
|
||||
nofralloc
|
||||
#include "JSystem/JKernel/JKRFileFinder/asm/func_802D47F4.s"
|
||||
}
|
||||
#endif
|
||||
|
||||
// everything matches except:
|
||||
// u16 flags = 1;
|
||||
// if(mIsFileOrDirectory) flags = 2;
|
||||
// mEntryTypeFlags = flags;
|
||||
#ifdef NONMATCHING
|
||||
bool JKRDvdFinder::findNextFile(void) {
|
||||
if (mIsAvailable) {
|
||||
DVDDirectoryEntry directoryEntry;
|
||||
mIsAvailable = DVDReadDir(&mDvdDirectory, &directoryEntry);
|
||||
|
||||
if (mIsAvailable) {
|
||||
mIsFileOrDirectory = directoryEntry.is_directory != 0;
|
||||
mEntryName = directoryEntry.name;
|
||||
mEntryFileIndex = directoryEntry.entry_number;
|
||||
mEntryId = 0;
|
||||
|
||||
u16 flags = 1;
|
||||
if (mIsFileOrDirectory)
|
||||
flags = 2;
|
||||
mEntryTypeFlags = flags;
|
||||
}
|
||||
}
|
||||
|
||||
return mIsAvailable;
|
||||
}
|
||||
#else
|
||||
asm bool JKRDvdFinder::findNextFile(void) {
|
||||
nofralloc
|
||||
#include "JSystem/JKernel/JKRFileFinder/asm/func_802D4874.s"
|
||||
}
|
||||
#endif
|
||||
|
||||
asm JKRFileFinder::~JKRFileFinder() {
|
||||
nofralloc
|
||||
#include "JSystem/JKernel/JKRFileFinder/asm/func_802D4910.s"
|
||||
}
|
||||
JKRFileFinder::~JKRFileFinder() {}
|
||||
|
||||
// JKRFileFinder::~JKRFileFinder is not inlined (same problem as with JKRDvdFinder::~JKRDvdFinder)
|
||||
#ifdef NONMATCHING
|
||||
JKRArcFinder::~JKRArcFinder() {}
|
||||
#else
|
||||
asm JKRArcFinder::~JKRArcFinder() {
|
||||
nofralloc
|
||||
#include "JSystem/JKernel/JKRFileFinder/asm/func_802D4958.s"
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user