mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-08 10:03:06 -04:00
Fix AR DMAs & async DVD reads on 64-bit
We get to the health and safety screen!!
This commit is contained in:
@@ -27,8 +27,8 @@ public:
|
||||
|
||||
/* 0x40 */ s32 mTransferDirection;
|
||||
/* 0x44 */ u32 mDataLength;
|
||||
/* 0x48 */ u32 mSrc;
|
||||
/* 0x4C */ u32 mDst;
|
||||
/* 0x48 */ uintptr_t mSrc;
|
||||
/* 0x4C */ uintptr_t mDst;
|
||||
/* 0x50 */ JKRAramBlock* mAramBlock;
|
||||
/* 0x54 */ u32 field_0x54;
|
||||
/* 0x58 */ AsyncCallback mCallback;
|
||||
@@ -63,15 +63,15 @@ public:
|
||||
static JSUList<JKRAMCommand> sAramPieceCommandList;
|
||||
|
||||
public:
|
||||
static JKRAMCommand* prepareCommand(int, u32, u32, u32, JKRAramBlock*,
|
||||
static JKRAMCommand* prepareCommand(int, uintptr_t, uintptr_t, u32, JKRAramBlock*,
|
||||
JKRAMCommand::AsyncCallback);
|
||||
static void sendCommand(JKRAMCommand*);
|
||||
|
||||
static JKRAMCommand* orderAsync(int, u32, u32, u32, JKRAramBlock*, JKRAMCommand::AsyncCallback);
|
||||
static JKRAMCommand* orderAsync(int, uintptr_t, uintptr_t, u32, JKRAramBlock*, JKRAMCommand::AsyncCallback);
|
||||
static BOOL sync(JKRAMCommand*, int);
|
||||
static BOOL orderSync(int, u32, u32, u32, JKRAramBlock*);
|
||||
static BOOL orderSync(int, uintptr_t, uintptr_t, u32, JKRAramBlock*);
|
||||
static void startDMA(JKRAMCommand*);
|
||||
static void doneDMA(u32);
|
||||
static void doneDMA(uintptr_t);
|
||||
|
||||
private:
|
||||
static void lock() { OSLockMutex(&mMutex); }
|
||||
@@ -82,7 +82,7 @@ inline void JKRAramPcs_SendCommand(JKRAMCommand* command) {
|
||||
JKRAramPiece::sendCommand(command);
|
||||
}
|
||||
|
||||
inline BOOL JKRAramPcs(int direction, u32 source, u32 destination, u32 length,
|
||||
inline BOOL JKRAramPcs(int direction, uintptr_t source, uintptr_t destination, u32 length,
|
||||
JKRAramBlock* block) {
|
||||
return JKRAramPiece::orderSync(direction, source, destination, length, block);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*ARQCallback)(u32 pointerToARQRequest);
|
||||
typedef void (*ARQCallback)(uintptr_t pointerToARQRequest);
|
||||
|
||||
struct ARQRequest {
|
||||
/* 0x00 */ struct ARQRequest *next;
|
||||
@@ -59,7 +59,7 @@ void ARClear(u32 flag);
|
||||
// ARQ
|
||||
void ARQInit(void);
|
||||
void ARQReset(void);
|
||||
void ARQPostRequest(ARQRequest* request, u32 owner, u32 type, u32 priority, u32 source, u32 dest, u32 length, ARQCallback callback);
|
||||
void ARQPostRequest(ARQRequest* request, u32 owner, u32 type, u32 priority, uintptr_t source, uintptr_t dest, u32 length, ARQCallback callback);
|
||||
void ARQRemoveRequest(ARQRequest* request);
|
||||
void ARQRemoveOwnerRequest(u32 owner);
|
||||
void ARQFlushQueue(void);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
#include <dolphin/os.h>
|
||||
|
||||
JKRAMCommand* JKRAramPiece::prepareCommand(int direction, u32 src, u32 dst, u32 length,
|
||||
JKRAMCommand* JKRAramPiece::prepareCommand(int direction, uintptr_t src, uintptr_t dst, u32 length,
|
||||
JKRAramBlock* block,
|
||||
JKRAMCommand::AsyncCallback callback) {
|
||||
JKRAMCommand* command = new (JKRGetSystemHeap(), -4) JKRAMCommand();
|
||||
@@ -27,7 +27,7 @@ JSUList<JKRAMCommand> JKRAramPiece::sAramPieceCommandList;
|
||||
|
||||
OSMutex JKRAramPiece::mMutex;
|
||||
|
||||
JKRAMCommand* JKRAramPiece::orderAsync(int direction, u32 source, u32 destination, u32 length,
|
||||
JKRAMCommand* JKRAramPiece::orderAsync(int direction, uintptr_t source, uintptr_t destination, u32 length,
|
||||
JKRAramBlock* block, JKRAMCommand::AsyncCallback callback) {
|
||||
lock();
|
||||
if ((source & 0x1f) != 0 || (destination & 0x1f) != 0) {
|
||||
@@ -73,7 +73,7 @@ BOOL JKRAramPiece::sync(JKRAMCommand* command, int is_non_blocking) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL JKRAramPiece::orderSync(int direction, u32 source, u32 destination, u32 length,
|
||||
BOOL JKRAramPiece::orderSync(int direction, uintptr_t source, uintptr_t destination, u32 length,
|
||||
JKRAramBlock* block) {
|
||||
lock();
|
||||
|
||||
@@ -97,7 +97,7 @@ void JKRAramPiece::startDMA(JKRAMCommand* command) {
|
||||
command->mDst, command->mDataLength, JKRAramPiece::doneDMA);
|
||||
}
|
||||
|
||||
void JKRAramPiece::doneDMA(u32 requestAddress) {
|
||||
void JKRAramPiece::doneDMA(uintptr_t requestAddress) {
|
||||
JKRAMCommand* command = (JKRAMCommand*)requestAddress;
|
||||
|
||||
if (command->mTransferDirection == 1) {
|
||||
|
||||
@@ -103,7 +103,7 @@ JKRADCommand* JKRDvdAramRipper::callCommand_Async(JKRADCommand* command) {
|
||||
fileSize = ALIGN_NEXT(fileSize, 0x20);
|
||||
if (command->mExpandSwitch == 1) {
|
||||
u8 buffer[0x40];
|
||||
u8* bufPtr = (u8*)ALIGN_NEXT((u32)&buffer, 0x20);
|
||||
u8* bufPtr = (u8*)ALIGN_NEXT((uintptr_t)&buffer, 0x20);
|
||||
while (true) {
|
||||
s32 result = DVDReadPrio(dvdFile->getFileInfo(), bufPtr, 0x20, 0, 2);
|
||||
if (result >= 0) {
|
||||
@@ -472,7 +472,7 @@ static u32 dmaBufferFlush(u32 param_1) {
|
||||
return 0;
|
||||
}
|
||||
u32 size = ALIGN_NEXT(dmaCurrent - dmaBuf, 0x20);
|
||||
JKRAramPcs(0, (u32)dmaBuf, param_1, size, NULL);
|
||||
JKRAramPcs(0, (uintptr_t)dmaBuf, param_1, size, NULL);
|
||||
dmaCurrent = dmaBuf;
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ s32 JKRDvdFile::sync(void) {
|
||||
|
||||
void JKRDvdFile::doneProcess(s32 id, DVDFileInfo* fileInfo) {
|
||||
// fileInfo->field_0x3c looks like some kind of user pointer?
|
||||
JKRDvdFile* dvdFile = *(JKRDvdFile**)((u8*)fileInfo + 0x3c);
|
||||
JKRDvdFile* dvdFile = *(JKRDvdFile**)((u8*)fileInfo + (offsetof(JKRDvdFile, mDvdFile) - offsetof(JKRDvdFile, mFileInfo)));
|
||||
OSSendMessage(&dvdFile->mMessageQueue2, (OSMessage)id, OS_MESSAGE_NOBLOCK);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1297,7 +1297,7 @@ u32 ARInit(u32* stack_index_addr, u32 num_entries) {
|
||||
}
|
||||
|
||||
#pragma mark ARQ
|
||||
void ARQPostRequest(ARQRequest* request, u32 owner, u32 type, u32 priority, u32 source, u32 dest,
|
||||
void ARQPostRequest(ARQRequest* request, u32 owner, u32 type, u32 priority, uintptr_t source, uintptr_t dest,
|
||||
u32 length, ARQCallback callback) {
|
||||
// Emulate ARAM DMA transfers using memcpy.
|
||||
// type 0 = MRAM -> ARAM, type 1 = ARAM -> MRAM
|
||||
@@ -1319,7 +1319,7 @@ void ARQPostRequest(ARQRequest* request, u32 owner, u32 type, u32 priority, u32
|
||||
|
||||
// Immediately invoke the callback (synchronous on PC, no DMA latency)
|
||||
if (callback) {
|
||||
callback((u32)(uintptr_t)request);
|
||||
callback((uintptr_t)request);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user