Change temp stack variable that holds full ROM path from fixed char array to std::string. This will allow for larger file paths.
This commit is contained in:
parent
c837c8981c
commit
210069b78a
25
src/fceu.cpp
25
src/fceu.cpp
|
@ -421,7 +421,7 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen
|
||||||
//----------
|
//----------
|
||||||
//attempt to open the files
|
//attempt to open the files
|
||||||
FCEUFILE *fp;
|
FCEUFILE *fp;
|
||||||
char fullname[2048]; // this name contains both archive name and ROM file name
|
std::string fullname; // this name contains both archive name and ROM file name
|
||||||
int lastpal = PAL;
|
int lastpal = PAL;
|
||||||
int lastdendy = dendy;
|
int lastdendy = dendy;
|
||||||
|
|
||||||
|
@ -443,16 +443,19 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen
|
||||||
}
|
}
|
||||||
else if (fp->archiveFilename != "")
|
else if (fp->archiveFilename != "")
|
||||||
{
|
{
|
||||||
strcpy(fullname, fp->archiveFilename.c_str());
|
fullname.assign(fp->archiveFilename.c_str());
|
||||||
strcat(fullname, "|");
|
fullname.append("|");
|
||||||
strcat(fullname, fp->filename.c_str());
|
fullname.append(fp->filename.c_str());
|
||||||
} else
|
}
|
||||||
strcpy(fullname, name);
|
else
|
||||||
|
{
|
||||||
|
fullname.assign(name);
|
||||||
|
}
|
||||||
|
|
||||||
// reset loaded game BEFORE it's loading.
|
// reset loaded game BEFORE it's loading.
|
||||||
ResetGameLoaded();
|
ResetGameLoaded();
|
||||||
//file opened ok. start loading.
|
//file opened ok. start loading.
|
||||||
FCEU_printf("Loading %s...\n\n", fullname);
|
FCEU_printf("Loading %s...\n\n", fullname.c_str());
|
||||||
GetFileBase(fp->filename.c_str());
|
GetFileBase(fp->filename.c_str());
|
||||||
//reset parameters so they're cleared just in case a format's loader doesn't know to do the clearing
|
//reset parameters so they're cleared just in case a format's loader doesn't know to do the clearing
|
||||||
MasterRomInfoParams = TMasterRomInfoParams();
|
MasterRomInfoParams = TMasterRomInfoParams();
|
||||||
|
@ -484,16 +487,16 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen
|
||||||
bool FCEUXLoad(const char *name, FCEUFILE * fp);
|
bool FCEUXLoad(const char *name, FCEUFILE * fp);
|
||||||
|
|
||||||
int load_result;
|
int load_result;
|
||||||
load_result = iNESLoad(fullname, fp, OverwriteVidMode);
|
load_result = iNESLoad(fullname.c_str(), fp, OverwriteVidMode);
|
||||||
if (load_result == LOADER_INVALID_FORMAT)
|
if (load_result == LOADER_INVALID_FORMAT)
|
||||||
{
|
{
|
||||||
load_result = NSFLoad(fullname, fp);
|
load_result = NSFLoad(fullname.c_str(), fp);
|
||||||
if (load_result == LOADER_INVALID_FORMAT)
|
if (load_result == LOADER_INVALID_FORMAT)
|
||||||
{
|
{
|
||||||
load_result = UNIFLoad(fullname, fp);
|
load_result = UNIFLoad(fullname.c_str(), fp);
|
||||||
if (load_result == LOADER_INVALID_FORMAT)
|
if (load_result == LOADER_INVALID_FORMAT)
|
||||||
{
|
{
|
||||||
load_result = FDSLoad(fullname, fp);
|
load_result = FDSLoad(fullname.c_str(), fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue