Merge pull request #537 from colton5007/patch-1

Fixed GBA SRAMPath in posix CLI
This commit is contained in:
zeromus 2022-05-29 02:45:25 -04:00 committed by GitHub
commit 416b08d6f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 5 deletions

View File

@ -388,11 +388,10 @@ int main(int argc, char ** argv) {
//set the GBA rom and sav paths //set the GBA rom and sav paths
GBACartridge_RomPath = my_config.gbaslot_rom.c_str(); GBACartridge_RomPath = my_config.gbaslot_rom.c_str();
if(toupper(strright(GBACartridge_RomPath,4)) == ".GBA") // finds the index of the file extension separator
GBACartridge_SRAMPath = strright(GBACartridge_RomPath,4) + ".sav"; int RomPath_ExtIdx = GBACartridge_RomPath.find_last_of(".");
else // checks if file has extension, if so replaces extension with .sav for SRAM Path, otherwise append .sav
//what to do? lets just do the same thing for now GBACartridge_SRAMPath = GBACartridge_RomPath.substr(0, RomPath_ExtIdx) + ".sav";
GBACartridge_SRAMPath = strright(GBACartridge_RomPath,4) + ".sav";
// Check if the file exists and can be opened // Check if the file exists and can be opened
FILE * test = fopen(GBACartridge_RomPath.c_str(), "rb"); FILE * test = fopen(GBACartridge_RomPath.c_str(), "rb");