You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
Begin HVQM support
This commit is contained in:
122
include/hvqm/HVQM2File.h
Normal file
122
include/hvqm/HVQM2File.h
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* HVQM2File.h: HVQM2(YUV 4:2:2/4:1:1) file format header file.
|
||||
*
|
||||
* Copyright (C) 1998,1999 NINTENDO Co., Ltd.
|
||||
*
|
||||
*/
|
||||
|
||||
/* revision 1.1 1999-02-12 */
|
||||
|
||||
#ifndef __HVQM2FILE_H__
|
||||
#define __HVQM2FILE_H__
|
||||
|
||||
#include <HVQmd.h>
|
||||
|
||||
/*
|
||||
* HVQM2Header : HVQM2 file header
|
||||
*/
|
||||
typedef struct {
|
||||
CARD8 file_version[16]; /* File version "HVQM2 1.0" */
|
||||
CARD32 file_size; /* File size [byte] */
|
||||
|
||||
CARD16 width; /* Number of pixels in horizontal direction of image */
|
||||
CARD16 height; /* Number of pixels in vertical direction of image */
|
||||
CARD8 h_sampling_rate; /* Video UV component's sampling step in horizontal direction */
|
||||
CARD8 v_sampling_rate; /* Video UV component's sampling step in vertical direction */
|
||||
CARD8 y_shiftnum; /* Image base read start y-coordinate LSB */
|
||||
CARD8 video_quantize_shift; /* Video quantized step */
|
||||
|
||||
CARD32 total_frames; /* Total number of video records */
|
||||
CARD32 usec_per_frame; /* Video frame interval [usec.] */
|
||||
CARD32 max_frame_size; /* Maximum size of video record [bytes]
|
||||
(Excluding record header) */
|
||||
CARD32 max_sp_packets; /* Maximum number of packets needed for SP FIFO */
|
||||
|
||||
CARD8 audio_format; /* Audio data format */
|
||||
CARD8 channels; /* Number of audio channels */
|
||||
CARD8 sample_bits; /* Number of bits in 1 sample (channel) [bit] */
|
||||
CARD8 audio_quantize_step; /* Audio quantized step */
|
||||
|
||||
CARD32 total_audio_records; /* Total number of audio records */
|
||||
CARD32 samples_per_sec; /* Number of audio samples per second */
|
||||
CARD32 max_audio_record_size; /* Maximum size of audio record [byte]
|
||||
(Excluding record header) */
|
||||
} HVQM2Header;
|
||||
|
||||
/*
|
||||
* Audio data format (HVQM2Header.audio_format)
|
||||
*/
|
||||
#define HVQM2_AUDIO_PCM 0 /* PCM format */
|
||||
#define HVQM2_AUDIO_IMA_ADPCM 1 /* IMA ADPCM format */
|
||||
|
||||
/*
|
||||
* HVQM2Record : Record header (Located directly after HVQM2Header)
|
||||
*/
|
||||
typedef struct {
|
||||
CARD16 type; /* Record type */
|
||||
CARD16 format; /* Data format */
|
||||
CARD32 size; /* Record size (excluding the header) [byte] */
|
||||
} HVQM2Record;
|
||||
|
||||
/*
|
||||
* Record type (HVQM2Record.type)
|
||||
*/
|
||||
#define HVQM2_AUDIO 0 /* Audio record */
|
||||
#define HVQM2_VIDEO 1 /* Video record */
|
||||
|
||||
/*
|
||||
* Audio record's (HVQM2Record.type == HVQM2_AUDIO)
|
||||
* data type (HVQM2Record.format)
|
||||
*/
|
||||
#define HVQM2_AUDIO_KEYFRAME 0 /* Key frame */
|
||||
#define HVQM2_AUDIO_PREDICT 1 /* Predict frame */
|
||||
|
||||
/*
|
||||
* Video record's (HVQM2Record.type == HVQM2_VIDEO)
|
||||
* data format (HVQM2Record.format)
|
||||
*/
|
||||
#define HVQM2_VIDEO_KEYFRAME 0 /* Key frame */
|
||||
#define HVQM2_VIDEO_PREDICT 1 /* Predict frame */
|
||||
#define HVQM2_VIDEO_HOLD 2 /* Hold frame */
|
||||
|
||||
/*
|
||||
* HVQM2Audio : Audio header (Follows record header)
|
||||
*/
|
||||
typedef struct {
|
||||
CARD32 samples; /* Number of samples (/channels) */
|
||||
} HVQM2Audio;
|
||||
|
||||
/*
|
||||
* HVQM2Frame : Video header (Follows record header)
|
||||
*/
|
||||
typedef struct {
|
||||
CARD32 basisnum_offset[2]; /* Basis number block (0: brightness, 1: color difference) */
|
||||
CARD32 basnumrn_offset[2]; /* Basis number cold run (0: brightness, 1: color difference) */
|
||||
CARD32 scale_offset[3]; /* Basis coefficient (0:Y, 1:U, 2:V) */
|
||||
CARD32 fixvl_offset[3]; /* Fixed length code (0:Y, 1:U, 2:V) */
|
||||
CARD32 dcval_offset[3]; /* Block DC (0:Y, 1:U, 2:V) */
|
||||
} HVQM2Frame;
|
||||
|
||||
/*
|
||||
* HVQM2KeyFrame : Key frame header (Follows the video header)
|
||||
*/
|
||||
typedef struct {
|
||||
CARD32 dcrun_offset[3]; /* DC value cold run (0:Y, 1:U, 2:V) */
|
||||
CARD16 nest_start_x; /* Base start position (x coordinate) */
|
||||
CARD16 nest_start_y; /* Base start position (y coordinate) */
|
||||
} HVQM2KeyFrame;
|
||||
|
||||
/*
|
||||
* HVQM2PredictFrame : Predict frame header (Follows video header)
|
||||
*/
|
||||
typedef struct {
|
||||
CARD32 movevector_offset; /* Movement vector */
|
||||
CARD32 macroblock_offset; /* Macro block state flag */
|
||||
} HVQM2PredictFrame;
|
||||
|
||||
/* Nest size */
|
||||
#define HVQM2_NESTSIZE_L 70 /* Number of elements on long side */
|
||||
#define HVQM2_NESTSIZE_S 38 /* Number of elements on shot side */
|
||||
#define HVQM2_NESTSIZE (HVQM2_NESTSIZE_L * HVQM2_NESTSIZE_S)
|
||||
|
||||
#endif /* __HVQM2FILE_H__ */
|
||||
22
include/hvqm/HVQmd.h
Normal file
22
include/hvqm/HVQmd.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* HVQmd.h: MACHINE DEPENDENT DECLARATIONS. [ For Nintendo64 ]
|
||||
*
|
||||
* Copyright (C) 1998,1999 NINTENDO Co.,Ltd.
|
||||
*
|
||||
*/
|
||||
|
||||
/* revision 1.0 1998-10-14 */
|
||||
|
||||
#ifndef __HVQMD_H__
|
||||
#define __HVQMD_H__
|
||||
|
||||
#include <ultra64.h>
|
||||
|
||||
typedef u8 CARD8;
|
||||
typedef s8 INT8;
|
||||
typedef u16 CARD16;
|
||||
typedef s16 INT16;
|
||||
typedef u32 CARD32;
|
||||
typedef s32 INT32;
|
||||
|
||||
#endif /* __HVQMD_H__ */
|
||||
33
include/hvqm/adpcmdec.h
Normal file
33
include/hvqm/adpcmdec.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* adpcmdec.h - N64-HVQM2 library header file
|
||||
*
|
||||
* Copyright (C) 1998,1999 NINTENDO Co.,Ltd.
|
||||
*
|
||||
*/
|
||||
|
||||
/* revision 1.0 1998-12-17 */
|
||||
|
||||
#ifndef __ADPCMDEC_H__
|
||||
#define __ADPCMDEC_H__
|
||||
|
||||
#include <ultra64.h>
|
||||
|
||||
/* ADPCM state information structure */
|
||||
typedef struct {
|
||||
u8 *inPtr;
|
||||
s16 *outPtr;
|
||||
s16 previous;
|
||||
u8 hi_nibble;
|
||||
u8 step_index;
|
||||
} ADPCMstate;
|
||||
|
||||
/* ADPCM decoder */
|
||||
void adpcmDecode(void *instream, u32 format, u32 samples, s16 *outstream, u32 ex_stereo, ADPCMstate *state);
|
||||
|
||||
/* adpcmDecode() format argument */
|
||||
#define ADPCM_RESET 0
|
||||
#define ADPCM_CONTINUE 1
|
||||
|
||||
#endif /* __ADPCMDEC_H__ */
|
||||
|
||||
/* end */
|
||||
104
include/hvqm/hvqm2dec.h
Normal file
104
include/hvqm/hvqm2dec.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* hvqm2dec.h - N64-HVQM2 library header file
|
||||
*
|
||||
* Copyright (C) 1998,1999 NINTENDO Co.,Ltd.
|
||||
*/
|
||||
|
||||
/* revision 1.2 1999-03-26 */
|
||||
|
||||
#ifndef __HVQM2DEC_H__
|
||||
#define __HVQM2DEC_H__
|
||||
|
||||
#include <ultra64.h>
|
||||
#include <HVQM2File.h>
|
||||
|
||||
typedef struct {
|
||||
u8 nbase;
|
||||
u8 dc;
|
||||
u8 dc_l;
|
||||
u8 dc_r;
|
||||
u8 dc_u;
|
||||
u8 dc_d;
|
||||
} HVQM2Block;
|
||||
|
||||
typedef struct {
|
||||
u8 sx;
|
||||
u8 sy;
|
||||
s16 scale;
|
||||
u16 offset;
|
||||
u16 lineskip;
|
||||
} HVQM2Basis;
|
||||
|
||||
typedef union {
|
||||
HVQM2Block blockinfo;
|
||||
HVQM2Basis basisinfo;
|
||||
long long int force_structure_alignment;
|
||||
} HVQM2Info;
|
||||
|
||||
typedef struct {
|
||||
u64 *info;
|
||||
u64 *buf;
|
||||
u16 buf_width;
|
||||
u8 chroma_step_h;
|
||||
u8 chroma_step_v;
|
||||
u16 hmcus;
|
||||
u16 vmcus;
|
||||
u8 alpha;
|
||||
u8 nest[HVQM2_NESTSIZE];
|
||||
} HVQM2Arg_t;
|
||||
|
||||
typedef union {
|
||||
HVQM2Arg_t t;
|
||||
long long int force_structure_alignment;
|
||||
} HVQM2Arg;
|
||||
|
||||
/*
|
||||
* Functions supporting 16-bit color (CPU version)
|
||||
*/
|
||||
void hvqm2Init1(u8 alpha);
|
||||
u32 hvqm2Setup1(HVQM2Header *header, u32 outbufWidth);
|
||||
void hvqm2Decode1(void *code, u32 format, u16 *outbuf, u16 *previm, u16 *workbuf);
|
||||
|
||||
/*
|
||||
* Functions supporting 32-bit color (CPU version)
|
||||
*/
|
||||
void hvqm2Init2(u8 alpha);
|
||||
u32 hvqm2Setup2(HVQM2Header *header, u32 outbufWidth);
|
||||
void hvqm2Decode2(void *code, u32 format, u32 *outbuf, u32 *previm, u16 *workbuf);
|
||||
|
||||
/*
|
||||
* Functions supporting 16-bit color (RSP version)
|
||||
*/
|
||||
void hvqm2InitSP1(u8 alpha);
|
||||
u32 hvqm2SetupSP1(HVQM2Header *header, u32 outbufWidth);
|
||||
u32 hvqm2DecodeSP1(void *code, u32 format, u16 *outbuf, u16 *previm, u16 *workbuf, HVQM2Arg *arg, HVQM2Info *infobuf);
|
||||
|
||||
/*
|
||||
* Functions supporting 32-bit color (RSP version)
|
||||
*/
|
||||
void hvqm2InitSP2(u8 alpha);
|
||||
u32 hvqm2SetupSP2(HVQM2Header *header, u32 outbufWidth);
|
||||
u32 hvqm2DecodeSP2(void *code, u32 format, u32 *outbuf, u32 *previm, u16 *workbuf, HVQM2Arg *arg, HVQM2Info *infobuf);
|
||||
|
||||
/*
|
||||
* RSP microcode-related definitions
|
||||
*/
|
||||
#define M_HVQM2TASK 7 /* task type */
|
||||
#define HVQM2_UCODE_DATA_SIZE 0x70 /* microcode data size */
|
||||
#define HVQM2_YIELD_DATA_SIZE 0xc10 /* yield buffer size */
|
||||
|
||||
/*
|
||||
* Definitions for RSP microcode supporting 16-bit color
|
||||
*/
|
||||
extern u8 hvqm2sp1TextStart[], hvqm2sp1TextEnd[];
|
||||
extern u8 hvqm2sp1DataStart[], hvqm2sp1DataEnd[];
|
||||
|
||||
/*
|
||||
* Definitions for RSP microcode supporting 32-bit color
|
||||
*/
|
||||
extern u8 hvqm2sp2TextStart[], hvqm2sp2TextEnd[];
|
||||
extern u8 hvqm2sp2DataStart[], hvqm2sp2DataEnd[];
|
||||
|
||||
#endif /* __HVQM2DEC_H__ */
|
||||
|
||||
/* end */
|
||||
@@ -166,8 +166,8 @@
|
||||
CMD_PTR(romEnd)
|
||||
#endif
|
||||
|
||||
#define LOAD_MARIO_HEAD(sethead) \
|
||||
CMD_BBH(0x19, 0x04, sethead)
|
||||
#define LOAD_MARIO_HEAD() \
|
||||
CMD_BBH(0x32, 0x04, 0x0000)
|
||||
|
||||
#ifdef NO_SEGMENTED_MEMORY
|
||||
#define LOAD_YAY0_TEXTURE(seg, romStart, romEnd) \
|
||||
|
||||
Reference in New Issue
Block a user