segacrp2_device: Device cleanup [O. Galibert]

This commit is contained in:
Olivier Galibert 2017-03-03 14:14:00 +01:00
parent 446108bfe9
commit 694b8be9ec
2 changed files with 13 additions and 15 deletions

View File

@ -84,9 +84,6 @@ static void decode(uint8_t *rom, uint8_t *decrypted,
} }
} }
const device_type SEGACRP2_Z80 = device_creator<segacrp2_z80_device>;
const device_type SEGA_315_5179 = device_creator<sega_315_5179_device>; const device_type SEGA_315_5179 = device_creator<sega_315_5179_device>;
const device_type SEGA_315_5178 = device_creator<sega_315_5178_device>; const device_type SEGA_315_5178 = device_creator<sega_315_5178_device>;
const device_type SEGA_315_5177 = device_creator<sega_315_5177_device>; // also seen as 317-5000 const device_type SEGA_315_5177 = device_creator<sega_315_5177_device>; // also seen as 317-5000
@ -100,7 +97,7 @@ const device_type SEGA_317_0007 = device_creator<sega_317_0007_device>;
segacrp2_z80_device::segacrp2_z80_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : z80_device(mconfig, SEGACRP2_Z80, "Z80 SegaCrypt2", tag, owner, clock, "z80_sega2", __FILE__) {} segacrp2_z80_device::segacrp2_z80_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source) : z80_device(mconfig, type, name, tag, owner, clock, shortname, __FILE__) {}
void segacrp2_z80_device::device_start() { z80_device::device_start(); decrypt(); } void segacrp2_z80_device::device_start() { z80_device::device_start(); decrypt(); }
void segacrp2_z80_device::device_reset() { z80_device::device_reset(); } void segacrp2_z80_device::device_reset() { z80_device::device_reset(); }
void segacrp2_z80_device::decrypt() { } void segacrp2_z80_device::decrypt() { }
@ -112,7 +109,8 @@ void segacrp2_z80_device::set_decrypted_tag(device_t &device, const char* decryp
} }
sega_315_5177_device::sega_315_5177_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {} sega_315_5177_device::sega_315_5177_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : segacrp2_z80_device(mconfig, SEGA_315_5177, "Sega 315-5177", tag, owner, clock, "sega_315_5177", __FILE__) {}
void sega_315_5177_device::decrypt() void sega_315_5177_device::decrypt()
{ {
// 315-5177 // 315-5177
@ -169,7 +167,8 @@ void sega_315_5177_device::decrypt()
} }
sega_315_5176_device::sega_315_5176_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {} sega_315_5176_device::sega_315_5176_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : segacrp2_z80_device(mconfig, SEGA_315_5176, "Sega 315-5176", tag, owner, clock, "sega_315_5176", __FILE__) {}
void sega_315_5176_device::decrypt() void sega_315_5176_device::decrypt()
{ {
// 315-5176 // 315-5176
@ -177,7 +176,7 @@ void sega_315_5176_device::decrypt()
} }
sega_315_5162_device::sega_315_5162_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {} sega_315_5162_device::sega_315_5162_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : segacrp2_z80_device(mconfig, SEGA_315_5162, "Sega 315-5162", tag, owner, clock, "sega_315_5162", __FILE__) {}
void sega_315_5162_device::decrypt() void sega_315_5162_device::decrypt()
{ {
// 315-5162 // 315-5162
@ -213,7 +212,7 @@ void sega_315_5162_device::decrypt()
sega_315_5178_device::sega_315_5178_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {} sega_315_5178_device::sega_315_5178_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : segacrp2_z80_device(mconfig, SEGA_315_5178, "Sega 315-5178", tag, owner, clock, "sega_315_5178", __FILE__) {}
void sega_315_5178_device::decrypt() void sega_315_5178_device::decrypt()
{ // 315-5178 { // 315-5178
static const uint8_t xor_table[128] = static const uint8_t xor_table[128] =
@ -261,7 +260,7 @@ void sega_315_5178_device::decrypt()
sega_315_5179_device::sega_315_5179_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {} sega_315_5179_device::sega_315_5179_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : segacrp2_z80_device(mconfig, SEGA_315_5179, "Sega 315-5179", tag, owner, clock, "sega_315_5179", __FILE__) {}
void sega_315_5179_device::decrypt() void sega_315_5179_device::decrypt()
{ // 315-5179 { // 315-5179
static const uint8_t xor_table[128] = static const uint8_t xor_table[128] =
@ -343,7 +342,7 @@ void _sega_decode_317(uint8_t *rom, uint8_t *decrypted, int shift)
} }
sega_317_0004_device::sega_317_0004_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {} sega_317_0004_device::sega_317_0004_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : segacrp2_z80_device(mconfig, SEGA_317_0004, "Sega 317-0004", tag, owner, clock, "sega_317_0004", __FILE__) {}
void sega_317_0004_device::decrypt() void sega_317_0004_device::decrypt()
{ // 317-0004 { // 317-0004
_sega_decode_317(memregion(tag())->base(), (uint8_t*)memshare(m_decrypted_tag)->ptr(), 0); _sega_decode_317(memregion(tag())->base(), (uint8_t*)memshare(m_decrypted_tag)->ptr(), 0);
@ -351,20 +350,20 @@ void sega_317_0004_device::decrypt()
sega_317_0005_device::sega_317_0005_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {} sega_317_0005_device::sega_317_0005_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : segacrp2_z80_device(mconfig, SEGA_317_0005, "Sega 317-0005", tag, owner, clock, "sega_317_0005", __FILE__) {}
void sega_317_0005_device::decrypt() void sega_317_0005_device::decrypt()
{ // 317-0005 { // 317-0005
_sega_decode_317(memregion(tag())->base(), (uint8_t*)memshare(m_decrypted_tag)->ptr(), 1); _sega_decode_317(memregion(tag())->base(), (uint8_t*)memshare(m_decrypted_tag)->ptr(), 1);
} }
sega_317_0006_device::sega_317_0006_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {} sega_317_0006_device::sega_317_0006_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : segacrp2_z80_device(mconfig, SEGA_317_0006, "Sega 317-0006", tag, owner, clock, "sega_317_0006", __FILE__) {}
void sega_317_0006_device::decrypt() void sega_317_0006_device::decrypt()
{ // 317-0006 { // 317-0006
_sega_decode_317(memregion(tag())->base(), (uint8_t*)memshare(m_decrypted_tag)->ptr(), 2); _sega_decode_317(memregion(tag())->base(), (uint8_t*)memshare(m_decrypted_tag)->ptr(), 2);
} }
sega_317_0007_device::sega_317_0007_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : segacrp2_z80_device(mconfig, tag, owner, clock) {} sega_317_0007_device::sega_317_0007_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : segacrp2_z80_device(mconfig, SEGA_317_0007, "Sega 317-0007", tag, owner, clock, "sega_317_0007", __FILE__) {}
void sega_317_0007_device::decrypt() void sega_317_0007_device::decrypt()
{ // 317-0006 { // 317-0006
_sega_decode_317(memregion(tag())->base(), (uint8_t*)memshare(m_decrypted_tag)->ptr(), 3); _sega_decode_317(memregion(tag())->base(), (uint8_t*)memshare(m_decrypted_tag)->ptr(), 3);

View File

@ -16,7 +16,7 @@
class segacrp2_z80_device : public z80_device class segacrp2_z80_device : public z80_device
{ {
public: public:
segacrp2_z80_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t); segacrp2_z80_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
static void set_decrypted_tag(device_t &device, const char* decrypted_tag); static void set_decrypted_tag(device_t &device, const char* decrypted_tag);
const char* m_decrypted_tag; const char* m_decrypted_tag;
@ -105,7 +105,6 @@ protected:
}; };
extern const device_type SEGACRP2_Z80;
extern const device_type SEGA_315_5179; extern const device_type SEGA_315_5179;
extern const device_type SEGA_315_5178; extern const device_type SEGA_315_5178;
extern const device_type SEGA_315_5177; extern const device_type SEGA_315_5177;