diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/mame/drivers/neodrvr.c | 90 | ||||
| -rw-r--r-- | src/mame/drivers/neogeo.c | 95 | ||||
| -rw-r--r-- | src/mame/includes/neogeo.h | 1 | ||||
| -rw-r--r-- | src/mame/mame.lst | 1 |
4 files changed, 182 insertions, 5 deletions
diff --git a/src/mame/drivers/neodrvr.c b/src/mame/drivers/neodrvr.c index 05f5b941001..6a341fd924f 100644 --- a/src/mame/drivers/neodrvr.c +++ b/src/mame/drivers/neodrvr.c @@ -9743,11 +9743,97 @@ static DRIVER_INIT( lans2004 ) } +driver_init_func neo_gameinit; + +static DRIVER_INIT( mvs ) +{ + DRIVER_INIT_CALL(neogeo); +} + + +// handle protected carts +void mvs_install_protection(device_image_interface& image) +{ +// neogeo_state *state = image.device().machine().driver_data<neogeo_state>(); + const char *crypt_feature = image.get_feature( "crypt" ); + + if(crypt_feature == NULL) + { + neo_gameinit = driver_init_neogeo; + } + else + { + /* work out which Driver Init decryption function to call based on flag in softlist + - note this is called AFTER the regular DRIVER_INIT */ + + if(strcmp(crypt_feature,"mslugx_prot") == 0) { neo_gameinit = driver_init_mslugx; } + else if(strcmp(crypt_feature,"fatfury2_prot") == 0) { neo_gameinit = driver_init_fatfury2; } + else if(strcmp(crypt_feature,"kog_prot") == 0) { neo_gameinit = driver_init_kog; } + else if(strcmp(crypt_feature,"kof98_prot") == 0) { neo_gameinit = driver_init_kof98; } + else if(strcmp(crypt_feature,"kof99_prot") == 0) { neo_gameinit = driver_init_kof99; } + else if(strcmp(crypt_feature,"kof99k_prot") == 0) { neo_gameinit = driver_init_kof99k; } + else if(strcmp(crypt_feature,"garou_prot") == 0) { neo_gameinit = driver_init_garou; } + else if(strcmp(crypt_feature,"garouo_prot") == 0) { neo_gameinit = driver_init_garouo; } + else if(strcmp(crypt_feature,"garoubl_prot") == 0) { neo_gameinit = driver_init_garoubl; } + else if(strcmp(crypt_feature,"mslug3_prot") == 0) { neo_gameinit = driver_init_mslug3; } + else if(strcmp(crypt_feature,"mslug3h_prot") == 0) { neo_gameinit = driver_init_mslug3h; } + else if(strcmp(crypt_feature,"mslug3b6_prot") == 0) { neo_gameinit = driver_init_mslug3b6; } + else if(strcmp(crypt_feature,"kof2000_prot") == 0) { neo_gameinit = driver_init_kof2000; } + else if(strcmp(crypt_feature,"kof2000n_prot") == 0) { neo_gameinit = driver_init_kof2000n; } + else if(strcmp(crypt_feature,"sengoku3_prot") == 0) { neo_gameinit = driver_init_sengoku3; } + else if(strcmp(crypt_feature,"zupapa_prot") == 0) { neo_gameinit = driver_init_zupapa; } + else if(strcmp(crypt_feature,"kof2001_prot") == 0) { neo_gameinit = driver_init_kof2001; } + else if(strcmp(crypt_feature,"cthd2003_prot") == 0) { neo_gameinit = driver_init_cthd2003; } + else if(strcmp(crypt_feature,"ct2k3sp_prot") == 0) { neo_gameinit = driver_init_ct2k3sp; } + else if(strcmp(crypt_feature,"ct2k3sa_prot") == 0) { neo_gameinit = driver_init_ct2k3sa; } + else if(strcmp(crypt_feature,"kof2002_prot") == 0) { neo_gameinit = driver_init_kof2002; } + else if(strcmp(crypt_feature,"kof2002b_prot") == 0) { neo_gameinit = driver_init_kof2002b; } + else if(strcmp(crypt_feature,"kf2k2pls_prot") == 0) { neo_gameinit = driver_init_kf2k2pls; } + else if(strcmp(crypt_feature,"kf2k2mp_prot") == 0) { neo_gameinit = driver_init_kf2k2mp; } + else if(strcmp(crypt_feature,"kf2k2mp2_prot") == 0) { neo_gameinit = driver_init_kf2k2mp2; } + else if(strcmp(crypt_feature,"kof10th_prot") == 0) { neo_gameinit = driver_init_kof10th; } + else if(strcmp(crypt_feature,"kf10thep_prot") == 0) { neo_gameinit = driver_init_kf10thep; } + else if(strcmp(crypt_feature,"kf2k5uni_prot") == 0) { neo_gameinit = driver_init_kf2k5uni; } + else if(strcmp(crypt_feature,"kof2k4se_prot") == 0) { neo_gameinit = driver_init_kof2k4se; } + else if(strcmp(crypt_feature,"mslug5_prot") == 0) { neo_gameinit = driver_init_mslug5; } + else if(strcmp(crypt_feature,"ms5plus_prot") == 0) { neo_gameinit = driver_init_ms5plus; } + else if(strcmp(crypt_feature,"svc_prot") == 0) { neo_gameinit = driver_init_svc; } + else if(strcmp(crypt_feature,"svcboot_prot") == 0) { neo_gameinit = driver_init_svcboot; } + else if(strcmp(crypt_feature,"svcplus_prot") == 0) { neo_gameinit = driver_init_svcplus; } + else if(strcmp(crypt_feature,"svcplusa_prot") == 0) { neo_gameinit = driver_init_svcplusa; } + else if(strcmp(crypt_feature,"svcsplus_prot") == 0) { neo_gameinit = driver_init_svcsplus; } + else if(strcmp(crypt_feature,"samsho5_prot") == 0) { neo_gameinit = driver_init_samsho5; } + else if(strcmp(crypt_feature,"samsho5b_prot") == 0) { neo_gameinit = driver_init_samsho5b; } + else if(strcmp(crypt_feature,"kof2003_prot") == 0) { neo_gameinit = driver_init_kof2003; } + else if(strcmp(crypt_feature,"kof2003h_prot") == 0) { neo_gameinit = driver_init_kof2003h; } + else if(strcmp(crypt_feature,"kf2k3bl_prot") == 0) { neo_gameinit = driver_init_kf2k3bl; } + else if(strcmp(crypt_feature,"kf2k3pl_prot") == 0) { neo_gameinit = driver_init_kf2k3pl; } + else if(strcmp(crypt_feature,"kf2k3upl_prot") == 0) { neo_gameinit = driver_init_kf2k3upl; } + else if(strcmp(crypt_feature,"samsh5sp_prot") == 0) { neo_gameinit = driver_init_samsh5sp; } + else if(strcmp(crypt_feature,"preisle2_prot") == 0) { neo_gameinit = driver_init_preisle2; } + else if(strcmp(crypt_feature,"nitd_prot") == 0) { neo_gameinit = driver_init_nitd; } + else if(strcmp(crypt_feature,"s1945p_prot") == 0) { neo_gameinit = driver_init_s1945p; } + else if(strcmp(crypt_feature,"lans2004_prot") == 0) { neo_gameinit = driver_init_lans2004; } + else if(strcmp(crypt_feature,"pnyaa_prot") == 0) { neo_gameinit = driver_init_pnyaa; } + else if(strcmp(crypt_feature,"ganryu_prot") == 0) { neo_gameinit = driver_init_ganryu; } + else if(strcmp(crypt_feature,"bangbead_prot") == 0) { neo_gameinit = driver_init_bangbead; } + else if(strcmp(crypt_feature,"mslug4_prot") == 0) { neo_gameinit = driver_init_mslug4; } + else if(strcmp(crypt_feature,"ms4plus_prot") == 0) { neo_gameinit = driver_init_ms4plus; } + else if(strcmp(crypt_feature,"rotd_prot") == 0) { neo_gameinit = driver_init_rotd; } + else if(strcmp(crypt_feature,"matrim_prot") == 0) { neo_gameinit = driver_init_matrim; } + else if(strcmp(crypt_feature,"matrimbl_prot") == 0) { neo_gameinit = driver_init_matrimbl; } + else { fatalerror("unknown crypt type\n"); } + } + + if (neo_gameinit) neo_gameinit(image.device().machine()); +} + /****************************************************************************/ -/* YEAR NAME PARENT MACHINE INPUT INIT MONITOR */ -GAME( 1990, neogeo, 0, neogeo, neogeo, neogeo, ROT0, "SNK", "Neo-Geo", GAME_IS_BIOS_ROOT | GAME_SUPPORTS_SAVE ) +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT */ +CONS( 1990, neogeo, 0, 0, mvs, neogeo, mvs, "SNK", "Neo-Geo", GAME_IS_BIOS_ROOT | GAME_SUPPORTS_SAVE ) +/* YEAR NAME PARENT MACHINE INPUT INIT MONITOR */ /* SNK */ GAME( 1990, nam1975, neogeo, neogeo, neogeo, neogeo, ROT0, "SNK", "NAM-1975 (NGM-001)(NGH-001)", GAME_SUPPORTS_SAVE ) GAME( 1990, bstars, neogeo, neogeo, neogeo, neogeo, ROT0, "SNK", "Baseball Stars Professional (NGM-002)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/neogeo.c b/src/mame/drivers/neogeo.c index 1d13f779f30..5a28b0bdb3d 100644 --- a/src/mame/drivers/neogeo.c +++ b/src/mame/drivers/neogeo.c @@ -147,7 +147,7 @@ #include "machine/pd4990a.h" #include "cpu/z80/z80.h" #include "sound/2610intf.h" - +#include "imagedev/cartslot.h" #include "neogeo.lh" @@ -388,7 +388,7 @@ static CUSTOM_INPUT( multiplexed_controller_r ) return input_port_read_safe(field.machine(), cntrl[port][state->m_controller_select & 0x01], 0x00); } - +#if 1 // this needs to be added dynamically somehow static CUSTOM_INPUT( mahjong_controller_r ) { neogeo_state *state = field.machine().driver_data<neogeo_state>(); @@ -413,7 +413,7 @@ cpu #0 (PC=00C18C40): unmapped memory word write to 00380000 = 0000 & 00FF return ret; } - +#endif static WRITE16_HANDLER( io_control_w ) { @@ -1275,6 +1275,82 @@ INPUT_PORTS_END +static DEVICE_IMAGE_LOAD( neo_cartridge ) +{ + UINT32 size; + device_t* ym = image.device().machine().device("ymsnd"); + + // first check software list + if(image.software_entry() != NULL) + { + // create memory regions + size = image.get_software_region_length("maincpu"); + image.device().machine().region_free("maincpu"); + image.device().machine().region_alloc("maincpu",size, 2, ENDIANNESS_BIG); + memcpy(image.device().machine().region("maincpu")->base(),image.get_software_region("maincpu"),size); + + // for whatever reason (intentional, or design flaw) software loaded via software lists is swapped in endianess vs. the standard ROM loading, regardless of the above. Swap it to keep consistency + for (int i=0; i<size/2;i++) + { + UINT16* ROM = (UINT16*)image.device().machine().region("maincpu")->base(); + ROM[i] = ((ROM[i]&0xff00)>>8) | ((ROM[i]&0x00ff)<<8); + } + + size = image.get_software_region_length("fixed"); + image.device().machine().region_free("fixed"); + image.device().machine().region_alloc("fixed",size,1, ENDIANNESS_LITTLE); + memcpy(image.device().machine().region("fixed")->base(),image.get_software_region("fixed"),size); + + if(image.get_software_region("audiocpu") != NULL) + { + size = image.get_software_region_length("audiocpu"); + image.device().machine().region_free("audiocpu"); + image.device().machine().region_alloc("audiocpu",size+0x10000,1, ENDIANNESS_LITTLE); + memcpy(image.device().machine().region("audiocpu")->base(),image.get_software_region("audiocpu"),size); + memcpy(image.device().machine().region("audiocpu")->base()+0x10000,image.get_software_region("audiocpu"),size); // avoid reloading in XML, should just improve banking instead tho? + } + + + size = image.get_software_region_length("ymsnd"); + image.device().machine().region_free("ymsnd"); + image.device().machine().region_alloc("ymsnd",size,1, ENDIANNESS_LITTLE); + memcpy(image.device().machine().region("ymsnd")->base(),image.get_software_region("ymsnd"),size); + if(image.get_software_region("ymsnd.deltat") != NULL) + { + size = image.get_software_region_length("ymsnd.deltat"); + image.device().machine().region_free("ymsnd.deltat"); + image.device().machine().region_alloc("ymsnd.deltat",size,1, ENDIANNESS_LITTLE); + memcpy(image.device().machine().region("ymsnd.deltat")->base(),image.get_software_region("ymsnd.deltat"),size); + } + else + image.device().machine().region_free("ymsnd.deltat"); // removing the region will fix sound glitches in non-Delta-T games + ym->reset(); + size = image.get_software_region_length("sprites"); + image.device().machine().region_free("sprites"); + image.device().machine().region_alloc("sprites",size,1, ENDIANNESS_LITTLE); + memcpy(image.device().machine().region("sprites")->base(),image.get_software_region("sprites"),size); + if(image.get_software_region("audiocrypt") != NULL) // encrypted Z80 code + { + size = image.get_software_region_length("audiocrypt"); + image.device().machine().region_alloc("audiocrypt",size,1, ENDIANNESS_LITTLE); + memcpy(image.device().machine().region("audiocrypt")->base(),image.get_software_region("audiocrypt"),size); + // allocate the audiocpu region to decrypt data into + image.device().machine().region_free("audiocpu"); + image.device().machine().region_alloc("audiocpu",size+0x10000,1, ENDIANNESS_LITTLE); + } + + // setup cartridge ROM area + image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x000080,0x0fffff,"cart_rom"); + memory_set_bankptr(image.device().machine(),"cart_rom",&image.device().machine().region("maincpu")->base()[0x80]); + + // handle possible protection + mvs_install_protection(image); + + return IMAGE_INIT_PASS; + } + return IMAGE_INIT_FAIL; +} + /************************************* * @@ -1323,6 +1399,19 @@ static MACHINE_CONFIG_START( neogeo, neogeo_state ) MCFG_UPD4990A_ADD("upd4990a") MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( mvs, neogeo ) + + MCFG_MEMCARD_HANDLER(neogeo) + + MCFG_CARTSLOT_ADD("cart") + MCFG_CARTSLOT_LOAD(neo_cartridge) + MCFG_CARTSLOT_INTERFACE("neo_cart") + MCFG_CARTSLOT_MANDATORY + + MCFG_SOFTWARE_LIST_ADD("cart_list","neogeo") +MACHINE_CONFIG_END + + /************************************* * * Driver initalization diff --git a/src/mame/includes/neogeo.h b/src/mame/includes/neogeo.h index 3dd2343df1c..623fd9a4763 100644 --- a/src/mame/includes/neogeo.h +++ b/src/mame/includes/neogeo.h @@ -205,6 +205,7 @@ void samsho5b_px_decrypt(running_machine &machine); void samsho5b_vx_decrypt(running_machine &machine); void matrimbl_decrypt(running_machine &machine); +void mvs_install_protection(device_image_interface& image); /*----------- defined in video/neogeo.c -----------*/ diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 5e980edde4f..07caf9ff93b 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -6052,6 +6052,7 @@ sscope2 // GX931 (c)2000 racingj // GX676 (c)1998 racingj2 // GX888 (c)1999 (EAE) racingj2j // GX888 (c)1999 (JAE) +racjamdx // G?676 (c)1997 Japan JAA thrilld // GX713 (c)1998 Japan JAE thrilldb // GX713 (c)1998 Japan JAB thrilldae // GX713 (c)1998 Europe EAA |
