From 2b67ade2de9379e3b5147376ca8cd1c49f7c88a2 Mon Sep 17 00:00:00 2001 From: KrahJohlito Date: Mon, 23 Dec 2024 11:33:08 +1030 Subject: [PATCH] icons --- Makefile | 10 ++++++++-- src/util.c | 31 ++++++++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index be9a518a5..cf433a905 100644 --- a/Makefile +++ b/Makefile @@ -104,7 +104,7 @@ PNG_ASSETS = load0 load1 load2 load3 load4 load5 load6 load7 usb usb_bd ilk_bd \ Index_0 Index_1 Index_2 Index_3 Index_4 R3 up down # unused icons - l1 l2 l3 r1 r2 -GFX_OBJS = $(PNG_ASSETS:%=%_png.o) poeveticanew.o icon_sys.o icon_icn.o +GFX_OBJS = $(PNG_ASSETS:%=%_png.o) poeveticanew.o icon_sys.o icon_icn.o icon_cpy_icn.o icon_del_icn.o AUDIO_OBJS = boot.o cancel.o confirm.o cursor.o message.o transition.o bd_connect.o bd_disconnect.o @@ -750,7 +750,13 @@ $(EE_ASM_DIR)poeveticanew.c: thirdparty/PoeVeticaNew.ttf | $(EE_ASM_DIR) $(EE_ASM_DIR)icon_sys.c: gfx/icon.sys | $(EE_ASM_DIR) $(BIN2C) $< $@ $(*F) -$(EE_ASM_DIR)icon_icn.c: gfx/opl.icn | $(EE_ASM_DIR) +$(EE_ASM_DIR)icon_icn.c: gfx/uopl.icn | $(EE_ASM_DIR) + $(BIN2C) $< $@ $(*F) + +$(EE_ASM_DIR)icon_cpy_icn.c: gfx/uopl_cpy.icn | $(EE_ASM_DIR) + $(BIN2C) $< $@ $(*F) + +$(EE_ASM_DIR)icon_del_icn.c: gfx/uopl_del.icn | $(EE_ASM_DIR) $(BIN2C) $< $@ $(*F) $(EE_ASM_DIR)icon_sys_A.c: misc/icon_A.sys | $(EE_ASM_DIR) diff --git a/src/util.c b/src/util.c index 676cfbace..fbde98981 100644 --- a/src/util.c +++ b/src/util.c @@ -23,6 +23,10 @@ extern void *icon_sys; extern int size_icon_sys; extern void *icon_icn; extern int size_icon_icn; +extern void *icon_cpy_icn; +extern int size_icon_cpy_icn; +extern void *icon_del_icn; +extern int size_icon_del_icn; static int mcID = -1; @@ -109,7 +113,7 @@ void checkMCFolder(void) snprintf(path, sizeof(path), "mc%d:OPL/", mcID & 1); mkdir(path, 0777); - snprintf(path, sizeof(path), "mc%d:OPL/opl.icn", mcID & 1); + snprintf(path, sizeof(path), "mc%d:OPL/uopl.icn", mcID & 1); fd = open(path, O_RDONLY); if (fd < 0) { fd = openFile(path, O_WRONLY | O_CREAT | O_TRUNC); @@ -117,9 +121,30 @@ void checkMCFolder(void) write(fd, &icon_icn, size_icon_icn); close(fd); } - } else { + } else + close(fd); + + snprintf(path, sizeof(path), "mc%d:OPL/uopl_cpy.icn", mcID & 1); + fd = open(path, O_RDONLY); + if (fd < 0) { + fd = openFile(path, O_WRONLY | O_CREAT | O_TRUNC); + if (fd >= 0) { + write(fd, &icon_cpy_icn, size_icon_cpy_icn); + close(fd); + } + } else + close(fd); + + snprintf(path, sizeof(path), "mc%d:OPL/uopl_del.icn", mcID & 1); + fd = open(path, O_RDONLY); + if (fd < 0) { + fd = openFile(path, O_WRONLY | O_CREAT | O_TRUNC); + if (fd >= 0) { + write(fd, &icon_del_icn, size_icon_del_icn); + close(fd); + } + } else close(fd); - } snprintf(path, sizeof(path), "mc%d:OPL/icon.sys", mcID & 1); fd = open(path, O_RDONLY);