HVQM no lag!!

This commit is contained in:
CrashOveride95
2020-12-09 14:10:43 -05:00
parent a242b18d99
commit d643eda27f
13 changed files with 49 additions and 38 deletions

BIN
data/capcom.hvqm Normal file

Binary file not shown.

7
data/capcom.s Normal file
View File

@@ -0,0 +1,7 @@
.include "macros.inc"
.section .data
glabel _capcomRomStart
.incbin "data/capcom.hvqm"
glabel _capcomRomEnd

View File

@@ -1,7 +0,0 @@
.include "macros.inc"
.section .data
glabel _hvqmSampleRomStart
.incbin "data/terry.hvqm"
glabel _hvqmSampleRomEnd

Binary file not shown.

7
data/sein.s Normal file
View File

@@ -0,0 +1,7 @@
.include "macros.inc"
.section .data
glabel _seinfeldRomStart
.incbin "data/sein800.hvqm"
glabel _seinfeldRomEnd

BIN
data/sein800.hvqm Normal file

Binary file not shown.

Binary file not shown.

14
sm64.ld
View File

@@ -125,7 +125,6 @@ SECTIONS
BUILD_DIR/lib/rsp.o(.text);
lib/PR/hvqm/hvqm2sp1.o(.text);
lib/PR/hvqm/hvqm2sp2.o(.text);
/* data */
BUILD_DIR/src/game*.o(.data*);
@@ -139,7 +138,6 @@ SECTIONS
BUILD_DIR/lib/rsp.o(.data*);
lib/PR/hvqm/hvqm2sp1.o(.data*);
lib/PR/hvqm/hvqm2sp2.o(.data*);
/* rodata */
BUILD_DIR/src/game*.o(.rodata*);
@@ -150,7 +148,6 @@ SECTIONS
BUILD_DIR/lib/rsp.o(.rodata*);
lib/PR/hvqm/hvqm2sp1.o(.rodata*);
lib/PR/hvqm/hvqm2sp2.o(.rodata*);
}
END_SEG(main)
BEGIN_NOLOAD(main)
@@ -353,11 +350,16 @@ SECTIONS
}
END_SEG(assets)
BEGIN_SEG(hvqm, __romPos)
BEGIN_SEG(capcom, __romPos) SUBALIGN(2)
{
BUILD_DIR/data/hvqm.o(.data);
BUILD_DIR/data/capcom.o(.data);
}
END_SEG(hvqm)
END_SEG(capcom)
BEGIN_SEG(sein, __romPos) SUBALIGN(2)
{
BUILD_DIR/data/sein.o(.data);
}
END_SEG(sein)
/* Discard everything not specifically mentioned above. */
/DISCARD/ :
{

View File

@@ -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];

View File

@@ -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

View File

@@ -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);

View File

@@ -17,6 +17,9 @@
*/
#define AUDIO_RECORD_SIZE_MAX 5000
#define MAXWIDTH 320
#define MAXHEIGHT 240
/*
* Size of data area for HVQM2 microcode
*/

View File

@@ -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
*/