diff --git a/.gitignore b/.gitignore index 45806b5..904425f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.idea/ **/__pycache__/ **/glsm/ build/ diff --git a/README.md b/README.md index f3ede0a..a9d4fa5 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ Run `./start-toolchain.sh` and then `make all` in the Docker container shell. - Add "mark as finished" OR "add as favorite" to menu - Improve battery capacity readings (2100 mAh, 2600 mAh, 3500 mAh) - Refactor Tools to Settings -- Add Clear Recent setting: +- ~~Add Clear Recent setting: ~~ - Adjust recently played count - Adjust overclocking - Release using GitHub action: diff --git a/makefile b/makefile index 9a9e260..be23180 100644 --- a/makefile +++ b/makefile @@ -40,6 +40,7 @@ all-cores: tools: cd ./src/clock && make + cd ./src/clear_recent && make cd ./other/DinguxCommander && make -j bundle: @@ -67,6 +68,7 @@ bundle: cp ./src/overclock/overclock.elf ./build/SYSTEM/rg35xx/bin cp ./src/minui/minui.elf ./build/SYSTEM/rg35xx/paks/MinUI.pak cp ./src/clock/clock.elf ./build/EXTRAS/Tools/rg35xx/Clock.pak + cp ./src/clear_recent/clear_recent.elf ./build/EXTRAS/Tools/rg35xx/ClearRecent.pak # stock cores cp ./cores/output/fceumm_libretro.so ./build/SYSTEM/rg35xx/cores @@ -123,4 +125,5 @@ clean: cd ./src/boot && rm -rf ./output cd ./cores && make clean cd ./src/clock && make clean + cd ./src/clear_recent && make clean cd ./other/DinguxCommander && make clean diff --git a/skeleton/EXTRAS/Tools/rg35xx/ClearRecent.pak/launch.sh b/skeleton/EXTRAS/Tools/rg35xx/ClearRecent.pak/launch.sh new file mode 100755 index 0000000..f445244 --- /dev/null +++ b/skeleton/EXTRAS/Tools/rg35xx/ClearRecent.pak/launch.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +cd $(dirname "$0") +./clear_recent.elf diff --git a/src/clear_recent/clear_recent.c b/src/clear_recent/clear_recent.c new file mode 100644 index 0000000..b6a137d --- /dev/null +++ b/src/clear_recent/clear_recent.c @@ -0,0 +1,53 @@ +#include +#include +#include +#include +#include +#include + +#include "defines.h" +#include "utils.h" +#include "api.h" + +int main(int argc, char* argv[]) { + POW_setCPUSpeed(CPU_SPEED_MENU); + + SDL_Surface* screen = GFX_init(MODE_MAIN); + POW_init(); + InitSettings(); + + SDL_Event event; + int quit = 0; + int save_changes = 0; + + // Show confirmation message + // GFX_blitHardwareGroup(screen, show_setting); + GFX_blitMessage(font.large, "Are you sure you want to clear\nRecently Played list?", screen, NULL); + GFX_blitButtonGroup((char*[]){ "B","CANCEL", "A","CONFIRM", NULL }, screen, 1); + + GFX_flip(screen); + + // Wait for user's input + while (!quit) { + PAD_poll(); + if (PAD_justPressed(BTN_A)) { + save_changes = 1; + quit = 1; + } else if (PAD_justPressed(BTN_B)) { + quit = 1; + } else { + GFX_sync(); + } + } + + // Execute main program based on user's input + if (save_changes) { + fclose(fopen(RECENT_PATH, "w")); + } + + QuitSettings(); + POW_quit(); + GFX_quit(); + + return EXIT_SUCCESS; +} diff --git a/src/clear_recent/makefile b/src/clear_recent/makefile new file mode 100644 index 0000000..cc4629d --- /dev/null +++ b/src/clear_recent/makefile @@ -0,0 +1,15 @@ +ifeq (,$(CROSS_COMPILE)) +$(error missing CROSS_COMPILE for this toolchain) +endif + +TARGET = clear_recent + +CC = $(CROSS_COMPILE)gcc +CFLAGS = -marm -mtune=cortex-a9 -mfpu=neon-fp16 -mfloat-abi=hard -march=armv7-a -fomit-frame-pointer +CFLAGS += -I. -I../common -DPLATFORM=\"$(UNION_PLATFORM)\" +LDFLAGS = -ldl -lSDL -lSDL_image -lSDL_ttf -lmsettings -lpthread + +all: + $(CC) $(TARGET).c ../common/utils.c ../common/api.c -o $(TARGET).elf $(CFLAGS) $(LDFLAGS) +clean: + rm -f $(TARGET).elf