trunk/src/mame/drivers/neodrvr.c
r21155 | r21156 | |
9289 | 9289 | DRIVER_INIT_MEMBER(neogeo_state,fatfury2) |
9290 | 9290 | { |
9291 | 9291 | DRIVER_INIT_CALL(neogeo); |
9292 | | fatfury2_install_protection(machine()); |
| 9292 | fatfury2_install_protection(); |
9293 | 9293 | } |
9294 | 9294 | |
9295 | 9295 | DRIVER_INIT_MEMBER(neogeo_state,zupapa) |
9296 | 9296 | { |
9297 | 9297 | DRIVER_INIT_CALL(neogeo); |
9298 | 9298 | m_fixed_layer_bank_type = 1; |
9299 | | kof99_neogeo_gfx_decrypt(machine(), 0xbd); |
| 9299 | kof99_neogeo_gfx_decrypt(0xbd); |
9300 | 9300 | } |
9301 | 9301 | |
9302 | 9302 | DRIVER_INIT_MEMBER(neogeo_state,kof98) |
9303 | 9303 | { |
9304 | 9304 | DRIVER_INIT_CALL(neogeo); |
9305 | | kof98_decrypt_68k(machine()); |
9306 | | install_kof98_protection(machine()); |
| 9305 | kof98_decrypt_68k(); |
| 9306 | install_kof98_protection(); |
9307 | 9307 | } |
9308 | 9308 | |
9309 | 9309 | DRIVER_INIT_MEMBER(neogeo_state,mslugx) |
9310 | 9310 | { |
9311 | 9311 | DRIVER_INIT_CALL(neogeo); |
9312 | | mslugx_install_protection(machine()); |
| 9312 | mslugx_install_protection(); |
9313 | 9313 | } |
9314 | 9314 | |
9315 | 9315 | DRIVER_INIT_MEMBER(neogeo_state,kof99) |
9316 | 9316 | { |
9317 | 9317 | DRIVER_INIT_CALL(neogeo); |
9318 | | kof99_decrypt_68k(machine()); |
| 9318 | kof99_decrypt_68k(); |
9319 | 9319 | m_fixed_layer_bank_type = 1; |
9320 | | kof99_neogeo_gfx_decrypt(machine(), 0x00); |
9321 | | kof99_install_protection(machine()); |
| 9320 | kof99_neogeo_gfx_decrypt(0x00); |
| 9321 | kof99_install_protection(); |
9322 | 9322 | } |
9323 | 9323 | |
9324 | 9324 | DRIVER_INIT_MEMBER(neogeo_state,kof99k) |
9325 | 9325 | { |
9326 | 9326 | DRIVER_INIT_CALL(neogeo); |
9327 | 9327 | m_fixed_layer_bank_type = 1; |
9328 | | kof99_neogeo_gfx_decrypt(machine(), 0x00); |
| 9328 | kof99_neogeo_gfx_decrypt(0x00); |
9329 | 9329 | } |
9330 | 9330 | |
9331 | 9331 | DRIVER_INIT_MEMBER(neogeo_state,garou) |
9332 | 9332 | { |
9333 | 9333 | DRIVER_INIT_CALL(neogeo); |
9334 | | garou_decrypt_68k(machine()); |
| 9334 | garou_decrypt_68k(); |
9335 | 9335 | m_fixed_layer_bank_type = 1; |
9336 | | kof99_neogeo_gfx_decrypt(machine(), 0x06); |
9337 | | garou_install_protection(machine()); |
| 9336 | kof99_neogeo_gfx_decrypt(0x06); |
| 9337 | garou_install_protection(); |
9338 | 9338 | } |
9339 | 9339 | |
9340 | 9340 | DRIVER_INIT_MEMBER(neogeo_state,garouh) |
9341 | 9341 | { |
9342 | 9342 | DRIVER_INIT_CALL(neogeo); |
9343 | | garouh_decrypt_68k(machine()); |
| 9343 | garouh_decrypt_68k(); |
9344 | 9344 | m_fixed_layer_bank_type = 1; |
9345 | | kof99_neogeo_gfx_decrypt(machine(), 0x06); |
9346 | | garouh_install_protection(machine()); |
| 9345 | kof99_neogeo_gfx_decrypt(0x06); |
| 9346 | garouh_install_protection(); |
9347 | 9347 | } |
9348 | 9348 | |
9349 | 9349 | DRIVER_INIT_MEMBER(neogeo_state,garoubl) |
9350 | 9350 | { |
9351 | 9351 | DRIVER_INIT_CALL(neogeo); |
9352 | | neogeo_bootleg_sx_decrypt(machine(), 2); |
9353 | | neogeo_bootleg_cx_decrypt(machine()); |
| 9352 | neogeo_bootleg_sx_decrypt(2); |
| 9353 | neogeo_bootleg_cx_decrypt(); |
9354 | 9354 | } |
9355 | 9355 | |
9356 | 9356 | DRIVER_INIT_MEMBER(neogeo_state,mslug3) |
9357 | 9357 | { |
9358 | 9358 | DRIVER_INIT_CALL(neogeo); |
9359 | | mslug3_decrypt_68k(machine()); |
| 9359 | mslug3_decrypt_68k(); |
9360 | 9360 | m_fixed_layer_bank_type = 1; |
9361 | | kof99_neogeo_gfx_decrypt(machine(), 0xad); |
9362 | | mslug3_install_protection(machine()); |
| 9361 | kof99_neogeo_gfx_decrypt(0xad); |
| 9362 | mslug3_install_protection(); |
9363 | 9363 | } |
9364 | 9364 | |
9365 | 9365 | DRIVER_INIT_MEMBER(neogeo_state,mslug3h) |
9366 | 9366 | { |
9367 | 9367 | DRIVER_INIT_CALL(neogeo); |
9368 | 9368 | m_fixed_layer_bank_type = 1; |
9369 | | kof99_neogeo_gfx_decrypt(machine(), 0xad); |
| 9369 | kof99_neogeo_gfx_decrypt(0xad); |
9370 | 9370 | } |
9371 | 9371 | |
9372 | 9372 | DRIVER_INIT_MEMBER(neogeo_state,mslug3b6) |
9373 | 9373 | { |
9374 | 9374 | DRIVER_INIT_CALL(neogeo); |
9375 | | neogeo_bootleg_sx_decrypt(machine(), 2); |
9376 | | cmc42_neogeo_gfx_decrypt(machine(), 0xad); |
| 9375 | neogeo_bootleg_sx_decrypt(2); |
| 9376 | cmc42_neogeo_gfx_decrypt(0xad); |
9377 | 9377 | } |
9378 | 9378 | |
9379 | 9379 | DRIVER_INIT_MEMBER(neogeo_state,kof2000) |
9380 | 9380 | { |
9381 | 9381 | DRIVER_INIT_CALL(neogeo); |
9382 | | kof2000_decrypt_68k(machine()); |
| 9382 | kof2000_decrypt_68k(); |
9383 | 9383 | m_fixed_layer_bank_type = 2; |
9384 | | neogeo_cmc50_m1_decrypt(machine()); |
9385 | | kof2000_neogeo_gfx_decrypt(machine(), 0x00); |
9386 | | kof2000_install_protection(machine()); |
| 9384 | neogeo_cmc50_m1_decrypt(); |
| 9385 | kof2000_neogeo_gfx_decrypt(0x00); |
| 9386 | kof2000_install_protection(); |
9387 | 9387 | } |
9388 | 9388 | |
9389 | 9389 | DRIVER_INIT_MEMBER(neogeo_state,kof2000n) |
9390 | 9390 | { |
9391 | 9391 | DRIVER_INIT_CALL(neogeo); |
9392 | 9392 | m_fixed_layer_bank_type = 2; |
9393 | | neogeo_cmc50_m1_decrypt(machine()); |
9394 | | kof2000_neogeo_gfx_decrypt(machine(), 0x00); |
| 9393 | neogeo_cmc50_m1_decrypt(); |
| 9394 | kof2000_neogeo_gfx_decrypt(0x00); |
9395 | 9395 | } |
9396 | 9396 | |
9397 | 9397 | DRIVER_INIT_MEMBER(neogeo_state,kof2001) |
9398 | 9398 | { |
9399 | 9399 | DRIVER_INIT_CALL(neogeo); |
9400 | 9400 | m_fixed_layer_bank_type = 1; |
9401 | | kof2000_neogeo_gfx_decrypt(machine(), 0x1e); |
9402 | | neogeo_cmc50_m1_decrypt(machine()); |
| 9401 | kof2000_neogeo_gfx_decrypt(0x1e); |
| 9402 | neogeo_cmc50_m1_decrypt(); |
9403 | 9403 | } |
9404 | 9404 | |
9405 | 9405 | DRIVER_INIT_MEMBER(neogeo_state,cthd2003) |
9406 | 9406 | { |
9407 | 9407 | DRIVER_INIT_CALL(neogeo); |
9408 | | decrypt_cthd2003(machine()); |
9409 | | patch_cthd2003(machine()); |
| 9408 | decrypt_cthd2003(); |
| 9409 | patch_cthd2003(); |
9410 | 9410 | } |
9411 | 9411 | |
9412 | 9412 | DRIVER_INIT_MEMBER(neogeo_state,ct2k3sp) |
9413 | 9413 | { |
9414 | 9414 | DRIVER_INIT_CALL(neogeo); |
9415 | | decrypt_ct2k3sp(machine()); |
9416 | | patch_cthd2003(machine()); |
| 9415 | decrypt_ct2k3sp(); |
| 9416 | patch_cthd2003(); |
9417 | 9417 | } |
9418 | 9418 | |
9419 | 9419 | DRIVER_INIT_MEMBER(neogeo_state,ct2k3sa) |
9420 | 9420 | { |
9421 | 9421 | DRIVER_INIT_CALL(neogeo); |
9422 | | decrypt_ct2k3sa(machine()); |
9423 | | patch_ct2k3sa(machine()); |
| 9422 | decrypt_ct2k3sa(); |
| 9423 | patch_ct2k3sa(); |
9424 | 9424 | } |
9425 | 9425 | |
9426 | 9426 | DRIVER_INIT_MEMBER(neogeo_state,mslug4) |
9427 | 9427 | { |
9428 | 9428 | DRIVER_INIT_CALL(neogeo); |
9429 | 9429 | m_fixed_layer_bank_type = 1; /* USA violent content screen is wrong -- not a bug, confirmed on real hardware! */ |
9430 | | neogeo_cmc50_m1_decrypt(machine()); |
9431 | | kof2000_neogeo_gfx_decrypt(machine(), 0x31); |
9432 | | neo_pcm2_snk_1999(machine(), 8); |
| 9430 | neogeo_cmc50_m1_decrypt(); |
| 9431 | kof2000_neogeo_gfx_decrypt(0x31); |
| 9432 | neo_pcm2_snk_1999(8); |
9433 | 9433 | } |
9434 | 9434 | |
9435 | 9435 | DRIVER_INIT_MEMBER(neogeo_state,ms4plus) |
9436 | 9436 | { |
9437 | 9437 | DRIVER_INIT_CALL(neogeo); |
9438 | | cmc50_neogeo_gfx_decrypt(machine(), 0x31); |
9439 | | neo_pcm2_snk_1999(machine(), 8); |
9440 | | neogeo_cmc50_m1_decrypt(machine()); |
| 9438 | cmc50_neogeo_gfx_decrypt(0x31); |
| 9439 | neo_pcm2_snk_1999(8); |
| 9440 | neogeo_cmc50_m1_decrypt(); |
9441 | 9441 | } |
9442 | 9442 | |
9443 | 9443 | DRIVER_INIT_MEMBER(neogeo_state,ganryu) |
9444 | 9444 | { |
9445 | 9445 | DRIVER_INIT_CALL(neogeo); |
9446 | 9446 | m_fixed_layer_bank_type = 1; |
9447 | | kof99_neogeo_gfx_decrypt(machine(), 0x07); |
| 9447 | kof99_neogeo_gfx_decrypt(0x07); |
9448 | 9448 | } |
9449 | 9449 | |
9450 | 9450 | DRIVER_INIT_MEMBER(neogeo_state,s1945p) |
9451 | 9451 | { |
9452 | 9452 | DRIVER_INIT_CALL(neogeo); |
9453 | 9453 | m_fixed_layer_bank_type = 1; |
9454 | | kof99_neogeo_gfx_decrypt(machine(), 0x05); |
| 9454 | kof99_neogeo_gfx_decrypt(0x05); |
9455 | 9455 | } |
9456 | 9456 | |
9457 | 9457 | DRIVER_INIT_MEMBER(neogeo_state,preisle2) |
9458 | 9458 | { |
9459 | 9459 | DRIVER_INIT_CALL(neogeo); |
9460 | 9460 | m_fixed_layer_bank_type = 1; |
9461 | | kof99_neogeo_gfx_decrypt(machine(), 0x9f); |
| 9461 | kof99_neogeo_gfx_decrypt(0x9f); |
9462 | 9462 | } |
9463 | 9463 | |
9464 | 9464 | DRIVER_INIT_MEMBER(neogeo_state,bangbead) |
9465 | 9465 | { |
9466 | 9466 | DRIVER_INIT_CALL(neogeo); |
9467 | 9467 | m_fixed_layer_bank_type = 1; |
9468 | | kof99_neogeo_gfx_decrypt(machine(), 0xf8); |
| 9468 | kof99_neogeo_gfx_decrypt(0xf8); |
9469 | 9469 | } |
9470 | 9470 | |
9471 | 9471 | DRIVER_INIT_MEMBER(neogeo_state,nitd) |
9472 | 9472 | { |
9473 | 9473 | DRIVER_INIT_CALL(neogeo); |
9474 | 9474 | m_fixed_layer_bank_type = 1; |
9475 | | kof99_neogeo_gfx_decrypt(machine(), 0xff); |
| 9475 | kof99_neogeo_gfx_decrypt(0xff); |
9476 | 9476 | } |
9477 | 9477 | |
9478 | 9478 | DRIVER_INIT_MEMBER(neogeo_state,sengoku3) |
9479 | 9479 | { |
9480 | 9480 | DRIVER_INIT_CALL(neogeo); |
9481 | 9481 | m_fixed_layer_bank_type = 1; |
9482 | | kof99_neogeo_gfx_decrypt(machine(), 0xfe); |
| 9482 | kof99_neogeo_gfx_decrypt(0xfe); |
9483 | 9483 | } |
9484 | 9484 | |
9485 | 9485 | DRIVER_INIT_MEMBER(neogeo_state,rotd) |
9486 | 9486 | { |
9487 | 9487 | DRIVER_INIT_CALL(neogeo); |
9488 | | neo_pcm2_snk_1999(machine(), 16); |
| 9488 | neo_pcm2_snk_1999(16); |
9489 | 9489 | m_fixed_layer_bank_type = 1; |
9490 | | neogeo_cmc50_m1_decrypt(machine()); |
9491 | | kof2000_neogeo_gfx_decrypt(machine(), 0x3f); |
| 9490 | neogeo_cmc50_m1_decrypt(); |
| 9491 | kof2000_neogeo_gfx_decrypt(0x3f); |
9492 | 9492 | } |
9493 | 9493 | |
9494 | 9494 | DRIVER_INIT_MEMBER(neogeo_state,kof2002) |
9495 | 9495 | { |
9496 | 9496 | DRIVER_INIT_CALL(neogeo); |
9497 | | kof2002_decrypt_68k(machine()); |
9498 | | neo_pcm2_swap(machine(), 0); |
9499 | | neogeo_cmc50_m1_decrypt(machine()); |
9500 | | kof2000_neogeo_gfx_decrypt(machine(), 0xec); |
| 9497 | kof2002_decrypt_68k(); |
| 9498 | neo_pcm2_swap(0); |
| 9499 | neogeo_cmc50_m1_decrypt(); |
| 9500 | kof2000_neogeo_gfx_decrypt(0xec); |
9501 | 9501 | } |
9502 | 9502 | |
9503 | 9503 | DRIVER_INIT_MEMBER(neogeo_state,kof2002b) |
9504 | 9504 | { |
9505 | 9505 | DRIVER_INIT_CALL(neogeo); |
9506 | | kof2002_decrypt_68k(machine()); |
9507 | | neo_pcm2_swap(machine(), 0); |
9508 | | neogeo_cmc50_m1_decrypt(machine()); |
9509 | | kof2002b_gfx_decrypt(machine(), memregion("sprites")->base(),0x4000000); |
9510 | | kof2002b_gfx_decrypt(machine(), memregion("fixed")->base(),0x20000); |
| 9506 | kof2002_decrypt_68k(); |
| 9507 | neo_pcm2_swap(0); |
| 9508 | neogeo_cmc50_m1_decrypt(); |
| 9509 | kof2002b_gfx_decrypt(memregion("sprites")->base(),0x4000000); |
| 9510 | kof2002b_gfx_decrypt(memregion("fixed")->base(),0x20000); |
9511 | 9511 | } |
9512 | 9512 | |
9513 | 9513 | DRIVER_INIT_MEMBER(neogeo_state,kf2k2pls) |
9514 | 9514 | { |
9515 | 9515 | DRIVER_INIT_CALL(neogeo); |
9516 | | kof2002_decrypt_68k(machine()); |
9517 | | neo_pcm2_swap(machine(), 0); |
9518 | | neogeo_cmc50_m1_decrypt(machine()); |
9519 | | cmc50_neogeo_gfx_decrypt(machine(), 0xec); |
| 9516 | kof2002_decrypt_68k(); |
| 9517 | neo_pcm2_swap(0); |
| 9518 | neogeo_cmc50_m1_decrypt(); |
| 9519 | cmc50_neogeo_gfx_decrypt(0xec); |
9520 | 9520 | } |
9521 | 9521 | |
9522 | 9522 | DRIVER_INIT_MEMBER(neogeo_state,kf2k2mp) |
9523 | 9523 | { |
9524 | 9524 | DRIVER_INIT_CALL(neogeo); |
9525 | | kf2k2mp_decrypt(machine()); |
9526 | | neo_pcm2_swap(machine(), 0); |
9527 | | neogeo_cmc50_m1_decrypt(machine()); |
9528 | | neogeo_bootleg_sx_decrypt(machine(), 2); |
9529 | | cmc50_neogeo_gfx_decrypt(machine(), 0xec); |
| 9525 | kf2k2mp_decrypt(); |
| 9526 | neo_pcm2_swap(0); |
| 9527 | neogeo_cmc50_m1_decrypt(); |
| 9528 | neogeo_bootleg_sx_decrypt(2); |
| 9529 | cmc50_neogeo_gfx_decrypt(0xec); |
9530 | 9530 | } |
9531 | 9531 | |
9532 | 9532 | DRIVER_INIT_MEMBER(neogeo_state,kf2k2mp2) |
9533 | 9533 | { |
9534 | 9534 | DRIVER_INIT_CALL(neogeo); |
9535 | | kf2k2mp2_px_decrypt(machine()); |
9536 | | neo_pcm2_swap(machine(), 0); |
9537 | | neogeo_cmc50_m1_decrypt(machine()); |
9538 | | neogeo_bootleg_sx_decrypt(machine(), 1); |
9539 | | cmc50_neogeo_gfx_decrypt(machine(), 0xec); |
| 9535 | kf2k2mp2_px_decrypt(); |
| 9536 | neo_pcm2_swap(0); |
| 9537 | neogeo_cmc50_m1_decrypt(); |
| 9538 | neogeo_bootleg_sx_decrypt(1); |
| 9539 | cmc50_neogeo_gfx_decrypt(0xec); |
9540 | 9540 | } |
9541 | 9541 | |
9542 | 9542 | DRIVER_INIT_MEMBER(neogeo_state,kof10th) |
9543 | 9543 | { |
9544 | 9544 | DRIVER_INIT_CALL(neogeo); |
9545 | | decrypt_kof10th(machine()); |
9546 | | install_kof10th_protection(machine()); |
| 9545 | decrypt_kof10th(); |
| 9546 | install_kof10th_protection(); |
9547 | 9547 | } |
9548 | 9548 | |
9549 | 9549 | DRIVER_INIT_MEMBER(neogeo_state,kf10thep) |
9550 | 9550 | { |
9551 | 9551 | DRIVER_INIT_CALL(neogeo); |
9552 | | decrypt_kf10thep(machine()); |
| 9552 | decrypt_kf10thep(); |
9553 | 9553 | } |
9554 | 9554 | |
9555 | 9555 | DRIVER_INIT_MEMBER(neogeo_state,kf2k5uni) |
9556 | 9556 | { |
9557 | 9557 | DRIVER_INIT_CALL(neogeo); |
9558 | | decrypt_kf2k5uni(machine()); |
| 9558 | decrypt_kf2k5uni(); |
9559 | 9559 | } |
9560 | 9560 | |
9561 | 9561 | DRIVER_INIT_MEMBER(neogeo_state,kof2k4se) |
9562 | 9562 | { |
9563 | 9563 | DRIVER_INIT_CALL(neogeo); |
9564 | | decrypt_kof2k4se_68k(machine()); |
| 9564 | decrypt_kof2k4se_68k(); |
9565 | 9565 | } |
9566 | 9566 | |
9567 | 9567 | DRIVER_INIT_MEMBER(neogeo_state,matrim) |
9568 | 9568 | { |
9569 | 9569 | DRIVER_INIT_CALL(neogeo); |
9570 | | matrim_decrypt_68k(machine()); |
9571 | | neo_pcm2_swap(machine(), 1); |
| 9570 | matrim_decrypt_68k(); |
| 9571 | neo_pcm2_swap(1); |
9572 | 9572 | m_fixed_layer_bank_type = 2; |
9573 | | neogeo_cmc50_m1_decrypt(machine()); |
9574 | | kof2000_neogeo_gfx_decrypt(machine(), 0x6a); |
| 9573 | neogeo_cmc50_m1_decrypt(); |
| 9574 | kof2000_neogeo_gfx_decrypt(0x6a); |
9575 | 9575 | } |
9576 | 9576 | |
9577 | 9577 | DRIVER_INIT_MEMBER(neogeo_state,matrimbl) |
9578 | 9578 | { |
9579 | 9579 | DRIVER_INIT_CALL(neogeo); |
9580 | | matrim_decrypt_68k(machine()); |
| 9580 | matrim_decrypt_68k(); |
9581 | 9581 | m_fixed_layer_bank_type = 2; |
9582 | | matrimbl_decrypt(machine()); |
9583 | | neogeo_sfix_decrypt(machine()); /* required for text layer */ |
| 9582 | matrimbl_decrypt(); |
| 9583 | neogeo_sfix_decrypt(); /* required for text layer */ |
9584 | 9584 | } |
9585 | 9585 | |
9586 | 9586 | DRIVER_INIT_MEMBER(neogeo_state,pnyaa) |
9587 | 9587 | { |
9588 | 9588 | DRIVER_INIT_CALL(neogeo); |
9589 | | neo_pcm2_snk_1999(machine(), 4); |
| 9589 | neo_pcm2_snk_1999(4); |
9590 | 9590 | m_fixed_layer_bank_type = 1; |
9591 | | neogeo_cmc50_m1_decrypt(machine()); |
9592 | | kof2000_neogeo_gfx_decrypt(machine(), 0x2e); |
| 9591 | neogeo_cmc50_m1_decrypt(); |
| 9592 | kof2000_neogeo_gfx_decrypt(0x2e); |
9593 | 9593 | } |
9594 | 9594 | |
9595 | 9595 | DRIVER_INIT_MEMBER(neogeo_state,mslug5) |
9596 | 9596 | { |
9597 | 9597 | DRIVER_INIT_CALL(neogeo); |
9598 | | mslug5_decrypt_68k(machine()); |
9599 | | neo_pcm2_swap(machine(), 2); |
| 9598 | mslug5_decrypt_68k(); |
| 9599 | neo_pcm2_swap(2); |
9600 | 9600 | m_fixed_layer_bank_type = 1; |
9601 | | neogeo_cmc50_m1_decrypt(machine()); |
9602 | | kof2000_neogeo_gfx_decrypt(machine(), 0x19); |
9603 | | install_pvc_protection(machine()); |
| 9601 | neogeo_cmc50_m1_decrypt(); |
| 9602 | kof2000_neogeo_gfx_decrypt(0x19); |
| 9603 | install_pvc_protection(); |
9604 | 9604 | } |
9605 | 9605 | |
9606 | | static TIMER_CALLBACK( ms5pcb_bios_timer_callback ) |
| 9606 | TIMER_CALLBACK_MEMBER(neogeo_state::ms5pcb_bios_timer_callback) |
9607 | 9607 | { |
9608 | | int harddip3 = machine.root_device().ioport("HARDDIP")->read() & 1; |
9609 | | machine.root_device().membank(NEOGEO_BANK_BIOS)->set_base(machine.root_device().memregion("mainbios")->base() + 0x20000 + harddip3 * 0x20000); |
| 9608 | int harddip3 = ioport("HARDDIP")->read() & 1; |
| 9609 | membank(NEOGEO_BANK_BIOS)->set_base(memregion("mainbios")->base() + 0x20000 + harddip3 * 0x20000); |
9610 | 9610 | } |
9611 | 9611 | |
9612 | 9612 | DRIVER_INIT_MEMBER(neogeo_state,ms5pcb) |
r21155 | r21156 | |
9614 | 9614 | DRIVER_INIT_CALL(neogeo); |
9615 | 9615 | |
9616 | 9616 | /* start a timer that will check the BIOS select DIP every second */ |
9617 | | machine().scheduler().timer_set(attotime::zero, FUNC(ms5pcb_bios_timer_callback)); |
9618 | | machine().scheduler().timer_pulse(attotime::from_msec(1000), FUNC(ms5pcb_bios_timer_callback)); |
| 9617 | machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(neogeo_state::ms5pcb_bios_timer_callback),this)); |
| 9618 | machine().scheduler().timer_pulse(attotime::from_msec(1000), timer_expired_delegate(FUNC(neogeo_state::ms5pcb_bios_timer_callback),this)); |
9619 | 9619 | |
9620 | | mslug5_decrypt_68k(machine()); |
9621 | | svcpcb_gfx_decrypt(machine()); |
9622 | | neogeo_cmc50_m1_decrypt(machine()); |
9623 | | kof2000_neogeo_gfx_decrypt(machine(), 0x19); |
| 9620 | mslug5_decrypt_68k(); |
| 9621 | svcpcb_gfx_decrypt(); |
| 9622 | neogeo_cmc50_m1_decrypt(); |
| 9623 | kof2000_neogeo_gfx_decrypt(0x19); |
9624 | 9624 | m_fixed_layer_bank_type = 2; |
9625 | | svcpcb_s1data_decrypt(machine()); |
9626 | | neo_pcm2_swap(machine(), 2); |
9627 | | install_pvc_protection(machine()); |
| 9625 | svcpcb_s1data_decrypt(); |
| 9626 | neo_pcm2_swap(2); |
| 9627 | install_pvc_protection(); |
9628 | 9628 | } |
9629 | 9629 | |
9630 | 9630 | DRIVER_INIT_MEMBER(neogeo_state,ms5plus) |
9631 | 9631 | { |
9632 | 9632 | DRIVER_INIT_CALL(neogeo); |
9633 | | cmc50_neogeo_gfx_decrypt(machine(), 0x19); |
9634 | | neo_pcm2_swap(machine(), 2); |
9635 | | neogeo_bootleg_sx_decrypt(machine(), 1); |
| 9633 | cmc50_neogeo_gfx_decrypt(0x19); |
| 9634 | neo_pcm2_swap(2); |
| 9635 | neogeo_bootleg_sx_decrypt(1); |
9636 | 9636 | m_fixed_layer_bank_type = 1; |
9637 | | neogeo_cmc50_m1_decrypt(machine()); |
9638 | | install_ms5plus_protection(machine()); |
| 9637 | neogeo_cmc50_m1_decrypt(); |
| 9638 | install_ms5plus_protection(); |
9639 | 9639 | } |
9640 | 9640 | |
9641 | | static TIMER_CALLBACK( svcpcb_bios_timer_callback ) |
| 9641 | TIMER_CALLBACK_MEMBER(neogeo_state::svcpcb_bios_timer_callback) |
9642 | 9642 | { |
9643 | | int harddip3 = machine.root_device().ioport("HARDDIP")->read() & 1; |
9644 | | machine.root_device().membank(NEOGEO_BANK_BIOS)->set_base(machine.root_device().memregion("mainbios")->base() + 0x20000 + harddip3 * 0x20000); |
| 9643 | int harddip3 = ioport("HARDDIP")->read() & 1; |
| 9644 | membank(NEOGEO_BANK_BIOS)->set_base(memregion("mainbios")->base() + 0x20000 + harddip3 * 0x20000); |
9645 | 9645 | } |
9646 | 9646 | |
9647 | 9647 | DRIVER_INIT_MEMBER(neogeo_state,svcpcb) |
r21155 | r21156 | |
9649 | 9649 | DRIVER_INIT_CALL(neogeo); |
9650 | 9650 | |
9651 | 9651 | /* start a timer that will check the BIOS select DIP every second */ |
9652 | | machine().scheduler().timer_set(attotime::zero, FUNC(svcpcb_bios_timer_callback)); |
9653 | | machine().scheduler().timer_pulse(attotime::from_msec(1000), FUNC(svcpcb_bios_timer_callback)); |
| 9652 | machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(neogeo_state::svcpcb_bios_timer_callback),this)); |
| 9653 | machine().scheduler().timer_pulse(attotime::from_msec(1000), timer_expired_delegate(FUNC(neogeo_state::svcpcb_bios_timer_callback),this)); |
9654 | 9654 | |
9655 | | svc_px_decrypt(machine()); |
9656 | | svcpcb_gfx_decrypt(machine()); |
9657 | | neogeo_cmc50_m1_decrypt(machine()); |
9658 | | kof2000_neogeo_gfx_decrypt(machine(), 0x57); |
9659 | | svcpcb_s1data_decrypt(machine()); |
9660 | | neo_pcm2_swap(machine(), 3); |
| 9655 | svc_px_decrypt(); |
| 9656 | svcpcb_gfx_decrypt(); |
| 9657 | neogeo_cmc50_m1_decrypt(); |
| 9658 | kof2000_neogeo_gfx_decrypt(0x57); |
| 9659 | svcpcb_s1data_decrypt(); |
| 9660 | neo_pcm2_swap(3); |
9661 | 9661 | m_fixed_layer_bank_type = 2; |
9662 | | install_pvc_protection(machine()); |
| 9662 | install_pvc_protection(); |
9663 | 9663 | } |
9664 | 9664 | |
9665 | 9665 | DRIVER_INIT_MEMBER(neogeo_state,svc) |
9666 | 9666 | { |
9667 | 9667 | DRIVER_INIT_CALL(neogeo); |
9668 | | svc_px_decrypt(machine()); |
9669 | | neo_pcm2_swap(machine(), 3); |
| 9668 | svc_px_decrypt(); |
| 9669 | neo_pcm2_swap(3); |
9670 | 9670 | m_fixed_layer_bank_type = 2; |
9671 | | neogeo_cmc50_m1_decrypt(machine()); |
9672 | | kof2000_neogeo_gfx_decrypt(machine(), 0x57); |
9673 | | install_pvc_protection(machine()); |
| 9671 | neogeo_cmc50_m1_decrypt(); |
| 9672 | kof2000_neogeo_gfx_decrypt(0x57); |
| 9673 | install_pvc_protection(); |
9674 | 9674 | } |
9675 | 9675 | |
9676 | 9676 | DRIVER_INIT_MEMBER(neogeo_state,svcboot) |
9677 | 9677 | { |
9678 | 9678 | DRIVER_INIT_CALL(neogeo); |
9679 | | svcboot_px_decrypt(machine()); |
9680 | | svcboot_cx_decrypt(machine()); |
9681 | | install_pvc_protection(machine()); |
| 9679 | svcboot_px_decrypt(); |
| 9680 | svcboot_cx_decrypt(); |
| 9681 | install_pvc_protection(); |
9682 | 9682 | } |
9683 | 9683 | |
9684 | 9684 | DRIVER_INIT_MEMBER(neogeo_state,svcplus) |
9685 | 9685 | { |
9686 | 9686 | DRIVER_INIT_CALL(neogeo); |
9687 | | svcplus_px_decrypt(machine()); |
9688 | | svcboot_cx_decrypt(machine()); |
9689 | | neogeo_bootleg_sx_decrypt(machine(), 1); |
9690 | | svcplus_px_hack(machine()); |
| 9687 | svcplus_px_decrypt(); |
| 9688 | svcboot_cx_decrypt(); |
| 9689 | neogeo_bootleg_sx_decrypt( 1); |
| 9690 | svcplus_px_hack(); |
9691 | 9691 | } |
9692 | 9692 | |
9693 | 9693 | DRIVER_INIT_MEMBER(neogeo_state,svcplusa) |
9694 | 9694 | { |
9695 | 9695 | DRIVER_INIT_CALL(neogeo); |
9696 | | svcplusa_px_decrypt(machine()); |
9697 | | svcboot_cx_decrypt(machine()); |
9698 | | svcplus_px_hack(machine()); |
| 9696 | svcplusa_px_decrypt(); |
| 9697 | svcboot_cx_decrypt(); |
| 9698 | svcplus_px_hack(); |
9699 | 9699 | } |
9700 | 9700 | |
9701 | 9701 | DRIVER_INIT_MEMBER(neogeo_state,svcsplus) |
9702 | 9702 | { |
9703 | 9703 | DRIVER_INIT_CALL(neogeo); |
9704 | | svcsplus_px_decrypt(machine()); |
9705 | | neogeo_bootleg_sx_decrypt(machine(), 2); |
9706 | | svcboot_cx_decrypt(machine()); |
9707 | | svcsplus_px_hack(machine()); |
9708 | | install_pvc_protection(machine()); |
| 9704 | svcsplus_px_decrypt(); |
| 9705 | neogeo_bootleg_sx_decrypt(2); |
| 9706 | svcboot_cx_decrypt(); |
| 9707 | svcsplus_px_hack(); |
| 9708 | install_pvc_protection(); |
9709 | 9709 | } |
9710 | 9710 | |
9711 | 9711 | DRIVER_INIT_MEMBER(neogeo_state,samsho5) |
9712 | 9712 | { |
9713 | 9713 | DRIVER_INIT_CALL(neogeo); |
9714 | | samsho5_decrypt_68k(machine()); |
9715 | | neo_pcm2_swap(machine(), 4); |
| 9714 | samsho5_decrypt_68k(); |
| 9715 | neo_pcm2_swap(4); |
9716 | 9716 | m_fixed_layer_bank_type = 1; |
9717 | | neogeo_cmc50_m1_decrypt(machine()); |
9718 | | kof2000_neogeo_gfx_decrypt(machine(), 0x0f); |
| 9717 | neogeo_cmc50_m1_decrypt(); |
| 9718 | kof2000_neogeo_gfx_decrypt(0x0f); |
9719 | 9719 | } |
9720 | 9720 | |
9721 | 9721 | DRIVER_INIT_MEMBER(neogeo_state,samsho5b) |
9722 | 9722 | { |
9723 | 9723 | DRIVER_INIT_CALL(neogeo); |
9724 | | samsho5b_px_decrypt(machine()); |
9725 | | samsho5b_vx_decrypt(machine()); |
9726 | | neogeo_bootleg_sx_decrypt(machine(), 1); |
9727 | | neogeo_bootleg_cx_decrypt(machine()); |
| 9724 | samsho5b_px_decrypt(); |
| 9725 | samsho5b_vx_decrypt(); |
| 9726 | neogeo_bootleg_sx_decrypt(1); |
| 9727 | neogeo_bootleg_cx_decrypt(); |
9728 | 9728 | } |
9729 | 9729 | |
9730 | 9730 | DRIVER_INIT_MEMBER(neogeo_state,kf2k3pcb) |
9731 | 9731 | { |
9732 | 9732 | DRIVER_INIT_CALL(neogeo); |
9733 | | kf2k3pcb_decrypt_68k(machine()); |
9734 | | kf2k3pcb_gfx_decrypt(machine()); |
9735 | | kof2003biosdecode(machine()); |
9736 | | neogeo_cmc50_m1_decrypt(machine()); |
| 9733 | kf2k3pcb_decrypt_68k(); |
| 9734 | kf2k3pcb_gfx_decrypt(); |
| 9735 | kof2003biosdecode(); |
| 9736 | neogeo_cmc50_m1_decrypt(); |
9737 | 9737 | |
9738 | 9738 | /* extra little swap on the m1 - this must be performed AFTER the m1 decrypt |
9739 | 9739 | or the m1 checksum (used to generate the key) for decrypting the m1 is |
r21155 | r21156 | |
9747 | 9747 | } |
9748 | 9748 | } |
9749 | 9749 | |
9750 | | kof2000_neogeo_gfx_decrypt(machine(), 0x9d); |
9751 | | kf2k3pcb_decrypt_s1data(machine()); |
9752 | | neo_pcm2_swap(machine(), 5); |
| 9750 | kof2000_neogeo_gfx_decrypt(0x9d); |
| 9751 | kf2k3pcb_decrypt_s1data(); |
| 9752 | neo_pcm2_swap(5); |
9753 | 9753 | m_fixed_layer_bank_type = 2; |
9754 | | install_pvc_protection(machine()); |
| 9754 | install_pvc_protection(); |
9755 | 9755 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xc00000, 0xc7ffff, "bios" ); // 512k bios |
9756 | 9756 | } |
9757 | 9757 | |
9758 | 9758 | DRIVER_INIT_MEMBER(neogeo_state,kof2003) |
9759 | 9759 | { |
9760 | 9760 | DRIVER_INIT_CALL(neogeo); |
9761 | | kof2003_decrypt_68k(machine()); |
9762 | | neo_pcm2_swap(machine(), 5); |
| 9761 | kof2003_decrypt_68k(); |
| 9762 | neo_pcm2_swap(5); |
9763 | 9763 | m_fixed_layer_bank_type = 2; |
9764 | | neogeo_cmc50_m1_decrypt(machine()); |
9765 | | kof2000_neogeo_gfx_decrypt(machine(), 0x9d); |
9766 | | install_pvc_protection(machine()); |
| 9764 | neogeo_cmc50_m1_decrypt(); |
| 9765 | kof2000_neogeo_gfx_decrypt(0x9d); |
| 9766 | install_pvc_protection(); |
9767 | 9767 | } |
9768 | 9768 | |
9769 | 9769 | DRIVER_INIT_MEMBER(neogeo_state,kof2003h) |
9770 | 9770 | { |
9771 | 9771 | DRIVER_INIT_CALL(neogeo); |
9772 | | kof2003h_decrypt_68k(machine()); |
9773 | | neo_pcm2_swap(machine(), 5); |
| 9772 | kof2003h_decrypt_68k(); |
| 9773 | neo_pcm2_swap(5); |
9774 | 9774 | m_fixed_layer_bank_type = 2; |
9775 | | neogeo_cmc50_m1_decrypt(machine()); |
9776 | | kof2000_neogeo_gfx_decrypt(machine(), 0x9d); |
9777 | | install_pvc_protection(machine()); |
| 9775 | neogeo_cmc50_m1_decrypt(); |
| 9776 | kof2000_neogeo_gfx_decrypt(0x9d); |
| 9777 | install_pvc_protection(); |
9778 | 9778 | } |
9779 | 9779 | |
9780 | 9780 | DRIVER_INIT_MEMBER(neogeo_state,kf2k3bl) |
9781 | 9781 | { |
9782 | 9782 | DRIVER_INIT_CALL(neogeo); |
9783 | | cmc50_neogeo_gfx_decrypt(machine(), 0x9d); |
9784 | | neo_pcm2_swap(machine(), 5); |
9785 | | neogeo_bootleg_sx_decrypt(machine(), 1); |
9786 | | kf2k3bl_install_protection(machine()); |
| 9783 | cmc50_neogeo_gfx_decrypt(0x9d); |
| 9784 | neo_pcm2_swap(5); |
| 9785 | neogeo_bootleg_sx_decrypt(1); |
| 9786 | kf2k3bl_install_protection(); |
9787 | 9787 | } |
9788 | 9788 | |
9789 | 9789 | DRIVER_INIT_MEMBER(neogeo_state,kf2k3pl) |
9790 | 9790 | { |
9791 | 9791 | DRIVER_INIT_CALL(neogeo); |
9792 | | cmc50_neogeo_gfx_decrypt(machine(), 0x9d); |
9793 | | neo_pcm2_swap(machine(), 5); |
9794 | | kf2k3pl_px_decrypt(machine()); |
9795 | | neogeo_bootleg_sx_decrypt(machine(), 1); |
9796 | | kf2k3pl_install_protection(machine()); |
| 9792 | cmc50_neogeo_gfx_decrypt(0x9d); |
| 9793 | neo_pcm2_swap(5); |
| 9794 | kf2k3pl_px_decrypt(); |
| 9795 | neogeo_bootleg_sx_decrypt(1); |
| 9796 | kf2k3pl_install_protection(); |
9797 | 9797 | } |
9798 | 9798 | |
9799 | 9799 | DRIVER_INIT_MEMBER(neogeo_state,kf2k3upl) |
9800 | 9800 | { |
9801 | 9801 | DRIVER_INIT_CALL(neogeo); |
9802 | | cmc50_neogeo_gfx_decrypt(machine(), 0x9d); |
9803 | | neo_pcm2_swap(machine(), 5); |
9804 | | kf2k3upl_px_decrypt(machine()); |
9805 | | neogeo_bootleg_sx_decrypt(machine(), 2); |
9806 | | kf2k3upl_install_protection(machine()); |
| 9802 | cmc50_neogeo_gfx_decrypt(0x9d); |
| 9803 | neo_pcm2_swap(5); |
| 9804 | kf2k3upl_px_decrypt(); |
| 9805 | neogeo_bootleg_sx_decrypt(2); |
| 9806 | kf2k3upl_install_protection(); |
9807 | 9807 | } |
9808 | 9808 | |
9809 | 9809 | DRIVER_INIT_MEMBER(neogeo_state,samsh5sp) |
9810 | 9810 | { |
9811 | 9811 | DRIVER_INIT_CALL(neogeo); |
9812 | | samsh5sp_decrypt_68k(machine()); |
9813 | | neo_pcm2_swap(machine(), 6); |
| 9812 | samsh5sp_decrypt_68k(); |
| 9813 | neo_pcm2_swap(6); |
9814 | 9814 | m_fixed_layer_bank_type = 1; |
9815 | | neogeo_cmc50_m1_decrypt(machine()); |
9816 | | kof2000_neogeo_gfx_decrypt(machine(), 0x0d); |
| 9815 | neogeo_cmc50_m1_decrypt(); |
| 9816 | kof2000_neogeo_gfx_decrypt(0x0d); |
9817 | 9817 | } |
9818 | 9818 | |
9819 | 9819 | DRIVER_INIT_MEMBER(neogeo_state,jockeygp) |
9820 | 9820 | { |
9821 | 9821 | DRIVER_INIT_CALL(neogeo); |
9822 | 9822 | m_fixed_layer_bank_type = 1; |
9823 | | neogeo_cmc50_m1_decrypt(machine()); |
9824 | | kof2000_neogeo_gfx_decrypt(machine(), 0xac); |
| 9823 | neogeo_cmc50_m1_decrypt(); |
| 9824 | kof2000_neogeo_gfx_decrypt(0xac); |
9825 | 9825 | |
9826 | 9826 | /* install some extra RAM */ |
9827 | 9827 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_ram(0x200000, 0x201fff); |
r21155 | r21156 | |
9842 | 9842 | |
9843 | 9843 | DRIVER_INIT_MEMBER(neogeo_state,kof97oro) |
9844 | 9844 | { |
9845 | | kof97oro_px_decode(machine()); |
9846 | | neogeo_bootleg_sx_decrypt(machine(), 1); |
9847 | | neogeo_bootleg_cx_decrypt(machine()); |
| 9845 | kof97oro_px_decode(); |
| 9846 | neogeo_bootleg_sx_decrypt(1); |
| 9847 | neogeo_bootleg_cx_decrypt(); |
9848 | 9848 | DRIVER_INIT_CALL(neogeo); |
9849 | 9849 | } |
9850 | 9850 | |
r21155 | r21156 | |
9853 | 9853 | /* overlay cartridge ROM */ |
9854 | 9854 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x0ffffe, 0x0fffff, "JUMPER"); |
9855 | 9855 | |
9856 | | kog_px_decrypt(machine()); |
9857 | | neogeo_bootleg_sx_decrypt(machine(), 1); |
9858 | | neogeo_bootleg_cx_decrypt(machine()); |
| 9856 | kog_px_decrypt(); |
| 9857 | neogeo_bootleg_sx_decrypt(1); |
| 9858 | neogeo_bootleg_cx_decrypt(); |
9859 | 9859 | DRIVER_INIT_CALL(neogeo); |
9860 | 9860 | } |
9861 | 9861 | |
9862 | 9862 | DRIVER_INIT_MEMBER(neogeo_state,lans2004) |
9863 | 9863 | { |
9864 | | lans2004_decrypt_68k(machine()); |
9865 | | lans2004_vx_decrypt(machine()); |
9866 | | neogeo_bootleg_sx_decrypt(machine(), 1); |
9867 | | neogeo_bootleg_cx_decrypt(machine()); |
| 9864 | lans2004_decrypt_68k(); |
| 9865 | lans2004_vx_decrypt(); |
| 9866 | neogeo_bootleg_sx_decrypt(1); |
| 9867 | neogeo_bootleg_cx_decrypt(); |
9868 | 9868 | DRIVER_INIT_CALL(neogeo); |
9869 | 9869 | } |
9870 | 9870 | |
9871 | | static READ16_HANDLER( sbp_lowerrom_r ) |
| 9871 | READ16_MEMBER( neogeo_state::sbp_lowerrom_r ) |
9872 | 9872 | { |
9873 | | UINT16* rom = (UINT16*)space.machine().root_device().memregion("maincpu")->base(); |
| 9873 | UINT16* rom = (UINT16*)memregion("maincpu")->base(); |
9874 | 9874 | UINT16 origdata = rom[(offset+(0x200/2))]; |
9875 | 9875 | UINT16 data = BITSWAP16(origdata, 11,10,9,8,15,14,13,12,3,2,1,0,7,6,5,4); |
9876 | 9876 | int realoffset = 0x200+(offset*2); |
r21155 | r21156 | |
9882 | 9882 | return data; |
9883 | 9883 | } |
9884 | 9884 | |
9885 | | static WRITE16_HANDLER( sbp_lowerrom_w ) |
| 9885 | WRITE16_MEMBER( neogeo_state::sbp_lowerrom_w ) |
9886 | 9886 | { |
9887 | 9887 | int realoffset = 0x200+(offset*2); |
9888 | 9888 | |
r21155 | r21156 | |
9911 | 9911 | // there are also writes to 0x1080.. |
9912 | 9912 | // |
9913 | 9913 | // other stuff going on as well tho, the main overlay is still missing, and p1 inputs don't work |
9914 | | machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x00200, 0x001fff, FUNC(sbp_lowerrom_r)); |
9915 | | machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x00200, 0x001fff, FUNC(sbp_lowerrom_w)); |
| 9914 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00200, 0x001fff, read16_delegate(FUNC(neogeo_state::sbp_lowerrom_r),this)); |
| 9915 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x00200, 0x001fff, write16_delegate(FUNC(neogeo_state::sbp_lowerrom_w),this)); |
9916 | 9916 | |
9917 | 9917 | /* the game code clears the text overlay used ingame immediately after writing it.. why? protection? sloppy code that the hw ignores? imperfect emulation? */ |
9918 | 9918 | { |
trunk/src/mame/machine/neocrypt.c
r21155 | r21156 | |
108 | 108 | |
109 | 109 | ***************************************************************************/ |
110 | 110 | |
111 | | static const UINT8 *type0_t03; |
112 | | static const UINT8 *type0_t12; |
113 | | static const UINT8 *type1_t03; |
114 | | static const UINT8 *type1_t12; |
115 | | static const UINT8 *address_8_15_xor1; |
116 | | static const UINT8 *address_8_15_xor2; |
117 | | static const UINT8 *address_16_23_xor1; |
118 | | static const UINT8 *address_16_23_xor2; |
119 | | static const UINT8 *address_0_7_xor; |
120 | | |
121 | | |
122 | 111 | static const UINT8 kof99_type0_t03[256] = |
123 | 112 | { |
124 | 113 | 0xfb, 0x86, 0x9d, 0xf1, 0xbf, 0x80, 0xd5, 0x43, 0xab, 0xb3, 0x9f, 0x6a, 0x33, 0xd9, 0xdb, 0xb6, |
r21155 | r21156 | |
501 | 490 | |
502 | 491 | |
503 | 492 | |
504 | | static void decrypt(UINT8 *r0, UINT8 *r1, |
| 493 | void neogeo_state::decrypt(UINT8 *r0, UINT8 *r1, |
505 | 494 | UINT8 c0, UINT8 c1, |
506 | 495 | const UINT8 *table0hi, |
507 | 496 | const UINT8 *table0lo, |
r21155 | r21156 | |
528 | 517 | } |
529 | 518 | |
530 | 519 | |
531 | | static void neogeo_gfx_decrypt(running_machine &machine, int extra_xor) |
| 520 | void neogeo_state::neogeo_gfx_decrypt(int extra_xor) |
532 | 521 | { |
533 | 522 | int rom_size; |
534 | 523 | UINT8 *buf; |
535 | 524 | UINT8 *rom; |
536 | 525 | int rpos; |
537 | 526 | |
538 | | rom_size = machine.root_device().memregion("sprites")->bytes(); |
| 527 | rom_size = memregion("sprites")->bytes(); |
539 | 528 | |
540 | | buf = auto_alloc_array(machine, UINT8, rom_size); |
| 529 | buf = auto_alloc_array(machine(), UINT8, rom_size); |
541 | 530 | |
542 | | rom = machine.root_device().memregion("sprites")->base(); |
| 531 | rom = memregion("sprites")->base(); |
543 | 532 | |
544 | 533 | // Data xor |
545 | 534 | for (rpos = 0;rpos < rom_size/4;rpos++) |
r21155 | r21156 | |
587 | 576 | rom[4*rpos+3] = buf[4*baser+3]; |
588 | 577 | } |
589 | 578 | |
590 | | auto_free(machine, buf); |
| 579 | auto_free(machine(), buf); |
591 | 580 | } |
592 | 581 | |
593 | 582 | |
594 | 583 | /* the S data comes from the end of the C data */ |
595 | | void neogeo_sfix_decrypt(running_machine &machine) |
| 584 | void neogeo_state::neogeo_sfix_decrypt() |
596 | 585 | { |
597 | 586 | int i; |
598 | | int rom_size = machine.root_device().memregion("sprites")->bytes(); |
599 | | int tx_size = machine.root_device().memregion("fixed")->bytes(); |
600 | | UINT8 *src = machine.root_device().memregion("sprites")->base()+rom_size-tx_size; |
601 | | UINT8 *dst = machine.root_device().memregion("fixed")->base(); |
| 587 | int rom_size = memregion("sprites")->bytes(); |
| 588 | int tx_size = memregion("fixed")->bytes(); |
| 589 | UINT8 *src = memregion("sprites")->base()+rom_size-tx_size; |
| 590 | UINT8 *dst = memregion("fixed")->base(); |
602 | 591 | |
603 | 592 | for (i = 0;i < tx_size;i++) |
604 | 593 | dst[i] = src[(i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4)]; |
r21155 | r21156 | |
606 | 595 | |
607 | 596 | |
608 | 597 | /* CMC42 protection chip */ |
609 | | void kof99_neogeo_gfx_decrypt(running_machine &machine, int extra_xor) |
| 598 | void neogeo_state::kof99_neogeo_gfx_decrypt(int extra_xor) |
610 | 599 | { |
611 | 600 | type0_t03 = kof99_type0_t03; |
612 | 601 | type0_t12 = kof99_type0_t12; |
r21155 | r21156 | |
617 | 606 | address_16_23_xor1 = kof99_address_16_23_xor1; |
618 | 607 | address_16_23_xor2 = kof99_address_16_23_xor2; |
619 | 608 | address_0_7_xor = kof99_address_0_7_xor; |
620 | | neogeo_gfx_decrypt(machine, extra_xor); |
621 | | neogeo_sfix_decrypt(machine); |
| 609 | neogeo_gfx_decrypt(extra_xor); |
| 610 | neogeo_sfix_decrypt(); |
622 | 611 | } |
623 | 612 | |
624 | 613 | |
625 | 614 | /* CMC50 protection chip */ |
626 | | void kof2000_neogeo_gfx_decrypt(running_machine &machine, int extra_xor) |
| 615 | void neogeo_state::kof2000_neogeo_gfx_decrypt(int extra_xor) |
627 | 616 | { |
628 | 617 | type0_t03 = kof2000_type0_t03; |
629 | 618 | type0_t12 = kof2000_type0_t12; |
r21155 | r21156 | |
634 | 623 | address_16_23_xor1 = kof2000_address_16_23_xor1; |
635 | 624 | address_16_23_xor2 = kof2000_address_16_23_xor2; |
636 | 625 | address_0_7_xor = kof2000_address_0_7_xor; |
637 | | neogeo_gfx_decrypt(machine, extra_xor); |
638 | | neogeo_sfix_decrypt(machine); |
| 626 | neogeo_gfx_decrypt(extra_xor); |
| 627 | neogeo_sfix_decrypt(); |
639 | 628 | } |
640 | 629 | |
641 | 630 | |
642 | 631 | /* CMC42 protection chip */ |
643 | | void cmc42_neogeo_gfx_decrypt(running_machine &machine, int extra_xor) |
| 632 | void neogeo_state::cmc42_neogeo_gfx_decrypt(int extra_xor) |
644 | 633 | { |
645 | 634 | type0_t03 = kof99_type0_t03; |
646 | 635 | type0_t12 = kof99_type0_t12; |
r21155 | r21156 | |
651 | 640 | address_16_23_xor1 = kof99_address_16_23_xor1; |
652 | 641 | address_16_23_xor2 = kof99_address_16_23_xor2; |
653 | 642 | address_0_7_xor = kof99_address_0_7_xor; |
654 | | neogeo_gfx_decrypt(machine, extra_xor); |
| 643 | neogeo_gfx_decrypt(extra_xor); |
655 | 644 | } |
656 | 645 | |
657 | 646 | |
658 | 647 | /* CMC50 protection chip */ |
659 | | void cmc50_neogeo_gfx_decrypt(running_machine &machine, int extra_xor) |
| 648 | void neogeo_state::cmc50_neogeo_gfx_decrypt(int extra_xor) |
660 | 649 | { |
661 | 650 | type0_t03 = kof2000_type0_t03; |
662 | 651 | type0_t12 = kof2000_type0_t12; |
r21155 | r21156 | |
667 | 656 | address_16_23_xor1 = kof2000_address_16_23_xor1; |
668 | 657 | address_16_23_xor2 = kof2000_address_16_23_xor2; |
669 | 658 | address_0_7_xor = kof2000_address_0_7_xor; |
670 | | neogeo_gfx_decrypt(machine, extra_xor); |
| 659 | neogeo_gfx_decrypt(extra_xor); |
671 | 660 | } |
672 | 661 | |
673 | 662 | |
674 | 663 | /* ms5pcb and svcpcb have an additional scramble on top of the standard CMC scrambling */ |
675 | | void svcpcb_gfx_decrypt(running_machine &machine) |
| 664 | void neogeo_state::svcpcb_gfx_decrypt() |
676 | 665 | { |
677 | 666 | static const UINT8 xorval[ 4 ] = { 0x34, 0x21, 0xc4, 0xe9 }; |
678 | 667 | int i; |
679 | 668 | int ofst; |
680 | | int rom_size = machine.root_device().memregion( "sprites" )->bytes(); |
681 | | UINT8 *rom = machine.root_device().memregion( "sprites" )->base(); |
682 | | UINT8 *buf = auto_alloc_array(machine, UINT8, rom_size ); |
| 669 | int rom_size = memregion( "sprites" )->bytes(); |
| 670 | UINT8 *rom = memregion( "sprites" )->base(); |
| 671 | UINT8 *buf = auto_alloc_array(machine(), UINT8, rom_size ); |
683 | 672 | |
684 | 673 | for( i = 0; i < rom_size; i++ ) |
685 | 674 | { |
r21155 | r21156 | |
702 | 691 | ofst += (i & 0xffe00000); |
703 | 692 | memcpy( &rom[ i * 4 ], &buf[ ofst * 4 ], 0x04 ); |
704 | 693 | } |
705 | | auto_free( machine, buf ); |
| 694 | auto_free( machine(), buf ); |
706 | 695 | } |
707 | 696 | |
708 | 697 | |
709 | 698 | /* and a further swap on the s1 data */ |
710 | | void svcpcb_s1data_decrypt(running_machine &machine) |
| 699 | void neogeo_state::svcpcb_s1data_decrypt() |
711 | 700 | { |
712 | 701 | int i; |
713 | | UINT8 *s1 = machine.root_device().memregion( "fixed" )->base(); |
714 | | size_t s1_size = machine.root_device().memregion( "fixed" )->bytes(); |
| 702 | UINT8 *s1 = memregion( "fixed" )->base(); |
| 703 | size_t s1_size = memregion( "fixed" )->bytes(); |
715 | 704 | |
716 | 705 | for( i = 0; i < s1_size; i++ ) // Decrypt S |
717 | 706 | { |
r21155 | r21156 | |
722 | 711 | |
723 | 712 | /* kf2k3pcb has an additional scramble on top of the standard CMC scrambling */ |
724 | 713 | /* Thanks to Razoola & Halrin for the info */ |
725 | | void kf2k3pcb_gfx_decrypt(running_machine &machine) |
| 714 | void neogeo_state::kf2k3pcb_gfx_decrypt() |
726 | 715 | { |
727 | 716 | static const UINT8 xorval[ 4 ] = { 0x34, 0x21, 0xc4, 0xe9 }; |
728 | 717 | int i; |
729 | 718 | int ofst; |
730 | | int rom_size = machine.root_device().memregion( "sprites" )->bytes(); |
731 | | UINT8 *rom = machine.root_device().memregion( "sprites" )->base(); |
732 | | UINT8 *buf = auto_alloc_array(machine, UINT8, rom_size ); |
| 719 | int rom_size = memregion( "sprites" )->bytes(); |
| 720 | UINT8 *rom = memregion( "sprites" )->base(); |
| 721 | UINT8 *buf = auto_alloc_array(machine(), UINT8, rom_size ); |
733 | 722 | |
734 | 723 | for ( i = 0; i < rom_size; i++ ) |
735 | 724 | { |
r21155 | r21156 | |
748 | 737 | ofst += (i & 0xff800000); |
749 | 738 | memcpy( &rom[ ofst ], &buf[ i ], 0x04 ); |
750 | 739 | } |
751 | | auto_free( machine, buf ); |
| 740 | auto_free( machine(), buf ); |
752 | 741 | } |
753 | 742 | |
754 | 743 | |
755 | 744 | /* and a further swap on the s1 data */ |
756 | | void kf2k3pcb_decrypt_s1data(running_machine &machine) |
| 745 | void neogeo_state::kf2k3pcb_decrypt_s1data() |
757 | 746 | { |
758 | 747 | UINT8 *src; |
759 | 748 | UINT8 *dst; |
760 | 749 | int i; |
761 | | int tx_size = machine.root_device().memregion( "fixed" )->bytes(); |
762 | | int srom_size = machine.root_device().memregion( "sprites" )->bytes(); |
| 750 | int tx_size = memregion( "fixed" )->bytes(); |
| 751 | int srom_size = memregion( "sprites" )->bytes(); |
763 | 752 | |
764 | | src = machine.root_device().memregion( "sprites" )->base() + srom_size - 0x1000000 - 0x80000; // Decrypt S |
765 | | dst = machine.root_device().memregion( "fixed" )->base(); |
| 753 | src = memregion( "sprites" )->base() + srom_size - 0x1000000 - 0x80000; // Decrypt S |
| 754 | dst = memregion( "fixed" )->base(); |
766 | 755 | |
767 | 756 | for( i = 0; i < tx_size / 2; i++ ) |
768 | 757 | { |
769 | 758 | dst[ i ] = src[ (i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) ]; |
770 | 759 | } |
771 | 760 | |
772 | | src = machine.root_device().memregion( "sprites" )->base() + srom_size - 0x80000; |
773 | | dst = machine.root_device().memregion( "fixed" )->base() + 0x80000; |
| 761 | src = memregion( "sprites" )->base() + srom_size - 0x80000; |
| 762 | dst = memregion( "fixed" )->base() + 0x80000; |
774 | 763 | |
775 | 764 | for( i = 0; i < tx_size / 2; i++ ) |
776 | 765 | { |
777 | 766 | dst[ i ] = src[ (i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) ]; |
778 | 767 | } |
779 | 768 | |
780 | | dst = machine.root_device().memregion( "fixed" )->base(); |
| 769 | dst = memregion( "fixed" )->base(); |
781 | 770 | |
782 | 771 | for( i = 0; i < tx_size; i++ ) |
783 | 772 | { |
r21155 | r21156 | |
839 | 828 | ,and uses this checksum as the basis of the key with which to decrypt |
840 | 829 | the rom */ |
841 | 830 | |
842 | | static UINT16 generate_cs16(UINT8 *rom, int size) |
| 831 | UINT16 neogeo_state::generate_cs16(UINT8 *rom, int size) |
843 | 832 | { |
844 | 833 | UINT16 cs16; |
845 | 834 | int i; |
r21155 | r21156 | |
852 | 841 | } |
853 | 842 | |
854 | 843 | |
855 | | static int m1_address_scramble(int address, UINT16 key) |
| 844 | int neogeo_state::m1_address_scramble(int address, UINT16 key) |
856 | 845 | { |
857 | 846 | int block; |
858 | 847 | int aux; |
r21155 | r21156 | |
885 | 874 | } |
886 | 875 | |
887 | 876 | |
888 | | void neogeo_cmc50_m1_decrypt(running_machine &machine) |
| 877 | void neogeo_state::neogeo_cmc50_m1_decrypt() |
889 | 878 | { |
890 | | UINT8* rom = machine.root_device().memregion("audiocrypt")->base(); |
| 879 | UINT8* rom = memregion("audiocrypt")->base(); |
891 | 880 | size_t rom_size = 0x80000; |
892 | | UINT8* rom2 = machine.root_device().memregion("audiocpu")->base(); |
| 881 | UINT8* rom2 = memregion("audiocpu")->base(); |
893 | 882 | |
894 | | UINT8* buffer = auto_alloc_array(machine, UINT8, rom_size); |
| 883 | UINT8* buffer = auto_alloc_array(machine(), UINT8, rom_size); |
895 | 884 | |
896 | 885 | UINT32 i; |
897 | 886 | |
r21155 | r21156 | |
912 | 901 | #if 0 |
913 | 902 | { |
914 | 903 | FILE *fp; |
915 | | const char *gamename = machine.system().name; |
| 904 | const char *gamename = machine().system().name; |
916 | 905 | char filename[256]; |
917 | 906 | sprintf(filename, "%s_m1.dump", gamename); |
918 | 907 | |
r21155 | r21156 | |
929 | 918 | #if 0 |
930 | 919 | { |
931 | 920 | FILE *fp; |
932 | | const char *gamename = machine.system().name; |
| 921 | const char *gamename = machine().system().name; |
933 | 922 | char filename[256]; |
934 | 923 | sprintf(filename, "%s_m1extra.dump", gamename); |
935 | 924 | |
r21155 | r21156 | |
942 | 931 | } |
943 | 932 | #endif |
944 | 933 | |
945 | | auto_free( machine, buffer ); |
| 934 | auto_free( machine(), buffer ); |
946 | 935 | } |
947 | 936 | |
948 | 937 | |
r21155 | r21156 | |
954 | 943 | |
955 | 944 | |
956 | 945 | /* Kof98 uses an early encryption, quite different from the others */ |
957 | | void kof98_decrypt_68k(running_machine &machine) |
| 946 | void neogeo_state::kof98_decrypt_68k() |
958 | 947 | { |
959 | | UINT8 *src = machine.root_device().memregion("maincpu")->base(); |
960 | | UINT8 *dst = auto_alloc_array(machine, UINT8, 0x200000); |
| 948 | UINT8 *src = memregion("maincpu")->base(); |
| 949 | UINT8 *dst = auto_alloc_array(machine(), UINT8, 0x200000); |
961 | 950 | int i, j, k; |
962 | 951 | static const UINT32 sec[]={0x000000,0x100000,0x000004,0x100004,0x10000a,0x00000a,0x10000e,0x00000e}; |
963 | 952 | static const UINT32 pos[]={0x000,0x004,0x00a,0x00e}; |
r21155 | r21156 | |
996 | 985 | } |
997 | 986 | memmove( &src[0x100000], &src[0x200000], 0x400000 ); |
998 | 987 | |
999 | | auto_free(machine, dst); |
| 988 | auto_free(machine(), dst); |
1000 | 989 | } |
1001 | 990 | |
1002 | 991 | |
1003 | 992 | /* kof99, garou, garouh, mslug3 and kof2000 have and SMA chip which contains program code and decrypts the 68k roms */ |
1004 | | void kof99_decrypt_68k(running_machine &machine) |
| 993 | void neogeo_state::kof99_decrypt_68k() |
1005 | 994 | { |
1006 | 995 | UINT16 *rom; |
1007 | 996 | int i,j; |
1008 | 997 | |
1009 | | rom = (UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x100000); |
| 998 | rom = (UINT16 *)(memregion("maincpu")->base() + 0x100000); |
1010 | 999 | /* swap data lines on the whole ROMs */ |
1011 | 1000 | for (i = 0;i < 0x800000/2;i++) |
1012 | 1001 | { |
r21155 | r21156 | |
1025 | 1014 | } |
1026 | 1015 | |
1027 | 1016 | /* swap address lines & relocate fixed part */ |
1028 | | rom = (UINT16 *)machine.root_device().memregion("maincpu")->base(); |
| 1017 | rom = (UINT16 *)memregion("maincpu")->base(); |
1029 | 1018 | for (i = 0;i < 0x0c0000/2;i++) |
1030 | 1019 | { |
1031 | 1020 | rom[i] = rom[0x700000/2 + BITSWAP24(i,23,22,21,20,19,18,11,6,14,17,16,5,8,10,12,0,4,3,2,7,9,15,13,1)]; |
r21155 | r21156 | |
1033 | 1022 | } |
1034 | 1023 | |
1035 | 1024 | |
1036 | | void garou_decrypt_68k(running_machine &machine) |
| 1025 | void neogeo_state::garou_decrypt_68k() |
1037 | 1026 | { |
1038 | 1027 | UINT16 *rom; |
1039 | 1028 | int i,j; |
1040 | 1029 | |
1041 | 1030 | /* thanks to Razoola and Mr K for the info */ |
1042 | | rom = (UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x100000); |
| 1031 | rom = (UINT16 *)(memregion("maincpu")->base() + 0x100000); |
1043 | 1032 | /* swap data lines on the whole ROMs */ |
1044 | 1033 | for (i = 0;i < 0x800000/2;i++) |
1045 | 1034 | { |
r21155 | r21156 | |
1047 | 1036 | } |
1048 | 1037 | |
1049 | 1038 | /* swap address lines & relocate fixed part */ |
1050 | | rom = (UINT16 *)machine.root_device().memregion("maincpu")->base(); |
| 1039 | rom = (UINT16 *)memregion("maincpu")->base(); |
1051 | 1040 | for (i = 0;i < 0x0c0000/2;i++) |
1052 | 1041 | { |
1053 | 1042 | rom[i] = rom[0x710000/2 + BITSWAP24(i,23,22,21,20,19,18,4,5,16,14,7,9,6,13,17,15,3,1,2,12,11,8,10,0)]; |
1054 | 1043 | } |
1055 | 1044 | |
1056 | 1045 | /* swap address lines for the banked part */ |
1057 | | rom = (UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x100000); |
| 1046 | rom = (UINT16 *)(memregion("maincpu")->base() + 0x100000); |
1058 | 1047 | for (i = 0;i < 0x800000/2;i+=0x8000/2) |
1059 | 1048 | { |
1060 | 1049 | UINT16 buffer[0x8000/2]; |
r21155 | r21156 | |
1067 | 1056 | } |
1068 | 1057 | |
1069 | 1058 | |
1070 | | void garouh_decrypt_68k(running_machine &machine) |
| 1059 | void neogeo_state::garouh_decrypt_68k() |
1071 | 1060 | { |
1072 | 1061 | UINT16 *rom; |
1073 | 1062 | int i,j; |
1074 | 1063 | |
1075 | 1064 | /* thanks to Razoola and Mr K for the info */ |
1076 | | rom = (UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x100000); |
| 1065 | rom = (UINT16 *)(memregion("maincpu")->base() + 0x100000); |
1077 | 1066 | /* swap data lines on the whole ROMs */ |
1078 | 1067 | for (i = 0;i < 0x800000/2;i++) |
1079 | 1068 | { |
r21155 | r21156 | |
1081 | 1070 | } |
1082 | 1071 | |
1083 | 1072 | /* swap address lines & relocate fixed part */ |
1084 | | rom = (UINT16 *)machine.root_device().memregion("maincpu")->base(); |
| 1073 | rom = (UINT16 *)memregion("maincpu")->base(); |
1085 | 1074 | for (i = 0;i < 0x0c0000/2;i++) |
1086 | 1075 | { |
1087 | 1076 | rom[i] = rom[0x7f8000/2 + BITSWAP24(i,23,22,21,20,19,18,5,16,11,2,6,7,17,3,12,8,14,4,0,9,1,10,15,13)]; |
1088 | 1077 | } |
1089 | 1078 | |
1090 | 1079 | /* swap address lines for the banked part */ |
1091 | | rom = (UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x100000); |
| 1080 | rom = (UINT16 *)(memregion("maincpu")->base() + 0x100000); |
1092 | 1081 | for (i = 0;i < 0x800000/2;i+=0x8000/2) |
1093 | 1082 | { |
1094 | 1083 | UINT16 buffer[0x8000/2]; |
r21155 | r21156 | |
1101 | 1090 | } |
1102 | 1091 | |
1103 | 1092 | |
1104 | | void mslug3_decrypt_68k(running_machine &machine) |
| 1093 | void neogeo_state::mslug3_decrypt_68k() |
1105 | 1094 | { |
1106 | 1095 | UINT16 *rom; |
1107 | 1096 | int i,j; |
1108 | 1097 | |
1109 | 1098 | /* thanks to Razoola and Mr K for the info */ |
1110 | | rom = (UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x100000); |
| 1099 | rom = (UINT16 *)(memregion("maincpu")->base() + 0x100000); |
1111 | 1100 | /* swap data lines on the whole ROMs */ |
1112 | 1101 | for (i = 0;i < 0x800000/2;i++) |
1113 | 1102 | { |
r21155 | r21156 | |
1115 | 1104 | } |
1116 | 1105 | |
1117 | 1106 | /* swap address lines & relocate fixed part */ |
1118 | | rom = (UINT16 *)machine.root_device().memregion("maincpu")->base(); |
| 1107 | rom = (UINT16 *)memregion("maincpu")->base(); |
1119 | 1108 | for (i = 0;i < 0x0c0000/2;i++) |
1120 | 1109 | { |
1121 | 1110 | rom[i] = rom[0x5d0000/2 + BITSWAP24(i,23,22,21,20,19,18,15,2,1,13,3,0,9,6,16,4,11,5,7,12,17,14,10,8)]; |
1122 | 1111 | } |
1123 | 1112 | |
1124 | 1113 | /* swap address lines for the banked part */ |
1125 | | rom = (UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x100000); |
| 1114 | rom = (UINT16 *)(memregion("maincpu")->base() + 0x100000); |
1126 | 1115 | for (i = 0;i < 0x800000/2;i+=0x10000/2) |
1127 | 1116 | { |
1128 | 1117 | UINT16 buffer[0x10000/2]; |
r21155 | r21156 | |
1135 | 1124 | } |
1136 | 1125 | |
1137 | 1126 | |
1138 | | void kof2000_decrypt_68k(running_machine &machine) |
| 1127 | void neogeo_state::kof2000_decrypt_68k() |
1139 | 1128 | { |
1140 | 1129 | UINT16 *rom; |
1141 | 1130 | int i,j; |
1142 | 1131 | |
1143 | 1132 | /* thanks to Razoola and Mr K for the info */ |
1144 | | rom = (UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x100000); |
| 1133 | rom = (UINT16 *)(memregion("maincpu")->base() + 0x100000); |
1145 | 1134 | /* swap data lines on the whole ROMs */ |
1146 | 1135 | for (i = 0;i < 0x800000/2;i++) |
1147 | 1136 | { |
r21155 | r21156 | |
1160 | 1149 | } |
1161 | 1150 | |
1162 | 1151 | /* swap address lines & relocate fixed part */ |
1163 | | rom = (UINT16 *)machine.root_device().memregion("maincpu")->base(); |
| 1152 | rom = (UINT16 *)memregion("maincpu")->base(); |
1164 | 1153 | for (i = 0;i < 0x0c0000/2;i++) |
1165 | 1154 | { |
1166 | 1155 | rom[i] = rom[0x73a000/2 + BITSWAP24(i,23,22,21,20,19,18,8,4,15,13,3,14,16,2,6,17,7,12,10,0,5,11,1,9)]; |
r21155 | r21156 | |
1169 | 1158 | |
1170 | 1159 | |
1171 | 1160 | /* kof2002, matrim, samsho5, samsh5sp have some simple block swapping */ |
1172 | | void kof2002_decrypt_68k(running_machine &machine) |
| 1161 | void neogeo_state::kof2002_decrypt_68k() |
1173 | 1162 | { |
1174 | 1163 | int i; |
1175 | 1164 | static const int sec[]={0x100000,0x280000,0x300000,0x180000,0x000000,0x380000,0x200000,0x080000}; |
1176 | | UINT8 *src = machine.root_device().memregion("maincpu")->base()+0x100000; |
1177 | | UINT8 *dst = auto_alloc_array(machine, UINT8, 0x400000); |
| 1165 | UINT8 *src = memregion("maincpu")->base()+0x100000; |
| 1166 | UINT8 *dst = auto_alloc_array(machine(), UINT8, 0x400000); |
1178 | 1167 | memcpy( dst, src, 0x400000 ); |
1179 | 1168 | for( i=0; i<8; ++i ) |
1180 | 1169 | { |
1181 | 1170 | memcpy( src+i*0x80000, dst+sec[i], 0x80000 ); |
1182 | 1171 | } |
1183 | | auto_free(machine, dst); |
| 1172 | auto_free(machine(), dst); |
1184 | 1173 | } |
1185 | 1174 | |
1186 | 1175 | |
1187 | | void matrim_decrypt_68k(running_machine &machine) |
| 1176 | void neogeo_state::matrim_decrypt_68k() |
1188 | 1177 | { |
1189 | 1178 | int i; |
1190 | 1179 | static const int sec[]={0x100000,0x280000,0x300000,0x180000,0x000000,0x380000,0x200000,0x080000}; |
1191 | | UINT8 *src = machine.root_device().memregion("maincpu")->base()+0x100000; |
1192 | | UINT8 *dst = auto_alloc_array(machine, UINT8, 0x400000); |
| 1180 | UINT8 *src = memregion("maincpu")->base()+0x100000; |
| 1181 | UINT8 *dst = auto_alloc_array(machine(), UINT8, 0x400000); |
1193 | 1182 | memcpy( dst, src, 0x400000); |
1194 | 1183 | for( i=0; i<8; ++i ) |
1195 | 1184 | { |
1196 | 1185 | memcpy( src+i*0x80000, dst+sec[i], 0x80000 ); |
1197 | 1186 | } |
1198 | | auto_free(machine, dst); |
| 1187 | auto_free(machine(), dst); |
1199 | 1188 | } |
1200 | 1189 | |
1201 | 1190 | |
1202 | | void samsho5_decrypt_68k(running_machine &machine) |
| 1191 | void neogeo_state::samsho5_decrypt_68k() |
1203 | 1192 | { |
1204 | 1193 | int i; |
1205 | 1194 | static const int sec[]={0x000000,0x080000,0x700000,0x680000,0x500000,0x180000,0x200000,0x480000,0x300000,0x780000,0x600000,0x280000,0x100000,0x580000,0x400000,0x380000}; |
1206 | | UINT8 *src = machine.root_device().memregion("maincpu")->base(); |
1207 | | UINT8 *dst = auto_alloc_array(machine, UINT8, 0x800000); |
| 1195 | UINT8 *src = memregion("maincpu")->base(); |
| 1196 | UINT8 *dst = auto_alloc_array(machine(), UINT8, 0x800000); |
1208 | 1197 | |
1209 | 1198 | memcpy( dst, src, 0x800000 ); |
1210 | 1199 | for( i=0; i<16; ++i ) |
1211 | 1200 | { |
1212 | 1201 | memcpy( src+i*0x80000, dst+sec[i], 0x80000 ); |
1213 | 1202 | } |
1214 | | auto_free(machine, dst); |
| 1203 | auto_free(machine(), dst); |
1215 | 1204 | } |
1216 | 1205 | |
1217 | 1206 | |
1218 | | void samsh5sp_decrypt_68k(running_machine &machine) |
| 1207 | void neogeo_state::samsh5sp_decrypt_68k() |
1219 | 1208 | { |
1220 | 1209 | int i; |
1221 | 1210 | static const int sec[]={0x000000,0x080000,0x500000,0x480000,0x600000,0x580000,0x700000,0x280000,0x100000,0x680000,0x400000,0x780000,0x200000,0x380000,0x300000,0x180000}; |
1222 | | UINT8 *src = machine.root_device().memregion("maincpu")->base(); |
1223 | | UINT8 *dst = auto_alloc_array(machine, UINT8, 0x800000); |
| 1211 | UINT8 *src = memregion("maincpu")->base(); |
| 1212 | UINT8 *dst = auto_alloc_array(machine(), UINT8, 0x800000); |
1224 | 1213 | |
1225 | 1214 | memcpy( dst, src, 0x800000 ); |
1226 | 1215 | for( i=0; i<16; ++i ) |
1227 | 1216 | { |
1228 | 1217 | memcpy( src+i*0x80000, dst+sec[i], 0x80000 ); |
1229 | 1218 | } |
1230 | | auto_free(machine, dst); |
| 1219 | auto_free(machine(), dst); |
1231 | 1220 | } |
1232 | 1221 | |
1233 | 1222 | |
1234 | 1223 | /* kf2k3pcb, kof2003, kof2003h, mslug5 and svc have updated P rom scramble */ |
1235 | | void mslug5_decrypt_68k(running_machine &machine) |
| 1224 | void neogeo_state::mslug5_decrypt_68k() |
1236 | 1225 | { |
1237 | 1226 | static const UINT8 xor1[ 0x20 ] = { 0xc2, 0x4b, 0x74, 0xfd, 0x0b, 0x34, 0xeb, 0xd7, 0x10, 0x6d, 0xf9, 0xce, 0x5d, 0xd5, 0x61, 0x29, 0xf5, 0xbe, 0x0d, 0x82, 0x72, 0x45, 0x0f, 0x24, 0xb3, 0x34, 0x1b, 0x99, 0xea, 0x09, 0xf3, 0x03 }; |
1238 | 1227 | static const UINT8 xor2[ 0x20 ] = { 0x36, 0x09, 0xb0, 0x64, 0x95, 0x0f, 0x90, 0x42, 0x6e, 0x0f, 0x30, 0xf6, 0xe5, 0x08, 0x30, 0x64, 0x08, 0x04, 0x00, 0x2f, 0x72, 0x09, 0xa0, 0x13, 0xc9, 0x0b, 0xa0, 0x3e, 0xc2, 0x00, 0x40, 0x2b }; |
1239 | 1228 | int i; |
1240 | 1229 | int ofst; |
1241 | 1230 | int rom_size = 0x800000; |
1242 | | UINT8 *rom = machine.root_device().memregion( "maincpu" )->base(); |
1243 | | UINT8 *buf = auto_alloc_array(machine, UINT8, rom_size ); |
| 1231 | UINT8 *rom = memregion( "maincpu" )->base(); |
| 1232 | UINT8 *buf = auto_alloc_array(machine(), UINT8, rom_size ); |
1244 | 1233 | |
1245 | 1234 | for( i = 0; i < 0x100000; i++ ) |
1246 | 1235 | { |
r21155 | r21156 | |
1273 | 1262 | memcpy( buf, rom, rom_size ); |
1274 | 1263 | memcpy( &rom[ 0x100000 ], &buf[ 0x700000 ], 0x100000 ); |
1275 | 1264 | memcpy( &rom[ 0x200000 ], &buf[ 0x100000 ], 0x600000 ); |
1276 | | auto_free( machine, buf ); |
| 1265 | auto_free( machine(), buf ); |
1277 | 1266 | } |
1278 | 1267 | |
1279 | 1268 | |
1280 | | void svc_px_decrypt(running_machine &machine) |
| 1269 | void neogeo_state::svc_px_decrypt() |
1281 | 1270 | { |
1282 | 1271 | static const UINT8 xor1[ 0x20 ] = { 0x3b, 0x6a, 0xf7, 0xb7, 0xe8, 0xa9, 0x20, 0x99, 0x9f, 0x39, 0x34, 0x0c, 0xc3, 0x9a, 0xa5, 0xc8, 0xb8, 0x18, 0xce, 0x56, 0x94, 0x44, 0xe3, 0x7a, 0xf7, 0xdd, 0x42, 0xf0, 0x18, 0x60, 0x92, 0x9f }; |
1283 | 1272 | static const UINT8 xor2[ 0x20 ] = { 0x69, 0x0b, 0x60, 0xd6, 0x4f, 0x01, 0x40, 0x1a, 0x9f, 0x0b, 0xf0, 0x75, 0x58, 0x0e, 0x60, 0xb4, 0x14, 0x04, 0x20, 0xe4, 0xb9, 0x0d, 0x10, 0x89, 0xeb, 0x07, 0x30, 0x90, 0x50, 0x0e, 0x20, 0x26 }; |
1284 | 1273 | int i; |
1285 | 1274 | int ofst; |
1286 | 1275 | int rom_size = 0x800000; |
1287 | | UINT8 *rom = machine.root_device().memregion( "maincpu" )->base(); |
1288 | | UINT8 *buf = auto_alloc_array(machine, UINT8, rom_size ); |
| 1276 | UINT8 *rom = memregion( "maincpu" )->base(); |
| 1277 | UINT8 *buf = auto_alloc_array(machine(), UINT8, rom_size ); |
1289 | 1278 | |
1290 | 1279 | for( i = 0; i < 0x100000; i++ ) |
1291 | 1280 | { |
r21155 | r21156 | |
1318 | 1307 | memcpy( buf, rom, rom_size ); |
1319 | 1308 | memcpy( &rom[ 0x100000 ], &buf[ 0x700000 ], 0x100000 ); |
1320 | 1309 | memcpy( &rom[ 0x200000 ], &buf[ 0x100000 ], 0x600000 ); |
1321 | | auto_free( machine, buf ); |
| 1310 | auto_free( machine(), buf ); |
1322 | 1311 | } |
1323 | 1312 | |
1324 | 1313 | |
1325 | | void kf2k3pcb_decrypt_68k(running_machine &machine) |
| 1314 | void neogeo_state::kf2k3pcb_decrypt_68k() |
1326 | 1315 | { |
1327 | 1316 | static const UINT8 xor2[ 0x20 ] = { 0xb4, 0x0f, 0x40, 0x6c, 0x38, 0x07, 0xd0, 0x3f, 0x53, 0x08, 0x80, 0xaa, 0xbe, 0x07, 0xc0, 0xfa, 0xd0, 0x08, 0x10, 0xd2, 0xf1, 0x03, 0x70, 0x7e, 0x87, 0x0b, 0x40, 0xf6, 0x2a, 0x0a, 0xe0, 0xf9 }; |
1328 | 1317 | int i; |
1329 | 1318 | int ofst; |
1330 | 1319 | int rom_size = 0x900000; |
1331 | | UINT8 *rom = machine.root_device().memregion( "maincpu" )->base(); |
1332 | | UINT8 *buf = auto_alloc_array(machine, UINT8, rom_size ); |
| 1320 | UINT8 *rom = memregion( "maincpu" )->base(); |
| 1321 | UINT8 *buf = auto_alloc_array(machine(), UINT8, rom_size ); |
1333 | 1322 | |
1334 | 1323 | for (i = 0; i < 0x100000; i++) |
1335 | 1324 | { |
r21155 | r21156 | |
1360 | 1349 | memcpy (&rom[0x000000], &buf[0x000000], 0x100000); |
1361 | 1350 | memcpy (&rom[0x100000], &buf[0x800000], 0x100000); |
1362 | 1351 | memcpy (&rom[0x200000], &buf[0x100000], 0x700000); |
1363 | | auto_free( machine, buf ); |
| 1352 | auto_free( machine(), buf ); |
1364 | 1353 | } |
1365 | 1354 | |
1366 | 1355 | |
1367 | | void kof2003_decrypt_68k(running_machine &machine) |
| 1356 | void neogeo_state::kof2003_decrypt_68k() |
1368 | 1357 | { |
1369 | 1358 | static const UINT8 xor1[0x20] = { 0x3b, 0x6a, 0xf7, 0xb7, 0xe8, 0xa9, 0x20, 0x99, 0x9f, 0x39, 0x34, 0x0c, 0xc3, 0x9a, 0xa5, 0xc8, 0xb8, 0x18, 0xce, 0x56, 0x94, 0x44, 0xe3, 0x7a, 0xf7, 0xdd, 0x42, 0xf0, 0x18, 0x60, 0x92, 0x9f }; |
1370 | 1359 | static const UINT8 xor2[0x20] = { 0x2f, 0x02, 0x60, 0xbb, 0x77, 0x01, 0x30, 0x08, 0xd8, 0x01, 0xa0, 0xdf, 0x37, 0x0a, 0xf0, 0x65, 0x28, 0x03, 0xd0, 0x23, 0xd3, 0x03, 0x70, 0x42, 0xbb, 0x06, 0xf0, 0x28, 0xba, 0x0f, 0xf0, 0x7a }; |
1371 | 1360 | int i; |
1372 | 1361 | int ofst; |
1373 | 1362 | int rom_size = 0x900000; |
1374 | | UINT8 *rom = machine.root_device().memregion( "maincpu" )->base(); |
1375 | | UINT8 *buf = auto_alloc_array(machine, UINT8, rom_size ); |
| 1363 | UINT8 *rom = memregion( "maincpu" )->base(); |
| 1364 | UINT8 *buf = auto_alloc_array(machine(), UINT8, rom_size ); |
1376 | 1365 | |
1377 | 1366 | for (i = 0; i < 0x100000; i++) |
1378 | 1367 | { |
r21155 | r21156 | |
1407 | 1396 | memcpy (&rom[0x000000], &buf[0x000000], 0x100000); |
1408 | 1397 | memcpy (&rom[0x100000], &buf[0x800000], 0x100000); |
1409 | 1398 | memcpy (&rom[0x200000], &buf[0x100000], 0x700000); |
1410 | | auto_free( machine, buf ); |
| 1399 | auto_free( machine(), buf ); |
1411 | 1400 | } |
1412 | 1401 | |
1413 | 1402 | |
1414 | 1403 | // Thanks to IQ_132 for the info |
1415 | | void kof2003h_decrypt_68k(running_machine &machine) |
| 1404 | void neogeo_state::kof2003h_decrypt_68k() |
1416 | 1405 | { |
1417 | 1406 | static const UINT8 xor1[0x20] = { 0xc2, 0x4b, 0x74, 0xfd, 0x0b, 0x34, 0xeb, 0xd7, 0x10, 0x6d, 0xf9, 0xce, 0x5d, 0xd5, 0x61, 0x29, 0xf5, 0xbe, 0x0d, 0x82, 0x72, 0x45, 0x0f, 0x24, 0xb3, 0x34, 0x1b, 0x99, 0xea, 0x09, 0xf3, 0x03 }; |
1418 | 1407 | static const UINT8 xor2[0x20] = { 0x2b, 0x09, 0xd0, 0x7f, 0x51, 0x0b, 0x10, 0x4c, 0x5b, 0x07, 0x70, 0x9d, 0x3e, 0x0b, 0xb0, 0xb6, 0x54, 0x09, 0xe0, 0xcc, 0x3d, 0x0d, 0x80, 0x99, 0x87, 0x03, 0x90, 0x82, 0xfe, 0x04, 0x20, 0x18 }; |
1419 | 1408 | int i; |
1420 | 1409 | int ofst; |
1421 | 1410 | int rom_size = 0x900000; |
1422 | | UINT8 *rom = machine.root_device().memregion( "maincpu" )->base(); |
1423 | | UINT8 *buf = auto_alloc_array(machine, UINT8, rom_size ); |
| 1411 | UINT8 *rom = memregion( "maincpu" )->base(); |
| 1412 | UINT8 *buf = auto_alloc_array(machine(), UINT8, rom_size ); |
1424 | 1413 | |
1425 | 1414 | for (i = 0; i < 0x100000; i++) |
1426 | 1415 | { |
r21155 | r21156 | |
1455 | 1444 | memcpy (&rom[0x000000], &buf[0x000000], 0x100000); |
1456 | 1445 | memcpy (&rom[0x100000], &buf[0x800000], 0x100000); |
1457 | 1446 | memcpy (&rom[0x200000], &buf[0x100000], 0x700000); |
1458 | | auto_free( machine, buf ); |
| 1447 | auto_free( machine(), buf ); |
1459 | 1448 | } |
1460 | 1449 | |
1461 | 1450 | |
r21155 | r21156 | |
1467 | 1456 | ***************************************************************************/ |
1468 | 1457 | |
1469 | 1458 | /* Neo-Pcm2 Drivers for Encrypted V Roms */ |
1470 | | void neo_pcm2_snk_1999(running_machine &machine, int value) |
| 1459 | void neogeo_state::neo_pcm2_snk_1999(int value) |
1471 | 1460 | { /* thanks to Elsemi for the NEO-PCM2 info */ |
1472 | | UINT16 *rom = (UINT16 *)machine.root_device().memregion("ymsnd")->base(); |
1473 | | int size = machine.root_device().memregion("ymsnd")->bytes(); |
| 1461 | UINT16 *rom = (UINT16 *)memregion("ymsnd")->base(); |
| 1462 | int size = memregion("ymsnd")->bytes(); |
1474 | 1463 | int i, j; |
1475 | 1464 | |
1476 | 1465 | if( rom != NULL ) |
1477 | 1466 | { /* swap address lines on the whole ROMs */ |
1478 | | UINT16 *buffer = auto_alloc_array(machine, UINT16, value / 2); |
| 1467 | UINT16 *buffer = auto_alloc_array(machine(), UINT16, value / 2); |
1479 | 1468 | |
1480 | 1469 | for( i = 0; i < size / 2; i += ( value / 2 ) ) |
1481 | 1470 | { |
r21155 | r21156 | |
1485 | 1474 | rom[ i + j ] = buffer[ j ^ (value/4) ]; |
1486 | 1475 | } |
1487 | 1476 | } |
1488 | | auto_free(machine, buffer); |
| 1477 | auto_free(machine(), buffer); |
1489 | 1478 | } |
1490 | 1479 | } |
1491 | 1480 | |
1492 | 1481 | |
1493 | 1482 | /* the later PCM2 games have additional scrambling */ |
1494 | | void neo_pcm2_swap(running_machine &machine, int value) |
| 1483 | void neogeo_state::neo_pcm2_swap(int value) |
1495 | 1484 | { |
1496 | 1485 | static const UINT32 addrs[7][2]={ |
1497 | 1486 | {0x000000,0xa5000}, |
r21155 | r21156 | |
1509 | 1498 | {0xcb,0x29,0x7d,0x43,0xd2,0x3a,0xc2,0xb4}, |
1510 | 1499 | {0x4b,0xa4,0x63,0x46,0xf0,0x91,0xea,0x62}, |
1511 | 1500 | {0x4b,0xa4,0x63,0x46,0xf0,0x91,0xea,0x62}}; |
1512 | | UINT8 *src = machine.root_device().memregion("ymsnd")->base(); |
1513 | | UINT8 *buf = auto_alloc_array(machine, UINT8, 0x1000000); |
| 1501 | UINT8 *src = memregion("ymsnd")->base(); |
| 1502 | UINT8 *buf = auto_alloc_array(machine(), UINT8, 0x1000000); |
1514 | 1503 | int i, j, d; |
1515 | 1504 | |
1516 | 1505 | memcpy(buf,src,0x1000000); |
r21155 | r21156 | |
1521 | 1510 | d=((i+addrs[value][0])&0xffffff); |
1522 | 1511 | src[j]=buf[d]^xordata[value][j&0x7]; |
1523 | 1512 | } |
1524 | | auto_free(machine, buf); |
| 1513 | auto_free(machine(), buf); |
1525 | 1514 | } |
1526 | 1515 | |
1527 | 1516 | |
r21155 | r21156 | |
1533 | 1522 | |
1534 | 1523 | |
1535 | 1524 | /* only found on kf2k3pcb */ |
1536 | | void kof2003biosdecode(running_machine &machine) |
| 1525 | void neogeo_state::kof2003biosdecode() |
1537 | 1526 | { |
1538 | 1527 | static const UINT8 address[0x80]={ |
1539 | 1528 | 0xb9,0xb8,0x36,0x37,0x3d,0x3c,0xb2,0xb3, |
r21155 | r21156 | |
1553 | 1542 | 0xd3,0xd2,0x5c,0x5d,0x57,0x56,0xd8,0xd9, |
1554 | 1543 | 0xd3,0xd2,0x5c,0x5d,0x57,0x56,0xd8,0xd9, |
1555 | 1544 | }; |
1556 | | UINT16*src= (UINT16*)machine.root_device().memregion( "mainbios" )->base(); |
1557 | | UINT16*buf= auto_alloc_array(machine, UINT16, 0x80000/2); |
| 1545 | UINT16*src= (UINT16*)memregion( "mainbios" )->base(); |
| 1546 | UINT16*buf= auto_alloc_array(machine(), UINT16, 0x80000/2); |
1558 | 1547 | int a,addr; |
1559 | 1548 | |
1560 | 1549 | for (a=0;a<0x80000/2;a++) |
r21155 | r21156 | |
1574 | 1563 | buf[addr]=src[a]; |
1575 | 1564 | } |
1576 | 1565 | memcpy(src,buf,0x80000); |
1577 | | auto_free(machine, buf); |
| 1566 | auto_free(machine(), buf); |
1578 | 1567 | } |
trunk/src/mame/machine/neoboot.c
r21155 | r21156 | |
19 | 19 | /* General Bootleg Functions - used by more than 1 game */ |
20 | 20 | |
21 | 21 | |
22 | | void neogeo_bootleg_cx_decrypt( running_machine &machine ) |
| 22 | void neogeo_state::neogeo_bootleg_cx_decrypt() |
23 | 23 | { |
24 | 24 | int i; |
25 | | int cx_size = machine.root_device().memregion( "sprites" )->bytes(); |
26 | | UINT8 *rom = machine.root_device().memregion( "sprites" )->base(); |
27 | | UINT8 *buf = auto_alloc_array(machine, UINT8, cx_size ); |
| 25 | int cx_size = memregion( "sprites" )->bytes(); |
| 26 | UINT8 *rom = memregion( "sprites" )->base(); |
| 27 | UINT8 *buf = auto_alloc_array(machine(), UINT8, cx_size ); |
28 | 28 | |
29 | 29 | memcpy( buf, rom, cx_size ); |
30 | 30 | |
r21155 | r21156 | |
32 | 32 | memcpy( &rom[ i * 0x40 ], &buf[ (i ^ 1) * 0x40 ], 0x40 ); |
33 | 33 | } |
34 | 34 | |
35 | | auto_free( machine, buf ); |
| 35 | auto_free( machine(), buf ); |
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | | void neogeo_bootleg_sx_decrypt( running_machine &machine, int value ) |
| 39 | void neogeo_state::neogeo_bootleg_sx_decrypt(int value ) |
40 | 40 | { |
41 | | int sx_size = machine.root_device().memregion( "fixed" )->bytes(); |
42 | | UINT8 *rom = machine.root_device().memregion( "fixed" )->base(); |
| 41 | int sx_size = memregion( "fixed" )->bytes(); |
| 42 | UINT8 *rom = memregion( "fixed" )->base(); |
43 | 43 | int i; |
44 | 44 | |
45 | 45 | if (value == 1) |
46 | 46 | { |
47 | | UINT8 *buf = auto_alloc_array(machine, UINT8, sx_size ); |
| 47 | UINT8 *buf = auto_alloc_array(machine(), UINT8, sx_size ); |
48 | 48 | memcpy( buf, rom, sx_size ); |
49 | 49 | |
50 | 50 | for( i = 0; i < sx_size; i += 0x10 ) |
r21155 | r21156 | |
52 | 52 | memcpy( &rom[ i ], &buf[ i + 8 ], 8 ); |
53 | 53 | memcpy( &rom[ i + 8 ], &buf[ i ], 8 ); |
54 | 54 | } |
55 | | auto_free( machine, buf ); |
| 55 | auto_free( machine(), buf ); |
56 | 56 | } |
57 | 57 | else if (value == 2) |
58 | 58 | { |
r21155 | r21156 | |
68 | 68 | /* The protection patching here may be incomplete |
69 | 69 | Thanks to Razoola for the info */ |
70 | 70 | |
71 | | void kog_px_decrypt( running_machine &machine ) |
| 71 | void neogeo_state::kog_px_decrypt() |
72 | 72 | { |
73 | 73 | /* the protection chip does some *very* strange things to the rom */ |
74 | | UINT8 *src = machine.root_device().memregion("maincpu")->base(); |
75 | | UINT8 *dst = auto_alloc_array(machine, UINT8, 0x600000 ); |
76 | | UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base(); |
| 74 | UINT8 *src = memregion("maincpu")->base(); |
| 75 | UINT8 *dst = auto_alloc_array(machine(), UINT8, 0x600000 ); |
| 76 | UINT16 *rom = (UINT16 *)memregion("maincpu")->base(); |
77 | 77 | int i; |
78 | 78 | static const int sec[] = { 0x3, 0x8, 0x7, 0xC, 0x1, 0xA, 0x6, 0xD }; |
79 | 79 | |
r21155 | r21156 | |
87 | 87 | memcpy (dst + 0x090000, src + 0x040000, 0x004000); |
88 | 88 | memcpy (dst + 0x100000, src + 0x200000, 0x400000); |
89 | 89 | memcpy (src, dst, 0x600000); |
90 | | auto_free (machine, dst); |
| 90 | auto_free (machine(), dst); |
91 | 91 | |
92 | 92 | for (i = 0x90000/2; i < 0x94000/2; i++){ |
93 | 93 | if (((rom[i]&0xFFBF) == 0x4EB9 || rom[i] == 0x43F9) && !rom[i + 1]) |
r21155 | r21156 | |
132 | 132 | |
133 | 133 | /* The King of Fighters '97 Oroshi Plus 2003 (bootleg) */ |
134 | 134 | |
135 | | void kof97oro_px_decode( running_machine &machine ) |
| 135 | void neogeo_state::kof97oro_px_decode() |
136 | 136 | { |
137 | 137 | int i; |
138 | | UINT16 *tmp = auto_alloc_array(machine, UINT16, 0x500000 ); |
139 | | UINT16 *src = (UINT16*)machine.root_device().memregion("maincpu")->base(); |
| 138 | UINT16 *tmp = auto_alloc_array(machine(), UINT16, 0x500000 ); |
| 139 | UINT16 *src = (UINT16*)memregion("maincpu")->base(); |
140 | 140 | |
141 | 141 | for (i = 0; i < 0x500000/2; i++) { |
142 | 142 | tmp[i] = src[i ^ 0x7ffef]; |
r21155 | r21156 | |
144 | 144 | |
145 | 145 | memcpy (src, tmp, 0x500000); |
146 | 146 | |
147 | | auto_free (machine, tmp); |
| 147 | auto_free (machine(), tmp); |
148 | 148 | } |
149 | 149 | |
150 | 150 | |
r21155 | r21156 | |
155 | 155 | is incomplete, at the moment the S data is copied from the program rom on |
156 | 156 | start-up instead */ |
157 | 157 | |
158 | | static UINT16 kof10thExtraRAMB[0x01000]; |
159 | | |
160 | | static void kof10thBankswitch(address_space &space, UINT16 nBank) |
| 158 | void neogeo_state::kof10thBankswitch(address_space &space, UINT16 nBank) |
161 | 159 | { |
162 | 160 | UINT32 bank = 0x100000 + ((nBank & 7) << 20); |
163 | 161 | if (bank >= 0x700000) |
164 | 162 | bank = 0x100000; |
165 | | space.machine().driver_data<neogeo_state>()->neogeo_set_main_cpu_bank_address(bank); |
| 163 | neogeo_set_main_cpu_bank_address(bank); |
166 | 164 | } |
167 | 165 | |
168 | | static READ16_HANDLER( kof10th_RAMB_r ) |
| 166 | READ16_MEMBER( neogeo_state::kof10th_RAMB_r ) |
169 | 167 | { |
170 | 168 | return kof10thExtraRAMB[offset]; |
171 | 169 | } |
172 | 170 | |
173 | | static WRITE16_HANDLER( kof10th_custom_w ) |
| 171 | WRITE16_MEMBER( neogeo_state::kof10th_custom_w ) |
174 | 172 | { |
175 | 173 | if (!kof10thExtraRAMB[0xFFE]) { // Write to RAM bank A |
176 | | UINT16 *prom = (UINT16*)space.machine().root_device().memregion( "maincpu" )->base(); |
| 174 | UINT16 *prom = (UINT16*)memregion( "maincpu" )->base(); |
177 | 175 | COMBINE_DATA(&prom[(0xE0000/2) + (offset & 0xFFFF)]); |
178 | 176 | } else { // Write S data on-the-fly |
179 | | UINT8 *srom = space.machine().root_device().memregion( "fixed" )->base(); |
| 177 | UINT8 *srom = memregion( "fixed" )->base(); |
180 | 178 | srom[offset] = BITSWAP8(data,7,6,0,4,3,2,1,5); |
181 | 179 | } |
182 | 180 | } |
183 | 181 | |
184 | | static WRITE16_HANDLER( kof10th_bankswitch_w ) |
| 182 | WRITE16_MEMBER( neogeo_state::kof10th_bankswitch_w ) |
185 | 183 | { |
186 | 184 | if (offset >= 0x5F000) { |
187 | 185 | if (offset == 0x5FFF8) { // Standard bankswitch |
188 | 186 | kof10thBankswitch(space, data); |
189 | 187 | } else if (offset == 0x5FFFC && kof10thExtraRAMB[0xFFC] != data) { // Special bankswitch |
190 | | UINT8 *src = space.machine().root_device().memregion( "maincpu" )->base(); |
| 188 | UINT8 *src = memregion( "maincpu" )->base(); |
191 | 189 | memcpy (src + 0x10000, src + ((data & 1) ? 0x810000 : 0x710000), 0xcffff); |
192 | 190 | } |
193 | 191 | COMBINE_DATA(&kof10thExtraRAMB[offset & 0xFFF]); |
194 | 192 | } |
195 | 193 | } |
196 | 194 | |
197 | | void install_kof10th_protection ( running_machine &machine ) |
| 195 | void neogeo_state::install_kof10th_protection () |
198 | 196 | { |
199 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x2fe000, 0x2fffff, FUNC(kof10th_RAMB_r)); |
200 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x200000, 0x23ffff, FUNC(kof10th_custom_w)); |
201 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x240000, 0x2fffff, FUNC(kof10th_bankswitch_w)); |
| 197 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x2fe000, 0x2fffff, read16_delegate(FUNC(neogeo_state::kof10th_RAMB_r),this)); |
| 198 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x200000, 0x23ffff, write16_delegate(FUNC(neogeo_state::kof10th_custom_w),this)); |
| 199 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x240000, 0x2fffff, write16_delegate(FUNC(neogeo_state::kof10th_bankswitch_w),this)); |
202 | 200 | } |
203 | 201 | |
204 | | void decrypt_kof10th(running_machine &machine) |
| 202 | void neogeo_state::decrypt_kof10th() |
205 | 203 | { |
206 | 204 | int i, j; |
207 | | UINT8 *dst = auto_alloc_array(machine, UINT8, 0x900000); |
208 | | UINT8 *src = machine.root_device().memregion( "maincpu" )->base(); |
| 205 | UINT8 *dst = auto_alloc_array(machine(), UINT8, 0x900000); |
| 206 | UINT8 *src = memregion( "maincpu" )->base(); |
209 | 207 | |
210 | 208 | memcpy(dst + 0x000000, src + 0x700000, 0x100000); // Correct (Verified in Uni-bios) |
211 | 209 | memcpy(dst + 0x100000, src + 0x000000, 0x800000); |
r21155 | r21156 | |
215 | 213 | src[j] = dst[i]; |
216 | 214 | } |
217 | 215 | |
218 | | auto_free(machine, dst); |
| 216 | auto_free(machine(), dst); |
219 | 217 | |
220 | 218 | // Altera protection chip patches these over P ROM |
221 | 219 | ((UINT16*)src)[0x0124/2] = 0x000d; // Enables XOR for RAM moves, forces SoftDIPs, and USA region |
r21155 | r21156 | |
230 | 228 | /* The King of Fighters 10th Anniversary Extra Plus (The King of Fighters 2002 bootleg) */ |
231 | 229 | |
232 | 230 | |
233 | | void decrypt_kf10thep(running_machine &machine) |
| 231 | void neogeo_state::decrypt_kf10thep() |
234 | 232 | { |
235 | 233 | int i; |
236 | | UINT16 *rom = (UINT16*)machine.root_device().memregion("maincpu")->base(); |
237 | | UINT8 *src = machine.root_device().memregion("maincpu")->base(); |
238 | | UINT16 *buf = (UINT16*)machine.root_device().memregion("audiocrypt")->base(); |
239 | | UINT8 *srom = (UINT8*)machine.root_device().memregion("fixed")->base(); |
240 | | UINT8 *sbuf = auto_alloc_array(machine, UINT8, 0x20000); |
| 234 | UINT16 *rom = (UINT16*)memregion("maincpu")->base(); |
| 235 | UINT8 *src = memregion("maincpu")->base(); |
| 236 | UINT16 *buf = (UINT16*)memregion("audiocrypt")->base(); |
| 237 | UINT8 *srom = (UINT8*)memregion("fixed")->base(); |
| 238 | UINT8 *sbuf = auto_alloc_array(machine(), UINT8, 0x20000); |
241 | 239 | |
242 | | UINT8 *dst = auto_alloc_array(machine, UINT8, 0x200000); |
| 240 | UINT8 *dst = auto_alloc_array(machine(), UINT8, 0x200000); |
243 | 241 | |
244 | 242 | memcpy(dst,buf,0x200000); |
245 | 243 | memcpy(src+0x000000,dst+0x060000,0x20000); |
r21155 | r21156 | |
258 | 256 | if (rom[i+0] == 0x4ef9 && rom[i+1] == 0x0000) rom[i+1] = 0x000F; // correct JMP in moved code |
259 | 257 | } |
260 | 258 | rom[0x00342/2] = 0x000f; |
261 | | auto_free(machine, dst); |
| 259 | auto_free(machine(), dst); |
262 | 260 | |
263 | 261 | for (i=0;i<0x20000;i++) |
264 | 262 | sbuf[i]=srom[i^0x8]; |
265 | 263 | |
266 | 264 | memcpy(srom,sbuf,0x20000); |
267 | | auto_free(machine, sbuf); |
| 265 | auto_free(machine(), sbuf); |
268 | 266 | } |
269 | 267 | |
270 | 268 | |
271 | 269 | /* The King of Fighters 10th Anniversary 2005 Unique (The King of Fighters 2002 bootleg) */ |
272 | 270 | |
273 | 271 | |
274 | | static void kf2k5uni_px_decrypt( running_machine &machine ) |
| 272 | void neogeo_state::kf2k5uni_px_decrypt() |
275 | 273 | { |
276 | 274 | int i, j, ofst; |
277 | | UINT8 *src = machine.root_device().memregion( "maincpu" )->base(); |
278 | | UINT8 *dst = auto_alloc_array(machine, UINT8, 0x80); |
| 275 | UINT8 *src = memregion( "maincpu" )->base(); |
| 276 | UINT8 *dst = auto_alloc_array(machine(), UINT8, 0x80); |
279 | 277 | |
280 | 278 | for (i = 0; i < 0x800000; i+=0x80) |
281 | 279 | { |
r21155 | r21156 | |
286 | 284 | } |
287 | 285 | memcpy(src + i, dst, 0x80); |
288 | 286 | } |
289 | | auto_free(machine, dst); |
| 287 | auto_free(machine(), dst); |
290 | 288 | |
291 | 289 | memcpy(src, src + 0x600000, 0x100000); // Seems to be the same as kof10th |
292 | 290 | } |
293 | 291 | |
294 | | static void kf2k5uni_sx_decrypt( running_machine &machine ) |
| 292 | void neogeo_state::kf2k5uni_sx_decrypt() |
295 | 293 | { |
296 | 294 | int i; |
297 | | UINT8 *srom = machine.root_device().memregion( "fixed" )->base(); |
| 295 | UINT8 *srom = memregion( "fixed" )->base(); |
298 | 296 | |
299 | 297 | for (i = 0; i < 0x20000; i++) |
300 | 298 | srom[i] = BITSWAP8(srom[i], 4, 5, 6, 7, 0, 1, 2, 3); |
301 | 299 | } |
302 | 300 | |
303 | | static void kf2k5uni_mx_decrypt( running_machine &machine ) |
| 301 | void neogeo_state::kf2k5uni_mx_decrypt() |
304 | 302 | { |
305 | 303 | int i; |
306 | | UINT8 *mrom = machine.root_device().memregion( "audiocpu" )->base(); |
| 304 | UINT8 *mrom = memregion( "audiocpu" )->base(); |
307 | 305 | |
308 | 306 | for (i = 0; i < 0x30000; i++) |
309 | 307 | mrom[i] = BITSWAP8(mrom[i], 4, 5, 6, 7, 0, 1, 2, 3); |
310 | 308 | } |
311 | 309 | |
312 | | void decrypt_kf2k5uni( running_machine &machine ) |
| 310 | void neogeo_state::decrypt_kf2k5uni() |
313 | 311 | { |
314 | | kf2k5uni_px_decrypt(machine); |
315 | | kf2k5uni_sx_decrypt(machine); |
316 | | kf2k5uni_mx_decrypt(machine); |
| 312 | kf2k5uni_px_decrypt(); |
| 313 | kf2k5uni_sx_decrypt(); |
| 314 | kf2k5uni_mx_decrypt(); |
317 | 315 | } |
318 | 316 | |
319 | 317 | |
r21155 | r21156 | |
321 | 319 | |
322 | 320 | |
323 | 321 | // Thanks to IQ_132 for the info |
324 | | void kof2002b_gfx_decrypt(running_machine &machine, UINT8 *src, int size) |
| 322 | void neogeo_state::kof2002b_gfx_decrypt(UINT8 *src, int size) |
325 | 323 | { |
326 | 324 | int i, j; |
327 | 325 | int t[ 8 ][ 10 ] = |
r21155 | r21156 | |
336 | 334 | { 8, 0, 7, 3, 4, 5, 6, 2, 1 }, |
337 | 335 | }; |
338 | 336 | |
339 | | UINT8 *dst = auto_alloc_array(machine, UINT8, 0x10000 ); |
| 337 | UINT8 *dst = auto_alloc_array(machine(), UINT8, 0x10000 ); |
340 | 338 | |
341 | 339 | for ( i = 0; i < size; i+=0x10000 ) |
342 | 340 | { |
r21155 | r21156 | |
350 | 348 | memcpy( src+i+ofst*128, dst+j*128, 128 ); |
351 | 349 | } |
352 | 350 | } |
353 | | auto_free( machine, dst ); |
| 351 | auto_free( machine(), dst ); |
354 | 352 | } |
355 | 353 | |
356 | 354 | |
357 | 355 | /* The King of Fighters 2002 Magic Plus (bootleg) */ |
358 | 356 | |
359 | 357 | |
360 | | void kf2k2mp_decrypt( running_machine &machine ) |
| 358 | void neogeo_state::kf2k2mp_decrypt() |
361 | 359 | { |
362 | 360 | int i,j; |
363 | 361 | |
364 | | UINT8 *src = machine.root_device().memregion("maincpu")->base(); |
365 | | UINT8 *dst = auto_alloc_array(machine, UINT8, 0x80); |
| 362 | UINT8 *src = memregion("maincpu")->base(); |
| 363 | UINT8 *dst = auto_alloc_array(machine(), UINT8, 0x80); |
366 | 364 | |
367 | 365 | memmove(src, src + 0x300000, 0x500000); |
368 | 366 | |
r21155 | r21156 | |
375 | 373 | } |
376 | 374 | memcpy(src + i, dst, 0x80); |
377 | 375 | } |
378 | | auto_free(machine, dst); |
| 376 | auto_free(machine(), dst); |
379 | 377 | } |
380 | 378 | |
381 | 379 | |
382 | 380 | /* The King of Fighters 2002 Magic Plus II (bootleg) */ |
383 | 381 | |
384 | 382 | |
385 | | void kf2k2mp2_px_decrypt( running_machine &machine ) |
| 383 | void neogeo_state::kf2k2mp2_px_decrypt() |
386 | 384 | { |
387 | | UINT8 *src = machine.root_device().memregion("maincpu")->base(); |
388 | | UINT8 *dst = auto_alloc_array(machine, UINT8, 0x600000); |
| 385 | UINT8 *src = memregion("maincpu")->base(); |
| 386 | UINT8 *dst = auto_alloc_array(machine(), UINT8, 0x600000); |
389 | 387 | |
390 | 388 | memcpy (dst + 0x000000, src + 0x1C0000, 0x040000); |
391 | 389 | memcpy (dst + 0x040000, src + 0x140000, 0x080000); |
392 | 390 | memcpy (dst + 0x0C0000, src + 0x100000, 0x040000); |
393 | 391 | memcpy (dst + 0x100000, src + 0x200000, 0x400000); |
394 | 392 | memcpy (src + 0x000000, dst + 0x000000, 0x600000); |
395 | | auto_free (machine, dst); |
| 393 | auto_free (machine(), dst); |
396 | 394 | } |
397 | 395 | |
398 | 396 | |
r21155 | r21156 | |
400 | 398 | |
401 | 399 | |
402 | 400 | /* descrambling information from razoola */ |
403 | | static void cthd2003_neogeo_gfx_address_fix_do(running_machine &machine, int start, int end, int bit3shift, int bit2shift, int bit1shift, int bit0shift) |
| 401 | void neogeo_state::cthd2003_neogeo_gfx_address_fix_do(int start, int end, int bit3shift, int bit2shift, int bit1shift, int bit0shift) |
404 | 402 | { |
405 | 403 | int i,j; |
406 | 404 | int tilesize=128; |
407 | 405 | |
408 | | UINT8* rom = auto_alloc_array(machine, UINT8, 16*tilesize); // 16 tiles buffer |
409 | | UINT8* realrom = machine.root_device().memregion("sprites")->base() + start*tilesize; |
| 406 | UINT8* rom = auto_alloc_array(machine(), UINT8, 16*tilesize); // 16 tiles buffer |
| 407 | UINT8* realrom = memregion("sprites")->base() + start*tilesize; |
410 | 408 | |
411 | 409 | for (i = 0; i < (end-start)/16; i++) { |
412 | 410 | for (j = 0; j < 16; j++) { |
r21155 | r21156 | |
420 | 418 | memcpy(realrom,rom,tilesize*16); |
421 | 419 | realrom+=16*tilesize; |
422 | 420 | } |
423 | | auto_free(machine, rom); |
| 421 | auto_free(machine(), rom); |
424 | 422 | } |
425 | 423 | |
426 | | static void cthd2003_neogeo_gfx_address_fix(running_machine &machine, int start, int end) |
| 424 | void neogeo_state::cthd2003_neogeo_gfx_address_fix(int start, int end) |
427 | 425 | { |
428 | | cthd2003_neogeo_gfx_address_fix_do(machine, start+512*0, end+512*0, 0,3,2,1); |
429 | | cthd2003_neogeo_gfx_address_fix_do(machine, start+512*1, end+512*1, 1,0,3,2); |
430 | | cthd2003_neogeo_gfx_address_fix_do(machine, start+512*2, end+512*2, 2,1,0,3); |
| 426 | cthd2003_neogeo_gfx_address_fix_do(start+512*0, end+512*0, 0,3,2,1); |
| 427 | cthd2003_neogeo_gfx_address_fix_do(start+512*1, end+512*1, 1,0,3,2); |
| 428 | cthd2003_neogeo_gfx_address_fix_do(start+512*2, end+512*2, 2,1,0,3); |
431 | 429 | // skip 3 & 4 |
432 | | cthd2003_neogeo_gfx_address_fix_do(machine, start+512*5, end+512*5, 0,1,2,3); |
433 | | cthd2003_neogeo_gfx_address_fix_do(machine, start+512*6, end+512*6, 0,1,2,3); |
434 | | cthd2003_neogeo_gfx_address_fix_do(machine, start+512*7, end+512*7, 0,2,3,1); |
| 430 | cthd2003_neogeo_gfx_address_fix_do(start+512*5, end+512*5, 0,1,2,3); |
| 431 | cthd2003_neogeo_gfx_address_fix_do(start+512*6, end+512*6, 0,1,2,3); |
| 432 | cthd2003_neogeo_gfx_address_fix_do(start+512*7, end+512*7, 0,2,3,1); |
435 | 433 | } |
436 | 434 | |
437 | | static void cthd2003_c(running_machine &machine, int pow) |
| 435 | void neogeo_state::cthd2003_c(int pow) |
438 | 436 | { |
439 | 437 | int i; |
440 | 438 | |
441 | 439 | for (i=0; i<=192; i+=8) |
442 | | cthd2003_neogeo_gfx_address_fix(machine, i*512,i*512+512); |
| 440 | cthd2003_neogeo_gfx_address_fix(i*512,i*512+512); |
443 | 441 | |
444 | 442 | for (i=200; i<=392; i+=8) |
445 | | cthd2003_neogeo_gfx_address_fix(machine, i*512,i*512+512); |
| 443 | cthd2003_neogeo_gfx_address_fix(i*512,i*512+512); |
446 | 444 | |
447 | 445 | for (i=400; i<=592; i+=8) |
448 | | cthd2003_neogeo_gfx_address_fix(machine, i*512,i*512+512); |
| 446 | cthd2003_neogeo_gfx_address_fix(i*512,i*512+512); |
449 | 447 | |
450 | 448 | for (i=600; i<=792; i+=8) |
451 | | cthd2003_neogeo_gfx_address_fix(machine, i*512,i*512+512); |
| 449 | cthd2003_neogeo_gfx_address_fix(i*512,i*512+512); |
452 | 450 | |
453 | 451 | for (i=800; i<=992; i+=8) |
454 | | cthd2003_neogeo_gfx_address_fix(machine, i*512,i*512+512); |
| 452 | cthd2003_neogeo_gfx_address_fix(i*512,i*512+512); |
455 | 453 | |
456 | 454 | for (i=1000; i<=1016; i+=8) |
457 | | cthd2003_neogeo_gfx_address_fix(machine, i*512,i*512+512); |
| 455 | cthd2003_neogeo_gfx_address_fix(i*512,i*512+512); |
458 | 456 | } |
459 | 457 | |
460 | | void decrypt_cthd2003( running_machine &machine ) |
| 458 | void neogeo_state::decrypt_cthd2003() |
461 | 459 | { |
462 | | UINT8 *romdata = machine.root_device().memregion("fixed")->base(); |
463 | | UINT8 *tmp = auto_alloc_array(machine, UINT8, 8*128*128); |
| 460 | UINT8 *romdata = memregion("fixed")->base(); |
| 461 | UINT8 *tmp = auto_alloc_array(machine(), UINT8, 8*128*128); |
464 | 462 | |
465 | 463 | memcpy(tmp+8*0*128, romdata+8*0*128, 8*32*128); |
466 | 464 | memcpy(tmp+8*32*128, romdata+8*64*128, 8*32*128); |
r21155 | r21156 | |
468 | 466 | memcpy(tmp+8*96*128, romdata+8*96*128, 8*32*128); |
469 | 467 | memcpy(romdata, tmp, 8*128*128); |
470 | 468 | |
471 | | romdata = machine.root_device().memregion("audiocpu")->base()+0x10000; |
| 469 | romdata = memregion("audiocpu")->base()+0x10000; |
472 | 470 | memcpy(tmp+8*0*128, romdata+8*0*128, 8*32*128); |
473 | 471 | memcpy(tmp+8*32*128, romdata+8*64*128, 8*32*128); |
474 | 472 | memcpy(tmp+8*64*128, romdata+8*32*128, 8*32*128); |
475 | 473 | memcpy(tmp+8*96*128, romdata+8*96*128, 8*32*128); |
476 | 474 | memcpy(romdata, tmp, 8*128*128); |
477 | 475 | |
478 | | auto_free(machine, tmp); |
| 476 | auto_free(machine(), tmp); |
479 | 477 | |
480 | 478 | memcpy(romdata-0x10000,romdata,0x10000); |
481 | 479 | |
482 | | cthd2003_c(machine, 0); |
| 480 | cthd2003_c(0); |
483 | 481 | } |
484 | 482 | |
485 | | static WRITE16_HANDLER ( cthd2003_bankswitch_w ) |
| 483 | WRITE16_MEMBER( neogeo_state::cthd2003_bankswitch_w ) |
486 | 484 | { |
487 | 485 | int bankaddress; |
488 | 486 | static const int cthd2003_banks[8] = |
r21155 | r21156 | |
492 | 490 | if (offset == 0) |
493 | 491 | { |
494 | 492 | bankaddress = 0x100000 + cthd2003_banks[data&7]*0x100000; |
495 | | space.machine().driver_data<neogeo_state>()->neogeo_set_main_cpu_bank_address(bankaddress); |
| 493 | neogeo_set_main_cpu_bank_address(bankaddress); |
496 | 494 | } |
497 | 495 | } |
498 | 496 | |
499 | | void patch_cthd2003( running_machine &machine ) |
| 497 | void neogeo_state::patch_cthd2003() |
500 | 498 | { |
501 | 499 | /* patches thanks to razoola */ |
502 | 500 | int i; |
503 | | UINT16 *mem16 = (UINT16 *)machine.root_device().memregion("maincpu")->base(); |
| 501 | UINT16 *mem16 = (UINT16 *)memregion("maincpu")->base(); |
504 | 502 | |
505 | 503 | /* special ROM banking handler */ |
506 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x2ffff0, 0x2fffff, FUNC(cthd2003_bankswitch_w)); |
| 504 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x2ffff0, 0x2fffff, write16_delegate(FUNC(neogeo_state::cthd2003_bankswitch_w),this)); |
507 | 505 | |
508 | 506 | // theres still a problem on the character select screen but it seems to be related to cpu core timing issues, |
509 | 507 | // overclocking the 68k prevents it. |
r21155 | r21156 | |
541 | 539 | /* Crouching Tiger Hidden Dragon 2003 Super Plus (bootleg of King of Fighters 2001) */ |
542 | 540 | |
543 | 541 | |
544 | | static void ct2k3sp_sx_decrypt( running_machine &machine ) |
| 542 | void neogeo_state::ct2k3sp_sx_decrypt() |
545 | 543 | { |
546 | | int rom_size = machine.root_device().memregion( "fixed" )->bytes(); |
547 | | UINT8 *rom = machine.root_device().memregion( "fixed" )->base(); |
548 | | UINT8 *buf = auto_alloc_array(machine, UINT8, rom_size ); |
| 544 | int rom_size = memregion( "fixed" )->bytes(); |
| 545 | UINT8 *rom = memregion( "fixed" )->base(); |
| 546 | UINT8 *buf = auto_alloc_array(machine(), UINT8, rom_size ); |
549 | 547 | int i; |
550 | 548 | int ofst; |
551 | 549 | |
r21155 | r21156 | |
568 | 566 | memcpy( &rom[ 0x28000 ], &buf[ 0x30000 ], 0x8000 ); |
569 | 567 | memcpy( &rom[ 0x30000 ], &buf[ 0x28000 ], 0x8000 ); |
570 | 568 | |
571 | | auto_free( machine, buf ); |
| 569 | auto_free( machine(), buf ); |
572 | 570 | } |
573 | 571 | |
574 | | void decrypt_ct2k3sp( running_machine &machine ) |
| 572 | void neogeo_state::decrypt_ct2k3sp() |
575 | 573 | { |
576 | | UINT8 *romdata = machine.root_device().memregion("audiocpu")->base()+0x10000; |
577 | | UINT8*tmp = auto_alloc_array(machine, UINT8, 8*128*128); |
| 574 | UINT8 *romdata = memregion("audiocpu")->base()+0x10000; |
| 575 | UINT8*tmp = auto_alloc_array(machine(), UINT8, 8*128*128); |
578 | 576 | memcpy(tmp+8*0*128, romdata+8*0*128, 8*32*128); |
579 | 577 | memcpy(tmp+8*32*128, romdata+8*64*128, 8*32*128); |
580 | 578 | memcpy(tmp+8*64*128, romdata+8*32*128, 8*32*128); |
581 | 579 | memcpy(tmp+8*96*128, romdata+8*96*128, 8*32*128); |
582 | 580 | memcpy(romdata, tmp, 8*128*128); |
583 | 581 | |
584 | | auto_free(machine, tmp); |
| 582 | auto_free(machine(), tmp); |
585 | 583 | memcpy(romdata-0x10000,romdata,0x10000); |
586 | | ct2k3sp_sx_decrypt(machine); |
587 | | cthd2003_c(machine, 0); |
| 584 | ct2k3sp_sx_decrypt(); |
| 585 | cthd2003_c(0); |
588 | 586 | } |
589 | 587 | |
590 | 588 | |
591 | 589 | /* Crouching Tiger Hidden Dragon 2003 Super Plus alternate (bootleg of King of Fighters 2001) */ |
592 | 590 | |
593 | 591 | |
594 | | void decrypt_ct2k3sa( running_machine &machine ) |
| 592 | void neogeo_state::decrypt_ct2k3sa() |
595 | 593 | { |
596 | | UINT8 *romdata = machine.root_device().memregion("audiocpu")->base()+0x10000; |
597 | | UINT8*tmp = auto_alloc_array(machine, UINT8, 8*128*128); |
| 594 | UINT8 *romdata = memregion("audiocpu")->base()+0x10000; |
| 595 | UINT8*tmp = auto_alloc_array(machine(), UINT8, 8*128*128); |
598 | 596 | memcpy(tmp+8*0*128, romdata+8*0*128, 8*32*128); |
599 | 597 | memcpy(tmp+8*32*128, romdata+8*64*128, 8*32*128); |
600 | 598 | memcpy(tmp+8*64*128, romdata+8*32*128, 8*32*128); |
601 | 599 | memcpy(tmp+8*96*128, romdata+8*96*128, 8*32*128); |
602 | 600 | memcpy(romdata, tmp, 8*128*128); |
603 | 601 | |
604 | | auto_free(machine, tmp); |
| 602 | auto_free(machine(), tmp); |
605 | 603 | memcpy(romdata-0x10000,romdata,0x10000); |
606 | | cthd2003_c(machine, 0); |
| 604 | cthd2003_c(0); |
607 | 605 | } |
608 | 606 | |
609 | | void patch_ct2k3sa( running_machine &machine ) |
| 607 | void neogeo_state::patch_ct2k3sa() |
610 | 608 | { |
611 | 609 | /* patches thanks to razoola - same as for cthd2003*/ |
612 | 610 | int i; |
613 | | UINT16 *mem16 = (UINT16 *)machine.root_device().memregion("maincpu")->base(); |
| 611 | UINT16 *mem16 = (UINT16 *)memregion("maincpu")->base(); |
614 | 612 | |
615 | 613 | // theres still a problem on the character select screen but it seems to be related to cpu core timing issues, |
616 | 614 | // overclocking the 68k prevents it. |
r21155 | r21156 | |
649 | 647 | /* King of Fighters Special Edition 2004 (bootleg of King of Fighters 2002) */ |
650 | 648 | |
651 | 649 | |
652 | | void decrypt_kof2k4se_68k( running_machine &machine ) |
| 650 | void neogeo_state::decrypt_kof2k4se_68k() |
653 | 651 | { |
654 | | UINT8 *src = machine.root_device().memregion("maincpu")->base()+0x100000; |
655 | | UINT8 *dst = auto_alloc_array(machine, UINT8, 0x400000); |
| 652 | UINT8 *src = memregion("maincpu")->base()+0x100000; |
| 653 | UINT8 *dst = auto_alloc_array(machine(), UINT8, 0x400000); |
656 | 654 | int i; |
657 | 655 | static const int sec[] = {0x300000,0x200000,0x100000,0x000000}; |
658 | 656 | memcpy(dst,src,0x400000); |
r21155 | r21156 | |
661 | 659 | { |
662 | 660 | memcpy(src+i*0x100000,dst+sec[i],0x100000); |
663 | 661 | } |
664 | | auto_free(machine, dst); |
| 662 | auto_free(machine(), dst); |
665 | 663 | } |
666 | 664 | |
667 | 665 | |
668 | 666 | /* Lansquenet 2004 (Shock Troopers - 2nd Squad bootleg) */ |
669 | 667 | |
670 | 668 | |
671 | | void lans2004_vx_decrypt( running_machine &machine ) |
| 669 | void neogeo_state::lans2004_vx_decrypt() |
672 | 670 | { |
673 | 671 | int i; |
674 | | UINT8 *rom = machine.root_device().memregion( "ymsnd" )->base(); |
| 672 | UINT8 *rom = memregion( "ymsnd" )->base(); |
675 | 673 | for (i = 0; i < 0xA00000; i++) |
676 | 674 | rom[i] = BITSWAP8(rom[i], 0, 1, 5, 4, 3, 2, 6, 7); |
677 | 675 | } |
678 | 676 | |
679 | | void lans2004_decrypt_68k( running_machine &machine ) |
| 677 | void neogeo_state::lans2004_decrypt_68k() |
680 | 678 | { |
681 | 679 | /* Descrambling P ROMs - Thanks to Razoola for the info */ |
682 | 680 | int i; |
683 | | UINT8 *src = machine.root_device().memregion( "maincpu" )->base(); |
684 | | UINT16 *rom = (UINT16*)machine.root_device().memregion( "maincpu" )->base(); |
685 | | UINT8 *dst = auto_alloc_array(machine, UINT8, 0x600000); |
| 681 | UINT8 *src = memregion( "maincpu" )->base(); |
| 682 | UINT16 *rom = (UINT16*)memregion( "maincpu" )->base(); |
| 683 | UINT8 *dst = auto_alloc_array(machine(), UINT8, 0x600000); |
686 | 684 | |
687 | 685 | { |
688 | 686 | static const int sec[] = { 0x3, 0x8, 0x7, 0xC, 0x1, 0xA, 0x6, 0xD }; |
r21155 | r21156 | |
694 | 692 | memcpy (dst + 0x02FFF0, src + 0x1A92BE, 0x000010); |
695 | 693 | memcpy (dst + 0x100000, src + 0x200000, 0x400000); |
696 | 694 | memcpy (src, dst, 0x600000); |
697 | | auto_free (machine, dst); |
| 695 | auto_free (machine(), dst); |
698 | 696 | } |
699 | 697 | |
700 | 698 | for (i = 0xBBB00/2; i < 0xBE000/2; i++) { |
r21155 | r21156 | |
718 | 716 | /* Metal Slug 5 Plus (bootleg) */ |
719 | 717 | |
720 | 718 | |
721 | | static READ16_HANDLER( mslug5_prot_r ) |
| 719 | READ16_MEMBER( neogeo_state::mslug5_prot_r ) |
722 | 720 | { |
723 | 721 | logerror("PC %06x: access protected\n",space.device().safe_pc()); |
724 | 722 | return 0xa0; |
725 | 723 | } |
726 | 724 | |
727 | | static WRITE16_HANDLER ( ms5plus_bankswitch_w ) |
| 725 | WRITE16_MEMBER( neogeo_state::ms5plus_bankswitch_w ) |
728 | 726 | { |
729 | 727 | int bankaddress; |
730 | 728 | logerror("offset: %06x PC %06x: set banking %04x\n",offset,space.device().safe_pc(),data); |
731 | 729 | if ((offset == 0)&&(data == 0xa0)) |
732 | 730 | { |
733 | 731 | bankaddress=0xa0; |
734 | | space.machine().driver_data<neogeo_state>()->neogeo_set_main_cpu_bank_address(bankaddress); |
| 732 | neogeo_set_main_cpu_bank_address(bankaddress); |
735 | 733 | logerror("offset: %06x PC %06x: set banking %04x\n\n",offset,space.device().safe_pc(),bankaddress); |
736 | 734 | } |
737 | 735 | else if(offset == 2) |
r21155 | r21156 | |
739 | 737 | data=data>>4; |
740 | 738 | //data=data&7; |
741 | 739 | bankaddress=data*0x100000; |
742 | | space.machine().driver_data<neogeo_state>()->neogeo_set_main_cpu_bank_address(bankaddress); |
| 740 | neogeo_set_main_cpu_bank_address(bankaddress); |
743 | 741 | logerror("offset: %06x PC %06x: set banking %04x\n\n",offset,space.device().safe_pc(),bankaddress); |
744 | 742 | } |
745 | 743 | } |
746 | 744 | |
747 | | void install_ms5plus_protection(running_machine &machine) |
| 745 | void neogeo_state::install_ms5plus_protection() |
748 | 746 | { |
749 | 747 | // special ROM banking handler / additional protection |
750 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x2ffff0, 0x2fffff,FUNC(mslug5_prot_r), FUNC(ms5plus_bankswitch_w)); |
| 748 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x2ffff0, 0x2fffff,read16_delegate(FUNC(neogeo_state::mslug5_prot_r),this), write16_delegate(FUNC(neogeo_state::ms5plus_bankswitch_w),this)); |
751 | 749 | } |
752 | 750 | |
753 | 751 | |
754 | 752 | /* SNK vs. CAPCOM SVC CHAOS (bootleg) */ |
755 | 753 | |
756 | 754 | |
757 | | void svcboot_px_decrypt( running_machine &machine ) |
| 755 | void neogeo_state::svcboot_px_decrypt() |
758 | 756 | { |
759 | 757 | static const UINT8 sec[] = { |
760 | 758 | 0x06, 0x07, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00 |
761 | 759 | }; |
762 | 760 | int i; |
763 | | int size = machine.root_device().memregion( "maincpu" )->bytes(); |
764 | | UINT8 *src = machine.root_device().memregion( "maincpu" )->base(); |
765 | | UINT8 *dst = auto_alloc_array(machine, UINT8, size ); |
| 761 | int size = memregion( "maincpu" )->bytes(); |
| 762 | UINT8 *src = memregion( "maincpu" )->base(); |
| 763 | UINT8 *dst = auto_alloc_array(machine(), UINT8, size ); |
766 | 764 | int ofst; |
767 | 765 | for( i = 0; i < size / 0x100000; i++ ){ |
768 | 766 | memcpy( &dst[ i * 0x100000 ], &src[ sec[ i ] * 0x100000 ], 0x100000 ); |
r21155 | r21156 | |
772 | 770 | ofst += (i & 0xffff00); |
773 | 771 | memcpy( &src[ i * 2 ], &dst[ ofst * 2 ], 0x02 ); |
774 | 772 | } |
775 | | auto_free( machine, dst ); |
| 773 | auto_free( machine(), dst ); |
776 | 774 | } |
777 | 775 | |
778 | | void svcboot_cx_decrypt( running_machine &machine ) |
| 776 | void neogeo_state::svcboot_cx_decrypt() |
779 | 777 | { |
780 | 778 | static const UINT8 idx_tbl[ 0x10 ] = { |
781 | 779 | 0, 1, 0, 1, 2, 3, 2, 3, 3, 4, 3, 4, 4, 5, 4, 5, |
r21155 | r21156 | |
789 | 787 | { 3, 0, 2, 1 }, |
790 | 788 | }; |
791 | 789 | int i; |
792 | | int size = machine.root_device().memregion( "sprites" )->bytes(); |
793 | | UINT8 *src = machine.root_device().memregion( "sprites" )->base(); |
794 | | UINT8 *dst = auto_alloc_array(machine, UINT8, size ); |
| 790 | int size = memregion( "sprites" )->bytes(); |
| 791 | UINT8 *src = memregion( "sprites" )->base(); |
| 792 | UINT8 *dst = auto_alloc_array(machine(), UINT8, size ); |
795 | 793 | int ofst; |
796 | 794 | memcpy( dst, src, size ); |
797 | 795 | for( i = 0; i < size / 0x80; i++ ){ |
r21155 | r21156 | |
804 | 802 | ofst += (i & 0xfffff00); |
805 | 803 | memcpy( &src[ i * 0x80 ], &dst[ ofst * 0x80 ], 0x80 ); |
806 | 804 | } |
807 | | auto_free( machine, dst ); |
| 805 | auto_free( machine(), dst ); |
808 | 806 | } |
809 | 807 | |
810 | 808 | |
811 | 809 | /* SNK vs. CAPCOM SVC CHAOS Plus (bootleg set 1) */ |
812 | 810 | |
813 | 811 | |
814 | | void svcplus_px_decrypt( running_machine &machine ) |
| 812 | void neogeo_state::svcplus_px_decrypt() |
815 | 813 | { |
816 | 814 | static const int sec[] = { |
817 | 815 | 0x00, 0x03, 0x02, 0x05, 0x04, 0x01 |
818 | 816 | }; |
819 | | int size = machine.root_device().memregion( "maincpu" )->bytes(); |
820 | | UINT8 *src = machine.root_device().memregion( "maincpu" )->base(); |
821 | | UINT8 *dst = auto_alloc_array(machine, UINT8, size ); |
| 817 | int size = memregion( "maincpu" )->bytes(); |
| 818 | UINT8 *src = memregion( "maincpu" )->base(); |
| 819 | UINT8 *dst = auto_alloc_array(machine(), UINT8, size ); |
822 | 820 | int i; |
823 | 821 | int ofst; |
824 | 822 | memcpy( dst, src, size ); |
r21155 | r21156 | |
834 | 832 | for( i = 0; i < 6; i++ ){ |
835 | 833 | memcpy( &src[ i * 0x100000 ], &dst[ sec[ i ] * 0x100000 ], 0x100000 ); |
836 | 834 | } |
837 | | auto_free( machine, dst ); |
| 835 | auto_free( machine(), dst ); |
838 | 836 | } |
839 | 837 | |
840 | | void svcplus_px_hack( running_machine &machine ) |
| 838 | void neogeo_state::svcplus_px_hack() |
841 | 839 | { |
842 | 840 | /* patched by the protection chip? */ |
843 | | UINT8 *src = machine.root_device().memregion( "maincpu" )->base(); |
| 841 | UINT8 *src = memregion( "maincpu" )->base(); |
844 | 842 | src[ 0x0f8010 ] = 0x40; |
845 | 843 | src[ 0x0f8011 ] = 0x04; |
846 | 844 | src[ 0x0f8012 ] = 0x00; |
r21155 | r21156 | |
855 | 853 | /* SNK vs. CAPCOM SVC CHAOS Plus (bootleg set 2) */ |
856 | 854 | |
857 | 855 | |
858 | | void svcplusa_px_decrypt( running_machine &machine ) |
| 856 | void neogeo_state::svcplusa_px_decrypt() |
859 | 857 | { |
860 | 858 | int i; |
861 | 859 | static const int sec[] = { |
862 | 860 | 0x01, 0x02, 0x03, 0x04, 0x05, 0x00 |
863 | 861 | }; |
864 | | int size = machine.root_device().memregion( "maincpu" )->bytes(); |
865 | | UINT8 *src = machine.root_device().memregion( "maincpu" )->base(); |
866 | | UINT8 *dst = auto_alloc_array(machine, UINT8, size ); |
| 862 | int size = memregion( "maincpu" )->bytes(); |
| 863 | UINT8 *src = memregion( "maincpu" )->base(); |
| 864 | UINT8 *dst = auto_alloc_array(machine(), UINT8, size ); |
867 | 865 | memcpy( dst, src, size ); |
868 | 866 | for( i = 0; i < 6; i++ ){ |
869 | 867 | memcpy( &src[ i * 0x100000 ], &dst[ sec[ i ] * 0x100000 ], 0x100000 ); |
870 | 868 | } |
871 | | auto_free( machine, dst ); |
| 869 | auto_free( machine(), dst ); |
872 | 870 | } |
873 | 871 | |
874 | 872 | |
875 | 873 | /* SNK vs. CAPCOM SVC CHAOS Super Plus (bootleg) */ |
876 | 874 | |
877 | 875 | |
878 | | void svcsplus_px_decrypt( running_machine &machine ) |
| 876 | void neogeo_state::svcsplus_px_decrypt() |
879 | 877 | { |
880 | 878 | static const int sec[] = { |
881 | 879 | 0x06, 0x07, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00 |
882 | 880 | }; |
883 | | int size = machine.root_device().memregion( "maincpu" )->bytes(); |
884 | | UINT8 *src = machine.root_device().memregion( "maincpu" )->base(); |
885 | | UINT8 *dst = auto_alloc_array(machine, UINT8, size ); |
| 881 | int size = memregion( "maincpu" )->bytes(); |
| 882 | UINT8 *src = memregion( "maincpu" )->base(); |
| 883 | UINT8 *dst = auto_alloc_array(machine(), UINT8, size ); |
886 | 884 | int i; |
887 | 885 | int ofst; |
888 | 886 | memcpy( dst, src, size ); |
r21155 | r21156 | |
894 | 892 | ofst += sec[ (i & 0xf80000) >> 19 ] << 19; |
895 | 893 | memcpy( &src[ i * 2 ], &dst[ ofst * 2 ], 0x02 ); |
896 | 894 | } |
897 | | auto_free( machine, dst ); |
| 895 | auto_free( machine(), dst ); |
898 | 896 | } |
899 | 897 | |
900 | | void svcsplus_px_hack( running_machine &machine ) |
| 898 | void neogeo_state::svcsplus_px_hack() |
901 | 899 | { |
902 | 900 | /* patched by the protection chip? */ |
903 | | UINT16 *mem16 = (UINT16 *)machine.root_device().memregion("maincpu")->base(); |
| 901 | UINT16 *mem16 = (UINT16 *)memregion("maincpu")->base(); |
904 | 902 | mem16[0x9e90/2] = 0x000f; |
905 | 903 | mem16[0x9e92/2] = 0xc9c0; |
906 | 904 | mem16[0xa10c/2] = 0x4eb9; |
r21155 | r21156 | |
909 | 907 | } |
910 | 908 | |
911 | 909 | #ifdef UNUSED_FUNCTION |
912 | | static UINT16 mv0_bank_ram[ 0x10/2 ]; |
| 910 | UINT16 mv0_bank_ram[ 0x10/2 ]; |
913 | 911 | |
914 | | static READ16_HANDLER( mv0_bankswitch_r ) |
| 912 | READ16_MEMBER( neogeo_state::mv0_bankswitch_r ) |
915 | 913 | { |
916 | 914 | return mv0_bank_ram[ offset ]; |
917 | 915 | } |
918 | 916 | |
919 | | static WRITE16_HANDLER( mv0_bankswitch_w ) |
| 917 | WRITE16_MEMBER( neogeo_state::mv0_bankswitch_w ) |
920 | 918 | { |
921 | 919 | UINT32 bankaddress = (mv0_bank_ram[ 0 ] >> 8) + (mv0_bank_ram[ 1 ] << 8) + 0x100000; |
922 | 920 | COMBINE_DATA( &mv0_bank_ram[ offset ] ); |
923 | | space.machine().driver_data<neogeo_state>()->neogeo_set_main_cpu_bank_address( bankaddress ); |
| 921 | neogeo_set_main_cpu_bank_address( bankaddress ); |
924 | 922 | } |
925 | 923 | #endif |
926 | 924 | |
r21155 | r21156 | |
928 | 926 | /* The King of Fighters 2003 (bootleg set 1) */ |
929 | 927 | |
930 | 928 | |
931 | | static UINT16 kof2003_tbl[4096]; |
932 | | |
933 | | static READ16_HANDLER( kof2003_r) |
| 929 | READ16_MEMBER( neogeo_state::kof2003_r) |
934 | 930 | { |
935 | 931 | return kof2003_tbl[offset]; |
936 | 932 | } |
937 | 933 | |
938 | | static WRITE16_HANDLER( kof2003_w ) |
| 934 | WRITE16_MEMBER( neogeo_state::kof2003_w ) |
939 | 935 | { |
940 | 936 | data = COMBINE_DATA(&kof2003_tbl[offset]); |
941 | 937 | if (offset == 0x1ff0/2 || offset == 0x1ff2/2) { |
942 | 938 | UINT8* cr = (UINT8 *)kof2003_tbl; |
943 | 939 | UINT32 address = (cr[BYTE_XOR_LE(0x1ff3)]<<16)|(cr[BYTE_XOR_LE(0x1ff2)]<<8)|cr[BYTE_XOR_LE(0x1ff1)]; |
944 | 940 | UINT8 prt = cr[BYTE_XOR_LE(0x1ff2)]; |
945 | | UINT8* mem = (UINT8 *)space.machine().root_device().memregion("maincpu")->base(); |
| 941 | UINT8* mem = (UINT8 *)memregion("maincpu")->base(); |
946 | 942 | |
947 | 943 | cr[BYTE_XOR_LE(0x1ff0)] = 0xa0; |
948 | 944 | cr[BYTE_XOR_LE(0x1ff1)] &= 0xfe; |
949 | 945 | cr[BYTE_XOR_LE(0x1ff3)] &= 0x7f; |
950 | | space.machine().driver_data<neogeo_state>()->neogeo_set_main_cpu_bank_address(address+0x100000); |
| 946 | neogeo_set_main_cpu_bank_address(address+0x100000); |
951 | 947 | |
952 | 948 | mem[BYTE_XOR_LE(0x58196)] = prt; |
953 | 949 | } |
954 | 950 | } |
955 | 951 | |
956 | | static WRITE16_HANDLER( kof2003p_w ) |
| 952 | WRITE16_MEMBER( neogeo_state::kof2003p_w ) |
957 | 953 | { |
958 | 954 | data = COMBINE_DATA(&kof2003_tbl[offset]); |
959 | 955 | if (offset == 0x1ff0/2 || offset == 0x1ff2/2) { |
960 | 956 | UINT8* cr = (UINT8 *)kof2003_tbl; |
961 | 957 | UINT32 address = (cr[BYTE_XOR_LE(0x1ff3)]<<16)|(cr[BYTE_XOR_LE(0x1ff2)]<<8)|cr[BYTE_XOR_LE(0x1ff0)]; |
962 | 958 | UINT8 prt = cr[BYTE_XOR_LE(0x1ff2)]; |
963 | | UINT8* mem = (UINT8 *)space.machine().root_device().memregion("maincpu")->base(); |
| 959 | UINT8* mem = (UINT8 *)memregion("maincpu")->base(); |
964 | 960 | |
965 | 961 | cr[BYTE_XOR_LE(0x1ff0)] &= 0xfe; |
966 | 962 | cr[BYTE_XOR_LE(0x1ff3)] &= 0x7f; |
967 | | space.machine().driver_data<neogeo_state>()->neogeo_set_main_cpu_bank_address(address+0x100000); |
| 963 | neogeo_set_main_cpu_bank_address(address+0x100000); |
968 | 964 | |
969 | 965 | mem[BYTE_XOR_LE(0x58196)] = prt; |
970 | 966 | } |
971 | 967 | } |
972 | 968 | |
973 | | void kf2k3bl_px_decrypt( running_machine &machine ) |
| 969 | void neogeo_state::kf2k3bl_px_decrypt() |
974 | 970 | { |
975 | 971 | int i; |
976 | 972 | static const UINT8 sec[] = { |
r21155 | r21156 | |
978 | 974 | }; |
979 | 975 | |
980 | 976 | int rom_size = 0x800000; |
981 | | UINT8 *rom = machine.root_device().memregion( "maincpu" )->base(); |
982 | | UINT8 *buf = auto_alloc_array(machine, UINT8, rom_size ); |
| 977 | UINT8 *rom = memregion( "maincpu" )->base(); |
| 978 | UINT8 *buf = auto_alloc_array(machine(), UINT8, rom_size ); |
983 | 979 | memcpy( buf, rom, rom_size ); |
984 | 980 | |
985 | 981 | for( i = 0; i < rom_size / 0x100000; i++ ){ |
986 | 982 | memcpy( &rom[ i * 0x100000 ], &buf[ sec[ i ] * 0x100000 ], 0x100000 ); |
987 | 983 | } |
988 | | auto_free( machine, buf ); |
| 984 | auto_free( machine(), buf ); |
989 | 985 | } |
990 | 986 | |
991 | | void kf2k3bl_install_protection(running_machine &machine) |
| 987 | void neogeo_state::kf2k3bl_install_protection() |
992 | 988 | { |
993 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x2fe000, 0x2fffff, FUNC(kof2003_r), FUNC(kof2003_w) ); |
| 989 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x2fe000, 0x2fffff, read16_delegate(FUNC(neogeo_state::kof2003_r),this), write16_delegate(FUNC(neogeo_state::kof2003_w),this) ); |
994 | 990 | } |
995 | 991 | |
996 | 992 | |
997 | 993 | /* The King of Fighters 2004 Plus / Hero (The King of Fighters 2003 bootleg) */ |
998 | 994 | |
999 | 995 | |
1000 | | void kf2k3pl_px_decrypt( running_machine &machine ) |
| 996 | void neogeo_state::kf2k3pl_px_decrypt() |
1001 | 997 | { |
1002 | | UINT16*tmp = auto_alloc_array(machine, UINT16, 0x100000/2); |
1003 | | UINT16*rom = (UINT16*)machine.root_device().memregion( "maincpu" )->base(); |
| 998 | UINT16*tmp = auto_alloc_array(machine(), UINT16, 0x100000/2); |
| 999 | UINT16*rom = (UINT16*)memregion( "maincpu" )->base(); |
1004 | 1000 | int j; |
1005 | 1001 | int i; |
1006 | 1002 | |
r21155 | r21156 | |
1010 | 1006 | for (j = 0;j < 0x100000/2;j++) |
1011 | 1007 | rom[i+j] = tmp[BITSWAP24(j,23,22,21,20,19,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18)]; |
1012 | 1008 | } |
1013 | | auto_free(machine, tmp); |
| 1009 | auto_free(machine(), tmp); |
1014 | 1010 | |
1015 | 1011 | /* patched by Altera protection chip on PCB */ |
1016 | 1012 | rom[0xf38ac/2] = 0x4e75; |
1017 | 1013 | } |
1018 | 1014 | |
1019 | | void kf2k3pl_install_protection(running_machine &machine) |
| 1015 | void neogeo_state::kf2k3pl_install_protection() |
1020 | 1016 | { |
1021 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x2fe000, 0x2fffff, FUNC(kof2003_r), FUNC(kof2003p_w) ); |
| 1017 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x2fe000, 0x2fffff, read16_delegate(FUNC(neogeo_state::kof2003_r),this), write16_delegate(FUNC(neogeo_state::kof2003p_w),this) ); |
1022 | 1018 | } |
1023 | 1019 | |
1024 | 1020 | |
1025 | 1021 | /* The King of Fighters 2004 Ultra Plus (The King of Fighters 2003 bootleg) */ |
1026 | 1022 | |
1027 | 1023 | |
1028 | | void kf2k3upl_px_decrypt( running_machine &machine ) |
| 1024 | void neogeo_state::kf2k3upl_px_decrypt() |
1029 | 1025 | { |
1030 | 1026 | { |
1031 | | UINT8 *src = machine.root_device().memregion("maincpu")->base(); |
| 1027 | UINT8 *src = memregion("maincpu")->base(); |
1032 | 1028 | memmove(src+0x100000, src, 0x600000); |
1033 | 1029 | memmove(src, src+0x700000, 0x100000); |
1034 | 1030 | } |
r21155 | r21156 | |
1036 | 1032 | { |
1037 | 1033 | int ofst; |
1038 | 1034 | int i; |
1039 | | UINT8 *rom = machine.root_device().memregion( "maincpu" )->base() + 0xfe000; |
1040 | | UINT8 *buf = machine.root_device().memregion( "maincpu" )->base() + 0xd0610; |
| 1035 | UINT8 *rom = memregion( "maincpu" )->base() + 0xfe000; |
| 1036 | UINT8 *buf = memregion( "maincpu" )->base() + 0xd0610; |
1041 | 1037 | |
1042 | 1038 | for( i = 0; i < 0x2000 / 2; i++ ){ |
1043 | 1039 | ofst = (i & 0xff00) + BITSWAP8( (i & 0x00ff), 7, 6, 0, 4, 3, 2, 1, 5 ); |
r21155 | r21156 | |
1046 | 1042 | } |
1047 | 1043 | } |
1048 | 1044 | |
1049 | | void kf2k3upl_install_protection(running_machine &machine) |
| 1045 | void neogeo_state::kf2k3upl_install_protection() |
1050 | 1046 | { |
1051 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x2fe000, 0x2fffff, FUNC(kof2003_r), FUNC(kof2003_w) ); |
| 1047 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x2fe000, 0x2fffff, read16_delegate(FUNC(neogeo_state::kof2003_r),this), write16_delegate(FUNC(neogeo_state::kof2003_w),this) ); |
1052 | 1048 | } |
1053 | 1049 | |
1054 | 1050 | |
1055 | 1051 | /* Samurai Shodown V / Samurai Spirits Zero (bootleg) */ |
1056 | 1052 | |
1057 | 1053 | |
1058 | | void samsho5b_px_decrypt( running_machine &machine ) |
| 1054 | void neogeo_state::samsho5b_px_decrypt() |
1059 | 1055 | { |
1060 | | int px_size = machine.root_device().memregion( "maincpu" )->bytes(); |
1061 | | UINT8 *rom = machine.root_device().memregion( "maincpu" )->base(); |
1062 | | UINT8 *buf = auto_alloc_array(machine, UINT8, px_size ); |
| 1056 | int px_size = memregion( "maincpu" )->bytes(); |
| 1057 | UINT8 *rom = memregion( "maincpu" )->base(); |
| 1058 | UINT8 *buf = auto_alloc_array(machine(), UINT8, px_size ); |
1063 | 1059 | int ofst; |
1064 | 1060 | int i; |
1065 | 1061 | |
r21155 | r21156 | |
1078 | 1074 | memcpy( &rom[ 0x000000 ], &buf[ 0x700000 ], 0x100000 ); |
1079 | 1075 | memcpy( &rom[ 0x100000 ], &buf[ 0x000000 ], 0x700000 ); |
1080 | 1076 | |
1081 | | auto_free( machine, buf ); |
| 1077 | auto_free( machine(), buf ); |
1082 | 1078 | } |
1083 | 1079 | |
1084 | 1080 | |
1085 | | void samsho5b_vx_decrypt( running_machine &machine ) |
| 1081 | void neogeo_state::samsho5b_vx_decrypt() |
1086 | 1082 | { |
1087 | | int vx_size = machine.root_device().memregion( "ymsnd" )->bytes(); |
1088 | | UINT8 *rom = machine.root_device().memregion( "ymsnd" )->base(); |
| 1083 | int vx_size = memregion( "ymsnd" )->bytes(); |
| 1084 | UINT8 *rom = memregion( "ymsnd" )->base(); |
1089 | 1085 | int i; |
1090 | 1086 | |
1091 | 1087 | for( i = 0; i < vx_size; i++ ) |
r21155 | r21156 | |
1098 | 1094 | |
1099 | 1095 | #define MATRIMBLZ80( i ) ( i^(BITSWAP8(i&0x3,4,3,1,2,0,7,6,5)<<8) ) |
1100 | 1096 | |
1101 | | void matrimbl_decrypt( running_machine &machine ) |
| 1097 | void neogeo_state::matrimbl_decrypt() |
1102 | 1098 | { |
1103 | 1099 | /* decrypt Z80 */ |
1104 | | UINT8 *rom = machine.root_device().memregion( "audiocpu" )->base()+0x10000; |
1105 | | UINT8 *buf = auto_alloc_array(machine, UINT8, 0x20000 ); |
| 1100 | UINT8 *rom = memregion( "audiocpu" )->base()+0x10000; |
| 1101 | UINT8 *buf = auto_alloc_array(machine(), UINT8, 0x20000 ); |
1106 | 1102 | int i, j=0; |
1107 | 1103 | memcpy( buf, rom, 0x20000 ); |
1108 | 1104 | for( i=0x00000; i<0x20000; i++ ) |
r21155 | r21156 | |
1133 | 1129 | } |
1134 | 1130 | rom[ j ]=buf[ i ]; |
1135 | 1131 | } |
1136 | | auto_free( machine, buf ); |
| 1132 | auto_free( machine(), buf ); |
1137 | 1133 | memcpy( rom-0x10000, rom, 0x10000 ); |
1138 | 1134 | |
1139 | 1135 | /* decrypt gfx */ |
1140 | | cthd2003_c( machine, 0 ); |
| 1136 | cthd2003_c( 0 ); |
1141 | 1137 | } |
trunk/src/mame/machine/neoprot.c
r21155 | r21156 | |
22 | 22 | |
23 | 23 | /************************ Fatal Fury 2 *************************/ |
24 | 24 | |
25 | | static READ16_HANDLER( fatfury2_protection_16_r ) |
26 | | { |
27 | | neogeo_state *state = space.machine().driver_data<neogeo_state>(); |
28 | | UINT16 res = state->m_fatfury2_prot_data >> 24; |
| 25 | READ16_MEMBER( neogeo_state::fatfury2_protection_16_r ) |
| 26 | { |
| 27 | UINT16 res = m_fatfury2_prot_data >> 24; |
29 | 28 | |
30 | 29 | switch (offset) |
31 | 30 | { |
r21155 | r21156 | |
48 | 47 | } |
49 | 48 | |
50 | 49 | |
51 | | static WRITE16_HANDLER( fatfury2_protection_16_w ) |
| 50 | WRITE16_MEMBER( neogeo_state::fatfury2_protection_16_w ) |
52 | 51 | { |
53 | | neogeo_state *state = space.machine().driver_data<neogeo_state>(); |
54 | | |
55 | 52 | switch (offset) |
56 | 53 | { |
57 | 54 | case 0x11112/2: /* data == 0x1111; expects 0xff000000 back */ |
58 | | state->m_fatfury2_prot_data = 0xff000000; |
| 55 | m_fatfury2_prot_data = 0xff000000; |
59 | 56 | break; |
60 | 57 | |
61 | 58 | case 0x33332/2: /* data == 0x3333; expects 0x0000ffff back */ |
62 | | state->m_fatfury2_prot_data = 0x0000ffff; |
| 59 | m_fatfury2_prot_data = 0x0000ffff; |
63 | 60 | break; |
64 | 61 | |
65 | 62 | case 0x44442/2: /* data == 0x4444; expects 0x00ff0000 back */ |
66 | | state->m_fatfury2_prot_data = 0x00ff0000; |
| 63 | m_fatfury2_prot_data = 0x00ff0000; |
67 | 64 | break; |
68 | 65 | |
69 | 66 | case 0x55552/2: /* data == 0x5555; read back from 55550, ffff0, 00000, ff000 */ |
70 | | state->m_fatfury2_prot_data = 0xff00ff00; |
| 67 | m_fatfury2_prot_data = 0xff00ff00; |
71 | 68 | break; |
72 | 69 | |
73 | 70 | case 0x56782/2: /* data == 0x1234; read back from 36000 *or* 36004 */ |
74 | | state->m_fatfury2_prot_data = 0xf05a3601; |
| 71 | m_fatfury2_prot_data = 0xf05a3601; |
75 | 72 | break; |
76 | 73 | |
77 | 74 | case 0x42812/2: /* data == 0x1824; read back from 36008 *or* 3600c */ |
78 | | state->m_fatfury2_prot_data = 0x81422418; |
| 75 | m_fatfury2_prot_data = 0x81422418; |
79 | 76 | break; |
80 | 77 | |
81 | 78 | case 0x55550/2: |
r21155 | r21156 | |
85 | 82 | case 0x36004/2: |
86 | 83 | case 0x36008/2: |
87 | 84 | case 0x3600c/2: |
88 | | state->m_fatfury2_prot_data <<= 8; |
| 85 | m_fatfury2_prot_data <<= 8; |
89 | 86 | break; |
90 | 87 | |
91 | 88 | default: |
r21155 | r21156 | |
95 | 92 | } |
96 | 93 | |
97 | 94 | |
98 | | void fatfury2_install_protection( running_machine &machine ) |
99 | | { |
100 | | neogeo_state *state = machine.driver_data<neogeo_state>(); |
101 | | |
| 95 | void neogeo_state::fatfury2_install_protection() |
| 96 | { |
102 | 97 | /* the protection involves reading and writing addresses in the */ |
103 | 98 | /* 0x2xxxxx range. There are several checks all around the code. */ |
104 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x200000, 0x2fffff, FUNC(fatfury2_protection_16_r), FUNC(fatfury2_protection_16_w)); |
| 99 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x200000, 0x2fffff, read16_delegate(FUNC(neogeo_state::fatfury2_protection_16_r),this), write16_delegate(FUNC(neogeo_state::fatfury2_protection_16_w),this)); |
105 | 100 | |
106 | | state->m_fatfury2_prot_data = 0; |
| 101 | m_fatfury2_prot_data = 0; |
107 | 102 | |
108 | | state->save_item(NAME(state->m_fatfury2_prot_data)); |
| 103 | save_item(NAME(m_fatfury2_prot_data)); |
109 | 104 | } |
110 | 105 | |
111 | 106 | |
r21155 | r21156 | |
116 | 111 | The board has a ALTERA (EPM7128SQC100-15) chip which is tied to 242-P1 |
117 | 112 | ***************************************************************/ |
118 | 113 | |
119 | | static WRITE16_HANDLER ( kof98_prot_w ) |
| 114 | WRITE16_MEMBER( neogeo_state::kof98_prot_w ) |
120 | 115 | { |
121 | 116 | /* info from razoola */ |
122 | | UINT16* mem16 = (UINT16*)space.machine().root_device().memregion("maincpu")->base(); |
| 117 | UINT16* mem16 = (UINT16*)memregion("maincpu")->base(); |
123 | 118 | |
124 | 119 | switch (data) |
125 | 120 | { |
r21155 | r21156 | |
142 | 137 | } |
143 | 138 | |
144 | 139 | |
145 | | void install_kof98_protection( running_machine &machine ) |
| 140 | void neogeo_state::install_kof98_protection() |
146 | 141 | { |
147 | 142 | /* when 0x20aaaa contains 0x0090 (word) then 0x100 (normally the neogeo header) should return 0x00c200fd worked out using real hw */ |
148 | 143 | |
149 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x20aaaa, 0x20aaab, FUNC(kof98_prot_w)); |
| 144 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20aaaa, 0x20aaab, write16_delegate(FUNC(neogeo_state::kof98_prot_w),this)); |
150 | 145 | } |
151 | 146 | |
152 | 147 | |
r21155 | r21156 | |
156 | 151 | Also found on this special board is a QFP144 labeled with 0103 |
157 | 152 | ***************************************************************/ |
158 | 153 | |
159 | | static WRITE16_HANDLER( mslugx_protection_16_w ) |
| 154 | WRITE16_MEMBER( neogeo_state::mslugx_protection_16_w ) |
160 | 155 | { |
161 | | neogeo_state *state = space.machine().driver_data<neogeo_state>(); |
162 | | |
163 | 156 | switch (offset) |
164 | 157 | { |
165 | 158 | case 0x0/2: // start new read? |
166 | | state->m_mslugx_command = 0; |
| 159 | m_mslugx_command = 0; |
167 | 160 | break; |
168 | 161 | |
169 | 162 | case 0x2/2: // command? These are pulsed with data and then 0 |
170 | 163 | case 0x4/2: |
171 | | state->m_mslugx_command |= data; |
| 164 | m_mslugx_command |= data; |
172 | 165 | break; |
173 | 166 | |
174 | 167 | case 0x6/2: // finished? |
175 | 168 | break; |
176 | 169 | |
177 | 170 | case 0xa/2: // init? |
178 | | state->m_mslugx_counter = 0; |
179 | | state->m_mslugx_command = 0; |
| 171 | m_mslugx_counter = 0; |
| 172 | m_mslugx_command = 0; |
180 | 173 | break; |
181 | 174 | |
182 | 175 | default: |
r21155 | r21156 | |
186 | 179 | } |
187 | 180 | |
188 | 181 | |
189 | | static READ16_HANDLER( mslugx_protection_16_r ) |
| 182 | READ16_MEMBER( neogeo_state::mslugx_protection_16_r ) |
190 | 183 | { |
191 | | neogeo_state *state = space.machine().driver_data<neogeo_state>(); |
192 | | |
193 | 184 | UINT16 res = 0; |
194 | 185 | |
195 | | switch (state->m_mslugx_command) |
| 186 | switch (m_mslugx_command) |
196 | 187 | { |
197 | 188 | case 0x0001: { // $3bdc(?) and $3c30 (Register D7) |
198 | | res = (space.read_byte(0xdedd2 + ((state->m_mslugx_counter >> 3) & 0xfff)) >> (~state->m_mslugx_counter & 0x07)) & 1; |
199 | | state->m_mslugx_counter++; |
| 189 | res = (space.read_byte(0xdedd2 + ((m_mslugx_counter >> 3) & 0xfff)) >> (~m_mslugx_counter & 0x07)) & 1; |
| 190 | m_mslugx_counter++; |
200 | 191 | } |
201 | 192 | break; |
202 | 193 | |
r21155 | r21156 | |
215 | 206 | } |
216 | 207 | |
217 | 208 | |
218 | | void mslugx_install_protection( running_machine &machine ) |
| 209 | void neogeo_state::mslugx_install_protection() |
219 | 210 | { |
220 | | neogeo_state *state = machine.driver_data<neogeo_state>(); |
| 211 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x2fffe0, 0x2fffef, read16_delegate(FUNC(neogeo_state::mslugx_protection_16_r),this), write16_delegate(FUNC(neogeo_state::mslugx_protection_16_w),this)); |
221 | 212 | |
222 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x2fffe0, 0x2fffef, FUNC(mslugx_protection_16_r), FUNC(mslugx_protection_16_w)); |
223 | | |
224 | | state->save_item(NAME(state->m_mslugx_command)); |
225 | | state->save_item(NAME(state->m_mslugx_counter)); |
| 213 | save_item(NAME(m_mslugx_command)); |
| 214 | save_item(NAME(m_mslugx_counter)); |
226 | 215 | } |
227 | 216 | |
228 | 217 | |
r21155 | r21156 | |
230 | 219 | thanks to Razoola |
231 | 220 | ***************************************************************/ |
232 | 221 | |
233 | | static WRITE16_HANDLER( kof99_bankswitch_w ) |
| 222 | WRITE16_MEMBER( neogeo_state::kof99_bankswitch_w ) |
234 | 223 | { |
235 | 224 | int bankaddress; |
236 | 225 | static const int bankoffset[64] = |
r21155 | r21156 | |
257 | 246 | |
258 | 247 | bankaddress = 0x100000 + bankoffset[data]; |
259 | 248 | |
260 | | space.machine().driver_data<neogeo_state>()->neogeo_set_main_cpu_bank_address(bankaddress); |
| 249 | neogeo_set_main_cpu_bank_address(bankaddress); |
261 | 250 | } |
262 | 251 | |
263 | 252 | |
264 | | static WRITE16_HANDLER( garou_bankswitch_w ) |
| 253 | WRITE16_MEMBER( neogeo_state::garou_bankswitch_w ) |
265 | 254 | { |
266 | 255 | /* thanks to Razoola and Mr K for the info */ |
267 | 256 | int bankaddress; |
r21155 | r21156 | |
294 | 283 | |
295 | 284 | bankaddress = 0x100000 + bankoffset[data]; |
296 | 285 | |
297 | | space.machine().driver_data<neogeo_state>()->neogeo_set_main_cpu_bank_address(bankaddress); |
| 286 | neogeo_set_main_cpu_bank_address(bankaddress); |
298 | 287 | } |
299 | 288 | |
300 | 289 | |
301 | | static WRITE16_HANDLER( garouh_bankswitch_w ) |
| 290 | WRITE16_MEMBER( neogeo_state::garouh_bankswitch_w ) |
302 | 291 | { |
303 | 292 | /* thanks to Razoola and Mr K for the info */ |
304 | 293 | int bankaddress; |
r21155 | r21156 | |
333 | 322 | |
334 | 323 | bankaddress = 0x100000 + bankoffset[data]; |
335 | 324 | |
336 | | space.machine().driver_data<neogeo_state>()->neogeo_set_main_cpu_bank_address(bankaddress); |
| 325 | neogeo_set_main_cpu_bank_address(bankaddress); |
337 | 326 | } |
338 | 327 | |
339 | 328 | |
340 | | static WRITE16_HANDLER( mslug3_bankswitch_w ) |
| 329 | WRITE16_MEMBER( neogeo_state::mslug3_bankswitch_w ) |
341 | 330 | { |
342 | 331 | /* thanks to Razoola and Mr K for the info */ |
343 | 332 | int bankaddress; |
r21155 | r21156 | |
369 | 358 | |
370 | 359 | bankaddress = 0x100000 + bankoffset[data]; |
371 | 360 | |
372 | | space.machine().driver_data<neogeo_state>()->neogeo_set_main_cpu_bank_address(bankaddress); |
| 361 | neogeo_set_main_cpu_bank_address(bankaddress); |
373 | 362 | } |
374 | 363 | |
375 | 364 | |
376 | | static WRITE16_HANDLER( kof2000_bankswitch_w ) |
| 365 | WRITE16_MEMBER( neogeo_state::kof2000_bankswitch_w ) |
377 | 366 | { |
378 | 367 | /* thanks to Razoola and Mr K for the info */ |
379 | 368 | int bankaddress; |
r21155 | r21156 | |
401 | 390 | |
402 | 391 | bankaddress = 0x100000 + bankoffset[data]; |
403 | 392 | |
404 | | space.machine().driver_data<neogeo_state>()->neogeo_set_main_cpu_bank_address(bankaddress); |
| 393 | neogeo_set_main_cpu_bank_address(bankaddress); |
405 | 394 | } |
406 | 395 | |
407 | 396 | |
408 | | static READ16_HANDLER( prot_9a37_r ) |
| 397 | READ16_MEMBER( neogeo_state::prot_9a37_r ) |
409 | 398 | { |
410 | 399 | return 0x9a37; |
411 | 400 | } |
r21155 | r21156 | |
414 | 403 | /* information about the sma random number generator provided by razoola */ |
415 | 404 | /* this RNG is correct for KOF99, other games might be different */ |
416 | 405 | |
417 | | static READ16_HANDLER( sma_random_r ) |
| 406 | READ16_MEMBER( neogeo_state::sma_random_r ) |
418 | 407 | { |
419 | | neogeo_state *state = space.machine().driver_data<neogeo_state>(); |
420 | | UINT16 old = state->m_neogeo_rng; |
| 408 | UINT16 old = m_neogeo_rng; |
421 | 409 | |
422 | | UINT16 newbit = ((state->m_neogeo_rng >> 2) ^ |
423 | | (state->m_neogeo_rng >> 3) ^ |
424 | | (state->m_neogeo_rng >> 5) ^ |
425 | | (state->m_neogeo_rng >> 6) ^ |
426 | | (state->m_neogeo_rng >> 7) ^ |
427 | | (state->m_neogeo_rng >>11) ^ |
428 | | (state->m_neogeo_rng >>12) ^ |
429 | | (state->m_neogeo_rng >>15)) & 1; |
| 410 | UINT16 newbit = ((m_neogeo_rng >> 2) ^ |
| 411 | (m_neogeo_rng >> 3) ^ |
| 412 | (m_neogeo_rng >> 5) ^ |
| 413 | (m_neogeo_rng >> 6) ^ |
| 414 | (m_neogeo_rng >> 7) ^ |
| 415 | (m_neogeo_rng >>11) ^ |
| 416 | (m_neogeo_rng >>12) ^ |
| 417 | (m_neogeo_rng >>15)) & 1; |
430 | 418 | |
431 | | state->m_neogeo_rng = (state->m_neogeo_rng << 1) | newbit; |
| 419 | m_neogeo_rng = (m_neogeo_rng << 1) | newbit; |
432 | 420 | |
433 | 421 | return old; |
434 | 422 | } |
435 | 423 | |
436 | 424 | |
437 | | void neogeo_reset_rng( running_machine &machine ) |
| 425 | void neogeo_state::neogeo_reset_rng() |
438 | 426 | { |
439 | | neogeo_state *state = machine.driver_data<neogeo_state>(); |
440 | | state->m_neogeo_rng = 0x2345; |
| 427 | m_neogeo_rng = 0x2345; |
441 | 428 | } |
442 | 429 | |
443 | 430 | |
444 | | static void sma_install_random_read_handler( running_machine &machine, int addr1, int addr2 ) |
| 431 | void neogeo_state::sma_install_random_read_handler(int addr1, int addr2 ) |
445 | 432 | { |
446 | | neogeo_state *state = machine.driver_data<neogeo_state>(); |
447 | | state->save_item(NAME(state->m_neogeo_rng)); |
| 433 | save_item(NAME(m_neogeo_rng)); |
448 | 434 | |
449 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(addr1, addr1 + 1, FUNC(sma_random_r)); |
450 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(addr2, addr2 + 1, FUNC(sma_random_r)); |
| 435 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(addr1, addr1 + 1, read16_delegate(FUNC(neogeo_state::sma_random_r),this)); |
| 436 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(addr2, addr2 + 1, read16_delegate(FUNC(neogeo_state::sma_random_r),this)); |
451 | 437 | } |
452 | 438 | |
453 | 439 | |
454 | | void kof99_install_protection( running_machine &machine ) |
| 440 | void neogeo_state::kof99_install_protection() |
455 | 441 | { |
456 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x2ffff0, 0x2ffff1, FUNC(kof99_bankswitch_w)); |
457 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x2fe446, 0x2fe447, FUNC(prot_9a37_r)); |
| 442 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x2ffff0, 0x2ffff1, write16_delegate(FUNC(neogeo_state::kof99_bankswitch_w),this)); |
| 443 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x2fe446, 0x2fe447, read16_delegate(FUNC(neogeo_state::prot_9a37_r),this)); |
458 | 444 | |
459 | | sma_install_random_read_handler(machine, 0x2ffff8, 0x2ffffa); |
| 445 | sma_install_random_read_handler(0x2ffff8, 0x2ffffa); |
460 | 446 | } |
461 | 447 | |
462 | 448 | |
463 | | void garou_install_protection( running_machine &machine ) |
| 449 | void neogeo_state::garou_install_protection() |
464 | 450 | { |
465 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x2fffc0, 0x2fffc1, FUNC(garou_bankswitch_w)); |
466 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x2fe446, 0x2fe447, FUNC(prot_9a37_r)); |
| 451 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x2fffc0, 0x2fffc1, write16_delegate(FUNC(neogeo_state::garou_bankswitch_w),this)); |
| 452 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x2fe446, 0x2fe447, read16_delegate(FUNC(neogeo_state::prot_9a37_r),this)); |
467 | 453 | |
468 | | sma_install_random_read_handler(machine, 0x2fffcc, 0x2ffff0); |
| 454 | sma_install_random_read_handler(0x2fffcc, 0x2ffff0); |
469 | 455 | } |
470 | 456 | |
471 | 457 | |
472 | | void garouh_install_protection( running_machine &machine ) |
| 458 | void neogeo_state::garouh_install_protection() |
473 | 459 | { |
474 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x2fffc0, 0x2fffc1, FUNC(garouh_bankswitch_w)); |
475 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x2fe446, 0x2fe447, FUNC(prot_9a37_r)); |
| 460 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x2fffc0, 0x2fffc1, write16_delegate(FUNC(neogeo_state::garouh_bankswitch_w),this)); |
| 461 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x2fe446, 0x2fe447, read16_delegate(FUNC(neogeo_state::prot_9a37_r),this)); |
476 | 462 | |
477 | | sma_install_random_read_handler(machine, 0x2fffcc, 0x2ffff0); |
| 463 | sma_install_random_read_handler(0x2fffcc, 0x2ffff0); |
478 | 464 | } |
479 | 465 | |
480 | 466 | |
481 | | void mslug3_install_protection( running_machine &machine ) |
| 467 | void neogeo_state::mslug3_install_protection() |
482 | 468 | { |
483 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x2fffe4, 0x2fffe5, FUNC(mslug3_bankswitch_w)); |
484 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x2fe446, 0x2fe447, FUNC(prot_9a37_r)); |
| 469 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x2fffe4, 0x2fffe5, write16_delegate(FUNC(neogeo_state::mslug3_bankswitch_w),this)); |
| 470 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x2fe446, 0x2fe447, read16_delegate(FUNC(neogeo_state::prot_9a37_r),this)); |
485 | 471 | |
486 | | // sma_install_random_read_handler(machine, 0x2ffff8, 0x2ffffa); |
| 472 | // sma_install_random_read_handler(0x2ffff8, 0x2ffffa); |
487 | 473 | } |
488 | 474 | |
489 | 475 | |
490 | | void kof2000_install_protection( running_machine &machine ) |
| 476 | void neogeo_state::kof2000_install_protection() |
491 | 477 | { |
492 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x2fffec, 0x2fffed, FUNC(kof2000_bankswitch_w)); |
493 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x2fe446, 0x2fe447, FUNC(prot_9a37_r)); |
| 478 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x2fffec, 0x2fffed, write16_delegate(FUNC(neogeo_state::kof2000_bankswitch_w),this)); |
| 479 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x2fe446, 0x2fe447, read16_delegate(FUNC(neogeo_state::prot_9a37_r),this)); |
494 | 480 | |
495 | | sma_install_random_read_handler(machine, 0x2fffd8, 0x2fffda); |
| 481 | sma_install_random_read_handler(0x2fffd8, 0x2fffda); |
496 | 482 | } |
497 | 483 | |
498 | 484 | |
r21155 | r21156 | |
501 | 487 | mslug5, svcchaos, kof2003 |
502 | 488 | ***************************************************************/ |
503 | 489 | |
504 | | static void pvc_w8( running_machine &machine, offs_t offset, UINT8 data ) |
| 490 | void neogeo_state::pvc_w8(offs_t offset, UINT8 data ) |
505 | 491 | { |
506 | | neogeo_state *state = machine.driver_data<neogeo_state>(); |
507 | | *(((UINT8*)state->m_pvc_cartridge_ram) + BYTE_XOR_LE(offset)) = data; |
| 492 | *(((UINT8*)m_pvc_cartridge_ram) + BYTE_XOR_LE(offset)) = data; |
508 | 493 | } |
509 | 494 | |
510 | 495 | |
511 | | static UINT8 pvc_r8( running_machine &machine, offs_t offset ) |
| 496 | UINT8 neogeo_state::pvc_r8(offs_t offset ) |
512 | 497 | { |
513 | | neogeo_state *state = machine.driver_data<neogeo_state>(); |
514 | | return *(((UINT8*)state->m_pvc_cartridge_ram) + BYTE_XOR_LE(offset)); |
| 498 | return *(((UINT8*)m_pvc_cartridge_ram) + BYTE_XOR_LE(offset)); |
515 | 499 | } |
516 | 500 | |
517 | 501 | |
518 | | static void pvc_prot1( running_machine &machine ) |
| 502 | void neogeo_state::pvc_prot1() |
519 | 503 | { |
520 | 504 | UINT8 b1, b2; |
521 | 505 | |
522 | | b1 = pvc_r8(machine, 0x1fe1); |
523 | | b2 = pvc_r8(machine, 0x1fe0); |
524 | | pvc_w8(machine, 0x1fe2, (((b2 >> 0) & 0xf) << 1) | ((b1 >> 4) & 1)); |
525 | | pvc_w8(machine, 0x1fe3, (((b2 >> 4) & 0xf) << 1) | ((b1 >> 5) & 1)); |
526 | | pvc_w8(machine, 0x1fe4, (((b1 >> 0) & 0xf) << 1) | ((b1 >> 6) & 1)); |
527 | | pvc_w8(machine, 0x1fe5, (b1 >> 7)); |
| 506 | b1 = pvc_r8(0x1fe1); |
| 507 | b2 = pvc_r8(0x1fe0); |
| 508 | pvc_w8(0x1fe2, (((b2 >> 0) & 0xf) << 1) | ((b1 >> 4) & 1)); |
| 509 | pvc_w8(0x1fe3, (((b2 >> 4) & 0xf) << 1) | ((b1 >> 5) & 1)); |
| 510 | pvc_w8(0x1fe4, (((b1 >> 0) & 0xf) << 1) | ((b1 >> 6) & 1)); |
| 511 | pvc_w8(0x1fe5, (b1 >> 7)); |
528 | 512 | } |
529 | 513 | |
530 | 514 | |
531 | | static void pvc_prot2( running_machine &machine ) // on writes to e8/e9/ea/eb |
| 515 | void neogeo_state::pvc_prot2() // on writes to e8/e9/ea/eb |
532 | 516 | { |
533 | 517 | UINT8 b1, b2, b3, b4; |
534 | 518 | |
535 | | b1 = pvc_r8(machine, 0x1fe9); |
536 | | b2 = pvc_r8(machine, 0x1fe8); |
537 | | b3 = pvc_r8(machine, 0x1feb); |
538 | | b4 = pvc_r8(machine, 0x1fea); |
539 | | pvc_w8(machine, 0x1fec, (b2 >> 1) | ((b1 >> 1) << 4)); |
540 | | pvc_w8(machine, 0x1fed, (b4 >> 1) | ((b2 & 1) << 4) | ((b1 & 1) << 5) | ((b4 & 1) << 6) | ((b3 & 1) << 7)); |
| 519 | b1 = pvc_r8(0x1fe9); |
| 520 | b2 = pvc_r8(0x1fe8); |
| 521 | b3 = pvc_r8(0x1feb); |
| 522 | b4 = pvc_r8(0x1fea); |
| 523 | pvc_w8(0x1fec, (b2 >> 1) | ((b1 >> 1) << 4)); |
| 524 | pvc_w8(0x1fed, (b4 >> 1) | ((b2 & 1) << 4) | ((b1 & 1) << 5) | ((b4 & 1) << 6) | ((b3 & 1) << 7)); |
541 | 525 | } |
542 | 526 | |
543 | 527 | |
544 | | static void pvc_write_bankswitch( address_space &space ) |
| 528 | void neogeo_state::pvc_write_bankswitch( address_space &space ) |
545 | 529 | { |
546 | | neogeo_state *state = space.machine().driver_data<neogeo_state>(); |
547 | 530 | UINT32 bankaddress; |
548 | 531 | |
549 | | bankaddress = ((state->m_pvc_cartridge_ram[0xff8] >> 8)|(state->m_pvc_cartridge_ram[0xff9] << 8)); |
550 | | *(((UINT8 *)state->m_pvc_cartridge_ram) + BYTE_XOR_LE(0x1ff0)) = 0xa0; |
551 | | *(((UINT8 *)state->m_pvc_cartridge_ram) + BYTE_XOR_LE(0x1ff1)) &= 0xfe; |
552 | | *(((UINT8 *)state->m_pvc_cartridge_ram) + BYTE_XOR_LE(0x1ff3)) &= 0x7f; |
553 | | state->neogeo_set_main_cpu_bank_address(bankaddress + 0x100000); |
| 532 | bankaddress = ((m_pvc_cartridge_ram[0xff8] >> 8)|(m_pvc_cartridge_ram[0xff9] << 8)); |
| 533 | *(((UINT8 *)m_pvc_cartridge_ram) + BYTE_XOR_LE(0x1ff0)) = 0xa0; |
| 534 | *(((UINT8 *)m_pvc_cartridge_ram) + BYTE_XOR_LE(0x1ff1)) &= 0xfe; |
| 535 | *(((UINT8 *)m_pvc_cartridge_ram) + BYTE_XOR_LE(0x1ff3)) &= 0x7f; |
| 536 | neogeo_set_main_cpu_bank_address(bankaddress + 0x100000); |
554 | 537 | } |
555 | 538 | |
556 | 539 | |
557 | | static READ16_HANDLER( pvc_prot_r ) |
| 540 | READ16_MEMBER( neogeo_state::pvc_prot_r ) |
558 | 541 | { |
559 | | neogeo_state *state = space.machine().driver_data<neogeo_state>(); |
560 | | return state->m_pvc_cartridge_ram[offset]; |
| 542 | return m_pvc_cartridge_ram[offset]; |
561 | 543 | } |
562 | 544 | |
563 | 545 | |
564 | | static WRITE16_HANDLER( pvc_prot_w ) |
| 546 | WRITE16_MEMBER( neogeo_state::pvc_prot_w ) |
565 | 547 | { |
566 | | neogeo_state *state = space.machine().driver_data<neogeo_state>(); |
567 | | |
568 | | COMBINE_DATA(&state->m_pvc_cartridge_ram[offset] ); |
| 548 | COMBINE_DATA(&m_pvc_cartridge_ram[offset] ); |
569 | 549 | if (offset == 0xff0) |
570 | | pvc_prot1(space.machine()); |
| 550 | pvc_prot1(); |
571 | 551 | else if(offset >= 0xff4 && offset <= 0xff5) |
572 | | pvc_prot2(space.machine()); |
| 552 | pvc_prot2(); |
573 | 553 | else if(offset >= 0xff8) |
574 | 554 | pvc_write_bankswitch(space); |
575 | 555 | } |
576 | 556 | |
577 | 557 | |
578 | | void install_pvc_protection( running_machine &machine ) |
| 558 | void neogeo_state::install_pvc_protection() |
579 | 559 | { |
580 | | neogeo_state *state = machine.driver_data<neogeo_state>(); |
581 | | state->m_pvc_cartridge_ram = auto_alloc_array(machine, UINT16, 0x2000 / 2); |
582 | | state->save_pointer(NAME(state->m_pvc_cartridge_ram), 0x2000 / 2); |
| 560 | m_pvc_cartridge_ram = auto_alloc_array(machine(), UINT16, 0x2000 / 2); |
| 561 | save_pointer(NAME(m_pvc_cartridge_ram), 0x2000 / 2); |
583 | 562 | |
584 | | machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x2fe000, 0x2fffff, FUNC(pvc_prot_r), FUNC(pvc_prot_w)); |
| 563 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x2fe000, 0x2fffff, read16_delegate(FUNC(neogeo_state::pvc_prot_r),this), write16_delegate(FUNC(neogeo_state::pvc_prot_w),this)); |
585 | 564 | } |
trunk/src/mame/includes/neogeo.h
r21155 | r21156 | |
263 | 263 | |
264 | 264 | void neogeo_set_main_cpu_bank_address( UINT32 bank_address ); |
265 | 265 | |
| 266 | // protection data |
| 267 | UINT16 kof2003_tbl[4096]; |
| 268 | UINT16 kof10thExtraRAMB[0x01000]; |
| 269 | const UINT8 *type0_t03; |
| 270 | const UINT8 *type0_t12; |
| 271 | const UINT8 *type1_t03; |
| 272 | const UINT8 *type1_t12; |
| 273 | const UINT8 *address_8_15_xor1; |
| 274 | const UINT8 *address_8_15_xor2; |
| 275 | const UINT8 *address_16_23_xor1; |
| 276 | const UINT8 *address_16_23_xor2; |
| 277 | const UINT8 *address_0_7_xor; |
| 278 | |
266 | 279 | protected: |
267 | 280 | required_memory_region m_region_maincpu; |
268 | 281 | required_memory_region m_region_sprites; |
r21155 | r21156 | |
319 | 332 | void set_outputs( ); |
320 | 333 | void set_output_latch( UINT8 data ); |
321 | 334 | void set_output_data( UINT8 data ); |
| 335 | TIMER_CALLBACK_MEMBER( ms5pcb_bios_timer_callback ); |
| 336 | TIMER_CALLBACK_MEMBER( svcpcb_bios_timer_callback ); |
| 337 | |
| 338 | // protections implementation |
| 339 | DECLARE_READ16_MEMBER( sbp_lowerrom_r ); |
| 340 | DECLARE_WRITE16_MEMBER( sbp_lowerrom_w ); |
| 341 | DECLARE_READ16_MEMBER( fatfury2_protection_16_r ); |
| 342 | DECLARE_WRITE16_MEMBER( fatfury2_protection_16_w ); |
| 343 | void fatfury2_install_protection(); |
| 344 | DECLARE_WRITE16_MEMBER ( kof98_prot_w ); |
| 345 | void install_kof98_protection(); |
| 346 | DECLARE_WRITE16_MEMBER( mslugx_protection_16_w ); |
| 347 | DECLARE_READ16_MEMBER( mslugx_protection_16_r ); |
| 348 | void mslugx_install_protection(); |
| 349 | DECLARE_WRITE16_MEMBER( kof99_bankswitch_w ); |
| 350 | DECLARE_WRITE16_MEMBER( garou_bankswitch_w ); |
| 351 | DECLARE_WRITE16_MEMBER( garouh_bankswitch_w ); |
| 352 | DECLARE_WRITE16_MEMBER( mslug3_bankswitch_w ); |
| 353 | DECLARE_WRITE16_MEMBER( kof2000_bankswitch_w ); |
| 354 | DECLARE_READ16_MEMBER( prot_9a37_r ); |
| 355 | DECLARE_READ16_MEMBER( sma_random_r ); |
| 356 | void neogeo_reset_rng(); |
| 357 | void sma_install_random_read_handler( int addr1, int addr2 ); |
| 358 | void kof99_install_protection(); |
| 359 | void garou_install_protection(); |
| 360 | void garouh_install_protection(); |
| 361 | void mslug3_install_protection(); |
| 362 | void kof2000_install_protection(); |
| 363 | void pvc_w8( offs_t offset, UINT8 data ); |
| 364 | UINT8 pvc_r8( offs_t offset ); |
| 365 | void pvc_prot1(); |
| 366 | void pvc_prot2(); // on writes to e8/e9/ea/eb |
| 367 | void pvc_write_bankswitch( address_space &space ); |
| 368 | DECLARE_READ16_MEMBER( pvc_prot_r ); |
| 369 | DECLARE_WRITE16_MEMBER( pvc_prot_w ); |
| 370 | void install_pvc_protection(); |
| 371 | void neogeo_bootleg_cx_decrypt(); |
| 372 | void neogeo_bootleg_sx_decrypt(int value ); |
| 373 | void kog_px_decrypt(); |
| 374 | void kof97oro_px_decode(); |
| 375 | void kof10thBankswitch(address_space &space, UINT16 nBank); |
| 376 | DECLARE_READ16_MEMBER( kof10th_RAMB_r ); |
| 377 | DECLARE_WRITE16_MEMBER( kof10th_custom_w ); |
| 378 | DECLARE_WRITE16_MEMBER( kof10th_bankswitch_w ); |
| 379 | void install_kof10th_protection (); |
| 380 | void decrypt_kof10th(); |
| 381 | void decrypt_kf10thep(); |
| 382 | void kf2k5uni_px_decrypt(); |
| 383 | void kf2k5uni_sx_decrypt(); |
| 384 | void kf2k5uni_mx_decrypt(); |
| 385 | void decrypt_kf2k5uni(); |
| 386 | void kof2002b_gfx_decrypt(UINT8 *src, int size); |
| 387 | void kf2k2mp_decrypt(); |
| 388 | void kf2k2mp2_px_decrypt(); |
| 389 | void cthd2003_neogeo_gfx_address_fix_do(int start, int end, int bit3shift, int bit2shift, int bit1shift, int bit0shift); |
| 390 | void cthd2003_neogeo_gfx_address_fix(int start, int end); |
| 391 | void cthd2003_c(int pow); |
| 392 | void decrypt_cthd2003(); |
| 393 | DECLARE_WRITE16_MEMBER ( cthd2003_bankswitch_w ); |
| 394 | void patch_cthd2003(); |
| 395 | void ct2k3sp_sx_decrypt(); |
| 396 | void decrypt_ct2k3sp(); |
| 397 | void decrypt_ct2k3sa(); |
| 398 | void patch_ct2k3sa(); |
| 399 | void decrypt_kof2k4se_68k(); |
| 400 | void lans2004_vx_decrypt(); |
| 401 | void lans2004_decrypt_68k(); |
| 402 | DECLARE_READ16_MEMBER( mslug5_prot_r ); |
| 403 | DECLARE_WRITE16_MEMBER ( ms5plus_bankswitch_w ); |
| 404 | void install_ms5plus_protection(); |
| 405 | void svcboot_px_decrypt(); |
| 406 | void svcboot_cx_decrypt(); |
| 407 | void svcplus_px_decrypt(); |
| 408 | void svcplus_px_hack(); |
| 409 | void svcplusa_px_decrypt(); |
| 410 | void svcsplus_px_decrypt(); |
| 411 | void svcsplus_px_hack(); |
| 412 | DECLARE_READ16_MEMBER( kof2003_r); |
| 413 | DECLARE_WRITE16_MEMBER( kof2003_w ); |
| 414 | DECLARE_WRITE16_MEMBER( kof2003p_w ); |
| 415 | void kf2k3bl_px_decrypt(); |
| 416 | void kf2k3bl_install_protection(); |
| 417 | void kf2k3pl_px_decrypt(); |
| 418 | void kf2k3pl_install_protection(); |
| 419 | void kf2k3upl_px_decrypt(); |
| 420 | void kf2k3upl_install_protection(); |
| 421 | void samsho5b_px_decrypt(); |
| 422 | void samsho5b_vx_decrypt(); |
| 423 | void matrimbl_decrypt(); |
| 424 | void decrypt(UINT8 *r0, UINT8 *r1,UINT8 c0, UINT8 c1,const UINT8 *table0hi,const UINT8 *table0lo,const UINT8 *table1,int base,int invert); |
| 425 | void neogeo_gfx_decrypt(int extra_xor); |
| 426 | void neogeo_sfix_decrypt(); |
| 427 | void kof99_neogeo_gfx_decrypt(int extra_xor); |
| 428 | void kof2000_neogeo_gfx_decrypt(int extra_xor); |
| 429 | void cmc42_neogeo_gfx_decrypt(int extra_xor); |
| 430 | void cmc50_neogeo_gfx_decrypt(int extra_xor); |
| 431 | void svcpcb_gfx_decrypt(); |
| 432 | void svcpcb_s1data_decrypt(); |
| 433 | void kf2k3pcb_gfx_decrypt(); |
| 434 | void kf2k3pcb_decrypt_s1data(); |
| 435 | UINT16 generate_cs16(UINT8 *rom, int size); |
| 436 | int m1_address_scramble(int address, UINT16 key); |
| 437 | void neogeo_cmc50_m1_decrypt(); |
| 438 | void kof98_decrypt_68k(); |
| 439 | void kof99_decrypt_68k(); |
| 440 | void garou_decrypt_68k(); |
| 441 | void garouh_decrypt_68k(); |
| 442 | void mslug3_decrypt_68k(); |
| 443 | void kof2000_decrypt_68k(); |
| 444 | void kof2002_decrypt_68k(); |
| 445 | void matrim_decrypt_68k(); |
| 446 | void samsho5_decrypt_68k(); |
| 447 | void samsh5sp_decrypt_68k(); |
| 448 | void mslug5_decrypt_68k(); |
| 449 | void svc_px_decrypt(); |
| 450 | void kf2k3pcb_decrypt_68k(); |
| 451 | void kof2003_decrypt_68k(); |
| 452 | void kof2003h_decrypt_68k(); |
| 453 | void neo_pcm2_snk_1999(int value); |
| 454 | void neo_pcm2_swap(int value); |
| 455 | void kof2003biosdecode(); |
322 | 456 | }; |
323 | 457 | |
324 | 458 | |
325 | 459 | /*----------- defined in drivers/neogeo.c -----------*/ |
326 | 460 | |
327 | 461 | MACHINE_CONFIG_EXTERN( neogeo_base ); |
328 | | |
329 | | /*----------- defined in machine/neocrypt.c -----------*/ |
330 | | |
331 | | void kof99_neogeo_gfx_decrypt(running_machine &machine, int extra_xor); |
332 | | void kof2000_neogeo_gfx_decrypt(running_machine &machine, int extra_xor); |
333 | | void cmc42_neogeo_gfx_decrypt(running_machine &machine, int extra_xor); |
334 | | void cmc50_neogeo_gfx_decrypt(running_machine &machine, int extra_xor); |
335 | | void neogeo_cmc50_m1_decrypt(running_machine &machine); |
336 | | void neo_pcm2_snk_1999(running_machine &machine, int value); |
337 | | void neo_pcm2_swap(running_machine &machine, int value); |
338 | | void neogeo_sfix_decrypt(running_machine &machine); |
339 | | void kof99_decrypt_68k(running_machine &machine); |
340 | | void garou_decrypt_68k(running_machine &machine); |
341 | | void garouh_decrypt_68k(running_machine &machine); |
342 | | void mslug3_decrypt_68k(running_machine &machine); |
343 | | void kof2000_decrypt_68k(running_machine &machine); |
344 | | void kof98_decrypt_68k(running_machine &machine); |
345 | | void kof2002_decrypt_68k(running_machine &machine); |
346 | | void matrim_decrypt_68k(running_machine &machine); |
347 | | void mslug5_decrypt_68k(running_machine &machine); |
348 | | void svc_px_decrypt(running_machine &machine); |
349 | | void svcpcb_gfx_decrypt(running_machine &machine); |
350 | | void svcpcb_s1data_decrypt(running_machine &machine); |
351 | | void samsho5_decrypt_68k(running_machine &machine); |
352 | | void kf2k3pcb_gfx_decrypt(running_machine &machine); |
353 | | void kf2k3pcb_decrypt_68k(running_machine &machine); |
354 | | void kf2k3pcb_decrypt_s1data(running_machine &machine); |
355 | | void kof2003_decrypt_68k(running_machine &machine); |
356 | | void kof2003h_decrypt_68k(running_machine &machine); |
357 | | void kof2003biosdecode(running_machine &machine); |
358 | | void samsh5sp_decrypt_68k(running_machine &machine); |
359 | | |
360 | | |
361 | | /*----------- defined in machine/neoprot.c -----------*/ |
362 | | |
363 | | void neogeo_reset_rng(running_machine &machine); |
364 | | void fatfury2_install_protection(running_machine &machine); |
365 | | void mslugx_install_protection(running_machine &machine); |
366 | | void kof99_install_protection(running_machine &machine); |
367 | | void garou_install_protection(running_machine &machine); |
368 | | void garouh_install_protection(running_machine &machine); |
369 | | void mslug3_install_protection(running_machine &machine); |
370 | | void kof2000_install_protection(running_machine &machine); |
371 | | void install_kof98_protection(running_machine &machine); |
372 | | void install_pvc_protection(running_machine &machine); |
373 | | |
374 | | |
375 | | /*----------- defined in machine/neoboot.c -----------*/ |
376 | | |
377 | | void kog_px_decrypt(running_machine &machine); |
378 | | void kof97oro_px_decode( running_machine &machine ); |
379 | | void neogeo_bootleg_cx_decrypt(running_machine &machine); |
380 | | void install_kof10th_protection(running_machine &machine); |
381 | | void decrypt_kof10th(running_machine &machine); |
382 | | void decrypt_kf10thep(running_machine &machine); |
383 | | void decrypt_kf2k5uni(running_machine &machine); |
384 | | void neogeo_bootleg_sx_decrypt(running_machine &machine, int value); |
385 | | void kof2002b_gfx_decrypt(running_machine &machine, UINT8 *src, int size); |
386 | | void kf2k2mp_decrypt(running_machine &machine); |
387 | | void kf2k2mp2_px_decrypt(running_machine &machine); |
388 | | void decrypt_cthd2003(running_machine &machine); |
389 | | void patch_cthd2003(running_machine &machine); |
390 | | void decrypt_ct2k3sp(running_machine &machine); |
391 | | void decrypt_ct2k3sa(running_machine &machine); |
392 | | void patch_ct2k3sa(running_machine &machine); |
393 | | void decrypt_kof2k4se_68k(running_machine &machine); |
394 | | void lans2004_decrypt_68k(running_machine &machine); |
395 | | void lans2004_vx_decrypt(running_machine &machine); |
396 | | void install_ms5plus_protection(running_machine &machine); |
397 | | void svcboot_px_decrypt(running_machine &machine); |
398 | | void svcboot_cx_decrypt(running_machine &machine); |
399 | | void svcplus_px_decrypt(running_machine &machine); |
400 | | void svcplus_px_hack(running_machine &machine); |
401 | | void svcplusa_px_decrypt(running_machine &machine); |
402 | | void svcsplus_px_decrypt(running_machine &machine); |
403 | | void svcsplus_px_hack(running_machine &machine); |
404 | | void kf2k3bl_px_decrypt(running_machine &machine); |
405 | | void kf2k3bl_install_protection(running_machine &machine); |
406 | | void kf2k3pl_px_decrypt(running_machine &machine); |
407 | | void kf2k3upl_px_decrypt(running_machine &machine); |
408 | | void kf2k3upl_install_protection(running_machine &machine); |
409 | | void kf2k3pl_install_protection(running_machine &machine); |
410 | | void samsho5b_px_decrypt(running_machine &machine); |
411 | | void samsho5b_vx_decrypt(running_machine &machine); |
412 | | void matrimbl_decrypt(running_machine &machine); |
413 | | |