diff --git a/Makefile b/Makefile index aec5398..e61a45d 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ BUILD := build SOURCES := source INCLUDES := include DATA := -MUSIC := +MUSIC := audio GRAPHICS := graphics #--------------------------------------------------------------------------------- @@ -52,7 +52,7 @@ LDFLAGS = -g $(ARCH) -Wl,-Map,$(notdir $*.map) #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -ltonc +LIBS := -lmm -ltonc #--------------------------------------------------------------------------------- diff --git a/audio/FlatOutLies.mod b/audio/FlatOutLies.mod new file mode 100644 index 0000000..7b06f97 Binary files /dev/null and b/audio/FlatOutLies.mod differ diff --git a/source/background_engine.cpp b/source/background_engine.cpp index 982cfb2..560975a 100644 --- a/source/background_engine.cpp +++ b/source/background_engine.cpp @@ -9,9 +9,6 @@ int x, y; void background_frame() { - vid_vsync(); - key_poll(); - x += key_tri_horz(); y += key_tri_vert(); diff --git a/source/main.cpp b/source/main.cpp index d9786ae..10b0173 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "debug.h" #include "flash_mem.h" @@ -19,6 +20,8 @@ #include "button_handler.h" #include "main_menu.h" #include "debug_mode.h" +#include "soundbank.h" +#include "soundbank_bin.h" /*TODO: -------- @@ -56,8 +59,38 @@ TESTING: -------- */ + Pokemon_Party party = Pokemon_Party(); +int test_main(void) +{ + + irq_init(NULL); + // Initialize maxmod with default settings + // pass soundbank address, and allocate 8 channels. + + irq_set(II_VBLANK, mmVBlank, 0); + irq_enable(II_VBLANK); + + mmInitDefault((mm_addr)soundbank_bin, 8); + + + mmStart(MOD_FLATOUTLIES, MM_PLAY_LOOP); + // Song is playing now (well... almost) + while (1) + { + // ..process game logic.. + + // Update Maxmod + mmFrame(); + + // Wait for new frame (SWI 5) + VBlankIntrWait(); + + // ..update graphical data.. + } +} + int main(void) { int delay_counter = 0; @@ -77,6 +110,14 @@ int main(void) add_script_party_var(party); +// Sound bank init + irq_init(NULL); + irq_set(II_VBLANK, mmVBlank, 0); + irq_enable(II_VBLANK); + mmInitDefault((mm_addr)soundbank_bin, 8); + mmStart(MOD_FLATOUTLIES, MM_PLAY_LOOP); + +// Graphics init oam_init(obj_buffer, 128); load_background(); @@ -176,11 +217,17 @@ int main(void) break; } + key_poll(); rand_next_frame(); background_frame(); text_next_frame(); oam_copy(oam_mem, obj_buffer, 8); + + VBlankIntrWait(); + mmFrame(); + + } }