keep scores and settings in SRAM
[gbajam22] / src / gba / main.c
index 6e5dbc0..4ade404 100644 (file)
@@ -4,6 +4,10 @@
 #include "debug.h"
 #include "game.h"
 #include "maxmod.h"
+#include "input.h"
+#include "timer.h"
+#include "xgl.h"
+#include "scoredb.h"
 
 static void vblank(void);
 
@@ -32,14 +36,20 @@ int main(void)
        REG_DISPSTAT |= DISPSTAT_IEN_VBLANK;
        unmask(INTR_VBLANK);
 
+       load_scores();
+       gba_colors = scores[10].score & 1;
+
+       xgl_init();
+
        if(init_screens() == -1) {
                panic(get_pc(), "failed to initialize screens");
        }
 
-       if(change_screen(find_screen("game")) == -1) {
-               panic(get_pc(), "failed to find game screen");
+       if(change_screen(find_screen("logo")) == -1) {
+               panic(get_pc(), "failed to find starting screen");
        }
 
+       reset_msec_timer();
        intr_enable();
 
        for(;;) {
@@ -51,10 +61,9 @@ int main(void)
 ARM_IWRAM
 static void vblank(void)
 {
-#ifdef VBLBAR
        vblperf_count++;
-#endif
 
+       keyb_vblank();
        curscr->vblank();
 
 #ifndef NOSOUND