mirror of
https://github.com/libretro/nestopia.git
synced 2025-10-14 10:38:47 +08:00
NstCartridgeInes: Improve iNES header parsing for official releases
This commit is contained in:
@@ -188,7 +188,7 @@ namespace Nes
|
||||
// This might be a VC/NES Remix game, seek to end of container and re-read header
|
||||
stream.Seek(32);
|
||||
stream.Read( header );
|
||||
result = ReadHeader( setup, header, 16, 0x00 );
|
||||
result = ReadHeader( setup, header, 16, false );
|
||||
|
||||
if (NES_FAILED(result))
|
||||
throw RESULT_ERR_CORRUPT_FILE;
|
||||
@@ -622,7 +622,7 @@ namespace Nes
|
||||
loader.Load();
|
||||
}
|
||||
|
||||
Result Cartridge::Ines::ReadHeader(Header& setup,const byte* const file,const ulong length,const byte lbyte)
|
||||
Result Cartridge::Ines::ReadHeader(Header& setup,const byte* const file,const ulong length,const bool lbyte)
|
||||
{
|
||||
if (file == NULL)
|
||||
return RESULT_ERR_INVALID_PARAM;
|
||||
@@ -633,7 +633,7 @@ namespace Nes
|
||||
file[0] != Ascii<'N'>::V ||
|
||||
file[1] != Ascii<'E'>::V ||
|
||||
file[2] != Ascii<'S'>::V ||
|
||||
(file[3] != 0x1A && file[3] != lbyte)
|
||||
(file[3] != 0x1A && lbyte) // Last byte may be ignored for "official" ROMs
|
||||
)
|
||||
return RESULT_ERR_INVALID_FILE;
|
||||
|
||||
|
@@ -55,7 +55,7 @@ namespace Nes
|
||||
const ImageDatabase*
|
||||
);
|
||||
|
||||
static Result ReadHeader(Header&,const byte*,ulong,const byte=0x1A);
|
||||
static Result ReadHeader(Header&,const byte*,ulong,const bool=true);
|
||||
static Result WriteHeader(const Header&,byte*,ulong);
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user