From 2345c612d8aba2caf20145f3ec502394ef47e142 Mon Sep 17 00:00:00 2001 From: Mateusz Faderewski Date: Fri, 8 Dec 2023 19:49:50 +0100 Subject: [PATCH] Moved assets to the DragonFS --- .gitignore | 1 + Makefile | 26 +++++++++++++++----------- assets/assets.S | 11 ----------- assets/assets.h | 16 ---------------- assets/images/.gitkeep | 0 src/menu/fonts.c | 3 +-- src/menu/menu.c | 6 +++--- tools/README.md | 9 --------- 8 files changed, 20 insertions(+), 52 deletions(-) delete mode 100644 assets/assets.S delete mode 100644 assets/assets.h delete mode 100644 assets/images/.gitkeep delete mode 100644 tools/README.md diff --git a/.gitignore b/.gitignore index f66361d1..2cfc2261 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /.vscode /build +/filesystem /output /tools/sc64/* diff --git a/Makefile b/Makefile index 3e949f64..b6377d7e 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ PROJECT_NAME = N64FlashcartMenu SOURCE_DIR = src ASSETS_DIR = assets +FILESYSTEM_DIR = filesystem BUILD_DIR = build OUTPUT_DIR = output @@ -62,26 +63,28 @@ SRCS = \ menu/views/system_info.c \ utils/fs.c -ASSETS = \ +FONTS = \ FiraMonoBold.ttf -OBJS = $(addprefix $(BUILD_DIR)/, $(addsuffix .o,$(basename $(SRCS) $(ASSETS)))) +OBJS = $(addprefix $(BUILD_DIR)/, $(addsuffix .o,$(basename $(SRCS)))) MINIZ_OBJS = $(filter $(BUILD_DIR)/libs/miniz/%.o,$(OBJS)) SPNG_OBJS = $(filter $(BUILD_DIR)/libs/libspng/%.o,$(OBJS)) DEPS = $(OBJS:.o=.d) +FILESYSTEM = \ + $(addprefix $(FILESYSTEM_DIR)/, $(notdir $(FONTS:%.ttf=%.font64))) + $(MINIZ_OBJS): N64_CFLAGS+=-DMINIZ_NO_TIME -fcompare-debug-second $(SPNG_OBJS): N64_CFLAGS+=-isystem $(SOURCE_DIR)/libs/miniz -DSPNG_USE_MINIZ -fcompare-debug-second -$(BUILD_DIR)/FiraMonoBold.asset: MKFONT_FLAGS+=-c 0 --size 16 -r 20-7F -r 2026-2026 --ellipsis 2026,1 +$(FILESYSTEM_DIR)/FiraMonoBold.font64: MKFONT_FLAGS+=-c 1 --size 16 -r 20-7F -r 2026-2026 --ellipsis 2026,1 -$(BUILD_DIR)/%.asset: $(ASSETS_DIR)/%.ttf - @echo " [FONT] $(basename $@).font64" - @$(N64_MKFONT) $(MKFONT_FLAGS) -o $(BUILD_DIR) "$<" - @mv $(basename $@).font64 $@ +$(@info $(shell mkdir -p ./$(FILESYSTEM_DIR) &> /dev/null)) -$(BUILD_DIR)/%.o: $(BUILD_DIR)/%.asset $(ASSETS_DIR)/assets.S - @sed -e "s,@sym@,$*,g" -e "s,@file@,$(basename $<).asset," < $(ASSETS_DIR)/assets.S | \ - $(CC) -x assembler-with-cpp $(ASFLAGS) -c - -o $@ +$(FILESYSTEM_DIR)/%.font64: $(ASSETS_DIR)/%.ttf + @echo " [FONT] $@" + @$(N64_MKFONT) $(MKFONT_FLAGS) -o $(FILESYSTEM_DIR) "$<" + +$(BUILD_DIR)/$(PROJECT_NAME).dfs: $(FILESYSTEM) $(BUILD_DIR)/$(PROJECT_NAME).elf: $(OBJS) @@ -90,6 +93,7 @@ disassembly: $(BUILD_DIR)/$(PROJECT_NAME).elf .PHONY: disassembly $(PROJECT_NAME).z64: N64_ROM_TITLE=$(PROJECT_NAME) +$(PROJECT_NAME).z64: $(BUILD_DIR)/$(PROJECT_NAME).dfs $(@info $(shell mkdir -p ./$(OUTPUT_DIR) &> /dev/null)) @@ -116,7 +120,7 @@ all: $(OUTPUT_DIR)/$(PROJECT_NAME).n64 64drive ed64 ed64-clone sc64 .PHONY: all clean: - @rm -rf ./$(BUILD_DIR) ./$(OUTPUT_DIR) + @rm -rf ./$(BUILD_DIR) ./$(FILESYSTEM_DIR) ./$(OUTPUT_DIR) .PHONY: clean run: $(OUTPUT_DIR)/$(PROJECT_NAME).n64 diff --git a/assets/assets.S b/assets/assets.S deleted file mode 100644 index a1c1eef7..00000000 --- a/assets/assets.S +++ /dev/null @@ -1,11 +0,0 @@ -.section .data.@sym@, "a", %progbits -.type assets_@sym@, %object - -.balign 16 - -.global assets_@sym@ -assets_@sym@: - .incbin "@file@" - -.global assets_@sym@_size - .set assets_@sym@_size, . - assets_@sym@ diff --git a/assets/assets.h b/assets/assets.h deleted file mode 100644 index efc35a82..00000000 --- a/assets/assets.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef ASSETS_H__ -#define ASSETS_H__ - - -#include - - -#define ASSET(n) \ - extern uint8_t assets_##n[] __attribute__((section(".data"))); \ - extern int assets_##n##_size[] __attribute__((section(".data"))) - - -ASSET(FiraMonoBold); - - -#endif diff --git a/assets/images/.gitkeep b/assets/images/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/src/menu/fonts.c b/src/menu/fonts.c index b51972bd..27eccd09 100644 --- a/src/menu/fonts.c +++ b/src/menu/fonts.c @@ -1,11 +1,10 @@ #include -#include "assets.h" #include "fonts.h" static void load_default_font (void) { - rdpq_font_t *default_font = rdpq_font_load_buf(assets_FiraMonoBold, (int) (assets_FiraMonoBold_size)); + rdpq_font_t *default_font = rdpq_font_load("rom:/FiraMonoBold.font64"); rdpq_font_style(default_font, STL_DEFAULT, &((rdpq_fontstyle_t) { .color = RGBA32(0xFF, 0xFF, 0xFF, 0xFF) })); rdpq_font_style(default_font, STL_DIRECTORY, &((rdpq_fontstyle_t) { .color = RGBA32(0xFF, 0xFF, 0x70, 0xFF) })); diff --git a/src/menu/menu.c b/src/menu/menu.c index 482f2d0f..1ba98b5d 100644 --- a/src/menu/menu.c +++ b/src/menu/menu.c @@ -59,7 +59,9 @@ static void menu_init (boot_params_t *boot_params) { rtc_init(); rspq_init(); rdpq_init(); + dfs_init(DFS_DEFAULT_LOCATION); + fonts_init(); sound_init_default(); menu = calloc(1, sizeof(menu_t)); @@ -102,8 +104,6 @@ static void menu_init (boot_params_t *boot_params) { display_init(RESOLUTION_640x480, DEPTH_16_BPP, 2, GAMMA_NONE, FILTERS_DISABLED); register_VI_handler(frame_counter_handler); - - fonts_init(); } static void menu_deinit (menu_t *menu) { @@ -157,7 +157,7 @@ static struct views_s { void menu_run (boot_params_t *boot_params) { menu_init(boot_params); - while (exception_reset_time() == 0) { + while (true) { surface_t *display = (frame_counter >= FRAMERATE_DIVIDER) ? display_try_get() : NULL; if (display != NULL) { diff --git a/tools/README.md b/tools/README.md deleted file mode 100644 index d2fa938a..00000000 --- a/tools/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Source -This Directory. - -# License -See root directory. - -# Description -`strip_debug_data.py` -Removes unnecessary debug data from the end of ROM file to cut on menu load time from SD card.