mirror of
https://github.com/holub/mame
synced 2025-07-04 17:38:08 +03:00
chihiro.c: simple way to add per-game patches (nw)
This commit is contained in:
parent
111f5dc710
commit
c80782eec9
@ -384,6 +384,11 @@ public:
|
|||||||
driver_device(mconfig, type, tag),
|
driver_device(mconfig, type, tag),
|
||||||
nvidia_nv2a(NULL),
|
nvidia_nv2a(NULL),
|
||||||
debug_irq_active(false),
|
debug_irq_active(false),
|
||||||
|
debug_irq_number(0),
|
||||||
|
dimm_board_memory(NULL),
|
||||||
|
dimm_board_memory_size(0),
|
||||||
|
usbhack_index(-1),
|
||||||
|
usbhack_counter(0),
|
||||||
m_maincpu(*this, "maincpu") { }
|
m_maincpu(*this, "maincpu") { }
|
||||||
|
|
||||||
DECLARE_READ32_MEMBER(geforce_r);
|
DECLARE_READ32_MEMBER(geforce_r);
|
||||||
@ -469,6 +474,7 @@ public:
|
|||||||
int debug_irq_number;
|
int debug_irq_number;
|
||||||
UINT8 *dimm_board_memory;
|
UINT8 *dimm_board_memory;
|
||||||
UINT32 dimm_board_memory_size;
|
UINT32 dimm_board_memory_size;
|
||||||
|
int usbhack_index;
|
||||||
int usbhack_counter;
|
int usbhack_counter;
|
||||||
required_device<cpu_device> m_maincpu;
|
required_device<cpu_device> m_maincpu;
|
||||||
};
|
};
|
||||||
@ -1046,36 +1052,32 @@ static const char *const usbregnames[] = {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const struct {
|
||||||
|
char *game_name;
|
||||||
|
struct {
|
||||||
|
UINT32 address;
|
||||||
|
UINT8 write_byte;
|
||||||
|
} modify[16];
|
||||||
|
} hacks[2] = { { "chihiro", { { 0x6a79f, 0x01 }, { 0x6a7a0, 0x00 }, { 0x6b575, 0x00 }, { 0x6b576, 0x00 }, { 0x6b5af, 0x75 }, { 0x6b78a, 0x75 }, { 0x6b7ca, 0x00 }, { 0x6b7b8, 0x00 }, { 0x8f5b2, 0x75 }, { 0x79a9e, 0x74 }, { 0x79b80, 0x74 }, { 0x79b97, 0x74 }, { 0, 0 } } },
|
||||||
|
{ "outr2", { { 0x12e4cf, 0x01 }, { 0x12e4d0, 0x00 }, { 0x4793e, 0x01 }, { 0x4793f, 0x00 }, { 0x47aa3, 0x01 }, { 0x47aa4, 0x00 }, { 0x14f2b6, 0x84 }, { 0x14f2d1, 0x75 }, { 0x8732f, 0x7d }, { 0x87384, 0x7d }, { 0x87388, 0xeb }, { 0, 0 } } } };
|
||||||
|
|
||||||
READ32_MEMBER(chihiro_state::usbctrl_r)
|
READ32_MEMBER(chihiro_state::usbctrl_r)
|
||||||
{
|
{
|
||||||
if (offset == 0) { /* hack needed until usb (and jvs) is implemented */
|
int a, p;
|
||||||
if (usbhack_counter == 0) {
|
|
||||||
m_maincpu->space(0).write_byte(0x6a79f, 0x01);
|
if (offset == 0) { /* hacks needed until usb (and jvs) is implemented */
|
||||||
m_maincpu->space(0).write_byte(0x6a7a0, 0x00);
|
if (usbhack_counter == 0)
|
||||||
m_maincpu->space(0).write_byte(0x6b575, 0x00);
|
p = 0;
|
||||||
m_maincpu->space(0).write_byte(0x6b576, 0x00);
|
else if (usbhack_counter == 1) // after game loaded
|
||||||
m_maincpu->space(0).write_byte(0x6b5af, 0x75);
|
p = usbhack_index;
|
||||||
m_maincpu->space(0).write_byte(0x6b78a, 0x75);
|
else
|
||||||
m_maincpu->space(0).write_byte(0x6b7ca, 0x00);
|
p = -1;
|
||||||
m_maincpu->space(0).write_byte(0x6b7b8, 0x00);
|
if (p >= 0) {
|
||||||
m_maincpu->space(0).write_byte(0x8f5b2, 0x75);
|
for (a = 0; a < 16; a++) {
|
||||||
m_maincpu->space(0).write_byte(0x79a9e, 0x74);
|
if (hacks[p].modify[a].address == 0)
|
||||||
m_maincpu->space(0).write_byte(0x79b80, 0x74);
|
break;
|
||||||
m_maincpu->space(0).write_byte(0x79b97, 0x74);
|
m_maincpu->space(0).write_byte(hacks[p].modify[a].address, hacks[p].modify[a].write_byte);
|
||||||
}
|
}
|
||||||
// after game loaded
|
|
||||||
if (usbhack_counter == 1) {
|
|
||||||
m_maincpu->space(0).write_byte(0x12e4cf, 0x01);
|
|
||||||
m_maincpu->space(0).write_byte(0x12e4d0, 0x00);
|
|
||||||
m_maincpu->space(0).write_byte(0x4793e, 0x01);
|
|
||||||
m_maincpu->space(0).write_byte(0x4793f, 0x00);
|
|
||||||
m_maincpu->space(0).write_byte(0x47aa3, 0x01);
|
|
||||||
m_maincpu->space(0).write_byte(0x47aa4, 0x00);
|
|
||||||
m_maincpu->space(0).write_byte(0x14f2b6, 0x84);
|
|
||||||
m_maincpu->space(0).write_byte(0x14f2d1, 0x75);
|
|
||||||
m_maincpu->space(0).write_byte(0x8732f, 0x7d);
|
|
||||||
m_maincpu->space(0).write_byte(0x87384, 0x7d);
|
|
||||||
m_maincpu->space(0).write_byte(0x87388, 0xeb);
|
|
||||||
}
|
}
|
||||||
usbhack_counter++;
|
usbhack_counter++;
|
||||||
}
|
}
|
||||||
@ -1790,6 +1792,12 @@ void chihiro_state::machine_start()
|
|||||||
apust.timer->enable(false);
|
apust.timer->enable(false);
|
||||||
if (machine().debug_flags & DEBUG_FLAG_ENABLED)
|
if (machine().debug_flags & DEBUG_FLAG_ENABLED)
|
||||||
debug_console_register_command(machine(), "chihiro", CMDFLAG_NONE, 0, 1, 4, chihiro_debug_commands);
|
debug_console_register_command(machine(), "chihiro", CMDFLAG_NONE, 0, 1, 4, chihiro_debug_commands);
|
||||||
|
usbhack_index = -1;
|
||||||
|
for (int a = 1; a < 2; a++)
|
||||||
|
if (strcmp(machine().basename(), hacks[a].game_name) == 0) {
|
||||||
|
usbhack_index = a;
|
||||||
|
break;
|
||||||
|
}
|
||||||
usbhack_counter = 0;
|
usbhack_counter = 0;
|
||||||
// savestates
|
// savestates
|
||||||
save_item(NAME(debug_irq_active));
|
save_item(NAME(debug_irq_active));
|
||||||
|
Loading…
Reference in New Issue
Block a user