mirror of https://github.com/stella-emu/stella.git
Updated FA2 autodetection for Harmony ROMs (29/32K). Basically these
are detected and the ARM code discarded. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2616 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
4610fd608d
commit
b6ec874778
|
@ -44,6 +44,9 @@
|
|||
support, as well as 'virtual' formats (such as showing the list
|
||||
of files for 2in1/4in1/8in1/etc within the UI).
|
||||
|
||||
* Improved bankswitch autodetection for FA2 ROMs; 29K and 32K versions
|
||||
(meant for Harmony cart) are now recognized.
|
||||
|
||||
* Improved bankswitch autodetection for X07 ROMs (although there's only
|
||||
two known ROMs in existence, so the detection probably isn't robust).
|
||||
|
||||
|
|
|
@ -430,7 +430,12 @@ string Cartridge::autodetectType(const uInt8* image, uInt32 size)
|
|||
}
|
||||
else if(size == 29*1024) // 29K
|
||||
{
|
||||
type = "DPC+";
|
||||
if(isProbablyDPCplus(image, size))
|
||||
type = "DPC+";
|
||||
else if(isProbablyARM(image, size))
|
||||
type = "FA2";
|
||||
else
|
||||
type = "4K"; // probably a bad ROM
|
||||
}
|
||||
else if(size == 32*1024) // 32K
|
||||
{
|
||||
|
@ -444,6 +449,8 @@ string Cartridge::autodetectType(const uInt8* image, uInt32 size)
|
|||
type = "DPC+";
|
||||
else if(isProbablyCTY(image, size))
|
||||
type = "CTY";
|
||||
else if(isProbablyFA2(image, size))
|
||||
type = "FA2";
|
||||
else
|
||||
type = "F4";
|
||||
}
|
||||
|
@ -544,6 +551,21 @@ bool Cartridge::isProbablySC(const uInt8* image, uInt32 size)
|
|||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge::isProbablyARM(const uInt8* image, uInt32 size)
|
||||
{
|
||||
// ARM code contains the following 'loader' patterns in the first 1K
|
||||
// Thanks to Thomas Jentzsch of AtariAge for this advice
|
||||
uInt8 signature[2][4] = {
|
||||
{ 0xA0, 0xC1, 0x1F, 0xE0 },
|
||||
{ 0x00, 0x80, 0x02, 0xE0 }
|
||||
};
|
||||
if(searchForBytes(image, 1024, signature[0], 4, 1))
|
||||
return true;
|
||||
else
|
||||
return searchForBytes(image, 1024, signature[1], 4, 1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge::isProbably0840(const uInt8* image, uInt32 size)
|
||||
{
|
||||
|
@ -707,6 +729,21 @@ bool Cartridge::isProbablyEF(const uInt8* image, uInt32 size)
|
|||
return false;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge::isProbablyFA2(const uInt8* image, uInt32 size)
|
||||
{
|
||||
// This currently tests only the 32K version of FA2; the 24 and 28K
|
||||
// versions are easy, in that they're the only possibility with those
|
||||
// file sizes
|
||||
|
||||
// 32K version has all zeros in 29K-32K area
|
||||
for(uInt32 i = 29*1024; i < 32*1024; ++i)
|
||||
if(image[i] != 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge::isProbablyFE(const uInt8* image, uInt32 size)
|
||||
{
|
||||
|
|
|
@ -271,6 +271,11 @@ class Cartridge : public Device
|
|||
*/
|
||||
static bool isProbablySC(const uInt8* image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image probably contains ARM code in the first 1K
|
||||
*/
|
||||
static bool isProbablyARM(const uInt8* image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a 0840 bankswitching cartridge
|
||||
*/
|
||||
|
@ -326,6 +331,11 @@ class Cartridge : public Device
|
|||
*/
|
||||
static bool isProbablyF6(const uInt8* image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably an FA2 bankswitching cartridge
|
||||
*/
|
||||
static bool isProbablyFA2(const uInt8* image, uInt32 size);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably an FE bankswitching cartridge
|
||||
*/
|
||||
|
|
|
@ -32,6 +32,13 @@ CartridgeFA2::CartridgeFA2(const uInt8* image, uInt32 size, const OSystem& osyst
|
|||
myRamAccessTimeout(0),
|
||||
mySize(size)
|
||||
{
|
||||
// 29/32K version of FA2 has valid data @ 1K - 29K
|
||||
if(size >= 29 * 1024)
|
||||
{
|
||||
image += 1024;
|
||||
mySize = 28 * 1024;
|
||||
}
|
||||
|
||||
// Allocate array for the ROM image
|
||||
myImage = new uInt8[mySize];
|
||||
|
||||
|
|
Loading…
Reference in New Issue