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/SMS.ino | |
parent | 38b2b2476b9a5eb30ad3cc68c1b7ab4218a8b6b6 (diff) | |
download | cartreader-9f0aa09197ef0f3f271787109a2c47a445d12f20.tar.gz cartreader-9f0aa09197ef0f3f271787109a2c47a445d12f20.zip |
remove duplicate code to create folder
Diffstat (limited to 'Cart_Reader/SMS.ino')
-rw-r--r-- | Cart_Reader/SMS.ino | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/Cart_Reader/SMS.ino b/Cart_Reader/SMS.ino index 86d1f16..f326e7e 100644 --- a/Cart_Reader/SMS.ino +++ b/Cart_Reader/SMS.ino @@ -550,24 +550,14 @@ void getCartInfo_SMS() { //******************************************
void readROM_SMS() {
// Get name, add extension depending on the system and convert to char array for sd lib
- EEPROM_readAnything(0, foldern);
- strcpy(fileName, romName);
if (system_sms) {
- strcat(fileName, ".sms");
- sprintf(folder, "SMS/ROM/%s/%d", romName, foldern);
+ createFolder("SMS", "ROM", romName, "sms");
} else if (system_gg) {
- strcat(fileName, ".gg");
- sprintf(folder, "GG/ROM/%s/%d", romName, foldern);
+ createFolder("GG", "ROM", romName, "gg");
} else {
- strcat(fileName, ".sg");
- sprintf(folder, "SG1000/ROM/%s/%d", romName, foldern);
+ createFolder("SG1000", "ROM", romName, "sg");
}
- // Create a new folder
- sd.chdir("/");
- sd.mkdir(folder, true);
- sd.chdir(folder);
-
display_Clear();
print_STR(saving_to_STR, 0);
print_Msg(folder);
@@ -658,20 +648,14 @@ void readROM_SMS() { ///*****************************************
void readSRAM_SMS() {
// Get name, add extension and convert to char array for sd lib
- strcpy(fileName, romName);
- strcat(fileName, ".sav");
+ const char* system;
- EEPROM_readAnything(0, foldern);
if (system_gg) {
- sprintf(folder, "GG/SAVE/%s/%d", romName, foldern);
+ system = "GG";
} else {
- sprintf(folder, "SMS/SAVE/%s/%d", romName, foldern);
+ system = "SMS";
}
-
- // Create a new folder
- sd.chdir("/");
- sd.mkdir(folder, true);
- sd.chdir(folder);
+ createFolder(system, "SAVE", romName, "sav");
display_Clear();
print_STR(saving_to_STR, 0);
|