diff --git a/src/menu/cpak_handler.c b/src/menu/cpak_handler.c index 4213cc9e..f6c8f78b 100644 --- a/src/menu/cpak_handler.c +++ b/src/menu/cpak_handler.c @@ -7,16 +7,14 @@ #include "../utils/fs.h" #include "cpak_handler.h" -uint8_t pak_data[128 * MEMPAK_BLOCK_SIZE]; +#define PAK_BLOCKS 128 +uint8_t pak_data[PAK_BLOCKS * MEMPAK_BLOCK_SIZE]; -int clone_pak_content_to_file(char *path, uint8_t jpad_port) { - // get the pak content +int clone_pak_content_to_file(char *path, uint8_t port) { int err; - for (int i = 0; i < 128; i++) { - err = read_mempak_sector(jpad_port, i, &pak_data[i * MEMPAK_BLOCK_SIZE]); + for (int i = 0; i < PAK_BLOCKS; i++) { + err = read_mempak_sector(port, i, &pak_data[i * MEMPAK_BLOCK_SIZE]); if (err) { - // there was an issue reading the content (-1 if the sector was out of bounds or sector_data was null - // -2 if there was an error reading part of a sector return err; } } diff --git a/src/menu/cpak_handler.h b/src/menu/cpak_handler.h index 31a7653a..796d8520 100644 --- a/src/menu/cpak_handler.h +++ b/src/menu/cpak_handler.h @@ -10,6 +10,6 @@ #ifndef CPAK_HANDLER_H__ #define CPAK_HANDLER_H__ -int clone_pak_content_to_file(char *path, uint8_t jpad_port); +int clone_pak_content_to_file(char *path, uint8_t port); #endif