mirror of
https://github.com/zeldaret/ss
synced 2026-07-09 22:21:32 -04:00
d_thp with THPPlayer headers from SMS
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user