You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
HVQM no lag!!
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include <ultra64.h>
|
||||
#include <hvqm2dec.h>
|
||||
|
||||
#include "buffers.h"
|
||||
#include <game/hvqm.h>
|
||||
#include "config.h"
|
||||
|
||||
ALIGNED8 u8 gDecompressionHeap[0xD000];
|
||||
@@ -41,7 +43,13 @@ ALIGNED8 u8 gAudioSPTaskYieldBuffer[OS_YIELD_AUDIO_SIZE];
|
||||
ALIGNED8 u8 gUnusedThread2Stack[0x1400];
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
ALIGNED16 u8 hvqbuf[HVQ_DATASIZE_MAX];
|
||||
|
||||
ALIGNED16 u64 hvq_yieldbuf[HVQM2_YIELD_DATA_SIZE/8];
|
||||
ALIGNED16 u8 adpcmbuf[AUDIO_RECORD_SIZE_MAX];
|
||||
ALIGNED16 u16 hvqwork[(MAXWIDTH/8)*(MAXHEIGHT/4)*4];
|
||||
|
||||
// Data area for the HVQ microcode
|
||||
ALIGNED16 HVQM2Info hvq_spfifo[HVQ_SPFIFO_SIZE];
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define BUFFERS_H
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include <hvqm2dec.h>
|
||||
|
||||
#include "game/save_file.h"
|
||||
#include "game/game_init.h"
|
||||
@@ -31,4 +32,11 @@ extern u8 gGfxSPTaskStack[];
|
||||
|
||||
extern struct GfxPool gGfxPools[2];
|
||||
|
||||
extern u8 adpcmbuf[]; /* Buffer for audio records ADPCM) */
|
||||
|
||||
extern u64 hvq_yieldbuf[]; /* RSP task yield buffer */
|
||||
extern HVQM2Info hvq_spfifo[]; /* Data area for HVQM2 microcode */
|
||||
extern u16 hvqwork[]; /* Work buffer for HVQM2 decoder */
|
||||
extern u8 hvqbuf[]; /* Buffer for video records (HVQM2) */
|
||||
|
||||
#endif // BUFFERS_H
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
#include <ultra64.h>
|
||||
#include <sm64.h>
|
||||
#include <buffers/framebuffers.h>
|
||||
#include <buffers/buffers.h>
|
||||
#include <hvqm2dec.h>
|
||||
#include <adpcmdec.h>
|
||||
#include "hvqm.h"
|
||||
|
||||
u8 hvqbuf[HVQ_DATASIZE_MAX];
|
||||
|
||||
static OSIoMesg audioDmaMesgBlock;
|
||||
static OSMesgQueue audioDmaMessageQ;
|
||||
static OSMesg audioDmaMessages[AUDIO_DMA_MSG_SIZE];
|
||||
@@ -49,22 +48,14 @@ static u32 video_remain; /* Counter for remaining number of video records to rea
|
||||
static u64 disptime; /* Counter for scheduled display time of next video frame */
|
||||
static ADPCMstate adpcm_state; /* Buffer for state information passed to the ADPCM decoder */
|
||||
|
||||
u64 hvq_yieldbuf[HVQM2_YIELD_DATA_SIZE/8];
|
||||
u8 adpcmbuf[AUDIO_RECORD_SIZE_MAX];
|
||||
|
||||
/*
|
||||
* Macro for loading multi-byte data from buffer holding data from stream
|
||||
*/
|
||||
#define load32(from) (*(u32*)&(from))
|
||||
#define load16(from) (*(u16*)&(from))
|
||||
|
||||
extern u8 _hvqmSegmentRomStart[];
|
||||
|
||||
u16 hvqwork[(SCREEN_WD/8)*(SCREEN_HT/4)*4];
|
||||
// Data area for the HVQ microcode
|
||||
HVQM2Info hvq_spfifo[HVQ_SPFIFO_SIZE];
|
||||
// Buffer for RSP task yield
|
||||
u64 hvq_yieldbuf[HVQM2_YIELD_DATA_SIZE/8];
|
||||
extern u8 _capcomSegmentRomStart[];
|
||||
extern u8 _seinSegmentRomStart[];
|
||||
|
||||
u32 cfb_status[NUM_CFBs];
|
||||
|
||||
@@ -138,7 +129,7 @@ u8 *get_record(HVQM2Record *headerbuf, void *bodybuf, u16 type, u8 *stream, OSIo
|
||||
}
|
||||
|
||||
static u32 next_audio_record( void *pcmbuf ) {
|
||||
u8 header_buffer[sizeof(HVQM2Record)+16];
|
||||
ALIGNED16 u8 header_buffer[sizeof(HVQM2Record)+16];
|
||||
HVQM2Record *record_header;
|
||||
HVQM2Audio *audio_headerP;
|
||||
u32 samples;
|
||||
@@ -157,7 +148,7 @@ static u32 next_audio_record( void *pcmbuf ) {
|
||||
}
|
||||
|
||||
static tkAudioProc rewind( void ) {
|
||||
video_streamP = audio_streamP = (u32)_hvqmSegmentRomStart + sizeof(HVQM2Header);
|
||||
video_streamP = audio_streamP = (u32)_capcomSegmentRomStart + sizeof(HVQM2Header);
|
||||
audio_remain = total_audio_records;
|
||||
video_remain = total_frames;
|
||||
disptime = 0;
|
||||
@@ -204,7 +195,7 @@ void hvqm_main_proc() {
|
||||
init_cfb();
|
||||
osViSwapBuffer( gFrameBuffers[NUM_CFBs-1] );
|
||||
|
||||
romcpy(hvqm_header, (void *)_hvqmSegmentRomStart, sizeof(HVQM2Header), OS_MESG_PRI_NORMAL, &videoDmaMesgBlock, &videoDmaMessageQ);
|
||||
romcpy(hvqm_header, (void *)_capcomSegmentRomStart, sizeof(HVQM2Header), OS_MESG_PRI_NORMAL, &videoDmaMesgBlock, &videoDmaMessageQ);
|
||||
|
||||
total_frames = load32(hvqm_header->total_frames);
|
||||
usec_per_frame = load32(hvqm_header->usec_per_frame);
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
*/
|
||||
#define AUDIO_RECORD_SIZE_MAX 5000
|
||||
|
||||
#define MAXWIDTH 320
|
||||
#define MAXHEIGHT 240
|
||||
|
||||
/*
|
||||
* Size of data area for HVQM2 microcode
|
||||
*/
|
||||
|
||||
@@ -17,14 +17,6 @@
|
||||
#define AUDIO_SAMPLE_BITS 4
|
||||
#define AUDIO_SAMPLES_MAX (((AUDIO_RECORD_SIZE_MAX-sizeof(HVQM2Audio))*8/AUDIO_SAMPLE_BITS)+1) /* Maximum number of records per sample */
|
||||
|
||||
/*
|
||||
* PCM buffer specifications
|
||||
*/
|
||||
#define NUM_PCMBUFs 3 /* Number of PCM buffers (2 or more, at least 3 recommended) */
|
||||
#define PCMBUF_SPREAD ((PCM_ALIGN-1)+AUDIO_SAMPLES_MAX) /* Minimum required capacity for PCM buffer = Number of samples carried forward from last time + number of samples newly decoded */
|
||||
#define PCMBUF_ALIGNED ((PCMBUF_SPREAD+(PCM_ALIGN-1))&(~(PCM_ALIGN-1))) /* pcmbuf[i] address is aligned */
|
||||
#define PCMBUF_SIZE 0xA00
|
||||
|
||||
/*
|
||||
* Thread ID and priority
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user