trunk/src/mess/drivers/pegasus.c
| r32376 | r32377 | |
| 94 | 94 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 95 | 95 | DECLARE_DRIVER_INIT(pegasus); |
| 96 | 96 | TIMER_DEVICE_CALLBACK_MEMBER(pegasus_firq); |
| 97 | | void pegasus_decrypt_rom(UINT8 *ROM); |
| 97 | void pegasus_decrypt_rom(UINT8 *ROM, bool force_decrypt); |
| 98 | 98 | |
| 99 | 99 | int load_cart(device_image_interface &image, generic_slot_device *slot, const char *reg_tag); |
| 100 | 100 | DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp00_load) { return load_cart(image, m_exp_00, "0000"); } |
| r32376 | r32377 | |
| 389 | 389 | |
| 390 | 390 | /* An encrypted single rom starts with 02, decrypted with 20. Not sure what |
| 391 | 391 | multipart roms will have. */ |
| 392 | | void pegasus_state::pegasus_decrypt_rom(UINT8 *ROM) |
| 392 | void pegasus_state::pegasus_decrypt_rom(UINT8 *ROM, bool force_decrypt) |
| 393 | 393 | { |
| 394 | 394 | UINT8 b; |
| 395 | 395 | UINT16 j; |
| 396 | 396 | dynamic_buffer temp_copy; |
| 397 | 397 | temp_copy.resize(0x1000); |
| 398 | 398 | |
| 399 | | if (ROM[0] == 0x02) |
| 399 | if (ROM[0] == 0x02 || force_decrypt) |
| 400 | 400 | { |
| 401 | 401 | for (int i = 0; i < 0x1000; i++) |
| 402 | 402 | { |
| r32376 | r32377 | |
| 424 | 424 | { |
| 425 | 425 | // we might be loading a cart compatible with all sockets! |
| 426 | 426 | // so try to get region "rom" |
| 427 | | printf("universal\n"); |
| 428 | 427 | size = slot->common_get_size("rom"); |
| 429 | 428 | any_socket = true; |
| 430 | 429 | |
| r32376 | r32377 | |
| 440 | 439 | slot->rom_alloc(0x1000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); // we alloc 0x1000 also for smaller roms! |
| 441 | 440 | slot->common_load_rom(slot->get_rom_base(), size, any_socket ? "rom" : reg_tag); |
| 442 | 441 | |
| 443 | | // raw images have to be decrypted |
| 444 | | pegasus_decrypt_rom(slot->get_rom_base()); |
| 442 | // raw images have to be decrypted (in particular the ones from softlist) |
| 443 | pegasus_decrypt_rom(slot->get_rom_base(), image.software_entry() != NULL); |
| 445 | 444 | |
| 446 | 445 | return IMAGE_INIT_PASS; |
| 447 | 446 | } |
| r32376 | r32377 | |
| 473 | 472 | { |
| 474 | 473 | // decrypt monitor |
| 475 | 474 | UINT8 *base = memregion("maincpu")->base() + 0xf000; |
| 476 | | pegasus_decrypt_rom(base); |
| 475 | pegasus_decrypt_rom(base, FALSE); |
| 477 | 476 | } |
| 478 | 477 | |
| 479 | 478 | static MACHINE_CONFIG_START( pegasus, pegasus_state ) |