feat: Clear recently played list (#1)
This commit is contained in:
parent
37260a497b
commit
138c92dd35
6 changed files with 77 additions and 1 deletions
53
src/clear_recent/clear_recent.c
Normal file
53
src/clear_recent/clear_recent.c
Normal 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
15
src/clear_recent/makefile
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue