From 08081a30313cb8d37d533731ce9dec868273d2f2 Mon Sep 17 00:00:00 2001 From: etabeta78 Date: Sun, 14 Jun 2015 16:53:32 +0200 Subject: [PATCH 01/21] info.c: worked around missing sub-devices in -lx output [Fabio Priuli] out of whatsnew: I fear no proper and clean solution is possible as long as the driver has such a privileged role in the MAME core structure, because stuff that is not attached to a root_device (=driver) is hard to parse. Anyway, there should be no more missing roms from -lx output (until people starts adding them as sub-sub-subdevices... ;) ) --- src/emu/info.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/emu/info.c b/src/emu/info.c index 4b5adfab3b1..adb0f3468d4 100644 --- a/src/emu/info.c +++ b/src/emu/info.c @@ -374,6 +374,12 @@ void info_xml_creator::output_one_device(device_t &device, const char *devtag) // output_devices - print the XML info for devices // with roms and for devices that can be mounted // in slots +// The current solution works to some extent, but +// it is limited by the fact that devices are only +// acknowledged when attached to a driver (so that +// for instance sub-sub-devices could never appear +// in the xml input if they are not also attached +// directly to a driver as device or sub-device) //------------------------------------------------- typedef tagmap_t slot_map; @@ -415,6 +421,17 @@ void info_xml_creator::output_devices() if (shortnames.add(dev->shortname(), 0, FALSE) != TMERR_DUPLICATE) output_one_device(*dev, temptag.c_str()); + // also, check for subdevices with ROMs (a few devices are missed otherwise, e.g. MPU401) + device_iterator deviter2(*dev); + for (device_t *device = deviter2.first(); device != NULL; device = deviter2.next()) + { + if (device->owner() == dev && device->shortname()!= NULL && strlen(device->shortname())!=0) + { + if (shortnames.add(device->shortname(), 0, FALSE) != TMERR_DUPLICATE) + output_one_device(*device, device->tag()); + } + } + const_cast(m_drivlist.config()).device_remove(&m_drivlist.config().root_device(), temptag.c_str()); } } From 36f146e5dc18d3ac79727153d1b719a0757f3542 Mon Sep 17 00:00:00 2001 From: Ville Linde Date: Sun, 14 Jun 2015 03:24:28 +0300 Subject: [PATCH 02/21] model3: various improvements [Ville Linde] * Rewrote projection calculations to use projection matrix * Rewrote polygon clipping to use 4D W-space clipping * Implemented 8-bit texture uploads * Changed all scanline renderers to use rgbutil --- src/mame/drivers/model3.c | 106 ++-- src/mame/includes/model3.h | 30 +- src/mame/video/model3.c | 978 +++++++++++++++++++++++++------------ 3 files changed, 739 insertions(+), 375 deletions(-) diff --git a/src/mame/drivers/model3.c b/src/mame/drivers/model3.c index f20f4901166..95e9177da59 100644 --- a/src/mame/drivers/model3.c +++ b/src/mame/drivers/model3.c @@ -1192,7 +1192,7 @@ static void configure_fast_ram(running_machine &machine) { model3_state *state = machine.driver_data(); /* set conservative DRC options */ - machine.device("maincpu")->ppcdrc_set_options(PPCDRC_COMPATIBLE_OPTIONS - PPCDRC_ACCURATE_SINGLES); + machine.device("maincpu")->ppcdrc_set_options(PPCDRC_COMPATIBLE_OPTIONS); /* configure fast RAM regions for DRC */ machine.device("maincpu")->ppcdrc_add_fastram(0x00000000, 0x007fffff, FALSE, state->m_work_ram); @@ -1556,7 +1556,7 @@ WRITE64_MEMBER(model3_state::model3_sys_w) m_crom_bank = data >> 56; data >>= 56; - data = (~data) & 0x7; + data = (~data) & 0xf; membank("bank1")->set_base(memregion( "user1" )->base() + 0x800000 + (data * 0x800000)); /* banked CROM */ } @@ -2047,7 +2047,7 @@ INPUT_PORTS_END #define ROM_LOAD_VROM(name, offset, length, hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_SKIP(14) ) ROM_START( lemans24 ) /* step 1.5, Sega game ID# is 833-13159, ROM board ID# 834-13160 GAME BD LEMANS 24 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-19887b.17", 0x600006, 0x080000, CRC(2842bb87) SHA1(2acabf3f7281acaf6bab4d3bae9701df3909cf81) ) ROM_LOAD64_WORD_SWAP( "epr-19888b.18", 0x600004, 0x080000, CRC(800d763d) SHA1(4f2865a64d6dda638840d359db3bd2f22b6d1404) ) @@ -2117,7 +2117,7 @@ ROM_END ROM_START( scud ) /* step 1.5, Sega game ID# is 833-13041, ROM board ID# 834-13072 SPG COMM AUS */ /* There is known to be a ROM board ID# 834-13034 SPG DX AUS with program roms EPR-19634 to EPR-19637 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-19731.17", 0x0600006, 0x80000, CRC(3ee6447e) SHA1(124697791d90c1b352dd6e33bd3b45535aa92bb5) ) ROM_LOAD64_WORD_SWAP( "epr-19732.18", 0x0600004, 0x80000, CRC(23e864bb) SHA1(0f34d963ee681ca1006f3dec12b593d961e3e442) ) @@ -2192,7 +2192,7 @@ ROM_START( scud ) /* step 1.5, Sega game ID# is 833-13041, ROM board ID# 834-1 ROM_END ROM_START( scudj ) /* step 1.5, Sega game ID# is 833-13041, ROM board ID# 12934 SPG DX */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-19610.17a", 0x0600006, 0x80000, CRC(53f5cd94) SHA1(e27609165087ef7000b61ce628883561ffe64b22) ) ROM_LOAD64_WORD_SWAP( "epr-19609.18a", 0x0600004, 0x80000, CRC(ec418b68) SHA1(8455db7e174ea00db30b7e61681ac7b7fcd9ba1c) ) @@ -2267,7 +2267,7 @@ ROM_START( scudj ) /* step 1.5, Sega game ID# is 833-13041, ROM board ID# 12934 ROM_END ROM_START( scuda ) /* step 1.5, Sega game ID# is 833-13041, ROM board ID# 834-13042 SPG FOR COMMUNICATION */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-19688.17", 0x0600006, 0x80000, CRC(a4c85103) SHA1(b2e57f86d0a49e3e88fa7d6a77bbd99039c034bb) ) ROM_LOAD64_WORD_SWAP( "epr-19689.18", 0x0600004, 0x80000, CRC(cbce6d62) SHA1(b6051af013ee80406cfadb0c8acf24b8825ccaf2) ) @@ -2342,7 +2342,7 @@ ROM_START( scuda ) /* step 1.5, Sega game ID# is 833-13041, ROM board ID# 834-1 ROM_END ROM_START( scudplus ) /* step 1.5, Sega game ID# is 833-13260 SCUD PLUS, ROM board ID# 834-13261 SCUD PLUS */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20092a.17", 0x0600006, 0x80000, CRC(a94ec57e) SHA1(bda1d9cb38e10a25f7cdde38f30ae13541fdbc5e) ) ROM_LOAD64_WORD_SWAP( "epr-20093a.18", 0x0600004, 0x80000, CRC(4ed2e35d) SHA1(ac149b369db9fc80e63e1ed943d42ccd056dab1b) ) @@ -2423,7 +2423,7 @@ ROM_START( scudplus ) /* step 1.5, Sega game ID# is 833-13260 SCUD PLUS, ROM b ROM_END ROM_START( scudplusa ) /* step 1.5, Sega game ID# is 833-13260 SCUD PLUS, ROM board ID# 834-13261 SCUD PLUS */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20092.17", 0x0600006, 0x80000, CRC(6f9161c1) SHA1(b1c66eeb1bb67664aafa78ad62515204f231f09b) ) ROM_LOAD64_WORD_SWAP( "epr-20093.18", 0x0600004, 0x80000, CRC(9a85c611) SHA1(fb21c29584b205ec14f82318110ecf5821a95c23) ) @@ -2504,7 +2504,7 @@ ROM_START( scudplusa ) /* step 1.5, Sega game ID# is 833-13260 SCUD PLUS, ROM b ROM_END ROM_START( vf3 ) /* step 1.0, Sega game ID# is 833-12712, ROM board ID# 834-12821 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-19227c.17", 0x600006, 0x080000, CRC(a7df4d75) SHA1(1b1186227f830556c5e2b6ca4c2bf20673b22f94) ) ROM_LOAD64_WORD_SWAP( "epr-19228c.18", 0x600004, 0x080000, CRC(9c5727e2) SHA1(f9f8b8cf27fdce08ab2975dbaa8c7a03f5c064fb) ) @@ -2579,7 +2579,7 @@ ROM_START( vf3 ) /* step 1.0, Sega game ID# is 833-12712, ROM board ID# 834-1 ROM_END ROM_START( vf3a ) /* step 1.0, Sega game ID# is 833-12712, ROM board ID# 834-12821 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr19227a.17", 0x600006, 0x080000, CRC(7139931a) SHA1(57eec80361726143017b1adbfaafbeef0bc4109d) ) ROM_LOAD64_WORD_SWAP( "epr19228a.18", 0x600004, 0x080000, CRC(82f17ab5) SHA1(64714d14e64d97ebeedd1c6e1e832969df9e2324) ) @@ -2654,7 +2654,7 @@ ROM_START( vf3a ) /* step 1.0, Sega game ID# is 833-12712, ROM board ID# 834-1 ROM_END ROM_START( vf3tb ) /* step 1.0? */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20126.17", 0x600006, 0x080000, CRC(27ecd3b0) SHA1(a9b913294ac925adb501d3b47f346006b70dfcd6) ) ROM_LOAD64_WORD_SWAP( "epr-20127.18", 0x600004, 0x080000, CRC(5c0f694b) SHA1(ca346d6b249bb7a3015f016d25bfb3050360c8ec) ) @@ -2729,7 +2729,7 @@ ROM_START( vf3tb ) /* step 1.0? */ ROM_END ROM_START( bass ) /* step 1.0, Sega game ID# is 833-13317, ROM board ID# 834-13318 BSS */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20643.17", 0x600006, 0x080000, CRC(daf02716) SHA1(b968f8ca602c78b9ca49969ff01f9440f175049a) ) ROM_LOAD64_WORD_SWAP( "epr-20644.18", 0x600004, 0x080000, CRC(c28db2b6) SHA1(0b12fe9e5189714b1aca79c4bba4be57a9e0d5fd) ) @@ -2798,7 +2798,7 @@ ROM_START( bass ) /* step 1.0, Sega game ID# is 833-13317, ROM board ID# 834-1 ROM_END ROM_START( bassdx ) /* step 1.0, Sega game ID# is 833-13476 BSS DX JPN, ROM board ID# 834-13477 BSS DX JPN */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20834.17", 0x600006, 0x080000, CRC(17f466a6) SHA1(2abdc432891cc79733fc29903df87af9eba11b32) ) ROM_LOAD64_WORD_SWAP( "epr-20835.18", 0x600004, 0x080000, CRC(f8f19bb2) SHA1(8f1704e532e494086fb5989d0c358ea0a0f6aae5) ) @@ -2892,7 +2892,7 @@ gal16v8d (sega 315-6126) */ ROM_START( getbass ) /* step 1.0, Sega game ID# is 833-13416 GET BASS STD, ROM board ID# 834-13417 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20309.17", 0x600006, 0x080000, CRC(a42e1033) SHA1(a834eb973e9529338413220a2d8e66ce98d6cb31) ) ROM_LOAD64_WORD_SWAP( "epr-20310.18", 0x600004, 0x080000, CRC(4efcddc9) SHA1(d1362c2a844b605901083e875a6aad817401eb0a) ) @@ -2964,7 +2964,7 @@ ROM_START( getbass ) /* step 1.0, Sega game ID# is 833-13416 GET BASS STD, RO ROM_END ROM_START( lostwsga ) /* Step 1.5, PCB cage labeled 834-13172 THE LOST WORLD U/R. Sega game ID# is 833-13171, ROM board ID# 834-13172 REV.A */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-19939a.17", 0x600006, 0x080000, CRC(8788b939) SHA1(30932057f763545568526f85977aa0afc4b66e7d) ) ROM_LOAD64_WORD_SWAP( "epr-19938a.18", 0x600004, 0x080000, CRC(38afe27a) SHA1(718a238ee246eeed9fa698b58493806932d0e7cb) ) @@ -3039,7 +3039,7 @@ ROM_START( lostwsga ) /* Step 1.5, PCB cage labeled 834-13172 THE LOST WORLD U ROM_END ROM_START( vs2 ) /* Step 2.0 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20467.17", 0x400006, 0x100000, CRC(25d7ae73) SHA1(433a7c1dac1bd5524b018da2ed09f937d527ac3e) ) ROM_LOAD64_WORD_SWAP( "epr-20468.18", 0x400004, 0x100000, CRC(f0f0b6ea) SHA1(b3f545e5a4dd45b97df938093251cc7845c2a1f9) ) @@ -3114,7 +3114,7 @@ ROM_START( vs2 ) /* Step 2.0 */ ROM_END ROM_START( vs215 ) /* Step 1.5 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-19900.17", 0x600006, 0x080000, CRC(8fb6045d) SHA1(88497eafc23ba70ab4a43de552a16caccd8dccbe) ) ROM_LOAD64_WORD_SWAP( "epr-19899.18", 0x600004, 0x080000, CRC(8cc2be9f) SHA1(ec82b1312c8d58adb200f4d7f6f9a9c8214415d5) ) @@ -3189,7 +3189,7 @@ ROM_START( vs215 ) /* Step 1.5 */ ROM_END ROM_START( vs215o ) /* Step 1.5, original release.. might even be for Step 1.0??? */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-19806.17", 0x600006, 0x080000, CRC(95e1b970) SHA1(bcc914088cd08cb0032349b71904757760d947f3) ) ROM_LOAD64_WORD_SWAP( "epr-19805.18", 0x600004, 0x080000, CRC(d9e40606) SHA1(b305e607ffe4226c825a73973a5c8ec1322e8b58) ) @@ -3264,7 +3264,7 @@ ROM_START( vs215o ) /* Step 1.5, original release.. might even be for Step 1.0?? ROM_END ROM_START( vs298 ) /* Step 2.0, Sega ID# 833-13346, ROM board ID# 834-13347 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20917.17", 0x400006, 0x100000, CRC(c3bbb270) SHA1(16b2342031ff72408f2290e775df5c8aa344c2e4) ) ROM_LOAD64_WORD_SWAP( "epr-20918.18", 0x400004, 0x100000, CRC(0e9cdc5b) SHA1(356816d0380c791b9d812ce17fa95123d15bb5e9) ) @@ -3342,7 +3342,7 @@ ROM_START( vs298 ) /* Step 2.0, Sega ID# 833-13346, ROM board ID# 834-13347 */ ROM_END ROM_START( vs29815 ) /* Step 1.5, ROM board ID# 834-13495 VS2 VER98 STEP 1.5 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20909.17", 0x600006, 0x080000, CRC(3dff0d7e) SHA1(c6a6a103f499cd451796ae2480b8c38c3e87a143) ) ROM_LOAD64_WORD_SWAP( "epr-20910.18", 0x600004, 0x080000, CRC(dc75a2e3) SHA1(f1b13674ae20b5b964be593171b9d6008d5a51b7) ) @@ -3417,7 +3417,7 @@ ROM_START( vs29815 ) /* Step 1.5, ROM board ID# 834-13495 VS2 VER98 STEP 1.5 ROM_END ROM_START( vs2v991 ) /* Step 2.0 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21535b.17", 0x400006, 0x100000, CRC(76c5fa8e) SHA1(862438198cb7fdd20beeba53e707a7c59e618ad9) ) ROM_LOAD64_WORD_SWAP( "epr-21536b.18", 0x400004, 0x100000, CRC(1f2bd190) SHA1(19843e6c5626de03eba3cba79c03ce9f2471c183) ) @@ -3495,7 +3495,7 @@ ROM_START( vs2v991 ) /* Step 2.0 */ ROM_END ROM_START( vs299b ) /* Step 2.0 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21550b.17", 0x400006, 0x100000, CRC(c508e488) SHA1(3134d418beaee9f824a0bd0e5441a997b5911d16) ) ROM_LOAD64_WORD_SWAP( "epr-21551b.18", 0x400004, 0x100000, CRC(0bbc40f7) SHA1(4437c7eab621349b826dcc03d1377731260417e8) ) @@ -3573,7 +3573,7 @@ ROM_START( vs299b ) /* Step 2.0 */ ROM_END ROM_START( vs299a ) /* Step 2.0 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21535a.17", 0x400006, 0x100000, CRC(8e4ec341) SHA1(973c71e7a48e728cbcb2465b56e90669fee0ec53) ) ROM_LOAD64_WORD_SWAP( "epr-21536a.18", 0x400004, 0x100000, CRC(95d49d6e) SHA1(80b6655c1ee0f76620e3e2e9425719819a96ccf7) ) @@ -3651,7 +3651,7 @@ ROM_START( vs299a ) /* Step 2.0 */ ROM_END ROM_START( vs299 ) /* Step 2.0 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21535.17", 0x400006, 0x100000, CRC(976a00bf) SHA1(d4be52ff59faa877b169f96ac509a2196cefb908) ) ROM_LOAD64_WORD_SWAP( "epr-21536.18", 0x400004, 0x100000, CRC(9af2b0d5) SHA1(6ec296014228782f372611fe774014d252956b63) ) @@ -3729,7 +3729,7 @@ ROM_START( vs299 ) /* Step 2.0 */ ROM_END ROM_START( von2 ) /* Step 2.0 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20683b.17", 0x000006, 0x200000, CRC(59d9c974) SHA1(c45594ed474a9e8fd074e0d9d5fa6662bc88dee6) ) ROM_LOAD64_WORD_SWAP( "epr-20684b.18", 0x000004, 0x200000, CRC(1fc15431) SHA1(c68c77dfcf5e2702214d64095ce07076d3702a5e) ) @@ -3808,7 +3808,7 @@ ROM_START( von2 ) /* Step 2.0 */ ROM_END ROM_START( von254g ) /* Step 2.0, Sega game ID# is 833-13789 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21788.17", 0x000006, 0x200000, CRC(97066bcf) SHA1(234c45ee1f23b22f61893825eebf31d867cf420f) ) ROM_LOAD64_WORD_SWAP( "epr-21789.18", 0x000004, 0x200000, CRC(3069108f) SHA1(f4e82da677458423abcf07c9c5a837005ed8f1c4) ) @@ -3887,7 +3887,7 @@ ROM_START( von254g ) /* Step 2.0, Sega game ID# is 833-13789 */ ROM_END ROM_START( skichamp ) /* Step 2.0 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20352.17", 0x000006, 0x200000, CRC(c92c2545) SHA1(612c39c935b403484fcda6d36fca50cc5ef726fc) ) ROM_LOAD64_WORD_SWAP( "epr-20353.19", 0x000004, 0x200000, CRC(badf5f04) SHA1(65a502a3fada114a699d0bf22e004d5bf1f5edf5) ) @@ -3959,7 +3959,7 @@ ROM_START( skichamp ) /* Step 2.0 */ ROM_END ROM_START( swtrilgy ) /* Step 2.1, Sega game ID# is 833-13586, ROM board ID# 834-13587 STAR WARS TRILOGY, Security board ID# 837-13588-COM */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21379a.17", 0x000006, 0x200000, CRC(24dc1555) SHA1(0a4b458bb09238de0f38ba2805512b5dbee7d58e) ) ROM_LOAD64_WORD_SWAP( "epr-21380a.18", 0x000004, 0x200000, CRC(780fb4e7) SHA1(6650e114bad0e4c3f67b744599dba9845da82f11) ) @@ -4034,7 +4034,7 @@ ROM_START( swtrilgy ) /* Step 2.1, Sega game ID# is 833-13586, ROM board ID# 8 ROM_END ROM_START( swtrilgya ) /* Step 2.1, Sega game ID# is 833-13586, ROM board ID# 834-13587 STAR WARS TRILOGY, Security board ID# 837-13588-COM */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21379.17", 0x000006, 0x200000, CRC(61ad51d9) SHA1(b27ea929702bb94c86d03d6c1f479af32230b4d0) ) ROM_LOAD64_WORD_SWAP( "epr-21380.18", 0x000004, 0x200000, CRC(49b182f2) SHA1(9a4e3180f2661c95976963ab17e66a5184bca9a3) ) @@ -4106,7 +4106,7 @@ ROM_START( swtrilgya ) /* Step 2.1, Sega game ID# is 833-13586, ROM board ID# 8 ROM_END ROM_START( dirtdvls ) /* Step 2.1 - Export version, Sega game ID# is 833-13427, ROM board ID# 834-13528 DRT */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21062a.17", 0x000006, 0x200000, CRC(64b55254) SHA1(0e5de3786edad77dde08652ac837dc9125e7851c) ) ROM_LOAD64_WORD_SWAP( "epr-21063a.18", 0x000004, 0x200000, CRC(6ab7eb32) SHA1(3a4226d4c786e7b64688af3b8883b4039b8c8407) ) @@ -4170,7 +4170,7 @@ ROM_START( dirtdvls ) /* Step 2.1 - Export version, Sega game ID# is 833-13427 ROM_END ROM_START( dirtdvlsa ) /* Step 2.1 - Australia version */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21058a", 0x000006, 0x200000, CRC(4d7fdc8d) SHA1(c45031b4e3ea65519de671e0e11f87e0965e3c93) ) ROM_LOAD64_WORD_SWAP( "epr-21059a", 0x000004, 0x200000, CRC(f31a2aa4) SHA1(b7398db217372885f763efdb909f3e43ccbac34a) ) @@ -4400,7 +4400,7 @@ ROM_START( dayto2pe ) /* Step 2.1, Sega game ID# is 833-13610 DAYTONA USA2 SP, ROM_END ROM_START( srally2 ) /* Step 2.0, Sega game ID# is 833-13373, ROM board ID# 834-13374 SRT TWIN */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20632.17", 0x000006, 0x200000, CRC(6829a801) SHA1(2aa3834f6a8c53f5db57ab52994b8ab3fde2d7c2) ) ROM_LOAD64_WORD_SWAP( "epr-20633.18", 0x000004, 0x200000, CRC(f5a24f24) SHA1(6f741bc53d51ff4b5535dbee35aa490f159945ec) ) @@ -4472,7 +4472,7 @@ ROM_START( srally2 ) /* Step 2.0, Sega game ID# is 833-13373, ROM board ID# 8 ROM_END ROM_START( srally2x ) /* Step 2.0 */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20502.17", 0x000006, 0x200000, CRC(af16846d) SHA1(a0babc4dc3809ca1e71eaad4dc2f8c1597575e8b) ) ROM_LOAD64_WORD_SWAP( "epr-20503.18", 0x000004, 0x200000, CRC(6e238b3d) SHA1(78da9abf39a2371d74d6b72b00f2467dfe86c4d5) ) @@ -4541,7 +4541,7 @@ ROM_START( srally2x ) /* Step 2.0 */ ROM_END ROM_START( harley ) /* Step 2.0, Sega game ID# is 833-13325, ROM board ID# 834-13326 HARLEY DAVIDSON */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20393b.17", 0x000006, 0x200000, CRC(7d712105) SHA1(35e0849f498de48fcb357495b6e8039740b8e881) ) ROM_LOAD64_WORD_SWAP( "epr-20394b.18", 0x000004, 0x200000, CRC(b4312135) SHA1(79c4306acd8c20f86d16a18de696783f7da9df84) ) @@ -4609,7 +4609,7 @@ ROM_START( harley ) /* Step 2.0, Sega game ID# is 833-13325, ROM board ID# 834-1 ROM_END ROM_START( harleya ) /* Step 2.0, Sega game ID# is 833-13325, ROM board ID# 834-13326 HARLEY DAVIDSON */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20393a.17", 0x000006, 0x200000, CRC(b5646556) SHA1(4bff0e140e1d1df7459f7194aa4a335bc4592203) ) ROM_LOAD64_WORD_SWAP( "epr-20394a.18", 0x000004, 0x200000, CRC(ce29e2b6) SHA1(482aaf5480b219b8ac6e4e36a6d64359e1834f44) ) @@ -4677,7 +4677,7 @@ ROM_START( harleya ) /* Step 2.0, Sega game ID# is 833-13325, ROM board ID# 8 ROM_END ROM_START( fvipers2 ) /* Step 2.0 - Japan version */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-20596a.17", 0x000006, 0x200000, CRC(969ab801) SHA1(a7a2aa71204d1c38a6a8c0605331fd859cb224f1) ) ROM_LOAD64_WORD_SWAP( "epr-20597a.18", 0x000004, 0x200000, CRC(6fcee322) SHA1(d65303f2551902ac5446a35656241628d67f4a63) ) @@ -4915,7 +4915,7 @@ ROM_START( spikeofe ) /* Step 2.1, Sega game ID# is 833-13746, ROM board ID# 8 ROM_END ROM_START( eca ) /* Step 2.1 Export version */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-22903.17", 0x000006, 0x200000, CRC(53882217) SHA1(163cbc92ff88671882cc1af377ceec80ba9f36db) ) ROM_LOAD64_WORD_SWAP( "epr-22904.18", 0x000004, 0x200000, CRC(0ff828a8) SHA1(2a74414891ceb5989e6ccb6e9d597f7d2e31fec4) ) // == epr-22896.18 @@ -4986,7 +4986,7 @@ ROM_START( eca ) /* Step 2.1 Export version */ ROM_END ROM_START( ecau ) /* Step 2.1, ROM board ID# 834-13946-01 ECA */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-22895.17", 0x000006, 0x200000, CRC(07df16a0) SHA1(a9ad2b229854a5f4f761565141db738adde28720) ) ROM_LOAD64_WORD_SWAP( "epr-22896.18", 0x000004, 0x200000, CRC(0ff828a8) SHA1(2a74414891ceb5989e6ccb6e9d597f7d2e31fec4) ) @@ -5057,7 +5057,7 @@ ROM_START( ecau ) /* Step 2.1, ROM board ID# 834-13946-01 ECA */ ROM_END ROM_START( ecap ) /* Step 2.1 - Proto or Location test - No security dongle */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM // Hand written SEGA labels in this form: TITLE: QQ ROM NO: IC17 CHECK SUM: 551B 9/12-'99 ROM_LOAD64_WORD_SWAP( "qq.ic17", 0x000006, 0x200000, BAD_DUMP CRC(1db889e0) SHA1(b9a5f344685e1d8b5711d8ab426bb886c1008e48) ) /* Check sum: 551B, dated "9/12-'99" */ @@ -5131,7 +5131,7 @@ ROM_START( ecap ) /* Step 2.1 - Proto or Location test - No security dongle */ ROM_END ROM_START( magtruck ) /* Step 2.1, Sega game ID# is 833-13601-01 (Export), ROM board ID# 834-13600-01 RCS EXP (Export), Security board ID# 837-13599-COM */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21435.17", 0x000006, 0x200000, CRC(9b169446) SHA1(285cbe5afd439d83c50f0499a878f71b8e5b94e5) ) ROM_LOAD64_WORD_SWAP( "epr-21433.18", 0x000004, 0x200000, CRC(60aa9d76) SHA1(b27741568a4fd0494b2254e468faea569e2d9fef) ) @@ -5261,7 +5261,7 @@ ROM_START( oceanhun ) /* Step 2.0, Sega game ID# is 833-13571, ROM board ID# 8 ROM_END ROM_START( lamachin ) /* Step 2.0, Sega game ID# is 833-13664, ROM board ID# 834-13665 L.A.MACHINEGUNS, 317-0244-COM security chip (837-13666-COM security board) */ - ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */ + ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM ROM_LOAD64_WORD_SWAP( "epr-21483.17", 0x000006, 0x200000, CRC(940637c2) SHA1(89894b603c17d27f57500ec8030eaa7e0e991479) ) ROM_LOAD64_WORD_SWAP( "epr-21484.18", 0x000004, 0x200000, CRC(58102168) SHA1(38dd9a41f653c0a84ac927b476f014c949454ffa) ) @@ -5690,6 +5690,9 @@ DRIVER_INIT_MEMBER(model3_state,scud) DRIVER_INIT_CALL(model3_15); /* TODO: network device at 0xC0000000 - FF */ m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xf9000000, 0xf90000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this)); + +// UINT32 *rom = (UINT32*)memregion("user1")->base(); +// rom[(0x799de8^4)/4] = 0x00050208; // secret debug menu } DRIVER_INIT_MEMBER(model3_state,scudplus) @@ -5822,6 +5825,15 @@ DRIVER_INIT_MEMBER(model3_state,harley) m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xc0000000, 0xc00fffff, read64_delegate(FUNC(model3_state::network_r),this), write64_delegate(FUNC(model3_state::network_w),this)); } +DRIVER_INIT_MEMBER(model3_state,harleya) +{ + DRIVER_INIT_CALL(model3_20); + + m_network_ram = auto_alloc_array_clear(machine(), UINT64, 0x10000); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xc0000000, 0xc00fffff, read64_delegate(FUNC(model3_state::network_r),this), write64_delegate(FUNC(model3_state::network_w),this)); +} + + DRIVER_INIT_MEMBER(model3_state,srally2) { DRIVER_INIT_CALL(model3_20); @@ -5937,6 +5949,16 @@ DRIVER_INIT_MEMBER(model3_state,eca) { DRIVER_INIT_CALL(model3_20); DRIVER_INIT_CALL(genprot); + + // base = 0xffc80000 + UINT32 *rom = (UINT32*)memregion("user1")->base(); + + // cabinet network error + rom[(0x4a45e4^4)/4] = 0x60000000; + + // this code sometimes gets stuck waiting for [0x1e0064], changed by the sound irq (sound FIFO overflow?) + rom[(0x5523b4^4)/4] = 0x60000000; + rom[(0x5523d4^4)/4] = 0x60000000; } DRIVER_INIT_MEMBER(model3_state,skichamp) @@ -6002,7 +6024,7 @@ GAME( 1998, vs29815, vs298, model3_15, model3, model3_state, vs29815, ROT0 /* Model 3 Step 2.0 */ GAME( 1997, vs2, 0, model3_20, model3, model3_state, vs2, ROT0, "Sega", "Virtua Striker 2 (Step 2.0)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) GAME( 1997, harley, 0, model3_20, harley, model3_state, harley, ROT0, "Sega", "Harley-Davidson and L.A. Riders (Revision B)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) -GAME( 1997, harleya, harley, model3_20, harley, model3_state, harley, ROT0, "Sega", "Harley-Davidson and L.A. Riders (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) +GAME( 1997, harleya, harley, model3_20, harley, model3_state, harleya, ROT0, "Sega", "Harley-Davidson and L.A. Riders (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) GAME( 1998, lamachin, 0, model3_20_5881, model3, model3_state, lamachin, ROT0, "Sega", "L.A. Machineguns (Japan)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) GAME( 1998, oceanhun, 0, model3_20_5881, model3, model3_state, oceanhun, ROT0, "Sega", "The Ocean Hunter", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) GAME( 1998, skichamp, 0, model3_20, skichamp, model3_state, skichamp, ROT0, "Sega", "Ski Champ (Japan)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) diff --git a/src/mame/includes/model3.h b/src/mame/includes/model3.h index 096691a831a..f2b63678309 100644 --- a/src/mame/includes/model3.h +++ b/src/mame/includes/model3.h @@ -22,14 +22,6 @@ struct cached_texture rgb_t data[1]; }; -struct m3_plane -{ - float x; - float y; - float z; - float d; -}; - struct m3_vertex { float x; @@ -47,9 +39,11 @@ struct m3_clip_vertex float x; float y; float z; + float w; float u; float v; float i; + float s; }; struct m3_triangle @@ -149,7 +143,7 @@ public: UINT8 m_id_data[32]; INT32 m_id_size; int m_tdo; - UINT8 m_layer_priority; + UINT16 m_layer_priority; UINT32 m_layer_modulate_r; UINT32 m_layer_modulate_g; UINT32 m_layer_modulate_b; @@ -175,12 +169,13 @@ public: int m_list_depth; MATRIX *m_matrix_stack; MATRIX m_coordinate_system; - float m_viewport_focal_length; - int m_viewport_region_x; - int m_viewport_region_y; - int m_viewport_region_width; - int m_viewport_region_height; - m3_plane m_clip_plane[5]; + MATRIX m_projection_matrix; + float m_viewport_x; + float m_viewport_y; + float m_viewport_width; + float m_viewport_height; + float m_viewport_near; + float m_viewport_far; UINT32 m_matrix_base_address; cached_texture *m_texcache[2][1024/32][2048/32]; @@ -249,6 +244,7 @@ public: DECLARE_DRIVER_INIT(daytona2); DECLARE_DRIVER_INIT(eca); DECLARE_DRIVER_INIT(srally2); + DECLARE_DRIVER_INIT(harleya); DECLARE_DRIVER_INIT(skichamp); DECLARE_DRIVER_INIT(spikeofe); DECLARE_DRIVER_INIT(scud); @@ -302,11 +298,12 @@ public: void reset_triangle_buffers(); m3_triangle* push_triangle(bool alpha); void draw_layers(bitmap_rgb32 &bitmap, const rectangle &cliprect); - void draw_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer, int bitdepth, int sx, int sy); + void draw_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer, int sx, int sy, int prio); void draw_3d_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect); void invalidate_texture(int page, int texx, int texy, int texwidth, int texheight); cached_texture *get_texture(int page, int texx, int texy, int texwidth, int texheight, int format); inline void write_texture16(int xpos, int ypos, int width, int height, int page, UINT16 *data); + inline void write_texture8(int xpos, int ypos, int width, int height, int page, int upper, int lower, UINT16 *data); void real3d_upload_texture(UINT32 header, UINT32 *data); void init_matrix_stack(); void get_top_matrix(MATRIX *out); @@ -316,6 +313,7 @@ public: void translate_matrix_stack(float x, float y, float z); void draw_model(UINT32 addr); UINT32 *get_memory_pointer(UINT32 address); + void set_projection(float left, float right, float top, float bottom, float near, float far); void load_matrix(int matrix_num, MATRIX *out); void traverse_list4(int lod_num, UINT32 address); void traverse_list(UINT32 address); diff --git a/src/mame/video/model3.c b/src/mame/video/model3.c index 70da1deaacf..940a015d4e7 100644 --- a/src/mame/video/model3.c +++ b/src/mame/video/model3.c @@ -5,6 +5,18 @@ #include "video/rgbutil.h" #include "includes/model3.h" +/* + TODO: + - Tilemap flash effect + - Fog + - Mipmapping + - Mipmap uploads smaller than a tile + - Some of the 4-bit and 8-bit textures need their alpha values rechecked + - Spotlights + - Recheck normal vector transform + +*/ + #define ENABLE_BILINEAR 1 #define TRI_PARAM_TEXTURE_PAGE 0x1 @@ -12,8 +24,9 @@ #define TRI_PARAM_TEXTURE_MIRROR_V 0x4 #define TRI_PARAM_TEXTURE_ENABLE 0x8 #define TRI_PARAM_ALPHA_TEST 0x10 +#define TRI_PARAM_COLOR_MOD 0x20 -#define TRI_BUFFER_SIZE 35000 +#define TRI_BUFFER_SIZE 50000 #define TRI_ALPHA_BUFFER_SIZE 15000 struct model3_polydata @@ -41,7 +54,9 @@ public: void clear_fb(); void clear_zb(); void draw_scanline_solid(INT32 scanline, const extent_t &extent, const model3_polydata &extradata, int threadid); + void draw_scanline_solid_trans(INT32 scanline, const extent_t &extent, const model3_polydata &extradata, int threadid); void draw_scanline_tex(INT32 scanline, const extent_t &extent, const model3_polydata &extradata, int threadid); + void draw_scanline_tex_colormod(INT32 scanline, const extent_t &extent, const model3_polydata &extradata, int threadid); void draw_scanline_tex_contour(INT32 scanline, const extent_t &extent, const model3_polydata &extradata, int threadid); void draw_scanline_tex_trans(INT32 scanline, const extent_t &extent, const model3_polydata &extradata, int threadid); void draw_scanline_tex_alpha(INT32 scanline, const extent_t &extent, const model3_polydata &extradata, int threadid); @@ -136,7 +151,7 @@ void model3_state::video_start() static const gfx_layout char4_layout = { 8, 8, - 30720, + 31744, 4, { 0,1,2,3 }, { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 }, @@ -147,7 +162,7 @@ void model3_state::video_start() static const gfx_layout char8_layout = { 8, 8, - 15360, + 15872, 8, { 0,1,2,3,4,5,6,7 }, { 4*8, 5*8, 6*8, 7*8, 0*8, 1*8, 2*8, 3*8 }, @@ -183,12 +198,6 @@ void model3_state::video_start() m_vid_reg0 = 0; - m_viewport_focal_length = 300.; - m_viewport_region_x = 0; - m_viewport_region_y = 0; - m_viewport_region_width = 496; - m_viewport_region_height = 384; - m_layer4[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(model3_state::tile_info_layer0_4bit), this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); m_layer8[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(model3_state::tile_info_layer0_8bit), this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); m_layer4[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(model3_state::tile_info_layer1_4bit), this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); @@ -253,14 +262,18 @@ void model3_state::draw_texture_sheet(bitmap_ind16 &bitmap, const rectangle &cli } #endif -void model3_state::draw_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer, int bitdepth, int sx, int sy) +void model3_state::draw_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer, int sx, int sy, int prio) { + int bitdepth = (m_layer_priority & (0x10 << layer)) ? 1 : 0; +// int layer_prio = (m_layer_priority & (0x1 << layer)) ? 1 : 0; + tilemap_t *tmap = bitdepth ? m_layer4[layer] : m_layer8[layer]; bitmap_ind16 &pixmap = tmap->pixmap(); const pen_t *pens = m_palette->pens(); UINT32* palram = (UINT32*)&m_paletteram64[0]; UINT16* rowscroll_ram = (UINT16*)&m_m3_char_ram[0x1ec00]; + UINT32* rowmask_ram = (UINT32*)&m_m3_char_ram[0x1ee00]; int x1 = cliprect.min_x; int y1 = cliprect.min_y; @@ -287,6 +300,12 @@ void model3_state::draw_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, i if (rowscroll & 0x100) rowscroll |= ~0x1ff; + UINT16 rowmask; + if (prio && (layer == 1 || layer == 2)) + rowmask = BYTE_REVERSE32(rowmask_ram[(y & 0x1ff) ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)]) & 0xffff; + else + rowmask = 0xffff; + int iix = ix & 0x1ff; int rx1 = x1 - (rowscroll * 2); @@ -302,10 +321,15 @@ void model3_state::draw_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, i for (int x = rx1; x <= rx2; x++) { - UINT16 p0 = src[iix & 0x1ff]; - if ((palram[p0^NATIVE_ENDIAN_VALUE_LE_BE(1,0)] & NATIVE_ENDIAN_VALUE_LE_BE(0x00800000,0x00008000)) == 0) + UINT32 mask = rowmask & (1 << ((iix & 0x1ff) >> 5)); + + if (mask) { - dst[x] = pens[p0]; + UINT16 p0 = src[iix & 0x1ff]; + if ((palram[p0^NATIVE_ENDIAN_VALUE_LE_BE(1,0)] & NATIVE_ENDIAN_VALUE_LE_BE(0x00800000,0x00008000)) == 0) + { + dst[x] = pens[p0]; + } } iix++; } @@ -339,26 +363,26 @@ UINT32 model3_state::screen_update_model3(screen_device &screen, bitmap_rgb32 &b // render enabled layers with priority 0 if ((layer_data[3] & 0x80000000) && (m_layer_priority & 0x8) == 0) - draw_layer(bitmap, cliprect, 3, m_layer_priority & 0x80, layer_scroll_x[3], layer_scroll_y[3]); + draw_layer(bitmap, cliprect, 3, layer_scroll_x[3], layer_scroll_y[3], 0); if ((layer_data[2] & 0x80000000) && (m_layer_priority & 0x4) == 0) - draw_layer(bitmap, cliprect, 2, m_layer_priority & 0x40, layer_scroll_x[2], layer_scroll_y[2]); + draw_layer(bitmap, cliprect, 2, layer_scroll_x[2], layer_scroll_y[2], 0); if ((layer_data[1] & 0x80000000) && (m_layer_priority & 0x2) == 0) - draw_layer(bitmap, cliprect, 1, m_layer_priority & 0x20, layer_scroll_x[1], layer_scroll_y[1]); + draw_layer(bitmap, cliprect, 1, layer_scroll_x[1], layer_scroll_y[1], 0); if ((layer_data[0] & 0x80000000) && (m_layer_priority & 0x1) == 0) - draw_layer(bitmap, cliprect, 0, m_layer_priority & 0x10, layer_scroll_x[0], layer_scroll_y[0]); + draw_layer(bitmap, cliprect, 0, layer_scroll_x[0], layer_scroll_y[0], 0); // render 3D m_renderer->draw(bitmap, cliprect); // render enabled layers with priority 1 if ((layer_data[3] & 0x80000000) && (m_layer_priority & 0x8) != 0) - draw_layer(bitmap, cliprect, 3, m_layer_priority & 0x80, layer_scroll_x[3], layer_scroll_y[3]); + draw_layer(bitmap, cliprect, 3, layer_scroll_x[3], layer_scroll_y[3], 1); if ((layer_data[2] & 0x80000000) && (m_layer_priority & 0x4) != 0) - draw_layer(bitmap, cliprect, 2, m_layer_priority & 0x40, layer_scroll_x[2], layer_scroll_y[2]); - if ((layer_data[1] & 0x80000000) && (m_layer_priority & 0x2) != 0) - draw_layer(bitmap, cliprect, 1, m_layer_priority & 0x20, layer_scroll_x[1], layer_scroll_y[1]); + draw_layer(bitmap, cliprect, 2, layer_scroll_x[2], layer_scroll_y[2], 1); if ((layer_data[0] & 0x80000000) && (m_layer_priority & 0x1) != 0) - draw_layer(bitmap, cliprect, 0, m_layer_priority & 0x10, layer_scroll_x[0], layer_scroll_y[0]); + draw_layer(bitmap, cliprect, 0, layer_scroll_x[0], layer_scroll_y[0], 1); + if ((layer_data[1] & 0x80000000) && (m_layer_priority & 0x2) != 0) + draw_layer(bitmap, cliprect, 1, layer_scroll_x[1], layer_scroll_y[1], 1); return 0; } @@ -422,7 +446,8 @@ WRITE64_MEMBER(model3_state::model3_tile_w) 0xF1180010: VBL IRQ acknowledge - 0xF1180020: -------- x------- -------- -------- Layer 3 bitdepth (0 = 8-bit, 1 = 4-bit) + 0xF1180020: xxxxxxxx -------- -------- -------- ? + -------- x------- -------- -------- Layer 3 bitdepth (0 = 8-bit, 1 = 4-bit) -------- -x------ -------- -------- Layer 2 bitdepth (0 = 8-bit, 1 = 4-bit) -------- --x----- -------- -------- Layer 1 bitdepth (0 = 8-bit, 1 = 4-bit) -------- ---x---- -------- -------- Layer 0 bitdepth (0 = 8-bit, 1 = 4-bit) @@ -571,50 +596,53 @@ cached_texture *model3_state::get_texture(int page, int texx, int texy, int texw } break; - case 1: /* 4-bit grayscale in low nibble */ + case 1: /* A4L4 interleaved */ for (x = 0; x < pixwidth; x++) { - UINT8 grayvalue = pal4bit(texsrc[x] >> 0); - alpha &= dest[x] = rgb_t(0xff, grayvalue, grayvalue, grayvalue); + UINT8 grayvalue = pal4bit(texsrc[x] & 0xf); + UINT8 a = pal4bit((texsrc[x] >> 4) & 0xf); + alpha &= dest[x] = rgb_t(a, grayvalue, grayvalue, grayvalue); } break; - case 2: /* 4-bit grayscale in 2nd nibble */ + case 2: /* A4L4? */ for (x = 0; x < pixwidth; x++) { - UINT8 grayvalue = pal4bit(texsrc[x] >> 4); - alpha &= dest[x] = rgb_t(0xff, grayvalue, grayvalue, grayvalue); + UINT8 grayvalue = pal4bit((texsrc[x] >> 0) & 0xf); + UINT8 a = pal4bit((texsrc[x] >> 4) & 0xf); + alpha &= dest[x] = rgb_t(a, grayvalue, grayvalue, grayvalue); } break; - case 3: /* 4-bit grayscale in 3rd nibble */ + case 3: /* A4L4 interleaved */ for (x = 0; x < pixwidth; x++) { - UINT8 grayvalue = pal4bit(texsrc[x] >> 8); - alpha &= dest[x] = rgb_t(0xff, grayvalue, grayvalue, grayvalue); + UINT8 grayvalue = pal4bit((texsrc[x] >> 8) & 0xf); + UINT8 a = pal4bit((texsrc[x] >> 12) & 0xf); + alpha &= dest[x] = rgb_t(a, grayvalue, grayvalue, grayvalue); } break; case 4: /* 8-bit A4L4 */ for (x = 0; x < pixwidth; x++) { - UINT8 pixdata = texsrc[x / 2] >> ((~x & 1) * 8); - alpha &= dest[x] = rgb_t(pal4bit(pixdata >> 4), pal4bit(~pixdata), pal4bit(~pixdata), pal4bit(~pixdata)); + UINT8 pixdata = texsrc[x] >> 8; + alpha &= dest[x] = rgb_t(pal4bit(pixdata), pal4bit(pixdata >> 4), pal4bit(pixdata >> 4), pal4bit(pixdata >> 4)); } break; - case 5: /* 8-bit grayscale */ + case 5: /* L8 */ for (x = 0; x < pixwidth; x++) { - UINT8 grayvalue = texsrc[x / 2] >> ((~x & 1) * 8); + UINT8 grayvalue = texsrc[x]; alpha &= dest[x] = rgb_t(0xff, grayvalue, grayvalue, grayvalue); } break; - case 6: /* 4-bit grayscale in high nibble */ + case 6: /* L8 */ for (x = 0; x < pixwidth; x++) { - UINT8 grayvalue = pal4bit(texsrc[x] >> 12); + UINT8 grayvalue = texsrc[x] >> 8; alpha &= dest[x] = rgb_t(0xff, grayvalue, grayvalue, grayvalue); } break; @@ -688,23 +716,23 @@ cached_texture *model3_state::get_texture(int page, int texx, int texy, int texw 0x01: Child node pointer (inherits parameters from this node) 0x02: Sibling node pointer - 0x03: Unknown (float) + 0x03: (float) Focal length? Affected by frustum angles and viewport size 0x04: Sun light vector Z-component (float) 0x05: Sun light vector X-component (float) 0x06: Sun light vector Y-component (float) 0x07: Sun light intensity (float) - 0x08: Far Clip plane Z - 0x09: Far Clip plane Distance - 0x0a: Near Clip plane Z - 0x0b: Near Clip plane Distance - 0x0c: Left Clip plane Z - 0x0d: Left Clip plane X - 0x0e: Top Clip plane Z - 0x0f: Top Clip plane Y - 0x10: Right Clip plane Z - 0x11: Right Clip plane X - 0x12: Bottom Clip plane Z - 0x13: Bottom Clip plane Y + 0x08: ? (float) Affected by left and right angle + 0x09: ? (float) Affected by top and bottom angle + 0x0a: ? (float) Affected by top and bottom angle + 0x0b: ? (float) Affected by left and right angle + 0x0c: (float) Frustum Left Angle Y (these angles are defined in polar coordinates) + 0x0d: (float) Frustum Left Angle X + 0x0e: (float) Frustum Top Angle Y + 0x0f: (float) Frustum Top Angle X + 0x10: (float) Frustum Right Angle Y + 0x11: (float) Frustum Right Angle X + 0x12: (float) Frustum Bottom Angle Y + 0x13: (float) Frustum Bottom Angle X 0x14: xxxxxxxx xxxxxxxx -------- -------- Viewport height (14.2 fixed-point) -------- -------- xxxxxxxx xxxxxxxx Viewport width (14.2 fixed-point) @@ -735,7 +763,7 @@ cached_texture *model3_state::get_texture(int page, int texx, int texy, int texw -------- -------- -----xxx -------- Light RGB Fog (RGB111?) -------- -------- -------- xxxxxxxx Scroll Fog (0.8 fixed-point?) What is this??? - 0x21: ? + 0x21: ? seen 8.0, 0.125, 1000000000.0 0x22: Fog Color (RGB888) 0x23: Fog Density (float) @@ -818,19 +846,24 @@ cached_texture *model3_state::get_texture(int page, int texx, int texy, int texw Polygon Data - 0x00: -------- xxxxxxxx xxxxxx-- -------- Polygon ID + 0x00: x------- -------- -------- -------- Supermodel says specular enable + -xxxxx-- -------- -------- -------- ? + ------xx xxxxxxxx xxxxxx-- -------- Polygon ID -------- -------- -------- -x------ 0 = Triangle, 1 = Quad -------- -------- -------- ----x--- Vertex 3 shared from previous polygon -------- -------- -------- -----x-- Vertex 2 shared from previous polygon -------- -------- -------- ------x- Vertex 1 shared from previous polygon -------- -------- -------- -------x Vertex 0 shared from previous polygon - xxxxxxxx -------- -------- x-xx---- ? + -------- -------- -------- x-xx---- ? -------- -------- ------xx -------- Broken polygons in srally2 set these (a way to mark them for HW to not render?) 0x01: xxxxxxxx xxxxxxxx xxxxxxxx -------- Polygon normal X coordinate (2.22 fixed point) -------- -------- -------- -x------ UV format (0 = 13.3, 1 = 16.0) + -------- -------- -------- ---x---- 1 = Double-sided polygon -------- -------- -------- -----x-- If set, this is the last polygon - -------- -------- -------- x-xxx-xx ? + -------- -------- -------- ------x- Poly color, 1 = RGB, 0 = color table + -------- -------- -------- x-x-x--x ? + 0x02: xxxxxxxx xxxxxxxx xxxxxxxx -------- Polygon normal Y coordinate (2.22 fixed point) -------- -------- -------- ------x- Texture U mirror enable @@ -844,7 +877,8 @@ cached_texture *model3_state::get_texture(int page, int texx, int texy, int texw 0x04: xxxxxxxx xxxxxxxx xxxxxxxx -------- Color (RGB888) -------- -------- -------- -x------ Texture page -------- -------- -------- ---xxxxx Upper 5 bits of texture U coordinate - -------- -------- -------- x-x----- ? + -------- -------- -------- x------- ? + -------- -------- -------- --x----- ? 0x05: xxxxxxxx xxxxxxxx xxxxxxxx -------- Specular color? -------- -------- -------- x------- Low bit of texture U coordinate @@ -852,15 +886,28 @@ cached_texture *model3_state::get_texture(int page, int texx, int texy, int texw -------- -------- -------- -xx----- ? 0x06: x------- -------- -------- -------- Texture contour enable - -xxxxxxx -------- -------- -------- Specularity? + -xxxxx-- -------- -------- -------- Fixed shading? + ------x- -------- -------- -------- Enable fixed shading? + -------x -------- -------- -------- Could be high priority polygon? -------- x------- -------- -------- 1 = disable transparency? - -------- -xxxxx-- -------- -------- Polygon transparency (0 = fully transparent) + -------- -xxxxx-- -------- -------- Polygon translucency (0 = fully transparent) -------- -------x -------- -------- 1 = disable lighting - -------- -------- xxxxx--- -------- Polygon luminosity - -------- -------- -----x-- -------- Texture enable + -------- -------- xxxxx--- -------- Polygon light modifier (Amount that a luminous polygon will burn through fog. + Valid range is 0.0 to 1.0. 0.0 is completely fogged; + 1.0 has no fog.) + -------- -------- -----x-- -------- Texture enable -------- -------- ------xx x------- Texture format -------- -------- -------- -------x Alpha enable? - -------- ------x- -------- -xxxxxx- ? + -------- ------x- -------- -------- Never seen set? + -------- -------- -------- -----xx- Always set? + -------- -------- -------- -xxxx--- ? + + TODO: Bits to find (from Real3D dev guide): + SetHighPriority(): Indicates that the polygon has higher priority than others in scene + PolygonIsLayered(): Indicates a stencil polygon. + DoSmoothShading(): Indicates that the polygon will be smooth shaded + void SetNPScale ( float np_scale ) ; Sets the texture lod scale for the polygon. A value greater than 1 will increase the + range of the transition of texture level of detail. Vertex entry @@ -904,10 +951,10 @@ WRITE64_MEMBER(model3_state::real3d_polygon_ram_w) } } -static const UINT8 texture_decode[64] = +static const UINT8 texture_decode16[64] = { - 0, 1, 4, 5, 8, 9, 12, 13, - 2, 3, 6, 7, 10, 11, 14, 15, + 0, 1, 4, 5, 8, 9, 12, 13, + 2, 3, 6, 7, 10, 11, 14, 15, 16, 17, 20, 21, 24, 25, 28, 29, 18, 19, 22, 23, 26, 27, 30, 31, 32, 33, 36, 37, 40, 41, 44, 45, @@ -916,6 +963,18 @@ static const UINT8 texture_decode[64] = 50, 51, 54, 55, 58, 59, 62, 63 }; +static const UINT8 texture_decode8[32] = +{ + 1, 3, 5, 7, + 0, 2, 4, 6, + 9, 11, 13, 15, + 8, 10, 12, 14, + 17, 19, 21, 23, + 16, 18, 20, 22, + 25, 27, 29, 31, + 24, 26, 28, 30 +}; + inline void model3_state::write_texture16(int xpos, int ypos, int width, int height, int page, UINT16 *data) { int x,y,i,j; @@ -928,7 +987,7 @@ inline void model3_state::write_texture16(int xpos, int ypos, int width, int hei int b = 0; for(j=y; j < y+8; j++) { for(i=x; i < x+8; i++) { - *texture++ = data[texture_decode[b^1]]; + *texture++ = data[texture_decode16[b^1]]; ++b; } texture += 2048-8; @@ -938,28 +997,76 @@ inline void model3_state::write_texture16(int xpos, int ypos, int width, int hei } } -#ifdef UNUSED_FUNCTION -inline void model3_state::write_texture8(int xpos, int ypos, int width, int height, int page, UINT16 *data) +inline void model3_state::write_texture8(int xpos, int ypos, int width, int height, int page, int upper, int lower, UINT16 *data) { int x,y,i,j; - UINT16 color = 0x7c00; - for(y=ypos; y < ypos+(height/2); y+=4) + for(y=ypos; y < ypos+height; y+=8) { for(x=xpos; x < xpos+width; x+=8) { UINT16 *texture = &m_texture_ram[page][y*2048+x]; - for(j=y; j < y+4; j++) { - for(i=x; i < x+8; i++) { - *texture = color; + int b = 0; + for(j=y; j < y+8; j++) + { + for(i=x; i < x+8; i+=2) + { + UINT16 d = data[texture_decode8[b]]; + + if (upper) + *texture = (*texture & 0xff) | (d & 0xff00); + if (lower) + *texture = (*texture & 0xff00) | ((d >> 8) & 0xff); texture++; + + if (upper) + *texture = (*texture & 0xff) | ((d & 0xff) << 8); + if (lower) + *texture = (*texture & 0xff00) | (d & 0xff); + texture++; + + ++b; } texture += 2048-8; } + data += 32; } } } -#endif + +/* + Texture header: + + -------- -------- -------- --xxxxxx X-position + -------- -------- ----xxxx x------- Y-position + -------- -------x xx------ -------- Width + -------- ----xxx- -------- -------- Height + -------- ---x---- -------- -------- Texture page + -------- --x----- -------- -------- Write 8-bit data to the lower byte of texel + -------- -x------ -------- -------- Write 8-bit data to the upper byte of texel + -------- x------- -------- -------- Bitdepth, 0 = 8-bit, 1 = 16-bit + xxxxxxxx -------- -------- -------- Texture type + 0x00 = texture with mipmaps + 0x01 = texture without mipmaps + 0x02 = only mipmaps + 0x80 = possibly gamma table + +*/ + +static const int mipmap_coords[9][2] = +{ + { 1024, 512 }, + { 1536, 768 }, + { 1792, 896 }, + { 1920, 960 }, + { 1984, 992 }, + { 2016, 1008 }, + { 2032, 1016 }, + { 2040, 1020 }, + { 2044, 1022 }, +}; + +static const int mipmap_divider[9] = { 2, 4, 8, 16, 32, 64, 128, 256, 512 }; void model3_state::real3d_upload_texture(UINT32 header, UINT32 *data) { @@ -968,36 +1075,100 @@ void model3_state::real3d_upload_texture(UINT32 header, UINT32 *data) int xpos = (header & 0x3f) * 32; int ypos = ((header >> 7) & 0x1f) * 32; int page = (header >> 20) & 0x1; - //int bitdepth = (header >> 23) & 0x1; + int bitdepth = (header >> 23) & 0x1; + int upper_byte = (header >> 22) & 0x1; + int lower_byte = (header >> 21) & 0x1; + + //printf("write tex: %08X, w %d, h %d, x %d, y %d, p %d, b %d\n", header, width, height, xpos, ypos, page, bitdepth); switch(header >> 24) { case 0x00: /* Texture with mipmaps */ - //if(bitdepth) { - write_texture16(xpos, ypos, width, height, page, (UINT16*)data); - invalidate_texture(page, header & 0x3f, (header >> 7) & 0x1f, (header >> 14) & 0x7, (header >> 17) & 0x7); - //} else { - /* TODO: 8-bit textures are weird. need to figure out some additional bits */ - //logerror("W: %d, H: %d, X: %d, Y: %d, P: %d, Bit: %d, : %08X, %08X\n", width, height, xpos, ypos, page, bitdepth, header & 0x00681040, header); - //write_texture8(xpos, ypos, width, height, page, (UINT16*)data); - //} + { + int x = xpos; + int y = ypos; + int w = width; + int h = height; + + int mipmap = 0; + + while (w >= 8 && h >= 8) + { + if (bitdepth) + { + write_texture16(x, y, w, h, page, (UINT16*)data); + } + else + { + //printf("write tex8: %08X, w %d, h %d, x %d, y %d, p %d, b %d\n", header, width, height, xpos, ypos, page, bitdepth); + write_texture8(x, y, w, h, page, upper_byte, lower_byte, (UINT16*)data); + } + + data += (w * h * (bitdepth ? 2 : 1)) / 4; + w /= 2; + h /= 2; + + x = mipmap_coords[mipmap][0] + (xpos / mipmap_divider[mipmap]); + y = mipmap_coords[mipmap][1] + (ypos / mipmap_divider[mipmap]); + mipmap++; + } + + invalidate_texture(page, header & 0x3f, (header >> 7) & 0x1f, (header >> 14) & 0x7, (header >> 17) & 0x7); break; + } case 0x01: /* Texture without mipmaps */ - //if(bitdepth) { + { + if (bitdepth) + { write_texture16(xpos, ypos, width, height, page, (UINT16*)data); - invalidate_texture(page, header & 0x3f, (header >> 7) & 0x1f, (header >> 14) & 0x7, (header >> 17) & 0x7); - //} else { - /* TODO: 8-bit textures are weird. need to figure out some additional bits */ - //logerror("W: %d, H: %d, X: %d, Y: %d, P: %d, Bit: %d, : %08X, %08X\n", width, height, xpos, ypos, page, bitdepth, header & 0x00681040, header); - //write_texture8(xpos, ypos, width, height, page, (UINT16*)data); - //} + } + else + { + //printf("write tex8: %08X, w %d, h %d, x %d, y %d, p %d, b %d\n", header, width, height, xpos, ypos, page, bitdepth); + write_texture8(xpos, ypos, width, height, page, upper_byte, lower_byte, (UINT16*)data); + } + + invalidate_texture(page, header & 0x3f, (header >> 7) & 0x1f, (header >> 14) & 0x7, (header >> 17) & 0x7); break; + } case 0x02: /* Only mipmaps */ + { + int x = mipmap_coords[0][0] + (xpos / mipmap_divider[0]); + int y = mipmap_coords[0][1] + (ypos / mipmap_divider[0]); + int w = width / 2; + int h = height / 2; + + int mipmap = 1; + + while (w >= 8 && h >= 8) + { + if (bitdepth) + { + write_texture16(x, y, w, h, page, (UINT16*)data); + } + else + { + //printf("write tex8: %08X, w %d, h %d, x %d, y %d, p %d, b %d\n", header, width, height, xpos, ypos, page, bitdepth); + write_texture8(x, y, w, h, page, upper_byte, lower_byte, (UINT16*)data); + } + + data += (w * h * (bitdepth ? 2 : 1)) / 4; + w /= 2; + h /= 2; + + x = mipmap_coords[mipmap][0] + (xpos / mipmap_divider[mipmap]); + y = mipmap_coords[mipmap][1] + (ypos / mipmap_divider[mipmap]); + mipmap++; + } + + invalidate_texture(page, header & 0x3f, (header >> 7) & 0x1f, (header >> 14) & 0x7, (header >> 17) & 0x7); break; + } case 0x80: /* Gamma-table ? */ break; default: - fatalerror("Unknown texture type: %02X\n", header >> 24); + fatalerror("Unknown texture type: %02X (%08X)\n", header >> 24, header); + break; } } @@ -1022,13 +1193,6 @@ void model3_state::real3d_display_list_end() reset_triangle_buffers(); real3d_traverse_display_list(); - /* - m_renderer->draw_opaque_triangles(m_tri_buffer, m_tri_buffer_ptr); - m_renderer->draw_alpha_triangles(m_tri_alpha_buffer, m_tri_alpha_buffer_ptr); - - m_renderer->wait_for_polys(); - */ - for (int i=0; i < 4; i++) { int ticount, tiacount; @@ -1241,78 +1405,145 @@ void model3_state::translate_matrix_stack(float x, float y, float z) matrix_multiply(tm, m_matrix_stack[m_matrix_stack_ptr], &m_matrix_stack[m_matrix_stack_ptr]); } +void model3_state::set_projection(float left, float right, float top, float bottom, float near, float far) +{ + float l = near * tanf(left * 0.5f); + float r = near * tanf(right * 0.5f); + float t = near * tanf(top * 0.5f ); + float b = near * tanf(bottom * 0.5f); + + m_projection_matrix[0][0] = (2.0f * near) / (l - r); + m_projection_matrix[0][1] = 0.0f; + m_projection_matrix[0][2] = (r + l) / (r - l); + m_projection_matrix[0][3] = 0.0f; + m_projection_matrix[1][0] = 0.0f; + m_projection_matrix[1][1] = (2.0f * near) / (t - b); + m_projection_matrix[1][2] = (t + b) / (t - b); + m_projection_matrix[1][3] = 0.0f; + m_projection_matrix[2][0] = 0.0f; + m_projection_matrix[2][1] = 0.0f; + m_projection_matrix[2][2] = -(far + near) / (far - near); + m_projection_matrix[2][3] = -(2.0f * far * near) / (far - near); + m_projection_matrix[3][0] = 0.0f; + m_projection_matrix[3][1] = 0.0f; + m_projection_matrix[3][2] = -1.0f; + m_projection_matrix[3][3] = 0.0f; +} + /*****************************************************************************/ /* transformation and rasterizing */ -INLINE bool is_point_inside(float x, float y, float z, m3_plane cp) +static int clip_w(const m3_clip_vertex* v, int num_vertices, m3_clip_vertex* out) { - float s = (x * cp.x) + (y * cp.y) + (z * cp.z) + cp.d; - if (s >= 0.0f) - return true; - else - return false; -} + if (num_vertices <= 0) + return 0; -INLINE float line_plane_intersection(const m3_clip_vertex *v1, const m3_clip_vertex *v2, m3_plane cp) -{ - float x = v1->x - v2->x; - float y = v1->y - v2->y; - float z = v1->z - v2->z; - float t = ((cp.x * v1->x) + (cp.y * v1->y) + (cp.z * v1->z)) / ((cp.x * x) + (cp.y * y) + (cp.z * z)); - return t; -} + const float W_PLANE = 0.000001f; -static int clip_polygon(const m3_clip_vertex *v, int num_vertices, m3_plane cp, m3_clip_vertex *vout) -{ m3_clip_vertex clipv[10]; int clip_verts = 0; - float t; - int i; int previ = num_vertices - 1; - for (i=0; i < num_vertices; i++) + for (int i=0; i < num_vertices; i++) { - bool v1_in = is_point_inside(v[i].x, v[i].y, v[i].z, cp); - bool v2_in = is_point_inside(v[previ].x, v[previ].y, v[previ].z, cp); + int v1_side = (v[i].w < W_PLANE) ? -1 : 1; + int v2_side = (v[previ].w < W_PLANE) ? -1 : 1; - if (v1_in && v2_in) /* edge is completely inside the volume */ + if ((v1_side * v2_side) < 0) // edge goes through W plane { - clipv[clip_verts] = v[i]; + // insert vertex at intersection point + float wdiv = v[previ].w - v[i].w; + if (wdiv == 0.0f) // 0 edge means degenerate polygon + return 0; + + float t = fabs((W_PLANE - v[previ].w) / wdiv); + + clipv[clip_verts].x = v[previ].x + ((v[i].x - v[previ].x) * t); + clipv[clip_verts].y = v[previ].y + ((v[i].y - v[previ].y) * t); + clipv[clip_verts].z = v[previ].z + ((v[i].z - v[previ].z) * t); + clipv[clip_verts].w = v[previ].w + ((v[i].w - v[previ].w) * t); + clipv[clip_verts].u = v[previ].u + ((v[i].u - v[previ].u) * t); + clipv[clip_verts].v = v[previ].v + ((v[i].v - v[previ].v) * t); + clipv[clip_verts].i = v[previ].i + ((v[i].i - v[previ].i) * t); + clipv[clip_verts].s = v[previ].s + ((v[i].s - v[previ].s) * t); ++clip_verts; } - else if (!v1_in && v2_in) /* edge is entering the volume */ + if (v1_side > 0) // current point is inside { - /* insert vertex at intersection point */ - t = line_plane_intersection(&v[i], &v[previ], cp); - clipv[clip_verts].x = v[i].x + ((v[previ].x - v[i].x) * t); - clipv[clip_verts].y = v[i].y + ((v[previ].y - v[i].y) * t); - clipv[clip_verts].z = v[i].z + ((v[previ].z - v[i].z) * t); - clipv[clip_verts].u = v[i].u + ((v[previ].u - v[i].u) * t); - clipv[clip_verts].v = v[i].v + ((v[previ].v - v[i].v) * t); - clipv[clip_verts].i = v[i].i + ((v[previ].i - v[i].i) * t); - ++clip_verts; - } - else if (v1_in && !v2_in) /* edge is leaving the volume */ - { - /* insert vertex at intersection point */ - t = line_plane_intersection(&v[i], &v[previ], cp); - clipv[clip_verts].x = v[i].x + ((v[previ].x - v[i].x) * t); - clipv[clip_verts].y = v[i].y + ((v[previ].y - v[i].y) * t); - clipv[clip_verts].z = v[i].z + ((v[previ].z - v[i].z) * t); - clipv[clip_verts].u = v[i].u + ((v[previ].u - v[i].u) * t); - clipv[clip_verts].v = v[i].v + ((v[previ].v - v[i].v) * t); - clipv[clip_verts].i = v[i].i + ((v[previ].i - v[i].i) * t); - ++clip_verts; - - /* insert the existing vertex */ clipv[clip_verts] = v[i]; ++clip_verts; } previ = i; } - memcpy(&vout[0], &clipv[0], sizeof(vout[0]) * clip_verts); + + memcpy(&out[0], &clipv[0], sizeof(out[0]) * clip_verts); + return clip_verts; +} + +static int clip(const m3_clip_vertex* v, int num_vertices, m3_clip_vertex* out, int axis, int sign) +{ + if (num_vertices <= 0) + return 0; + + m3_clip_vertex clipv[10]; + int clip_verts = 0; + + int previ = num_vertices - 1; + + for (int i=0; i < num_vertices; i++) + { + int v1_side, v2_side; + float* v1a = (float*)&v[i]; + float* v2a = (float*)&v[previ]; + + float v1_axis, v2_axis; + + if (sign) // +axis + { + v1_axis = v1a[axis]; + v2_axis = v2a[axis]; + } + else // -axis + { + v1_axis = -v1a[axis]; + v2_axis = -v2a[axis]; + } + + v1_side = (v1_axis <= v[i].w) ? 1 : -1; + v2_side = (v2_axis <= v[previ].w) ? 1 : -1; + + if ((v1_side * v2_side) < 0) // edge goes through W plane + { + // insert vertex at intersection point + float wdiv = ((v[previ].w - v2_axis) - (v[i].w - v1_axis)); + + if (wdiv == 0.0f) // 0 edge means degenerate polygon + return 0; + + float t = fabs((v[previ].w - v2_axis) / wdiv); + + clipv[clip_verts].x = v[previ].x + ((v[i].x - v[previ].x) * t); + clipv[clip_verts].y = v[previ].y + ((v[i].y - v[previ].y) * t); + clipv[clip_verts].z = v[previ].z + ((v[i].z - v[previ].z) * t); + clipv[clip_verts].w = v[previ].w + ((v[i].w - v[previ].w) * t); + clipv[clip_verts].u = v[previ].u + ((v[i].u - v[previ].u) * t); + clipv[clip_verts].v = v[previ].v + ((v[i].v - v[previ].v) * t); + clipv[clip_verts].i = v[previ].i + ((v[i].i - v[previ].i) * t); + clipv[clip_verts].s = v[previ].s + ((v[i].s - v[previ].s) * t); + ++clip_verts; + } + if (v1_side > 0) // current point is inside + { + clipv[clip_verts] = v[i]; + ++clip_verts; + } + + previ = i; + } + + memcpy(&out[0], &clipv[0], sizeof(out[0]) * clip_verts); return clip_verts; } @@ -1368,7 +1599,14 @@ void model3_state::draw_model(UINT32 addr) m3_clip_vertex clip_vert[10]; MATRIX transform_matrix; - float center_x, center_y; + MATRIX vp_matrix; + MATRIX coord_matrix; + + memset(&coord_matrix, 0, sizeof(coord_matrix)); + coord_matrix[0][0] = m_coordinate_system[0][1]; + coord_matrix[1][1] = m_coordinate_system[1][2]; + coord_matrix[2][2] = -m_coordinate_system[2][0]; + coord_matrix[3][3] = 1.0f; if (m_step < 0x15) // position coordinates are 17.7 fixed-point in Step 1.0 fixed_point_fraction = 1.0f / 128.0f; @@ -1377,9 +1615,9 @@ void model3_state::draw_model(UINT32 addr) get_top_matrix(&transform_matrix); - /* current viewport center coordinates on screen */ - center_x = (float)(m_viewport_region_x + (m_viewport_region_width / 2)); - center_y = (float)(m_viewport_region_y + (m_viewport_region_height / 2)); + // make view-projection matrix + matrix_multiply(transform_matrix, coord_matrix, &transform_matrix); + matrix_multiply(transform_matrix, m_projection_matrix, &vp_matrix); memset(prev_vertex, 0, sizeof(prev_vertex)); @@ -1448,24 +1686,29 @@ void model3_state::draw_model(UINT32 addr) /* Copy current vertices as previous vertices */ memcpy(prev_vertex, vertex, sizeof(m3_vertex) * 4); - color = (header[4] >> 8) & 0xffffff; + if (header[1] & 0x2) + { + color = (header[4] >> 8) & 0xffffff; + } + else + { + int ci = (header[4] >> 8) & 0x7ff; + color = m_polygon_ram[0x400 + ci]; + } + polygon_transparency = (header[6] & 0x800000) ? 32 : ((header[6] >> 18) & 0x1f); /* transform polygon normal to view-space */ sn[0] = (normal[0] * transform_matrix[0][0]) + - (normal[1] * transform_matrix[1][0]) + - (normal[2] * transform_matrix[2][0]); - sn[1] = (normal[0] * transform_matrix[0][1]) + + (normal[1] * transform_matrix[0][1]) + + (normal[2] * transform_matrix[0][2]); + sn[1] = (normal[0] * transform_matrix[1][0]) + (normal[1] * transform_matrix[1][1]) + - (normal[2] * transform_matrix[2][1]); - sn[2] = (normal[0] * transform_matrix[0][2]) + - (normal[1] * transform_matrix[1][2]) + + (normal[2] * transform_matrix[1][2]); + sn[2] = (normal[0] * transform_matrix[2][0]) + + (normal[1] * transform_matrix[2][1]) + (normal[2] * transform_matrix[2][2]); - - sn[0] *= m_coordinate_system[0][1]; - sn[1] *= m_coordinate_system[1][2]; - sn[2] *= m_coordinate_system[2][0]; - + // TODO: depth bias // transform and light vertices for (i = 0; i < num_vertices; i++) @@ -1477,36 +1720,38 @@ void model3_state::draw_model(UINT32 addr) vect[2] = vertex[i].z; vect[3] = 1.0f; - // transform to world-space - matrix_multiply_vector(transform_matrix, vect, &p[i]); + // transform to projection space + matrix_multiply_vector(vp_matrix, vect, &p[i]); + + clip_vert[i].x = p[i][0]; + clip_vert[i].y = p[i][1]; + clip_vert[i].z = p[i][2]; + clip_vert[i].w = p[i][3]; - // apply coordinate system - clip_vert[i].x = p[i][0] * m_coordinate_system[0][1]; - clip_vert[i].y = p[i][1] * m_coordinate_system[1][2]; - clip_vert[i].z = p[i][2] * m_coordinate_system[2][0]; - clip_vert[i].u = vertex[i].u * texture_coord_scale; - clip_vert[i].v = vertex[i].v * texture_coord_scale; + clip_vert[i].u = vertex[i].u * texture_coord_scale * 256.0f; // 8 bits of subtexel accuracy for bilinear filtering + clip_vert[i].v = vertex[i].v * texture_coord_scale * 256.0f; // transform vertex normal VECTOR3 n; n[0] = (vertex[i].nx * transform_matrix[0][0]) + - (vertex[i].ny * transform_matrix[1][0]) + - (vertex[i].nz * transform_matrix[2][0]); - n[0] *= m_coordinate_system[0][1]; - n[1] = (vertex[i].nx * transform_matrix[0][1]) + + (vertex[i].ny * transform_matrix[0][1]) + + (vertex[i].nz * transform_matrix[0][2]); + n[1] = (vertex[i].nx * transform_matrix[1][0]) + (vertex[i].ny * transform_matrix[1][1]) + - (vertex[i].nz * transform_matrix[2][1]); - n[1] *= m_coordinate_system[1][2]; - n[2] = (vertex[i].nx * transform_matrix[0][2]) + - (vertex[i].ny * transform_matrix[1][2]) + + (vertex[i].nz * transform_matrix[1][2]); + n[2] = (vertex[i].nx * transform_matrix[2][0]) + + (vertex[i].ny * transform_matrix[2][1]) + (vertex[i].nz * transform_matrix[2][2]); - n[2] *= m_coordinate_system[2][0]; // lighting float intensity; if ((header[6] & 0x10000) == 0) { float dot = dot_product3(n, m_parallel_light); + + if (header[1] & 0x10) + dot = fabs(dot); + intensity = ((dot * m_parallel_light_intensity) + m_ambient_light_intensity) * 255.0f; if (intensity > 255.0f) { @@ -1519,43 +1764,55 @@ void model3_state::draw_model(UINT32 addr) } else { - // apply luminosity - intensity = ((float)((header[6] >> 11) & 0x1f) / 31.0f) * 255.0f; + intensity = 255.0f; } clip_vert[i].i = intensity; } - /* clip against view frustum */ - num_vertices = clip_polygon(clip_vert, num_vertices, m_clip_plane[0], clip_vert); - num_vertices = clip_polygon(clip_vert, num_vertices, m_clip_plane[1], clip_vert); - num_vertices = clip_polygon(clip_vert, num_vertices, m_clip_plane[2], clip_vert); - num_vertices = clip_polygon(clip_vert, num_vertices, m_clip_plane[3], clip_vert); - num_vertices = clip_polygon(clip_vert, num_vertices, m_clip_plane[4], clip_vert); + /* clip against view frustum */ + num_vertices = clip_w(clip_vert, num_vertices, clip_vert); + num_vertices = clip(clip_vert, num_vertices, clip_vert, 0, 0); // W <= -X + num_vertices = clip(clip_vert, num_vertices, clip_vert, 0, 1); // W <= +X + num_vertices = clip(clip_vert, num_vertices, clip_vert, 1, 0); // W <= -Y + num_vertices = clip(clip_vert, num_vertices, clip_vert, 1, 1); // W <= +X + num_vertices = clip(clip_vert, num_vertices, clip_vert, 2, 0); // W <= -Z + num_vertices = clip(clip_vert, num_vertices, clip_vert, 2, 1); // W <= +Z + /* divide by W, transform to screen coords */ + for(i=0; i < num_vertices; i++) + { + float oow = 1.0f / clip_vert[i].w; + + clip_vert[i].x *= oow; + clip_vert[i].y *= oow; + clip_vert[i].z *= oow; + clip_vert[i].u *= oow; + clip_vert[i].v *= oow; + + clip_vert[i].x = (((clip_vert[i].x * 0.5f) + 0.5f) * m_viewport_width) + m_viewport_x; + clip_vert[i].y = (((clip_vert[i].y * 0.5f) + 0.5f) * m_viewport_height) + m_viewport_y; + clip_vert[i].z = (((clip_vert[i].z * 0.5f) + 0.5f) * (m_viewport_far - m_viewport_near)) + m_viewport_near; + } + /* backface culling */ - if( (header[6] & 0x800000) && (!(header[1] & 0x0010)) ) { - if(sn[0]*clip_vert[0].x + sn[1]*clip_vert[0].y + sn[2]*clip_vert[0].z >0) + if( (header[6] & 0x800000) && (!(header[1] & 0x0010)) ) + { + if (sn[0]*clip_vert[0].x + sn[1]*clip_vert[0].y + sn[2]*clip_vert[0].z > 0) back_face = 1; else back_face = 0; } else + { back_face = 0; //no culling for transparent or two-sided polygons + } + + back_face = 0; if (!back_face) { - /* homogeneous Z-divide, screen-space transformation */ - for(i=0; i < num_vertices; i++) - { - float ooz = 1.0f / clip_vert[i].z; - clip_vert[i].x = ((clip_vert[i].x * ooz) * m_viewport_focal_length) + center_x; - clip_vert[i].y = ((clip_vert[i].y * ooz) * m_viewport_focal_length) + center_y; - clip_vert[i].u *= ooz; - clip_vert[i].v *= ooz; - } - - + bool colormod = false; cached_texture* texture; if (header[6] & 0x0000400) @@ -1566,6 +1823,9 @@ void model3_state::draw_model(UINT32 addr) int tex_height = (header[3] & 0x7); int tex_format = (header[6] >> 7) & 0x7; + if (tex_format != 0 && tex_format != 7) // enable color modulation if this is not a color texture + colormod = true; + if (tex_width >= 6 || tex_height >= 6) // srally2 poly ram has degenerate polys with 2k tex size (cpu bug or intended?) return; @@ -1577,8 +1837,8 @@ void model3_state::draw_model(UINT32 addr) } for (i=2; i < num_vertices; i++) - { - bool alpha = (header[6] & 0x1) || (header[6] & 0x80000000); // put to alpha buffer if there's any transparency involved + { + bool alpha = (header[6] & 0x1) || ((header[6] & 0x800000) == 0); // put to alpha buffer if there's any transparency involved m3_triangle* tri = push_triangle(alpha); // bail out if tri buffer is maxed out (happens during harley boot) @@ -1593,12 +1853,13 @@ void model3_state::draw_model(UINT32 addr) tri->transparency = polygon_transparency; tri->color = color; - tri->param = 0; - tri->param |= (header[4] & 0x40) ? TRI_PARAM_TEXTURE_PAGE : 0; - tri->param |= (header[6] & 0x00000400) ? TRI_PARAM_TEXTURE_ENABLE : 0; - tri->param |= (header[2] & 0x2) ? TRI_PARAM_TEXTURE_MIRROR_U : 0; - tri->param |= (header[2] & 0x1) ? TRI_PARAM_TEXTURE_MIRROR_V : 0; - tri->param |= (header[6] & 0x80000000) ? TRI_PARAM_ALPHA_TEST : 0; + tri->param = 0; + tri->param |= (header[4] & 0x40) ? TRI_PARAM_TEXTURE_PAGE : 0; + tri->param |= (header[6] & 0x00000400) ? TRI_PARAM_TEXTURE_ENABLE : 0; + tri->param |= (header[2] & 0x2) ? TRI_PARAM_TEXTURE_MIRROR_U : 0; + tri->param |= (header[2] & 0x1) ? TRI_PARAM_TEXTURE_MIRROR_V : 0; + tri->param |= (header[6] & 0x80000000) ? TRI_PARAM_ALPHA_TEST : 0; + tri->param |= (colormod) ? TRI_PARAM_COLOR_MOD : 0; } } } @@ -1754,8 +2015,6 @@ void model3_state::draw_viewport(int pri, UINT32 address) { const UINT32 *node = get_memory_pointer(address); UINT32 link_address; - float /*viewport_left, viewport_right, */viewport_top, viewport_bottom; - float /*fov_x,*/ fov_y; link_address = node[1]; @@ -1769,28 +2028,33 @@ void model3_state::draw_viewport(int pri, UINT32 address) return; /* set viewport parameters */ - m_viewport_region_x = (node[26] & 0xffff) >> 4; /* 12.4 fixed point */ - m_viewport_region_y = ((node[26] >> 16) & 0xffff) >> 4; - m_viewport_region_width = (node[20] & 0xffff) >> 2; /* 14.2 fixed point */ - m_viewport_region_height = ((node[20] >> 16) & 0xffff) >> 2; + m_viewport_x = (float)(node[26] & 0xffff) / 16.0f; /* 12.4 fixed point */ + m_viewport_y = (float)((node[26] >> 16) & 0xffff) / 16.0f; + m_viewport_width = (float)(node[20] & 0xffff) / 4.0f; /* 14.2 fixed point */ + m_viewport_height = (float)((node[20] >> 16) & 0xffff) / 4.0f; - /* frustum plane angles */ - //viewport_left = RADIAN_TO_DEGREE(asin(*(float *)&node[12])); - //viewport_right = RADIAN_TO_DEGREE(asin(*(float *)&node[16])); - viewport_top = RADIAN_TO_DEGREE(asin(*(float *)&node[14])); - viewport_bottom = RADIAN_TO_DEGREE(asin(*(float *)&node[18])); + m_viewport_near = 1.0f; + m_viewport_far = 100000.0f; - /* build clipping planes */ - m_clip_plane[0].x = *(float *)&node[13]; m_clip_plane[0].y = 0.0f; m_clip_plane[0].z = *(float *)&node[12]; m_clip_plane[0].d = 0.0f; - m_clip_plane[1].x = *(float *)&node[17]; m_clip_plane[1].y = 0.0f; m_clip_plane[1].z = *(float *)&node[16]; m_clip_plane[1].d = 0.0f; - m_clip_plane[2].x = 0.0f; m_clip_plane[2].y = *(float *)&node[15]; m_clip_plane[2].z = *(float *)&node[14]; m_clip_plane[2].d = 0.0f; - m_clip_plane[3].x = 0.0f; m_clip_plane[3].y = *(float *)&node[19]; m_clip_plane[3].z = *(float *)&node[18]; m_clip_plane[3].d = 0.0f; - m_clip_plane[4].x = 0.0f; m_clip_plane[4].y = 0.0f; m_clip_plane[4].z = 1.0f; m_clip_plane[4].d = 1.0f; + /* set up frustum */ + float frustum_left = atan2(*(float *)&node[12], *(float *)&node[13]); + float frustum_right = -atan2(*(float *)&node[16], -*(float *)&node[17]); + float frustum_top = atan2(*(float *)&node[14], *(float *)&node[15]); + float frustum_bottom = -atan2(*(float *)&node[18], -*(float *)&node[19]); +// float frustum_1 = atan2(*(float *)&node[9], *(float *)&node[8]); +// float frustum_2 = atan2(*(float *)&node[11], *(float *)&node[10]); + + /* + printf("%f\n", *(float *)&node[3]); + printf("0: %f, 1: %f, 2: %f, 3: %f\n", *(float *)&node[8], *(float *)&node[9], *(float *)&node[10], *(float *)&node[11]); + printf("4: %f, 5: %f, 6: %f, 7: %f\n", *(float *)&node[12], *(float *)&node[13], *(float *)&node[14], *(float *)&node[15]); + printf("8: %f, 9: %f, A: %f, B: %f\n", *(float *)&node[16], *(float *)&node[17], *(float *)&node[18], *(float *)&node[19]); + printf("fl = %f, fr = %f, ft = %f, fb = %f\n", RADIAN_TO_DEGREE(frustum_left), RADIAN_TO_DEGREE(frustum_right), RADIAN_TO_DEGREE(frustum_top), RADIAN_TO_DEGREE(frustum_bottom)); + printf("f1 = %f, f2 = %f\n", RADIAN_TO_DEGREE(frustum_1), RADIAN_TO_DEGREE(frustum_2)); + */ + + set_projection(frustum_left, frustum_right, frustum_top, frustum_bottom, m_viewport_near, m_viewport_far); - /* compute field of view */ - //fov_x = viewport_left + viewport_right; - fov_y = viewport_top + viewport_bottom; - m_viewport_focal_length = (m_viewport_region_height / 2) / tan( (fov_y * M_PI / 180.0f) / 2.0f ); m_matrix_base_address = node[22]; /* TODO: where does node[23] point to ? LOD table ? */ @@ -1798,7 +2062,7 @@ void model3_state::draw_viewport(int pri, UINT32 address) /* set lighting parameters */ m_parallel_light[0] = *(float *)&node[5]; m_parallel_light[1] = *(float *)&node[6]; - m_parallel_light[2] = -*(float *)&node[4]; + m_parallel_light[2] = *(float *)&node[4]; m_parallel_light_intensity = *(float *)&node[7]; m_ambient_light_intensity = (UINT8)(node[36] >> 8) / 256.0f; @@ -1893,10 +2157,10 @@ void model3_renderer::draw_opaque_triangles(const m3_triangle* tris, int num_tri { v[i].x = tri->v[i].x; v[i].y = tri->v[i].y; - v[i].p[0] = tri->v[i].z; - v[i].p[1] = 1.0f / tri->v[i].z; - v[i].p[2] = tri->v[i].u * 256.0f; // 8 bits of subtexel precision for bilinear filtering - v[i].p[3] = tri->v[i].v * 256.0f; + v[i].p[0] = tri->v[i].w; + v[i].p[1] = 1.0f / tri->v[i].w; + v[i].p[2] = tri->v[i].u; + v[i].p[3] = tri->v[i].v; v[i].p[4] = tri->v[i].i; } @@ -1904,8 +2168,19 @@ void model3_renderer::draw_opaque_triangles(const m3_triangle* tris, int num_tri extra.texture = tri->texture; extra.transparency = tri->transparency; extra.texture_param = tri->param; + extra.color = tri->color; - render_triangle(cliprect, render_delegate(FUNC(model3_renderer::draw_scanline_tex), this), 5, v[0], v[1], v[2]); + if (tri->param & TRI_PARAM_ALPHA_TEST) + { + render_triangle(cliprect, render_delegate(FUNC(model3_renderer::draw_scanline_tex_contour), this), 5, v[0], v[1], v[2]); + } + else + { + if (tri->param & TRI_PARAM_COLOR_MOD) + render_triangle(cliprect, render_delegate(FUNC(model3_renderer::draw_scanline_tex_colormod), this), 5, v[0], v[1], v[2]); + else + render_triangle(cliprect, render_delegate(FUNC(model3_renderer::draw_scanline_tex), this), 5, v[0], v[1], v[2]); + } } else { @@ -1913,7 +2188,7 @@ void model3_renderer::draw_opaque_triangles(const m3_triangle* tris, int num_tri { v[i].x = tri->v[i].x; v[i].y = tri->v[i].y; - v[i].p[0] = tri->v[i].z; + v[i].p[0] = tri->v[i].w; v[i].p[1] = tri->v[i].i; } @@ -1947,10 +2222,10 @@ void model3_renderer::draw_alpha_triangles(const m3_triangle* tris, int num_tris { v[i].x = tri->v[i].x; v[i].y = tri->v[i].y; - v[i].p[0] = tri->v[i].z; - v[i].p[1] = 1.0f / tri->v[i].z; - v[i].p[2] = tri->v[i].u * 256.0f; // 8 bits of subtexel precision for bilinear filtering - v[i].p[3] = tri->v[i].v * 256.0f; + v[i].p[0] = tri->v[i].w; + v[i].p[1] = 1.0f / tri->v[i].w; + v[i].p[2] = tri->v[i].u; + v[i].p[3] = tri->v[i].v; v[i].p[4] = tri->v[i].i; } @@ -1959,14 +2234,7 @@ void model3_renderer::draw_alpha_triangles(const m3_triangle* tris, int num_tris extra.transparency = tri->transparency; extra.texture_param = tri->param; - if (tri->param & TRI_PARAM_ALPHA_TEST) - { - render_triangle(cliprect, render_delegate(FUNC(model3_renderer::draw_scanline_tex_contour), this), 5, v[0], v[1], v[2]); - } - else - { - render_triangle(cliprect, render_delegate(FUNC(model3_renderer::draw_scanline_tex_alpha), this), 5, v[0], v[1], v[2]); - } + render_triangle(cliprect, render_delegate(FUNC(model3_renderer::draw_scanline_tex_alpha), this), 5, v[0], v[1], v[2]); } else { @@ -1974,15 +2242,15 @@ void model3_renderer::draw_alpha_triangles(const m3_triangle* tris, int num_tris { v[i].x = tri->v[i].x; v[i].y = tri->v[i].y; - v[i].p[0] = tri->v[i].z; + v[i].p[0] = tri->v[i].w; v[i].p[1] = tri->v[i].i; } model3_polydata &extra = object_data_alloc(); extra.color = tri->color; + extra.transparency = tri->transparency; - // TODO: scanline renderer for solid /w transparency - render_triangle(cliprect, render_delegate(FUNC(model3_renderer::draw_scanline_solid), this), 2, v[0], v[1], v[2]); + render_triangle(cliprect, render_delegate(FUNC(model3_renderer::draw_scanline_solid_trans), this), 2, v[0], v[1], v[2]); } } } @@ -1998,36 +2266,62 @@ void model3_renderer::draw_scanline_solid(INT32 scanline, const extent_t &extent float in = extent.param[1].start; float inz = extent.param[1].dpdx; - int pr = polydata.color & 0xff0000; - int pg = polydata.color & 0xff00; - int pb = polydata.color & 0xff; - - int srctrans = polydata.transparency; - int desttrans = 32 - polydata.transparency; + rgbint color; + rgb_to_rgbint(&color, polydata.color); for (int x = extent.startx; x < extent.stopx; x++) { - if (z < zb[x]) + if (z <= zb[x]) { + rgbint c = color; int ii = (int)(in); - int r = (pr * ii) >> 8; - int g = (pg * ii) >> 8; - int b = (pb * ii) >> 8; + rgbint_scale_immediate_and_clamp(&c, ii); - if (srctrans != 0x1f) + fb[x] = 0xff000000 | rgbint_to_rgb_clamp(&c); + zb[x] = z; + } + + in += inz; + z += dz; + } +} + +void model3_renderer::draw_scanline_solid_trans(INT32 scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) +{ + UINT32 *fb = &m_fb->pix32(scanline); + float *zb = (float*)&m_zb->pix32(scanline); + + float z = extent.param[0].start; + float dz = extent.param[0].dpdx; + + float in = extent.param[1].start; + float inz = extent.param[1].dpdx; + + rgbint color; + rgb_to_rgbint(&color, polydata.color); + + int trans = (polydata.transparency << 3) | (polydata.transparency >> 2); + + for (int x = extent.startx; x < extent.stopx; x++) + { + if (z <= zb[x]) + { + rgbint c = color; + + int ii = (int)(in); + + rgbint_scale_immediate_and_clamp(&c, ii); + + if (trans != 0xff) { + rgbint fbcolor; UINT32 orig = fb[x]; - r = (r * srctrans) >> 5; - g = (g * srctrans) >> 5; - b = (b * srctrans) >> 5; - r += ((orig & 0x00ff0000) * desttrans) >> 5; - g += ((orig & 0x0000ff00) * desttrans) >> 5; - b += ((orig & 0x000000ff) * desttrans) >> 5; + rgb_to_rgbint(&fbcolor, orig); + rgbint_blend(&c, &fbcolor, trans); } - fb[x] = 0xff000000 | (r & 0xff0000) | (g & 0xff00) | (b & 0xff); - zb[x] = z; + fb[x] = 0xff000000 | rgbint_to_rgb_clamp(&c); } in += inz; @@ -2090,18 +2384,69 @@ void model3_renderer::draw_scanline_tex(INT32 scanline, const extent_t &extent, for (int x = extent.startx; x < extent.stopx; x++) { - if (z < zb[x]) + if (z <= zb[x]) { UINT32 texel; - TEX_FETCH(); + TEX_FETCH(); // TODO fetch rgbint instead - int ii = in; + rgbint color; + rgb_to_rgbint(&color, texel); - UINT32 r = ((texel & 0xff0000) * ii) >> 8; - UINT32 g = ((texel & 0xff00) * ii) >> 8; - UINT32 b = ((texel & 0xff) * ii) >> 8; + int ii = (int)(in); + rgbint_scale_immediate_and_clamp(&color, ii); - fb[x] = 0xff000000 | (r & 0xff0000) | (g & 0xff00) | (b & 0xff); + fb[x] = 0xff000000 | rgbint_to_rgb_clamp(&color); + zb[x] = z; + } + + ooz += dooz; + uoz += duoz; + voz += dvoz; + in += inz; + z += dz; + } +} + +void model3_renderer::draw_scanline_tex_colormod(INT32 scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) +{ + UINT32 *fb = &m_fb->pix32(scanline); + float *zb = (float*)&m_zb->pix32(scanline); + const cached_texture *texture = polydata.texture; + + float z = extent.param[0].start; + float dz = extent.param[0].dpdx; + float ooz = extent.param[1].start; + float dooz = extent.param[1].dpdx; + float uoz = extent.param[2].start; + float duoz = extent.param[2].dpdx; + float voz = extent.param[3].start; + float dvoz = extent.param[3].dpdx; + float in = extent.param[4].start; + float inz = extent.param[4].dpdx; + + UINT32 umask = (((polydata.texture_param & TRI_PARAM_TEXTURE_MIRROR_U) ? 64 : 32) << texture->width) - 1; + UINT32 vmask = (((polydata.texture_param & TRI_PARAM_TEXTURE_MIRROR_V) ? 64 : 32) << texture->height) - 1; + UINT32 width = 6 + texture->width; + + rgbint polycolor; + rgb_to_rgbint(&polycolor, polydata.color); + + for (int x = extent.startx; x < extent.stopx; x++) + { + if (z <= zb[x]) + { + UINT32 texel; + TEX_FETCH(); // TODO fetch rgbint instead + + rgbint color; + rgb_to_rgbint(&color, texel); + + rgbint_scale_channel_and_clamp(&color, &polycolor); + + int ii = (int)(in); + rgbint_scale_immediate_and_clamp(&color, ii); + + fb[x] = 0xff000000 | rgbint_to_rgb_clamp(&color); zb[x] = z; } @@ -2134,9 +2479,12 @@ void model3_renderer::draw_scanline_tex_contour(INT32 scanline, const extent_t & UINT32 vmask = (((polydata.texture_param & TRI_PARAM_TEXTURE_MIRROR_V) ? 64 : 32) << texture->height) - 1; UINT32 width = 6 + texture->width; + rgbint polycolor; + rgb_to_rgbint(&polycolor, polydata.color); + for (int x = extent.startx; x < extent.stopx; x++) { - if (z < zb[x]) + if (z <= zb[x]) { UINT32 texel; TEX_FETCH(); @@ -2144,19 +2492,20 @@ void model3_renderer::draw_scanline_tex_contour(INT32 scanline, const extent_t & UINT32 fa = texel >> 24; if (fa >= 0xf8) { - UINT32 r = ((texel & 0x00ff0000) * fa) >> 8; - UINT32 g = ((texel & 0x0000ff00) * fa) >> 8; - UINT32 b = ((texel & 0x000000ff) * fa) >> 8; + rgbint color; + rgb_to_rgbint(&color, texel); + + rgbint_scale_channel_and_clamp(&color, &polycolor); + int ii = (int)(in); + rgbint_scale_immediate_and_clamp(&color, ii); + + rgbint fbcolor; UINT32 orig = fb[x]; + rgb_to_rgbint(&fbcolor, orig); + rgbint_blend(&color, &fbcolor, fa); - int minalpha = 255 - fa; - - r += ((orig & 0x00ff0000) * minalpha) >> 8; - g += ((orig & 0x0000ff00) * minalpha) >> 8; - b += ((orig & 0x000000ff) * minalpha) >> 8; - - fb[x] = 0xff000000 | (r & 0xff0000) | (g & 0xff00) | (b & 0xff); + fb[x] = 0xff000000 | rgbint_to_rgb_clamp(&color); zb[x] = z; } } @@ -2186,37 +2535,37 @@ void model3_renderer::draw_scanline_tex_trans(INT32 scanline, const extent_t &ex float in = extent.param[4].start; float inz = extent.param[4].dpdx; - int srctrans = polydata.transparency; - int desttrans = 32 - polydata.transparency; + int trans = (polydata.transparency << 3) | (polydata.transparency >> 2); UINT32 umask = (((polydata.texture_param & TRI_PARAM_TEXTURE_MIRROR_U) ? 64 : 32) << texture->width) - 1; UINT32 vmask = (((polydata.texture_param & TRI_PARAM_TEXTURE_MIRROR_V) ? 64 : 32) << texture->height) - 1; UINT32 width = 6 + texture->width; + rgbint polycolor; + rgb_to_rgbint(&polycolor, polydata.color); + for (int x = extent.startx; x < extent.stopx; x++) { - if (z < zb[x]) + if (z <= zb[x]) { UINT32 texel; TEX_FETCH(); + rgbint color; + rgb_to_rgbint(&color, texel); + + rgbint_scale_channel_and_clamp(&color, &polycolor); + int ii = (int)in; - UINT32 r = ((texel & 0x00ff0000) * ii) >> 8; - UINT32 g = ((texel & 0x0000ff00) * ii) >> 8; - UINT32 b = ((texel & 0x000000ff) * ii) >> 8; - - r = (r * srctrans) >> 5; - g = (g * srctrans) >> 5; - b = (b * srctrans) >> 5; + rgbint_scale_immediate_and_clamp(&color, ii); + rgbint fbcolor; UINT32 orig = fb[x]; + rgb_to_rgbint(&fbcolor, orig); + rgbint_blend(&color, &fbcolor, trans); - r += ((orig & 0x00ff0000) * desttrans) >> 5; - g += ((orig & 0x0000ff00) * desttrans) >> 5; - b += ((orig & 0x000000ff) * desttrans) >> 5; - - fb[x] = 0xff000000 | (r & 0xff0000) | (g & 0xff00) | (b & 0xff); + fb[x] = 0xff000000 | rgbint_to_rgb_clamp(&color); } ooz += dooz; @@ -2253,7 +2602,7 @@ void model3_renderer::draw_scanline_tex_alpha(INT32 scanline, const extent_t &ex for (int x = extent.startx; x < extent.stopx; x++) { - if (z < zb[x]) + if (z <= zb[x]) { UINT32 texel; TEX_FETCH(); @@ -2261,24 +2610,19 @@ void model3_renderer::draw_scanline_tex_alpha(INT32 scanline, const extent_t &ex UINT32 fa = texel >> 24; if (fa != 0) { + rgbint color; + rgb_to_rgbint(&color, texel); + int ii = (int)in; - UINT32 r = ((texel & 0x00ff0000) * ii) >> 8; - UINT32 g = ((texel & 0x0000ff00) * ii) >> 8; - UINT32 b = ((texel & 0x000000ff) * ii) >> 8; - - r = (r * fa) >> 8; - g = (g * fa) >> 8; - b = (b * fa) >> 8; + rgbint_scale_immediate_and_clamp(&color, ii); + rgbint fbcolor; UINT32 orig = fb[x]; + rgb_to_rgbint(&fbcolor, orig); + rgbint_blend(&color, &fbcolor, fa); - int minalpha = 255 - fa; - r += ((orig & 0x00ff0000) * minalpha) >> 8; - g += ((orig & 0x0000ff00) * minalpha) >> 8; - b += ((orig & 0x000000ff) * minalpha) >> 8; - - fb[x] = 0xff000000 | (r & 0xff0000) | (g & 0xff00) | (b & 0xff); + fb[x] = 0xff000000 | rgbint_to_rgb_clamp(&color); } } From c81d3d9955e2dcc464139d6a55d19a7c3973066a Mon Sep 17 00:00:00 2001 From: MetalliC <0vetal0@gmail.com> Date: Sun, 14 Jun 2015 22:48:45 +0300 Subject: [PATCH 03/21] naomi.c: brute forced DES key for "Shakatto Tambourine (GDS-0002B)" [CaH4e3, MetalliC, emuDrache (trurip), rtw] --- src/mame/drivers/naomi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/naomi.c b/src/mame/drivers/naomi.c index 7ee377c9d67..e28abe21c2b 100644 --- a/src/mame/drivers/naomi.c +++ b/src/mame/drivers/naomi.c @@ -7386,8 +7386,8 @@ ROM_START( shaktam ) DISK_IMAGE_READONLY( "gds-0002b", 0, SHA1(c656497b44d5ca4743aa1a8d836af2bfa3484dd5) ) ROM_REGION( 0x4000, "pic", ROMREGION_ERASEFF) - // key PIC is missing - ROM_LOAD("317-xxxx-com.pic", 0x00, 0x4000, BAD_DUMP CRC(034b7299) SHA1(45118d5f65b21ae599e3ca8e35df847135708d44) ) + // PIC label is unknown + ROM_LOAD("317-xxxx-com.pic", 0x00, 0x4000, CRC(9e1a8971) SHA1(022a1781b5d7346b61defe921dbabf11331834d7) ) ROM_END ROM_START( sprtjam ) From 0d1ef70586ff107332088aa03dd7de825418f33e Mon Sep 17 00:00:00 2001 From: Scott Stone Date: Sun, 14 Jun 2015 16:56:59 -0400 Subject: [PATCH 04/21] New Clones Added ---------------- Space Attack (bproms)(bootleg of Space Invaders) [Mike McBike] --- src/mame/arcade.lst | 15 ++++++++------- src/mame/drivers/8080bw.c | 28 ++++++++++++++++++---------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index aec6fa01461..68701f0c585 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -1465,8 +1465,9 @@ invadrmr // (c) 1978 Model Racing claybust // (c) 1978 Model Racing gunchamp // (c) 1980 Model Racing gunchamps // (c) 1980 Model Racing (sshot.c) -spaceatt // (c) 1978 Video Games GMBH -spaceatt2k // (c) 1978 Video Games GMBH +spaceatt // (c) 1978 Video Games GmbH +spaceattbp // (c) 1978 Video Games GmbH +spaceatt2k // (c) 1978 Video Games GmbH galmonst // (c) Laguna S.A. spaceat2 // (c) 1980 Zenitone-Microsec Ltd spacecom // bootleg @@ -2655,7 +2656,7 @@ outzoneb // TP-O18 (c) 1990 Toaplan outzonec // TP-O18 (c) 1990 Toaplan vimana // TP-O19 (c) 1991 Toaplan (+ Tecmo license when set to Japan) vimanaj // TP-O19 (c) 1991 Toaplan (+ Tecmo license when set to Japan) -vimanan // TP-O19 (c) 1991 Toaplan (+ Nova Apparate GMBH & Co license) +vimanan // TP-O19 (c) 1991 Toaplan (+ Nova Apparate GmbH & Co license) snowbros // MIN16-02 (c) 1990 Toaplan + Romstar license snowbrosa // MIN16-02 (c) 1990 Toaplan + Romstar license snowbrosb // MIN16-02 (c) 1990 Toaplan + Romstar license @@ -9479,9 +9480,9 @@ puzzlet // (c) 2000 Yunizu Corporation (Japan) spcforce // (c) 1980 Venture Line spcforc2 // bootleg meteor // (c) 1981 Venture Line -looping // (c) 1982 Video Games GMBH -loopingv // (c) 1982 Video Games GMBH (Venture Line license) -loopingva // (c) 1982 Video Games GMBH (Venture Line license) +looping // (c) 1982 Video Games GmbH +loopingv // (c) 1982 Video Games GmbH (Venture Line license) +loopingva // (c) 1982 Video Games GmbH (Venture Line license) skybump // (c) 1982 Venture Line suprridr // (c) 1983 Venture Line + Taito license @@ -12855,7 +12856,7 @@ vpoker // (c) 198? specfrce // (c) 2002 ICE/Play Mechanix jnero // (c) 2004 ICE/Play Mechanix -// Amatic Trading GMBH +// Amatic Trading GmbH suprstar // (c) 1996 Amatic am_mg24 // (c) 2000 Amatic am_mg3 // (c) 2000 Amatic diff --git a/src/mame/drivers/8080bw.c b/src/mame/drivers/8080bw.c index cbfca8caeff..ec488e6c447 100644 --- a/src/mame/drivers/8080bw.c +++ b/src/mame/drivers/8080bw.c @@ -3307,7 +3307,6 @@ ROM_START( searthie ) ROM_LOAD( "searthie.e", 0x1800, 0x0800, CRC(baf949b0) SHA1(bfda97a3ef59fcdf87814afc6918507190c3e315) ) ROM_END - ROM_START( invadrmr ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "11.1t", 0x0000, 0x0400, CRC(389d44b6) SHA1(5d2581b8bc0da918ce57cf319e06b5b31989c681) ) @@ -3318,7 +3317,6 @@ ROM_START( invadrmr ) ROM_LOAD( "sv06.1g", 0x1c00, 0x0400, CRC(2c68e0b4) SHA1(a5e5357120102ad32792bf3ef6362f45b7ba7070) ) ROM_END - ROM_START( claybust ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "0.a1", 0x0000, 0x0400, CRC(90810582) SHA1(a5c3655bae6f92a3cd0eae3a5a3c25e414d4fdf0) ) @@ -3329,7 +3327,6 @@ ROM_START( claybust ) ROM_LOAD( "5.a8", 0x1400, 0x0400, CRC(92cd4da8) SHA1(217e00012a52c479bf0b0cf37ce556387755740d) ) ROM_END - ROM_START( gunchamp ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "251.a1", 0x0000, 0x0400, CRC(f27a8c1e) SHA1(510debd1ac2c0986f99c217e3078208a39d7837c) ) @@ -3342,7 +3339,6 @@ ROM_START( gunchamp ) ROM_LOAD( "258.a10", 0x1c00, 0x0400, CRC(471d4052) SHA1(c8ccda2eba44c2ab49f5fc2874fe70c2bdae35d3) ) ROM_END - ROM_START( spaceatt ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "h", 0x0000, 0x0400, CRC(d0c32d72) SHA1(b3bd950b1ba940fbeb5d95e55113ed8f4c311434) ) // == SV01 @@ -3353,6 +3349,23 @@ ROM_START( spaceatt ) ROM_LOAD( "a", 0x1c00, 0x0400, CRC(211ac4a3) SHA1(e08e90a4e77cfa30400626a484c9f37c87ea13f9) ) ROM_END +/* SPACE ATTACK set is from Video Game GmbH - 1010 A / Top board shows Video-Games - 6302 LICH - 1034 + Roms are set up as 1k bproms (82S137) and data is 1 rom top 4 bits, another bottom 4. This data once assembled matches original spaceatt set */ +ROM_START( spaceattbp ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROMX_LOAD( "06e.bin", 0x0000, 0x0400, CRC(68301d05) SHA1(b0c33a982b42378da828281e74356d58fbea1d86), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI ) + ROMX_LOAD( "12l.bin", 0x0000, 0x0400, CRC(c5a5228f) SHA1(7861b5567d44e972d728551d47aab9b92d71ffc7), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO ) + ROMX_LOAD( "05de.bin", 0x0400, 0x0400, CRC(42032c14) SHA1(753948e7f52b88655c894b48d419b76de07c14f2), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI ) + ROMX_LOAD( "11hl.bin", 0x0400, 0x0400, CRC(d5d3811a) SHA1(7d2d983fa88b0349a90a6331ca3e18583125d21e), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO ) + ROMX_LOAD( "04d.bin", 0x0800, 0x0400, CRC(5f5e540c) SHA1(9092794a878494dbe34c2f05a212ff7b9d00fc55), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI ) + ROMX_LOAD( "10h.bin", 0x0800, 0x0400, CRC(9d5ef6f1) SHA1(ef584678373375a7f13307d7c4597639a5f6010e), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO ) + ROMX_LOAD( "03b.bin", 0x1400, 0x0400, CRC(89e13008) SHA1(1ad82ae0607af27925b42758f8c86a0e89079620), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI ) + ROMX_LOAD( "09g.bin", 0x1400, 0x0400, CRC(c16f5503) SHA1(cf36beac472c5c405342193b7ef434d32b37a4a8), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO ) + ROMX_LOAD( "02ab.bin", 0x1800, 0x0400, CRC(ffa166c2) SHA1(10496fcbb272130cc200dfb1886808559be8d6ea), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI ) + ROMX_LOAD( "08f.bin", 0x1800, 0x0400, CRC(b5fa1a2b) SHA1(7eab1cb9a9f95520a37ee4fb2b246ef072dedcbd), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO ) + ROMX_LOAD( "01a.bin", 0x1c00, 0x0400, CRC(44f8e99c) SHA1(9adecdadb16edaebde02892e30f9f87fb98f4ae1), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI ) + ROMX_LOAD( "07ef.bin", 0x1c00, 0x0400, CRC(9560880d) SHA1(866d6c3714b939814ce48707be53a69ef8355b34), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO ) +ROM_END /* SPACE ATTACK set is from Video Games GmbH - Board Typ 1010 C / Top board shows Video-Games - 6302 LICH - 1034B Contains same data as spaceatt but with added 00 fill to make larger roms (b+a=E1, 00fill+c=F1, f+00fill=G1, h+sv02=H1) */ @@ -3382,12 +3395,6 @@ ROM_START( galmonst ) ROM_LOAD( "a.5v", 0x1c00, 0x0400, CRC(05a6806b) SHA1(ea884110d0ea6463801cbc2f87ce9c4921b49e33) ) ROM_END - - - - - - ROM_START( spacecom ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "1f.ic67", 0x0000, 0x0400, BAD_DUMP CRC(703f2cbe) SHA1(b183f9fbedd8658399555c0ba21ecab6370e86cb) ) @@ -4707,6 +4714,7 @@ GAMEL(1979, cosmicm2, invaders, cosmicmo, cosmicmo, driver_device, 0, ROT270 GAMEL(1980?,sinvzen, invaders, invaders, sinvzen, driver_device, 0, ROT270, "Taito / Zenitone-Microsec Ltd.", "Super Invaders (Zenitone-Microsec)", GAME_SUPPORTS_SAVE, layout_invaders ) // unclassified, licensed or bootleg? GAMEL(1980, ultrainv, invaders, invaders, sicv, driver_device, 0, ROT270, "Taito / Konami", "Ultra Invaders", GAME_SUPPORTS_SAVE, layout_invaders ) // unclassified, licensed or bootleg? GAMEL(1978, spaceatt, invaders, invaders, sicv, driver_device, 0, ROT270, "bootleg (Video Games GmbH)", "Space Attack (bootleg of Space Invaders)", GAME_SUPPORTS_SAVE, layout_invaders ) +GAMEL(1978, spaceattbp, invaders, invaders, sicv, driver_device, 0, ROT270, "bootleg (Video Games GmbH)", "Space Attack (bproms)(bootleg of Space Invaders)", GAME_SUPPORTS_SAVE, layout_invaders ) GAMEL(1978, spaceatt2k, invaders, invaders, sicv, driver_device, 0, ROT270, "bootleg (Video Games GmbH)", "Space Attack (2k roms)(bootleg of Space Invaders)", GAME_SUPPORTS_SAVE, layout_invaders ) GAMEL(1978, galmonst, invaders, invaders, sicv, driver_device, 0, ROT270, "bootleg (Laguna S.A.)", "Galaxy Monsters (Laguna S.A. Spanish bootleg of Space Invaders)", GAME_SUPPORTS_SAVE, layout_invaders ) GAMEL(1980, spaceat2, invaders, invaders, spaceat2, driver_device, 0, ROT270, "bootleg (Video Games UK)", "Space Attack II (bootleg of Super Invaders)", GAME_SUPPORTS_SAVE, layout_invaders ) // bootleg of Zenitone-Microsec Super Invaders From ba0057dfc03a659042795eaef4ecac75a577e364 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Sun, 14 Jun 2015 23:39:33 +0100 Subject: [PATCH 05/21] new clones Beast Busters (US, Version 3) [Jets (www.emu-france.com) & Layer (www.neo-arcadia.com)] --- src/mame/arcade.lst | 1 + src/mame/drivers/bbusters.c | 49 +++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 68701f0c585..ec8af0967e3 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -7504,6 +7504,7 @@ mechattu // A8002 'MA' (c) 1989 mechattu1 // A8002 'MA' (c) 1989 bbusters // A9003 'BB' (c) 1989 bbustersu // A9003 'BB' (c) 1989 +bbustersu3 // A9003 'BB' (c) 1989 // Electrocoin on early SNK hardware dmndrby // G4001 'DD' (c) 1986 diff --git a/src/mame/drivers/bbusters.c b/src/mame/drivers/bbusters.c index 0077139e261..2f56daf691d 100644 --- a/src/mame/drivers/bbusters.c +++ b/src/mame/drivers/bbusters.c @@ -834,6 +834,54 @@ ROM_START( bbustersu ) ROM_LOAD( "bbusters-eeprom.bin", 0x00, 0x100, CRC(a52ebd66) SHA1(de04db6f1510700c61bf152799452a80220ae87c) ) ROM_END +ROM_START( bbustersu3 ) + ROM_REGION( 0x80000, "maincpu", 0 ) + ROM_LOAD16_BYTE( "bb-ver3-u3.k10", 0x000000, 0x20000, CRC(c80ec3bc) SHA1(81cccc920c6dc58ccd20fb38bfede717f534986f) ) + ROM_LOAD16_BYTE( "bb-ver3-u5.k12", 0x000001, 0x20000, CRC(5ded86d1) SHA1(de2ce91b85a1d74e60a7093211c1a7d3c27c1d72) ) + ROM_LOAD16_BYTE( "bb-2.k8", 0x040000, 0x20000, CRC(20141805) SHA1(0958579681bda81bcf48d020a14bc147c1e575f1) ) + ROM_LOAD16_BYTE( "bb-4.k11", 0x040001, 0x20000, CRC(d482e0e9) SHA1(e56ca92965e8954b613ba4b0e3975e3a12840c30) ) + + ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_LOAD( "bb-1.e6", 0x000000, 0x10000, CRC(4360f2ee) SHA1(4c6b212f59389bdf4388893d2030493b110ac087) ) + + ROM_REGION( 0x020000, "gfx1", 0 ) + ROM_LOAD( "bb-10.l9", 0x000000, 0x20000, CRC(490c0d9b) SHA1(567c25a6d96407259c64061d674305e4117d9fa4) ) + + ROM_REGION( 0x200000, "gfx2", 0 ) + ROM_LOAD( "bb-f11.m16", 0x000000, 0x80000, CRC(39fdf9c0) SHA1(80392947e3a1831c3ee80139f6f3bdc3bafa4f0d) ) + ROM_LOAD( "bb-f12.m13", 0x080000, 0x80000, CRC(69ee046b) SHA1(5c0435f1ce76b584fa8d154d7617d73c7ab5f62f) ) + ROM_LOAD( "bb-f13.m12", 0x100000, 0x80000, CRC(f5ef840e) SHA1(dd0f630c52076e0d330f47931e68a3ae9a401078) ) + ROM_LOAD( "bb-f14.m11", 0x180000, 0x80000, CRC(1a7df3bb) SHA1(1f27a528e6f89fe56a7342c4f1ff733da0a09327) ) + + ROM_REGION( 0x200000, "gfx3", 0 ) + ROM_LOAD( "bb-f21.l10", 0x000000, 0x80000, CRC(530f595b) SHA1(820898693b878c4423de9c244f943d39ea69515e) ) + ROM_LOAD( "bb-f22.l12", 0x080000, 0x80000, CRC(889c562e) SHA1(d19172d6515ab9793c98de75d6e41687e61a408d) ) + ROM_LOAD( "bb-f23.l13", 0x100000, 0x80000, CRC(c89fe0da) SHA1(92be860a7191e7473c42aa2da981eda873219d3d) ) + ROM_LOAD( "bb-f24.l15", 0x180000, 0x80000, CRC(e0d81359) SHA1(2213c17651b6c023a456447f352b0739439f913a) ) + + ROM_REGION( 0x80000, "gfx4", 0 ) + ROM_LOAD( "bb-back1.m4", 0x000000, 0x80000, CRC(b5445313) SHA1(3c99b557b2af30ff0fbc8a7dc6c40448c4f327db) ) + + ROM_REGION( 0x80000, "gfx5", 0 ) + ROM_LOAD( "bb-back2.m6", 0x000000, 0x80000, CRC(8be996f6) SHA1(1e2c56f4c24793f806d7b366b92edc03145ae94c) ) + + ROM_REGION( 0x10000, "user1", 0 ) /* Zoom table */ + /* same rom exists in 4 different locations on the board */ + ROM_LOAD( "bb-6.e7", 0x000000, 0x10000, CRC(61f3de03) SHA1(736f9634fe054ea68a2aa90a743bd0dc320f23c9) ) + ROM_LOAD( "bb-7.h7", 0x000000, 0x10000, CRC(61f3de03) SHA1(736f9634fe054ea68a2aa90a743bd0dc320f23c9) ) + ROM_LOAD( "bb-8.a14", 0x000000, 0x10000, CRC(61f3de03) SHA1(736f9634fe054ea68a2aa90a743bd0dc320f23c9) ) + ROM_LOAD( "bb-9.c14", 0x000000, 0x10000, CRC(61f3de03) SHA1(736f9634fe054ea68a2aa90a743bd0dc320f23c9) ) + + ROM_REGION( 0x80000, "ymsnd", 0 ) + ROM_LOAD( "bb-pcma.l5", 0x000000, 0x80000, CRC(44cd5bfe) SHA1(26a612191a0aa614c090203485aba17c99c763ee) ) + + ROM_REGION( 0x80000, "ymsnd.deltat", 0 ) + ROM_LOAD( "bb-pcma.l5", 0x000000, 0x80000, CRC(44cd5bfe) SHA1(26a612191a0aa614c090203485aba17c99c763ee) ) + + ROM_REGION( 0x100, "eeprom", 0 ) + ROM_LOAD( "bbusters-eeprom.bin", 0x00, 0x100, CRC(a52ebd66) SHA1(de04db6f1510700c61bf152799452a80220ae87c) ) +ROM_END + ROM_START( mechatt ) ROM_REGION( 0x80000, "maincpu", 0 ) // Located on the A8002-1 main board @@ -1022,6 +1070,7 @@ ROM_END // as soon as you calibrate the guns in test mode the game refuses to boot GAME( 1989, bbusters, 0, bbusters, bbusters, driver_device, 0, ROT0, "SNK", "Beast Busters (World)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) GAME( 1989, bbustersu,bbusters, bbusters, bbusters, driver_device, 0, ROT0, "SNK", "Beast Busters (US, Version 2)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1989, bbustersu3,bbusters,bbusters, bbusters, driver_device, 0, ROT0, "SNK", "Beast Busters (US, Version 3)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) GAME( 1989, mechatt, 0, mechatt, mechatt, driver_device, 0, ROT0, "SNK", "Mechanized Attack (World)", GAME_SUPPORTS_SAVE ) GAME( 1989, mechattj, mechatt, mechatt, mechattj, driver_device, 0, ROT0, "SNK", "Mechanized Attack (Japan)", GAME_SUPPORTS_SAVE ) From 215e9a8be91b6ef9b6ea43d1e9674b7abd661c23 Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 15 Jun 2015 03:24:24 +0200 Subject: [PATCH 06/21] added interrupt handling --- src/emu/cpu/melps4/m58846.c | 51 ++++++++++++++- src/emu/cpu/melps4/m58846.h | 7 ++ src/emu/cpu/melps4/melps4.c | 110 ++++++++++++++++++++++++++++---- src/emu/cpu/melps4/melps4.h | 22 ++++++- src/emu/cpu/melps4/melps4op.inc | 11 ++-- 5 files changed, 181 insertions(+), 20 deletions(-) diff --git a/src/emu/cpu/melps4/m58846.c b/src/emu/cpu/melps4/m58846.c index ac14baf797d..824969f8cd6 100644 --- a/src/emu/cpu/melps4/m58846.c +++ b/src/emu/cpu/melps4/m58846.c @@ -10,7 +10,7 @@ */ #include "m58846.h" -#include "debugger.h" +//#include "debugger.h" @@ -50,6 +50,9 @@ offs_t m58846_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *o void m58846_device::device_start() { melps4_cpu_device::device_start(); + + m_timer[0] = timer_alloc(0); + m_timer[1] = timer_alloc(1); } @@ -61,6 +64,52 @@ void m58846_device::device_start() void m58846_device::device_reset() { melps4_cpu_device::device_reset(); + + // timer 1 runs continuously + reset_timer1(); +} + + + +//------------------------------------------------- +// timers +//------------------------------------------------- + +void m58846_device::reset_timer1() +{ + // reset 7-bit prescaler + attotime base = attotime::from_ticks(6 * 128, unscaled_clock()); + m_timer[0]->adjust(base); +} + +void m58846_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + // timer 1 + case 0: + m_irqflag[1] = true; + m_possible_irq = true; + reset_timer1(); + break; + + // timer 2 + case 1: + break; + + default: + assert_always(FALSE, "Unknown id in m58846_device::device_timer"); + break; + } +} + +void m58846_device::write_v(UINT8 data) +{ + // d0: enable timer 1 irq + m_tmr_irq_enabled[0] = (data & 1) ? true : false; + m_possible_irq = true; + + m_v = data; } diff --git a/src/emu/cpu/melps4/m58846.h b/src/emu/cpu/melps4/m58846.h index 7ee094df568..458f649c4f0 100644 --- a/src/emu/cpu/melps4/m58846.h +++ b/src/emu/cpu/melps4/m58846.h @@ -29,6 +29,13 @@ protected: // device_disasm_interface overrides virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); + + // timers + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + virtual void write_v(UINT8 data); + + emu_timer *m_timer[2]; + void reset_timer1(); }; diff --git a/src/emu/cpu/melps4/melps4.c b/src/emu/cpu/melps4/melps4.c index 5fdd2b1cab6..c4309c6a3b9 100644 --- a/src/emu/cpu/melps4/melps4.c +++ b/src/emu/cpu/melps4/melps4.c @@ -46,12 +46,15 @@ void melps4_cpu_device::state_string_export(const device_state_entry &entry, std { // obviously not from a single flags register, letters are made up case STATE_GENFLAGS: - strprintf(str, "%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c %c%c%c", m_intp ? 'P':'p', m_inte ? 'I':'i', m_sm ? 'S':'s', m_cps ? 'D':'d', - m_cy ? 'C':'c' + m_cy ? 'C':'c', + m_irqflag[0] ? 'X':'.', // exf + m_irqflag[1] ? '1':'.', // 1f + m_irqflag[2] ? '2':'.' // 2f ); break; @@ -111,7 +114,11 @@ void melps4_cpu_device::device_start() m_skip = false; m_inte = 0; m_intp = 1; + m_irqflag[0] = m_irqflag[1] = m_irqflag[2] = false; + m_tmr_irq_enabled[0] = m_tmr_irq_enabled[1] = false; + m_int_state = 0; m_prohibit_irq = false; + m_possible_irq = false; m_a = 0; m_b = 0; @@ -147,7 +154,11 @@ void melps4_cpu_device::device_start() save_item(NAME(m_skip)); save_item(NAME(m_inte)); save_item(NAME(m_intp)); + save_item(NAME(m_irqflag)); + save_item(NAME(m_tmr_irq_enabled)); + save_item(NAME(m_int_state)); save_item(NAME(m_prohibit_irq)); + save_item(NAME(m_possible_irq)); save_item(NAME(m_a)); save_item(NAME(m_b)); @@ -165,7 +176,7 @@ void melps4_cpu_device::device_start() // register state for debugger state_add(STATE_GENPC, "curpc", m_pc).formatstr("%04X").noshow(); - state_add(STATE_GENFLAGS, "GENFLAGS", m_cy).formatstr("%5s").noshow(); + state_add(STATE_GENFLAGS, "GENFLAGS", m_cy).formatstr("%9s").noshow(); state_add(MELPS4_PC, "PC", m_pc).formatstr("%04X"); state_add(MELPS4_A, "A", m_a).formatstr("%2d"); // show in decimal @@ -194,18 +205,20 @@ void melps4_cpu_device::device_reset() { m_sm = m_sms = false; m_ba_flag = false; - m_prohibit_irq = false; - m_skip = false; m_op = m_prev_op = 0; m_pc = m_prev_pc = 0; - m_inte = 0; - m_intp = 1; op_lcps(); // CPS=0 - m_v = 0; - m_w = 0; - + // clear interrupts + m_inte = 0; + m_intp = 1; + write_v(0); + write_w(0); + m_irqflag[0] = m_irqflag[1] = m_irqflag[2] = false; + m_prohibit_irq = false; + m_possible_irq = false; + // clear ports write_d_pin(MELPS4_PORTD_CLR, 0); write_gen_port(MELPS4_PORTS, 0); @@ -291,6 +304,73 @@ void melps4_cpu_device::write_d_pin(int bit, int state) +//------------------------------------------------- +// interrupts +//------------------------------------------------- + +void melps4_cpu_device::execute_set_input(int line, int state) +{ + state = (state) ? 1 : 0; + + switch (line) + { + // external interrupt + case MELPS4_INPUT_LINE_INT: + // irq on rising/falling edge + if (state != m_int_state && state == m_intp) + { + m_irqflag[0] = true; + m_possible_irq = true; + } + m_int_state = state; + break; + + // timer input pin + case MELPS4_INPUT_LINE_T: + break; + + default: + break; + } +} + +void melps4_cpu_device::do_interrupt(int which) +{ + m_inte = 0; + m_irqflag[which] = false; + + m_icount--; + push_pc(); + m_sms = m_sm; + m_sm = false; + m_op = 0; // fake nop + m_pc = m_int_page << 7 | (which * 2); + + standard_irq_callback(which); +} + +void melps4_cpu_device::check_interrupt() +{ + if (!m_inte) + return; + + int which = 0; + + // assume that lower irq vectors have higher priority + if (m_irqflag[0]) + which = 0; + else if (m_irqflag[1] && m_tmr_irq_enabled[0]) + which = 1; + else if (m_irqflag[2] && m_tmr_irq_enabled[1]) + which = 2; + else + return; + + do_interrupt(which); +} + + + //------------------------------------------------- // execute //------------------------------------------------- @@ -314,8 +394,14 @@ void melps4_cpu_device::execute_run() m_prev_op = m_op; m_prev_pc = m_pc; - // irq is not accepted during skip or LXY, LA, EI, DI, RT/RTS/RTI or any branch - //.. + // Interrupts are not accepted during skips or LXY, LA, EI, DI, RT/RTS/RTI or any branch. + // Documentation is conflicting here: older docs say that it is allowed during skips, + // newer docs specifically say when interrupts are prohibited. + if (m_possible_irq && !m_prohibit_irq && !m_skip) + { + m_possible_irq = false; + check_interrupt(); + } m_prohibit_irq = false; // fetch next opcode diff --git a/src/emu/cpu/melps4/melps4.h b/src/emu/cpu/melps4/melps4.h index 023b0b9ba02..e4110dd07e7 100644 --- a/src/emu/cpu/melps4/melps4.h +++ b/src/emu/cpu/melps4/melps4.h @@ -60,6 +60,12 @@ enum MELPS4_PORTU }; +enum +{ + MELPS4_INPUT_LINE_INT = 0, + MELPS4_INPUT_LINE_T +}; + // pinout reference @@ -142,8 +148,9 @@ protected: virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const { return (clocks + 6 - 1) / 6; } // 6 t-states per machine cycle virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const { return (cycles * 6); } // " virtual UINT32 execute_min_cycles() const { return 1; } - virtual UINT32 execute_max_cycles() const { return 1; } + virtual UINT32 execute_max_cycles() const { return 1+1; } // max opcode cycles + interrupt duration virtual UINT32 execute_input_lines() const { return 3; } // up to 3 (some internal) + virtual void execute_set_input(int line, int state); virtual void execute_run(); virtual void execute_one(); @@ -189,14 +196,18 @@ protected: UINT8 m_port_s; // " UINT8 m_port_f; // " - bool m_sm, m_sms; // subroutine mode flag + stack + bool m_sm, m_sms; // subroutine mode flag + irq stack bool m_ba_flag; // temp flag indicates BA opcode was executed UINT8 m_sp_param; // temp register holding SP opcode parameter UINT8 m_cps; // DP,CY or DP',CY' selected bool m_skip; // skip next opcode UINT8 m_inte; // interrupt enable flag - UINT8 m_intp; // external interrupt polarity ('40 to '44) + int m_intp; // external interrupt polarity ('40 to '44) + bool m_irqflag[3]; // irq flags: exf, 1f, 2f (external, timer 1, timer 2) + bool m_tmr_irq_enabled[2]; + int m_int_state; // INT pin state bool m_prohibit_irq; // interrupt is prohibited during certain opcodes + bool m_possible_irq; // indicate that irq needs to be rechecked // work registers (unless specified, each is 4-bit) UINT8 m_a; // accumulator @@ -225,6 +236,11 @@ protected: devcb_write8 m_write_g; devcb_write8 m_write_u; devcb_write_line m_write_t; + + virtual void write_v(UINT8 data) { m_v = data; } + virtual void write_w(UINT8 data) { m_w = data; } + virtual void do_interrupt(int which); + virtual void check_interrupt(); UINT8 read_gen_port(int port); void write_gen_port(int port, UINT8 data); diff --git a/src/emu/cpu/melps4/melps4op.inc b/src/emu/cpu/melps4/melps4op.inc index 476de900e93..6640156b16b 100644 --- a/src/emu/cpu/melps4/melps4op.inc +++ b/src/emu/cpu/melps4/melps4op.inc @@ -419,25 +419,27 @@ void melps4_cpu_device::op_tab2() void melps4_cpu_device::op_tva() { // TVA: transfer A to timer control V - m_v = m_a; + write_v(m_a); } void melps4_cpu_device::op_twa() { // TWA: transfer A to timer control W - m_w = m_a; + write_w(m_a); } void melps4_cpu_device::op_snz1() { // SNZ1: skip next on flag 1F - op_illegal(); + m_skip = m_irqflag[1]; + m_irqflag[1] = false; } void melps4_cpu_device::op_snz2() { // SNZ2: skip next on flag 2F - op_illegal(); + m_skip = m_irqflag[2]; + m_irqflag[2] = false; } @@ -631,6 +633,7 @@ void melps4_cpu_device::op_ei() { // EI: enable interrupt flag m_prohibit_irq = true; + m_possible_irq = true; m_inte = 1; } From 277bd7e759a00e404ccfbd089cedaf4cd68cfd41 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 15 Jun 2015 12:38:20 +1000 Subject: [PATCH 07/21] Fix off-by-one --- src/osd/modules/opengl/gl_shader_tool.c | 29 +++++++++---------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/src/osd/modules/opengl/gl_shader_tool.c b/src/osd/modules/opengl/gl_shader_tool.c index 5d308882ed8..203869e308e 100644 --- a/src/osd/modules/opengl/gl_shader_tool.c +++ b/src/osd/modules/opengl/gl_shader_tool.c @@ -374,11 +374,6 @@ errout: int gl_compile_shader_file( GLhandleARB *shader, GLenum type, const char * shader_file, int verbose ) { - int err = 0, i, c; - FILE * file = NULL; - int buffer_len = 8192; - GLcharARB *buffer=NULL; - if(shader==NULL || shader_file==NULL) { if(shader==NULL) @@ -388,7 +383,7 @@ int gl_compile_shader_file( GLhandleARB *shader, GLenum type, const char * shade return -1; } - file = fopen(shader_file, "r"); + FILE *const file = fopen(shader_file, "r"); if(!file) { osd_printf_warning("cannot open shader_file: %s\n", shader_file); @@ -397,23 +392,20 @@ int gl_compile_shader_file( GLhandleARB *shader, GLenum type, const char * shade // get the real file size fseek(file, 0, SEEK_END); - buffer_len = (int)ftell(file); + int const buffer_len = (int)ftell(file); fseek(file, 0, SEEK_SET); - buffer = (GLcharARB *) malloc(buffer_len); - memset(buffer, 0, buffer_len); + GLcharARB *const buffer = (GLcharARB *)malloc(buffer_len + 1); + memset(buffer, 0, buffer_len + 1); - /* Load Shader Sources */ - i=0; - while( i Date: Sun, 14 Jun 2015 22:09:37 -0500 Subject: [PATCH 08/21] tmnt.c: Bells & Whistles derive CPU clock by actual OSC - NW --- src/mame/drivers/tmnt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/drivers/tmnt.c b/src/mame/drivers/tmnt.c index 883a874179e..8ce3409f286 100644 --- a/src/mame/drivers/tmnt.c +++ b/src/mame/drivers/tmnt.c @@ -2236,7 +2236,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_START( blswhstl, tmnt_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M68000, 16000000) /* 16 MHz */ + MCFG_CPU_ADD("maincpu", M68000, XTAL_32MHz/2) /* Confirmed */ MCFG_CPU_PROGRAM_MAP(blswhstl_main_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", tmnt_state, punkshot_interrupt) From 8ea36b999d6a4bedddc754aea0256be8460a6551 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 15 Jun 2015 12:50:03 +1000 Subject: [PATCH 09/21] Move UI mode key out of SDL options into generic options --- src/osd/modules/lib/osdobj_common.c | 14 ++++++++------ src/osd/modules/lib/osdobj_common.h | 21 +++++++++++++-------- src/osd/sdl/input.c | 2 +- src/osd/sdl/osdsdl.h | 2 -- src/osd/sdl/sdlmain.c | 5 ----- src/osd/windows/input.c | 20 ++++++++++++++++++++ 6 files changed, 42 insertions(+), 22 deletions(-) diff --git a/src/osd/modules/lib/osdobj_common.c b/src/osd/modules/lib/osdobj_common.c index 903ee072d36..1f37c0a335c 100644 --- a/src/osd/modules/lib/osdobj_common.c +++ b/src/osd/modules/lib/osdobj_common.c @@ -17,6 +17,13 @@ extern bool g_print_verbose; const options_entry osd_options::s_option_entries[] = { + { NULL, NULL, OPTION_HEADER, "OSD KEYBOARD MAPPING OPTIONS" }, +#ifdef SDLMAME_MACOSX + { OSDOPTION_UIMODEKEY, "DEL", OPTION_STRING, "Key to toggle keyboard mode" }, +#else + { OSDOPTION_UIMODEKEY, "SCRLOCK", OPTION_STRING, "Key to toggle keyboard mode" }, +#endif // SDLMAME_MACOSX + { NULL, NULL, OPTION_HEADER, "OSD FONT OPTIONS" }, { OSD_FONT_PROVIDER, OSDOPTVAL_AUTO, OPTION_STRING, "provider for ui font: " }, @@ -24,20 +31,17 @@ const options_entry osd_options::s_option_entries[] = { OSDCOMMAND_LIST_MIDI_DEVICES ";mlist", "0", OPTION_COMMAND, "list available MIDI I/O devices" }, { OSDCOMMAND_LIST_NETWORK_ADAPTERS ";nlist", "0", OPTION_COMMAND, "list available network adapters" }, - // debugging options { NULL, NULL, OPTION_HEADER, "OSD DEBUGGING OPTIONS" }, { OSDOPTION_DEBUGGER, OSDOPTVAL_AUTO, OPTION_STRING, "debugger used: " }, { OSDOPTION_DEBUGGER_FONT ";dfont", OSDOPTVAL_AUTO, OPTION_STRING, "specifies the font to use for debugging" }, { OSDOPTION_DEBUGGER_FONT_SIZE ";dfontsize", "0", OPTION_FLOAT, "specifies the font size to use for debugging" }, - { OSDOPTION_WATCHDOG ";wdog", "0", OPTION_INTEGER, "force the program to terminate if no updates within specified number of seconds" }, - // performance options { NULL, NULL, OPTION_HEADER, "OSD PERFORMANCE OPTIONS" }, { OSDOPTION_MULTITHREADING ";mt", "0", OPTION_BOOLEAN, "enable multithreading; this enables rendering and blitting on a separate thread" }, { OSDOPTION_NUMPROCESSORS ";np", OSDOPTVAL_AUTO, OPTION_STRING, "number of processors; this overrides the number the system reports" }, { OSDOPTION_BENCH, "0", OPTION_INTEGER, "benchmark for the given number of emulated seconds; implies -video none -sound none -nothrottle" }, - // video options + { NULL, NULL, OPTION_HEADER, "OSD VIDEO OPTIONS" }, // OS X can be trusted to have working hardware OpenGL, so default to it on for the best user experience { OSDOPTION_VIDEO, OSDOPTVAL_AUTO, OPTION_STRING, "video output method: " }, @@ -85,7 +89,6 @@ const options_entry osd_options::s_option_entries[] = { OSDOPTION_PRESCALE, "1", OPTION_INTEGER, "scale screen rendering by this amount in software" }, #if USE_OPENGL - // OpenGL specific options { NULL, NULL, OPTION_HEADER, "OpenGL-SPECIFIC OPTIONS" }, { OSDOPTION_GL_FORCEPOW2TEXTURE, "0", OPTION_BOOLEAN, "force power of two textures (default no)" }, { OSDOPTION_GL_NOTEXTURERECT, "0", OPTION_BOOLEAN, "don't use OpenGL GL_ARB_texture_rectangle (default on)" }, @@ -115,7 +118,6 @@ const options_entry osd_options::s_option_entries[] = { OSDOPTION_SHADER_SCREEN "9", OSDOPTVAL_NONE, OPTION_STRING, "custom OpenGL GLSL shader screen bitmap 9" }, #endif - // sound options { NULL, NULL, OPTION_HEADER, "OSD SOUND OPTIONS" }, { OSDOPTION_SOUND, OSDOPTVAL_AUTO, OPTION_STRING, "sound output method: " }, { OSDOPTION_AUDIO_LATENCY "(1-5)", "2", OPTION_INTEGER, "set audio latency (increase to reduce glitches, decrease for responsiveness)" }, diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h index d46463b414d..ddbc8c974d4 100644 --- a/src/osd/modules/lib/osdobj_common.h +++ b/src/osd/modules/lib/osdobj_common.h @@ -26,6 +26,8 @@ // Defines //============================================================ +#define OSDOPTION_UIMODEKEY "uimodekey" + #define OSDCOMMAND_LIST_MIDI_DEVICES "listmidi" #define OSDCOMMAND_LIST_NETWORK_ADAPTERS "listnetwork" @@ -54,9 +56,6 @@ #define OSDOPTION_SWITCHRES "switchres" -#define OSDOPTION_SOUND "sound" -#define OSDOPTION_AUDIO_LATENCY "audio_latency" - #define OSDOPTION_FILTER "filter" #define OSDOPTION_PRESCALE "prescale" @@ -69,6 +68,9 @@ #define OSDOPTION_GL_NOTEXTURERECT "gl_notexturerect" #define OSDOPTION_GL_FORCEPOW2TEXTURE "gl_forcepow2texture" +#define OSDOPTION_SOUND "sound" +#define OSDOPTION_AUDIO_LATENCY "audio_latency" + #define OSDOPTION_AUDIO_OUTPUT "audio_output" #define OSDOPTION_AUDIO_EFFECT "audio_effect" @@ -87,6 +89,9 @@ public: // construction/destruction osd_options(); + // keyboard mapping + const char *ui_mode_key() const { return value(OSDOPTION_UIMODEKEY); } + // debugging options const char *debugger() const { return value(OSDOPTION_DEBUGGER); } const char *debugger_font() const { return value(OSDOPTION_DEBUGGER_FONT); } @@ -121,11 +126,7 @@ public: // full screen options bool switch_res() const { return bool_value(OSDOPTION_SWITCHRES); } - // sound options - const char *sound() const { return value(OSDOPTION_SOUND); } - int audio_latency() const { return int_value(OSDOPTION_AUDIO_LATENCY); } - - // video options + // accelerated video options bool filter() const { return bool_value(OSDOPTION_FILTER); } int prescale() const { return int_value(OSDOPTION_PRESCALE); } @@ -139,6 +140,10 @@ public: const char *shader_mame(int index) const { std::string temp; strprintf(temp, "%s%d", OSDOPTION_SHADER_MAME, index); return value(temp.c_str()); } const char *shader_screen(int index) const { std::string temp; strprintf(temp, "%s%d", OSDOPTION_SHADER_SCREEN, index); return value(temp.c_str()); } + // sound options + const char *sound() const { return value(OSDOPTION_SOUND); } + int audio_latency() const { return int_value(OSDOPTION_AUDIO_LATENCY); } + // CoreAudio specific options const char *audio_output() const { return value(OSDOPTION_AUDIO_OUTPUT); } const char *audio_effect(int index) const { std::string temp; strprintf(temp, "%s%d", OSDOPTION_AUDIO_EFFECT, index); return value(temp.c_str()); } diff --git a/src/osd/sdl/input.c b/src/osd/sdl/input.c index 7d4e9adb375..8f70ba1e0ee 100644 --- a/src/osd/sdl/input.c +++ b/src/osd/sdl/input.c @@ -2067,7 +2067,7 @@ void sdl_osd_interface::customize_input_type_list(simple_list input_item_id mameid_code; input_code ui_code; input_type_entry *entry; - const char* uimode; + const char* uimode; char fullmode[64]; // loop over the defaults diff --git a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h index 8b8ebeb4444..22a3aad60b9 100644 --- a/src/osd/sdl/osdsdl.h +++ b/src/osd/sdl/osdsdl.h @@ -48,7 +48,6 @@ #define SDLOPTION_SYNCREFRESH "syncrefresh" #define SDLOPTION_KEYMAP "keymap" #define SDLOPTION_KEYMAP_FILE "keymap_file" -#define SDLOPTION_UIMODEKEY "uimodekey" #define SDLOPTION_SIXAXIS "sixaxis" #define SDLOPTION_JOYINDEX "joy_idx" @@ -118,7 +117,6 @@ public: // keyboard mapping bool keymap() const { return bool_value(SDLOPTION_KEYMAP); } const char *keymap_file() const { return value(SDLOPTION_KEYMAP_FILE); } - const char *ui_mode_key() const { return value(SDLOPTION_UIMODEKEY); } // joystick mapping const char *joy_index(int index) const { std::string temp; return value(strformat(temp, "%s%d", SDLOPTION_JOYINDEX, index).c_str()); } diff --git a/src/osd/sdl/sdlmain.c b/src/osd/sdl/sdlmain.c index e022c9d59b4..14ff93ecaf5 100644 --- a/src/osd/sdl/sdlmain.c +++ b/src/osd/sdl/sdlmain.c @@ -117,11 +117,6 @@ const options_entry sdl_options::s_option_entries[] = { NULL, NULL, OPTION_HEADER, "SDL KEYBOARD MAPPING" }, { SDLOPTION_KEYMAP, "0", OPTION_BOOLEAN, "enable keymap" }, { SDLOPTION_KEYMAP_FILE, "keymap.dat", OPTION_STRING, "keymap filename" }, -#ifdef SDLMAME_MACOSX - { SDLOPTION_UIMODEKEY, "DEL", OPTION_STRING, "Key to toggle keyboard mode" }, -#else - { SDLOPTION_UIMODEKEY, "SCRLOCK", OPTION_STRING, "Key to toggle keyboard mode" }, -#endif // SDLMAME_MACOSX // joystick mapping { NULL, NULL, OPTION_HEADER, "SDL JOYSTICK MAPPING" }, diff --git a/src/osd/windows/input.c b/src/osd/windows/input.c index f6c46d87f15..f32b4a94f8c 100644 --- a/src/osd/windows/input.c +++ b/src/osd/windows/input.c @@ -719,7 +719,11 @@ int wininput_vkey_for_mame_code(input_code code) void windows_osd_interface::customize_input_type_list(simple_list &typelist) { + //input_item_id mameid_code; + //input_code ui_code; input_type_entry *entry; + const char* uimode; + char fullmode[64]; // loop over the defaults for (entry = typelist.first(); entry != NULL; entry = entry->next()) @@ -731,6 +735,22 @@ void windows_osd_interface::customize_input_type_list(simple_listdefseq(SEQ_TYPE_STANDARD).set(KEYCODE_TAB, input_seq::not_code, KEYCODE_LALT, input_seq::not_code, KEYCODE_RALT); break; + // configurable UI mode switch + case IPT_UI_TOGGLE_UI: + uimode = options().ui_mode_key(); + if (!strcmp(uimode,"auto")) + { + //mameid_code = lookup_mame_code("ITEM_ID_INSERT"); + } + else + { + snprintf(fullmode, 63, "ITEM_ID_%s", uimode); + //mameid_code = lookup_mame_code(fullmode); + } + //ui_code = input_code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, input_item_id(mameid_code)); + entry->defseq(SEQ_TYPE_STANDARD).set(ui_code); + break; + // alt-enter for fullscreen case IPT_OSD_1: entry->configure_osd("TOGGLE_FULLSCREEN", "Toggle Fullscreen"); From dff97806b05812a5213e2505508da255f4a02c0b Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 15 Jun 2015 13:57:04 +1000 Subject: [PATCH 10/21] Hook up -uimodekey for Windows --- src/osd/windows/input.c | 316 +++++++++++++++++++++------------------- 1 file changed, 170 insertions(+), 146 deletions(-) diff --git a/src/osd/windows/input.c b/src/osd/windows/input.c index f32b4a94f8c..7616ef897ea 100644 --- a/src/osd/windows/input.c +++ b/src/osd/windows/input.c @@ -52,11 +52,6 @@ enum #define MAX_KEYS 256 -#define MAME_KEY 0 -#define DI_KEY 1 -#define VIRTUAL_KEY 2 -#define ASCII_KEY 3 - //============================================================ @@ -270,118 +265,126 @@ static const TCHAR *default_pov_name(int which); //============================================================ // master keyboard translation table -static const int win_key_trans_table[][4] = +struct key_trans_entry { + input_item_id mame_key; + INT32 di_key; + char virtual_key; + char ascii_key; + char const * mame_key_name; +}; +#define KEY_TRANS_ENTRY(mame, di, virtual, ascii) { ITEM_ID_##mame, DIK_##di, virtual, ascii, "ITEM_ID_"#mame } +static const key_trans_entry win_key_trans_table[] = { - // MAME key dinput key virtual key ascii - { ITEM_ID_ESC, DIK_ESCAPE, VK_ESCAPE, 27 }, - { ITEM_ID_1, DIK_1, '1', '1' }, - { ITEM_ID_2, DIK_2, '2', '2' }, - { ITEM_ID_3, DIK_3, '3', '3' }, - { ITEM_ID_4, DIK_4, '4', '4' }, - { ITEM_ID_5, DIK_5, '5', '5' }, - { ITEM_ID_6, DIK_6, '6', '6' }, - { ITEM_ID_7, DIK_7, '7', '7' }, - { ITEM_ID_8, DIK_8, '8', '8' }, - { ITEM_ID_9, DIK_9, '9', '9' }, - { ITEM_ID_0, DIK_0, '0', '0' }, - { ITEM_ID_MINUS, DIK_MINUS, VK_OEM_MINUS, '-' }, - { ITEM_ID_EQUALS, DIK_EQUALS, VK_OEM_PLUS, '=' }, - { ITEM_ID_BACKSPACE, DIK_BACK, VK_BACK, 8 }, - { ITEM_ID_TAB, DIK_TAB, VK_TAB, 9 }, - { ITEM_ID_Q, DIK_Q, 'Q', 'Q' }, - { ITEM_ID_W, DIK_W, 'W', 'W' }, - { ITEM_ID_E, DIK_E, 'E', 'E' }, - { ITEM_ID_R, DIK_R, 'R', 'R' }, - { ITEM_ID_T, DIK_T, 'T', 'T' }, - { ITEM_ID_Y, DIK_Y, 'Y', 'Y' }, - { ITEM_ID_U, DIK_U, 'U', 'U' }, - { ITEM_ID_I, DIK_I, 'I', 'I' }, - { ITEM_ID_O, DIK_O, 'O', 'O' }, - { ITEM_ID_P, DIK_P, 'P', 'P' }, - { ITEM_ID_OPENBRACE, DIK_LBRACKET, VK_OEM_4, '[' }, - { ITEM_ID_CLOSEBRACE, DIK_RBRACKET, VK_OEM_6, ']' }, - { ITEM_ID_ENTER, DIK_RETURN, VK_RETURN, 13 }, - { ITEM_ID_LCONTROL, DIK_LCONTROL, VK_LCONTROL, 0 }, - { ITEM_ID_A, DIK_A, 'A', 'A' }, - { ITEM_ID_S, DIK_S, 'S', 'S' }, - { ITEM_ID_D, DIK_D, 'D', 'D' }, - { ITEM_ID_F, DIK_F, 'F', 'F' }, - { ITEM_ID_G, DIK_G, 'G', 'G' }, - { ITEM_ID_H, DIK_H, 'H', 'H' }, - { ITEM_ID_J, DIK_J, 'J', 'J' }, - { ITEM_ID_K, DIK_K, 'K', 'K' }, - { ITEM_ID_L, DIK_L, 'L', 'L' }, - { ITEM_ID_COLON, DIK_SEMICOLON, VK_OEM_1, ';' }, - { ITEM_ID_QUOTE, DIK_APOSTROPHE, VK_OEM_7, '\'' }, - { ITEM_ID_TILDE, DIK_GRAVE, VK_OEM_3, '`' }, - { ITEM_ID_LSHIFT, DIK_LSHIFT, VK_LSHIFT, 0 }, - { ITEM_ID_BACKSLASH, DIK_BACKSLASH, VK_OEM_5, '\\' }, - { ITEM_ID_BACKSLASH2, DIK_OEM_102, VK_OEM_102, '<' }, - { ITEM_ID_Z, DIK_Z, 'Z', 'Z' }, - { ITEM_ID_X, DIK_X, 'X', 'X' }, - { ITEM_ID_C, DIK_C, 'C', 'C' }, - { ITEM_ID_V, DIK_V, 'V', 'V' }, - { ITEM_ID_B, DIK_B, 'B', 'B' }, - { ITEM_ID_N, DIK_N, 'N', 'N' }, - { ITEM_ID_M, DIK_M, 'M', 'M' }, - { ITEM_ID_COMMA, DIK_COMMA, VK_OEM_COMMA, ',' }, - { ITEM_ID_STOP, DIK_PERIOD, VK_OEM_PERIOD, '.' }, - { ITEM_ID_SLASH, DIK_SLASH, VK_OEM_2, '/' }, - { ITEM_ID_RSHIFT, DIK_RSHIFT, VK_RSHIFT, 0 }, - { ITEM_ID_ASTERISK, DIK_MULTIPLY, VK_MULTIPLY, '*' }, - { ITEM_ID_LALT, DIK_LMENU, VK_LMENU, 0 }, - { ITEM_ID_SPACE, DIK_SPACE, VK_SPACE, ' ' }, - { ITEM_ID_CAPSLOCK, DIK_CAPITAL, VK_CAPITAL, 0 }, - { ITEM_ID_F1, DIK_F1, VK_F1, 0 }, - { ITEM_ID_F2, DIK_F2, VK_F2, 0 }, - { ITEM_ID_F3, DIK_F3, VK_F3, 0 }, - { ITEM_ID_F4, DIK_F4, VK_F4, 0 }, - { ITEM_ID_F5, DIK_F5, VK_F5, 0 }, - { ITEM_ID_F6, DIK_F6, VK_F6, 0 }, - { ITEM_ID_F7, DIK_F7, VK_F7, 0 }, - { ITEM_ID_F8, DIK_F8, VK_F8, 0 }, - { ITEM_ID_F9, DIK_F9, VK_F9, 0 }, - { ITEM_ID_F10, DIK_F10, VK_F10, 0 }, - { ITEM_ID_NUMLOCK, DIK_NUMLOCK, VK_NUMLOCK, 0 }, - { ITEM_ID_SCRLOCK, DIK_SCROLL, VK_SCROLL, 0 }, - { ITEM_ID_7_PAD, DIK_NUMPAD7, VK_NUMPAD7, 0 }, - { ITEM_ID_8_PAD, DIK_NUMPAD8, VK_NUMPAD8, 0 }, - { ITEM_ID_9_PAD, DIK_NUMPAD9, VK_NUMPAD9, 0 }, - { ITEM_ID_MINUS_PAD, DIK_SUBTRACT, VK_SUBTRACT, 0 }, - { ITEM_ID_4_PAD, DIK_NUMPAD4, VK_NUMPAD4, 0 }, - { ITEM_ID_5_PAD, DIK_NUMPAD5, VK_NUMPAD5, 0 }, - { ITEM_ID_6_PAD, DIK_NUMPAD6, VK_NUMPAD6, 0 }, - { ITEM_ID_PLUS_PAD, DIK_ADD, VK_ADD, 0 }, - { ITEM_ID_1_PAD, DIK_NUMPAD1, VK_NUMPAD1, 0 }, - { ITEM_ID_2_PAD, DIK_NUMPAD2, VK_NUMPAD2, 0 }, - { ITEM_ID_3_PAD, DIK_NUMPAD3, VK_NUMPAD3, 0 }, - { ITEM_ID_0_PAD, DIK_NUMPAD0, VK_NUMPAD0, 0 }, - { ITEM_ID_DEL_PAD, DIK_DECIMAL, VK_DECIMAL, 0 }, - { ITEM_ID_F11, DIK_F11, VK_F11, 0 }, - { ITEM_ID_F12, DIK_F12, VK_F12, 0 }, - { ITEM_ID_F13, DIK_F13, VK_F13, 0 }, - { ITEM_ID_F14, DIK_F14, VK_F14, 0 }, - { ITEM_ID_F15, DIK_F15, VK_F15, 0 }, - { ITEM_ID_ENTER_PAD, DIK_NUMPADENTER, VK_RETURN, 0 }, - { ITEM_ID_RCONTROL, DIK_RCONTROL, VK_RCONTROL, 0 }, - { ITEM_ID_SLASH_PAD, DIK_DIVIDE, VK_DIVIDE, 0 }, - { ITEM_ID_PRTSCR, DIK_SYSRQ, 0, 0 }, - { ITEM_ID_RALT, DIK_RMENU, VK_RMENU, 0 }, - { ITEM_ID_HOME, DIK_HOME, VK_HOME, 0 }, - { ITEM_ID_UP, DIK_UP, VK_UP, 0 }, - { ITEM_ID_PGUP, DIK_PRIOR, VK_PRIOR, 0 }, - { ITEM_ID_LEFT, DIK_LEFT, VK_LEFT, 0 }, - { ITEM_ID_RIGHT, DIK_RIGHT, VK_RIGHT, 0 }, - { ITEM_ID_END, DIK_END, VK_END, 0 }, - { ITEM_ID_DOWN, DIK_DOWN, VK_DOWN, 0 }, - { ITEM_ID_PGDN, DIK_NEXT, VK_NEXT, 0 }, - { ITEM_ID_INSERT, DIK_INSERT, VK_INSERT, 0 }, - { ITEM_ID_DEL, DIK_DELETE, VK_DELETE, 0 }, - { ITEM_ID_LWIN, DIK_LWIN, VK_LWIN, 0 }, - { ITEM_ID_RWIN, DIK_RWIN, VK_RWIN, 0 }, - { ITEM_ID_MENU, DIK_APPS, VK_APPS, 0 }, - { ITEM_ID_PAUSE, DIK_PAUSE, VK_PAUSE, 0 }, - { ITEM_ID_CANCEL, 0, VK_CANCEL, 0 }, + // MAME key dinput key virtual key ascii + KEY_TRANS_ENTRY(ESC, ESCAPE, VK_ESCAPE, 27), + KEY_TRANS_ENTRY(1, 1, '1', '1'), + KEY_TRANS_ENTRY(2, 2, '2', '2'), + KEY_TRANS_ENTRY(3, 3, '3', '3'), + KEY_TRANS_ENTRY(4, 4, '4', '4'), + KEY_TRANS_ENTRY(5, 5, '5', '5'), + KEY_TRANS_ENTRY(6, 6, '6', '6'), + KEY_TRANS_ENTRY(7, 7, '7', '7'), + KEY_TRANS_ENTRY(8, 8, '8', '8'), + KEY_TRANS_ENTRY(9, 9, '9', '9'), + KEY_TRANS_ENTRY(0, 0, '0', '0'), + KEY_TRANS_ENTRY(MINUS, MINUS, VK_OEM_MINUS, '-'), + KEY_TRANS_ENTRY(EQUALS, EQUALS, VK_OEM_PLUS, '='), + KEY_TRANS_ENTRY(BACKSPACE, BACK, VK_BACK, 8), + KEY_TRANS_ENTRY(TAB, TAB, VK_TAB, 9), + KEY_TRANS_ENTRY(Q, Q, 'Q', 'Q'), + KEY_TRANS_ENTRY(W, W, 'W', 'W'), + KEY_TRANS_ENTRY(E, E, 'E', 'E'), + KEY_TRANS_ENTRY(R, R, 'R', 'R'), + KEY_TRANS_ENTRY(T, T, 'T', 'T'), + KEY_TRANS_ENTRY(Y, Y, 'Y', 'Y'), + KEY_TRANS_ENTRY(U, U, 'U', 'U'), + KEY_TRANS_ENTRY(I, I, 'I', 'I'), + KEY_TRANS_ENTRY(O, O, 'O', 'O'), + KEY_TRANS_ENTRY(P, P, 'P', 'P'), + KEY_TRANS_ENTRY(OPENBRACE, LBRACKET, VK_OEM_4, '['), + KEY_TRANS_ENTRY(CLOSEBRACE, RBRACKET, VK_OEM_6, ']'), + KEY_TRANS_ENTRY(ENTER, RETURN, VK_RETURN, 13), + KEY_TRANS_ENTRY(LCONTROL, LCONTROL, VK_LCONTROL, 0), + KEY_TRANS_ENTRY(A, A, 'A', 'A'), + KEY_TRANS_ENTRY(S, S, 'S', 'S'), + KEY_TRANS_ENTRY(D, D, 'D', 'D'), + KEY_TRANS_ENTRY(F, F, 'F', 'F'), + KEY_TRANS_ENTRY(G, G, 'G', 'G'), + KEY_TRANS_ENTRY(H, H, 'H', 'H'), + KEY_TRANS_ENTRY(J, J, 'J', 'J'), + KEY_TRANS_ENTRY(K, K, 'K', 'K'), + KEY_TRANS_ENTRY(L, L, 'L', 'L'), + KEY_TRANS_ENTRY(COLON, SEMICOLON, VK_OEM_1, ';'), + KEY_TRANS_ENTRY(QUOTE, APOSTROPHE, VK_OEM_7, '\''), + KEY_TRANS_ENTRY(TILDE, GRAVE, VK_OEM_3, '`'), + KEY_TRANS_ENTRY(LSHIFT, LSHIFT, VK_LSHIFT, 0), + KEY_TRANS_ENTRY(BACKSLASH, BACKSLASH, VK_OEM_5, '\\'), + KEY_TRANS_ENTRY(BACKSLASH2, OEM_102, VK_OEM_102, '<'), + KEY_TRANS_ENTRY(Z, Z, 'Z', 'Z'), + KEY_TRANS_ENTRY(X, X, 'X', 'X'), + KEY_TRANS_ENTRY(C, C, 'C', 'C'), + KEY_TRANS_ENTRY(V, V, 'V', 'V'), + KEY_TRANS_ENTRY(B, B, 'B', 'B'), + KEY_TRANS_ENTRY(N, N, 'N', 'N'), + KEY_TRANS_ENTRY(M, M, 'M', 'M'), + KEY_TRANS_ENTRY(COMMA, COMMA, VK_OEM_COMMA, ','), + KEY_TRANS_ENTRY(STOP, PERIOD, VK_OEM_PERIOD, '.'), + KEY_TRANS_ENTRY(SLASH, SLASH, VK_OEM_2, '/'), + KEY_TRANS_ENTRY(RSHIFT, RSHIFT, VK_RSHIFT, 0), + KEY_TRANS_ENTRY(ASTERISK, MULTIPLY, VK_MULTIPLY, '*'), + KEY_TRANS_ENTRY(LALT, LMENU, VK_LMENU, 0), + KEY_TRANS_ENTRY(SPACE, SPACE, VK_SPACE, ' '), + KEY_TRANS_ENTRY(CAPSLOCK, CAPITAL, VK_CAPITAL, 0), + KEY_TRANS_ENTRY(F1, F1, VK_F1, 0), + KEY_TRANS_ENTRY(F2, F2, VK_F2, 0), + KEY_TRANS_ENTRY(F3, F3, VK_F3, 0), + KEY_TRANS_ENTRY(F4, F4, VK_F4, 0), + KEY_TRANS_ENTRY(F5, F5, VK_F5, 0), + KEY_TRANS_ENTRY(F6, F6, VK_F6, 0), + KEY_TRANS_ENTRY(F7, F7, VK_F7, 0), + KEY_TRANS_ENTRY(F8, F8, VK_F8, 0), + KEY_TRANS_ENTRY(F9, F9, VK_F9, 0), + KEY_TRANS_ENTRY(F10, F10, VK_F10, 0), + KEY_TRANS_ENTRY(NUMLOCK, NUMLOCK, VK_NUMLOCK, 0), + KEY_TRANS_ENTRY(SCRLOCK, SCROLL, VK_SCROLL, 0), + KEY_TRANS_ENTRY(7_PAD, NUMPAD7, VK_NUMPAD7, 0), + KEY_TRANS_ENTRY(8_PAD, NUMPAD8, VK_NUMPAD8, 0), + KEY_TRANS_ENTRY(9_PAD, NUMPAD9, VK_NUMPAD9, 0), + KEY_TRANS_ENTRY(MINUS_PAD, SUBTRACT, VK_SUBTRACT, 0), + KEY_TRANS_ENTRY(4_PAD, NUMPAD4, VK_NUMPAD4, 0), + KEY_TRANS_ENTRY(5_PAD, NUMPAD5, VK_NUMPAD5, 0), + KEY_TRANS_ENTRY(6_PAD, NUMPAD6, VK_NUMPAD6, 0), + KEY_TRANS_ENTRY(PLUS_PAD, ADD, VK_ADD, 0), + KEY_TRANS_ENTRY(1_PAD, NUMPAD1, VK_NUMPAD1, 0), + KEY_TRANS_ENTRY(2_PAD, NUMPAD2, VK_NUMPAD2, 0), + KEY_TRANS_ENTRY(3_PAD, NUMPAD3, VK_NUMPAD3, 0), + KEY_TRANS_ENTRY(0_PAD, NUMPAD0, VK_NUMPAD0, 0), + KEY_TRANS_ENTRY(DEL_PAD, DECIMAL, VK_DECIMAL, 0), + KEY_TRANS_ENTRY(F11, F11, VK_F11, 0), + KEY_TRANS_ENTRY(F12, F12, VK_F12, 0), + KEY_TRANS_ENTRY(F13, F13, VK_F13, 0), + KEY_TRANS_ENTRY(F14, F14, VK_F14, 0), + KEY_TRANS_ENTRY(F15, F15, VK_F15, 0), + KEY_TRANS_ENTRY(ENTER_PAD, NUMPADENTER, VK_RETURN, 0), + KEY_TRANS_ENTRY(RCONTROL, RCONTROL, VK_RCONTROL, 0), + KEY_TRANS_ENTRY(SLASH_PAD, DIVIDE, VK_DIVIDE, 0), + KEY_TRANS_ENTRY(PRTSCR, SYSRQ, 0, 0), + KEY_TRANS_ENTRY(RALT, RMENU, VK_RMENU, 0), + KEY_TRANS_ENTRY(HOME, HOME, VK_HOME, 0), + KEY_TRANS_ENTRY(UP, UP, VK_UP, 0), + KEY_TRANS_ENTRY(PGUP, PRIOR, VK_PRIOR, 0), + KEY_TRANS_ENTRY(LEFT, LEFT, VK_LEFT, 0), + KEY_TRANS_ENTRY(RIGHT, RIGHT, VK_RIGHT, 0), + KEY_TRANS_ENTRY(END, END, VK_END, 0), + KEY_TRANS_ENTRY(DOWN, DOWN, VK_DOWN, 0), + KEY_TRANS_ENTRY(PGDN, NEXT, VK_NEXT, 0), + KEY_TRANS_ENTRY(INSERT, INSERT, VK_INSERT, 0), + KEY_TRANS_ENTRY(DEL, DELETE, VK_DELETE, 0), + KEY_TRANS_ENTRY(LWIN, LWIN, VK_LWIN, 0), + KEY_TRANS_ENTRY(RWIN, RWIN, VK_RWIN, 0), + KEY_TRANS_ENTRY(MENU, APPS, VK_APPS, 0), + KEY_TRANS_ENTRY(PAUSE, PAUSE, VK_PAUSE, 0), + { ITEM_ID_CANCEL, 0, VK_CANCEL, 0, "ITEM_ID_CANCEL" }, // New keys introduced in Windows 2000. These have no MAME codes to // preserve compatibility with old config files that may refer to them @@ -391,18 +394,18 @@ static const int win_key_trans_table[][4] = // paused). Some codes are missing because the mapping to vkey codes // isn't clear, and MapVirtualKey is no help. - { ITEM_ID_OTHER_SWITCH, DIK_MUTE, VK_VOLUME_MUTE, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_VOLUMEDOWN, VK_VOLUME_DOWN, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_VOLUMEUP, VK_VOLUME_UP, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_WEBHOME, VK_BROWSER_HOME, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_WEBSEARCH, VK_BROWSER_SEARCH, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_WEBFAVORITES, VK_BROWSER_FAVORITES, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_WEBREFRESH, VK_BROWSER_REFRESH, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_WEBSTOP, VK_BROWSER_STOP, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_WEBFORWARD, VK_BROWSER_FORWARD, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_WEBBACK, VK_BROWSER_BACK, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_MAIL, VK_LAUNCH_MAIL, 0 }, - { ITEM_ID_OTHER_SWITCH, DIK_MEDIASELECT, VK_LAUNCH_MEDIA_SELECT, 0 }, + KEY_TRANS_ENTRY(OTHER_SWITCH, MUTE, VK_VOLUME_MUTE, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, VOLUMEDOWN, VK_VOLUME_DOWN, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, VOLUMEUP, VK_VOLUME_UP, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, WEBHOME, VK_BROWSER_HOME, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, WEBSEARCH, VK_BROWSER_SEARCH, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, WEBFAVORITES, VK_BROWSER_FAVORITES, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, WEBREFRESH, VK_BROWSER_REFRESH, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, WEBSTOP, VK_BROWSER_STOP, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, WEBFORWARD, VK_BROWSER_FORWARD, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, WEBBACK, VK_BROWSER_BACK, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, MAIL, VK_LAUNCH_MAIL, 0), + KEY_TRANS_ENTRY(OTHER_SWITCH, MEDIASELECT, VK_LAUNCH_MEDIA_SELECT, 0), }; @@ -424,8 +427,8 @@ INLINE input_item_id keyboard_map_scancode_to_itemid(int scancode) // scan the table for a match for (tablenum = 0; tablenum < ARRAY_LENGTH(win_key_trans_table); tablenum++) - if (win_key_trans_table[tablenum][DI_KEY] == scancode) - return (input_item_id)win_key_trans_table[tablenum][MAME_KEY]; + if (win_key_trans_table[tablenum].di_key == scancode) + return (input_item_id)win_key_trans_table[tablenum].mame_key; // default to an "other" switch return ITEM_ID_OTHER_SWITCH; @@ -706,24 +709,45 @@ int wininput_vkey_for_mame_code(input_code code) // scan the table for a match for (tablenum = 0; tablenum < ARRAY_LENGTH(win_key_trans_table); tablenum++) - if (win_key_trans_table[tablenum][MAME_KEY] == id) - return win_key_trans_table[tablenum][VIRTUAL_KEY]; + if (win_key_trans_table[tablenum].mame_key == id) + return win_key_trans_table[tablenum].virtual_key; } return 0; } +//============================================================ +// lookup_mame_code +//============================================================ + +static int lookup_mame_index(const char *scode) +{ + for (int i = 0; i < ARRAY_LENGTH(win_key_trans_table); i++) + { + if (!strcmp(scode, win_key_trans_table[i].mame_key_name)) + return i; + } + return -1; +} + +static input_item_id lookup_mame_code(const char *scode) +{ + int const index = lookup_mame_index(scode); + if (index >= 0) + return win_key_trans_table[index].mame_key; + else + return ITEM_ID_INVALID; +} + + //============================================================ // customize_input_type_list //============================================================ void windows_osd_interface::customize_input_type_list(simple_list &typelist) { - //input_item_id mameid_code; - //input_code ui_code; input_type_entry *entry; const char* uimode; - char fullmode[64]; // loop over the defaults for (entry = typelist.first(); entry != NULL; entry = entry->next()) @@ -738,17 +762,17 @@ void windows_osd_interface::customize_input_type_list(simple_listdefseq(SEQ_TYPE_STANDARD).set(ui_code); + } } - else - { - snprintf(fullmode, 63, "ITEM_ID_%s", uimode); - //mameid_code = lookup_mame_code(fullmode); - } - //ui_code = input_code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, input_item_id(mameid_code)); - entry->defseq(SEQ_TYPE_STANDARD).set(ui_code); break; // alt-enter for fullscreen @@ -1030,10 +1054,10 @@ static void win32_keyboard_poll(device_info *devinfo) // iterate over keys for (keynum = 0; keynum < ARRAY_LENGTH(win_key_trans_table); keynum++) { - int vk = win_key_trans_table[keynum][VIRTUAL_KEY]; + int vk = win_key_trans_table[keynum].virtual_key; if (vk != 0 && (GetAsyncKeyState(vk) & 0x8000) != 0) { - int dik = win_key_trans_table[keynum][DI_KEY]; + int dik = win_key_trans_table[keynum].di_key; // conver the VK code to a scancode (DIK code) if (dik != 0) From 8b1fdcb518229119c09385e89af9ac626bf40d02 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 15 Jun 2015 08:46:16 +0200 Subject: [PATCH 11/21] force rebuild version.c (nw) --- scripts/src/main.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/src/main.lua b/scripts/src/main.lua index 6bbdc01833c..2156a775dbc 100644 --- a/scripts/src/main.lua +++ b/scripts/src/main.lua @@ -222,6 +222,12 @@ function mainProject(_target, _subtarget) { MAME_DIR .. "src/".._target .."/" .. _subtarget ..".lst" , GEN_DIR .. _target .. "/" .. _subtarget .."/drivlist.c", { MAME_DIR .. "src/build/makelist.py" }, {"@echo Building driver list...", PYTHON .. " $(1) $(<) > $(@)" }}, } + configuration { "gmake" } + dependency { + { ".PHONY", ".FORCE", true }, + { "$(OBJDIR)/src/version.o", ".FORCE", true }, + } + configuration { "mingw*" } custombuildtask { { MAME_DIR .. "src/version.c" , GEN_DIR .. "/resource/" .. rctarget .. "vers.rc", { MAME_DIR .. "src/build/verinfo.py" }, {"@echo Emitting " .. rctarget .. "vers.rc" .. "...", PYTHON .. " $(1) -r -b " .. rctarget .. " $(<) > $(@)" }}, From 01d3e240a6c3a2afb86cd7f30a5d788e589c2fef Mon Sep 17 00:00:00 2001 From: Logan B Date: Mon, 15 Jun 2015 19:10:32 +1200 Subject: [PATCH 12/21] Fix copy/paste error (nw) --- hash/gamegear.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hash/gamegear.xml b/hash/gamegear.xml index 2818c50119e..1caac2b5e7c 100644 --- a/hash/gamegear.xml +++ b/hash/gamegear.xml @@ -3909,7 +3909,7 @@ a certain item) --> Lemmings 2 - The Tribes (Euro, Prototype) 1994 Psygnosis - + From 63cc0ad2144b47c1614a7c0227235e4a71cc2c5a Mon Sep 17 00:00:00 2001 From: David Haywood Date: Mon, 15 Jun 2015 13:49:16 +0100 Subject: [PATCH 13/21] new NOT WORKING Bingo Party Multicart (Rev B) (M1 Satellite board) [zozo] this is one of the satellite boards from a much larger system, unfortunately no other parts of it are dumped. We have bingoc.c but I think that's a different part of a similar system (possibly one of the 'link' boards but for an earlier) we also have 'pontoon' in segas18.c which is likely to be the video part of a similar system, but again there we're missing all the other boards. Finally we also have Royal Ascot (X-Board) which could also be a component of one of these setups (we know Caribbean Boule which has M1 satellite boards uses an X-Board for the communal display) maybe one day we can actually get hold of a complete set of PCBs for one of these things.... --- scripts/target/mame/arcade.lua | 1 + src/mame/arcade.lst | 3 + src/mame/drivers/segam1.c | 111 +++++++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 src/mame/drivers/segam1.c diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 10dac16f38f..5e95ab7fbc1 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -2480,6 +2480,7 @@ files { MAME_DIR .. "src/mame/video/segas18.c", MAME_DIR .. "src/mame/drivers/segas24.c", MAME_DIR .. "src/mame/video/segas24.c", + MAME_DIR .. "src/mame/drivers/segam1.c", MAME_DIR .. "src/mame/drivers/segas32.c", MAME_DIR .. "src/mame/machine/segas32.c", MAME_DIR .. "src/mame/video/segas32.c", diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index ec8af0967e3..f3609500739 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -4842,6 +4842,9 @@ quizmeku // 1993.05 Quiz Mekurumeku Story (Japan) mahmajn2 // 1994.05 Tokorosan no Mahmahjong 2 (Japan) qgh // 1994.09 Quiz Ghost Hunter +// M! board +bingpty // ? + // Sega System 32 games radm // 1991.?? Rad Mobile (World) radmu // 1991.03 Rad Mobile (US) diff --git a/src/mame/drivers/segam1.c b/src/mame/drivers/segam1.c new file mode 100644 index 00000000000..d6ecaf31abb --- /dev/null +++ b/src/mame/drivers/segam1.c @@ -0,0 +1,111 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood +/* + +Sega M1 hardware (837-7571) (PCB) + +Sega Bingo Multicart (837-10675) (Sticker on PCB) + +used for redemption / gambling style machines in a satellite setup + +based on Caribbean Boule the following hardware setup is used + +One X-Board (segaxbd.c) drives a large rear-projection monitor which all players view to see the main game progress. + +Multiple M1 boards ("satellite" board) for each player for them to view information privately. + +One 'link' board which connects everything together. The link board has audio hardware, a 68K, and a Z80 as +well as a huge bank of UARTS and toslink connectors, but no video. it's possible the main game logic runs +on the 'link' board. + + +Unfortunately we don't have any dumps of anything other than an M1 board right now. + +--- + +is this related to (or a component of?) bingoc.c, the EPR numbers are much lower there tho +so it's probably an earlier version of the same thing or one of the 'link' boards? + +uses s24 style tilemaps (ram based?) + + +*/ + + +#include "emu.h" +#include "cpu/m68000/m68000.h" + + + +class segam1_state : public driver_device +{ +public: + segam1_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + { } + + virtual void video_start(); + UINT32 screen_update_segam1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_maincpu; +}; + +void segam1_state::video_start() +{ +} + +UINT32 segam1_state::screen_update_segam1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + + + +static ADDRESS_MAP_START( segam1_map, AS_PROGRAM, 16, segam1_state ) + AM_RANGE(0x000000, 0x03ffff) AM_ROM +ADDRESS_MAP_END + + +static INPUT_PORTS_START( segam1 ) +INPUT_PORTS_END + + + + +static MACHINE_CONFIG_START( segam1, segam1_state ) + + MCFG_CPU_ADD("maincpu", M68000, XTAL_20MHz/2) + MCFG_CPU_PROGRAM_MAP(segam1_map) +// MCFG_CPU_VBLANK_INT_DRIVER("screen", segam1_state, irq1_line_hold) + + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MCFG_SCREEN_SIZE(64*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) + MCFG_SCREEN_UPDATE_DRIVER(segam1_state, screen_update_segam1) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 0x200) + MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") +MACHINE_CONFIG_END + + +ROM_START( bingpty ) + ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 Code */ + ROM_LOAD16_BYTE( "epr-16648b.bin", 0x00000, 0x20000, CRC(e4fceb4c) SHA1(0a248bb328d2f6d72d540baefbe62838f4b76585) ) + ROM_LOAD16_BYTE( "epr-16649b.bin", 0x00001, 0x20000, CRC(736d8bbd) SHA1(c359ad513d4a7693cbb1a27ce26f89849e894d05) ) + + ROM_REGION( 0x20000, "audiocpu", 0 ) /* Z80 Code */ + ROM_LOAD( "epr-14845.bin", 0x00000, 0x20000, CRC(90d47101) SHA1(7bc002c104e3dbde1986aaec54112d5658eab523) ) + + ROM_REGION( 0x8000, "m1comm", 0 ) /* Z80 Code */ + ROM_LOAD( "epr-14221a.bin", 0x00000, 0x8000, CRC(a13e67a4) SHA1(4cd269c7f04a64ae7806c8784f86bf6553a25d85) ) + + // dumps of the X-Board part, and the LINK PCB are missing. +ROM_END + +GAME( 199?, bingpty, 0, segam1, segam1, driver_device, 0, ROT0, "Sega", "Bingo Party Multicart (Rev B) (Satellite board?)", GAME_NOT_WORKING | GAME_NO_SOUND ) From de3fd6441e5c7bd31c74a1b01137b67dc09a67f9 Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 15 Jun 2015 22:08:18 +0200 Subject: [PATCH 14/21] fix stupid bug and added undocumented opcodes --- src/emu/cpu/melps4/m58846.c | 49 ++++++++++++++------------------- src/emu/cpu/melps4/m58846.h | 4 +-- src/emu/cpu/melps4/melps4.c | 3 ++ src/emu/cpu/melps4/melps4.h | 5 ++++ src/emu/cpu/melps4/melps4d.c | 20 +++++++------- src/emu/cpu/melps4/melps4op.inc | 25 ++++++++++++++++- 6 files changed, 65 insertions(+), 41 deletions(-) diff --git a/src/emu/cpu/melps4/m58846.c b/src/emu/cpu/melps4/m58846.c index 824969f8cd6..17161da2fb5 100644 --- a/src/emu/cpu/melps4/m58846.c +++ b/src/emu/cpu/melps4/m58846.c @@ -50,9 +50,7 @@ offs_t m58846_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *o void m58846_device::device_start() { melps4_cpu_device::device_start(); - - m_timer[0] = timer_alloc(0); - m_timer[1] = timer_alloc(1); + m_timer = timer_alloc(0); } @@ -66,7 +64,7 @@ void m58846_device::device_reset() melps4_cpu_device::device_reset(); // timer 1 runs continuously - reset_timer1(); + reset_timer(); } @@ -75,37 +73,30 @@ void m58846_device::device_reset() // timers //------------------------------------------------- -void m58846_device::reset_timer1() +void m58846_device::reset_timer() { // reset 7-bit prescaler attotime base = attotime::from_ticks(6 * 128, unscaled_clock()); - m_timer[0]->adjust(base); + m_timer->adjust(base); } void m58846_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - switch (id) - { - // timer 1 - case 0: - m_irqflag[1] = true; - m_possible_irq = true; - reset_timer1(); - break; - - // timer 2 - case 1: - break; - - default: - assert_always(FALSE, "Unknown id in m58846_device::device_timer"); - break; - } + if (id != 0) + return; + + // timer 1 overflow + m_irqflag[1] = true; + m_possible_irq = true; + reset_timer(); } void m58846_device::write_v(UINT8 data) { // d0: enable timer 1 irq + // d1: enable timer 2 irq? (TODO) + // d2: ? + // d3: timer 2 enable? m_tmr_irq_enabled[0] = (data & 1) ? true : false; m_possible_irq = true; @@ -121,7 +112,7 @@ void m58846_device::write_v(UINT8 data) void m58846_device::execute_one() { // handle one opcode - switch (m_op & 0xf0) + switch (m_op & 0x1f0) { case 0x30: op_sey(); break; case 0x70: op_sp(); break; @@ -131,7 +122,7 @@ void m58846_device::execute_one() case 0xc0: case 0xd0: case 0xe0: case 0xf0: op_lxy(); break; default: - switch (m_op & 0xfc) + switch (m_op & 0x1fc) { case 0x20: op_szb(); break; case 0x4c: op_sb(); break; @@ -156,11 +147,11 @@ void m58846_device::execute_one() case 0x03: op_dey(); break; case 0x04: op_di(); break; case 0x05: op_ei(); break; + case 0x09: op_tabe(); break; // undocumented case 0x0a: op_am(); break; case 0x0b: op_ose(); break; case 0x0c: op_tya(); break; case 0x0f: op_cma(); break; - // 0x18 RAR undocumented? case 0x10: op_cls(); break; case 0x11: op_clds(); break; @@ -169,6 +160,8 @@ void m58846_device::execute_one() case 0x15: op_sd(); break; case 0x16: op_tepa(); break; case 0x17: op_ospa(); break; + case 0x18: op_rl(); break; // undocumented + case 0x19: op_rr(); break; // undocumented case 0x1a: op_teab(); break; case 0x1b: op_osab(); break; case 0x1c: op_tba(); break; @@ -203,10 +196,10 @@ void m58846_device::execute_one() break; } - break; // 0xff + break; // 0x1ff } - break; // 0xfc + break; // 0x1fc } // big switch } diff --git a/src/emu/cpu/melps4/m58846.h b/src/emu/cpu/melps4/m58846.h index 458f649c4f0..72d8253dd23 100644 --- a/src/emu/cpu/melps4/m58846.h +++ b/src/emu/cpu/melps4/m58846.h @@ -34,8 +34,8 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); virtual void write_v(UINT8 data); - emu_timer *m_timer[2]; - void reset_timer1(); + emu_timer *m_timer; + void reset_timer(); }; diff --git a/src/emu/cpu/melps4/melps4.c b/src/emu/cpu/melps4/melps4.c index c4309c6a3b9..e6291a485da 100644 --- a/src/emu/cpu/melps4/melps4.c +++ b/src/emu/cpu/melps4/melps4.c @@ -117,6 +117,7 @@ void melps4_cpu_device::device_start() m_irqflag[0] = m_irqflag[1] = m_irqflag[2] = false; m_tmr_irq_enabled[0] = m_tmr_irq_enabled[1] = false; m_int_state = 0; + m_t_state = 0; m_prohibit_irq = false; m_possible_irq = false; @@ -157,6 +158,7 @@ void melps4_cpu_device::device_start() save_item(NAME(m_irqflag)); save_item(NAME(m_tmr_irq_enabled)); save_item(NAME(m_int_state)); + save_item(NAME(m_t_state)); save_item(NAME(m_prohibit_irq)); save_item(NAME(m_possible_irq)); @@ -327,6 +329,7 @@ void melps4_cpu_device::execute_set_input(int line, int state) // timer input pin case MELPS4_INPUT_LINE_T: + write_t_in(state); break; default: diff --git a/src/emu/cpu/melps4/melps4.h b/src/emu/cpu/melps4/melps4.h index e4110dd07e7..5a7d2327198 100644 --- a/src/emu/cpu/melps4/melps4.h +++ b/src/emu/cpu/melps4/melps4.h @@ -206,6 +206,7 @@ protected: bool m_irqflag[3]; // irq flags: exf, 1f, 2f (external, timer 1, timer 2) bool m_tmr_irq_enabled[2]; int m_int_state; // INT pin state + int m_t_state; // T input pin state bool m_prohibit_irq; // interrupt is prohibited during certain opcodes bool m_possible_irq; // indicate that irq needs to be rechecked @@ -237,6 +238,7 @@ protected: devcb_write8 m_write_u; devcb_write_line m_write_t; + virtual void write_t_in(int state) { m_t_state = state; } virtual void write_v(UINT8 data) { m_v = data; } virtual void write_w(UINT8 data) { m_w = data; } virtual void do_interrupt(int which); @@ -259,6 +261,7 @@ protected: void op_tay(); void op_tya(); void op_teab(); + void op_tabe(); void op_tepa(); void op_txa(); void op_tax(); @@ -284,6 +287,8 @@ protected: void op_rc(); void op_szc(); void op_cma(); + void op_rl(); + void op_rr(); void op_sb(); void op_rb(); diff --git a/src/emu/cpu/melps4/melps4d.c b/src/emu/cpu/melps4/melps4d.c index 01d9b51f5ce..4c2ca2fd9d4 100644 --- a/src/emu/cpu/melps4/melps4d.c +++ b/src/emu/cpu/melps4/melps4d.c @@ -18,10 +18,10 @@ enum e_mnemonics { em_ILL, - em_TAB, em_TBA, em_TAY, em_TYA, em_TEAB, em_TEPA, em_TXA, em_TAX, + em_TAB, em_TBA, em_TAY, em_TYA, em_TEAB, em_TABE, em_TEPA, em_TXA, em_TAX, em_LXY, em_LZ, em_INY, em_DEY, em_LCPS, em_SADR, em_TAM, em_XAM, em_XAMD, em_XAMI, - em_LA, em_AM, em_AMC, em_AMCS, em_A, em_SC, em_RC, em_SZC, em_CMA, + em_LA, em_AM, em_AMC, em_AMCS, em_A, em_SC, em_RC, em_SZC, em_CMA, em_RL, em_RR, em_SB, em_RB, em_SZB, em_SEAM, em_SEY, em_TLA, em_THA, em_TAJ, em_XAL, em_XAH, em_LC7, em_DEC, em_SHL, em_RHL, em_CPA, em_CPAS, em_CPAE, em_SZJ, em_T1AB, em_TRAB, em_T2AB, em_TAB1, em_TABR, em_TAB2, em_TVA, em_TWA, em_SNZ1, em_SNZ2, @@ -33,10 +33,10 @@ enum e_mnemonics static const char *const em_name[] = { "?", - "TAB", "TBA", "TAY", "TYA", "TEAB", "TEPA", "TXA", "TAX", + "TAB", "TBA", "TAY", "TYA", "TEAB", "TABE", "TEPA", "TXA", "TAX", "LXY", "LZ", "INY", "DEY", "LCPS", "SADR", "TAM", "XAM", "XAMD", "XAMI", - "LA", "AM", "AMC", "AMCS", "A", "SC", "RC", "SZC", "CMA", + "LA", "AM", "AMC", "AMCS", "A", "SC", "RC", "SZC", "CMA", "RL", "RR", "SB", "RB", "SZB", "SEAM", "SEY", "TLA", "THA", "TAJ", "XAL", "XAH", "LC7", "DEC", "SHL", "RHL", "CPA", "CPAS", "CPAE", "SZJ", "T1AB", "TRAB", "T2AB", "TAB1", "TABR", "TAB2", "TVA", "TWA", "SNZ1", "SNZ2", @@ -49,10 +49,10 @@ static const char *const em_name[] = static const UINT8 em_bits[] = { 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 1, 0, 0, 1, 2, 2, 2, 2, 2, - 4, 0, 0, 0, 4, 0, 0, 0, 0, + 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -67,10 +67,10 @@ static const UINT8 em_bits[] = static const UINT32 em_flags[] = { 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -86,8 +86,8 @@ static const UINT32 em_flags[] = static const UINT8 m58846_opmap[0xc0] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F - em_NOP, em_BA, em_INY, em_DEY, em_DI, em_EI, em_RU, em_SU, 0, 0, em_AM, em_OSE, em_TYA, 0, 0, em_CMA, // 0x - em_CLS, em_CLDS, 0, em_CLD, em_RD, em_SD, em_TEPA, em_OSPA, 0, 0, em_TEAB, em_OSAB, em_TBA, em_TAY, em_TAB, 0, // 1x + em_NOP, em_BA, em_INY, em_DEY, em_DI, em_EI, em_RU, em_SU, 0, em_TABE, em_AM, em_OSE, em_TYA, 0, 0, em_CMA, // 0x + em_CLS, em_CLDS, 0, em_CLD, em_RD, em_SD, em_TEPA, em_OSPA, em_RL, em_RR, em_TEAB, em_OSAB, em_TBA, em_TAY, em_TAB, 0, // 1x em_SZB, em_SZB, em_SZB, em_SZB, 0, 0, em_SEAM, 0, 0, 0, 0, em_SZD, 0, 0, 0, em_SZC, // 2x em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, em_SEY, // 3x em_LCPS, em_LCPS, 0, em_AMC, em_RT, em_RTS, em_RTI, 0, em_RC, em_SC, em_LZ, em_LZ, em_SB, em_SB, em_SB, em_SB, // 4x diff --git a/src/emu/cpu/melps4/melps4op.inc b/src/emu/cpu/melps4/melps4op.inc index 6640156b16b..1ac63b0f2a2 100644 --- a/src/emu/cpu/melps4/melps4op.inc +++ b/src/emu/cpu/melps4/melps4op.inc @@ -64,6 +64,13 @@ void melps4_cpu_device::op_teab() m_e = m_b << 4 | m_a; } +void melps4_cpu_device::op_tabe() +{ + // TABE(undocumented): transfer E to A and B + m_b = m_e >> 4; + m_a = m_e & 0xf; +} + void melps4_cpu_device::op_tepa() { // TEPA: decode A by PLA and transfer to E @@ -247,6 +254,22 @@ void melps4_cpu_device::op_cma() m_a ^= 0xf; } +void melps4_cpu_device::op_rl() +{ + // RL(undocumented): rotate A left through carry + UINT8 c = m_a >> 3 & 1; + m_a = (m_a << 1 | m_cy) & 0xf; + m_cy = c; +} + +void melps4_cpu_device::op_rr() +{ + // RR(undocumented): rotate A right through carry + UINT8 c = m_a & 1; + m_a = m_a >> 1 | m_cy << 3; + m_cy = c; +} + // Bit operations @@ -395,7 +418,7 @@ void melps4_cpu_device::op_trab() void melps4_cpu_device::op_t2ab() { // T2AB: transfer A and B to timer 2 and timer 2 reload - op_illegal(); + //op_illegal(); } void melps4_cpu_device::op_tab1() From 909c369610eb9c1708dd4d311b0ae7dba1970724 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Mon, 15 Jun 2015 21:14:18 +0100 Subject: [PATCH 15/21] new clones Dream Soccer '94 (Korea, M107 hardware) [Bill D. / The Dumping Union] --- src/mame/arcade.lst | 1 + src/mame/drivers/m107.c | 29 +++++++++++++++++++++++++++++ src/mame/drivers/segam1.c | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index f3609500739..4962ee7d3c7 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -1901,6 +1901,7 @@ geostorm // (c) 1994 Irem (Japan) airass // (c) 1993 Irem (World) firebarr // (c) 1993 Irem (Japan) dsoccr94 // (c) 1994 Irem (Data East Corporation license) +dsoccr94k // kftgoal // (c) 1994 Jaleco wpksoc // (c) 1995 Jaleco diff --git a/src/mame/drivers/m107.c b/src/mame/drivers/m107.c index cf5397ac5c9..bc1bd16490b 100644 --- a/src/mame/drivers/m107.c +++ b/src/mame/drivers/m107.c @@ -920,6 +920,34 @@ ROM_START( dsoccr94 ) ROM_LOAD( "ds_da0.ic24", 0x000000, 0x100000, CRC(67fc52fd) SHA1(5771e948115af8fe4a6d3f448c03a2a9b42b6f20) ) ROM_END +ROM_START( dsoccr94k ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD16_BYTE( "ic59_h0.bin", 0x000001, 0x040000, CRC(7b26d8a3) SHA1(03b4a5f0c7bd72bee24065feb22b837b373d936c) ) + ROM_LOAD16_BYTE( "ic61_l0.bin", 0x000000, 0x040000, CRC(b13f0ff4) SHA1(01d4241019abb16364090b2d00b93864d228ab98) ) + ROM_LOAD16_BYTE( "ic60_h1.bin", 0x080001, 0x040000, CRC(6109041b) SHA1(063898a88f8a6a9f1510aa55e53a39f037b02903) ) + ROM_LOAD16_BYTE( "ic62_l1.bin", 0x080000, 0x040000, CRC(97a01f6b) SHA1(e188e28f880f5f3f4d7b49eca639d643989b1468) ) + + ROM_REGION( 0x20000, "soundcpu", 0 ) + ROM_LOAD16_BYTE( "a3-sh0-c-0.ic31", 0x00001, 0x10000, CRC(23fe6ffc) SHA1(896377961cafc19e44d9d889f9fbfdbaedd556da) ) + ROM_LOAD16_BYTE( "a3-sl0-c-0.ic37", 0x00000, 0x10000, CRC(768132e5) SHA1(1bb64516eb58d3b246f08e1c07f091e78085689f) ) + + ROM_REGION( 0x400000, "gfx1", 0 ) /* chars */ + ROM_LOAD16_BYTE( "ds_c00.ic29", 0x000000, 0x100000, CRC(2d31d418) SHA1(6cd0e362bc2e3f2b20d96ee97a04bff46ee3016a) ) /* MASK ROMs with no "official" rom label */ + ROM_LOAD16_BYTE( "ds_c10.ic28", 0x000001, 0x100000, CRC(57f7bcd3) SHA1(a38e7cdfdea72d882fba414cae391ba09443e73c) ) + ROM_LOAD16_BYTE( "ds_c01.ic21", 0x200000, 0x100000, CRC(9d31a464) SHA1(1e38ac296f64d77fabfc0d5f7921a9b7a8424875) ) + ROM_LOAD16_BYTE( "ds_c11.ic20", 0x200001, 0x100000, CRC(a372e79f) SHA1(6b0889cfc2970028832566e25257927ddc461ea6) ) + + ROM_REGION( 0x400000, "gfx2", 0 ) /* sprites */ + ROM_LOAD( "ds_000.ic11", 0x000000, 0x100000, CRC(366b3e29) SHA1(cb016dcbdc6e8ea56c28c00135263666b07df991) ) /* MASK ROMs with no "official" rom label */ + ROM_LOAD( "ds_010.ic12", 0x100000, 0x100000, CRC(28a4cc40) SHA1(7f4e1ef995eaadf1945ee22ab3270cb8a21c601d) ) + ROM_LOAD( "ds_020.ic13", 0x200000, 0x100000, CRC(5a310f7f) SHA1(21969e4247c8328d27118d00604096deaf6700af) ) + ROM_LOAD( "ds_030.ic14", 0x300000, 0x100000, CRC(328b1f45) SHA1(4cbbd4d9be4fc151d426175bdbd35d8481bf2966) ) + + ROM_REGION( 0x100000, "irem", 0 ) /* ADPCM samples */ + ROM_LOAD( "ds_da0.ic24", 0x000000, 0x100000, CRC(67fc52fd) SHA1(5771e948115af8fe4a6d3f448c03a2a9b42b6f20) ) +ROM_END + + ROM_START( wpksoc ) ROM_REGION( 0x100000, "maincpu", 0 ) ROM_LOAD16_BYTE( "pk-h0-eur-d.h0", 0x000001, 0x040000, CRC(b4917788) SHA1(673294c518eaf28354fa6a3058f9325c6d9ddde6) ) @@ -1016,6 +1044,7 @@ GAME( 1993, airass, 0, airass, firebarr, m107_state, fireba GAME( 1993, firebarr, airass, firebarr, firebarr, m107_state, firebarr, ROT270, "Irem", "Fire Barrel (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) GAME( 1994, dsoccr94, 0, dsoccr94, dsoccr94, m107_state, dsoccr94, ROT0, "Irem (Data East Corporation license)", "Dream Soccer '94 (World, M107 hardware)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) +GAME( 1994, dsoccr94k, dsoccr94, dsoccr94, dsoccr94, m107_state, dsoccr94, ROT0, "Irem (Data East Corporation license)", "Dream Soccer '94 (Korea, M107 hardware)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) // default team selected is Korea, so likely a Korean set GAME( 1995, wpksoc, 0, wpksoc, wpksoc, m107_state, wpksoc, ROT0, "Jaleco", "World PK Soccer", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_NO_COCKTAIL | GAME_MECHANICAL | GAME_SUPPORTS_SAVE ) GAME( 1994, kftgoal, wpksoc, wpksoc, wpksoc, m107_state, wpksoc, ROT0, "Jaleco", "Kick for the Goal", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_NO_COCKTAIL | GAME_MECHANICAL | GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/segam1.c b/src/mame/drivers/segam1.c index d6ecaf31abb..2790a4b0431 100644 --- a/src/mame/drivers/segam1.c +++ b/src/mame/drivers/segam1.c @@ -108,4 +108,4 @@ ROM_START( bingpty ) // dumps of the X-Board part, and the LINK PCB are missing. ROM_END -GAME( 199?, bingpty, 0, segam1, segam1, driver_device, 0, ROT0, "Sega", "Bingo Party Multicart (Rev B) (Satellite board?)", GAME_NOT_WORKING | GAME_NO_SOUND ) +GAME( 199?, bingpty, 0, segam1, segam1, driver_device, 0, ROT0, "Sega", "Bingo Party Multicart (Rev B) (M1 Satellite board)", GAME_NOT_WORKING | GAME_NO_SOUND ) From 5391f93abc0341a8eb2fdb34a182444723c03287 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Mon, 15 Jun 2015 21:55:50 +0100 Subject: [PATCH 16/21] new clones Dunk Shot (Rev A, FD1089A 317-0022) [CoolMod] --- src/mame/arcade.lst | 5 +++-- src/mame/drivers/segas16b.c | 43 +++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 4962ee7d3c7..c248771df0c 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -4609,8 +4609,9 @@ cottonja // (c) 1990 (FD1094) ddux // (c) 1989 (FD1094) dduxj // (c) 1989 (FD1094) ddux1 // (c) 1989 (8751) -dunkshot // (c) 1986 (FD1094) -dunkshoto // (c) 1986 (FD1094) +dunkshot // (c) 1986 (FD1089A) +dunkshota // (c) 1986 (FD1089A) +dunkshoto // (c) 1986 (FD1089A) eswat // (c) 1989 (FD1094) eswatu // (c) 1989 (FD1094) eswatj // (c) 1989 (FD1094) diff --git a/src/mame/drivers/segas16b.c b/src/mame/drivers/segas16b.c index 6b2206f5bbf..8646a8976fc 100644 --- a/src/mame/drivers/segas16b.c +++ b/src/mame/drivers/segas16b.c @@ -4538,6 +4538,48 @@ ROM_START( dunkshot ) ROM_LOAD( "317-0022.key", 0x0000, 0x2000, CRC(4eedc66d) SHA1(50588fa13bf25a2d1322579cdc9937450543c978) ) ROM_END +ROM_START( dunkshota ) // several roms had replacement? (different style to others) labels with 'T' markings, content identical. + ROM_REGION( 0x30000, "maincpu", 0 ) // 68000 code + ROM_LOAD16_BYTE( "epr-10520a.a1", 0x000001, 0x8000, CRC(16e213ba) SHA1(efddff17d1802ccbea9eac69cedef62fa6b9a640) ) + ROM_LOAD16_BYTE( "epr-10523a.a4", 0x000000, 0x8000, CRC(22e3f074) SHA1(acdb6952308957244355bedb9cc627314a0139ef) ) + ROM_LOAD16_BYTE( "epr-10521.a2", 0x010001, 0x8000, CRC(e2d5f97a) SHA1(bf7b4a029580633fee65be89d5c9c83ff76a8484) ) // == epr-10468.a2 + ROM_LOAD16_BYTE( "epr-10524.a5", 0x010000, 0x8000, CRC(22777314) SHA1(fbc35505a94c8d4bdb44ee058e9e2e9e9b377c5c) ) // == epr-10471.a5 + ROM_LOAD16_BYTE( "epr-10522.a3", 0x020001, 0x8000, CRC(e5b5f754) SHA1(af02c46437e3cf62331753dc405211b7f90e3f62) ) + ROM_LOAD16_BYTE( "epr-10525.a6", 0x020000, 0x8000, CRC(7f41f334) SHA1(631f6113f3c0c47f2dd1ee0ea6e7db4321d7366d) ) + + ROM_REGION( 0x18000, "gfx1", 0 ) // tiles + ROM_LOAD( "epr-10528.b9", 0x00000, 0x8000, CRC(a8a3762d) SHA1(af75df6eda0df903e2b3f9680cd128da4227961d) ) + ROM_LOAD( "epr-10529.b10", 0x08000, 0x8000, CRC(80cbff50) SHA1(3641ee337194d56d774bf1be91939d03f3c0f77b) ) + ROM_LOAD( "epr-10530.b11", 0x10000, 0x8000, CRC(2dbe1e52) SHA1(a6b74f88e2f47322fbde1f6682cae58caf79f6c8) ) + + ROM_REGION16_BE( 0x80000, "sprites", 0 ) // sprites + ROM_LOAD16_BYTE( "epr-10481.b5", 0x00000, 0x8000, CRC(feb04bc9) SHA1(233dc8e3b887a88ac114723d58a909a58f0ae771) ) + ROM_RELOAD( 0x10000, 0x8000 ) + ROM_LOAD16_BYTE( "epr-10477.b1", 0x00001, 0x8000, CRC(f9d3b2cb) SHA1(b530fe16882c718122bfd1de098f39e54993de28) ) + ROM_RELOAD( 0x10001, 0x8000 ) + ROM_LOAD16_BYTE( "epr-10482.b6", 0x20000, 0x8000, CRC(5bc07618) SHA1(f4c88f81b407d467f958181770ea4fd32aab3daf) ) + ROM_RELOAD( 0x30000, 0x8000 ) + ROM_LOAD16_BYTE( "epr-10478.b2", 0x20001, 0x8000, CRC(5b5c5c92) SHA1(1c6f1cafa0788678c80ade11560f4a8d8bb7272a) ) + ROM_RELOAD( 0x30001, 0x8000 ) + ROM_LOAD16_BYTE( "epr-10483.b7", 0x40000, 0x8000, CRC(7cab4f9e) SHA1(2310a9fe604f78d74d84bea301c95e6f0e6a6085) ) + ROM_RELOAD( 0x50000, 0x8000 ) + ROM_LOAD16_BYTE( "epr-10479.b3", 0x40001, 0x8000, CRC(e84190a0) SHA1(23a8799adf81e1884a8c6b4c55397b8bca2f1850) ) + ROM_RELOAD( 0x50001, 0x8000 ) + ROM_LOAD16_BYTE( "epr-10527.b8", 0x60000, 0x8000, CRC(39b1a242) SHA1(cf0c0768d006a18345b66dd389acba1e8192ec53) ) + ROM_RELOAD( 0x70000, 0x8000 ) + ROM_LOAD16_BYTE( "epr-10526.b4", 0x60001, 0x8000, CRC(bf200754) SHA1(60900d80cfea147b011813dde558c1d39fdd274c) ) + ROM_RELOAD( 0x70001, 0x8000 ) + + ROM_REGION( 0x50000, "soundcpu", 0 ) // sound CPU + ROM_LOAD( "epr-10473.a7", 0x00000, 0x08000, CRC(7f1f5a27) SHA1(7ff91b95c883b395ab4ff5e440d78e553a09e623) ) + ROM_LOAD( "epr-10474.a8", 0x10000, 0x08000, CRC(419a656e) SHA1(aa734ae835761badeb069f99acc5fded2a19b3a3) ) + ROM_LOAD( "epr-10475.a9", 0x20000, 0x08000, CRC(17d55e85) SHA1(0c414bafecbfaa82679cc155f15f5255c186358d) ) + ROM_LOAD( "epr-10476.a10", 0x30000, 0x08000, CRC(a6be0956) SHA1(fc4d6e25e0b46679f94fddbb1850fb0b02f8d84b) ) + + ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key + ROM_LOAD( "317-0022.key", 0x0000, 0x2000, CRC(4eedc66d) SHA1(50588fa13bf25a2d1322579cdc9937450543c978) ) +ROM_END + ROM_START( dunkshoto ) ROM_REGION( 0x30000, "maincpu", 0 ) // 68000 code @@ -6903,6 +6945,7 @@ GAME( 1988, dduxj, ddux, system16b_fd1094, ddux, segas16b_state, GAME( 1988, ddux1, ddux, system16b_i8751, ddux, segas16b_state,ddux_5704, ROT0, "Sega", "Dynamite Dux (set 1, 8751 317-0095)", 0 ) GAME( 1987, dunkshot, 0, system16b_fd1089a, dunkshot, segas16b_state,dunkshot_5358_small,ROT0, "Sega", "Dunk Shot (Rev C, FD1089A 317-0022)", 0 ) +GAME( 1987, dunkshota, dunkshot, system16b_fd1089a, dunkshot, segas16b_state,dunkshot_5358_small,ROT0, "Sega", "Dunk Shot (Rev A, FD1089A 317-0022)", 0 ) GAME( 1986, dunkshoto, dunkshot, system16b_fd1089a, dunkshot, segas16b_state,dunkshot_5358_small,ROT0, "Sega", "Dunk Shot (FD1089A 317-0022)", 0 ) GAME( 1989, eswat, 0, system16b_fd1094_5797,eswat, segas16b_state,generic_5797, ROT0, "Sega", "E-Swat - Cyber Police (set 4, World, FD1094 317-0130)", 0 ) From 00daf24db907a05f18e963d183b1e79372549584 Mon Sep 17 00:00:00 2001 From: briantro Date: Mon, 15 Jun 2015 16:24:57 -0500 Subject: [PATCH 17/21] Make the most recent US version of Beast Busters the "parent" US version and older version becomes the "a" clone. - NW --- src/mame/arcade.lst | 2 +- src/mame/drivers/bbusters.c | 32 ++++++++++++++++---------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index c248771df0c..6dc98e89e4c 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -7509,7 +7509,7 @@ mechattu // A8002 'MA' (c) 1989 mechattu1 // A8002 'MA' (c) 1989 bbusters // A9003 'BB' (c) 1989 bbustersu // A9003 'BB' (c) 1989 -bbustersu3 // A9003 'BB' (c) 1989 +bbustersua // A9003 'BB' (c) 1989 // Electrocoin on early SNK hardware dmndrby // G4001 'DD' (c) 1986 diff --git a/src/mame/drivers/bbusters.c b/src/mame/drivers/bbusters.c index 2f56daf691d..8d615cd422a 100644 --- a/src/mame/drivers/bbusters.c +++ b/src/mame/drivers/bbusters.c @@ -788,10 +788,10 @@ ROM_END ROM_START( bbustersu ) ROM_REGION( 0x80000, "maincpu", 0 ) - ROM_LOAD16_BYTE( "bbv2-3.k10", 0x000000, 0x20000, CRC(6930088b) SHA1(265f0b584d81b6fdcda5c3a2e0bd15d56443bb35) ) - ROM_LOAD16_BYTE( "bbv2-5.k12", 0x000001, 0x20000, CRC(cfdb2c6c) SHA1(54a837dc84b74d12e931f607f3dc9ee06a7e4d31) ) - ROM_LOAD16_BYTE( "bb-2.k8", 0x040000, 0x20000, CRC(20141805) SHA1(0958579681bda81bcf48d020a14bc147c1e575f1) ) - ROM_LOAD16_BYTE( "bb-4.k11", 0x040001, 0x20000, CRC(d482e0e9) SHA1(e56ca92965e8954b613ba4b0e3975e3a12840c30) ) + ROM_LOAD16_BYTE( "bb-ver3-u3.k10", 0x000000, 0x20000, CRC(c80ec3bc) SHA1(81cccc920c6dc58ccd20fb38bfede717f534986f) ) + ROM_LOAD16_BYTE( "bb-ver3-u5.k12", 0x000001, 0x20000, CRC(5ded86d1) SHA1(de2ce91b85a1d74e60a7093211c1a7d3c27c1d72) ) + ROM_LOAD16_BYTE( "bb-2.k8", 0x040000, 0x20000, CRC(20141805) SHA1(0958579681bda81bcf48d020a14bc147c1e575f1) ) + ROM_LOAD16_BYTE( "bb-4.k11", 0x040001, 0x20000, CRC(d482e0e9) SHA1(e56ca92965e8954b613ba4b0e3975e3a12840c30) ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "bb-1.e6", 0x000000, 0x10000, CRC(4360f2ee) SHA1(4c6b212f59389bdf4388893d2030493b110ac087) ) @@ -834,12 +834,12 @@ ROM_START( bbustersu ) ROM_LOAD( "bbusters-eeprom.bin", 0x00, 0x100, CRC(a52ebd66) SHA1(de04db6f1510700c61bf152799452a80220ae87c) ) ROM_END -ROM_START( bbustersu3 ) +ROM_START( bbustersua ) ROM_REGION( 0x80000, "maincpu", 0 ) - ROM_LOAD16_BYTE( "bb-ver3-u3.k10", 0x000000, 0x20000, CRC(c80ec3bc) SHA1(81cccc920c6dc58ccd20fb38bfede717f534986f) ) - ROM_LOAD16_BYTE( "bb-ver3-u5.k12", 0x000001, 0x20000, CRC(5ded86d1) SHA1(de2ce91b85a1d74e60a7093211c1a7d3c27c1d72) ) - ROM_LOAD16_BYTE( "bb-2.k8", 0x040000, 0x20000, CRC(20141805) SHA1(0958579681bda81bcf48d020a14bc147c1e575f1) ) - ROM_LOAD16_BYTE( "bb-4.k11", 0x040001, 0x20000, CRC(d482e0e9) SHA1(e56ca92965e8954b613ba4b0e3975e3a12840c30) ) + ROM_LOAD16_BYTE( "bb-ver2-u3.k10", 0x000000, 0x20000, CRC(6930088b) SHA1(265f0b584d81b6fdcda5c3a2e0bd15d56443bb35) ) + ROM_LOAD16_BYTE( "bb-ver2-u5.k12", 0x000001, 0x20000, CRC(cfdb2c6c) SHA1(54a837dc84b74d12e931f607f3dc9ee06a7e4d31) ) + ROM_LOAD16_BYTE( "bb-2.k8", 0x040000, 0x20000, CRC(20141805) SHA1(0958579681bda81bcf48d020a14bc147c1e575f1) ) + ROM_LOAD16_BYTE( "bb-4.k11", 0x040001, 0x20000, CRC(d482e0e9) SHA1(e56ca92965e8954b613ba4b0e3975e3a12840c30) ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "bb-1.e6", 0x000000, 0x10000, CRC(4360f2ee) SHA1(4c6b212f59389bdf4388893d2030493b110ac087) ) @@ -1068,11 +1068,11 @@ ROM_END /******************************************************************************/ // as soon as you calibrate the guns in test mode the game refuses to boot -GAME( 1989, bbusters, 0, bbusters, bbusters, driver_device, 0, ROT0, "SNK", "Beast Busters (World)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) -GAME( 1989, bbustersu,bbusters, bbusters, bbusters, driver_device, 0, ROT0, "SNK", "Beast Busters (US, Version 2)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) -GAME( 1989, bbustersu3,bbusters,bbusters, bbusters, driver_device, 0, ROT0, "SNK", "Beast Busters (US, Version 3)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1989, bbusters, 0, bbusters, bbusters, driver_device, 0, ROT0, "SNK", "Beast Busters (World)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1989, bbustersu, bbusters, bbusters, bbusters, driver_device, 0, ROT0, "SNK", "Beast Busters (US, Version 3)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1989, bbustersua, bbusters, bbusters, bbusters, driver_device, 0, ROT0, "SNK", "Beast Busters (US, Version 2)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) -GAME( 1989, mechatt, 0, mechatt, mechatt, driver_device, 0, ROT0, "SNK", "Mechanized Attack (World)", GAME_SUPPORTS_SAVE ) -GAME( 1989, mechattj, mechatt, mechatt, mechattj, driver_device, 0, ROT0, "SNK", "Mechanized Attack (Japan)", GAME_SUPPORTS_SAVE ) -GAME( 1989, mechattu, mechatt, mechatt, mechattu, driver_device, 0, ROT0, "SNK", "Mechanized Attack (US)", GAME_SUPPORTS_SAVE ) -GAME( 1989, mechattu1,mechatt, mechatt, mechattu, driver_device, 0, ROT0, "SNK", "Mechanized Attack (US, Version 1, Single Player)", GAME_SUPPORTS_SAVE ) +GAME( 1989, mechatt, 0, mechatt, mechatt, driver_device, 0, ROT0, "SNK", "Mechanized Attack (World)", GAME_SUPPORTS_SAVE ) +GAME( 1989, mechattj, mechatt, mechatt, mechattj, driver_device, 0, ROT0, "SNK", "Mechanized Attack (Japan)", GAME_SUPPORTS_SAVE ) +GAME( 1989, mechattu, mechatt, mechatt, mechattu, driver_device, 0, ROT0, "SNK", "Mechanized Attack (US)", GAME_SUPPORTS_SAVE ) +GAME( 1989, mechattu1, mechatt, mechatt, mechattu, driver_device, 0, ROT0, "SNK", "Mechanized Attack (US, Version 1, Single Player)", GAME_SUPPORTS_SAVE ) From aeca2883733608ee562e5942e45047f927b3134a Mon Sep 17 00:00:00 2001 From: Scott Stone Date: Mon, 15 Jun 2015 17:54:12 -0400 Subject: [PATCH 18/21] New Bios Added -------------- Megatech Ver 0 Rev A (alt?) [zozo] --- src/mame/drivers/megatech.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mame/drivers/megatech.c b/src/mame/drivers/megatech.c index 02a61342eca..27cf39abb4d 100644 --- a/src/mame/drivers/megatech.c +++ b/src/mame/drivers/megatech.c @@ -791,7 +791,11 @@ MACHINE_CONFIG_END ROM_SYSTEM_BIOS( 1, "ver0a", "Ver 0 Rev A" ) \ ROMX_LOAD( "epr-12263a.20", 0x000000, 0x8000, CRC(07c3f423) SHA1(50c28bbc2d4349c820d988ae3f20aae3f808545f), ROM_BIOS(2)) \ ROM_SYSTEM_BIOS( 2, "ver0b", "Ver 0 Rev B" ) \ - ROMX_LOAD( "epr-12263b.20", 0x000000, 0x8000, CRC(ca26c87a) SHA1(987a18bede6e54cd73c4434426eb6c302a37cdc5), ROM_BIOS(3)) + ROMX_LOAD( "epr-12263b.20", 0x000000, 0x8000, CRC(ca26c87a) SHA1(987a18bede6e54cd73c4434426eb6c302a37cdc5), ROM_BIOS(3)) \ + ROM_SYSTEM_BIOS( 3, "ver0aa","Ver 0 Rev B (alt?)" ) \ + ROMX_LOAD( "EPR-12604a.", 0x000000, 0x8000, CRC(884e4aa5) SHA1(c9008c431a937c084fb475273093ca0b434b5f47), ROM_BIOS(4)) + + /* no games */ ROM_START( megatech ) MEGATECH_BIOS From 9cab60eeb34c0770bfc2cb68b69b505398e1646f Mon Sep 17 00:00:00 2001 From: David Haywood Date: Mon, 15 Jun 2015 23:50:14 +0100 Subject: [PATCH 19/21] (nw) --- src/mame/video/segas32.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mame/video/segas32.c b/src/mame/video/segas32.c index b04df8b8a26..16f9f75d271 100644 --- a/src/mame/video/segas32.c +++ b/src/mame/video/segas32.c @@ -210,6 +210,9 @@ void segas32_state::common_start(int multi32) { + if(!m_gfxdecode->started()) + throw device_missing_dependencies(); + int tmap; /* remember whether or not we are multi32 */ From 9abbf5984bbbb1cefe1464d035af931d4ec1dfcf Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Mon, 15 Jun 2015 19:08:58 -0400 Subject: [PATCH 20/21] fix case of new megatech rom, add location (the megatech mb has only one rom socket on it as far as I can see, so it must be ic20) (n/w) --- src/mame/drivers/megatech.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/drivers/megatech.c b/src/mame/drivers/megatech.c index 27cf39abb4d..ff7994cdc4d 100644 --- a/src/mame/drivers/megatech.c +++ b/src/mame/drivers/megatech.c @@ -793,7 +793,7 @@ MACHINE_CONFIG_END ROM_SYSTEM_BIOS( 2, "ver0b", "Ver 0 Rev B" ) \ ROMX_LOAD( "epr-12263b.20", 0x000000, 0x8000, CRC(ca26c87a) SHA1(987a18bede6e54cd73c4434426eb6c302a37cdc5), ROM_BIOS(3)) \ ROM_SYSTEM_BIOS( 3, "ver0aa","Ver 0 Rev B (alt?)" ) \ - ROMX_LOAD( "EPR-12604a.", 0x000000, 0x8000, CRC(884e4aa5) SHA1(c9008c431a937c084fb475273093ca0b434b5f47), ROM_BIOS(4)) + ROMX_LOAD( "epr-12604a.20", 0x000000, 0x8000, CRC(884e4aa5) SHA1(c9008c431a937c084fb475273093ca0b434b5f47), ROM_BIOS(4)) /* no games */ From e3fdd3f0335fc6ba632b792c448d941f2bd514e9 Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Mon, 15 Jun 2015 19:39:06 -0400 Subject: [PATCH 21/21] update tms5110r.c comments (n/w) --- src/emu/sound/tms5110r.inc | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/emu/sound/tms5110r.inc b/src/emu/sound/tms5110r.inc index 3d34c0b5e3c..40ec66b8f4d 100644 --- a/src/emu/sound/tms5110r.inc +++ b/src/emu/sound/tms5110r.inc @@ -214,7 +214,7 @@ struct tms5100_coeffs /* K8 */\ { -205, -112, -10, 92, 187, 269, 336, 387 },\ /* K9 */\ - { -249, -183, -110, -32, 48, 126, 198, 261 }, /* on patents 4,403,965 and 4,946,391 the 4th entry is -19 which is wrong! should be -32*/\ + { -249, -183, -110, -32, 48, 126, 198, 261 }, /* on patents 4,403,965 and 4,946,391 the 4th entry is 0x3ED (-19) which is a typo of the correct value of 0x3E0 (-32)*/\ /* K10 */\ { -190, -133, -73, -10, 53, 115, 173, 227 }, @@ -390,11 +390,18 @@ static const struct tms5100_coeffs T0280D_0281D_coeff = Used in the Speak & Math, Speak & Read, and Language Translator Decapped by Digshadow in 2014 http://siliconpr0n.org/map/ti/tmc0280fnl/ Digitally dumped via PROMOUT by PlgDavid in 2014 - The coefficients are exactly the same as the TMS5200 - The coefficients also come from US Patents 4,403,965 and 4,946,391 (with one error in the patent); -The Mitsubishi M58817 also seems to work best with these coefficients, so its possible the engineers of that chip copied them from the TI patents, see next entry - ***TODO: there are 2 versions of this chip, and the interpolation behavior between the two differs slightly: - * TMC0280NLP // CD2801 with datecodes around 1980 has the same interpolation inhibit behavior as 5100/TMC0281 on unvoiced->silent transition + The coefficients are exactly the same as the TMS5200. + The coefficients also come from US Patents 4,403,965 and 4,946,391 (with + one typo in the patent). + The chirp table is very slightly different from the 4,209,836 patent one, + but matches the table in the 4,403,965 and 4,946,391 patents. + The Mitsubishi M58817 also seems to work best with these coefficients, so + it is possible the engineers of that chip copied them from the TI patents. + ***TODO: there are 2 versions of this chip, and the interpolation + behavior between the two differs slightly: + * TMC0280NLP // CD2801 with datecodes around 1980 has the same + interpolation inhibit behavior as 5100/TMC0281 on unvoiced->silent + transition. * CD2801A-NL with datecodes around 1982 have the 'alternate behavior' */ static const struct tms5100_coeffs T0280F_2801A_coeff = @@ -416,7 +423,10 @@ static const struct tms5100_coeffs T0280F_2801A_coeff = }; /* Mitsubishi M58817 -The Mitsubishi M58817 seems to have (partly?) copied the coefficients from the TMC0280/CD2801 above, but has some slight differences to it within the chip: the main accumulator seems to have 1 extra bit and the digital values are tapped 1 bit higher than on the TI chips. This is emulated within tms5110.c +The Mitsubishi M58817 seems to have (partly?) copied the coefficients from the +TMC0280/CD2801 above, but has some slight differences to it within the chip: +the main accumulator seems to have 1 extra bit and the digital values are +tapped 1 bit higher than on the TI chips. This is emulated within tms5110.c */ static const struct tms5100_coeffs M58817_coeff = { @@ -560,16 +570,17 @@ Note that the K coefficients are VERY different from the coefficients given in the US 4,335,277 patent, which may have been for some sort of prototype or otherwise intentionally scrambled. The energy and pitch tables, however, are identical to that patent. -Also note, that the K coefficients are ALMOST identical to the coefficients from the CD2802. -The interpolation coefficients still come from the patents pending verification - of the interpolation counter circuit from the chip decap image. +Also note, that the K coefficients are identical to the coefficients from the + CD2801 (which itself is almost identical to the CD2802). NOTE FROM DECAP: immediately to the left of each of the K1,2,3,4,5,and 6 coefficients in the LPC rom are extra columns containing the constants -510, -502, 313, 318, or in hex 0x202, 0x20A, 0x139, 0x13E. Those EXACT constants DO appear (rather nonsensically) on the lpc table in US patent 4,335,277. They are likely related to the multiplicative interpolator described in us patent 4,419,540; whether the 5200/2501E and the 5220 or 5220C - actually implement this interpolator or not is unclear. + actually implement this interpolator or not is unclear. This interpolator + seems intended for chips with variable frame rate, so it may only exist + on the TMS/TSP5220C and CD2501ECD. */ static const struct tms5100_coeffs T0285_2501E_coeff =