nice asset names

This commit is contained in:
Polprzewodnikowy 2022-05-17 18:45:01 +02:00
parent ac754b582a
commit b055a439a4
5 changed files with 24 additions and 8 deletions

View File

@ -38,13 +38,13 @@ SRC_FILES = \
fatfs/ffunicode.c
ASSET_FILES = \
background.png
exception_background.png
SRCS = $(SRC_FILES) $(ASSET_FILES)
OBJS = $(addprefix $(BUILD_DIR)/, $(notdir $(patsubst %,%.o,$(SRCS))))
SRC_OBJS = $(patsubst %,%.o,$(SRC_FILES))
ASSET_OBJS = $(patsubst %,%.asset.o,$(basename $(ASSET_FILES)))
OBJS = $(addprefix $(BUILD_DIR)/,$(notdir $(SRC_OBJS) $(ASSET_OBJS)))
DEPS = $(OBJS:.o=.d)
$(info $(SRCS))
$(info $(OBJS))
VPATH = $(SRC_DIR) $(SRC_DIR)/fatfs $(ASSET_DIR)
$(@info $(shell mkdir -p ./$(BUILD_DIR) &> /dev/null))
@ -55,9 +55,11 @@ $(BUILD_DIR)/%.S.o: %.S
$(BUILD_DIR)/%.c.o: %.c
$(CC) $(FLAGS) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.png.o: %.png
$(BUILD_DIR)/%.asset: $(ASSET_DIR)/%.png
$(PYTHON) tools/asset_converter.py $< $@
$(OBJCOPY) -I binary -O elf32-bigmips -B mips:4000 $@ $@
$(BUILD_DIR)/%.asset.o: $(BUILD_DIR)/%.asset $(ASSET_DIR)/assets.S
@sed -e "s,@sym@,$*,g" -e "s,@file@,$<," < $(ASSET_DIR)/assets.S | $(CC) -x assembler-with-cpp $(FLAGS) $(ASFLAGS) $(CFLAGS) -c - -o $@
$(BUILD_DIR)/bootloader.elf: $(OBJS) N64.ld
$(CXX) $(FLAGS) $(LDFLAGS) -TN64.ld $(OBJS) -o $@

View File

@ -0,0 +1,3 @@
.global assets_@sym@
assets_@sym@:
.incbin "@file@"

View File

@ -0,0 +1,11 @@
#ifndef ASSETS_H__
#define ASSETS_H__
#include <stdint.h>
extern const uint32_t assets_exception_background;
#endif

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -7,6 +7,7 @@
#include "sc64.h"
#include "version.h"
#include "vr4300.h"
#include "../assets/assets.h"
#define EXCEPTION_INTERRUPT (0)
@ -26,7 +27,6 @@
#define LINE_HEIGHT (10)
extern const uint32_t _binary_build_background_png_o_start;
static io32_t exception_framebuffer[SCREEN_WIDTH * SCREEN_HEIGHT] __attribute__((aligned(64)));
static const vi_regs_t vi_config[] = {{
.CR = (
@ -75,7 +75,7 @@ static const vi_regs_t vi_config[] = {{
static void exception_init_screen (void) {
const vi_regs_t *cfg = &vi_config[OS_INFO->tv_type];
uint32_t *background_data = (uint32_t *) (&_binary_build_background_png_o_start);
uint32_t *background_data = (uint32_t *) (&assets_exception_background);
for (int i = 0; i < (SCREEN_WIDTH * SCREEN_HEIGHT); i += 2) {
io_write(&exception_framebuffer[i], *background_data);