Skip to content

Commit

Permalink
match most of THPVideoDecode.c
Browse files Browse the repository at this point in the history
also fix OSMessage types for better accuracy
  • Loading branch information
EpochFlame committed Sep 13, 2023
1 parent 4f12e0e commit 11806f7
Show file tree
Hide file tree
Showing 8 changed files with 196 additions and 466 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"thpfile.h": "c",
"thpaudiodecode.h": "c",
"thpdraw.h": "c",
"thpplayer.h": "c"
"thpplayer.h": "c",
"thpvideodecode.h": "c"
}
}
6 changes: 3 additions & 3 deletions docs/recommended_todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectSpecialActor.cpp">JSTObjectSpecialActor.cpp</a> | 2289 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/illustratedBookMessage.cpp">illustratedBookMessage.cpp</a> | 2964 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/captionMessage.cpp">captionMessage.cpp</a> | 3528 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/messageObj.cpp">messageObj.cpp</a> | 4504 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/aramMgr.cpp">aramMgr.cpp</a> | 4920 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/gameflow.cpp">gameflow.cpp</a> | 5333 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/messageMgr.cpp">messageMgr.cpp</a> | 6825 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/THPRead.c">THPRead.c</a> | 7129 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/section.cpp">section.cpp</a> | 7138 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/moviePlayerPauseAndDraw.cpp">moviePlayerPauseAndDraw.cpp</a> | 8587 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/screenScene.cpp">screenScene.cpp</a> | 9274 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/THPVideoDecode.c">THPVideoDecode.c</a> | 10029 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/messageMgr.cpp">messageMgr.cpp</a> | 6825 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/THPVideoDecode.c">THPVideoDecode.c</a> | 6852 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/THPRead.c">THPRead.c</a> | 7129 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/section.cpp">section.cpp</a> | 7138 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/moviePlayerPauseAndDraw.cpp">moviePlayerPauseAndDraw.cpp</a> | 8587 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/screenScene.cpp">screenScene.cpp</a> | 9274 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectParticleActor.cpp">JSTObjectParticleActor.cpp</a> | 11032 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/loadResource.cpp">loadResource.cpp</a> | 11781 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/heapStatus.cpp">heapStatus.cpp</a> | 12405 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/dvdThread.cpp">dvdThread.cpp</a> | 12535 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectCamera.cpp">JSTObjectCamera.cpp</a> | 12894 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/P2DScreen.cpp">P2DScreen.cpp</a> | 12998 |
Expand Down
14 changes: 7 additions & 7 deletions include/Dolphin/OS/OSMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ struct OSMessageQueue {
OSThreadQueue queueSend; // _00
OSThreadQueue queueReceive; // _08
OSMessage* msgArray; // _10, array of messages.
int msgCount; // _14, array limit size.
int firstIndex; // _18, first message index in array.
int usedCount; // _1C, actual number of used messages.
s32 msgCount; // _14, array limit size.
s32 firstIndex; // _18, first message index in array.
s32 usedCount; // _1C, actual number of used messages.
};

