JKernel cleanup and DVD types (#59)

* JKRDecomp OK

* JKRFile and JKRDvdFile cleanup

* more DVD stuff and cleanup JKRDvdFile more

* formatting

* JKRHeap cleanup

* formatting

* JKRDisposer cleanup

* JKRAramBlock and JKRAramHeap cleanup

* fix merge error

* fixed comments

* forgot to save file...

* fix DVDCBcallback

Co-authored-by: Julgodis <>
This commit is contained in:
Jonathan Wase
2021-01-04 03:26:25 +01:00
committed by GitHub
parent 409257b111
commit 5217a4189e
13 changed files with 190 additions and 257 deletions
@@ -24,13 +24,14 @@ public:
void newGroupID(u8 groupId) { mGroupId = groupId; }
public:
JSULink<JKRAramBlock> mBlockLink;
u32 mAddress;
u32 mSize;
u32 mFreeSize;
u8 mGroupId;
u8 mIsTempMemory;
u8 padding[2];
/* 0x00 */ // vtable
/* 0x04 */ JSULink<JKRAramBlock> mBlockLink;
/* 0x14 */ u32 mAddress;
/* 0x18 */ u32 mSize;
/* 0x1C */ u32 mFreeSize;
/* 0x20 */ u8 mGroupId;
/* 0x21 */ u8 mIsTempMemory;
/* 0x22 */ u8 padding[2];
};
#endif
@@ -37,13 +37,15 @@ private:
void unlock() { OSUnlockMutex(&mMutex); }
public:
OSMutex mMutex;
JKRHeap* mHeap;
u32 mHeadAddress;
u32 mTailAddress;
u32 mSize;
u8 mGroupId;
u8 padding_0x41[3];
/* 0x00 */ // vtable
/* 0x04 */ // JKRDisposer
/* 0x18 */ OSMutex mMutex;
/* 0x30 */ JKRHeap* mHeap;
/* 0x34 */ u32 mHeadAddress;
/* 0x38 */ u32 mTailAddress;
/* 0x3C */ u32 mSize;
/* 0x40 */ u8 mGroupId;
/* 0x41 */ u8 padding_0x41[3];
};
#endif
@@ -11,8 +11,9 @@ public:
virtual ~JKRDisposer();
public:
JKRHeap* mHeap;
JSULink<JKRDisposer> mLink;
/* 0x00 */ // vtable
/* 0x04 */ JKRHeap* mHeap;
/* 0x08 */ JSULink<JKRDisposer> mLink;
};
#endif
+22 -23
View File
@@ -11,45 +11,44 @@ class JSUFileInputStream;
class JKRDvdFile : public JKRFile {
public:
JKRDvdFile();
JKRDvdFile(char const*);
JKRDvdFile(const char*);
JKRDvdFile(long);
virtual ~JKRDvdFile();
void initiate(void);
s32 sync(void);
int getFileID() const { return this->file_info.start_address << 2; }
int getFileID() const { return mFileInfo.start_address << 2; }
const DVDFileInfo* getFileInfo() const { return &this->file_info; }
const DVDFileInfo& getFileInfo() const { return mFileInfo; }
int getStatus() { return DVDGetCommandBlockStatus(&this->file_info); }
int getStatus() { return DVDGetCommandBlockStatus(&mFileInfo.block); }
public:
/* vt[03] */ virtual bool open(char const*); /* override */
/* vt[03] */ virtual bool open(const char*); /* override */
/* vt[04] */ virtual void close(void); /* override */
/* vt[05] */ virtual s32 readData(void*, long, long); /* override */
/* vt[06] */ virtual s32 writeData(void const*, long, long); /* override */
/* vt[06] */ virtual s32 writeData(const void*, long, long); /* override */
/* vt[07] */ virtual s32 getFileSize(void) const; /* override */
/* vt[08] */ virtual bool open(long);
private:
OSMutex mMutex1;
OSMutex mMutex2;
JKRADCommand* field_0x4c;
OSThread* field_0x50;
JSUFileInputStream* field_0x54;
u32 field_0x58;
DVDFileInfo file_info;
// s32 mFileID;
// s32 mFileSize;
// u32 field_0x94;
JKRDvdFile* mDvdFile;
OSMessageQueue mQueue1;
OSMessage mMessages1[1];
OSMessageQueue mQueue2;
OSMessage mMessages2[1];
JSULink<JKRDvdFile> mDvdLink;
OSThread* mOSThread;
/* 0x00 */ // vtable
/* 0x04 */ // JKRFile
/* 0x1C */ OSMutex mMutex1;
/* 0x34 */ OSMutex mMutex2;
/* 0x4C */ u32 field_0x4c;
/* 0x50 */ u32 field_0x50;
/* 0x54 */ u32 field_0x54;
/* 0x58 */ u32 field_0x58;
/* 0x5C */ DVDFileInfo mFileInfo;
/* 0x98 */ JKRDvdFile* mDvdFile;
/* 0x9C */ OSMessageQueue mMessageQueue1;
/* 0xBC */ OSMessage mMessage1;
/* 0xC0 */ OSMessageQueue mMessageQueue2;
/* 0xE0 */ OSMessage mMessage2;
/* 0xE4 */ JSULink<JKRDvdFile> mDvdLink;
/* 0xF4 */ OSThread* mOSThread;
public:
static void doneProcess(long, DVDFileInfo*);
+7 -5
View File
@@ -11,18 +11,20 @@ public:
s32 read(void*, long, long);
bool isAvailable() { return this->mIsAvailable; }
bool isAvailable() const { return this->mIsAvailable; }
public:
/* vt[03] */ virtual bool open(const char*) = 0;
/* vt[04] */ virtual void close() = 0;
/* vt[05] */ virtual s32 readData(void*, long, long) = 0;
/* vt[06] */ virtual s32 writeData(const void*, long, long) = 0;
/* vt[05] */ virtual s32 readData(void*, s32, s32) = 0;
/* vt[06] */ virtual s32 writeData(const void*, s32, s32) = 0;
/* vt[07] */ virtual s32 getFileSize() const = 0;
protected:
bool mIsAvailable;
u8 field_0x19[3];
/* 0x00 */ // vtable
/* 0x04 */ // JKRDisposer
/* 0x18 */ bool mIsAvailable;
/* 0x19 */ u8 field_0x19[3];
};
#endif
+23 -21
View File
@@ -27,7 +27,7 @@ public:
s32 getFreeSize();
void* getMaxFreeBlock();
s32 getTotalFreeSize();
u8 changeGroupID(u8 param_1);
u8 changeGroupID(u8 newGroupId);
s32 getMaxAllocatableSize(int alignment);
JKRHeap* find(void* ptr) const;
@@ -63,7 +63,7 @@ public:
/* vt[22] */ virtual bool state_compare(JKRHeap::TState const&, JKRHeap::TState const&) const;
/* vt[23] */ virtual void state_dump();
void setDebugFill(bool debugFill) { this->mDebugFill = debugFill; }
void setDebugFill(bool debugFill) { mDebugFill = debugFill; }
void* getStartAddr() const { return (void*)mStart; }
@@ -71,37 +71,39 @@ public:
u32 getSize() const { return mSize; }
bool getErrorFlag() { return mErrorFlag; }
bool getErrorFlag() const { return mErrorFlag; }
JKRHeap* getParent() {
JSUTree<JKRHeap>* parent = this->mChildTree.getParent();
JKRHeap* getParent() const {
JSUTree<JKRHeap>* parent = mChildTree.getParent();
return parent->getObject();
}
JSUTree<JKRHeap>& getHeapTree() { return this->mChildTree; }
JSUTree<JKRHeap>& getHeapTree() { return mChildTree; }
void appendDisposer(JKRDisposer* disposer) { mDisposerList.append(&disposer->mLink); }
void removeDisposer(JKRDisposer* disposer) { mDisposerList.remove(&disposer->mLink); }
void lock() { OSLockMutex(&this->mMutex); }
void lock() { OSLockMutex(&mMutex); }
void unlock() { OSUnlockMutex(&this->mMutex); }
void unlock() { OSUnlockMutex(&mMutex); }
protected:
OSMutex mMutex;
u32 mStart;
u32 mEnd;
u32 mSize;
bool mDebugFill;
bool mCheckMemoryFilled;
u8 mAllocationMode; // EAllocMode?
u8 mGroupId;
JSUTree<JKRHeap> mChildTree;
JSUList<JKRDisposer> mDisposerList;
bool mErrorFlag;
bool mInitFlag;
u8 padding_0x6a[2];
/* 0x00 */ // vtable
/* 0x04 */ // JKRDisposer
/* 0x18 */ OSMutex mMutex;
/* 0x30 */ u32 mStart;
/* 0x34 */ u32 mEnd;
/* 0x38 */ u32 mSize;
/* 0x3C */ bool mDebugFill;
/* 0x3D */ bool mCheckMemoryFilled;
/* 0x3E */ u8 mAllocationMode; // EAllocMode?
/* 0x3F */ u8 mGroupId;
/* 0x40 */ JSUTree<JKRHeap> mChildTree;
/* 0x5C */ JSUList<JKRDisposer> mDisposerList;
/* 0x68 */ bool mErrorFlag;
/* 0x69 */ bool mInitFlag;
/* 0x6A */ u8 padding_0x6a[2];
public:
static bool initArena(char**, u32*, int);
+13 -12
View File
@@ -20,7 +20,7 @@ typedef enum DVDState {
} DVDState;
}
class DVDDiskID {
struct DVDDiskID {
char game_name[4];
char company[2];
u8 disk_number;
@@ -30,10 +30,14 @@ class DVDDiskID {
u8 padding[22];
};
class DVDCommandBlock {
public:
struct DVDFileInfo;
struct DVDCommandBlock;
typedef void (*DVDCBCallback)(s32 result, DVDCommandBlock* block);
typedef void (*DVDCallback)(s32 result, DVDFileInfo* info);
struct DVDCommandBlock {
DVDCommandBlock* next;
DVDCommandBlock* previous;
DVDCommandBlock* prev;
u32 command;
s32 state;
u32 offset;
@@ -42,18 +46,15 @@ public:
u32 current_transfer_size;
u32 transferred_size;
DVDDiskID* disk_id;
u8 callback[4];
DVDCBCallback callback;
void* user_data;
};
// typedef void (*DVDCallback)(u32 result, DVDFileInfo *info);
class DVDFileInfo {
public:
struct DVDFileInfo {
DVDCommandBlock block;
u32 start_address;
u32 length;
u8 callback[4];
DVDCallback callback;
};
extern "C" {
@@ -62,8 +63,8 @@ s32 DVDClose(DVDFileInfo*);
void DVDReadPrio(DVDFileInfo*, void*, s32, s32, s32);
void DVDGetCurrentDiskID(void);
s32 DVDFastOpen(long, DVDFileInfo*);
int DVDGetCommandBlockStatus(DVDFileInfo*);
s32 DVDReadAsyncPrio(DVDFileInfo*, void*, long, long, void (*)(long, DVDFileInfo*), long);
int DVDGetCommandBlockStatus(DVDCommandBlock*);
s32 DVDReadAsyncPrio(DVDFileInfo*, void*, long, long, DVDCallback, long);
void DVDConvertPathToEntrynum(void);
DVDState DVDGetDriveStatus(void);
s32 DVDCheckDisk(void);
-18
View File
@@ -441,24 +441,6 @@ void initiate__6JUTXfbFUsUsP7JKRHeapl(void);
void common_init__6JUTXfbFl(void);
}
// DVD
// class DVDFileInfo;
// extern "C" {
// s32 DVDOpen(const char*, DVDFileInfo*);
// s32 DVDClose(DVDFileInfo*);
// void DVDReadPrio(DVDFileInfo*, void*, s32, s32, s32);
// void DVDGetCurrentDiskID(void);
// s32 DVDFastOpen(long, u8[48]);
// int DVDGetCommandBlockStatus(u8[48]);
// s32 DVDReadAsyncPrio(u8[48], void*, long, long, void (*)(long, DVDFileInfo*), long);
// void DVDConvertPathToEntrynum(void);
// void DVDChangeDir(void);
// void DVDCloseDir(void);
// void DVDOpenDir(void);
// void DVDReadDir(void);
// }
class mDoCPd_c;
extern "C" {
void mDoCPd_c_NS_recalibrate(void);
+2
View File
@@ -12,6 +12,8 @@ struct Vec {
float x, y, z;
};
#define JUT_ASSERT(...)
#include "dolphin/types.h"
#include "ar/ARQ.h"