Import SDK Types

This commit is contained in:
gamemasterplc 2023-11-22 14:01:55 -06:00
parent 84b3e69630
commit 4fe4c38e0d
86 changed files with 6528 additions and 27 deletions

View file

@ -0,0 +1,38 @@
#ifndef _DOLPHIN_THPAUDIO
#define _DOLPHIN_THPAUDIO
#include "dolphin/types.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct THPAudioRecordHeader {
u32 offsetNextChannel;
u32 sampleSize;
s16 lCoef[8][2];
s16 rCoef[8][2];
s16 lYn1;
s16 lYn2;
s16 rYn1;
s16 rYn2;
} THPAudioRecordHeader;
typedef struct THPAudioDecodeInfo {
u8* encodeData;
u32 offsetNibbles;
u8 predictor;
u8 scale;
s16 yn1;
s16 yn2;
} THPAudioDecodeInfo;
u32 THPAudioDecode(s16* audioBuffer, u8* audioFrame, s32 flag);
static s32 __THPAudioGetNewSample(THPAudioDecodeInfo* info);
static void __THPAudioInitialize(THPAudioDecodeInfo* info, u8* ptr);
#ifdef __cplusplus
}
#endif
#endif // _DOLPHIN_THPAUDIO

View file

@ -0,0 +1,29 @@
#ifndef _THP_THPAUDIODECODE_H
#define _THP_THPAUDIODECODE_H
#include "Dolphin/os.h"
#include "THP/THPAudio.h"
static void* AudioDecoderForOnMemory(void* bufPtr);
static void* AudioDecoder(void* _);
static void AudioDecode(THPReadBuffer* readBuffer);
#ifdef __cplusplus
extern "C" {
#endif
BOOL CreateAudioDecodeThread(OSPriority prio, void* param);
void AudioDecodeThreadStart();
void AudioDecodeThreadCancel();
void PushFreeAudioBuffer(void* buf);
void PushDecodedAudioBuffer(void* buf);
void* PopFreeAudioBuffer();
void* PopDecodedAudioBuffer(s32 flags);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,36 @@
#ifndef _THP_THPBUFFER_H
#define _THP_THPBUFFER_H
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
// Size 0x10
typedef struct THPTextureSet {
u8* mYTexture; // _00
u8* mUTexture; // _04
u8* mVTexture; // _08
s32 mFrameNumber; // _0C
} THPTextureSet;
// Size 0xC
typedef struct THPAudioBuffer {
s16* mBuffer; // _00
s16* mCurPtr; // _04
u32 mValidSample; // _08
} THPAudioBuffer;
// Size 0xC
typedef struct THPReadBuffer {
u8* mPtr; // _00
s32 mFrameNumber; // _04
BOOL mIsValid; // _08
} THPReadBuffer;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,21 @@
#ifndef _THP_THPDRAW_H
#define _THP_THPDRAW_H
#include "types.h"
#include "Dolphin/GX/GXTypes.h"
#ifdef __cplusplus
extern "C" {
#endif // ifdef __cplusplus
void THPGXRestore(void);
void THPGXYuv2RgbSetup(GXRenderModeObj* obj);
void THPGXYuv2RgbDraw(u32* yImage, u32* uImage, u32* vImage, s16 x, s16 y, s16 texWidth, s16 texHeight, s16 polyWidth, s16 polyHeight);
void THPPlayerStop();
BOOL THPPlayerSetVolume(int, int);
#ifdef __cplusplus
};
#endif // ifdef __cplusplus
#endif

View file

@ -0,0 +1,30 @@
#ifndef _THP_THPFILE_H
#define _THP_THPFILE_H
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
// Size 0x30
typedef struct THPHeader {
char mMagic[4]; // _00
u32 mVersion; // _04
u32 mBufferSize; // _08
u32 mAudioMaxSamples; // _0C
f32 mFrameRate; // _10
u32 mNumFrames; // _14
u32 mFirstFrameSize; // _18
u32 mMovieDataSize; // _1C
u32 mCompInfoDataOffsets; // _20
u32 mOffsetDataOffsets; // _24
u32 mMovieDataOffsets; // _28
u32 mFinalFrameDataOffsets; // _2C
} THPHeader;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,35 @@
#ifndef _THP_THPINFO_H
#define _THP_THPINFO_H
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
// Size 0xC
typedef struct THPVideoInfo {
u32 mXSize; // _00
u32 mYSize; // _04
u32 mVideoType; // _08
} THPVideoInfo;
// Size 0x10
typedef struct THPAudioInfo {
u32 mSndChannels; // _00
u32 mSndFrequency; // _04
u32 mSndNumSamples; // _08
u32 mSndNumTracks; // _0C
} THPAudioInfo;
// Size 0x14
typedef struct THPFrameCompInfo {
u32 mNumComponents; // _00
u8 mFrameComp[16]; // _04
} THPFrameCompInfo;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,91 @@
#ifndef _THP_THPPLAYER_H
#define _THP_THPPLAYER_H
#include "types.h"
#include "Dolphin/os.h"
#include "Dolphin/gx.h"
#include "THP/THPBuffer.h"
#include "THP/THPFile.h"
#include "THP/THPInfo.h"
#ifdef __cplusplus
extern "C" {
#endif
// Size: 0x1D0
typedef struct THPPlayer {
DVDFileInfo mFileInfo; // _00
THPHeader mHeader; // _3C
THPFrameCompInfo mCompInfo; // _6C
THPVideoInfo mVideoInfo; // _80
THPAudioInfo mAudioInfo; // _8C
void* mThpWorkArea; // _9C
BOOL mIsOpen; // _A0
u8 mState; // _A4
u8 mInternalState; // _A5
u8 mPlayFlag; // _A6
u8 mAudioExist; // _A7
s32 mDvdError; // _A8
s32 mVideoError; // _AC
BOOL mIsOnMemory; // _B0
u8* mMovieData; // _B4
s32 mInitOffset; // _B8
s32 mInitReadSize; // _BC
s32 mInitReadFrame; // _C0
u32 mCurField; // _C4
s64 mRetraceCount; // _C8
s32 mPrevCount; // _D0
s32 mCurCount; // _D4
s32 mVideoDecodeCount; // _D8
f32 mCurVolume; // _DC
f32 mTargetVolume; // _E0
f32 mDeltaVolume; // _E4
s32 mRampCount; // _E8
s32 mCurAudioTrack; // _EC
s32 mCurVideoNumber; // _F0
s32 mCurAudioNumber; // _F4
THPTextureSet* mDispTextureSet; // _F8
THPAudioBuffer* mPlayAudioBuffer; // _FC
THPReadBuffer mReadBuffer[10]; // _100
THPTextureSet mTextureSet[3]; // _178
THPAudioBuffer mAudioBuffer[3]; // _1A8
} THPPlayer;
extern THPPlayer ActivePlayer;
BOOL THPPlayerInit(int _);
void THPPlayerQuit();
BOOL THPPlayerOpen(const char* fileName, BOOL onMemory);
BOOL THPPlayerClose();
BOOL THPPlayerPlay();
void THPPlayerStop();
BOOL THPPlayerPause();
BOOL THPPlayerPrepare(int offset, u8 flag, int audioTrack);
BOOL THPPlayerSetBuffer(u8* data);
u32 THPPlayerCalcNeedMemory();
BOOL THPPlayerGetVideoInfo(void* dst);
BOOL THPPlayerGetAudioInfo(void* dst);
// f32 THPPlayerGetFrameRate();
BOOL THPPlayerSetVolume(int vol, int duration);
int THPPlayerDrawCurrentFrame(GXRenderModeObj* obj, int x, int y, int polyWidth,
int polyHeight); // TODO, parameter names from dwarf info if it exists
u32 THPPlayerGetTotalFrame();
u8 THPPlayerGetState();
void THPPlayerDrawDone();
void THPPlayerPostDrawDone();
// this should go in a dolphin THP header eventually
BOOL THPInit(void);
#ifdef __cplusplus
}
#endif
void PrepareReady(int msg);
#endif /* _THP_THPPLAYER_H */

View file

@ -0,0 +1,28 @@
#ifndef _THP_THPREAD_H
#define _THP_THPREAD_H
#include "dolphin/thp/THPBuffer.h"
#include "dolphin/os.h"
static void* Reader(void* arg);
#ifdef __cplusplus
extern "C" {
#endif // ifdef __cplusplus
BOOL CreateReadThread(OSPriority priority);
void ReadThreadStart();
void ReadThreadCancel();
OSMessage PopReadedBuffer();
BOOL PushReadedBuffer(OSMessage*);
OSMessage PopFreeReadBuffer();
BOOL PushFreeReadBuffer(OSMessage*);
OSMessage PopReadedBuffer2();
BOOL PushReadedBuffer2(OSMessage*);
extern u8 gTHPReaderDvdAccess;
#ifdef __cplusplus
};
#endif
#endif

View file

@ -0,0 +1,31 @@
#ifndef _DOLPHIN_THPVIDEODECODE
#define _DOLPHIN_THPVIDEODECODE
#include "dolphin/thp/THPRead.h"
static void* VideoDecoder(void*);
static void* VideoDecoderForOnMemory(void*);
static void VideoDecode(THPReadBuffer*);
#ifdef __cplusplus
extern "C" {
#endif // ifdef __cplusplus
s32 THPVideoDecode(void* file, void* tileY, void* tileU, void* tileV, void* work);
BOOL CreateVideoDecodeThread(OSPriority priority, void* task);
void VideoDecodeThreadStart();
void VideoDecodeThreadCancel();
OSMessage PopFreeTextureSet();
BOOL PushFreeTextureSet(OSMessage*);
OSMessage PopDecodedTextureSet(s32 flags);
BOOL PushDecodedTextureSet(OSMessage*);
extern BOOL VideoDecodeThreadCreated;
extern OSMessageQueue FreeTextureSetQueue;
extern OSMessageQueue DecodedTextureSetQueue;
extern OSThread VideoDecodeThread;
#ifdef __cplusplus
};
#endif
#endif // _DOLPHIN_THPVIDEODECODE