replace OS_MESSAGE_NON_BLOCKING and OS_MESSAGE_BLOCKING with OS_MESSAGE_NOBLOCK and OS_MESSAGE_BLOCK

This commit is contained in:
Jcw87 2023-04-24 21:10:38 -07:00
parent af265612c1
commit 3477aaa1cb
11 changed files with 27 additions and 30 deletions

View File

@ -81,23 +81,23 @@ public:
protected: protected:
void resume() { OSResumeThread(mThreadRecord); } void resume() { OSResumeThread(mThreadRecord); }
void sendMessage(OSMessage message) { void sendMessage(OSMessage message) {
OSSendMessage(&mMessageQueue, message, OS_MESSAGE_NON_BLOCKING); OSSendMessage(&mMessageQueue, message, OS_MESSAGE_NOBLOCK);
} }
void sendMessageBlock(OSMessage message) { void sendMessageBlock(OSMessage message) {
OSSendMessage(&mMessageQueue, message, OS_MESSAGE_BLOCKING); OSSendMessage(&mMessageQueue, message, OS_MESSAGE_BLOCK);
} }
OSMessage waitMessage() { OSMessage waitMessage() {
OSMessage message; OSMessage message;
OSReceiveMessage(&mMessageQueue, &message, OS_MESSAGE_NON_BLOCKING); OSReceiveMessage(&mMessageQueue, &message, OS_MESSAGE_NOBLOCK);
return message; return message;
} }
OSMessage waitMessageBlock() { OSMessage waitMessageBlock() {
OSMessage message; OSMessage message;
OSReceiveMessage(&mMessageQueue, &message, OS_MESSAGE_BLOCKING); OSReceiveMessage(&mMessageQueue, &message, OS_MESSAGE_BLOCK);
return message; return message;
} }
void jamMessageBlock(OSMessage message) { void jamMessageBlock(OSMessage message) {
OSJamMessage(&mMessageQueue, message, OS_MESSAGE_BLOCKING); OSJamMessage(&mMessageQueue, message, OS_MESSAGE_BLOCK);
} }
private: private:

View File

