diff options
author | smesgr9000 <smesgr9000> | 2024-05-12 15:37:11 +0200 |
---|---|---|
committer | smesgr9000 <smesgr9000> | 2024-05-12 15:37:11 +0200 |
commit | 9f0aa09197ef0f3f271787109a2c47a445d12f20 (patch) | |
tree | 7ae7ee98f9e5f7978b9ea7f18208e2c66e05ceb1 /Cart_Reader/GBA.ino | |
parent | 38b2b2476b9a5eb30ad3cc68c1b7ab4218a8b6b6 (diff) | |
download | cartreader-9f0aa09197ef0f3f271787109a2c47a445d12f20.tar.gz cartreader-9f0aa09197ef0f3f271787109a2c47a445d12f20.zip |
remove duplicate code to create folder
Diffstat (limited to 'Cart_Reader/GBA.ino')
-rw-r--r-- | Cart_Reader/GBA.ino | 47 |
1 files changed, 5 insertions, 42 deletions
diff --git a/Cart_Reader/GBA.ino b/Cart_Reader/GBA.ino index 8745175..cca63a7 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
- strcpy(fileName, romName);
- strcat(fileName, ".gba");
-
- // create a new folder for the rom file
- EEPROM_readAnything(0, foldern);
- sprintf(folder, "GBA/ROM/%s/%d", romName, foldern);
- sd.mkdir(folder, true);
- sd.chdir(folder);
+ createFolder("GBA", "ROM", romName, "gba");
//clear the screen
display_Clear();
@@ -935,14 +928,7 @@ boolean compare_checksum_GBA() { void readSRAM_GBA(boolean browseFile, uint32_t sramSize, uint32_t pos) {
if (browseFile) {
// Get name, add extension and convert to char array for sd lib
- strcpy(fileName, romName);
- strcat(fileName, ".srm");
-
- // create a new folder for the save file
- EEPROM_readAnything(0, foldern);
- sprintf(folder, "GBA/SAVE/%s/%d", romName, foldern);
- sd.mkdir(folder, true);
- sd.chdir(folder);
+ createFolder("GBA", "SAVE", romName, "srm");
// Save location
print_STR(saving_to_STR, 0);
@@ -1076,14 +1062,7 @@ void readFRAM_GBA(unsigned long framSize) { PORTH &= ~((1 << 0) | (1 << 6));
// Get name, add extension and convert to char array for sd lib
- strcpy(fileName, romName);
- strcat(fileName, ".srm");
-
- // create a new folder for the save file
- EEPROM_readAnything(0, foldern);
- sprintf(folder, "GBA/SAVE/%s/%d", romName, foldern);
- sd.mkdir(folder, true);
- sd.chdir(folder);
+ createFolder("GBA", "SAVE", romName, "srm");
// Save location
print_STR(saving_to_STR, 0);
@@ -1480,15 +1459,7 @@ void readFLASH_GBA(boolean browseFile, uint32_t flashSize, uint32_t pos) { if (browseFile) {
// Get name, add extension and convert to char array for sd lib
- strcpy(fileName, romName);
- strcat(fileName, ".fla");
-
- // create a new folder for the save file
- EEPROM_readAnything(0, foldern);
-
- sprintf(folder, "GBA/SAVE/%s/%d", romName, foldern);
- sd.mkdir(folder, true);
- sd.chdir(folder);
+ createFolder("GBA", "SAVE", romName, "fla");
// Save location
print_STR(saving_to_STR, 0);
@@ -1724,15 +1695,7 @@ void writeEeprom_GBA(word eepSize) { // Read eeprom to file
void readEeprom_GBA(word eepSize) {
// Get name, add extension and convert to char array for sd lib
- strcpy(fileName, romName);
- strcat(fileName, ".eep");
-
- // create a new folder for the save file
- EEPROM_readAnything(0, foldern);
-
- sprintf(folder, "GBA/SAVE/%s/%d", romName, foldern);
- sd.mkdir(folder, true);
- sd.chdir(folder);
+ createFolder("GBA", "SAVE", romName, "eep");
// Save location
print_STR(saving_to_STR, 0);
|