mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 14:41:38 -04:00
80ef14e480
* match and link JKRAram.cpp * match and link JKRExpHeap * match and link JKRAramStream.cpp * match and link JKRFileLoader.cpp * match and link JKRFileFinder.cpp * JKernel Dump * match and link JKRAramArchive.cpp * match and link JKRDvdArchive.cpp * match and link JKRCompArchive.cpp * match but not link JKRDvdAramRipper * small refactors * match and link JKRThread.cpp * fix and link JKRDvdAramStream.cpp * Formatting fixes --------- Co-authored-by: SwareJonge <olaf23okken@gmail.com>
81 lines
1.9 KiB
C++
81 lines
1.9 KiB
C++
#ifndef JKRDVDFILE_H
|
|
#define JKRDVDFILE_H
|
|
|
|
#include "JSystem/JKernel/JKRAram.h"
|
|
#include "JSystem/JKernel/JKRFile.h"
|
|
#include "JSystem/JSupport/JSUStream.h"
|
|
|
|
class JKRDvdFile;
|
|
|
|
struct JKRDvdFileInfo : public DVDFileInfo {
|
|
JKRDvdFile* mFile;
|
|
};
|
|
|
|
class JKRDvdFile : public JKRFile {
|
|
public:
|
|
JKRDvdFile();
|
|
JKRDvdFile(const char* filename);
|
|
JKRDvdFile(s32 entrynum);
|
|
|
|
virtual ~JKRDvdFile();
|
|
|
|
virtual bool open(const char* filename);
|
|
virtual bool close();
|
|
virtual int readData(void* data, s32 length, s32 ofs);
|
|
virtual int writeData(const void* data, s32 length, s32 ofs);
|
|
virtual u32 getFileSize() const { return this->mDvdFileInfo.length; }
|
|
virtual bool open(s32 entrynum);
|
|
|
|
inline DVDFileInfo* getFileInfo() {
|
|
return &this->mDvdFileInfo;
|
|
}
|
|
|
|
inline int readDataAsync(void* addr, s32 length, s32 offset) {
|
|
OSLockMutex(&this->mDvdMutex);
|
|
s32 retAddr;
|
|
|
|
if (this->mDvdThread != nullptr) {
|
|
OSUnlockMutex(&this->mDvdMutex);
|
|
retAddr = -1;
|
|
}
|
|
else {
|
|
this->mDvdThread = OSGetCurrentThread();
|
|
retAddr = -1;
|
|
if (DVDReadAsync(&this->mDvdFileInfo, addr, length, offset, JKRDvdFile::doneProcess)) {
|
|
retAddr = this->sync();
|
|
}
|
|
|
|
this->mDvdThread = nullptr;
|
|
OSUnlockMutex(&this->mDvdMutex);
|
|
}
|
|
|
|
return retAddr;
|
|
}
|
|
|
|
inline int writeDataAsync(const void* data, s32 length, s32 offset) { return -1; }
|
|
|
|
void initiate();
|
|
s32 sync();
|
|
|
|
static void doneProcess(s32 result, DVDFileInfo* info);
|
|
|
|
static JSUList<JKRDvdFile> sDvdList;
|
|
|
|
public:
|
|
OSMutex mDvdMutex;
|
|
OSMutex mAramMutex;
|
|
JKRAramBlock* mAramBlock;
|
|
OSThread* mAramThread;
|
|
JSUFileInputStream* mInputStream;
|
|
u32 _58;
|
|
JKRDvdFileInfo mDvdFileInfo;
|
|
OSMessageQueue mAramMessageQueue;
|
|
OSMessage mAramMessage;
|
|
OSMessageQueue mDvdMessageQueue;
|
|
OSMessage mDvdMessage;
|
|
JSULink<JKRDvdFile> mLink;
|
|
OSThread* mDvdThread;
|
|
};
|
|
|
|
#endif
|