mirror of
https://github.com/0ldsk00l/nestopia.git
synced 2025-04-02 10:31:51 -04:00
Sync with upstream repo at commit c7bb0a6
This commit is contained in:
parent
fc8bcee4b1
commit
881592c3d5
5 changed files with 41 additions and 5 deletions
|
@ -89,6 +89,27 @@ namespace Nes
|
|||
);
|
||||
break;
|
||||
|
||||
case 0x0000:
|
||||
// Check for VC/NES Remix container for cartridge-based games
|
||||
// Just load the game for now, until more is known about the container format.
|
||||
//if (((Stream::In(&context.stream).Peek64() >> 32) & 0xFF) & 0x60)
|
||||
//{
|
||||
Ines::Load
|
||||
(
|
||||
context.stream,
|
||||
context.patch,
|
||||
context.patchBypassChecksum,
|
||||
context.patchResult,
|
||||
prg,
|
||||
chr,
|
||||
context.favoredSystem,
|
||||
profile,
|
||||
profileEx,
|
||||
context.database
|
||||
);
|
||||
//}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
Romset::Load
|
||||
|
|
|
@ -184,8 +184,15 @@ namespace Nes
|
|||
|
||||
Result result = ReadHeader( setup, header, 16 );
|
||||
|
||||
if (NES_FAILED(result))
|
||||
throw RESULT_ERR_CORRUPT_FILE;
|
||||
if (NES_FAILED(result)) {
|
||||
// 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, false );
|
||||
|
||||
if (NES_FAILED(result))
|
||||
throw RESULT_ERR_CORRUPT_FILE;
|
||||
}
|
||||
|
||||
Log log;
|
||||
|
||||
|
@ -615,7 +622,7 @@ namespace Nes
|
|||
loader.Load();
|
||||
}
|
||||
|
||||
Result Cartridge::Ines::ReadHeader(Header& setup,const byte* const file,const ulong length)
|
||||
Result Cartridge::Ines::ReadHeader(Header& setup,const byte* const file,const ulong length,const bool lbyte)
|
||||
{
|
||||
if (file == NULL)
|
||||
return RESULT_ERR_INVALID_PARAM;
|
||||
|
@ -626,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] != 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);
|
||||
static Result ReadHeader(Header&,const byte*,ulong,const bool=true);
|
||||
static Result WriteHeader(const Header&,byte*,ulong);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -273,6 +273,13 @@ namespace Nes
|
|||
return data;
|
||||
}
|
||||
|
||||
qaword In::Peek64()
|
||||
{
|
||||
const qaword data = Read64();
|
||||
Seek( -8 );
|
||||
return data;
|
||||
}
|
||||
|
||||
void In::Peek(byte* data,dword length)
|
||||
{
|
||||
Read( data, length );
|
||||
|
|
|
@ -73,6 +73,7 @@ namespace Nes
|
|||
uint Peek8();
|
||||
uint Peek16();
|
||||
dword Peek32();
|
||||
qaword Peek64();
|
||||
void Seek(idword);
|
||||
ulong Length();
|
||||
bool Eof();
|
||||
|
|
Loading…
Add table
Reference in a new issue