mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-27 23:14:14 +01:00
V24: Changed folder structure on SD card
All modules now write their roms/saves to a separate subfolder.
This commit is contained in:
parent
ed5dc3f573
commit
dddf21fc3e
@ -2,8 +2,8 @@
|
||||
Cartridge Reader for Arduino Mega2560
|
||||
|
||||
Author: sanni
|
||||
Date: 2017-05-03
|
||||
Version: V23A
|
||||
Date: 2017-05-08
|
||||
Version: V24
|
||||
|
||||
SD lib: https://github.com/greiman/SdFat
|
||||
LCD lib: https://github.com/adafruit/Adafruit_SSD1306
|
||||
@ -34,7 +34,7 @@
|
||||
YamaArashi - GBA flashrom bank switch command
|
||||
|
||||
**********************************************************************************/
|
||||
char ver[5] = "V23A";
|
||||
char ver[5] = "V24";
|
||||
|
||||
/******************************************
|
||||
Define Output
|
||||
@ -117,13 +117,14 @@ SdFile myFile;
|
||||
#define mode_N64_Cart 0
|
||||
#define mode_N64_Controller 1
|
||||
#define mode_SNES 2
|
||||
#define mode_NP 3
|
||||
#define mode_NPFlash 4
|
||||
#define mode_NPGame 5
|
||||
#define mode_SFM 3
|
||||
#define mode_SFM_Flash 4
|
||||
#define mode_SFM_Game 5
|
||||
#define mode_GB 6
|
||||
#define mode_FLASH8 7
|
||||
#define mode_FLASH16 8
|
||||
#define mode_GBA 9
|
||||
#define mode_GBM 10
|
||||
|
||||
/******************************************
|
||||
Variables
|
||||
@ -178,7 +179,7 @@ boolean filebrowse = 0;
|
||||
char fileOptions[30][20];
|
||||
|
||||
// Common
|
||||
char romName[10];
|
||||
char romName[17];
|
||||
int sramSize = 0;
|
||||
int romType = 0;
|
||||
byte saveType;
|
||||
@ -199,7 +200,7 @@ byte mode;
|
||||
|
||||
//remember folder number to create a new folder for every save
|
||||
int foldern;
|
||||
char folder[24];
|
||||
char folder[36];
|
||||
|
||||
// Array that holds the data
|
||||
byte sdBuffer[512];
|
||||
@ -333,6 +334,11 @@ static const char n64MenuItem2[] PROGMEM = "Controller";
|
||||
static const char n64MenuItem3[] PROGMEM = "Flash Repro";
|
||||
static const char* const menuOptionsN64[] PROGMEM = {n64MenuItem1, n64MenuItem2, n64MenuItem3};
|
||||
|
||||
// Nintendo Power Submenu
|
||||
static const char npMenuItem1[] PROGMEM = "SF Memory";
|
||||
static const char npMenuItem2[] PROGMEM = "GB Memory";
|
||||
static const char* const menuOptionsNP[] PROGMEM = {npMenuItem1, npMenuItem2};
|
||||
|
||||
// Flash Submenu
|
||||
static const char flashMenuItem1[] PROGMEM = "8bit slot";
|
||||
static const char flashMenuItem2[] PROGMEM = "16bit slot";
|
||||
@ -354,7 +360,7 @@ void mainMenu() {
|
||||
switch (modeMenu)
|
||||
{
|
||||
case 0:
|
||||
// create menu with title and 2 options to choose from
|
||||
// create menu with title and 3 options to choose from
|
||||
unsigned char n64Dev;
|
||||
// Copy menuOptions out of progmem
|
||||
convertPgm(menuOptionsN64, 3);
|
||||
@ -398,10 +404,29 @@ void mainMenu() {
|
||||
break;
|
||||
|
||||
case 2:
|
||||
display_Clear();
|
||||
display_Update();
|
||||
setup_NP();
|
||||
mode = mode_NP;
|
||||
// create menu with title and 2 options to choose from
|
||||
unsigned char npCart;
|
||||
// Copy menuOptions out of progmem
|
||||
convertPgm(menuOptionsNP, 1);
|
||||
npCart = question_box("Select NP Cart", menuOptions, 1, 0);
|
||||
|
||||
// wait for user choice to come back from the question box menu
|
||||
switch (npCart)
|
||||
{
|
||||
case 0:
|
||||
display_Clear();
|
||||
display_Update();
|
||||
setup_SFM();
|
||||
mode = mode_SFM;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
display_Clear();
|
||||
display_Update();
|
||||
setup_GBM();
|
||||
mode = mode_GBM;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
@ -493,7 +518,7 @@ void mainMenu() {
|
||||
display_Update();
|
||||
delay(2000);
|
||||
foldern = 0;
|
||||
EEPROM_writeAnything(0, foldern);
|
||||
EEPROM_writeAnything(10, foldern);
|
||||
asm volatile (" jmp 0");
|
||||
}
|
||||
}
|
||||
@ -522,7 +547,7 @@ void setup() {
|
||||
rgb.setColor(0, 0, 0);
|
||||
|
||||
// Read current folder number out of eeprom
|
||||
EEPROM_readAnything(0, foldern);
|
||||
EEPROM_readAnything(10, foldern);
|
||||
|
||||
if (enable_OLED) {
|
||||
// GLCD
|
||||
@ -1269,8 +1294,8 @@ void loop() {
|
||||
else if (mode == mode_FLASH16) {
|
||||
flashromMenu16();
|
||||
}
|
||||
else if (mode == mode_NP) {
|
||||
npMenu();
|
||||
else if (mode == mode_SFM) {
|
||||
sfmMenu();
|
||||
}
|
||||
else if (mode == mode_GB) {
|
||||
gbMenu();
|
||||
@ -1278,11 +1303,14 @@ void loop() {
|
||||
else if (mode == mode_GBA) {
|
||||
gbaMenu();
|
||||
}
|
||||
else if (mode == mode_NPFlash) {
|
||||
NPFlashMenu();
|
||||
else if (mode == mode_SFM_Flash) {
|
||||
sfmFlashMenu();
|
||||
}
|
||||
else if (mode == mode_NPGame) {
|
||||
NPGameOptions();
|
||||
else if (mode == mode_SFM_Game) {
|
||||
sfmGameOptions();
|
||||
}
|
||||
else if (mode == mode_GBM) {
|
||||
gbmMenu();
|
||||
}
|
||||
else {
|
||||
display_Clear();
|
||||
|
@ -824,14 +824,14 @@ void readFlash() {
|
||||
sd.chdir("/");
|
||||
|
||||
// Get name, add extension and convert to char array for sd lib
|
||||
EEPROM_readAnything(0, foldern);
|
||||
EEPROM_readAnything(10, foldern);
|
||||
sd.mkdir("FLASH", true);
|
||||
sd.chdir("FLASH");
|
||||
sprintf(fileName, "FL%d", foldern);
|
||||
strcat(fileName, ".bin");
|
||||
// write new folder number back to eeprom
|
||||
foldern = foldern + 1;
|
||||
EEPROM_writeAnything(0, foldern);
|
||||
EEPROM_writeAnything(10, foldern);
|
||||
|
||||
display_Clear();
|
||||
print_Msg(F("Saving as "));
|
||||
@ -1060,14 +1060,14 @@ void readFlash16() {
|
||||
sd.chdir("/");
|
||||
|
||||
// Get name, add extension and convert to char array for sd lib
|
||||
EEPROM_readAnything(0, foldern);
|
||||
EEPROM_readAnything(10, foldern);
|
||||
sd.mkdir("FLASH", true);
|
||||
sd.chdir("FLASH");
|
||||
sprintf(fileName, "FL%d", foldern);
|
||||
strcat(fileName, ".bin");
|
||||
// write new folder number back to eeprom
|
||||
foldern = foldern + 1;
|
||||
EEPROM_writeAnything(0, foldern);
|
||||
EEPROM_writeAnything(10, foldern);
|
||||
|
||||
display_Clear();
|
||||
print_Msg(F("Saving as "));
|
||||
|
@ -128,7 +128,7 @@ void setup_GB() {
|
||||
display_Clear();
|
||||
if (strcmp(checksumStr, "00") != 0) {
|
||||
println_Msg(F("GB Cart Info"));
|
||||
print_Msg(F("Rom Name: "));
|
||||
print_Msg(F("Name: "));
|
||||
println_Msg(romName);
|
||||
print_Msg(F("Rom Type: "));
|
||||
switch (romType) {
|
||||
@ -329,13 +329,13 @@ void getCartInfo_GB() {
|
||||
// Get Checksum as string
|
||||
sprintf(checksumStr, "%02X%02X", readByte_GB(0x014E), readByte_GB(0x014F));
|
||||
|
||||
// Dump name into 8.3 compatible format
|
||||
// Get name
|
||||
byte myByte = 0;
|
||||
byte myLength = 0;
|
||||
|
||||
for (int addr = 0x0134; addr <= 0x13C; addr++) {
|
||||
myByte = readByte_GB(addr);
|
||||
if (((char(myByte) >= 48 && char(myByte) <= 57) || (char(myByte) >= 65 && char(myByte) <= 122)) && myLength < 8) {
|
||||
if (((char(myByte) >= 48 && char(myByte) <= 57) || (char(myByte) >= 65 && char(myByte) <= 122)) && myLength < 16) {
|
||||
romName[myLength] = char(myByte);
|
||||
myLength++;
|
||||
}
|
||||
@ -345,25 +345,24 @@ void getCartInfo_GB() {
|
||||
// Dump ROM
|
||||
void readROM_GB() {
|
||||
// Get name, add extension and convert to char array for sd lib
|
||||
char fileName[26];
|
||||
strcpy(fileName, romName);
|
||||
strcat(fileName, ".GB");
|
||||
|
||||
// create a new folder for the rom file
|
||||
EEPROM_readAnything(0, foldern);
|
||||
sprintf(folder, "ROM/%s/%d", romName, foldern);
|
||||
EEPROM_readAnything(10, foldern);
|
||||
sprintf(folder, "GB/ROM/%s/%d", romName, foldern);
|
||||
sd.mkdir(folder, true);
|
||||
sd.chdir(folder);
|
||||
|
||||
//clear the screen
|
||||
display_Clear();
|
||||
println_Msg(F("Creating folder: "));
|
||||
println_Msg(folder);
|
||||
print_Msg(F("Saving to "));
|
||||
print_Msg(folder);
|
||||
println_Msg(F("/..."));
|
||||
display_Update();
|
||||
|
||||
// write new folder number back to eeprom
|
||||
foldern = foldern + 1;
|
||||
EEPROM_writeAnything(0, foldern);
|
||||
EEPROM_writeAnything(10, foldern);
|
||||
|
||||
//open file on sd card
|
||||
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
|
||||
@ -406,10 +405,6 @@ void readROM_GB() {
|
||||
|
||||
// Close the file:
|
||||
myFile.close();
|
||||
|
||||
// Signal end of process
|
||||
print_Msg(F("Saved as "));
|
||||
println_Msg(fileName);
|
||||
}
|
||||
|
||||
unsigned int calc_checksum_GB (char* fileName, char* folder) {
|
||||
@ -451,13 +446,12 @@ boolean compare_checksum_GB() {
|
||||
println_Msg(F("Calculating Checksum"));
|
||||
display_Update();
|
||||
|
||||
char fileName[26];
|
||||
strcpy(fileName, romName);
|
||||
strcat(fileName, ".GB");
|
||||
|
||||
// last used rom folder
|
||||
EEPROM_readAnything(0, foldern);
|
||||
sprintf(folder, "ROM/%s/%d", romName, foldern - 1);
|
||||
EEPROM_readAnything(10, foldern);
|
||||
sprintf(folder, "GB/ROM/%s/%d", romName, foldern - 1);
|
||||
|
||||
char calcsumStr[5];
|
||||
sprintf(calcsumStr, "%04X", calc_checksum_GB(fileName, folder));
|
||||
@ -483,19 +477,18 @@ void readSRAM_GB() {
|
||||
if (sramEndAddress > 0) {
|
||||
|
||||
// Get name, add extension and convert to char array for sd lib
|
||||
char fileName[26];
|
||||
strcpy(fileName, romName);
|
||||
strcat(fileName, ".sav");
|
||||
|
||||
// create a new folder for the save file
|
||||
EEPROM_readAnything(0, foldern);
|
||||
sprintf(folder, "SAVE/%s/%d", romName, foldern);
|
||||
EEPROM_readAnything(10, foldern);
|
||||
sprintf(folder, "GB/SAVE/%s/%d", romName, foldern);
|
||||
sd.mkdir(folder, true);
|
||||
sd.chdir(folder);
|
||||
|
||||
// write new folder number back to eeprom
|
||||
foldern = foldern + 1;
|
||||
EEPROM_writeAnything(0, foldern);
|
||||
EEPROM_writeAnything(10, foldern);
|
||||
|
||||
//open file on sd card
|
||||
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
|
||||
@ -540,12 +533,9 @@ void readSRAM_GB() {
|
||||
myFile.close();
|
||||
|
||||
// Signal end of process
|
||||
print_Msg(F("Saved to SAVE/"));
|
||||
print_Msg(romName);
|
||||
print_Msg(F("/"));
|
||||
print_Msg(foldern - 1);
|
||||
print_Msg(F("/"));
|
||||
println_Msg(fileName);
|
||||
print_Msg(F("Saved to "));
|
||||
print_Msg(folder);
|
||||
println_Msg(F("/"));
|
||||
display_Update();
|
||||
}
|
||||
else {
|
||||
|
@ -453,8 +453,7 @@ void setup_GBA() {
|
||||
getCartInfo_GBA();
|
||||
display_Clear();
|
||||
|
||||
println_Msg(F("GBA Cart Info"));
|
||||
print_Msg(F("Rom Name: "));
|
||||
print_Msg(F("Name: "));
|
||||
println_Msg(romName);
|
||||
print_Msg(F("Cart ID: "));
|
||||
println_Msg(cartID);
|
||||
@ -733,12 +732,12 @@ void getCartInfo_GBA() {
|
||||
print_Error(F("GBA.txt missing"), true);
|
||||
}
|
||||
|
||||
// Dump name into 8.3 compatible format
|
||||
// Get name
|
||||
byte myByte = 0;
|
||||
byte myLength = 0;
|
||||
for (int addr = 0xA0; addr <= 0xAB; addr++) {
|
||||
myByte = sdBuffer[addr];
|
||||
if (((char(myByte) >= 48 && char(myByte) <= 57) || (char(myByte) >= 65 && char(myByte) <= 122)) && myLength < 8) {
|
||||
if (((char(myByte) >= 48 && char(myByte) <= 57) || (char(myByte) >= 65 && char(myByte) <= 122)) && myLength < 16) {
|
||||
romName[myLength] = char(myByte);
|
||||
myLength++;
|
||||
}
|
||||
@ -775,25 +774,25 @@ void getCartInfo_GBA() {
|
||||
// Dump ROM
|
||||
void readROM_GBA() {
|
||||
// Get name, add extension and convert to char array for sd lib
|
||||
char fileName[26];
|
||||
strcpy(fileName, romName);
|
||||
strcat(fileName, ".gba");
|
||||
|
||||
// create a new folder for the rom file
|
||||
EEPROM_readAnything(0, foldern);
|
||||
sprintf(folder, "ROM/%s/%d", romName, foldern);
|
||||
EEPROM_readAnything(10, foldern);
|
||||
sprintf(folder, "GBA/ROM/%s/%d", romName, foldern);
|
||||
sd.mkdir(folder, true);
|
||||
sd.chdir(folder);
|
||||
|
||||
//clear the screen
|
||||
display_Clear();
|
||||
println_Msg(F("Reading to: "));
|
||||
println_Msg(folder);
|
||||
print_Msg(F("Saving to "));
|
||||
print_Msg(folder);
|
||||
println_Msg(F("/..."));
|
||||
display_Update();
|
||||
|
||||
// write new folder number back to eeprom
|
||||
foldern = foldern + 1;
|
||||
EEPROM_writeAnything(0, foldern);
|
||||
EEPROM_writeAnything(10, foldern);
|
||||
|
||||
//open file on sd card
|
||||
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
|
||||
@ -821,10 +820,6 @@ void readROM_GBA() {
|
||||
|
||||
// Close the file:
|
||||
myFile.close();
|
||||
|
||||
// Signal end of process
|
||||
print_Msg(F("Saved as "));
|
||||
println_Msg(fileName);
|
||||
}
|
||||
|
||||
// Calculate the checksum of the dumped rom
|
||||
@ -832,13 +827,12 @@ boolean compare_checksum_GBA () {
|
||||
println_Msg(F("Calculating Checksum"));
|
||||
display_Update();
|
||||
|
||||
char fileName[26];
|
||||
strcpy(fileName, romName);
|
||||
strcat(fileName, ".gba");
|
||||
|
||||
// last used rom folder
|
||||
EEPROM_readAnything(0, foldern);
|
||||
sprintf(folder, "ROM/%s/%d", romName, foldern - 1);
|
||||
EEPROM_readAnything(10, foldern);
|
||||
sprintf(folder, "GBA/ROM/%s/%d", romName, foldern - 1);
|
||||
sd.chdir(folder);
|
||||
|
||||
// If file exists
|
||||
@ -901,24 +895,19 @@ void readFRAM_GBA (unsigned long framSize) {
|
||||
strcat(fileName, ".srm");
|
||||
|
||||
// create a new folder for the save file
|
||||
EEPROM_readAnything(0, foldern);
|
||||
sprintf(folder, "SAVE/%s/%d", romName, foldern);
|
||||
EEPROM_readAnything(10, foldern);
|
||||
sprintf(folder, "GBA/SAVE/%s/%d", romName, foldern);
|
||||
sd.mkdir(folder, true);
|
||||
sd.chdir(folder);
|
||||
|
||||
// Signal end of process
|
||||
print_Msg(F("Reading to SAVE/"));
|
||||
print_Msg(romName);
|
||||
print_Msg(F("/"));
|
||||
print_Msg(foldern);
|
||||
print_Msg(F("/"));
|
||||
print_Msg(fileName);
|
||||
print_Msg(F("..."));
|
||||
// Save location
|
||||
print_Msg(F("Saving to "));
|
||||
print_Msg(folder);
|
||||
println_Msg(F("/..."));
|
||||
display_Update();
|
||||
|
||||
// write new folder number back to eeprom
|
||||
foldern = foldern + 1;
|
||||
EEPROM_writeAnything(0, foldern);
|
||||
EEPROM_writeAnything(10, foldern);
|
||||
|
||||
//open file on sd card
|
||||
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
|
||||
@ -1315,25 +1304,21 @@ void readFLASH_GBA (boolean browseFile, unsigned long flashSize, uint32_t pos) {
|
||||
strcat(fileName, ".fla");
|
||||
|
||||
// create a new folder for the save file
|
||||
EEPROM_readAnything(0, foldern);
|
||||
EEPROM_readAnything(10, foldern);
|
||||
|
||||
sprintf(folder, "SAVE/%s/%d", romName, foldern);
|
||||
sprintf(folder, "GBA/SAVE/%s/%d", romName, foldern);
|
||||
sd.mkdir(folder, true);
|
||||
sd.chdir(folder);
|
||||
|
||||
// Signal end of process
|
||||
print_Msg(F("Reading to SAVE/"));
|
||||
print_Msg(romName);
|
||||
print_Msg(F("/"));
|
||||
print_Msg(foldern);
|
||||
print_Msg(F("/"));
|
||||
print_Msg(fileName);
|
||||
print_Msg(F("..."));
|
||||
// Save location
|
||||
print_Msg(F("Saving to "));
|
||||
print_Msg(folder);
|
||||
println_Msg(F("/..."));
|
||||
display_Update();
|
||||
|
||||
// write new folder number back to eeprom
|
||||
foldern = foldern + 1;
|
||||
EEPROM_writeAnything(0, foldern);
|
||||
EEPROM_writeAnything(10, foldern);
|
||||
}
|
||||
|
||||
//open file on sd card
|
||||
@ -1548,25 +1533,21 @@ void readEeprom_GBA(word eepSize) {
|
||||
strcat(fileName, ".eep");
|
||||
|
||||
// create a new folder for the save file
|
||||
EEPROM_readAnything(0, foldern);
|
||||
EEPROM_readAnything(10, foldern);
|
||||
|
||||
sprintf(folder, "SAVE/%s/%d", romName, foldern);
|
||||
sprintf(folder, "GBA/SAVE/%s/%d", romName, foldern);
|
||||
sd.mkdir(folder, true);
|
||||
sd.chdir(folder);
|
||||
|
||||
// Signal end of process
|
||||
print_Msg(F("Reading to SAVE/"));
|
||||
print_Msg(romName);
|
||||
print_Msg(F("/"));
|
||||
print_Msg(foldern);
|
||||
print_Msg(F("/"));
|
||||
print_Msg(fileName);
|
||||
print_Msg(F("..."));
|
||||
// Save location
|
||||
print_Msg(F("Saving to "));
|
||||
print_Msg(folder);
|
||||
println_Msg(F("/..."));
|
||||
display_Update();
|
||||
|
||||
// write new folder number back to eeprom
|
||||
foldern = foldern + 1;
|
||||
EEPROM_writeAnything(0, foldern);
|
||||
EEPROM_writeAnything(10, foldern);
|
||||
|
||||
//open file on sd card
|
||||
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
|
||||
|
@ -132,10 +132,6 @@ void n64CartMenu() {
|
||||
{
|
||||
case 0:
|
||||
sd.chdir("/");
|
||||
display_Clear();
|
||||
|
||||
println_Msg(F("Reading Rom..."));
|
||||
display_Update();
|
||||
readRom_N64();
|
||||
break;
|
||||
|
||||
@ -805,17 +801,19 @@ void readBlock(word myAddress) {
|
||||
void readMPK() {
|
||||
// Change to root
|
||||
sd.chdir("/");
|
||||
// Make MPK directory
|
||||
sd.mkdir("N64/MPK", true);
|
||||
// Change to MPK directory
|
||||
sd.chdir("MPK");
|
||||
sd.chdir("N64/MPK");
|
||||
|
||||
// Get name, add extension and convert to char array for sd lib
|
||||
EEPROM_readAnything(0, foldern);
|
||||
EEPROM_readAnything(10, foldern);
|
||||
sprintf(fileName, "%d", foldern);
|
||||
strcat(fileName, ".mpk");
|
||||
|
||||
// write new folder number back to eeprom
|
||||
foldern = foldern + 1;
|
||||
EEPROM_writeAnything(0, foldern);
|
||||
EEPROM_writeAnything(10, foldern);
|
||||
|
||||
//open file on sd card
|
||||
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
|
||||
@ -836,7 +834,7 @@ void readMPK() {
|
||||
}
|
||||
// Close the file:
|
||||
myFile.close();
|
||||
print_Msg(F("Saved as /MPK/"));
|
||||
print_Msg(F("Saved as N64/MPK/"));
|
||||
println_Msg(fileName);
|
||||
display_Update();
|
||||
}
|
||||
@ -1202,10 +1200,10 @@ void idCart() {
|
||||
// Get rom version
|
||||
romVersion = sdBuffer[0x3F];
|
||||
|
||||
// Get name in 8.3 compatible format
|
||||
// Get name
|
||||
byte myLength = 0;
|
||||
for (unsigned int i = 0; i < 20; i++) {
|
||||
if (((char(sdBuffer[0x20 + i]) >= 48 && char(sdBuffer[0x20 + i]) <= 57) || (char(sdBuffer[0x20 + i]) >= 65 && char(sdBuffer[0x20 + i]) <= 122)) && myLength < 8) {
|
||||
if (((char(sdBuffer[0x20 + i]) >= 48 && char(sdBuffer[0x20 + i]) <= 57) || (char(sdBuffer[0x20 + i]) >= 65 && char(sdBuffer[0x20 + i]) <= 122)) && myLength < 16) {
|
||||
romName[myLength] = char(sdBuffer[0x20 + i]);
|
||||
myLength++;
|
||||
}
|
||||
@ -1341,14 +1339,14 @@ void readEeprom() {
|
||||
strcat(fileName, ".eep");
|
||||
|
||||
// create a new folder for the save file
|
||||
EEPROM_readAnything(0, foldern);
|
||||
sprintf(folder, "SAVE/%s/%d", romName, foldern);
|
||||
EEPROM_readAnything(10, foldern);
|
||||
sprintf(folder, "N64/SAVE/%s/%d", romName, foldern);
|
||||
sd.mkdir(folder, true);
|
||||
sd.chdir(folder);
|
||||
|
||||
// write new folder number back to eeprom
|
||||
foldern = foldern + 1;
|
||||
EEPROM_writeAnything(0, foldern);
|
||||
EEPROM_writeAnything(10, foldern);
|
||||
|
||||
// Open file on sd card
|
||||
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
|
||||
@ -1386,12 +1384,11 @@ void readEeprom() {
|
||||
}
|
||||
// Close the file:
|
||||
myFile.close();
|
||||
print_Msg(F("Saved to SAVE/"));
|
||||
print_Msg(romName);
|
||||
print_Msg(F("/"));
|
||||
print_Msg(foldern - 1);
|
||||
print_Msg(F("/"));
|
||||
println_Msg(fileName);
|
||||
//clear the screen
|
||||
display_Clear();
|
||||
print_Msg(F("Saved to "));
|
||||
print_Msg(folder);
|
||||
println_Msg(F("/"));
|
||||
display_Update();
|
||||
}
|
||||
else {
|
||||
@ -1531,14 +1528,14 @@ void readSram(unsigned long sramSize, byte flashramType) {
|
||||
}
|
||||
|
||||
// create a new folder for the save file
|
||||
EEPROM_readAnything(0, foldern);
|
||||
sprintf(folder, "SAVE/%s/%d", romName, foldern);
|
||||
EEPROM_readAnything(10, foldern);
|
||||
sprintf(folder, "N64/SAVE/%s/%d", romName, foldern);
|
||||
sd.mkdir(folder, true);
|
||||
sd.chdir(folder);
|
||||
|
||||
// write new folder number back to eeprom
|
||||
foldern = foldern + 1;
|
||||
EEPROM_writeAnything(0, foldern);
|
||||
EEPROM_writeAnything(10, foldern);
|
||||
|
||||
// Open file on sd card
|
||||
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
|
||||
@ -1563,12 +1560,9 @@ void readSram(unsigned long sramSize, byte flashramType) {
|
||||
}
|
||||
// Close the file:
|
||||
myFile.close();
|
||||
print_Msg(F("Saved to SAVE/"));
|
||||
print_Msg(romName);
|
||||
print_Msg(F("/"));
|
||||
print_Msg(foldern - 1);
|
||||
print_Msg(F("/"));
|
||||
println_Msg(fileName);
|
||||
print_Msg(F("Saved to "));
|
||||
print_Msg(folder);
|
||||
println_Msg(F("/"));
|
||||
display_Update();
|
||||
}
|
||||
|
||||
@ -1932,14 +1926,20 @@ void readRom_N64() {
|
||||
strcat(fileName, ".Z64");
|
||||
|
||||
// create a new folder
|
||||
EEPROM_readAnything(0, foldern);
|
||||
sprintf(folder, "ROM/%s/%d", romName, foldern);
|
||||
EEPROM_readAnything(10, foldern);
|
||||
sprintf(folder, "N64/ROM/%s/%d", romName, foldern);
|
||||
sd.mkdir(folder, true);
|
||||
sd.chdir(folder);
|
||||
|
||||
display_Clear();
|
||||
print_Msg(F("Saving to "));
|
||||
print_Msg(folder);
|
||||
println_Msg(F("/..."));
|
||||
display_Update();
|
||||
|
||||
// write new folder number back to eeprom
|
||||
foldern = foldern + 1;
|
||||
EEPROM_writeAnything(0, foldern);
|
||||
EEPROM_writeAnything(10, foldern);
|
||||
|
||||
readn64rom:
|
||||
// Open file on sd card
|
||||
@ -1969,13 +1969,6 @@ readn64rom:
|
||||
}
|
||||
// Close the file:
|
||||
myFile.close();
|
||||
print_Msg(F("Saved to ROM/"));
|
||||
print_Msg(romName);
|
||||
print_Msg(F("/"));
|
||||
print_Msg(foldern - 1);
|
||||
print_Msg(F("/"));
|
||||
println_Msg(fileName);
|
||||
display_Update();
|
||||
|
||||
calcn64crc:
|
||||
// Calculate Checksum and convert to string
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -375,7 +375,7 @@ void getCartInfo_SNES() {
|
||||
}
|
||||
|
||||
display_Clear();
|
||||
print_Msg(F("Rom Name: "));
|
||||
print_Msg(F("Name: "));
|
||||
println_Msg(romName);
|
||||
|
||||
print_Msg(F("Type: "));
|
||||
@ -560,12 +560,12 @@ boolean checkcart_SNES() {
|
||||
//Check SD card for alt config
|
||||
checkAltConf();
|
||||
|
||||
// Dump name into 8.3 compatible format
|
||||
// Get name
|
||||
byte myByte = 0;
|
||||
byte myLength = 0;
|
||||
for (unsigned int i = 65472; i < 65492; i++) {
|
||||
myByte = readBank_SNES(0, i);
|
||||
if (((char(myByte) >= 48 && char(myByte) <= 57) || (char(myByte) >= 65 && char(myByte) <= 122)) && myLength < 8) {
|
||||
if (((char(myByte) >= 48 && char(myByte) <= 57) || (char(myByte) >= 65 && char(myByte) <= 122)) && myLength < 16) {
|
||||
romName[myLength] = char(myByte);
|
||||
myLength++;
|
||||
}
|
||||
@ -777,8 +777,8 @@ boolean compare_checksum() {
|
||||
strcat(fileName, ".sfc");
|
||||
|
||||
// last used rom folder
|
||||
EEPROM_readAnything(0, foldern);
|
||||
sprintf(folder, "ROM/%s/%d", romName, foldern - 1);
|
||||
EEPROM_readAnything(10, foldern);
|
||||
sprintf(folder, "SNES/ROM/%s/%d", romName, foldern - 1);
|
||||
|
||||
char calcsumStr[5];
|
||||
sprintf(calcsumStr, "%04X", calc_checksum(fileName, folder));
|
||||
@ -810,20 +810,21 @@ void readROM_SNES() {
|
||||
strcat(fileName, ".sfc");
|
||||
|
||||
// create a new folder for the save file
|
||||
EEPROM_readAnything(0, foldern);
|
||||
sprintf(folder, "ROM/%s/%d", romName, foldern);
|
||||
EEPROM_readAnything(10, foldern);
|
||||
sprintf(folder, "SNES/ROM/%s/%d", romName, foldern);
|
||||
sd.mkdir(folder, true);
|
||||
sd.chdir(folder);
|
||||
|
||||
//clear the screen
|
||||
display_Clear();
|
||||
println_Msg(F("Creating folder: "));
|
||||
println_Msg(folder);
|
||||
print_Msg(F("Saving to "));
|
||||
print_Msg(folder);
|
||||
println_Msg(F("/..."));
|
||||
display_Update();
|
||||
|
||||
// write new folder number back to eeprom
|
||||
foldern = foldern + 1;
|
||||
EEPROM_writeAnything(0, foldern);
|
||||
EEPROM_writeAnything(10, foldern);
|
||||
|
||||
//open file on sd card
|
||||
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
|
||||
@ -832,9 +833,6 @@ void readROM_SNES() {
|
||||
|
||||
// Check if LoROM or HiROM...
|
||||
if (romType == LO) {
|
||||
println_Msg(F("Dumping LoRom..."));
|
||||
display_Update();
|
||||
|
||||
// Read up to 96 banks starting at bank 0×00.
|
||||
for (int currBank = 0; currBank < numBanks; currBank++) {
|
||||
// Dump the bytes to SD 512B at a time
|
||||
@ -848,9 +846,6 @@ void readROM_SNES() {
|
||||
}
|
||||
// Dump High-type ROM
|
||||
else if (((romType == HI) || (romType == SA) || (romType == EX)) && (romChips != 69)) {
|
||||
println_Msg(F("Dumping HiRom..."));
|
||||
display_Update();
|
||||
|
||||
for (int currBank = 192; currBank < (numBanks + 192); currBank++) {
|
||||
for (long currByte = 0; currByte < 65536; currByte += 512) {
|
||||
for (int c = 0; c < 512; c++) {
|
||||
@ -862,9 +857,6 @@ void readROM_SNES() {
|
||||
}
|
||||
// Dump SDD1 High-type ROM
|
||||
else if ((romType == HI) && (romChips == 69)) {
|
||||
println_Msg(F("Dumping SDD1 HiRom..."));
|
||||
display_Update();
|
||||
|
||||
controlIn_SNES();
|
||||
byte initialSOMap = readBank_SNES(0, 18439);
|
||||
|
||||
@ -898,10 +890,6 @@ void readROM_SNES() {
|
||||
}
|
||||
// Close the file:
|
||||
myFile.close();
|
||||
|
||||
// Signal end of process
|
||||
print_Msg(F("Saved as "));
|
||||
println_Msg(fileName);
|
||||
}
|
||||
|
||||
/******************************************
|
||||
@ -1044,24 +1032,14 @@ void readSRAM () {
|
||||
strcat(fileName, ".srm");
|
||||
|
||||
// create a new folder for the save file
|
||||
EEPROM_readAnything(0, foldern);
|
||||
sprintf(folder, "SAVE/%s/%d", romName, foldern);
|
||||
EEPROM_readAnything(10, foldern);
|
||||
sprintf(folder, "SNES/SAVE/%s/%d", romName, foldern);
|
||||
sd.mkdir(folder, true);
|
||||
sd.chdir(folder);
|
||||
|
||||
// Signal end of process
|
||||
print_Msg(F("Reading to SAVE/"));
|
||||
print_Msg(romName);
|
||||
print_Msg(F("/"));
|
||||
print_Msg(foldern);
|
||||
print_Msg(F("/"));
|
||||
print_Msg(fileName);
|
||||
print_Msg(F("..."));
|
||||
display_Update();
|
||||
|
||||
// write new folder number back to eeprom
|
||||
foldern = foldern + 1;
|
||||
EEPROM_writeAnything(0, foldern);
|
||||
EEPROM_writeAnything(10, foldern);
|
||||
|
||||
//open file on sd card
|
||||
if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
|
||||
@ -1106,7 +1084,10 @@ void readSRAM () {
|
||||
myFile.close();
|
||||
|
||||
// Signal end of process
|
||||
println_Msg(F("Done"));
|
||||
display_Clear();
|
||||
print_Msg(F("Saved to "));
|
||||
print_Msg(folder);
|
||||
println_Msg(F("/..."));
|
||||
display_Update();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user