@ -38,9 +38,6 @@ extern "C" {
#define OS_BASE_CACHED (OS_CACHED_REGION_PREFIX << 16) #define OS_BASE_CACHED (OS_CACHED_REGION_PREFIX << 16)
#define OS_BASE_UNCACHED (OS_UNCACHED_REGION_PREFIX << 16) #define OS_BASE_UNCACHED (OS_UNCACHED_REGION_PREFIX << 16)
#define OS_MESSAGE_NON_BLOCKING 0
#define OS_MESSAGE_BLOCKING 1
#define OS_CONSOLE_MASK 0xf0000000 #define OS_CONSOLE_MASK 0xf0000000
#define OS_CONSOLE_RETAIL 0x00000000 #define OS_CONSOLE_RETAIL 0x00000000
#define OS_CONSOLE_DEVELOPMENT 0x10000000 #define OS_CONSOLE_DEVELOPMENT 0x10000000

View File

@ -520,7 +520,7 @@ static void waitForTick(u32 param_0, u16 param_1) {
OSMessage msg; OSMessage msg;
do { do {
if (!OSReceiveMessage(JUTVideo::getManager()->getMessageQueue(), &msg, if (!OSReceiveMessage(JUTVideo::getManager()->getMessageQueue(), &msg,
OS_MESSAGE_BLOCKING)) { OS_MESSAGE_BLOCK)) {
msg = NULL; msg = NULL;
} }
} while ((int)msg - nextCount > 0); } while ((int)msg - nextCount > 0);

View File

@ -158,7 +158,7 @@ void* JKRAram::run(void) {
JKRAramPiece::Message* message; JKRAramPiece::Message* message;
OSInitMessageQueue(&sMessageQueue, sMessageBuffer, 4); OSInitMessageQueue(&sMessageQueue, sMessageBuffer, 4);
do { do {
OSReceiveMessage(&sMessageQueue, (OSMessage*)&message, OS_MESSAGE_BLOCKING); OSReceiveMessage(&sMessageQueue, (OSMessage*)&message, OS_MESSAGE_BLOCK);
result = message->field_0x00; result = message->field_0x00;
command = message->command; command = message->command;
delete message; delete message;

View File

@ -57,7 +57,7 @@ JKRAMCommand* JKRAramPiece::orderAsync(int direction, u32 source, u32 destinatio
message->field_0x00 = 1; message->field_0x00 = 1;
message->command = command; message->command = command;
OSSendMessage(&JKRAram::sMessageQueue, message, OS_MESSAGE_BLOCKING); OSSendMessage(&JKRAram::sMessageQueue, message, OS_MESSAGE_BLOCK);
if (command->mCallback != NULL) { if (command->mCallback != NULL) {
sAramPieceCommandList.append(&command->mPieceLink); sAramPieceCommandList.append(&command->mPieceLink);
} }
@ -72,13 +72,13 @@ BOOL JKRAramPiece::sync(JKRAMCommand* command, int is_non_blocking) {
lock(); lock();
if (is_non_blocking == 0) { if (is_non_blocking == 0) {
OSReceiveMessage(&command->mMessageQueue, &message, OS_MESSAGE_BLOCKING); OSReceiveMessage(&command->mMessageQueue, &message, OS_MESSAGE_BLOCK);
sAramPieceCommandList.remove(&command->mPieceLink); sAramPieceCommandList.remove(&command->mPieceLink);
unlock(); unlock();
return TRUE; return TRUE;
} }
BOOL result = OSReceiveMessage(&command->mMessageQueue, &message, OS_MESSAGE_NON_BLOCKING); BOOL result = OSReceiveMessage(&command->mMessageQueue, &message, OS_MESSAGE_NOBLOCK);
if (!result) { if (!result) {
unlock(); unlock();
return FALSE; return FALSE;
@ -134,9 +134,9 @@ void JKRAramPiece::doneDMA(u32 requestAddress) {
if (command->mCallback) { if (command->mCallback) {
(*command->mCallback)(requestAddress); (*command->mCallback)(requestAddress);
} else if (command->field_0x5C) { } else if (command->field_0x5C) {
OSSendMessage(command->field_0x5C, command, OS_MESSAGE_NON_BLOCKING); OSSendMessage(command->field_0x5C, command, OS_MESSAGE_NOBLOCK);
} else { } else {
OSSendMessage(&command->mMessageQueue, command, OS_MESSAGE_NON_BLOCKING); OSSendMessage(&command->mMessageQueue, command, OS_MESSAGE_NOBLOCK);
} }
} }

View File

@ -51,7 +51,7 @@ void* JKRAramStream::run() {
for (;;) { for (;;) {
OSMessage message; OSMessage message;
OSReceiveMessage(&sMessageQueue, &message, OS_MESSAGE_BLOCKING); OSReceiveMessage(&sMessageQueue, &message, OS_MESSAGE_BLOCK);
JKRAramStreamCommand* command = (JKRAramStreamCommand*)message; JKRAramStreamCommand* command = (JKRAramStreamCommand*)message;
switch (command->mType) { switch (command->mType) {
@ -173,7 +173,7 @@ JKRAramStreamCommand* JKRAramStream::write_StreamToAram_Async(JSUFileInputStream
} }
OSInitMessageQueue(&command->mMessageQueue, &command->mMessage, 1); OSInitMessageQueue(&command->mMessageQueue, &command->mMessage, 1);
OSSendMessage(&sMessageQueue, command, OS_MESSAGE_BLOCKING); OSSendMessage(&sMessageQueue, command, OS_MESSAGE_BLOCK);
return command; return command;
} }
@ -182,7 +182,7 @@ JKRAramStreamCommand* JKRAramStream::write_StreamToAram_Async(JSUFileInputStream
JKRAramStreamCommand* JKRAramStream::sync(JKRAramStreamCommand* command, BOOL isNonBlocking) { JKRAramStreamCommand* JKRAramStream::sync(JKRAramStreamCommand* command, BOOL isNonBlocking) {
OSMessage message; OSMessage message;
if (isNonBlocking == 0) { if (isNonBlocking == 0) {
OSReceiveMessage(&command->mMessageQueue, &message, OS_MESSAGE_BLOCKING); OSReceiveMessage(&command->mMessageQueue, &message, OS_MESSAGE_BLOCK);
if (message == NULL) { if (message == NULL) {
command = NULL; command = NULL;
return command; return command;
@ -191,7 +191,7 @@ JKRAramStreamCommand* JKRAramStream::sync(JKRAramStreamCommand* command, BOOL is
} }
} else { } else {
BOOL receiveResult = BOOL receiveResult =
OSReceiveMessage(&command->mMessageQueue, &message, OS_MESSAGE_NON_BLOCKING); OSReceiveMessage(&command->mMessageQueue, &message, OS_MESSAGE_NOBLOCK);
if (receiveResult == FALSE) { if (receiveResult == FALSE) {
command = NULL; command = NULL;
return command; return command;

View File

@ -83,7 +83,7 @@ void* JKRDecomp::run() {
OSInitMessageQueue(&sMessageQueue, sMessageBuffer, 8); OSInitMessageQueue(&sMessageQueue, sMessageBuffer, 8);
for (;;) { for (;;) {
OSMessage message; OSMessage message;
OSReceiveMessage(&sMessageQueue, &message, OS_MESSAGE_BLOCKING); OSReceiveMessage(&sMessageQueue, &message, OS_MESSAGE_BLOCK);
JKRDecompCommand* command = (JKRDecompCommand*)message; JKRDecompCommand* command = (JKRDecompCommand*)message;
decode(command->mSrcBuffer, command->mDstBuffer, command->mSrcLength, command->mDstLength); decode(command->mSrcBuffer, command->mDstBuffer, command->mSrcLength, command->mDstLength);
@ -101,9 +101,9 @@ void* JKRDecomp::run() {
} }
if (command->field_0x1c) { if (command->field_0x1c) {
OSSendMessage(command->field_0x1c, (OSMessage)1, OS_MESSAGE_NON_BLOCKING); OSSendMessage(command->field_0x1c, (OSMessage)1, OS_MESSAGE_NOBLOCK);
} else { } else {
OSSendMessage(&command->mMessageQueue, (OSMessage)1, OS_MESSAGE_NON_BLOCKING); OSSendMessage(&command->mMessageQueue, (OSMessage)1, OS_MESSAGE_NOBLOCK);
} }
} }
} }
@ -125,7 +125,7 @@ JKRDecompCommand* JKRDecomp::prepareCommand(u8* srcBuffer, u8* dstBuffer, u32 sr
/* 802DB8D0-802DB900 2D6210 0030+00 1/1 1/1 0/0 .text sendCommand__9JKRDecompFP16JKRDecompCommand /* 802DB8D0-802DB900 2D6210 0030+00 1/1 1/1 0/0 .text sendCommand__9JKRDecompFP16JKRDecompCommand
*/ */
void JKRDecomp::sendCommand(JKRDecompCommand* command) { void JKRDecomp::sendCommand(JKRDecompCommand* command) {
OSSendMessage(&sMessageQueue, command, OS_MESSAGE_NON_BLOCKING); OSSendMessage(&sMessageQueue, command, OS_MESSAGE_NOBLOCK);
} }
/* 802DB900-802DB934 2D6240 0034+00 1/1 0/0 0/0 .text orderAsync__9JKRDecompFPUcPUcUlUlPFUl_v */ /* 802DB900-802DB934 2D6240 0034+00 1/1 0/0 0/0 .text orderAsync__9JKRDecompFPUcPUcUlUlPFUl_v */
@ -142,11 +142,11 @@ bool JKRDecomp::sync(JKRDecompCommand* command, int isNonBlocking) {
OSMessage message; OSMessage message;
bool result; bool result;
if (isNonBlocking == JKRDECOMP_SYNC_BLOCKING) { if (isNonBlocking == JKRDECOMP_SYNC_BLOCKING) {
OSReceiveMessage(&command->mMessageQueue, &message, OS_MESSAGE_BLOCKING); OSReceiveMessage(&command->mMessageQueue, &message, OS_MESSAGE_BLOCK);
result = true; result = true;
} else { } else {
result = result =
OSReceiveMessage(&command->mMessageQueue, &message, OS_MESSAGE_NON_BLOCKING) != FALSE; OSReceiveMessage(&command->mMessageQueue, &message, OS_MESSAGE_NOBLOCK) != FALSE;
} }
return result; return result;

View File

@ -144,7 +144,7 @@ s32 JKRDvdFile::sync(void) {
void JKRDvdFile::doneProcess(long id, DVDFileInfo* fileInfo) { void JKRDvdFile::doneProcess(long id, DVDFileInfo* fileInfo) {
// fileInfo->field_0x3c looks like some kind of user pointer? // fileInfo->field_0x3c looks like some kind of user pointer?
JKRDvdFile* dvdFile = *(JKRDvdFile**)((u8*)fileInfo + 0x3c); JKRDvdFile* dvdFile = *(JKRDvdFile**)((u8*)fileInfo + 0x3c);
OSSendMessage(&dvdFile->mMessageQueue2, (OSMessage)id, OS_MESSAGE_NON_BLOCKING); OSSendMessage(&dvdFile->mMessageQueue2, (OSMessage)id, OS_MESSAGE_NOBLOCK);
} }
/* 802D9AF8-802D9B00 2D4438 0008+00 1/0 0/0 0/0 .text getFileSize__10JKRDvdFileCFv */ /* 802D9AF8-802D9B00 2D4438 0008+00 1/0 0/0 0/0 .text getFileSize__10JKRDvdFileCFv */

View File

@ -216,7 +216,7 @@ void JUTException::errorHandler(OSError error, OSContext* context, u32 param_3,
exCallbackObject.param_3 = param_3; exCallbackObject.param_3 = param_3;
exCallbackObject.param_4 = param_4; exCallbackObject.param_4 = param_4;
OSSendMessage(&sMessageQueue, &exCallbackObject, OS_MESSAGE_BLOCKING); OSSendMessage(&sMessageQueue, &exCallbackObject, OS_MESSAGE_BLOCK);
OSEnableScheduler(); OSEnableScheduler();
OSYieldThread(); OSYieldThread();
} }

View File

@ -192,7 +192,7 @@ void JUTVideo::postRetraceProc(u32 retrace_count) {
} }
OSMessage message = (OSMessage*)VIGetRetraceCount(); OSMessage message = (OSMessage*)VIGetRetraceCount();
OSSendMessage(&sManager->mMessageQueue, message, OS_MESSAGE_NON_BLOCKING); OSSendMessage(&sManager->mMessageQueue, message, OS_MESSAGE_NOBLOCK);
} }
/* 802E5198-802E5210 2DFAD8 0078+00 1/1 2/2 0/0 .text /* 802E5198-802E5210 2DFAD8 0078+00 1/1 2/2 0/0 .text

View File

@ -68,13 +68,13 @@ mDoDvdThd_param_c::mDoDvdThd_param_c() {
/* 8001598C-800159B4 0102CC 0028+00 2/2 0/0 0/0 .text kick__17mDoDvdThd_param_cFv */ /* 8001598C-800159B4 0102CC 0028+00 2/2 0/0 0/0 .text kick__17mDoDvdThd_param_cFv */
void mDoDvdThd_param_c::kick() { void mDoDvdThd_param_c::kick() {
OSSendMessage(&mMessageQueue, NULL, OS_MESSAGE_NON_BLOCKING); OSSendMessage(&mMessageQueue, NULL, OS_MESSAGE_NOBLOCK);
} }
/* 800159B4-800159DC 0102F4 0028+00 1/1 0/0 0/0 .text waitForKick__17mDoDvdThd_param_cFv /* 800159B4-800159DC 0102F4 0028+00 1/1 0/0 0/0 .text waitForKick__17mDoDvdThd_param_cFv
*/ */
s32 mDoDvdThd_param_c::waitForKick() { s32 mDoDvdThd_param_c::waitForKick() {
return OSReceiveMessage(&mMessageQueue, NULL, OS_MESSAGE_BLOCKING); return OSReceiveMessage(&mMessageQueue, NULL, OS_MESSAGE_BLOCK);
} }
/* 800159DC-800159E4 01031C 0008+00 1/1 0/0 0/0 .text getFirstCommand__17mDoDvdThd_param_cFv */ /* 800159DC-800159E4 01031C 0008+00 1/1 0/0 0/0 .text getFirstCommand__17mDoDvdThd_param_cFv */