aboutsummaryrefslogtreecommitdiff
path: root/core.c
diff options
context:
space:
mode:
authorneonloop2023-07-22 19:29:58 +0000
committerneonloop2023-07-22 19:29:58 +0000
commitecb3c7bf765a84413ac0a53ffca7c8bf470c821f (patch)
treedab03af97c70fde6361b051c7be2851ea5d350ca /core.c
parent9efef9e19a4310f02b4c69a6d79ed9242c88aa34 (diff)
downloadpicoarch-ecb3c7bf765a84413ac0a53ffca7c8bf470c821f.tar.gz
picoarch-ecb3c7bf765a84413ac0a53ffca7c8bf470c821f.tar.bz2
picoarch-ecb3c7bf765a84413ac0a53ffca7c8bf470c821f.zip
Opens internal file browser to last played content on core
Diffstat (limited to 'core.c')
-rw-r--r--core.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/core.c b/core.c
index 61a14b5..6f28d28 100644
--- a/core.c
+++ b/core.c
@@ -704,6 +704,49 @@ finish:
return ret;
}
+void core_load_last_opened(char *buf, size_t len) {
+ char filename[MAX_PATH];
+ FILE *file;
+ size_t count;
+
+ if (!len)
+ goto finish;
+
+ snprintf(filename, MAX_PATH, "%s%s", config_dir, "last_opened.txt");
+ file = fopen(filename, "r");
+
+ if (!file)
+ goto finish;
+
+ count = fread(buf, 1, len - 1, file);
+ buf[count] = '\0';
+
+finish:
+ if (file)
+ fclose(file);
+}
+
+void core_save_last_opened(struct content *content) {
+ char filename[MAX_PATH];
+ FILE *file;
+ size_t len = strlen(content->path);
+
+ if (!len)
+ goto finish;
+
+ snprintf(filename, MAX_PATH, "%s%s", config_dir, "last_opened.txt");
+ file = fopen(filename, "w");
+
+ if (!file)
+ goto finish;
+
+ fwrite(content->path, 1, len, file);
+
+finish:
+ if (file)
+ fclose(file);
+}
+
void core_apply_cheats(struct cheats *cheats) {
if (!cheats)
return;