From ca14773df0fb07e50d66fbd70bf48e8af2931060 Mon Sep 17 00:00:00 2001 From: Lorenzooone Date: Mon, 18 Mar 2024 04:12:24 +0100 Subject: [PATCH] Various GBA Fixes/Improvements - Pre NDS port (#52) * Use header files instead of externs with proper Makefile dependencies * Fix issue with not being able to quit monoscope * Fix issue with monoscope turning green after pressing start * Fix possible issue with pressing START while DMAs are active * Have top pixel of Hill Zone Scroll Test also scroll * Fix issue with bad sprite when changing image in Shadow Sprite * Change .cS to .s [Confession from Pino: Yes, it appears I'm that sloppy and that I've treated the GBA as a red-headed stepchild.] --- gba/Makefile | 23 ++++++++-------- gba/src/audiosync.c | 1 - gba/src/backlight.c | 2 -- gba/src/global.h | 5 ++-- gba/src/help.c | 25 +++++++---------- gba/src/main.c | 16 +++-------- gba/src/megaton.c | 1 - gba/src/motionblur.c | 6 +---- gba/src/overscan.c | 1 - gba/src/placeholder.c | 7 ++--- gba/src/{posprintf.S => posprintf.s} | 0 gba/src/scrolltest.c | 13 +++------ gba/src/shadowsprite.c | 23 ++++++---------- gba/src/soundtest.c | 10 ++----- gba/src/stills.c | 39 +++++++++------------------ gba/src/stopwatch.c | 8 +++--- gba/src/vwfdraw.c | 16 +---------- gba/tilesets/monoscope.png | Bin 744 -> 2218 bytes gba/tools/paginate_help.py | 30 +++++++++++++++++---- gba/tools/vwfbuild.py | 13 +++++++-- 20 files changed, 99 insertions(+), 140 deletions(-) rename gba/src/{posprintf.S => posprintf.s} (100%) diff --git a/gba/Makefile b/gba/Makefile index 25d73e3..4365d6a 100644 --- a/gba/Makefile +++ b/gba/Makefile @@ -32,17 +32,18 @@ GRAPHICS := tilesets ../common/tilesets #--------------------------------------------------------------------------------- # options for code generation #--------------------------------------------------------------------------------- +DEFINES := -D__GBA__ ARCH := -mthumb -mthumb-interwork CFLAGS := -g -Wall -O2 -fno-common\ -mcpu=arm7tdmi -mtune=arm7tdmi\ - $(ARCH) + $(ARCH) $(DEFINES) CFLAGS += $(INCLUDE) CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -ASFLAGS := -g $(ARCH) +ASFLAGS := -g $(ARCH) $(DEFINES) -x assembler-with-cpp LDFLAGS = -g $(ARCH) -Wl,-Map,$(notdir $*.map) #--------------------------------------------------------------------------------- @@ -90,13 +91,13 @@ CFILES := \ shadowsprite.c stopwatch.c soundtest.c audiosync.c backlight.c megaton.c \ pads.c ppuclear.c vwfdraw.c vwflabels.c undte.c rand.c 4bcanvas.c CPPFILES := -SFILES := \ - posprintf.s \ +S_H_SFILES := \ bggfx_chr.s spritegfx_chr.s monoscope_chr.s sharpness_chr.s \ stopwatchface_chr.s stopwatchhand_chr.s stopwatchdigits_chr.s \ kikimap_chr.s kikitiles_chr.s greenhillzone_chr.s hepsie_chr.s \ Gus_portrait_chr.s convergence_chr.s pluge_shark_6color_chr.s \ - vwf7.s helppages.s helpbgtiles_chr.s helpsprites_chr.s Donna_chr.s + helpbgtiles_chr.s helpsprites_chr.s Donna_chr.s vwf7.s helppages.s +SFILES := posprintf.s #--------------------------------------------------------------------------------- # use CXX for linking C++ projects, CC for standard C @@ -114,11 +115,11 @@ endif export OFILES_BIN := $(addsuffix .o,$(BINFILES)) -export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) $(S_H_SFILES:.s=.o) export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) -export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) $(subst .s,.h,$(S_H_SFILES)) export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ @@ -172,8 +173,8 @@ $(OFILES_SOURCES) : $(HFILES) grit $< -ff$(word 2,$^) -fts -o$*_chr # Convert a proportional font -vwf7.s: vwf7_cp144p.png ../tools/vwfbuild.py last-commit - $(PY) ../tools/vwfbuild.py $< $@ +vwf7.s vwf7.h: vwf7_cp144p.png ../tools/vwfbuild.py last-commit + $(PY) ../tools/vwfbuild.py $< $(basename $@).s $(basename $@).h # Update last-commit if it has changed last-commit-now: @@ -183,8 +184,8 @@ last-commit: last-commit-now cmp $< $@ || cp $< $@ # Convert help files -helppages.s: helppages.txt last-commit ../tools/paginate_help.py - $(PY) ../tools/paginate_help.py -DCOMMIT="$$(cat last-commit)" $< -o $@ +helppages.s helppages.h: helppages.txt last-commit ../tools/paginate_help.py + $(PY) ../tools/paginate_help.py -DCOMMIT="$$(cat last-commit)" $< -o $(basename $@).s -oh $(basename $@).h -include $(DEPSDIR)/*.d #--------------------------------------------------------------------------------------- diff --git a/gba/src/audiosync.c b/gba/src/audiosync.c index cd778e8..bb8b3e3 100644 --- a/gba/src/audiosync.c +++ b/gba/src/audiosync.c @@ -22,7 +22,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include -extern const unsigned char helpsect_audio_sync[]; #define PFMAP 23 static const BarsListEntry audiosync_rects[] = { diff --git a/gba/src/backlight.c b/gba/src/backlight.c index ac3c606..6221831 100644 --- a/gba/src/backlight.c +++ b/gba/src/backlight.c @@ -21,8 +21,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include -extern const unsigned char helpsect_backlight_zones[]; - void activity_backlight_zone(void) { unsigned inverted = 0, hidden = 0, high_gear = 0, held_keys = 0, sz = 1; unsigned int x = 119, y = 79; diff --git a/gba/src/global.h b/gba/src/global.h index aeea1f9..70f1be1 100644 --- a/gba/src/global.h +++ b/gba/src/global.h @@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include +#include "helppages.h" // Size of a statically sized array #define count(array) (sizeof((array)) / sizeof((array)[0])) @@ -34,8 +35,8 @@ typedef void (*activity_func)(void); extern char help_line_buffer[HELP_LINE_LEN]; extern unsigned char help_bg_loaded, help_wanted_page, help_cursor_y; extern signed char help_wnd_progress; -unsigned int helpscreen(unsigned int doc_num, unsigned int keymask); -unsigned int read_pad_help_check(const void *doc_num_as_ptr); +unsigned int helpscreen(helpdoc_kind doc_num, unsigned int keymask); +unsigned int read_pad_help_check(helpdoc_kind doc_num); // stills.c diff --git a/gba/src/help.c b/gba/src/help.c index 84dada7..64e67d3 100644 --- a/gba/src/help.c +++ b/gba/src/help.c @@ -24,6 +24,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include "global.h" #include "posprintf.h" +#include "helpsprites_chr.h" +#include "helpbgtiles_chr.h" // Code units #define LF 0x0A @@ -94,17 +96,6 @@ The window */ -extern const unsigned int helpbgtiles_chrTiles[]; -extern const unsigned short helpbgtiles_chrPal[16]; -extern const unsigned char helpsprites_chrTiles[]; -extern const unsigned short helpsprites_chrPal[16]; - -extern const char *const helppages[]; -extern const char *const helptitles[]; -extern const unsigned char help_cumul_pages[]; -extern const void *HELP_NUM_PAGES; -extern const void *HELP_NUM_SECTS; - static void load_help_bg(void) { // Load pattern table @@ -198,7 +189,7 @@ static void help_draw_cursor(unsigned int objx) { oam_used = ou + 1; } -static void help_draw_page(unsigned int doc_num, unsigned int left, unsigned int keymask) { +static void help_draw_page(helpdoc_kind doc_num, unsigned int left, unsigned int keymask) { // Draw document title dma_memset16(PATRAM4(3, 0), FG_BGCOLOR*0x1111, WINDOW_WIDTH * 32); vwf8Puts(PATRAM4(3, 0), helptitles[doc_num], 0, FG_FGCOLOR); @@ -294,7 +285,7 @@ static unsigned int help_move_window(void) { return x; } -unsigned int helpscreen(unsigned int doc_num, unsigned int keymask) { +unsigned int helpscreen(helpdoc_kind doc_num, unsigned int keymask) { // If not within this document, move to the first page // and move the cursor (if any) to the top @@ -395,7 +386,7 @@ unsigned int helpscreen(unsigned int doc_num, unsigned int keymask) { * @param pg an extern helpsect_ value * @return 1 if pressed, 0 if not */ -unsigned int read_pad_help_check(const void *pg) { +unsigned int read_pad_help_check(helpdoc_kind pg) { read_pad(); if (!(new_keys & KEY_START)) return 0; @@ -405,8 +396,12 @@ unsigned int read_pad_help_check(const void *pg) { REG_SOUND1CNT_X = 0x8000; REG_SOUND2CNT_L = 0; REG_SOUND2CNT_H = 0x8000; + REG_DMA0CNT = 0; + REG_DMA1CNT = 0; + REG_DMA2CNT = 0; + REG_DMA3CNT = 0; help_wnd_progress = 0; - helpscreen((unsigned int)pg, KEY_A|KEY_START|KEY_B|KEY_LEFT|KEY_RIGHT); + helpscreen(pg, KEY_A|KEY_START|KEY_B|KEY_LEFT|KEY_RIGHT); new_keys = 0; help_wnd_progress = 0; return 1; diff --git a/gba/src/main.c b/gba/src/main.c index 9d4a2bc..908dd2f 100644 --- a/gba/src/main.c +++ b/gba/src/main.c @@ -25,16 +25,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include "global.h" -// It's a bit tricky to import a document ID into C. -extern const unsigned char helpsect_160p_test_suite_menu[]; -extern const unsigned char helpsect_160p_test_suite[]; -extern const unsigned char helpsect_about[]; -extern const unsigned char helpsect_to_do[]; - -#define DOC_MENU ((unsigned int)helpsect_160p_test_suite_menu) -#define DOC_CREDITS ((unsigned int)helpsect_160p_test_suite) -#define DOC_ABOUT ((unsigned int)helpsect_about) -#define DOC_TODO ((unsigned int)helpsect_to_do) +#define DOC_MENU helpsect_160p_test_suite_menu +#define DOC_CREDITS helpsect_160p_test_suite // Notes: // iprintf/siprintf is devkitARM-specific printf/sprintf without float @@ -90,7 +82,7 @@ int main(void) { irqInit(); irqEnable(IRQ_VBLANK); //activity_overscan(); - //helpscreen(DOC_TODO, KEY_A|KEY_START|KEY_B|KEY_LEFT|KEY_RIGHT); + //helpscreen(helpsect_to_do, KEY_A|KEY_START|KEY_B|KEY_LEFT|KEY_RIGHT); activity_credits(); while (1) { @@ -110,7 +102,7 @@ int main(void) { } void activity_about(void) { - helpscreen(DOC_ABOUT, KEY_A|KEY_START|KEY_B|KEY_LEFT|KEY_RIGHT); + helpscreen(helpsect_about, KEY_A|KEY_START|KEY_B|KEY_LEFT|KEY_RIGHT); } void activity_credits(void) { diff --git a/gba/src/megaton.c b/gba/src/megaton.c index 3d34ac7..ffe22f9 100644 --- a/gba/src/megaton.c +++ b/gba/src/megaton.c @@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include "posprintf.h" -extern const unsigned char helpsect_timing_and_reflex_test[]; #define PFMAP 23 #define NUM_TRIALS 10 #define BLANK_TILE 0x0004 diff --git a/gba/src/motionblur.c b/gba/src/motionblur.c index b6f3165..c1ce878 100644 --- a/gba/src/motionblur.c +++ b/gba/src/motionblur.c @@ -21,10 +21,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include -extern const unsigned char helpsect_health_warning[]; -#define DOC_HEALTH_WARNING ((unsigned int)helpsect_health_warning) - -extern const unsigned char helpsect_motion_blur[]; #define PFMAP 23 #define NUM_PARAMS 6 #define BLANK_TILE 0x0004 @@ -57,7 +53,7 @@ void activity_motion_blur() { unsigned int phase = 0, timeleft = 0, running = 0; if (!flashing_accepted) { - helpscreen(DOC_HEALTH_WARNING, KEY_A|KEY_START|KEY_B|KEY_LEFT|KEY_RIGHT); + helpscreen(helpsect_health_warning, KEY_A|KEY_START|KEY_B|KEY_LEFT|KEY_RIGHT); if (!(new_keys & (KEY_A | KEY_START))) return; flashing_accepted = 1; } diff --git a/gba/src/overscan.c b/gba/src/overscan.c index aa56834..7a68b28 100644 --- a/gba/src/overscan.c +++ b/gba/src/overscan.c @@ -22,7 +22,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include -extern const unsigned char helpsect_overscan[]; #define PFMAP 23 static signed int keys_to_side(unsigned int keys) { diff --git a/gba/src/placeholder.c b/gba/src/placeholder.c index a656f85..12ace63 100644 --- a/gba/src/placeholder.c +++ b/gba/src/placeholder.c @@ -29,10 +29,8 @@ it freely, subject to the following restrictions: #include #include "global.h" -extern const unsigned char spritegfx_chrTiles[]; -extern const unsigned short spritegfx_chrPal[16]; - -extern const unsigned char helpsect_lame_boy[]; +#include "bggfx_chr.h" +#include "spritegfx_chr.h" unsigned short player_x; signed short player_dx; @@ -127,7 +125,6 @@ static void draw_player_sprite(void) { // Still trying to see whether GritHub will cause me to not need // pilbmp2nes.py. // It's in Virtual Boy format because that decompresses easily -extern const VBTILE bggfx_chrTiles[48]; static const unsigned short bgcolors00[16] = { RGB5(25,25,31), RGB5(20,20, 0), RGB5(27,27, 0), RGB5(31,31, 0) diff --git a/gba/src/posprintf.S b/gba/src/posprintf.s similarity index 100% rename from gba/src/posprintf.S rename to gba/src/posprintf.s diff --git a/gba/src/scrolltest.c b/gba/src/scrolltest.c index 4ae941b..12aade0 100644 --- a/gba/src/scrolltest.c +++ b/gba/src/scrolltest.c @@ -24,9 +24,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include -extern const unsigned char helpsect_grid_scroll_test[]; -extern const unsigned char helpsect_hill_zone_scroll_test[]; -extern const unsigned char helpsect_vertical_scroll_test[]; +#include "kikitiles_chr.h" +#include "kikimap_chr.h" +#include "greenhillzone_chr.h" #define PFSCROLLTEST 22 @@ -144,8 +144,6 @@ static const unsigned char mt_belowR[] = { 8, 0, 3, 9, 0, 0, 0, 7, 7, 7 }; -extern const unsigned int kikimap_chrTiles[32]; -extern const VBTILE kikitiles_chrTiles[24]; static const unsigned short kikipalette0[] = { RGB5( 0, 0, 0),RGB5(15,11, 7),RGB5(23,18,13),RGB5(31,25,19) }; @@ -221,10 +219,6 @@ void activity_kiki_scroll(void) { // Horizontal scroll (like Sonic the Hedgehog) ////////////////////// -extern const unsigned short greenhillzone_chrPal[8]; -extern const unsigned short greenhillzone_chrMap[]; // LZ77 -extern const unsigned short greenhillzone_chrTiles[]; // LZ77 - void hill_zone_load_bg(void) { LZ77UnCompVram(greenhillzone_chrTiles, PATRAM4(0, 0)); LZ77UnCompVram(greenhillzone_chrMap, MAP[PFSCROLLTEST]); @@ -251,6 +245,7 @@ void hill_zone_set_scroll(uint16_t *hdmaTable, unsigned int x) { REG_DMA0SAD = (intptr_t)&(hdmaTable[1]); REG_DMA0DAD = (intptr_t)&(BG_OFFSET[1].x); REG_DMA0CNT = 1|DMA_DST_RELOAD|DMA_SRC_INC|DMA_REPEAT|DMA16|DMA_HBLANK|DMA_ENABLE; + BG_OFFSET[1].x = hdmaTable[0]; } void activity_hill_zone_scroll(void) { diff --git a/gba/src/shadowsprite.c b/gba/src/shadowsprite.c index adef1db..d19e936 100644 --- a/gba/src/shadowsprite.c +++ b/gba/src/shadowsprite.c @@ -24,22 +24,17 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include -extern const unsigned char helpsect_shadow_sprite[]; +#include "Donna_chr.h" +#include "Gus_portrait_chr.h" +#include "hepsie_chr.h" + #define PFSCROLLTEST 22 #define PFOVERLAY 21 -extern const unsigned int Gus_portrait_chrTiles[]; -extern const unsigned short Gus_portrait_chrMap[20][14]; -extern const unsigned short Gus_portrait_chrPal[16]; - -extern const unsigned int Donna_chrTiles[]; -extern const unsigned short Donna_chrMap[20][14]; -extern const unsigned short Donna_chrPal[16]; - static void gus_bg_setup(void) { LZ77UnCompVram(Gus_portrait_chrTiles, PATRAM4(0, 0)); dma_memset16(MAP[PFSCROLLTEST], 0x0000, 32*20*2); - load_flat_map(&(MAP[PFSCROLLTEST][0][8]), Gus_portrait_chrMap[0], 14, 20); + load_flat_map(&(MAP[PFSCROLLTEST][0][8]), Gus_portrait_chrMap, 14, 20); } static void gus_bg_set_scroll(uint16_t *hdmaTable, unsigned int unused) { @@ -54,7 +49,7 @@ static void gus_bg_set_scroll(uint16_t *hdmaTable, unsigned int unused) { static void donna_bg_setup(void) { LZ77UnCompVram(Donna_chrTiles, PATRAM4(0, 0)); dma_memset16(MAP[PFSCROLLTEST], 0x0000, 32*20*2); - load_flat_map(&(MAP[PFSCROLLTEST][0][0]), Donna_chrMap[0], 30, 20); + load_flat_map(&(MAP[PFSCROLLTEST][0][0]), Donna_chrMap, 30, 20); } static void donna_bg_set_scroll(uint16_t *hdmaTable, unsigned int unused) { @@ -104,8 +99,6 @@ static const ShadowSpriteBG bgtypes[] = { #define NUM_BGTYPES (sizeof bgtypes / sizeof bgtypes[0]) -extern const VBTILE hepsie_chrTiles[32]; - static const unsigned short shadow_sprite_palettes[3][3] = { {RGB5( 0, 0, 0),RGB5( 0,31, 0),RGB5(31,25,19)}, // Hepsie top half {RGB5( 0, 0, 0),RGB5(31, 0,31),RGB5(31,31, 0)}, // Hepsie bottom half @@ -170,13 +163,13 @@ void activity_shadow_sprite() { if (cur_keys & KEY_A) { if (new_keys & KEY_RIGHT) { if (++cur_bg >= NUM_BGTYPES) cur_bg = 0; - REG_DISPCNT = MODE_0 | BG0_ON | OBJ_ON; + REG_DISPCNT = MODE_0 | BG0_ON | OBJ_1D_MAP | OBJ_ON; bgtypes[cur_bg].setup(); held_keys &= ~KEY_A; } if (new_keys & KEY_LEFT) { cur_bg = cur_bg ? cur_bg - 1 : NUM_BGTYPES - 1; - REG_DISPCNT = MODE_0 | BG0_ON | OBJ_ON; + REG_DISPCNT = MODE_0 | BG0_ON | OBJ_1D_MAP | OBJ_ON; bgtypes[cur_bg].setup(); held_keys &= ~KEY_A; } diff --git a/gba/src/soundtest.c b/gba/src/soundtest.c index ede8dac..0fbc30c 100644 --- a/gba/src/soundtest.c +++ b/gba/src/soundtest.c @@ -232,12 +232,6 @@ IWRAM_CODE static void beepPCM(void) { // Sound test menu ////////////////////////////////////////////////// -extern const unsigned char helpsect_sound_test_frequency[]; -extern const unsigned char helpsect_sound_test[]; - -#define DOC_MENU ((unsigned int)helpsect_sound_test_frequency) -#define DOC_HELP ((unsigned int)helpsect_sound_test) - static const activity_func sound_test_handlers[] = { beep8k, beep4k, @@ -259,7 +253,7 @@ void activity_sound_test() { reinitAudio(); while (1) { REG_SOUNDCNT_L = 0xFF77; // reset PSG vol/pan - helpscreen(DOC_MENU, KEY_A|KEY_START|KEY_B|KEY_UP|KEY_DOWN|KEY_LEFT|KEY_RIGHT); + helpscreen(helpsect_sound_test_frequency, KEY_A|KEY_START|KEY_B|KEY_UP|KEY_DOWN|KEY_LEFT|KEY_RIGHT); if (new_keys & KEY_B) { REG_SOUNDCNT_X = 0; // reset audio @@ -270,7 +264,7 @@ void activity_sound_test() { unsigned int last_y = help_cursor_y; help_wanted_page = last_page; help_cursor_y = last_y; - helpscreen(DOC_HELP, KEY_A|KEY_START|KEY_B|KEY_LEFT|KEY_RIGHT); + helpscreen(helpsect_sound_test, KEY_A|KEY_START|KEY_B|KEY_LEFT|KEY_RIGHT); } else { sound_test_handlers[help_cursor_y](); } diff --git a/gba/src/stills.c b/gba/src/stills.c index 5f096e1..8bc4d2c 100644 --- a/gba/src/stills.c +++ b/gba/src/stills.c @@ -28,30 +28,14 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "4bcanvas.h" #include "posprintf.h" -extern const unsigned char helpsect_pluge[]; -extern const unsigned char helpsect_gradient_color_bars[]; -extern const unsigned char helpsect_smpte_color_bars[]; -extern const unsigned char helpsect_color_bars_on_gray[]; -extern const unsigned char helpsect_color_bleed[]; -extern const unsigned char helpsect_monoscope[]; -extern const unsigned char helpsect_convergence[]; -extern const unsigned char helpsect_gray_ramp[]; -extern const unsigned char helpsect_sharpness[]; -extern const unsigned char helpsect_solid_color_screen[]; -extern const unsigned char helpsect_sharpness[]; -extern const unsigned char helpsect_full_screen_stripes[]; +#include "monoscope_chr.h" +#include "sharpness_chr.h" +#include "convergence_chr.h" +#include "pluge_shark_6color_chr.h" #define PFMAP 23 #define PFOVERLAY 22 -extern const VBTILE monoscope_chrTiles[32]; -extern const unsigned int monoscope_chrMap[]; -extern const VBTILE sharpness_chrTiles[48]; -extern const unsigned int sharpness_chrMap[]; -extern const VBTILE convergence_chrTiles[5]; - -extern const unsigned char pluge_shark_6color_chrTiles[]; -extern const unsigned short pluge_shark_6color_chrPal[6]; static const unsigned short pluge_shark_dark[] = { RGB5( 0, 0, 0),RGB5( 0, 0, 0),RGB5( 0, 0, 0),RGB5( 2, 2, 2), RGB5( 2, 2, 2),RGB5( 4, 4, 4) @@ -142,7 +126,6 @@ void activity_monoscope(void) { bitunpack2(PATRAM4(0, 0), monoscope_chrTiles, sizeof(monoscope_chrTiles)); RLUnCompVram(monoscope_chrMap, MAP[PFMAP]); - BG_COLORS[1] = RGB5(31, 0, 0); while (1) { read_pad_help_check(helpsect_monoscope); @@ -152,12 +135,16 @@ void activity_monoscope(void) { if (new_keys & KEY_DOWN) { if (!brightness--) brightness = 4; } + if (new_keys & KEY_B) { + return; + } VBlankIntrWait(); BGCTRL[0] = BG_16_COLOR|BG_WID_32|BG_HT_32|CHAR_BASE(0)|SCREEN_BASE(PFMAP); BG_OFFSET[0].x = BG_OFFSET[0].y = 0; - BG_COLORS[0] = (brightness >= 4) ? RGB5(13,13,13) : 0; - BG_COLORS[2] = monoscope_whites[brightness]; + BG_PALETTE[0] = (brightness >= 4) ? RGB5(13,13,13) : 0; + BG_PALETTE[1] = monoscope_whites[brightness]; + BG_PALETTE[2] = RGB5(31, 0, 0); REG_DISPCNT = MODE_0 | BG0_ON; } } @@ -261,7 +248,7 @@ void draw_barslist(const BarsListEntry *rects) { } } -static void do_bars(const BarsListEntry *rects, const unsigned char *helpsect) { +static void do_bars(const BarsListEntry *rects, helpdoc_kind helpsect) { unsigned int bright = 0, beep = 0; draw_barslist(rects); @@ -532,7 +519,7 @@ static const unsigned short full_stripes_colors[10][2] = { }; -static void do_full_stripes(const unsigned char *helpsect) { +static void do_full_stripes(helpdoc_kind helpsect) { unsigned int pattern = 0, inverted = 0, frame = 0; unsigned int lcdcvalue = MODE_1 | BG1_ON; @@ -748,4 +735,4 @@ void activity_convergence(void) { } } -} \ No newline at end of file +} diff --git a/gba/src/stopwatch.c b/gba/src/stopwatch.c index 98eddeb..a20cd58 100644 --- a/gba/src/stopwatch.c +++ b/gba/src/stopwatch.c @@ -22,12 +22,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include -extern const VBTILE stopwatchhand_chrTiles[48]; -extern const ONEBTILE stopwatchface_chrTiles[64]; -extern const VBTILE stopwatchdigits_chrTiles[64]; -extern const unsigned short stopwatchface_chrMap[]; +#include "stopwatchhand_chr.h" +#include "stopwatchface_chr.h" +#include "stopwatchdigits_chr.h" -extern const unsigned char helpsect_stopwatch[]; #define PFMAP 23 #define NUM_DIGITS 8 #define NUM_FACE_PHASES 10 diff --git a/gba/src/vwfdraw.c b/gba/src/vwfdraw.c index 6640e3f..400ab43 100644 --- a/gba/src/vwfdraw.c +++ b/gba/src/vwfdraw.c @@ -24,6 +24,7 @@ it freely, subject to the following restrictions: */ #include #include "global.h" +#include "vwf7.h" #if 0 typedef struct VWFCanvas { @@ -80,21 +81,6 @@ void loadMapRowMajor(unsigned short *dst, unsigned int tilenum, } } -extern const unsigned char vwfChrData[][8]; -extern const unsigned char vwfChrWidths[]; -/* - = { - {0, 0, 0, 0, 0, 0, 0, 0}, - {0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01}, - {0x00, 0x05, 0x05}, - {0x00, 0x0A, 0x1F, 0x0A, 0x1F, 0x0A}, -}; - -const unsigned char vwfGlyphWidths[] = { - 3, 2, 4, 6 -}; -*/ - #define FIRST_PRINTABLE_CU 0x18 void vwf8PutTile(uint32_t *dst, unsigned int glyphnum, diff --git a/gba/tilesets/monoscope.png b/gba/tilesets/monoscope.png index 4d2779c416bbd2a90bc0abcd34833e5db3c1a95b..21adba155d38eadbd97a7f860e9e7e2c4f5bc5f0 100644 GIT binary patch literal 2218 zcmeH|Sx}P)6omsMngvN%+CV@sB1sFx1S87;6EP7%K)}k90G3}w6c?7Ff`|wqfD)8g z6cAaWHWbCMFG?x!g9H^&mLgFh1d^(t5CXDDES63?)9IsceellQd*;rZr*F=kd%@e& zWgQZSgg_wccDe5OZdGSin-AAmoiLcTKLnxy@%Hd>UR^(})~bA|&n57M+UFAc|M}zJ z`m7!Y?BK2)+kN5+rh>Q;@(r4rs!t~S>aJG;AJ^1x5({l+wMEn(sE6;!WgD*P`g50` zy#30nXJB+l(YcXBcs22(O1nT}TM|PbOR<7N60>8+{YOcO7Ip_Rb;LS%W?Y6+*lM&{ zPS*H=jE)T};`koja-|gr0cr)r*FxzLqlOa`XYV>ay_yg^K=~-@hb6)zpfpLp)U4PE zGoB?JLYB`&yPLcwWfwW6Zfi6Sn@~47-PWqgigav*2@4N_Wte5RBIM|_wjpwX^#E5U z{RJyzaR}qLRFsCh)afB@b49MbsZmOKh1l;P2*_xzo^D_dy45_-z)Vjk49TX!)Tv zv?jHJeR%kJztIhhrB-h=8hk-pvi_!N-UZ>eHZ+5?CRpv3$hJ6rcU6gW@#?}ZmpU_O zc4zw(R0f?U>pyJ>s-;)vU<~j~f}FEQmJakNy$f47(Pk@MfhH|!z}FA;VykOY|20Sp zp?htY4(tXM7ISBG@ymG&$b|uk7sazRzwFwPR~EqVx(lcJ;*)^TtDXwOfy))e3ZEB; z*MU5=9QD4IO7bS?dh0N*9Tv4j=R1N!>s|F|beUhE*g zvo~hfski?M4V(hdw4j7;y@ESj)XpJ< zU%Xt@9vQy<(I)Vs;H@g!Jy(*84Em&{P(4$6ADFoLJv@TwQG24U)DB2v;+o_kYS@9A zHcc?f=nY8Pr&F!xO%=kGR_6lM70+m^x=M13M3FAq7=n$?nP!>LwQYHu`!c5w=WR zbZ9sVzlC1u@epxKga#cDB@r{7`Rq~u<$}RI#}S}h8RY=lC96=PITDss2fSJ&Buy|@ z0#UO!?1rV$JV7E{3(S!1Z%e+zmdLJ$H49dFb2Fx}z5fZFHrqNzQv)xKF>d}R+{=T; zATB{W#h|xK>^0*I*Eu#v1M7!<2nIOgshjf`0cE zBu58gMAE;+)$fLYLxd%cD{Q}MHZHOr;E>6AHDZ!w&(Hu1cg9wF)=YQWuJm-9M1}`# zq3MDyMCSmO!~tOU8Uap4U%zzZ&18xTGynFspOn%cj#?%a!z$=+ESAz_V~h|6Nb4H0 zjwJ`!c3<|*4}PXXKoY7BTE9w-v`Ppyc~bKlzH_Fm2^(CRKGojQnMu@~dD(<57N#T0 ziJ4eO+epiOS+blpl1S)c(4*K`OyZnIsggml8GD|yhWud;D|Ae+I)PS$wmeqBs^@t` zO^I;KD=#iK`&9F$-WPEvPyr54+5Y(VR})%fW9YR0jn@n#-c|nf26j1n?kJ}N>^}ho CtiY`R delta 732 zcmV<20wevZ5$FYw7=Ho-0000_wF&kB000S4OjJbx009300RR90XBlK30007-NklF()NujQL3X=aHY>2DM1P=9xBJ|K-ClOS-*#oW z-RB&((S%RQUP59jW|M^S{D{l3-1?quhl+VKekCFt*RMm3_&Qk}b z^RNRjWPexn9J0qHx$W$X4i99Tjb*dL816Vs4;3c~!@VRCzHX#1x`%&1U-#SB{q_~A ztA9QL3r8K-d6)oevR@6>4vHUkzAYWgYYzmL8Mj6iOkG~UXr&M;2W=1D+u3{q#_ixy z80}-oPU*Pplp5Lm$SHQ-dE_L)x@^H=dZ;2vkX6bon;vQc79OW+4{}#wJo)=1xBKB& z1*m^!xc`y@_0J6VUytDanc?oF{@LN9uY{n4C0LU!I7|zbkR(t1KFM#F<(Xj~E=T47 O0000 1 and argv[1] == '--help': - print("usage: %s font.png font.s" % argv[0]) + print("usage: %s font.png font.s [font.h]" % argv[0]) return - if len(argv) != 3: + if len(argv) < 3 or len(argv) > 4: print("wrong number of options; try %s --help" % argv[0], file=sys.stderr) sys.exit(1) @@ -58,6 +58,15 @@ def main(argv=None): ''] with open(argv[2], 'w') as outfp: outfp.write('\n'.join(out)) + if len(argv) > 3: + out = ["// Generated by vwfbuild", + "#ifndef VWFCHR_H__", + "#define VWFCHR_H__", + "extern const unsigned char vwfChrData[" + str(int(len(tiledata) / 8)) + "][8];\n" + "extern const unsigned char vwfChrWidths[" + str(len(widths)) + "];\n" + "#endif"] + with open(argv[3], 'w') as outfp: + outfp.write('\n'.join(out)) if __name__ == '__main__': ## main(['vwfbuild', '../tilesets/vwf7.png', '../obj/vwf7.s'])