summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/snesb.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/snesb.cpp')
-rw-r--r--src/mame/drivers/snesb.cpp84
1 files changed, 82 insertions, 2 deletions
diff --git a/src/mame/drivers/snesb.cpp b/src/mame/drivers/snesb.cpp
index 143d5f3a6aa..c3a2097e0a8 100644
--- a/src/mame/drivers/snesb.cpp
+++ b/src/mame/drivers/snesb.cpp
@@ -33,7 +33,7 @@ TODO:
- legendsb : unknown dipswitches
- rushbets : dipswitches (stored at memory locations $785006 and $785008)
- venom : gfx glitches on second level
- - wldgunsb : not decrypted yet
+ - wldgunsb : check if it doesn't work because of protection or some bug in the decryption
***************************************************************************
@@ -174,6 +174,7 @@ public:
void init_legendsb();
void init_rushbets();
void init_venom();
+ void init_wldgunsb();
private:
std::unique_ptr<int8_t[]> m_shared_ram;
@@ -1356,6 +1357,85 @@ void snesb_state::init_venom()
init_snes();
}
+void snesb_state::init_wldgunsb()
+{
+ uint8_t *src = memregion("user7")->base();
+ uint8_t *dst = memregion("user3")->base();
+
+ static uint8_t address_tab_high[0x20] = {
+ // 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
+ 0x0b, 0x1d, 0x05, 0x15, 0x09, 0x19, 0x04, 0x13, 0x02, 0x1f, 0x07, 0x17, 0x0d, 0x11, 0x0a, 0x1a, // unkn
+ 0x14, 0x0e, 0x18, 0x06, 0x1e, 0x01, 0x10, 0x0c, 0x1b, 0x0f, 0x16, 0x00, 0x12, 0x08, 0x1c, 0x03 // 0x10
+ };
+
+ static uint8_t address_tab_low[0x40] = {
+ // 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
+ 0x14, 0x1d, 0x11, 0x3c, 0x0a, 0x29, 0x2d, 0x2e, 0x30, 0x32, 0x16, 0x36, 0x05, 0x25, 0x26, 0x37,
+ 0x20, 0x21, 0x27, 0x28, 0x33, 0x34, 0x23, 0x12, 0x1e, 0x1f, 0x3b, 0x24, 0x2c, 0x35, 0x38, 0x39,
+ 0x3d, 0x0c, 0x2a, 0x0d, 0x22, 0x18, 0x19, 0x1a, 0x03, 0x08, 0x04, 0x3a, 0x0b, 0x0f, 0x15, 0x17,
+ 0x1b, 0x13, 0x00, 0x1c, 0x2b, 0x01, 0x06, 0x2f, 0x07, 0x09, 0x02, 0x31, 0x10, 0x0e, 0x3f, 0x3e
+ };
+
+ static uint8_t data_table[0x100] = {
+ // 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
+ 0x35, 0xad, 0x85, 0xb5, 0x95, 0x05, 0x25, 0xa5, 0x0d, 0xbd, 0x3d, 0x1d, 0x8d, 0x15, 0x2d, 0x9d, // 0x00
+ 0x73, 0xeb, 0xc3, 0xf3, 0xd3, 0x43, 0x63, 0xe3, 0x4b, 0xfb, 0x7b, 0x5b, 0xcb, 0x53, 0x6b, 0xdb, // 0x10
+ 0x70, 0xe8, 0xc0, 0xf0, 0xd0, 0x40, 0x60, 0xe0, 0x48, 0xf8, 0x78, 0x58, 0xc8, 0x50, 0x68, 0xd8, // 0x20
+ 0x75, 0xed, 0xc5, 0xf5, 0xd5, 0x45, 0x65, 0xe5, 0x4d, 0xfd, 0x7d, 0x5d, 0xcd, 0x55, 0x6d, 0xdd, // 0x30
+ 0x74, 0xec, 0xc4, 0xf4, 0xd4, 0x44, 0x64, 0xe4, 0x4c, 0xfc, 0x7c, 0x5c, 0xcc, 0x54, 0x6c, 0xdc, // 0x40
+ 0x30, 0xa8, 0x80, 0xb0, 0x90, 0x00, 0x20, 0xa0, 0x08, 0xb8, 0x38, 0x18, 0x88, 0x10, 0x28, 0x98, // 0x50
+ 0x31, 0xa9, 0x81, 0xb1, 0x91, 0x01, 0x21, 0xa1, 0x09, 0xb9, 0x39, 0x19, 0x89, 0x11, 0x29, 0x99, // 0x60
+ 0x71, 0xe9, 0xc1, 0xf1, 0xd1, 0x41, 0x61, 0xe1, 0x49, 0xf9, 0x79, 0x59, 0xc9, 0x51, 0x69, 0xd9, // 0x70
+ 0x32, 0xaa, 0x82, 0xb2, 0x92, 0x02, 0x22, 0xa2, 0x0a, 0xba, 0x3a, 0x1a, 0x8a, 0x12, 0x2a, 0x9a, // 0x80
+ 0x77, 0xef, 0xc7, 0xf7, 0xd7, 0x47, 0x67, 0xe7, 0x4f, 0xff, 0x7f, 0x5f, 0xcf, 0x57, 0x6f, 0xdf, // 0x90
+ 0x37, 0xaf, 0x87, 0xb7, 0x97, 0x07, 0x27, 0xa7, 0x0f, 0xbf, 0x3f, 0x1f, 0x8f, 0x17, 0x2f, 0x9f, // 0xa0
+ 0x36, 0xae, 0x86, 0xb6, 0x96, 0x06, 0x26, 0xa6, 0x0e, 0xbe, 0x3e, 0x1e, 0x8e, 0x16, 0x2e, 0x9e, // 0xb0
+ 0x72, 0xea, 0xc2, 0xf2, 0xd2, 0x42, 0x62, 0xe2, 0x4a, 0xfa, 0x7a, 0x5a, 0xca, 0x52, 0x6a, 0xda, // 0xc0
+ 0x34, 0xac, 0x84, 0xb4, 0x94, 0x04, 0x24, 0xa4, 0x0c, 0xbc, 0x3c, 0x1c, 0x8c, 0x14, 0x2c, 0x9c, // 0xd0
+ 0x33, 0xab, 0x83, 0xb3, 0x93, 0x03, 0x23, 0xa3, 0x0b, 0xbb, 0x3b, 0x1b, 0x8b, 0x13, 0x2b, 0x9b, // 0xe0
+ 0x76, 0xee, 0xc6, 0xf6, 0xd6, 0x46, 0x66, 0xe6, 0x4e, 0xfe, 0x7e, 0x5e, 0xce, 0x56, 0x6e, 0xde // 0xf0
+ };
+
+ for (int i = 0; i < 0x100000; i++)
+ {
+ int j = (address_tab_high[i >> 15] << 15) + (i & 0x7fc0) + address_tab_low[i & 0x3f];
+
+ dst[i] = data_table[src[j]];
+
+ if (i >= 0x00000 && i < 0x10000) {
+ dst[i] = bitswap<8>(dst[i], 3, 1, 7, 0, 6, 4, 5, 2) ^ 0xff;
+ }
+
+ if (i >= 0x10000 && i < 0x20000) {
+ dst[i] = bitswap<8>(dst[i], 4, 7, 3, 2, 0, 1, 6, 5);
+ }
+
+ if (i >= 0x20000 && i < 0x30000) {
+ dst[i] = bitswap<8>(dst[i], 6, 0, 7, 1, 4, 3, 5, 2) ^ 0xff;
+ }
+
+ if (i >= 0x30000 && i < 0x40000) {
+ dst[i] = bitswap<8>(dst[i], 0, 2, 6, 4, 1, 5, 7, 3);
+ }
+ }
+
+ // boot vector
+ dst[0x7ffc] = 0x40;
+ dst[0x7ffd] = 0x80;
+
+ m_shared_ram = std::make_unique<int8_t[]>(0x22);
+ //m_shared_ram2 = std::make_unique<int8_t[]>(0x22);
+ m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x781000, 0x781021, read8sm_delegate(*this, FUNC(snesb_state::sharedram_r)), write8sm_delegate(*this, FUNC(snesb_state::sharedram_w)));
+ //m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x781200, 0x781221, read8sm_delegate(*this, FUNC(snesb_state::sharedram2_r)), write8sm_delegate(*this, FUNC(snesb_state::sharedram2_w)));
+
+ m_maincpu->space(AS_PROGRAM).install_read_handler(0x770073, 0x770073, read8smo_delegate(*this, FUNC(snesb_state::snesb_dsw1_r)));
+ m_maincpu->space(AS_PROGRAM).install_read_handler(0x770074, 0x770074, read8smo_delegate(*this, FUNC(snesb_state::snesb_dsw2_r)));
+ //m_maincpu->space(AS_PROGRAM).install_read_handler(0x770079, 0x770079, read8smo_delegate(*this, FUNC(snesb_state::snesb_coin_r)));
+
+ init_snes();
+}
+
+
ROM_START( kinstb )
ROM_REGION( 0x400000, "user3", 0 )
ROM_LOAD( "1.u14", 0x000000, 0x100000, CRC(70889919) SHA1(1451714cbdacb7f6ced2bc7afa478ad7264cf3b7) )
@@ -1544,4 +1624,4 @@ GAME( 1996, endless, 0, kinstb, endless, snesb_state, init_e
GAME( 1996, legendsb, 0, kinstb, kinstb, snesb_state, init_legendsb, ROT0, "bootleg", "Legend (SNES bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
GAME( 1997, rushbets, 0, kinstb, rushbets, snesb_state, init_rushbets, ROT0, "bootleg", "Rushing Beat Shura (SNES bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
GAME( 1997, venom, 0, kinstb, venom, snesb_state, init_venom, ROT0, "bootleg", "Venom & Spider-Man - Separation Anxiety (SNES bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
-GAME( 1996, wldgunsb, 0, kinstb, venom, snesb_state, empty_init, ROT0, "bootleg", "Wild Guns (SNES bootleg)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
+GAME( 1996, wldgunsb, 0, kinstb, venom, snesb_state, init_wldgunsb, ROT0, "bootleg", "Wild Guns (SNES bootleg)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )