From 301926ebfcd444881e7aa41d6ed94834a2206233 Mon Sep 17 00:00:00 2001 From: adavie Date: Tue, 29 Jul 2014 13:25:23 +0000 Subject: [PATCH] Implemented autodetect for DASH scheme. Requires 'TJAD' to be present in ROM. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2965 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/emucore/Cart.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/emucore/Cart.cxx b/src/emucore/Cart.cxx index bd13d4c27..7662ae786 100644 --- a/src/emucore/Cart.cxx +++ b/src/emucore/Cart.cxx @@ -518,6 +518,10 @@ string Cartridge::autodetectType(const uInt8* image, uInt32 size) type = "4K"; // Most common bankswitching type } + // Because it's a variable size ROM format, DASH check is independent of image size and comes last + if(isProbablyDASH(image, size)) + type = "DASH"; + return type; } @@ -688,7 +692,9 @@ bool Cartridge::isProbablyCV(const uInt8* image, uInt32 size) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool Cartridge::isProbablyDASH(const uInt8* image, uInt32 size) { - return false; // TODO - add autodetection + // DASH cart is identified key 'TJAD' in the ROM + uInt8 signature[] = { 0x54, 0x4a, 0x41, 0x44 }; + return searchForBytes(image, size, signature, 4, 1); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -