feat: Clear recently played list (#1)

This commit is contained in:
Ali Firash 2023-04-17 19:43:15 +02:00 committed by GitHub
parent 37260a497b
commit 138c92dd35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 77 additions and 1 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
.idea/
**/__pycache__/
**/glsm/
build/

View file

@ -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: <https://github.com/dingmah/MiniUI-Tool-Clear-Recently-Played-List>
- ~~Add Clear Recent setting: <https://github.com/dingmah/MiniUI-Tool-Clear-Recently-Played-List>~~
- Adjust recently played count
- Adjust overclocking
- Release using GitHub action: <https://github.com/JoeStaff/devilutionX/commit/a0fe502e70767ca8e2921d5580d4d4dec9e15cc1>

View file

@ -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

View file

@ -0,0 +1,4 @@
#!/bin/sh
cd $(dirname "$0")
./clear_recent.elf

View file

@ -0,0 +1,53 @@
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <msettings.h>
#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;
}

15
src/clear_recent/makefile Normal file
View file

@ -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