From ba432bb8c823aa16095b6efd2d85b5aae2d7283c Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Sun, 24 Oct 2021 17:03:39 -0400 Subject: [PATCH] MEMPAK folder is under ed64 now --- inc/constants.h | 18 ++++++++++++++++++ src/main.c | 11 +---------- src/memorypak.c | 9 +++++---- 3 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 inc/constants.h diff --git a/inc/constants.h b/inc/constants.h new file mode 100644 index 0000000..22c361c --- /dev/null +++ b/inc/constants.h @@ -0,0 +1,18 @@ +// +// Copyright (c) 2017 The Altra64 project contributors +// See LICENSE file in the project root for full license information. +// + +#ifndef _CONSTANTS_H_ +#define _CONSTANTS_H_ + +#define ED64PLUS +#define MAX_SUPPORTED_PATH_LEN 256 + +#ifdef ED64PLUS +#define ED64_FIRMWARE_PATH "ED64P" +#else +#define ED64_FIRMWARE_PATH "ED64" +#endif + +#endif diff --git a/src/main.c b/src/main.c index 76d24c9..8f9de99 100644 --- a/src/main.c +++ b/src/main.c @@ -40,6 +40,7 @@ // YAML parser #include +#include "constants.h" #include "debug.h" #include "mem.h" #include "chksum64.h" @@ -49,22 +50,12 @@ #include "menu.h" #include "cic.h" -#define ED64PLUS - -#ifdef ED64PLUS -#define ED64_FIRMWARE_PATH "ED64P" -#else -#define ED64_FIRMWARE_PATH "ED64" -#endif - #ifdef USE_TRUETYPE #define STB_TRUETYPE_IMPLEMENTATION #include "stb_truetype.h" #define MAX_LIST 20 -#define MAX_SUPPORTED_PATH_LEN 256 - struct glyph { int xoff; diff --git a/src/memorypak.c b/src/memorypak.c index 343bf92..70771c7 100644 --- a/src/memorypak.c +++ b/src/memorypak.c @@ -7,6 +7,7 @@ #include #include #include +#include "constants.h" #include "types.h" #include "mempak.h" #include "memorypak.h" @@ -382,14 +383,14 @@ void view_mpk(display_context_t disp) //old function to dump a mempak to a file void mpk_to_file(display_context_t disp, char *mpk_filename, int quick) { - u8 buff[64]; + u8 buff[MAX_SUPPORTED_PATH_LEN]; u8 v = 0; u8 ok = 0; if (quick) - sprintf(buff, "%s%s", mempak_path, mpk_filename); + sprintf(buff, "/"ED64_FIRMWARE_PATH"/%s/%s", mempak_path, mpk_filename); else - sprintf(buff, "%s%s.MPK", mempak_path, mpk_filename); + sprintf(buff, "/"ED64_FIRMWARE_PATH"/%s/%s.MPK", mempak_path, mpk_filename); FRESULT fr; FILINFO fno; @@ -403,7 +404,7 @@ void mpk_to_file(display_context_t disp, char *mpk_filename, int quick) else while (fr == FR_OK) { - sprintf(buff, "%s%s%i.MPK", mempak_path, mpk_filename, v); + sprintf(buff, "/"ED64_FIRMWARE_PATH"/%s/%s.%i.MPK", mempak_path, mpk_filename, v); fr = f_stat(buff, &fno); if (fr == FR_OK)