This commit is contained in:
Robin Jones 2024-03-18 00:33:07 +00:00
parent 2670c84cb6
commit 6a278bbd0a
2 changed files with 6 additions and 8 deletions

View File

@ -7,16 +7,14 @@
#include "../utils/fs.h" #include "../utils/fs.h"
#include "cpak_handler.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) { int clone_pak_content_to_file(char *path, uint8_t port) {
// get the pak content
int err; int err;
for (int i = 0; i < 128; i++) { for (int i = 0; i < PAK_BLOCKS; i++) {
err = read_mempak_sector(jpad_port, i, &pak_data[i * MEMPAK_BLOCK_SIZE]); err = read_mempak_sector(port, i, &pak_data[i * MEMPAK_BLOCK_SIZE]);
if (err) { 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; return err;
} }
} }

View File

@ -10,6 +10,6 @@
#ifndef CPAK_HANDLER_H__ #ifndef CPAK_HANDLER_H__
#define 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 #endif