diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 90d206f7..0d8c04d4 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -2322,12 +2322,42 @@ libms/msgfile.c: .data start:0x80547278 end:0x80547288 .sdata start:0x80574028 end:0x80574048 -toBeSorted/d_thp.cpp: - extab start:0x80006780 end:0x800068D8 - extabindex start:0x800069B0 end:0x80006BB4 - .text start:0x80324440 end:0x80327134 align:16 +THPPlayer/THPAudioDecode.c: + extab start:0x80006780 end:0x800067B8 + extabindex start:0x800069B0 end:0x80006A04 + .text start:0x80324440 end:0x803247F4 align:16 + .sbss start:0x80575C98 end:0x80575CA0 + .bss start:0x805CC0A8 end:0x805CD440 + +THPPlayer/THPDraw.c: + extab start:0x800067B8 end:0x800067D0 + extabindex start:0x80006A04 end:0x80006A28 + .text start:0x80324800 end:0x80324FB0 align:16 + .sdata2 start:0x8057CF58 end:0x8057CF80 + +THPPlayer/THPPlayer.c: + extab start:0x800067D0 end:0x80006870 + extabindex start:0x80006A28 end:0x80006B18 + .text start:0x80324FB0 end:0x803268D8 align:16 .data start:0x80547288 end:0x80547388 - .sbss start:0x80575C98 end:0x80575CD0 + .sdata start:0x80574048 end:0x80574050 + .sbss start:0x80575CA0 end:0x80575CC0 + .sdata2 start:0x8057CF80 end:0x8057CF90 + .bss start:0x805CD440 end:0x805CD9C0 + +THPPlayer/THPRead.c: + extab start:0x80006870 end:0x800068A0 + extabindex start:0x80006B18 end:0x80006B60 + .text start:0x803268E0 end:0x80326BD4 align:16 + .sbss start:0x80575CC0 end:0x80575CC8 + .bss start:0x805CD9C0 end:0x805CEDB0 + +THPPlayer/THPVideoDecode.c: + extab start:0x800068A0 end:0x800068D8 + extabindex start:0x80006B60 end:0x80006BB4 + .text start:0x80326BE0 end:0x80327134 align:16 + .sbss start:0x80575CC8 end:0x80575CD0 + .bss start:0x805CEDB0 end:0x805D0128 d/col/c/c_bg_s_chk.cpp: .text start:0x80327140 end:0x8032721C align:16 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index b8037cc1..29eb77f1 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -14496,7 +14496,7 @@ play__12dThpPlayer_cFv = .text:0x802739E0; // type:function size:0x60 destroy__12dThpPlayer_cFv = .text:0x80273A40; // type:function size:0x98 isDone__12dThpPlayer_cFv = .text:0x80273AE0; // type:function size:0x2C draw__14ThpVideoScreenFv = .text:0x80273B10; // type:function size:0x38 -fn_80273B50 = .text:0x80273B50; // type:function size:0x68 +THPVideoDecodeLC = .text:0x80273B50; // type:function size:0x68 TgAlldie__ctor = .text:0x80273BC0; // type:function size:0x5C TgAlldie__init = .text:0x80273C20; // type:function size:0x74 fn_80273CA0 = .text:0x80273CA0; // type:function size:0x8 @@ -18650,67 +18650,67 @@ LMS_GetText = .text:0x803242C0; // type:function size:0x48 LMS_GetTextByLabel = .text:0x80324310; // type:function size:0x48 LMS_GetLabelByTextIndex = .text:0x80324360; // type:function size:0xA4 LMS_GetAttribute = .text:0x80324410; // type:function size:0x24 -fn_80324440 = .text:0x80324440; // type:function size:0xD0 -fn_80324510 = .text:0x80324510; // type:function size:0x1C -fn_80324530 = .text:0x80324530; // type:function size:0x3C -fn_80324570 = .text:0x80324570; // type:function size:0x28 -fn_803245A0 = .text:0x803245A0; // type:function size:0xAC -fn_80324650 = .text:0x80324650; // type:function size:0xD4 -fn_80324730 = .text:0x80324730; // type:function size:0x34 -fn_80324770 = .text:0x80324770; // type:function size:0x14 -fn_80324790 = .text:0x80324790; // type:function size:0x44 -fn_803247E0 = .text:0x803247E0; // type:function size:0x14 -fn_80324800 = .text:0x80324800; // type:function size:0x118 -fn_80324920 = .text:0x80324920; // type:function size:0x4B4 -fn_80324DE0 = .text:0x80324DE0; // type:function size:0x1D0 +CreateAudioDecodeThread = .text:0x80324440; // type:function size:0xD0 +AudioDecodeThreadStart = .text:0x80324510; // type:function size:0x1C +AudioDecodeThreadCancel = .text:0x80324530; // type:function size:0x3C +AudioDecoder__FPv = .text:0x80324570; // type:function size:0x28 +AudioDecoderForOnMemory__FPv = .text:0x803245A0; // type:function size:0xAC +AudioDecode__FP13THPReadBuffer = .text:0x80324650; // type:function size:0xD4 +PopFreeAudioBuffer = .text:0x80324730; // type:function size:0x34 +PushFreeAudioBuffer = .text:0x80324770; // type:function size:0x14 +PopDecodedAudioBuffer = .text:0x80324790; // type:function size:0x44 +PushDecodedAudioBuffer = .text:0x803247E0; // type:function size:0x14 +THPGXRestore = .text:0x80324800; // type:function size:0x118 +THPGXYuv2RgbSetup = .text:0x80324920; // type:function size:0x4B4 +THPGXYuv2RgbDraw = .text:0x80324DE0; // type:function size:0x1D0 THPPlayerInit = .text:0x80324FB0; // type:function size:0x11C THPPlayerQuit = .text:0x803250D0; // type:function size:0x50 THPPlayerOpen = .text:0x80325120; // type:function size:0x280 THPPlayerClose = .text:0x803253A0; // type:function size:0x54 THPPlayerCalcNeedMemory = .text:0x80325400; // type:function size:0xB8 THPPlayerSetBuffer = .text:0x803254C0; // type:function size:0x248 -fn_80325710 = .text:0x80325710; // type:function size:0xD0 -fn_803257E0 = .text:0x803257E0; // type:function size:0x40 -fn_80325820 = .text:0x80325820; // type:function size:0x14 +InitAllMessageQueue__Fv = .text:0x80325710; // type:function size:0xD0 +WaitUntilPrepare__Fv = .text:0x803257E0; // type:function size:0x40 +PrepareReady__Fi = .text:0x80325820; // type:function size:0x14 THPPlayerPrepare = .text:0x80325840; // type:function size:0x278 THPPlayerPlayResume = .text:0x80325AC0; // type:function size:0x74 THPPlayerPlay = .text:0x80325B40; // type:function size:0x8 THPPlayerResume = .text:0x80325B50; // type:function size:0x8 THPPlayerStop = .text:0x80325B60; // type:function size:0xB8 THPPlayerPause = .text:0x80325C20; // type:function size:0x3C -fn_80325C60 = .text:0x80325C60; // type:function size:0x27C -fn_80325EE0 = .text:0x80325EE0; // type:function size:0x6C -fn_80325F50 = .text:0x80325F50; // type:function size:0x128 +PlayControl__FUl = .text:0x80325C60; // type:function size:0x27C +ProperTimingForStart__Fv = .text:0x80325EE0; // type:function size:0x6C +ProperTimingForGettingNextFrame__Fv = .text:0x80325F50; // type:function size:0x128 THPPlayerDrawCurrentFrame = .text:0x80326080; // type:function size:0xD0 THPPlayerGetVideoInfo = .text:0x80326150; // type:function size:0x48 THPPlayerGetAudioInfo = .text:0x803261A0; // type:function size:0x48 THPPlayerGetState = .text:0x803261F0; // type:function size:0x10 -fn_80326200 = .text:0x80326200; // type:function size:0x14 -fn_80326220 = .text:0x80326220; // type:function size:0x44 +PushUsedTextureSet__FPv = .text:0x80326200; // type:function size:0x14 +PopUsedTextureSet__Fv = .text:0x80326220; // type:function size:0x44 THPPlayerPostDrawDone = .text:0x80326270; // type:function size:0x40 fn_803262B0 = .text:0x803262B0; // type:function size:0x168 -fn_80326420 = .text:0x80326420; // type:function size:0x388 +MixAudio__FPsPsUl = .text:0x80326420; // type:function size:0x388 THPPlayerSetVolume = .text:0x803267B0; // type:function size:0x128 -fn_803268E0 = .text:0x803268E0; // type:function size:0xA0 -fn_80326980 = .text:0x80326980; // type:function size:0x1C -fn_803269A0 = .text:0x803269A0; // type:function size:0x3C -fn_803269E0 = .text:0x803269E0; // type:function size:0xDC -fn_80326AC0 = .text:0x80326AC0; // type:function size:0x34 -fn_80326B00 = .text:0x80326B00; // type:function size:0x14 -fn_80326B20 = .text:0x80326B20; // type:function size:0x34 -fn_80326B60 = .text:0x80326B60; // type:function size:0x14 -fn_80326B80 = .text:0x80326B80; // type:function size:0x34 -fn_80326BC0 = .text:0x80326BC0; // type:function size:0x14 -fn_80326BE0 = .text:0x80326BE0; // type:function size:0xD4 -fn_80326CC0 = .text:0x80326CC0; // type:function size:0x1C -fn_80326CE0 = .text:0x80326CE0; // type:function size:0x3C -fn_80326D20 = .text:0x80326D20; // type:function size:0xCC -fn_80326DF0 = .text:0x80326DF0; // type:function size:0x134 -fn_80326F30 = .text:0x80326F30; // type:function size:0x13C -fn_80327070 = .text:0x80327070; // type:function size:0x34 -fn_803270B0 = .text:0x803270B0; // type:function size:0x14 -fn_803270D0 = .text:0x803270D0; // type:function size:0x44 -fn_80327120 = .text:0x80327120; // type:function size:0x14 +CreateReadThread = .text:0x803268E0; // type:function size:0xA0 +ReadThreadStart = .text:0x80326980; // type:function size:0x1C +ReadThreadCancel = .text:0x803269A0; // type:function size:0x3C +Reader__FPv = .text:0x803269E0; // type:function size:0xDC +PopReadedBuffer = .text:0x80326AC0; // type:function size:0x34 +PushReadedBuffer = .text:0x80326B00; // type:function size:0x14 +PopFreeReadBuffer = .text:0x80326B20; // type:function size:0x34 +PushFreeReadBuffer = .text:0x80326B60; // type:function size:0x14 +PopReadedBuffer2 = .text:0x80326B80; // type:function size:0x34 +PushReadedBuffer2 = .text:0x80326BC0; // type:function size:0x14 +CreateVideoDecodeThread = .text:0x80326BE0; // type:function size:0xD4 +VideoDecodeThreadStart = .text:0x80326CC0; // type:function size:0x1C +VideoDecodeThreadCancel = .text:0x80326CE0; // type:function size:0x3C +VideoDecoder__FPv = .text:0x80326D20; // type:function size:0xCC +VideoDecoderForOnMemory__FPv = .text:0x80326DF0; // type:function size:0x134 +VideoDecode__FP13THPReadBuffer = .text:0x80326F30; // type:function size:0x13C +PopFreeTextureSet = .text:0x80327070; // type:function size:0x34 +PushFreeTextureSet = .text:0x803270B0; // type:function size:0x14 +PopDecodedTextureSet = .text:0x803270D0; // type:function size:0x44 +PushDecodedTextureSet = .text:0x80327120; // type:function size:0x14 __ct__8cBgS_ChkFv = .text:0x80327140; // type:function size:0x60 __dt__8cBgS_ChkFv = .text:0x803271A0; // type:function size:0x5C SetActorID__8cBgS_ChkFPUl = .text:0x80327200; // type:function size:0x1C @@ -37565,7 +37565,7 @@ __vt__15JPAFieldGravity = .data:0x80547244; // type:object size:0x14 __vt__10JPATexture = .data:0x80547258; // type:object size:0xC @46 = .data:0x80547268; // type:object size:0x9 scope:local data:string @50 = .data:0x80547278; // type:object size:0x9 scope:local data:string -lbl_80547288 = .data:0x80547288; // type:object size:0x100 +VolumeTable = .data:0x80547288; // type:object size:0x100 scope:local __vt__8cBgS_Chk = .data:0x80547388; // type:object size:0xC __vt__11cBgS_GndChk = .data:0x80547398; // type:object size:0xC __vt__11cBgS_LinChk = .data:0x805473A8; // type:object size:0x10 @@ -40698,7 +40698,7 @@ p_dl = .sdata:0x80574008; // type:object size:0x8 scope:local @52 = .sdata:0x80574030; // type:object size:0x5 scope:local data:string @53 = .sdata:0x80574038; // type:object size:0x5 scope:local data:string @54 = .sdata:0x80574040; // type:object size:0x5 scope:local data:string -lbl_80574048 = .sdata:0x80574048; // type:object size:0x8 +lbl_80574048 = .sdata:0x80574048; // type:object size:0x4 data:string lbl_80574050 = .sdata:0x80574050; // type:object size:0x8 data:4byte lbl_80574058 = .sdata:0x80574058; // type:object size:0x8 data:4byte lbl_80574060 = .sdata:0x80574060; // type:object size:0x4 data:4byte @@ -41944,18 +41944,18 @@ mVec2__Ey = .sbss:0x80575C80; // type:object size:0x4 align:4 data:float m_video__6mVideo = .sbss:0x80575C88; // type:object size:0x8 data:4byte MSB_ALLOC_FUNC = .sbss:0x80575C90; // type:object size:0x4 data:4byte MSB_FREE_FUNC = .sbss:0x80575C94; // type:object size:0x4 data:4byte -lbl_80575C98 = .sbss:0x80575C98; // type:object size:0x8 data:4byte -lbl_80575CA0 = .sbss:0x80575CA0; // type:object size:0x4 data:4byte -lbl_80575CA4 = .sbss:0x80575CA4; // type:object size:0x4 data:4byte +AudioDecodeThreadCreated = .sbss:0x80575C98; // type:object size:0x8 scope:local data:4byte +lbl_80575CA0 = .sbss:0x80575CA0; // type:object size:0x4 scope:local data:4byte +OldVIPostCallback = .sbss:0x80575CA4; // type:object size:0x4 data:4byte lbl_80575CA8 = .sbss:0x80575CA8; // type:object size:0x4 data:4byte lbl_80575CAC = .sbss:0x80575CAC; // type:object size:0x4 data:4byte lbl_80575CB0 = .sbss:0x80575CB0; // type:object size:0x4 data:4byte lbl_80575CB4 = .sbss:0x80575CB4; // type:object size:0x4 data:4byte lbl_80575CB8 = .sbss:0x80575CB8; // type:object size:0x4 data:4byte -lbl_80575CBC = .sbss:0x80575CBC; // type:object size:0x4 -lbl_80575CC0 = .sbss:0x80575CC0; // type:object size:0x8 data:4byte -lbl_80575CC8 = .sbss:0x80575CC8; // type:object size:0x4 data:4byte -lbl_80575CCC = .sbss:0x80575CCC; // type:object size:0x4 data:4byte +PrepareReadyMessage = .sbss:0x80575CBC; // type:object size:0x4 +ReadThreadCreated = .sbss:0x80575CC0; // type:object size:0x8 data:4byte +VideoDecodeThreadCreated = .sbss:0x80575CC8; // type:object size:0x4 scope:local data:4byte +First = .sbss:0x80575CCC; // type:object size:0x4 scope:local data:4byte lbl_80575CD0 = .sbss:0x80575CD0; // type:object size:0x4 data:4byte lbl_80575CD4 = .sbss:0x80575CD4; // type:object size:0x4 data:4byte lbl_80575CD8 = .sbss:0x80575CD8; // type:object size:0x4 data:4byte @@ -51810,21 +51810,27 @@ __HBMSYNVoice = .bss:0x805CBBD4; // type:object size:0x4C4 data:4byte lbl_805CC098 = .bss:0x805CC098; // type:object size:0x8 data:4byte lbl_805CC0A0 = .bss:0x805CC0A0; // type:object size:0x4 data:4byte lbl_805CC0A4 = .bss:0x805CC0A4; // type:object size:0x4 data:4byte -lbl_805CC0A8 = .bss:0x805CC0A8; // type:object size:0x1318 -lbl_805CD3C0 = .bss:0x805CD3C0; // type:object size:0x38 -lbl_805CD3F8 = .bss:0x805CD3F8; // type:object size:0x48 -lbl_805CD440 = .bss:0x805CD440; // type:object size:0x1F0 -lbl_805CD630 = .bss:0x805CD630; // type:object size:0x30 +AudioDecodeThread = .bss:0x805CC0A8; // type:object size:0x318 scope:local +AudioDecodeThreadStack = .bss:0x805CC3C0; // type:object size:0x1000 scope:local +FreeAudioBufferQueue = .bss:0x805CD3C0; // type:object size:0x20 scope:local +FreeAudioBufferMessage = .bss:0x805CD3E0; // type:object size:0x18 scope:local +DecodedAudioBufferQueue = .bss:0x805CD3F8; // type:object size:0x20 scope:local +DecodedAudioBufferMessage = .bss:0x805CD418; // type:object size:0x28 scope:local +ActivePlayer = .bss:0x805CD440; // type:object size:0x1F0 +UsedTextureSetQueue = .bss:0x805CD630; // type:object size:0x30 lbl_805CD660 = .bss:0x805CD660; // type:object size:0x300 -lbl_805CD960 = .bss:0x805CD960; // type:object size:0x40 data:4byte -lbl_805CD9A0 = .bss:0x805CD9A0; // type:object size:0x20 -lbl_805CD9C0 = .bss:0x805CD9C0; // type:object size:0x1318 -lbl_805CECD8 = .bss:0x805CECD8; // type:object size:0x48 -lbl_805CED20 = .bss:0x805CED20; // type:object size:0x48 -lbl_805CED68 = .bss:0x805CED68; // type:object size:0x48 -lbl_805CEDB0 = .bss:0x805CEDB0; // type:object size:0x1318 -lbl_805D00C8 = .bss:0x805D00C8; // type:object size:0x30 -lbl_805D00F8 = .bss:0x805D00F8; // type:object size:0x30 +WorkBuffer = .bss:0x805CD960; // type:object size:0x40 align:32 data:4byte +PrepareReadyQueue = .bss:0x805CD9A0; // type:object size:0x20 +ReadThread = .bss:0x805CD9C0; // type:object size:0x1318 +FreeReadBufferQueue = .bss:0x805CECD8; // type:object size:0x48 +ReadedBufferQueue = .bss:0x805CED20; // type:object size:0x48 +ReadedBufferQueue2 = .bss:0x805CED68; // type:object size:0x48 +VideoDecodeThread = .bss:0x805CEDB0; // type:object size:0x318 +VideoDecodeThreadStack = .bss:0x805CF0C8; // type:object size:0x1000 +FreeTextureSetQueue = .bss:0x805D00C8; // type:object size:0x20 +FreeTextureSetMessage = .bss:0x805D00E8; // type:object size:0x10 +DecodedTextureSetQueue = .bss:0x805D00F8; // type:object size:0x20 +DecodedTextureSetMessage = .bss:0x805D0118; // type:object size:0x10 sVirtualCenter__14cCcD_ShapeAttr = .bss:0x805D0128; // type:object size:0xC align:4 data:float lbl_805D0138 = .bss:0x805D0138; // type:object size:0x7C data:4byte lbl_805D01B4 = .bss:0x805D01B4; // type:object size:0x14 data:4byte diff --git a/configure.py b/configure.py index 7e368281..d2aca699 100644 --- a/configure.py +++ b/configure.py @@ -248,6 +248,15 @@ cflags_libms = [ "-Cpp_exceptions on", ] +# THPPlayer flags +cflags_thpplayer = [ + *cflags_base, + "-inline noauto", + "-fp_contract off", + "-lang=C++", + "-Cpp_exceptions on", +] + # EGG flags cflags_egg = [ *cflags_base, @@ -648,7 +657,20 @@ config.libs = [ Object(NonMatching, "toBeSorted/d_sc_e3_title.cpp"), Object(NonMatching, "toBeSorted/d_sc_e3_game_end.cpp"), Object(Matching, "DynamicLink.cpp"), - Object(NonMatching, "toBeSorted/d_thp.cpp"), + ], + }, + { + "lib": "thpplayer", + "mw_version": "Wii/1.5", + "cflags": cflags_thpplayer, + "progress_category": "thpplayer", + "host": False, + "objects": [ + Object(NonMatching, "THPPlayer/THPAudioDecode.c"), + Object(NonMatching, "THPPlayer/THPDraw.c"), + Object(NonMatching, "THPPlayer/THPPlayer.c"), + Object(NonMatching, "THPPlayer/THPRead.c"), + Object(NonMatching, "THPPlayer/THPVideoDecode.c"), ], }, { @@ -2925,6 +2947,7 @@ config.progress_categories = [ ProgressCategory("jsystem", "JSystem"), ProgressCategory("hbm", "Home Button Menu"), ProgressCategory("keyboard", "Virtual Keyboard"), + ProgressCategory("thpplayer", "THPPlayer"), ] config.progress_each_module = args.verbose # Optional extra arguments to `objdiff-cli report generate` diff --git a/include/d/d_thp_player.h b/include/d/d_thp_player.h index 8d527d40..2ef99a1a 100644 --- a/include/d/d_thp_player.h +++ b/include/d/d_thp_player.h @@ -9,7 +9,7 @@ #include "sized_string.h" class ThpVideoScreen : public m2d::Base_c { - public: +public: ThpVideoScreen() { mEfbWidth = 0; mEfbHeight = 0; @@ -28,6 +28,7 @@ class ThpVideoScreen : public m2d::Base_c { mVideoHeight = height; } +private: /* 0x10 */ s32 mEfbWidth; /* 0x14 */ s32 mEfbHeight; /* 0x18 */ s32 mVideoWidth; @@ -50,18 +51,19 @@ public: s32 play(); s32 destroy(); void open(); - void setupFile(char* filename, s32 loadAllAtOnce); + void setupFile(char *filename, s32 loadAllAtOnce); - /* 0x68 */ mDvd_callback_c* mDvdCallback; +private: + /* 0x68 */ mDvd_callback_c *mDvdCallback; /* 0x6C */ SizedString<0x20> mFilename; - + /* 0x8C */ THPVideoInfo mVideoComponent; /* 0x98 */ THPAudioInfo mAudioComponent; /* 0xA8 */ s32 mLoadAllAtOnce; /* 0xAC */ s32 mFilenameSet; /* 0xB0 */ s32 mSetupDone; /* 0xB4 */ s32 isPlaying; - /* 0xB8 */ u8* mBuffer; + /* 0xB8 */ u8 *mBuffer; /* 0xBC */ ThpVideoScreen mScreen; /* 0xDC */ s32 mSpecialType; }; diff --git a/src/d/d_thp_player.cpp b/src/d/d_thp_player.cpp index 80893f4f..3728ec60 100644 --- a/src/d/d_thp_player.cpp +++ b/src/d/d_thp_player.cpp @@ -165,7 +165,8 @@ void ThpVideoScreen::draw() { drawTHPFrame(mEfbWidth, mEfbHeight, (mEfbWidth - mVideoWidth) / 2, (mEfbHeight - mVideoHeight) / 2, mVideoWidth, mVideoHeight); } -extern "C" s32 fn_80273B50(s32 p1, s32 p2, s32 p3, s32 p4, s32 p5) { +// THPPlayer calls this instead of directly calling THPVideoDecode. +extern "C" s32 THPVideoDecodeLC(s32 p1, s32 p2, s32 p3, s32 p4, s32 p5) { nw4r::ut::LC::Lock(); s32 result = THPVideoDecode(p1, p2, p3, p4, p5); nw4r::ut::LC::Unlock();