inital commit
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
#ifndef SCE_MPEG_AUDIODEC_H
|
||||
#define SCE_MPEG_AUDIODEC_H
|
||||
|
||||
#include "typedefs.h"
|
||||
|
||||
#define VOLUME_MASTER_MAX 0x3fff
|
||||
|
||||
#define AU_STATE_INIT 0
|
||||
#define AU_STATE_PRESET 1
|
||||
#define AU_STATE_PLAY 2
|
||||
#define AU_STATE_PAUSE 3
|
||||
|
||||
#define AUTODMA_CH 0
|
||||
|
||||
#define UNIT_SIZE 1024
|
||||
|
||||
typedef struct { // 0x20
|
||||
/* 0x00 */ char id[4];
|
||||
/* 0x04 */ int size;
|
||||
/* 0x08 */ int type;
|
||||
/* 0x0c */ int rate;
|
||||
/* 0x10 */ int ch;
|
||||
/* 0x14 */ int interSize;
|
||||
/* 0x18 */ int loopStart;
|
||||
/* 0x1c */ int loopEnd;
|
||||
} SpuStreamHeader;
|
||||
|
||||
typedef struct { // 0x8
|
||||
/* 0x0 */ char id[4];
|
||||
/* 0x4 */ int size;
|
||||
} SpuStreamBody;
|
||||
|
||||
typedef struct { // 0x5c
|
||||
/* 0x00 */ int state;
|
||||
/* 0x04 */ SpuStreamHeader sshd;
|
||||
/* 0x24 */ SpuStreamBody ssbd;
|
||||
/* 0x2c */ int hdrCount;
|
||||
/* 0x30 */ u_char *data;
|
||||
/* 0x34 */ int put;
|
||||
/* 0x38 */ int count;
|
||||
/* 0x3c */ int size;
|
||||
/* 0x40 */ int totalBytes;
|
||||
/* 0x44 */ int iopBuff;
|
||||
/* 0x48 */ int iopBuffSize;
|
||||
/* 0x4c */ int iopLastPos;
|
||||
/* 0x50 */ int iopPausePos;
|
||||
/* 0x54 */ int totalBytesSent;
|
||||
/* 0x58 */ int iopZero;
|
||||
} AudioDec;
|
||||
|
||||
#endif // SCE_MPEG_AUDIODEC_H
|
||||
@@ -0,0 +1,38 @@
|
||||
#ifndef SCE_MPEG_DEFS_H
|
||||
#define SCE_MPEG_DEFS_H
|
||||
|
||||
#include "typedefs.h"
|
||||
|
||||
#ifdef BUILD_EU_VERSION
|
||||
#define MAX_WIDTH 640
|
||||
#define MAX_HEIGHT 448
|
||||
#else
|
||||
#define MAX_WIDTH 640
|
||||
#define MAX_HEIGHT 480
|
||||
#endif
|
||||
|
||||
// these are the same for both US and EU versions of the game
|
||||
#define MPEG_DISP_WIDTH 640
|
||||
#define MPEG_DISP_HEIGHT 480
|
||||
|
||||
#define bound(val, x) ((((val) + (x) - 1) / (x))*(x))
|
||||
|
||||
#define N_VOBUF 2
|
||||
|
||||
#define N_LDTAGS (MAX_WIDTH/16 * MAX_HEIGHT/16 * 6 + 10)
|
||||
|
||||
#define TS_NONE -1
|
||||
|
||||
static inline void *DmaAddr(void *val)
|
||||
{
|
||||
return (void*)((u_int)val & 0x0fffffff);
|
||||
}
|
||||
|
||||
static inline void *UncAddr(void *val)
|
||||
{
|
||||
return (void*)(((u_int)val & 0x0fffffff) | 0x20000000);
|
||||
}
|
||||
|
||||
void clearGsMem(int r, int g, int b, int disp_width, int disp_height);
|
||||
|
||||
#endif // SCE_MPEG_DEFS_H
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef SCE_MPEG_DISP_H
|
||||
#define SCE_MPEG_DISP_H
|
||||
|
||||
void clearGsMem(int r, int g, int b, int disp_width, int disp_height);
|
||||
|
||||
#endif // SCE_MPEG_DISP_H
|
||||
@@ -0,0 +1,84 @@
|
||||
#ifndef SCE_MPEG_LIBMPEG_H
|
||||
#define SCE_MPEG_LIBMPEG_H
|
||||
|
||||
#include "typedefs.h"
|
||||
|
||||
#include "sce/mpeg/defs.h"
|
||||
|
||||
#define SCE_MPEG_BUFFER_SIZE(w, h) ((w)*(h)*9/2 + 512 + 24*64 + 8192)
|
||||
|
||||
typedef enum {
|
||||
sceMpegCbError = 0,
|
||||
sceMpegCbNodata = 1,
|
||||
sceMpegCbStopDMA = 2,
|
||||
sceMpegCbRestartDMA = 3,
|
||||
sceMpegCbBackground = 4,
|
||||
sceMpegCbTimeStamp = 5,
|
||||
sceMpegCbStr = 6,
|
||||
} sceMpegCbType;
|
||||
|
||||
typedef enum {
|
||||
sceMpegStrM2V = 0,
|
||||
sceMpegStrIPU = 1,
|
||||
sceMpegStrPCM = 2,
|
||||
sceMpegStrADPCM = 3,
|
||||
sceMpegStrDATA = 4,
|
||||
} sceMpegStrType;
|
||||
|
||||
typedef struct {
|
||||
int width;
|
||||
int height;
|
||||
int frameCount;
|
||||
long int pts;
|
||||
long int dts;
|
||||
u_long flags;
|
||||
long int pts2nd;
|
||||
long int dts2nd;
|
||||
u_long flags2nd;
|
||||
void *sys;
|
||||
} sceMpeg;
|
||||
|
||||
typedef struct {
|
||||
sceMpegCbType type;
|
||||
char *errMessage;
|
||||
} sceMpegCbDataError;
|
||||
|
||||
typedef struct {
|
||||
sceMpegCbType type;
|
||||
long int pts;
|
||||
long int dts;
|
||||
} sceMpegCbDataTimeStamp;
|
||||
|
||||
typedef struct {
|
||||
sceMpegCbType type;
|
||||
u_char *header;
|
||||
u_char *data;
|
||||
u_int len;
|
||||
long int pts;
|
||||
long int dts;
|
||||
} sceMpegCbDataStr;
|
||||
|
||||
typedef union {
|
||||
sceMpegCbType type;
|
||||
sceMpegCbDataError error;
|
||||
sceMpegCbDataTimeStamp ts;
|
||||
sceMpegCbDataStr str;
|
||||
} sceMpegCbData;
|
||||
|
||||
typedef struct {
|
||||
u_int pix[256];
|
||||
} sceIpuRGB32;
|
||||
|
||||
typedef int (*sceMpegCallback)(sceMpeg *mp, sceMpegCbData *cbData, void *anyData);
|
||||
|
||||
int sceMpegReset(sceMpeg *mp);
|
||||
int sceMpegCreate(sceMpeg *mp, u_char *work_area, int work_area_size);
|
||||
int sceMpegDelete(sceMpeg *mp);
|
||||
int sceMpegGetPicture(sceMpeg *mp, sceIpuRGB32 *rgb32, int mbcount);
|
||||
int sceMpegIsEnd(sceMpeg *mp);
|
||||
int sceMpegIsRefBuffEmpty(sceMpeg *mp);
|
||||
void sceMpegSetDecodeMode(sceMpeg *mp, int ni, int np, int nb);
|
||||
sceMpegCallback sceMpegAddCallback(sceMpeg *mp, sceMpegCbType type, sceMpegCallback callback, void *anyData);
|
||||
sceMpegCallback sceMpegAddStrCallback(sceMpeg *mp, sceMpegStrType strType, int ch, sceMpegCallback callback, void *anyData);
|
||||
|
||||
#endif // SCE_MPEG_LIBMPEG_H
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef SCE_MPEG_READBUF_H
|
||||
#define SCE_MPEG_READBUF_H
|
||||
|
||||
#include "typedefs.h"
|
||||
|
||||
#define READ_UNIT_SIZE (64*1024)
|
||||
#define N_READ_UNIT 5
|
||||
#define READBUF_BUFF_SIZE (N_READ_UNIT * READ_UNIT_SIZE)
|
||||
|
||||
typedef struct
|
||||
{ // 0x5000c
|
||||
/* 0x00000 */ u_char data[N_READ_UNIT * READ_UNIT_SIZE];
|
||||
/* 0x50000 */ int put;
|
||||
/* 0x50004 */ int count;
|
||||
/* 0x50008 */ int size;
|
||||
} ReadBuf;
|
||||
|
||||
#endif // SCE_MPEG_READBUF_H
|
||||
@@ -0,0 +1,52 @@
|
||||
#ifndef SCE_MPEG_VIBUF_H
|
||||
#define SCE_MPEG_VIBUF_H
|
||||
|
||||
#include "typedefs.h"
|
||||
|
||||
#include "sce/libipu.h"
|
||||
|
||||
#define DMA_ID_REFE 0
|
||||
#define DMA_ID_NEXT 2
|
||||
#define DMA_ID_REF 3
|
||||
|
||||
#define VIBUF_ELM_SIZE 2048
|
||||
#define VIBUF_SIZE 256
|
||||
#define VIBUF_TS_SIZE (VIBUF_SIZE*2)
|
||||
|
||||
#define TAG_ADDR(i) ((u_int)DmaAddr(f->tag + i))
|
||||
#define DATA_ADDR(i) ((u_int)f->data + VIBUF_ELM_SIZE * (i))
|
||||
#define WRAP_ADDR(addr) ((u_int)(f->data) + (((u_int)(addr) - (u_int)(f->data)) % (VIBUF_ELM_SIZE * f->n)))
|
||||
#define IsInRegion(i,start,len,n) ( (0 <= (((i) + (n) - (start)) % (n))) && ((((i) + (n) - (start)) % (n)) < (len)))
|
||||
|
||||
extern inline int IsPtsInRegion(int tgt, int pos, int len, int size)
|
||||
{
|
||||
int tgt1 = (tgt + size - pos) % size;
|
||||
return tgt1 < len;
|
||||
}
|
||||
|
||||
typedef struct { // 0x18
|
||||
/* 0x00 */ long int pts;
|
||||
/* 0x08 */ long int dts;
|
||||
/* 0x10 */ int pos;
|
||||
/* 0x14 */ int len;
|
||||
} TimeStamp;
|
||||
|
||||
typedef struct { // 0x60
|
||||
/* 0x00 */ u_long128 *data;
|
||||
/* 0x04 */ u_long128 *tag;
|
||||
/* 0x08 */ int n;
|
||||
/* 0x0c */ int dmaStart;
|
||||
/* 0x10 */ int dmaN;
|
||||
/* 0x14 */ int readBytes;
|
||||
/* 0x18 */ int buffSize;
|
||||
/* 0x1c */ sceIpuDmaEnv env;
|
||||
/* 0x40 */ int sema;
|
||||
/* 0x44 */ int isActive;
|
||||
/* 0x48 */ long int totalBytes;
|
||||
/* 0x50 */ TimeStamp *ts;
|
||||
/* 0x54 */ int n_ts;
|
||||
/* 0x58 */ int count_ts;
|
||||
/* 0x5c */ int wt_ts;
|
||||
} ViBuf;
|
||||
|
||||
#endif // SCE_MPEG_VIBUF_H
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef SCE_MPEG_VIDEODEC_H
|
||||
#define SCE_MPEG_VIDEODEC_H
|
||||
|
||||
#include "sce/mpeg/libmpeg.h"
|
||||
#include "sce/mpeg/vibuf.h"
|
||||
|
||||
#define VD_STATE_NORMAL 0
|
||||
#define VD_STATE_ABORT 1
|
||||
#define VD_STATE_FLUSH 2
|
||||
#define VD_STATE_END 3
|
||||
|
||||
typedef struct { // 0xb8
|
||||
/* 0x00 */ sceMpeg mpeg;
|
||||
/* 0x48 */ ViBuf vibuf;
|
||||
/* 0xa8 */ u_int state;
|
||||
/* 0xac */ int sema;
|
||||
/* 0xb0 */ int hid_endimage;
|
||||
/* 0xb4 */ int hid_vblank;
|
||||
} VideoDec;
|
||||
|
||||
#endif // SCE_MPEG_VIDEODEC_H
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef SCE_MPEG_VOBUF_H
|
||||
#define SCE_MPEG_VOBUF_H
|
||||
|
||||
#include "typedefs.h"
|
||||
|
||||
#include "sce/mpeg/libmpeg.h"
|
||||
|
||||
#define N_GSBUF 2
|
||||
|
||||
#define VOBUF_STATUS_ 0
|
||||
#define VOBUF_STATUS_TOPDONE 1
|
||||
#define VOBUF_STATUS_FULL 2
|
||||
|
||||
typedef struct {
|
||||
u_char v[MAX_WIDTH * MAX_HEIGHT * 4];
|
||||
} VoData;
|
||||
|
||||
typedef struct {
|
||||
int status;
|
||||
int dummy[15];
|
||||
u_int v[N_VOBUF][bound((N_LDTAGS+100)*4, 64)];
|
||||
} VoTag;
|
||||
|
||||
typedef struct {
|
||||
VoData *data;
|
||||
VoTag *tag;
|
||||
volatile int write;
|
||||
volatile int count;
|
||||
int size;
|
||||
} VoBuf;
|
||||
|
||||
#endif // SCE_MPEG_VOBUF_H
|
||||
Reference in New Issue
Block a user