mirror of
https://github.com/mamedev/mame.git
synced 2024-11-18 10:06:19 +01:00
pacman protection modernization (nw)
This commit is contained in:
parent
f12da35ce6
commit
3bdc0ee891
6 changed files with 80 additions and 72 deletions
|
@ -1357,12 +1357,12 @@ static ADDRESS_MAP_START( nmouse_portmap, AS_IO, 8, pacman_state )
|
|||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( theglobp_portmap, AS_IO, 8, pacman_state )
|
||||
AM_RANGE(0x00, 0xff) AM_READ_LEGACY(theglobp_decrypt_rom) /* Switch protection logic */
|
||||
AM_RANGE(0x00, 0xff) AM_READ(theglobp_decrypt_rom) /* Switch protection logic */
|
||||
AM_IMPORT_FROM(writeport)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( acitya_portmap, AS_IO, 8, pacman_state )
|
||||
AM_RANGE(0x00, 0xff) AM_READ_LEGACY(acitya_decrypt_rom) /* Switch protection logic */
|
||||
AM_RANGE(0x00, 0xff) AM_READ(acitya_decrypt_rom) /* Switch protection logic */
|
||||
AM_IMPORT_FROM(writeport)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
@ -6033,12 +6033,12 @@ DRIVER_INIT_MEMBER(pacman_state,woodpek)
|
|||
|
||||
DRIVER_INIT_MEMBER(pacman_state,pacplus)
|
||||
{
|
||||
pacplus_decode(machine());
|
||||
pacplus_decode();
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(pacman_state,jumpshot)
|
||||
{
|
||||
jumpshot_decode(machine());
|
||||
jumpshot_decode();
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(pacman_state,drivfrcp)
|
||||
|
|
|
@ -125,10 +125,6 @@ public:
|
|||
DECLARE_VIDEO_START(pacman);
|
||||
DECLARE_PALETTE_INIT(pacman);
|
||||
DECLARE_VIDEO_START(birdiy);
|
||||
DECLARE_MACHINE_START(theglobp);
|
||||
DECLARE_MACHINE_RESET(theglobp);
|
||||
DECLARE_MACHINE_START(acitya);
|
||||
DECLARE_MACHINE_RESET(acitya);
|
||||
DECLARE_VIDEO_START(s2650games);
|
||||
DECLARE_MACHINE_RESET(mschamp);
|
||||
DECLARE_MACHINE_RESET(superabc);
|
||||
|
@ -145,16 +141,30 @@ public:
|
|||
void korosuke_rom_decode();
|
||||
void eyes_decode(UINT8 *data);
|
||||
void mspacman_install_patches(UINT8 *ROM);
|
||||
|
||||
// theglopb.c
|
||||
void theglobp_decrypt_rom_8();
|
||||
void theglobp_decrypt_rom_9();
|
||||
void theglobp_decrypt_rom_A();
|
||||
void theglobp_decrypt_rom_B();
|
||||
DECLARE_READ8_MEMBER(theglobp_decrypt_rom);
|
||||
DECLARE_MACHINE_START(theglobp);
|
||||
DECLARE_MACHINE_RESET(theglobp);
|
||||
|
||||
// pacplus.c
|
||||
UINT8 pacplus_decrypt(int addr, UINT8 e);
|
||||
void pacplus_decode();
|
||||
|
||||
// jumpshot.c
|
||||
UINT8 jumpshot_decrypt(int addr, UINT8 e);
|
||||
void jumpshot_decode();
|
||||
|
||||
// acitya.c
|
||||
void acitya_decrypt_rom_8();
|
||||
void acitya_decrypt_rom_9();
|
||||
void acitya_decrypt_rom_A();
|
||||
void acitya_decrypt_rom_B();
|
||||
DECLARE_READ8_MEMBER(acitya_decrypt_rom);
|
||||
DECLARE_MACHINE_START(acitya);
|
||||
DECLARE_MACHINE_RESET(acitya);
|
||||
};
|
||||
|
||||
/*----------- defined in machine/pacplus.c -----------*/
|
||||
void pacplus_decode(running_machine &machine);
|
||||
|
||||
/*----------- defined in machine/jumpshot.c -----------*/
|
||||
void jumpshot_decode(running_machine &machine);
|
||||
|
||||
/*----------- defined in machine/theglobp.c -----------*/
|
||||
DECLARE_READ8_HANDLER( theglobp_decrypt_rom );
|
||||
|
||||
/*----------- defined in machine/acitya.c -------------*/
|
||||
DECLARE_READ8_HANDLER( acitya_decrypt_rom );
|
||||
|
|
|
@ -16,13 +16,13 @@ David Widel d_widel@hotmail.com
|
|||
#include "includes/pacman.h"
|
||||
|
||||
|
||||
static void acitya_decrypt_rom_8(running_machine &machine)
|
||||
void pacman_state::acitya_decrypt_rom_8()
|
||||
{
|
||||
int oldbyte,inverted_oldbyte,newbyte;
|
||||
int mem;
|
||||
UINT8 *RAM;
|
||||
|
||||
RAM = machine.root_device().memregion("maincpu")->base();
|
||||
RAM = memregion("maincpu")->base();
|
||||
|
||||
|
||||
for (mem=0;mem<0x4000;mem++)
|
||||
|
@ -51,13 +51,13 @@ static void acitya_decrypt_rom_8(running_machine &machine)
|
|||
}
|
||||
|
||||
|
||||
static void acitya_decrypt_rom_9(running_machine &machine)
|
||||
void pacman_state::acitya_decrypt_rom_9()
|
||||
{
|
||||
int oldbyte,inverted_oldbyte,newbyte;
|
||||
int mem;
|
||||
UINT8 *RAM;
|
||||
|
||||
RAM = machine.root_device().memregion("maincpu")->base();
|
||||
RAM = memregion("maincpu")->base();
|
||||
|
||||
for (mem=0;mem<0x4000;mem++)
|
||||
{
|
||||
|
@ -83,13 +83,13 @@ static void acitya_decrypt_rom_9(running_machine &machine)
|
|||
return;
|
||||
}
|
||||
|
||||
static void acitya_decrypt_rom_A(running_machine &machine)
|
||||
void pacman_state::acitya_decrypt_rom_A()
|
||||
{
|
||||
int oldbyte,inverted_oldbyte,newbyte;
|
||||
int mem;
|
||||
UINT8 *RAM;
|
||||
|
||||
RAM = machine.root_device().memregion("maincpu")->base();
|
||||
RAM = memregion("maincpu")->base();
|
||||
|
||||
for (mem=0;mem<0x4000;mem++)
|
||||
{
|
||||
|
@ -115,13 +115,13 @@ static void acitya_decrypt_rom_A(running_machine &machine)
|
|||
return;
|
||||
}
|
||||
|
||||
static void acitya_decrypt_rom_B(running_machine &machine)
|
||||
void pacman_state::acitya_decrypt_rom_B()
|
||||
{
|
||||
int oldbyte,inverted_oldbyte,newbyte;
|
||||
int mem;
|
||||
UINT8 *RAM;
|
||||
|
||||
RAM = machine.root_device().memregion("maincpu")->base();
|
||||
RAM = memregion("maincpu")->base();
|
||||
|
||||
for (mem=0;mem<0x4000;mem++)
|
||||
{
|
||||
|
@ -150,26 +150,25 @@ static void acitya_decrypt_rom_B(running_machine &machine)
|
|||
}
|
||||
|
||||
|
||||
READ8_HANDLER( acitya_decrypt_rom )
|
||||
READ8_MEMBER(pacman_state::acitya_decrypt_rom )
|
||||
{
|
||||
pacman_state *state = space.machine().driver_data<pacman_state>();
|
||||
if (offset & 0x01)
|
||||
{
|
||||
state->m_counter = (state->m_counter - 1) & 0x0F;
|
||||
m_counter = (m_counter - 1) & 0x0F;
|
||||
}
|
||||
else
|
||||
{
|
||||
state->m_counter = (state->m_counter + 1) & 0x0F;
|
||||
m_counter = (m_counter + 1) & 0x0F;
|
||||
}
|
||||
|
||||
switch(state->m_counter)
|
||||
switch(m_counter)
|
||||
{
|
||||
case 0x08: state->membank ("bank1")->set_entry (0); break;
|
||||
case 0x09: state->membank ("bank1")->set_entry (1); break;
|
||||
case 0x0A: state->membank ("bank1")->set_entry (2); break;
|
||||
case 0x0B: state->membank ("bank1")->set_entry (3); break;
|
||||
case 0x08: membank ("bank1")->set_entry (0); break;
|
||||
case 0x09: membank ("bank1")->set_entry (1); break;
|
||||
case 0x0A: membank ("bank1")->set_entry (2); break;
|
||||
case 0x0B: membank ("bank1")->set_entry (3); break;
|
||||
default:
|
||||
logerror("Invalid counter = %02X\n",state->m_counter);
|
||||
logerror("Invalid counter = %02X\n",m_counter);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -184,10 +183,10 @@ MACHINE_START_MEMBER(pacman_state,acitya)
|
|||
/* While the PAL supports up to 16 decryption methods, only four
|
||||
are actually used in the PAL. Therefore, we'll take a little
|
||||
memory overhead and decrypt the ROMs using each method in advance. */
|
||||
acitya_decrypt_rom_8(machine());
|
||||
acitya_decrypt_rom_9(machine());
|
||||
acitya_decrypt_rom_A(machine());
|
||||
acitya_decrypt_rom_B(machine());
|
||||
acitya_decrypt_rom_8();
|
||||
acitya_decrypt_rom_9();
|
||||
acitya_decrypt_rom_A();
|
||||
acitya_decrypt_rom_B();
|
||||
|
||||
membank("bank1")->configure_entries(0, 4, &RAM[0x10000], 0x4000);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "includes/pacman.h"
|
||||
|
||||
|
||||
static UINT8 decrypt(int addr, UINT8 e)
|
||||
UINT8 pacman_state::jumpshot_decrypt(int addr, UINT8 e)
|
||||
{
|
||||
static const UINT8 swap_xor_table[6][9] =
|
||||
{
|
||||
|
@ -39,16 +39,16 @@ static UINT8 decrypt(int addr, UINT8 e)
|
|||
}
|
||||
|
||||
|
||||
void jumpshot_decode(running_machine &machine)
|
||||
void pacman_state::jumpshot_decode()
|
||||
{
|
||||
int i;
|
||||
UINT8 *RAM;
|
||||
|
||||
/* CPU ROMs */
|
||||
|
||||
RAM = machine.root_device().memregion("maincpu")->base();
|
||||
RAM = memregion("maincpu")->base();
|
||||
for (i = 0; i < 0x4000; i++)
|
||||
{
|
||||
RAM[i] = decrypt(i,RAM[i]);
|
||||
RAM[i] = jumpshot_decrypt(i,RAM[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "includes/pacman.h"
|
||||
|
||||
|
||||
static UINT8 decrypt(int addr, UINT8 e)
|
||||
UINT8 pacman_state::pacplus_decrypt(int addr, UINT8 e)
|
||||
{
|
||||
static const UINT8 swap_xor_table[6][9] =
|
||||
{
|
||||
|
@ -39,16 +39,16 @@ static UINT8 decrypt(int addr, UINT8 e)
|
|||
}
|
||||
|
||||
|
||||
void pacplus_decode(running_machine &machine)
|
||||
void pacman_state::pacplus_decode()
|
||||
{
|
||||
int i;
|
||||
UINT8 *RAM;
|
||||
|
||||
/* CPU ROMs */
|
||||
|
||||
RAM = machine.root_device().memregion("maincpu")->base();
|
||||
RAM = memregion("maincpu")->base();
|
||||
for (i = 0; i < 0x4000; i++)
|
||||
{
|
||||
RAM[i] = decrypt(i,RAM[i]);
|
||||
RAM[i] = pacplus_decrypt(i,RAM[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,13 +65,13 @@
|
|||
#include "includes/pacman.h"
|
||||
|
||||
|
||||
static void theglobp_decrypt_rom_8(running_machine &machine)
|
||||
void pacman_state::theglobp_decrypt_rom_8()
|
||||
{
|
||||
int oldbyte,inverted_oldbyte,newbyte;
|
||||
int mem;
|
||||
UINT8 *RAM;
|
||||
|
||||
RAM = machine.root_device().memregion("maincpu")->base();
|
||||
RAM = memregion("maincpu")->base();
|
||||
|
||||
|
||||
for (mem=0;mem<0x4000;mem++)
|
||||
|
@ -101,13 +101,13 @@ static void theglobp_decrypt_rom_8(running_machine &machine)
|
|||
}
|
||||
|
||||
|
||||
static void theglobp_decrypt_rom_9(running_machine &machine)
|
||||
void pacman_state::theglobp_decrypt_rom_9()
|
||||
{
|
||||
int oldbyte,inverted_oldbyte,newbyte;
|
||||
int mem;
|
||||
UINT8 *RAM;
|
||||
|
||||
RAM = machine.root_device().memregion("maincpu")->base();
|
||||
RAM = memregion("maincpu")->base();
|
||||
|
||||
for (mem=0;mem<0x4000;mem++)
|
||||
{
|
||||
|
@ -135,13 +135,13 @@ static void theglobp_decrypt_rom_9(running_machine &machine)
|
|||
return;
|
||||
}
|
||||
|
||||
static void theglobp_decrypt_rom_A(running_machine &machine)
|
||||
void pacman_state::theglobp_decrypt_rom_A()
|
||||
{
|
||||
int oldbyte,inverted_oldbyte,newbyte;
|
||||
int mem;
|
||||
UINT8 *RAM;
|
||||
|
||||
RAM = machine.root_device().memregion("maincpu")->base();
|
||||
RAM = memregion("maincpu")->base();
|
||||
|
||||
for (mem=0;mem<0x4000;mem++)
|
||||
{
|
||||
|
@ -169,13 +169,13 @@ static void theglobp_decrypt_rom_A(running_machine &machine)
|
|||
return;
|
||||
}
|
||||
|
||||
static void theglobp_decrypt_rom_B(running_machine &machine)
|
||||
void pacman_state::theglobp_decrypt_rom_B()
|
||||
{
|
||||
int oldbyte,inverted_oldbyte,newbyte;
|
||||
int mem;
|
||||
UINT8 *RAM;
|
||||
|
||||
RAM = machine.root_device().memregion("maincpu")->base();
|
||||
RAM = memregion("maincpu")->base();
|
||||
|
||||
for (mem=0;mem<0x4000;mem++)
|
||||
{
|
||||
|
@ -204,26 +204,25 @@ static void theglobp_decrypt_rom_B(running_machine &machine)
|
|||
}
|
||||
|
||||
|
||||
READ8_HANDLER( theglobp_decrypt_rom )
|
||||
READ8_MEMBER(pacman_state::theglobp_decrypt_rom )
|
||||
{
|
||||
pacman_state *state = space.machine().driver_data<pacman_state>();
|
||||
if (offset & 0x01)
|
||||
{
|
||||
state->m_counter = (state->m_counter - 1) & 0x0F;
|
||||
m_counter = (m_counter - 1) & 0x0F;
|
||||
}
|
||||
else
|
||||
{
|
||||
state->m_counter = (state->m_counter + 1) & 0x0F;
|
||||
m_counter = (m_counter + 1) & 0x0F;
|
||||
}
|
||||
|
||||
switch(state->m_counter)
|
||||
switch(m_counter)
|
||||
{
|
||||
case 0x08: state->membank ("bank1")->set_entry (0); break;
|
||||
case 0x09: state->membank ("bank1")->set_entry (1); break;
|
||||
case 0x0A: state->membank ("bank1")->set_entry (2); break;
|
||||
case 0x0B: state->membank ("bank1")->set_entry (3); break;
|
||||
case 0x08: membank ("bank1")->set_entry (0); break;
|
||||
case 0x09: membank ("bank1")->set_entry (1); break;
|
||||
case 0x0A: membank ("bank1")->set_entry (2); break;
|
||||
case 0x0B: membank ("bank1")->set_entry (3); break;
|
||||
default:
|
||||
logerror("Invalid counter = %02X\n",state->m_counter);
|
||||
logerror("Invalid counter = %02X\n",m_counter);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -238,10 +237,10 @@ MACHINE_START_MEMBER(pacman_state,theglobp)
|
|||
/* While the PAL supports up to 16 decryption methods, only four
|
||||
are actually used in the PAL. Therefore, we'll take a little
|
||||
memory overhead and decrypt the ROMs using each method in advance. */
|
||||
theglobp_decrypt_rom_8(machine());
|
||||
theglobp_decrypt_rom_9(machine());
|
||||
theglobp_decrypt_rom_A(machine());
|
||||
theglobp_decrypt_rom_B(machine());
|
||||
theglobp_decrypt_rom_8();
|
||||
theglobp_decrypt_rom_9();
|
||||
theglobp_decrypt_rom_A();
|
||||
theglobp_decrypt_rom_B();
|
||||
|
||||
membank("bank1")->configure_entries(0, 4, &RAM[0x10000], 0x4000);
|
||||
|
||||
|
|
Loading…
Reference in a new issue