aboutsummaryrefslogtreecommitdiffhomepage
path: root/Cart_Reader/GBA.ino
diff options
context:
space:
mode:
authorsmesgr9000 <smesgr9000>2024-05-26 22:20:47 +0200
committersmesgr9000 <smesgr9000>2024-05-26 22:20:47 +0200
commit363d18b5429c2f418250af4496a81d5522aed6d6 (patch)
tree41ce7be00b881091f5f30e27691ed8f96c62edb0 /Cart_Reader/GBA.ino
parent78bf1462d00df5cfbc9447b25577e9ec3d128b66 (diff)
downloadcartreader-363d18b5429c2f418250af4496a81d5522aed6d6.tar.gz
cartreader-363d18b5429c2f418250af4496a81d5522aed6d6.zip
add common function to open create folder, print message and open file. Remove duplicate code
Diffstat (limited to 'Cart_Reader/GBA.ino')
-rw-r--r--Cart_Reader/GBA.ino17
1 files changed, 2 insertions, 15 deletions
diff --git a/Cart_Reader/GBA.ino b/Cart_Reader/GBA.ino
index 530cc84..995d9e3 100644
--- a/Cart_Reader/GBA.ino
+++ b/Cart_Reader/GBA.ino
@@ -821,14 +821,7 @@ void getCartInfo_GBA() {
// Dump ROM
void readROM_GBA() {
// Get name, add extension and convert to char array for sd lib
- createFolder("GBA", "ROM", romName, "gba");
-
- printAndIncrementFolder(true);
-
- //open file on sd card
- if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
- print_FatalError(create_file_STR);
- }
+ createFolderAndOpenFile("GBA", "ROM", romName, "gba");
//Initialize progress bar
uint32_t processedProgressBar = 0;
@@ -1045,14 +1038,8 @@ void readFRAM_GBA(unsigned long framSize) {
PORTH &= ~((1 << 0) | (1 << 6));
// Get name, add extension and convert to char array for sd lib
- createFolder("GBA", "SAVE", romName, "srm");
+ createFolderAndOpenFile("GBA", "SAVE", romName, "srm");
- printAndIncrementFolder();
-
- //open file on sd card
- if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
- print_FatalError(sd_error_STR);
- }
for (unsigned long currAddress = 0; currAddress < framSize; currAddress += 512) {
for (int c = 0; c < 512; c++) {
// Pull OE_SRAM(PH6) HIGH