diff --git a/sm64.ld b/sm64.ld index e251d49663..cf6acafd50 100755 --- a/sm64.ld +++ b/sm64.ld @@ -190,6 +190,8 @@ SECTIONS /* data */ BUILD_DIR/asm/n64_assert.o(.*data*); BUILD_DIR/src/boot*.o(.*data*); + BUILD_DIR/src/hvqm*.o(.*data*); + BUILD_DIR/src/usb*.o(.*data*); BUILD_DIR/src/audio*.o(.*data*); #ifdef S2DEX_TEXT_ENGINE BUILD_DIR/src/s2d_engine*.o(.*data*); @@ -208,6 +210,7 @@ SECTIONS /* rodata */ BUILD_DIR/src/boot*.o(.rodata*); BUILD_DIR/src/usb*.o(.rodata*); + BUILD_DIR/src/hvqm*.o(.rodata*); BUILD_DIR/src/audio*.o(.rodata*); #ifdef S2DEX_TEXT_ENGINE BUILD_DIR/src/s2d_engine*.o(.rodata*); diff --git a/src/game/game_init.c b/src/game/game_init.c index 443eb9c5b0..c573861b77 100644 --- a/src/game/game_init.c +++ b/src/game/game_init.c @@ -802,6 +802,10 @@ void setup_game_memory(void) { load_segment_decompress(SEGMENT_SEGMENT2, _segment2_mio0SegmentRomStart, _segment2_mio0SegmentRomEnd); } + + +extern struct SPTask *sCurrentDisplaySPTask; + /** * Main game loop thread. Runs forever as long as the game continues. */ @@ -858,7 +862,9 @@ void thread5_game_loop(UNUSED void *arg) { read_controller_inputs(THREAD_5_GAME_LOOP); profiler_update(PROFILER_TIME_CONTROLLERS, 0); profiler_collision_reset(); + addr = level_script_execute(addr); + profiler_collision_completed(); #if !defined(PUPPYPRINT_DEBUG) && defined(VISUAL_DEBUG) debug_box_input(); @@ -875,12 +881,6 @@ void thread5_game_loop(UNUSED void *arg) { // amount of free space remaining. print_text_fmt_int(180, 20, "BUF %d", gGfxPoolEnd - (u8 *) gDisplayListHead); } -#endif -#if 0 - if (gPlayer1Controller->buttonPressed & L_TRIG) { - osStartThread(&hvqmThread); - osRecvMesg(&gDmaMesgQueue, NULL, OS_MESG_BLOCK); - } #endif } } diff --git a/src/game/sound_init.c b/src/game/sound_init.c index 3172073109..d0942fadb4 100644 --- a/src/game/sound_init.c +++ b/src/game/sound_init.c @@ -19,6 +19,10 @@ #include "puppyprint.h" #include "profiling.h" +#ifdef HVQM +#include +#endif + #include "config/config_audio.h" #define MUSIC_NONE 0xFFFF @@ -373,7 +377,11 @@ void thread4_sound(UNUSED void *arg) { osRecvMesg(&sSoundMesgQueue, &msg, OS_MESG_BLOCK); profiler_audio_started(); // also starts PROFILER_TIME_SUB_AUDIO_UPDATE inside +#ifdef HVQM + if (gResetTimer < 25 && gHvqmPlayState == 0) { +#else if (gResetTimer < 25) { +#endif struct SPTask *spTask = create_next_audio_frame_task(); if (spTask != NULL) { dispatch_audio_sptask(spTask); diff --git a/src/hvqm/cfbkeep.c b/src/hvqm/cfbkeep.c index fdebe79e42..14df5cb588 100644 --- a/src/hvqm/cfbkeep.c +++ b/src/hvqm/cfbkeep.c @@ -13,6 +13,7 @@ #include #include "hvqm.h" #include "buffers/framebuffers.h" +#include "game/debug.h" /*********************************************************************** * Array maintaining the state of the frame buffer @@ -98,12 +99,15 @@ int get_cfb() { int cfbno; + int loop_count = 0; for ( ; ; ) { for ( cfbno = 0; cfbno < NUM_CFBs; cfbno++ ) if ( cfb_status[cfbno] == 0 ) return cfbno; osYieldThread(); + loop_count++; + aggress(loop_count < 1000000, "HVQM: get_cfb: all framebuffers busy for too long"); } } diff --git a/src/hvqm/hvqm.c b/src/hvqm/hvqm.c index 3719606bd9..038dae97f8 100644 --- a/src/hvqm/hvqm.c +++ b/src/hvqm/hvqm.c @@ -4,34 +4,37 @@ #include #include #include +#include