Skip to content

Commit

Permalink
icons
Browse files Browse the repository at this point in the history
  • Loading branch information
KrahJohlito committed Dec 23, 2024
1 parent 4e1afdf commit 2b67ade
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
31 changes: 28 additions & 3 deletions src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -109,17 +113,38 @@ 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);
if (fd >= 0) {
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);
Expand Down

0 comments on commit 2b67ade

Please sign in to comment.