mirror of https://github.com/stella-emu/stella.git
fixed #1053
This commit is contained in:
parent
9b0c8c18de
commit
34e4439729
|
@ -827,9 +827,19 @@ ByteBuffer OSystem::openROM(const FSNode& rom, size_t& size,
|
|||
// Next check for a proper file size
|
||||
// Streaming ROMs read only a portion of the file
|
||||
// Otherwise the size to read is 0 (meaning read the entire file)
|
||||
const size_t sizeToRead = CartDetector::isProbablyMVC(rom);
|
||||
size_t sizeToRead = 0;
|
||||
try
|
||||
{
|
||||
sizeToRead = CartDetector::isProbablyMVC(rom);
|
||||
}
|
||||
catch(const runtime_error&)
|
||||
{
|
||||
if(showErrorMessage)
|
||||
throw runtime_error("File not found/readable");
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
const bool isStreaming = sizeToRead > 0;
|
||||
|
||||
// Make sure we only read up to the maximum supported cart size
|
||||
const bool isValidSize = isValidROM && (isStreaming ||
|
||||
rom.getSize() <= Cartridge::maxSize());
|
||||
|
|
Loading…
Reference in New Issue