diff --git a/Makefile b/Makefile index d0ddace7..0d38a3f2 100644 --- a/Makefile +++ b/Makefile @@ -145,6 +145,17 @@ $(eval $(call validate-option,UNF,0 1)) ifeq ($(UNF),1) DEFINES += UNF=1 + SRC_DIRS += src/usb +endif + +# HVQM - whether to use HVQM fmv library +# 1 - includes code in ROM +# 0 - does not +HVQM ?= 0 +$(eval $(call validate-option,HVQM,0 1)) +ifeq ($(HVQM),1) + DEFINES += HVQM=1 + SRC_DIRS += src/hvqm endif # Whether to hide commands or not @@ -230,7 +241,7 @@ ACTOR_DIR := actors LEVEL_DIRS := $(patsubst levels/%,%,$(dir $(wildcard levels/*/header.h))) # Directories containing source files -SRC_DIRS := src src/usb src/engine src/game src/hvqm src/audio src/menu src/buffers actors levels bin data assets asm lib sound +SRC_DIRS := src src/engine src/game src/audio src/menu src/buffers actors levels bin data assets asm lib sound BIN_DIRS := bin bin/$(VERSION) # File dependencies and variables for specific files @@ -651,7 +662,8 @@ $(GLOBAL_ASM_DEP).$(NON_MATCHING): # Generate version_data.h $(BUILD_DIR)/src/game/version_data.h: tools/make_version.sh - tools/make_version.sh $(CROSS) > $@ + @$(PRINT) "$(GREEN)Generating: $(BLUE)$@ $(NO_COL)\n" + $(V)tools/make_version.sh $(CROSS) > $@ #==============================================================================# # Compilation Recipes # diff --git a/sm64.ld b/sm64.ld index 7fb2f822..a1e23fce 100755 --- a/sm64.ld +++ b/sm64.ld @@ -85,9 +85,11 @@ SECTIONS BEGIN_NOLOAD(buffers) { BUILD_DIR/src/buffers/buffers.o(.bss*); +#ifdef HVQM BUILD_DIR/src/buffers/hvqmwork.o(.bss*); BUILD_DIR/src/buffers/adpcmbuf.o(.bss*); BUILD_DIR/src/buffers/hvqbuf.o(.bss*); +#endif BUILD_DIR/src/audio/globals_start.o(.bss*); BUILD_DIR/src/audio/synthesis.o(.bss*); BUILD_DIR/src/audio/heap.o(.bss*); @@ -114,7 +116,9 @@ SECTIONS BUILD_DIR/asm/entry.o(.text); BUILD_DIR/src/game*.o(.text); +#ifdef HVQM BUILD_DIR/src/hvqm*.o(.text); +#endif #ifdef UNF BUILD_DIR/src/usb*.o(.text); #endif @@ -140,10 +144,14 @@ SECTIONS */libultra_rom.a:*.o(.data*); */libultra_rom.a:*.o(.sdata*); +#ifdef HVQM */libhvqm2.a:*.o(.data*); +#endif BUILD_DIR/lib/rsp.o(.data*); +#ifdef HVQM lib/PR/hvqm/hvqm2sp1.o(.data*); +#endif /* rodata */ BUILD_DIR/src/game*.o(.rodata*); @@ -153,10 +161,14 @@ SECTIONS BUILD_DIR/src/audio*.o(.rodata*); */libultra_rom.a:*.o(.rodata*); +#ifdef HVQM */libhvqm2.a:*.o(.rodata*); +#endif BUILD_DIR/lib/rsp.o(.rodata*); +#ifdef HVQM lib/PR/hvqm/hvqm2sp1.o(.rodata*); +#endif } END_SEG(main) BEGIN_NOLOAD(main) @@ -361,12 +373,13 @@ SECTIONS BUILD_DIR/sound/sound_data.o(.data); } END_SEG(assets) - +#ifdef HVQM BEGIN_SEG(capcom, __romPos) SUBALIGN(2) { BUILD_DIR/data/capcom.o(.data); } END_SEG(capcom) +#endif #if 0 BEGIN_SEG(sein, __romPos) SUBALIGN(2) { diff --git a/src/audio/external.c b/src/audio/external.c index 708092a3..302911e2 100644 --- a/src/audio/external.c +++ b/src/audio/external.c @@ -10,7 +10,9 @@ #include "game/level_update.h" #include "game/object_list_processor.h" #include "game/camera.h" +#ifdef UNF #include "usb/debug.h" +#endif #include "seq_ids.h" #include "dialog_ids.h" diff --git a/src/buffers/buffers.c b/src/buffers/buffers.c index ce93c603..0a7080e0 100644 --- a/src/buffers/buffers.c +++ b/src/buffers/buffers.c @@ -2,7 +2,9 @@ #include #include "buffers.h" +#ifdef HVQM #include +#endif #include "config.h" ALIGNED8 u8 gDecompressionHeap[0xD000]; diff --git a/src/buffers/framebuffers.c b/src/buffers/framebuffers.c index 7f4a07e5..ab5e62f7 100644 --- a/src/buffers/framebuffers.c +++ b/src/buffers/framebuffers.c @@ -3,4 +3,4 @@ #include "config.h" // 0x70800 bytes -__attribute__((aligned (64))) u16 gFrameBuffers[3][SCREEN_WIDTH * SCREEN_HEIGHT]; +u16 gFrameBuffers[3][SCREEN_WIDTH * SCREEN_HEIGHT]; diff --git a/src/game/game_init.c b/src/game/game_init.c index 018a4282..e3eed8c2 100644 --- a/src/game/game_init.c +++ b/src/game/game_init.c @@ -19,9 +19,13 @@ #include "segment2.h" #include "segment_symbols.h" #include "rumble_init.h" +#ifdef HVQM #include +#endif +#ifdef UNF #include "usb/usb.h" #include "usb/debug.h" +#endif #include // FIXME: I'm not sure all of these variables belong in this file, but I don't @@ -602,53 +606,25 @@ void thread5_game_loop(UNUSED void *arg) { struct LevelCommand *addr; setup_game_memory(); -#ifdef UNF - debug_printf("init_rumble_pak_scheduler_queue\n"); -#endif #if ENABLE_RUMBLE init_rumble_pak_scheduler_queue(); -#endif -#ifdef UNF - debug_printf("init_controllers\n"); #endif init_controllers(); #if ENABLE_RUMBLE -#ifdef UNF - debug_printf("create_thread_6\n"); -#endif create_thread_6(); #endif -#ifdef UNF - debug_printf("createHvqmThread\n"); -#endif +#ifdef HVQM createHvqmThread(); -#ifdef UNF - debug_printf("save_file_load_all\n"); #endif save_file_load_all(); -#ifdef UNF - debug_printf("set_vblank_handler\n"); -#endif set_vblank_handler(2, &gGameVblankHandler, &gGameVblankQueue, (OSMesg) 1); -#ifdef UNF - debug_printf("point addr to the entry point into the level script data.\n"); -#endif // point addr to the entry point into the level script data. addr = segmented_to_virtual(level_script_entry); -#ifdef UNF - debug_printf("play_music\n"); -#endif play_music(SEQ_PLAYER_SFX, SEQUENCE_ARGS(0, SEQ_SOUND_PLAYER), 0); -#ifdef UNF - debug_printf("set_sound_mode\n"); -#endif set_sound_mode(save_file_get_sound_mode()); -#ifdef UNF - debug_printf("rendering_init\n"); -#endif rendering_init(); while (TRUE) { diff --git a/src/game/main.c b/src/game/main.c index 090e9ac2..5388c5e3 100644 --- a/src/game/main.c +++ b/src/game/main.c @@ -13,8 +13,10 @@ #include "main.h" #include "rumble_init.h" #include "version.h" +#ifdef UNF #include "usb/usb.h" #include "usb/debug.h" +#endif // Message IDs #define MESG_SP_COMPLETE 100 diff --git a/src/game/memory.c b/src/game/memory.c index 0c18a45d..a6854b4e 100644 --- a/src/game/memory.c +++ b/src/game/memory.c @@ -11,7 +11,10 @@ #include "memory.h" #include "segment_symbols.h" #include "segments.h" +#ifdef UNF #include "usb/debug.h" +#endif + // round up to the next multiple #define ALIGN4(val) (((val) + 0x3) & ~0x3) diff --git a/src/game/version.c b/src/game/version.c index c8b70492..ab2da363 100644 --- a/src/game/version.c +++ b/src/game/version.c @@ -4,4 +4,4 @@ char __username__[] = __USERNAME__; char __datetime__[] = __DATETIME__; char __compiler__[] = __COMPILER__; -char __linker__[] = __LINKER__; \ No newline at end of file +char __linker__[] = __LINKER__; diff --git a/src/game/version.h b/src/game/version.h index 21a2d370..ba4d54b1 100644 --- a/src/game/version.h +++ b/src/game/version.h @@ -6,4 +6,4 @@ extern char __datetime__[]; extern char __compiler__[]; extern char __linker__[]; -#endif \ No newline at end of file +#endif diff --git a/src/buffers/adpcmbuf.c b/src/hvqm/adpcmbuf.c similarity index 100% rename from src/buffers/adpcmbuf.c rename to src/hvqm/adpcmbuf.c diff --git a/src/buffers/hvqbuf.c b/src/hvqm/hvqbuf.c similarity index 100% rename from src/buffers/hvqbuf.c rename to src/hvqm/hvqbuf.c diff --git a/src/buffers/hvqmwork.c b/src/hvqm/hvqmwork.c similarity index 100% rename from src/buffers/hvqmwork.c rename to src/hvqm/hvqmwork.c