// Defines for message flags for sending/receiving.
Expand All @@ -37,10 +37,10 @@ typedef enum {

/////// MESSAGE FUNCTIONS ////////
// Functions for handling messages.
void OSInitMessageQueue(OSMessageQueue* queue, OSMessage* msgArray, int msgCount);
BOOL OSSendMessage(OSMessageQueue* queue, OSMessage msg, int flags);
BOOL OSJamMessage(OSMessageQueue* queue, OSMessage msg, int flags);
BOOL OSReceiveMessage(OSMessageQueue* queue, OSMessage* msgPtr, int flags);
void OSInitMessageQueue(OSMessageQueue* queue, OSMessage* msgArray, s32 msgCount);
BOOL OSSendMessage(OSMessageQueue* queue, OSMessage msg, s32 flags);
BOOL OSJamMessage(OSMessageQueue* queue, OSMessage msg, s32 flags);
BOOL OSReceiveMessage(OSMessageQueue* queue, OSMessage* msgPtr, s32 flags);

//////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion include/THP/THPAudioDecode.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ static void AudioDecode(THPReadBuffer* readBuffer);
#ifdef __cplusplus
extern "C" {
#endif
int THPAudioDecode(s16* arg1, u8* arg2, int arg3); // TODO: determine args and name properly
int THPAudioDecode(s16* buffer, u8* frame, s32 flags); // TODO: determine args and name properly

BOOL CreateAudioDecodeThread(OSPriority prio, void* param);
void AudioDecodeThreadStart();
Expand Down
13 changes: 7 additions & 6 deletions include/THP/THPVideoDecode.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@
#include "THP/THPRead.h"
#include "types.h"

static void* VideoDecoder(void*);
static void* VideoDecoderForOnMemory(void*);
static void VideoDecode(THPReadBuffer*);

#ifdef __cplusplus
extern "C" {
#endif // ifdef __cplusplus

BOOL CreateVideoDecodeThread(int, void*);
s32 THPVideoDecode(void* file, void* tileY, void* tileU, void* tileV, void* work);
BOOL CreateVideoDecodeThread(OSPriority priority, void* task);
void VideoDecodeThreadStart();
void VideoDecodeThreadCancel();
void VideoDecoder(void*);
void VideoDecoderForOnMemory(void*);
void VideoDecode(THPReadBuffer*);
OSMessage PopFreeTextureSet();
BOOL PushFreeTextureSet(OSMessage*);
OSMessage PopDecodedTextureSet();
OSMessage PopDecodedTextureSet(s32 flags);
BOOL PushDecodedTextureSet(OSMessage*);

extern BOOL VideoDecodeThreadCreated;
Expand Down
12 changes: 6 additions & 6 deletions src/Dolphin/os/OSMessage.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
* Address: 800EF4BC
* Size: 000060
*/
void OSInitMessageQueue(OSMessageQueue* queue, void** buffer, int capacity)
void OSInitMessageQueue(OSMessageQueue* queue, OSMessage* msgArray, s32 msgCount)
{
OSInitThreadQueue(&queue->queueSend);
OSInitThreadQueue(&queue->queueReceive);
queue->msgArray = buffer;
queue->msgCount = capacity;
queue->msgArray = msgArray;
queue->msgCount = msgCount;
queue->firstIndex = 0;
queue->usedCount = 0;
}
Expand All @@ -27,7 +27,7 @@ void OSInitMessageQueue(OSMessageQueue* queue, void** buffer, int capacity)
* Address: 800EF51C
* Size: 0000C8
*/
BOOL OSSendMessage(OSMessageQueue* queue, void* msg, int flags)
BOOL OSSendMessage(OSMessageQueue* queue, void* msg, s32 flags)
{
int mesgId;
u32 interrupt;
Expand Down Expand Up @@ -57,7 +57,7 @@ BOOL OSSendMessage(OSMessageQueue* queue, void* msg, int flags)
* Address: 800EF5E4
* Size: 0000DC
*/
BOOL OSReceiveMessage(OSMessageQueue* queue, void** buffer, int flags)
BOOL OSReceiveMessage(OSMessageQueue* queue, void** buffer, s32 flags)
{
u32 interrupt;

Expand Down Expand Up @@ -89,7 +89,7 @@ BOOL OSReceiveMessage(OSMessageQueue* queue, void** buffer, int flags)
* Address: 800EF6C0
* Size: 0000D4
*/
BOOL OSJamMessage(OSMessageQueue* queue, void* msg, int flags)
BOOL OSJamMessage(OSMessageQueue* queue, void* msg, s32 flags)
{
s32 lastMesg;
u32 interrupt;
Expand Down
Loading

0 comments on commit 11806f7

Please sign in to comment.