summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Tauwasser <tauwasser@tauwasser.eu>2017-06-09 05:47:05 +0200
committer Tauwasser <tauwasser@tauwasser.eu>2017-06-21 15:27:40 +0200
commit8345e439f1567117122f70ec76051551bb8757f8 (patch)
tree6be18afefacb6a0d6f25dd9eadf1fd0952dc538d
parenta8ef5381bf69e77232a262fd803fcc5107055d9d (diff)
gameboy: remove GoodGBX MBC1 Collection check code
Replace with direct comparison of internal ROM name Signed-off-by: Tauwasser <tauwasser@tauwasser.eu>
-rw-r--r--src/devices/bus/gameboy/gb_slot.cpp55
-rw-r--r--src/devices/bus/gameboy/gb_slot.h1
2 files changed, 31 insertions, 25 deletions
diff --git a/src/devices/bus/gameboy/gb_slot.cpp b/src/devices/bus/gameboy/gb_slot.cpp
index 5e767119e80..9a7b8168269 100644
--- a/src/devices/bus/gameboy/gb_slot.cpp
+++ b/src/devices/bus/gameboy/gb_slot.cpp
@@ -464,6 +464,34 @@ bool gb_cart_slot_device_base::get_mmm01_candidate(const uint8_t *ROM, uint32_t
return false;
}
+bool gb_cart_slot_device_base::is_mbc1col_game(const uint8_t *ROM, uint32_t len)
+{
+ const uint8_t name_length = 0x10u;
+ static const uint8_t internal_names[][name_length + 1] = {
+ /* Bomberman Collection */
+ "BOMCOL\0\0\0\0\0\0\0\0\0\0",
+ /* Bomberman Selection */
+ "BOMSEL\0\0\0\0\0B2CK\xC0",
+ /* Genjin Collection */
+ "GENCOL\0\0\0\0\0\0\0\0\0\0",
+ /* Momotarou Collection */
+ "MOMOCOL\0\0\0\0\0\0\0\0\0",
+ /* Mortal Kombat I & II Japan */
+ "MORTALKOMBAT DUO",
+ /* Mortal Kombat I & II US */
+ "MORTALKOMBATI&II",
+ };
+
+ const uint8_t rows = sizeof(internal_names) / sizeof(internal_names[0]);
+
+ for (uint8_t i = 0x00; i < rows; ++i) {
+ if (0 == memcmp(&ROM[0x134], &internal_names[i][0], name_length))
+ return true;
+ }
+
+ return false;
+}
+
int gb_cart_slot_device_base::get_cart_type(const uint8_t *ROM, uint32_t len)
{
int type = GB_MBC_NONE;
@@ -547,31 +575,8 @@ int gb_cart_slot_device_base::get_cart_type(const uint8_t *ROM, uint32_t len)
}
/* Check if we're dealing with the multigame variant of the MBC1 mapper */
- if (type == GB_MBC_MBC1)
- { // bomberman collection korea
- if (ROM[0x134] == 0x42 && ROM[0x135] == 0x4f && ROM[0x136] == 0x4d && ROM[0x137] == 0x53)
- type = GB_MBC_MBC1_COL;
-// if (ROM[0x13f] == 0x42 && ROM[0x140] == 0x32 && ROM[0x141] == 0x43 && ROM[0x142] == 0x4B)
-// type = GB_MBC_MBC1_COL;
- // genjin collection
- if (ROM[0x134] == 0x47 && ROM[0x135] == 0x45 && ROM[0x136] == 0x4e && ROM[0x137] == 0x43)
- type = GB_MBC_MBC1_COL;
- // bomberman collection japan
- if (ROM[0x134] == 0x42 && ROM[0x135] == 0x4f && ROM[0x136] == 0x4d && ROM[0x137] == 0x43)
- type = GB_MBC_MBC1_COL;
- // mortal kombat I & II US
- if (ROM[0x140] == 0x49 && ROM[0x141] == 0x26 && ROM[0x142] == 0x49 && ROM[0x143] == 0x49)
- type = GB_MBC_MBC1_COL;
- // mortal kombat I & II japan
- if (ROM[0x140] == 0x20 && ROM[0x141] == 0x44 && ROM[0x142] == 0x55 && ROM[0x143] == 0x4f)
- type = GB_MBC_MBC1_COL;
- // momotarou collection 1 japan
- if (ROM[0x137] == 0x4f && ROM[0x138] == 0x43 && ROM[0x139] == 0x4f && ROM[0x13a] == 0x4c)
- type = GB_MBC_MBC1_COL;
- // super chinese 123 dash japan
- if (ROM[0x142] == 0x32 && ROM[0x143] == 0x33 && ROM[0x144] == 0x42 && ROM[0x145] == 0x41)
- type = GB_MBC_MBC1_COL;
- }
+ if (type == GB_MBC_MBC1 && is_mbc1col_game(ROM, len))
+ type = GB_MBC_MBC1_COL;
return type;
}
diff --git a/src/devices/bus/gameboy/gb_slot.h b/src/devices/bus/gameboy/gb_slot.h
index f3198f8e20c..c1b786602e6 100644
--- a/src/devices/bus/gameboy/gb_slot.h
+++ b/src/devices/bus/gameboy/gb_slot.h
@@ -126,6 +126,7 @@ public:
int get_type() { return m_type; }
static int get_cart_type(const uint8_t *ROM, uint32_t len);
static bool get_mmm01_candidate(const uint8_t *ROM, uint32_t len);
+ static bool is_mbc1col_game(const uint8_t *ROM, uint32_t len);
// remove me when SGB is properly emulated
int get_sgb_hack() { return m_sgb_hack; }