mirror of
https://github.com/Polprzewodnikowy/N64FlashcartMenu.git
synced 2024-12-23 16:51:53 +01:00
Fixed assets alignment issue
This commit is contained in:
parent
5f6b006a1b
commit
ee769b38ac
19
Makefile
19
Makefile
@ -9,7 +9,7 @@ OUTPUT_DIR = output
|
||||
|
||||
include $(N64_INST)/include/n64.mk
|
||||
|
||||
N64_CFLAGS += -iquote $(SOURCE_DIR) -I $(SOURCE_DIR)/libs -flto=auto $(FLAGS)
|
||||
N64_CFLAGS += -iquote $(SOURCE_DIR) -iquote $(ASSETS_DIR) -I $(SOURCE_DIR)/libs -flto=auto $(FLAGS)
|
||||
|
||||
SRCS = \
|
||||
main.c \
|
||||
@ -56,7 +56,7 @@ SRCS = \
|
||||
utils/fs.c
|
||||
|
||||
ASSETS = \
|
||||
FiraMono-Bold.ttf
|
||||
FiraMonoBold.ttf
|
||||
|
||||
OBJS = $(addprefix $(BUILD_DIR)/, $(addsuffix .o,$(basename $(SRCS) $(ASSETS))))
|
||||
MINIZ_OBJS = $(filter $(BUILD_DIR)/libs/miniz/%.o,$(OBJS))
|
||||
@ -65,13 +65,16 @@ DEPS = $(OBJS:.o=.d)
|
||||
|
||||
$(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)/FiraMono-Bold.o: MKFONT_FLAGS+=-c 0 --size 16 -r 20-7F -r 2026-2026 --ellipsis 2026,1
|
||||
$(BUILD_DIR)/FiraMonoBold.asset: MKFONT_FLAGS+=-c 0 --size 16 -r 20-7F -r 2026-2026 --ellipsis 2026,1
|
||||
|
||||
$(BUILD_DIR)/%.o: $(ASSETS_DIR)/%.ttf
|
||||
@echo " [FONT] $@"
|
||||
@$(N64_MKFONT) $(MKFONT_FLAGS) -o $(ASSETS_DIR) "$<"
|
||||
@$(N64_OBJCOPY) -I binary -O elf32-bigmips -B mips4300 $(basename $<).font64 $@
|
||||
@rm $(basename $<).font64
|
||||
$(BUILD_DIR)/%.asset: $(ASSETS_DIR)/%.ttf
|
||||
@echo " [FONT] $(basename $@).font64"
|
||||
@$(N64_MKFONT) $(MKFONT_FLAGS) -o $(BUILD_DIR) "$<"
|
||||
@$(shell mv $(basename $@).font64 $@)
|
||||
|
||||
$(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 $@
|
||||
|
||||
$(BUILD_DIR)/$(PROJECT_NAME).elf: $(OBJS)
|
||||
|
||||
|
11
assets/assets.S
Normal file
11
assets/assets.S
Normal file
@ -0,0 +1,11 @@
|
||||
.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@
|
16
assets/assets.h
Normal file
16
assets/assets.h
Normal file
@ -0,0 +1,16 @@
|
||||
#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
|
@ -1,19 +1,11 @@
|
||||
#include <libdragon.h>
|
||||
|
||||
#include "assets.h"
|
||||
#include "fonts.h"
|
||||
|
||||
|
||||
#define FONT_IMPORT(f) \
|
||||
extern void *_binary_assets_##f##_start __attribute__((section(".data"))); \
|
||||
extern int _binary_assets_##f##_size __attribute__((section(".data")));
|
||||
#define FONT_LOAD(f) rdpq_font_load_buf((void *) (&_binary_assets_##f##_start), (size_t) (&_binary_assets_##f##_size))
|
||||
|
||||
|
||||
FONT_IMPORT(FiraMono_Bold_font64);
|
||||
|
||||
|
||||
static void load_default_font (void) {
|
||||
rdpq_font_t *default_font = FONT_LOAD(FiraMono_Bold_font64);
|
||||
rdpq_font_t *default_font = rdpq_font_load_buf(assets_FiraMonoBold, (int) (assets_FiraMonoBold_size));
|
||||
|
||||
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) }));
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "views.h"
|
||||
|
||||
|
||||
static const char *rom_extensions[] = { "z64", "n64", "v64", NULL };
|
||||
static const char *rom_extensions[] = { "z64", "n64", "v64", "rom", NULL };
|
||||
static const char *emulator_extensions[] = { "nes", "gb", "gbc", "smc", "gen", "smd", NULL };
|
||||
static const char *save_extensions[] = { "sav", NULL }; // TODO: "eep", "sra", "srm", "fla" could be used if transfered from different flashcarts.
|
||||
static const char *image_extensions[] = { "png", NULL };
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "views.h"
|
||||
|
||||
|
||||
static const char *n64_rom_extensions[] = { "z64", "n64", "v64", NULL };
|
||||
static const char *n64_rom_extensions[] = { "z64", "n64", "v64", "rom", NULL };
|
||||
static const char *text_extensions[] = { "txt", NULL };
|
||||
static const char *config_extensions[] = { "ini", "cfg", "yml", "yaml", "toml", NULL };
|
||||
static const char *save_extensions[] = { "sav", "eep", "eeprom", "sra", "srm", "ram", "fla", "flashram", NULL };
|
||||
|
Loading…
Reference in New Issue
Block a user