Skip to content

Commit

Permalink
fix remaining funcs
Browse files Browse the repository at this point in the history
Co-Authored-By: SwareJonge <[email protected]>
  • Loading branch information
EpochFlame and SwareJonge committed Sep 13, 2023
1 parent f10f4db commit fa8ab94
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1615,8 +1615,8 @@
["sysGCU/THPAudioDecode", True],
["sysGCU/THPDraw", True],
"sysGCU/THPPlayer",
"sysGCU/THPRead",
"sysGCU/THPVideoDecode",
["sysGCU/THPRead", True],
["sysGCU/THPVideoDecode", True],
"sysGCU/pikmin2THPPlayer",
["sysGCU/captionMgr", True],
"sysGCU/captionMessage",
Expand Down
2 changes: 1 addition & 1 deletion include/THP/THPRead.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "types.h"
#include "THP/THPBuffer.h"

static void Reader(void*);
static void* Reader(void* arg);

#ifdef __cplusplus
extern "C" {
Expand Down
4 changes: 2 additions & 2 deletions src/sysGCU/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ GC_FILES:=\
$(BUILD_DIR)/src/sysGCU/THPAudioDecode.o\
$(BUILD_DIR)/src/sysGCU/THPDraw.o\
$(BUILD_DIR)/asm/sysGCU/THPPlayer.o\
$(BUILD_DIR)/asm/sysGCU/THPRead.o\
$(BUILD_DIR)/asm/sysGCU/THPVideoDecode.o\
$(BUILD_DIR)/src/sysGCU/THPRead.o\
$(BUILD_DIR)/src/sysGCU/THPVideoDecode.o\
$(BUILD_DIR)/asm/sysGCU/pikmin2THPPlayer.o\
$(BUILD_DIR)/src/sysGCU/captionMgr.o\
$(BUILD_DIR)/asm/sysGCU/captionMessage.o\
Expand Down
4 changes: 2 additions & 2 deletions src/sysGCU/THPRead.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static u8 ReadThreadStack[STACK_SIZE];

BOOL CreateReadThread(OSPriority priority)
{
if (OSCreateThread(&ReadThread, nullptr, Reader, ReadThreadStack + STACK_SIZE, STACK_SIZE, priority, 1) == FALSE) {
if (OSCreateThread(&ReadThread, Reader, NULL, ReadThreadStack + STACK_SIZE, STACK_SIZE, priority, 1) == FALSE){
return FALSE;
}

Expand Down Expand Up @@ -71,7 +71,7 @@ void ReadThreadCancel()
* Address: 8044F69C
* Size: 0000EC
*/
static void Reader(void* arg)
static void* Reader(void* arg)
{
THPReadBuffer* buf;
s32 curFrame;
Expand Down
17 changes: 9 additions & 8 deletions src/sysGCU/THPVideoDecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ void VideoDecodeThreadCancel()
*/
static void* VideoDecoder(void* arg)
{
BOOL old;
THPReadBuffer* thpBuffer;
int decodedFrame = ActivePlayer.mVideoDecodeCount;

Expand All @@ -85,9 +86,9 @@ static void* VideoDecoder(void* arg)
VideoDecode(thpBuffer);

PushFreeReadBuffer((OSMessage*)thpBuffer);
BOOL interrupt = OSDisableInterrupts();
old = OSDisableInterrupts();
ActivePlayer.mVideoDecodeCount++;
OSRestoreInterrupts(interrupt);
OSRestoreInterrupts(old);
}
}

Expand Down Expand Up @@ -120,11 +121,10 @@ static void* VideoDecoderForOnMemory(void* arg)
readBuffer.mPtr = (u8*)arg;
while (TRUE) {
if (ActivePlayer.mAudioExist) {
BOOL interrupt = OSDisableInterrupts();
ActivePlayer.mVideoDecodeCount++;
OSRestoreInterrupts(interrupt);
while (i--) {
while (ActivePlayer.mVideoDecodeCount < 0) {
BOOL old = OSDisableInterrupts();
ActivePlayer.mVideoDecodeCount++;
OSRestoreInterrupts(old);
s32 remaining = (frame + ActivePlayer.mInitReadFrame) % ActivePlayer.mHeader.mNumFrames;
if (remaining == ActivePlayer.mHeader.mNumFrames - 1) {
if ((ActivePlayer.mPlayFlag & 1) == 0)
Expand Down Expand Up @@ -174,6 +174,7 @@ static void VideoDecode(THPReadBuffer* readBuffer)
s32 i;
u32* tileOffsets;
u8* tile;
BOOL old;

tileOffsets = (u32*)(readBuffer->mPtr + 8);
tile = &readBuffer->mPtr[ActivePlayer.mCompInfo.mNumComponents * 4] + 8;
Expand All @@ -193,9 +194,9 @@ static void VideoDecode(THPReadBuffer* readBuffer)
}
textureSet->mFrameNumber = readBuffer->mFrameNumber;
PushDecodedTextureSet((OSMessage*)textureSet);
BOOL interrupt = OSDisableInterrupts();
old = OSDisableInterrupts();
ActivePlayer.mVideoDecodeCount++;
OSRestoreInterrupts(interrupt);
OSRestoreInterrupts(old);
}
}

Expand Down

0 comments on commit fa8ab94

Please sign in to comment.