diff options
author | neonloop | 2023-07-22 19:29:58 +0000 |
---|---|---|
committer | neonloop | 2023-07-22 19:29:58 +0000 |
commit | ecb3c7bf765a84413ac0a53ffca7c8bf470c821f (patch) | |
tree | dab03af97c70fde6361b051c7be2851ea5d350ca /core.c | |
parent | 9efef9e19a4310f02b4c69a6d79ed9242c88aa34 (diff) | |
download | picoarch-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.c | 43 |
1 files changed, 43 insertions, 0 deletions
@@ -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; |