Add database for common available titles

This commit is contained in:
negativeExponent 2019-12-25 11:13:14 +08:00
parent 12db71df06
commit 8254289c35
3 changed files with 147 additions and 14 deletions

View File

@ -54,6 +54,117 @@
#include "../../scrc32.h"
#include "../mednafen-endian.h"
static LYNX_DB lynxDB[] = {
{ 0x540e9bb7, "Alien vs Predator (USA) (Proto) (1993-12-17)", 262144, 0, 0 },
{ 0xf6fb48fb, "A.P.B. (USA, Europe)", 262144, 0, 0 },
{ 0x0483cd2a, "Awesome Golf (USA, Europe)", 262144, 0, 0 },
{ 0x3943c116, "Baseball Heroes (USA, Europe)", 262144, 0, 0 },
{ 0x4161bb4a, "Basketbrawl (USA, Europe)", 131072, 0, 0 },
{ 0x277f82c2, "Batman Returns (USA, Europe)", 262144, 0, 0 },
{ 0x779faece, "Battle Wheels (USA, Europe)", 131072, 0, 0 },
{ 0x30fee726, "Battlezone 2000 (USA, Europe)", 262144, 0, 0 },
{ 0x143a313e, "Bill & Ted's Excellent Adventure (USA, Europe)", 262144, 0, 0 },
{ 0x0d973c9d, "[BIOS] Atari Lynx (USA, Europe)", 512, 0, 0 },
{ 0x3cd75df3, "Block Out (USA, Europe)", 131072, 0, 0 },
{ 0xdaf587b1, "Blue Lightning (USA, Europe)", 131072, 0, 0 },
{ 0xbfe36525, "Blue Lightning (USA, Europe) (Demo)", 131072, 0, 0 },
{ 0x333daece, "Bubble Trouble (USA, Europe)", 262144, 0, 0 },
{ 0xa08f0b59, "California Games (USA, Europe)", 131072, 0, 0 },
{ 0x97501709, "Centipede (USA) (Proto)", 131072, CART_ROTATE_LEFT, 0 },
{ 0x19c5a7a5, "Checkered Flag (USA, Europe)", 262144, 0, 0 },
{ 0x6a5f53ed, "Chip's Challenge (USA, Europe)", 131072, 0, 0 },
{ 0xaec474c8, "Crystal Mines II (USA, Europe)", 131072, 0, 0 },
{ 0x99729395, "Daemonsgate (USA) (Proto)", 262144, 0, 0 },
{ 0xb9ac1fe5, "Desert Strike - Return to the Gulf (USA, Europe)", 262144, 0, 0 },
{ 0x50386cfa, "Dinolympics (USA, Europe)", 262144, 0, 0 },
{ 0xd565fbb7, "Dirty Larry - Renegade Cop (USA, Europe)", 262144, 0, 0 },
{ 0xfbfc0f05, "Double Dragon (USA, Europe)", 262144, 0, 0 },
{ 0x33bb74c7, "Dracula the Undead (USA, Europe)", 262144, 0, 0 },
{ 0xbd97116b, "Electrocop (USA, Europe)", 131072, 0, 0 },
{ 0xf83397f9, "European Soccer Challenge (USA, Europe)", 131072, 0, 0 },
{ 0x6bceaa9c, "Eye of the Beholder (USA) (Proto)", 131072, 0, 0 },
{ 0x9034ee27, "Fat Bobby (USA, Europe)", 262144, 0, 0 },
{ 0x7e4b5945, "Fidelity Ultimate Chess Challenge, The (USA, Europe)", 131072, 0, 0 },
{ 0x494cc568, "Gates of Zendocon (USA, Europe)", 131072, 0, 0 },
{ 0xac564baa, "Gauntlet - The Third Encounter (1990) [o1]", 262144, CART_ROTATE_RIGHT, 0 },
{ 0x7f0ec7ad, "Gauntlet - The Third Encounter (USA, Europe)", 131072, CART_ROTATE_RIGHT, 0 },
{ 0xd20a85fc, "Gordo 106 (USA, Europe)", 262144, 0, 0 },
{ 0x6df63834, "Hard Drivin' (USA, Europe)", 131072, 0, 0 },
{ 0xe8b45707, "Hockey (USA, Europe)", 262144, 0, 0 },
{ 0xe3041c6c, "Hydra (USA, Europe)", 262144, 0, 0 },
{ 0x5cf8bbf0, "Ishido - The Way of Stones (USA, Europe)", 131072, 0, 0 },
{ 0x2455b6cf, "Jimmy Connors' Tennis (USA, Europe)", 524288, 0, 0 },
{ 0x5dba792a, "Joust (USA, Europe)", 131072, 0, 0 },
{ 0xa53649f1, "Klax (USA, Europe)", 262144, CART_ROTATE_LEFT, 0 },
{ 0xbed5ba2b, "Krazy Ace - Miniature Golf (USA, Europe)", 262144, 0, 0 },
{ 0xcd1bd405, "Kung Food (USA, Europe)", 262144, 0, 0 },
{ 0x39b9b8cc, "Lemmings (USA, Europe)", 262144, 0, 0 },
{ 0x0271b6e9, "Lexis (USA)", 262144, CART_ROTATE_LEFT, 0 },
{ 0xb1c25ef1, "Loopz (USA) (Proto)", 262144, 0, 0 },
{ 0x1091a268, "Lynx Casino (USA, Europe)", 262144, 0, 0 },
{ 0x28ada019, "Lynx II Production Test Program (USA) (v0.02) (Proto)", 262144, 0, 0 },
{ 0xaba6da3d, "Malibu Bikini Volleyball (USA, Europe)", 262144, 0, 0 },
{ 0xc3fa0d4d, "Marlboro Go! (Europe) (Proto)", 262144, 0, 0 },
{ 0x7de3783a, "Ms. Pac-Man (USA, Europe)", 131072, 0, 0 },
{ 0x006fd398, "NFL Football (USA, Europe)", 262144, CART_ROTATE_LEFT, 0 },
{ 0xf3e3f811, "Ninja Gaiden III - The Ancient Ship of Doom (USA, Europe)", 524288, 0, 0 },
{ 0x22d47d51, "Ninja Gaiden (USA, Europe)", 262144, 0, 0 },
{ 0xaa50dd22, "Pac-Land (USA, Europe)", 131072, 0, 0 },
{ 0x4cdfbd57, "Paperboy (USA, Europe)", 131072, 0, 0 },
{ 0x14d38ca7, "Pinball Jam (USA, Europe)", 262144, 0, 0 },
{ 0x2393135f, "Pit-Fighter (USA, Europe)", 524288, 0, 0 },
{ 0x99c42034, "Power Factor (USA, Europe)", 262144, 0, 0 },
{ 0xb9881423, "QIX (USA, Europe)", 131072, 0, 0 },
{ 0xbcd10c3a, "Raiden (USA) (v3.0) (Beta)", 262144, CART_ROTATE_LEFT, 0 },
{ 0xb10b7c8e, "Rampage (USA, Europe)", 262144, 0, 0 },
{ 0x139f301d, "Rampart (USA, Europe)", 262144, 0, 0 },
{ 0x6867e80c, "RoadBlasters (USA, Europe)", 262144, 0, 0 },
{ 0x69959a3b, "Road Riot 4WD (USA) (Proto 3)", 262144, 0, 0 },
{ 0xd1dff2b2, "Robo-Squash (USA, Europe)", 131072, 0, 0 },
{ 0x7a6049b5, "Robotron 2084 (USA, Europe)", 131072, 0, 0 },
{ 0x67e5bdba, "Rygar (USA, Europe)", 262144, 0, 0 },
{ 0xbe166f3b, "Scrapyard Dog (USA, Europe)", 262144, 0, 0 },
{ 0xeb78baa3, "Shadow of the Beast (USA, Europe)", 262144, 0, 0 },
{ 0x192bcd04, "Shanghai (USA, Europe)", 131072, 0, 0 },
{ 0x5b2308ed, "Steel Talons (USA, Europe)", 262144, 0, 0 },
{ 0x8595c40b, "S.T.U.N. Runner (USA, Europe)", 262144, 0, 0 },
{ 0x2da7e2a8, "Super Asteroids, Missile Command (USA, Europe)", 131072, 0, 0 },
{ 0x690caeb0, "Super Off-Road (USA, Europe)", 262144, 0, 0 },
{ 0xdfa61571, "Super Skweek (USA, Europe)", 262144, 0, 0 },
{ 0x13657705, "Switchblade II (USA, Europe)", 262144, 0, 0 },
{ 0xae267e29, "Todd's Adventures in Slime World (USA, Europe)", 131072, 0, 0 },
{ 0x156a4a4c, "Toki (USA, Europe)", 262144, 0, 0 },
{ 0x0590a9e3, "Tournament Cyberball (USA, Europe)", 262144, 0, 0 },
{ 0xa4b924d6, "Turbo Sub (USA, Europe)", 131072, 0, 0 },
{ 0x8d56828b, "Viking Child (USA, Europe)", 262144, 0, 0 },
{ 0xb946ba49, "Warbirds (USA, Europe)", 131072, 0, 0 },
{ 0x91233794, "World Class Soccer (USA, Europe)", 262144, 0, 0 },
{ 0x9bed736d, "Xenophobe (USA, Europe)", 131072, 0, 0 },
{ 0x89e2a595, "Xybots (USA, Europe)", 262144, 0, 0 },
{ 0xcb27199d, "Zarlor Mercenary (USA, Europe)", 131072, 0, 0 },
{ 0, NULL, 0, 0, 0 },
};
LYNX_DB CCart::CheckHash(const uint32 crc32)
{
LYNX_DB ret = {};
unsigned i = 0;
found = false;
while (lynxDB[i].crc32 != 0)
{
if (lynxDB[i].crc32 == crc32)
{
found = true;
ret = lynxDB[i];
break;
}
i++;
}
return ret;
}
LYNX_HEADER CCart::DecodeHeader(const uint8 *data)
{
LYNX_HEADER header;
@ -101,6 +212,7 @@ CCart::CCart(MDFNFILE *fp)
uint64 gamesize;
uint8 raw_header[HEADER_RAW_SIZE];
LYNX_HEADER header;
uint32 header_size = HEADER_RAW_SIZE;;
uint32 loop;
mWriteEnableBank0=false;
@ -118,6 +230,7 @@ CCart::CCart(MDFNFILE *fp)
// Sanity checks on the header
if(header.magic[0]!= 'L' || header.magic[1]!='Y' || header.magic[2]!='N' || header.magic[3]!='X' || header.version!=1)
{
header_size = 0;
file_seek(fp, 0, SEEK_SET);
memset(&header, 0, HEADER_RAW_SIZE);
strncpy((char*)&header.cartname, "NO HEADER", 32);
@ -146,11 +259,22 @@ CCart::CCart(MDFNFILE *fp)
InfoROMSize = gamesize;
// Setup name & manufacturer
strncpy(mName,(char*)&header.cartname, 32);
strncpy(mManufacturer,(char*)&header.manufname, 16);
// Calculate checksum and check database for rom entries
mCRC32 = crc32(0, GET_FDATA_PTR(fp) + header_size, gamesize);
LYNX_DB db = CheckHash(mCRC32);
if (found)
{
MDFN_printf("Found lynx rom in database.\n");
MDFN_printf("Title: %s.\n", db.name);
header.page_size_bank0 = db.filesize >> 8;
header.rotation = db.rotation;
}
MDFN_printf("Name: %s\n", mName);
// Setup name & manufacturer
strncpy(mName, (char *)&header.cartname, 32);
strncpy(mManufacturer, (char *)&header.manufname, 16);
MDFN_printf("Cart Name: %s\n", mName);
MDFN_printf("Manufacturer: %s\n", mManufacturer);
// Setup rotation
@ -252,7 +376,6 @@ CCart::CCart(MDFNFILE *fp)
// Read in the BANK0 bytes
mCRC32 = 0;
md5_context md5;
md5.starts();
@ -260,7 +383,6 @@ CCart::CCart(MDFNFILE *fp)
{
uint64 size = std::min<uint64>(gamesize, mMaskBank0 + 1);
file_read(fp, mCartBank0, size, 1);
mCRC32 = crc32(0, mCartBank0, size);
md5.update(mCartBank0, size);
gamesize -= size;
}
@ -270,7 +392,6 @@ CCart::CCart(MDFNFILE *fp)
{
uint64 size = std::min<uint64>(gamesize, mMaskBank0 + 1);
file_read(fp, mCartBank1, size, 1);
mCRC32 = crc32(mCRC32, mCartBank1, size);
md5.update(mCartBank1, size);
}

View File

@ -65,6 +65,15 @@ struct LYNX_HEADER
uint8 spare[5];
};
struct LYNX_DB
{
uint32 crc32;
char name[100];
uint32 filesize;
uint32 rotation;
uint32 reserved;
};
class CCart : public CLynxBase
{
@ -136,7 +145,10 @@ class CCart : public CLynxBase
uint32 mCountMask1;
uint32 mCRC32;
int8 last_strobe;
int8 last_strobe;
bool found;
LYNX_DB CheckHash(const uint32 crc32);
};
#endif

View File

@ -233,16 +233,16 @@ void Load(MDFNFILE *fp)
if(lynxie->mRam->InfoRAMSize)
{
memcpy(MDFNGameInfo->MD5, lynxie->mRam->MD5, 16);
MDFN_printf(_("RAM: %u bytes\n"), lynxie->mRam->InfoRAMSize);
MDFN_printf(_("CRC32: 0x%08x\n"), lynxie->mRam->CRC32());
MDFN_printf(_("RAM MD5: 0x%s\n"), md5_context::asciistr(MDFNGameInfo->MD5, 0).c_str());
MDFN_printf(_("RAM: %u bytes\n"), lynxie->mRam->InfoRAMSize);
MDFN_printf(_("CRC32: 0x%08x\n"), lynxie->mRam->CRC32());
MDFN_printf(_("RAM MD5: 0x%s\n"), md5_context::asciistr(MDFNGameInfo->MD5, 0).c_str());
}
else
{
memcpy(MDFNGameInfo->MD5, lynxie->mCart->MD5, 16);
MDFN_printf(_("ROM: %dKiB\n"), (lynxie->mCart->InfoROMSize + 1023) / 1024);
MDFN_printf(_("CRC32: 0x%08x\n"), lynxie->mCart->CRC32());
MDFN_printf(_("ROM MD5: 0x%s\n"), md5_context::asciistr(MDFNGameInfo->MD5, 0).c_str());
MDFN_printf(_("ROM: %dKiB\n"), (lynxie->mCart->InfoROMSize + 1023) / 1024);
MDFN_printf(_("CRC32: 0x%08x\n"), lynxie->mCart->CRC32());
MDFN_printf(_("ROM MD5: 0x%s\n"), md5_context::asciistr(MDFNGameInfo->MD5, 0).c_str());
}
MDFNGameInfo->fps = (uint32)(59.8 * 65536 * 256);