From 40e126a35f9acf6fae1cc4404720f290df2d6885 Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Thu, 12 Mar 2026 12:46:54 +0100 Subject: [PATCH] Make JKRAramPiece trap on invalid pointers --- libs/JSystem/src/JKernel/JKRAramPiece.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libs/JSystem/src/JKernel/JKRAramPiece.cpp b/libs/JSystem/src/JKernel/JKRAramPiece.cpp index f01b530cfe..0946275b83 100644 --- a/libs/JSystem/src/JKernel/JKRAramPiece.cpp +++ b/libs/JSystem/src/JKernel/JKRAramPiece.cpp @@ -27,6 +27,10 @@ JSUList JKRAramPiece::sAramPieceCommandList; OSMutex JKRAramPiece::mMutex; +#if DEBUG && TARGET_PC +volatile u8 forceRead; +#endif + JKRAMCommand* JKRAramPiece::orderAsync(int direction, uintptr_t source, uintptr_t destination, u32 length, JKRAramBlock* block, JKRAMCommand::AsyncCallback callback) { lock(); @@ -45,6 +49,12 @@ JKRAMCommand* JKRAramPiece::orderAsync(int direction, uintptr_t source, uintptr_ JKRAramPiece::prepareCommand(direction, source, destination, length, block, callback); message->setting(1, command); +#if DEBUG && TARGET_PC + if (direction == ARAM_DIR_MRAM_TO_ARAM) { + forceRead = *reinterpret_cast(source); + } +#endif + OSSendMessage(&JKRAram::sMessageQueue, message, OS_MESSAGE_BLOCK); if (command->mCallback != NULL) { sAramPieceCommandList.append(&command->mPieceLink);