Moved assets to the DragonFS

This commit is contained in:
Mateusz Faderewski 2023-12-08 19:49:50 +01:00
parent 6ee348fa57
commit 2345c612d8
8 changed files with 20 additions and 52 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
/.vscode /.vscode
/build /build
/filesystem
/output /output
/tools/sc64/* /tools/sc64/*

View File

@ -4,6 +4,7 @@ PROJECT_NAME = N64FlashcartMenu
SOURCE_DIR = src SOURCE_DIR = src
ASSETS_DIR = assets ASSETS_DIR = assets
FILESYSTEM_DIR = filesystem
BUILD_DIR = build BUILD_DIR = build
OUTPUT_DIR = output OUTPUT_DIR = output
@ -62,26 +63,28 @@ SRCS = \
menu/views/system_info.c \ menu/views/system_info.c \
utils/fs.c utils/fs.c
ASSETS = \ FONTS = \
FiraMonoBold.ttf 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)) MINIZ_OBJS = $(filter $(BUILD_DIR)/libs/miniz/%.o,$(OBJS))
SPNG_OBJS = $(filter $(BUILD_DIR)/libs/libspng/%.o,$(OBJS)) SPNG_OBJS = $(filter $(BUILD_DIR)/libs/libspng/%.o,$(OBJS))
DEPS = $(OBJS:.o=.d) DEPS = $(OBJS:.o=.d)
FILESYSTEM = \
$(addprefix $(FILESYSTEM_DIR)/, $(notdir $(FONTS:%.ttf=%.font64)))
$(MINIZ_OBJS): N64_CFLAGS+=-DMINIZ_NO_TIME -fcompare-debug-second $(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 $(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 $(@info $(shell mkdir -p ./$(FILESYSTEM_DIR) &> /dev/null))
@echo " [FONT] $(basename $@).font64"
@$(N64_MKFONT) $(MKFONT_FLAGS) -o $(BUILD_DIR) "$<"
@mv $(basename $@).font64 $@
$(BUILD_DIR)/%.o: $(BUILD_DIR)/%.asset $(ASSETS_DIR)/assets.S $(FILESYSTEM_DIR)/%.font64: $(ASSETS_DIR)/%.ttf
@sed -e "s,@sym@,$*,g" -e "s,@file@,$(basename $<).asset," < $(ASSETS_DIR)/assets.S | \ @echo " [FONT] $@"
$(CC) -x assembler-with-cpp $(ASFLAGS) -c - -o $@ @$(N64_MKFONT) $(MKFONT_FLAGS) -o $(FILESYSTEM_DIR) "$<"
$(BUILD_DIR)/$(PROJECT_NAME).dfs: $(FILESYSTEM)
$(BUILD_DIR)/$(PROJECT_NAME).elf: $(OBJS) $(BUILD_DIR)/$(PROJECT_NAME).elf: $(OBJS)
@ -90,6 +93,7 @@ disassembly: $(BUILD_DIR)/$(PROJECT_NAME).elf
.PHONY: disassembly .PHONY: disassembly
$(PROJECT_NAME).z64: N64_ROM_TITLE=$(PROJECT_NAME) $(PROJECT_NAME).z64: N64_ROM_TITLE=$(PROJECT_NAME)
$(PROJECT_NAME).z64: $(BUILD_DIR)/$(PROJECT_NAME).dfs
$(@info $(shell mkdir -p ./$(OUTPUT_DIR) &> /dev/null)) $(@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 .PHONY: all
clean: clean:
@rm -rf ./$(BUILD_DIR) ./$(OUTPUT_DIR) @rm -rf ./$(BUILD_DIR) ./$(FILESYSTEM_DIR) ./$(OUTPUT_DIR)
.PHONY: clean .PHONY: clean
run: $(OUTPUT_DIR)/$(PROJECT_NAME).n64 run: $(OUTPUT_DIR)/$(PROJECT_NAME).n64

View File

@ -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@

View File

@ -1,16 +0,0 @@
#ifndef ASSETS_H__
#define ASSETS_H__
#include <stdint.h>
#define ASSET(n) \
extern uint8_t assets_##n[] __attribute__((section(".data"))); \
extern int assets_##n##_size[] __attribute__((section(".data")))
ASSET(FiraMonoBold);
#endif

View File

View File

@ -1,11 +1,10 @@
#include <libdragon.h> #include <libdragon.h>
#include "assets.h"
#include "fonts.h" #include "fonts.h"
static void load_default_font (void) { 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_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) })); rdpq_font_style(default_font, STL_DIRECTORY, &((rdpq_fontstyle_t) { .color = RGBA32(0xFF, 0xFF, 0x70, 0xFF) }));

View File

@ -59,7 +59,9 @@ static void menu_init (boot_params_t *boot_params) {
rtc_init(); rtc_init();
rspq_init(); rspq_init();
rdpq_init(); rdpq_init();
dfs_init(DFS_DEFAULT_LOCATION);
fonts_init();
sound_init_default(); sound_init_default();
menu = calloc(1, sizeof(menu_t)); 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); display_init(RESOLUTION_640x480, DEPTH_16_BPP, 2, GAMMA_NONE, FILTERS_DISABLED);
register_VI_handler(frame_counter_handler); register_VI_handler(frame_counter_handler);
fonts_init();
} }
static void menu_deinit (menu_t *menu) { static void menu_deinit (menu_t *menu) {
@ -157,7 +157,7 @@ static struct views_s {
void menu_run (boot_params_t *boot_params) { void menu_run (boot_params_t *boot_params) {
menu_init(boot_params); menu_init(boot_params);
while (exception_reset_time() == 0) { while (true) {
surface_t *display = (frame_counter >= FRAMERATE_DIVIDER) ? display_try_get() : NULL; surface_t *display = (frame_counter >= FRAMERATE_DIVIDER) ? display_try_get() : NULL;
if (display != NULL) { if (display != NULL) {

View File

@ -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.