Don't crash when a block device can't be created.

This commit is contained in:
Unknown W. Brackets 2013-07-01 00:33:19 -07:00
parent 7c681973f5
commit c8102b708a

View File

@ -44,7 +44,11 @@
// to determine if the emulator should enable extra memory and
// double-sized texture coordinates.
void InitMemoryForGameISO(std::string fileToStart) {
ISOFileSystem *umd2 = new ISOFileSystem(&pspFileSystem, constructBlockDevice(fileToStart.c_str()));
auto bd = constructBlockDevice(fileToStart.c_str());
// Can't init anything without a block device...
if (!bd)
return;
ISOFileSystem *umd2 = new ISOFileSystem(&pspFileSystem, bd);
// Parse PARAM.SFO
@ -174,11 +178,14 @@ bool Load_PSP_ELF_PBP(const char *filename, std::string *error_string)
// This is really just for headless, might need tweaking later.
if (!PSP_CoreParameter().mountIso.empty())
{
ISOFileSystem *umd2 = new ISOFileSystem(&pspFileSystem, constructBlockDevice(PSP_CoreParameter().mountIso.c_str()));
auto bd = constructBlockDevice(PSP_CoreParameter().mountIso.c_str());
if (bd != NULL) {
ISOFileSystem *umd2 = new ISOFileSystem(&pspFileSystem, bd);
pspFileSystem.Mount("umd1:", umd2);
pspFileSystem.Mount("disc0:", umd2);
pspFileSystem.Mount("umd:", umd2);
pspFileSystem.Mount("umd1:", umd2);
pspFileSystem.Mount("disc0:", umd2);
pspFileSystem.Mount("umd:", umd2);
}
}
std::string full_path = filename;