mirror of
https://github.com/zeldaret/ss
synced 2026-05-29 16:44:44 -04:00
d_thp with THPPlayer headers from SMS
This commit is contained in:
@@ -1467,6 +1467,7 @@ d/a/obj/d_a_obj_switch.cpp:
|
||||
d/d_thp_player.cpp:
|
||||
.text start:0x80273370 end:0x80273BB8 align:16
|
||||
.data start:0x80535FB8 end:0x805360A0
|
||||
.sdata2 start:0x8057C4E0 end:0x8057C4F0
|
||||
|
||||
d/tg/d_t_alldie.cpp:
|
||||
.text start:0x80273BC0 end:0x8027405C align:16
|
||||
|
||||
+36
-36
@@ -14478,24 +14478,24 @@ initializeState__22sFStateID_c<8dAcOsw_c>CFR8dAcOsw_c = .text:0x80272E50; // typ
|
||||
__sinit_\d_a_obj_switch_cpp = .text:0x80272E80; // type:function size:0x3F4 scope:local
|
||||
__dt__22sFStateID_c<8dAcOsw_c>Fv = .text:0x80273280; // type:function size:0x58 scope:weak
|
||||
isSameName__22sFStateID_c<8dAcOsw_c>CFPCc = .text:0x802732E0; // type:function size:0x88 scope:weak
|
||||
fn_80273370 = .text:0x80273370; // type:function size:0x30
|
||||
fn_802733A0 = .text:0x802733A0; // type:function size:0x34
|
||||
fn_802733E0 = .text:0x802733E0; // type:function size:0x38
|
||||
fn_80273420 = .text:0x80273420; // type:function size:0x24
|
||||
fn_80273450 = .text:0x80273450; // type:function size:0x44
|
||||
fn_802734A0 = .text:0x802734A0; // type:function size:0x88
|
||||
fn_80273530 = .text:0x80273530; // type:function size:0x58
|
||||
fn_80273590 = .text:0x80273590; // type:function size:0xA8
|
||||
fn_80273640 = .text:0x80273640; // type:function size:0x68
|
||||
fn_802736B0 = .text:0x802736B0; // type:function size:0x2C
|
||||
fn_802736E0 = .text:0x802736E0; // type:function size:0x24
|
||||
fn_80273710 = .text:0x80273710; // type:function size:0x44
|
||||
fn_80273760 = .text:0x80273760; // type:function size:0xD0
|
||||
fn_80273830 = .text:0x80273830; // type:function size:0x1B0
|
||||
fn_802739E0 = .text:0x802739E0; // type:function size:0x60
|
||||
fn_80273A40 = .text:0x80273A40; // type:function size:0x98
|
||||
fn_80273AE0 = .text:0x80273AE0; // type:function size:0x2C
|
||||
fn_80273B10 = .text:0x80273B10; // type:function size:0x38
|
||||
dThpPlayer_c_classInit__Fv = .text:0x80273370; // type:function size:0x30
|
||||
create__12dThpPlayer_cFv = .text:0x802733A0; // type:function size:0x34
|
||||
doDelete__12dThpPlayer_cFv = .text:0x802733E0; // type:function size:0x38
|
||||
execute__12dThpPlayer_cFv = .text:0x80273420; // type:function size:0x24
|
||||
draw__12dThpPlayer_cFv = .text:0x80273450; // type:function size:0x44
|
||||
__ct__12dThpPlayer_cFv = .text:0x802734A0; // type:function size:0x88
|
||||
__dt__14ThpVideoScreenFv = .text:0x80273530; // type:function size:0x58
|
||||
__dt__12dThpPlayer_cFv = .text:0x80273590; // type:function size:0xA8
|
||||
reallyCreate__12dThpPlayer_cFUsUs = .text:0x80273640; // type:function size:0x68
|
||||
drawTHPFrame__FUlUlUlUlUlUl = .text:0x802736B0; // type:function size:0x2C
|
||||
callback__FPv = .text:0x802736E0; // type:function size:0x24
|
||||
open__12dThpPlayer_cFv = .text:0x80273710; // type:function size:0x44
|
||||
setupFile__12dThpPlayer_cFPcl = .text:0x80273760; // type:function size:0xD0
|
||||
reallyExecute__12dThpPlayer_cFv = .text:0x80273830; // type:function size:0x1B0
|
||||
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
|
||||
TgAlldie__ctor = .text:0x80273BC0; // type:function size:0x5C
|
||||
TgAlldie__init = .text:0x80273C20; // type:function size:0x74
|
||||
@@ -18663,34 +18663,34 @@ 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
|
||||
fn_80324FB0 = .text:0x80324FB0; // type:function size:0x11C
|
||||
fn_803250D0 = .text:0x803250D0; // type:function size:0x50
|
||||
fn_80325120 = .text:0x80325120; // type:function size:0x280
|
||||
fn_803253A0 = .text:0x803253A0; // type:function size:0x54
|
||||
fn_80325400 = .text:0x80325400; // type:function size:0xB8
|
||||
fn_803254C0 = .text:0x803254C0; // type:function size:0x248
|
||||
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
|
||||
fn_80325840 = .text:0x80325840; // type:function size:0x278
|
||||
fn_80325AC0 = .text:0x80325AC0; // type:function size:0x74
|
||||
fn_80325B40 = .text:0x80325B40; // type:function size:0x8
|
||||
fn_80325B50 = .text:0x80325B50; // type:function size:0x8
|
||||
fn_80325B60 = .text:0x80325B60; // type:function size:0xB8
|
||||
fn_80325C20 = .text:0x80325C20; // type:function size:0x3C
|
||||
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
|
||||
fn_80326080 = .text:0x80326080; // type:function size:0xD0
|
||||
fn_80326150 = .text:0x80326150; // type:function size:0x48
|
||||
fn_803261A0 = .text:0x803261A0; // type:function size:0x48
|
||||
fn_803261F0 = .text:0x803261F0; // type:function size:0x10
|
||||
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
|
||||
fn_80326270 = .text:0x80326270; // type:function size:0x40
|
||||
THPPlayerPostDrawDone = .text:0x80326270; // type:function size:0x40
|
||||
fn_803262B0 = .text:0x803262B0; // type:function size:0x168
|
||||
fn_80326420 = .text:0x80326420; // type:function size:0x388
|
||||
fn_803267B0 = .text:0x803267B0; // type:function size:0x128
|
||||
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
|
||||
|
||||
+1
-1
@@ -592,7 +592,7 @@ config.libs = [
|
||||
Object(NonMatching, "d/a/obj/d_a_obj_tbox.cpp"),
|
||||
Object(NonMatching, "d/a/obj/d_a_obj_time_area.cpp"),
|
||||
Object(Matching, "d/a/obj/d_a_obj_switch.cpp"),
|
||||
Object(NonMatching, "d/d_thp_player.cpp"),
|
||||
Object(Matching, "d/d_thp_player.cpp"),
|
||||
Object(NonMatching, "d/tg/d_t_alldie.cpp"),
|
||||
Object(NonMatching, "d/tg/d_t_view_clip.cpp"),
|
||||
Object(Matching, "d/tg/d_t_switch.cpp"),
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef _THP_THPAUDIODECODE_H
|
||||
#define _THP_THPAUDIODECODE_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
BOOL CreateAudioDecodeThread(s32 prioriy, void*);
|
||||
void AudioDecodeThreadStart();
|
||||
void AudioDecodeThreadCancel();
|
||||
|
||||
void PushFreeAudioBuffer(void* buf);
|
||||
void PushDecodedAudioBuffer(void* buf);
|
||||
|
||||
void* PopFreeAudioBuffer();
|
||||
void* PopDecodedAudioBuffer(s32 flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef _THP_THPBUFFER_H
|
||||
#define _THP_THPBUFFER_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct THPTextureSet {
|
||||
u8* ytexture;
|
||||
u8* utexture;
|
||||
u8* vtexture;
|
||||
s32 frameNumber;
|
||||
} THPTextureSet;
|
||||
|
||||
typedef struct THPAudioBuffer {
|
||||
s16* buffer;
|
||||
s16* curPtr;
|
||||
u32 validSample;
|
||||
} THPAudioBuffer;
|
||||
|
||||
typedef struct THPReadBuffer {
|
||||
u8* ptr;
|
||||
s32 frameNumber;
|
||||
BOOL isValid;
|
||||
} THPReadBuffer;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef _THP_THPDRAW_H
|
||||
#define _THP_THPDRAW_H
|
||||
|
||||
#include "common.h"
|
||||
#include "rvl/GX/GXFrameBuf.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void THPGXRestore();
|
||||
void THPGXYuv2RgbSetup(GXRenderModeObj* rmode);
|
||||
void THPGXYuv2RgbDraw(u8* yTexture, u8* uTexture, u8* vTexture, s16 x, s16 y,
|
||||
s16 textureWidth, s16 textureHeight, s16 polygonWidth,
|
||||
s16 polygonHeight);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef _THP_THPFILE_H
|
||||
#define _THP_THPFILE_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct THPHeader {
|
||||
char magic[4];
|
||||
u32 version;
|
||||
u32 bufsize;
|
||||
u32 audioMaxSamples;
|
||||
f32 frameRate;
|
||||
u32 numFrames;
|
||||
u32 firstFrameSize;
|
||||
u32 movieDataSize;
|
||||
u32 compInfoDataOffsets;
|
||||
u32 offsetDataOffsets;
|
||||
u32 movieDataOffsets;
|
||||
u32 finalFrameDataOffsets;
|
||||
} THPHeader;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef _THP_THPINFO_H
|
||||
#define _THP_THPINFO_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct THPVideoInfo {
|
||||
u32 xSize;
|
||||
u32 ySize;
|
||||
u32 videoType;
|
||||
} THPVideoInfo;
|
||||
|
||||
typedef struct THPAudioInfo {
|
||||
u32 sndChannels;
|
||||
u32 sndFrequency;
|
||||
u32 sndNumSamples;
|
||||
u32 sndNumTracks;
|
||||
} THPAudioInfo;
|
||||
|
||||
typedef struct THPFrameCompInfo {
|
||||
u32 numComponents;
|
||||
u8 frameComp[16];
|
||||
} THPFrameCompInfo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,91 @@
|
||||
#ifndef _THP_THPPLAYER_H
|
||||
#define _THP_THPPLAYER_H
|
||||
|
||||
#include "common.h"
|
||||
#include "rvl/DVD/dvd.h"
|
||||
#include "rvl/GX/GXFrameBuf.h"
|
||||
|
||||
#include <THPPlayer/THPBuffer.h>
|
||||
#include <THPPlayer/THPFile.h>
|
||||
#include <THPPlayer/THPInfo.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define THP_AUDIO_BUFFER_COUNT 3
|
||||
#define THP_READ_BUFFER_COUNT 10
|
||||
#define THP_TEXTURE_SET_COUNT 3
|
||||
|
||||
typedef struct THPPlayer {
|
||||
DVDFileInfo fileInfo;
|
||||
THPHeader header;
|
||||
THPFrameCompInfo compInfo;
|
||||
THPVideoInfo videoInfo;
|
||||
THPAudioInfo audioInfo;
|
||||
void* thpWork;
|
||||
BOOL open;
|
||||
u8 state;
|
||||
u8 internalState;
|
||||
u8 playFlag;
|
||||
u8 audioExist;
|
||||
s32 dvdError;
|
||||
s32 videoError;
|
||||
BOOL onMemory;
|
||||
u8* movieData;
|
||||
s32 initOffset;
|
||||
s32 initReadSize;
|
||||
s32 initReadFrame;
|
||||
u32 curField;
|
||||
s64 retaceCount;
|
||||
s32 prevCount;
|
||||
s32 curCount;
|
||||
s32 videoDecodeCount;
|
||||
f32 curVolume;
|
||||
f32 targetVolume;
|
||||
f32 deltaVolume;
|
||||
s32 rampCount;
|
||||
s32 curAudioTrack;
|
||||
s32 curVideoNumber;
|
||||
s32 curAudioNumber;
|
||||
THPTextureSet* dispTextureSet;
|
||||
THPAudioBuffer* playAudioBuffer;
|
||||
THPReadBuffer readBuffer[10];
|
||||
THPTextureSet textureSet[THP_TEXTURE_SET_COUNT];
|
||||
THPAudioBuffer audioBuffer[THP_AUDIO_BUFFER_COUNT];
|
||||
} THPPlayer; // Size: 0x1d0
|
||||
|
||||
extern THPPlayer ActivePlayer;
|
||||
|
||||
BOOL THPPlayerInit(s32);
|
||||
void THPPlayerQuit();
|
||||
BOOL THPPlayerOpen(const char* fileName, BOOL onMemory);
|
||||
BOOL THPPlayerClose();
|
||||
BOOL THPPlayerPlay();
|
||||
void THPPlayerStop();
|
||||
BOOL THPPlayerPause();
|
||||
BOOL THPPlayerPrepare(s32 offset, u8 flag, s32 audioTrack);
|
||||
|
||||
BOOL THPPlayerSetBuffer(u8* data);
|
||||
|
||||
u32 THPPlayerCalcNeedMemory();
|
||||
|
||||
BOOL THPPlayerGetVideoInfo(THPVideoInfo* videoInfo);
|
||||
BOOL THPPlayerGetAudioInfo(THPAudioInfo* audioInfo);
|
||||
// f32 THPPlayerGetFrameRate();
|
||||
BOOL THPPlayerSetVolume(s32 vol, s32 duration);
|
||||
|
||||
s32 THPPlayerDrawCurrentFrame(u16, u16, u32, u32, u32, u32);
|
||||
u32 THPPlayerGetTotalFrame();
|
||||
s32 THPPlayerGetState();
|
||||
void THPPlayerDrawDone();
|
||||
|
||||
void THPPlayerPostDrawDone();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
void PrepareReady(int msg);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef _THP_THPREAD_H
|
||||
#define _THP_THPREAD_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
BOOL CreateReadThread(s32 prioriy);
|
||||
void ReadThreadStart(void);
|
||||
void ReadThreadCancel(void);
|
||||
|
||||
// TODO: figure out if these returns THPBuffer * instead(DWARF info pls)
|
||||
void* PopReadedBuffer(void);
|
||||
void* PopFreeReadBuffer(void);
|
||||
void* PopReadedBuffer2(void);
|
||||
void* PushReadedBuffer(void* buffer);
|
||||
void PushFreeReadBuffer(void* buffer);
|
||||
void PushReadedBuffer2(void* buffer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef _THP_THPVIDEODECODE_H
|
||||
#define _THP_THPVIDEODECODE_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
BOOL CreateVideoDecodeThread(s32 prioriy, void*);
|
||||
void VideoDecodeThreadStart(void);
|
||||
void VideoDecodeThreadCancel(void);
|
||||
|
||||
void* PopFreeTextureSet(void);
|
||||
void* PopDecodedTextureSet(s32 flags);
|
||||
|
||||
void PushFreeTextureSet(void* tex);
|
||||
void PushDecodedTextureSet(void* tex);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,69 @@
|
||||
#ifndef D_THP_PLAYER_H
|
||||
#define D_THP_PLAYER_H
|
||||
|
||||
#include "THPPlayer/THPInfo.h"
|
||||
#include "common.h"
|
||||
#include "d/d_base.h"
|
||||
#include "m/m2d.h"
|
||||
#include "m/m_dvd.h"
|
||||
#include "sized_string.h"
|
||||
|
||||
class ThpVideoScreen : public m2d::Base_c {
|
||||
public:
|
||||
ThpVideoScreen() {
|
||||
mEfbWidth = 0;
|
||||
mEfbHeight = 0;
|
||||
mVideoWidth = 0;
|
||||
mVideoHeight = 0;
|
||||
}
|
||||
virtual void draw() override;
|
||||
void setEfbWidth(s16 width) {
|
||||
mEfbWidth = width;
|
||||
}
|
||||
void setEfbHeight(s16 height) {
|
||||
mEfbHeight = height;
|
||||
}
|
||||
void setVideoDimensions(u32 width, u32 height) {
|
||||
mVideoWidth = width;
|
||||
mVideoHeight = height;
|
||||
}
|
||||
|
||||
/* 0x10 */ s32 mEfbWidth;
|
||||
/* 0x14 */ s32 mEfbHeight;
|
||||
/* 0x18 */ s32 mVideoWidth;
|
||||
/* 0x1C */ s32 mVideoHeight;
|
||||
};
|
||||
|
||||
class dThpPlayer_c : public dBase_c {
|
||||
public:
|
||||
dThpPlayer_c();
|
||||
~dThpPlayer_c();
|
||||
|
||||
virtual int create() override;
|
||||
virtual int doDelete() override;
|
||||
virtual int execute() override;
|
||||
virtual int draw() override;
|
||||
|
||||
void reallyExecute();
|
||||
void reallyCreate(u16, u16);
|
||||
s32 isDone();
|
||||
s32 play();
|
||||
s32 destroy();
|
||||
void open();
|
||||
void setupFile(char* filename, s32 loadAllAtOnce);
|
||||
|
||||
/* 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;
|
||||
/* 0xBC */ ThpVideoScreen mScreen;
|
||||
/* 0xDC */ s32 mSpecialType;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "__va_arg.h"
|
||||
#include "common.h"
|
||||
|
||||
#include "RVL/OS/OSContext.h"
|
||||
#include "rvl/OS/OSContext.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
+2
-2
@@ -27,6 +27,7 @@
|
||||
#include "rvl/VI/vi.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
#include "toBeSorted/save_manager.h"
|
||||
#include "THPPlayer/THPPlayer.h"
|
||||
|
||||
#include "rvl/OS.h"
|
||||
|
||||
@@ -296,7 +297,6 @@ void Manage_c::ModeProc_Normal() {
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void fn_803267B0(s32, s32);
|
||||
void Manage_c::ModeInit_SoftReset() {
|
||||
DebugPrintMode("SoftReset");
|
||||
if (mSoftReset) {
|
||||
@@ -315,7 +315,7 @@ void Manage_c::ModeInit_SoftReset() {
|
||||
} else {
|
||||
dSndPlayerMgr_c::GetInstance()->fn_8035E250(30);
|
||||
}
|
||||
fn_803267B0(0, 60);
|
||||
THPPlayerSetVolume(0, 60);
|
||||
mpFader->setFrame(30);
|
||||
mpFader->fadeOut();
|
||||
field_0x66 = true;
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_sys.h"
|
||||
#include "f/f_base.h"
|
||||
#include "f/f_profile.h"
|
||||
#include "f/f_profile_name.h"
|
||||
#include "m/m_color.h"
|
||||
#include "m/m_video.h"
|
||||
#include "rvl/OS/OSError.h"
|
||||
#include "nw4r/ut/ut_LockedCache.h"
|
||||
#include "m/m_heap.h"
|
||||
#include "m/m3d/m3d.h"
|
||||
#include "m/m_dvd.h"
|
||||
#include "d/d_heap.h"
|
||||
#include "THPPlayer/THPPlayer.h"
|
||||
#include "d/d_thp_player.h"
|
||||
#include "d/d_gfx.h"
|
||||
|
||||
SPECIAL_BASE_PROFILE(THPPLAYER, dThpPlayer_c, fProfile::THPPLAYER, 0x3, 0x400);
|
||||
|
||||
int dThpPlayer_c::create() {
|
||||
reallyCreate(mVideo::m_video->pRenderMode->fbWidth, mVideo::m_video->pRenderMode->efbHeight);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int dThpPlayer_c::doDelete() {
|
||||
if (destroy() == 0) {
|
||||
return NOT_READY;
|
||||
} else {
|
||||
THPPlayerQuit();
|
||||
return SUCCEEDED;
|
||||
}
|
||||
}
|
||||
int dThpPlayer_c::execute() {
|
||||
reallyExecute();
|
||||
return SUCCEEDED;
|
||||
}
|
||||
int dThpPlayer_c::draw() {
|
||||
dSys_c::setClearColor(mColor(0xFF));
|
||||
mScreen.addToDrawList();
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
dThpPlayer_c::dThpPlayer_c(): mDvdCallback(), mFilename(), mLoadAllAtOnce(0), mFilenameSet(0), mSetupDone(0), isPlaying(0), mBuffer(nullptr), mScreen(), mSpecialType(3) {}
|
||||
|
||||
dThpPlayer_c::~dThpPlayer_c() {
|
||||
if (mBuffer != nullptr) {
|
||||
dHeap::work2Heap.heap->free(mBuffer);
|
||||
mBuffer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void dThpPlayer_c::reallyCreate(u16 efbWidth, u16 efbHeight) {
|
||||
THPPlayerInit(1);
|
||||
isPlaying = 0;
|
||||
mBuffer = nullptr;
|
||||
mScreen.setEfbWidth(efbWidth);
|
||||
mScreen.setEfbHeight(efbHeight);
|
||||
m3d::resetMaterial();
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
s32 THPVideoDecode(s32 p1, s32 p2, s32 p3, s32 p4, s32 p5);
|
||||
}
|
||||
|
||||
void drawTHPFrame(u32 p1, u32 p2, u32 p3, u32 p4, u32 p5, u32 p6) {
|
||||
THPPlayerDrawCurrentFrame(p1, p2, p3, p4, p5, p6);
|
||||
THPPlayerPostDrawDone();
|
||||
}
|
||||
|
||||
static s32 callback(void* player) {
|
||||
((dThpPlayer_c*) player)->open();
|
||||
return 1;
|
||||
}
|
||||
|
||||
void dThpPlayer_c::open() {
|
||||
if (!THPPlayerOpen(mFilename.mChars, mLoadAllAtOnce)) {
|
||||
mFilenameSet = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void dThpPlayer_c::setupFile(char* filename, s32 loadAllAtOnce) {
|
||||
if (destroy()) {
|
||||
mFilenameSet = 1;
|
||||
mFilename = filename;
|
||||
mLoadAllAtOnce = loadAllAtOnce;
|
||||
mDvdCallback = mDvd_callback_c::createOrDie((dvdReadCallback)callback, this);
|
||||
}
|
||||
}
|
||||
|
||||
static const u8 SPECIAL_TYPES[] = {0x7A, 0x78, 0x78};
|
||||
|
||||
void dThpPlayer_c::reallyExecute() {
|
||||
if (mDvdCallback == nullptr || mDvdCallback->mStatus == 0 || !mFilenameSet || mSetupDone) {
|
||||
return;
|
||||
}
|
||||
if (mFilename == "THP/Demo01_01.thp") {
|
||||
mSpecialType = 0;
|
||||
} else if (mFilename == "THP/Demo01_02.thp") {
|
||||
mSpecialType = 1;
|
||||
} else if (mFilename == "THP/Demo78_01.thp") {
|
||||
mSpecialType = 2;
|
||||
}
|
||||
if (mSpecialType != 3) {
|
||||
THPPlayerSetVolume(SPECIAL_TYPES[mSpecialType], 0);
|
||||
}
|
||||
THPPlayerGetVideoInfo(&mVideoComponent);
|
||||
THPPlayerGetAudioInfo(&mAudioComponent);
|
||||
mScreen.setVideoDimensions(
|
||||
mVideoComponent.xSize,
|
||||
(mVideoComponent.ySize * (dGfx_c::getEFBHeightF() / dGfx_c::getCurrentScreenHeightF()))
|
||||
);
|
||||
mBuffer = (u8*)dHeap::work2Heap.heap->alloc(THPPlayerCalcNeedMemory(), 0x20);
|
||||
if (mBuffer == nullptr) {
|
||||
#line 279
|
||||
OSError("Can\'t allocate memory.");
|
||||
} else {
|
||||
THPPlayerSetBuffer(mBuffer);
|
||||
if (THPPlayerPrepare(0, 0, 0) == 0) {
|
||||
#line 288
|
||||
OSError("Fail to prepare.");
|
||||
} else {
|
||||
mSetupDone = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s32 dThpPlayer_c::play() {
|
||||
if (!mFilenameSet) {
|
||||
return true;
|
||||
} else if (!mSetupDone) {
|
||||
return false;
|
||||
} else {
|
||||
THPPlayerPlay();
|
||||
isPlaying = 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
s32 dThpPlayer_c::destroy() {
|
||||
if (mDvdCallback != nullptr) {
|
||||
if (mDvdCallback->mStatus == 0) {
|
||||
return NOT_READY;
|
||||
}
|
||||
THPPlayerStop();
|
||||
THPPlayerClose();
|
||||
if (mBuffer != nullptr) {
|
||||
dHeap::work2Heap.heap->free(mBuffer);
|
||||
mBuffer = nullptr;
|
||||
}
|
||||
mDvdCallback->do_delete();
|
||||
mDvdCallback = nullptr;
|
||||
mFilenameSet = 0;
|
||||
mSetupDone = 0;
|
||||
isPlaying = 0;
|
||||
}
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
s32 dThpPlayer_c::isDone() {
|
||||
return THPPlayerGetState() == 3;
|
||||
}
|
||||
|
||||
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) {
|
||||
nw4r::ut::LC::Lock();
|
||||
s32 result = THPVideoDecode(p1, p2, p3, p4, p5);
|
||||
nw4r::ut::LC::Unlock();
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user