chihiro: usb is always enabled now, remove unused parts (nw)

This commit is contained in:
yz70s 2017-04-15 13:48:37 +02:00
parent 589b9fe546
commit 44b654f70a
3 changed files with 22 additions and 27 deletions

View File

@ -540,8 +540,8 @@ class chihiro_state : public xbox_base_state
public:
chihiro_state(const machine_config &mconfig, device_type type, const char *tag) :
xbox_base_state(mconfig, type, tag),
usbhack_index(-1),
usbhack_counter(0),
hack_index(-1),
hack_counter(0),
dimm_board_memory(nullptr),
dimm_board_memory_size(0) { }
@ -560,8 +560,8 @@ public:
bus_master_ide_controller_device *ide;
naomi_gdrom_board *dimmboard;
} chihiro_devs;
int usbhack_index;
int usbhack_counter;
int hack_index;
int hack_counter;
uint8_t *dimm_board_memory;
uint32_t dimm_board_memory_size;
@ -731,26 +731,25 @@ void chihiro_state::hack_eeprom()
static const struct
{
const char *game_name;
const bool disable_usb;
struct {
uint32_t address;
uint8_t write_byte;
} modify[16];
} hacks[HACK_ITEMS] = { { "chihiro", false, { { 0x6a79f/*3f79f*/, 0x01 }, { 0x6a7a0/*3f7a0*/, 0x00 }, { 0x6b575/*40575*/, 0x00 }, { 0x6b576/*40576*/, 0x00 }, { 0x6b5af/*405af*/, 0x75 }, { 0x6b78a/*4078a*/, 0x75 }, { 0x6b7ca/*407ca*/, 0x00 }, { 0x6b7b8/*407b8*/, 0x00 }, { 0x8f5b2, 0x75 }, { 0x79a9e/*2ea9e*/, 0x74 }, { 0x79b80/*2eb80*/, 0xeb }, { 0x79b97/*2eb97*/, 0x74 }, { 0, 0 } } },
{ "outr2", false, { { 0, 0 } } },
{ "crtaxihr", false, { { 0x14ada5/*11fda5*/, 0x90 },{ 0x14ada6/*11fda6*/, 0x90 }, { 0, 0 } } },
{ "ghostsqu", false, { { 0x78833/*4d833*/, 0x90 },{ 0x78834/*4d834*/, 0x90 }, { 0, 0 } } },
{ "vcop3", false, { { 0x61a23/*36a23*/, 0x90 },{ 0x61a24/*36a24*/, 0x90 }, { 0, 0 } } },
} hacks[HACK_ITEMS] = { { "chihiro", { { 0x6a79f/*3f79f*/, 0x01 }, { 0x6a7a0/*3f7a0*/, 0x00 }, { 0x6b575/*40575*/, 0x00 }, { 0x6b576/*40576*/, 0x00 }, { 0x6b5af/*405af*/, 0x75 }, { 0x6b78a/*4078a*/, 0x75 }, { 0x6b7ca/*407ca*/, 0x00 }, { 0x6b7b8/*407b8*/, 0x00 }, { 0x8f5b2, 0x75 }, { 0x79a9e/*2ea9e*/, 0x74 }, { 0x79b80/*2eb80*/, 0xeb }, { 0x79b97/*2eb97*/, 0x74 }, { 0, 0 } } },
{ "outr2", { { 0, 0 } } },
{ "crtaxihr", { { 0x14ada5/*11fda5*/, 0x90 }, { 0x14ada6/*11fda6*/, 0x90 }, { 0, 0 } } },
{ "ghostsqu", { { 0x78833/*4d833*/, 0x90 }, { 0x78834/*4d834*/, 0x90 }, { 0, 0 } } },
{ "vcop3", { { 0x61a23/*36a23*/, 0x90 }, { 0x61a24/*36a24*/, 0x90 }, { 0, 0 } } },
};
void chihiro_state::hack_usb()
{
int p;
if ((usbhack_counter == 0) && (usb_hack_enabled))
p = 0;
else if (usbhack_counter == 1) // after game loaded
p = usbhack_index;
if (hack_counter == 0)
p = 0; // need to patch the kernel
else if (hack_counter == 1)
p = hack_index; // need to patch the game
else
p = -1;
if (p >= 0) {
@ -760,7 +759,7 @@ void chihiro_state::hack_usb()
m_maincpu->space(0).write_byte(hacks[p].modify[a].address, hacks[p].modify[a].write_byte);
}
}
usbhack_counter++;
hack_counter++;
}
//**************************************************************************
@ -1734,15 +1733,13 @@ void chihiro_state::machine_start()
using namespace std::placeholders;
machine().debugger().console().register_command("chihiro", CMDFLAG_NONE, 0, 1, 4, std::bind(&chihiro_state::debug_commands, this, _1, _2));
}
usbhack_index = -1;
hack_index = -1;
for (int a = 1; a < HACK_ITEMS; a++)
if (strcmp(machine().basename(), hacks[a].game_name) == 0) {
usbhack_index = a;
if (hacks[a].disable_usb == true)
usb_hack_enabled = true;
hack_index = a;
break;
}
usbhack_counter = 0;
hack_counter = 0;
usb_device1 = machine().device<ohci_hlean2131qc_device>("ohci_hlean2131qc");
usb_device1->initialize(machine(), ohci_usb);
usb_device1->set_region_base(memregion(":others")->base()); // temporary
@ -1752,7 +1749,7 @@ void chihiro_state::machine_start()
usb_device2->set_region_base(memregion(":others")->base() + 0x2080); // temporary
ohci_usb->usb_ohci_plug(2, usb_device2); // connect
// savestates
save_item(NAME(usbhack_counter));
save_item(NAME(hack_counter));
}
static SLOT_INTERFACE_START(ide_baseboard)
@ -1775,7 +1772,7 @@ static MACHINE_CONFIG_DERIVED_CLASS(chihiro_base, xbox_base, chihiro_state)
MCFG_DEVICE_ADD("ohci_hlean2131sc", OHCI_HLEAN2131SC, 0)
MCFG_DEVICE_ADD("jvs_master", JVS_MASTER, 0)
MCFG_SEGA_837_13551_DEVICE_ADD("837_13551", "jvs_master", ":TILT", ":P1", ":P2", ":A0", ":A1", ":A2", ":A3", ":A4", ":A5", ":A6", ":A7", ":OUTPUT")
MACHINE_CONFIG_END
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED(chihirogd, chihiro_base)
MCFG_NAOMI_GDROM_BOARD_ADD("rom_board", ":gdrom", "^pic", nullptr, NOOP)

View File

@ -20,7 +20,6 @@ public:
nvidia_nv2a(nullptr),
debug_irq_active(false),
debug_irq_number(0),
usb_hack_enabled(false),
m_maincpu(*this, "maincpu") { }
DECLARE_READ32_MEMBER(geforce_r);
@ -119,7 +118,6 @@ public:
std::unique_ptr<nv2a_renderer> nvidia_nv2a;
bool debug_irq_active;
int debug_irq_number;
bool usb_hack_enabled;
required_device<cpu_device> m_maincpu;
ohci_usb_controller *ohci_usb;
static const struct debugger_constants

View File

@ -1169,8 +1169,7 @@ READ32_MEMBER(xbox_base_state::ohci_usb_r)
WRITE32_MEMBER(xbox_base_state::ohci_usb_w)
{
if (!usb_hack_enabled)
ohci_usb->write(space, offset, data, mem_mask);
ohci_usb->write(space, offset, data, mem_mask);
}
READ32_MEMBER(xbox_base_state::ohci_usb2_r)
@ -1187,7 +1186,6 @@ ADDRESS_MAP_START(xbox_base_map, AS_PROGRAM, 32, xbox_base_state)
AM_RANGE(0xf0000000, 0xf7ffffff) AM_RAM AM_SHARE("nv2a_share") // 3d accelerator wants this
AM_RANGE(0xfd000000, 0xfdffffff) AM_RAM AM_READWRITE(geforce_r, geforce_w)
AM_RANGE(0xfed00000, 0xfed003ff) AM_READWRITE(ohci_usb_r, ohci_usb_w)
//AM_RANGE(0xfed00000, 0xfed00fff) AM_DEVREADWRITE("ohci_usb", ohci_usb_controller, read, write)
AM_RANGE(0xfed08000, 0xfed08fff) AM_READWRITE(ohci_usb2_r, ohci_usb2_w)
AM_RANGE(0xfe800000, 0xfe87ffff) AM_READWRITE(audio_apu_r, audio_apu_w)
AM_RANGE(0xfec00000, 0xfec00fff) AM_READWRITE(audio_ac93_r, audio_ac93_w)
@ -1205,6 +1203,8 @@ ADDRESS_MAP_START(xbox_base_map_io, AS_IO, 32, xbox_base_state)
AM_RANGE(0x8000, 0x80ff) AM_READWRITE(dummy_r, dummy_w) // lpc bridge
AM_RANGE(0xc000, 0xc00f) AM_READWRITE(smbus_r, smbus_w)
AM_RANGE(0xc200, 0xc21f) AM_READWRITE(smbus2_r, smbus2_w)
AM_RANGE(0xd000, 0xd0ff) AM_NOP // ac97
AM_RANGE(0xd200, 0xd27f) AM_NOP // ac97
AM_RANGE(0xe000, 0xe007) AM_READWRITE(networkio_r, networkio_w)
AM_RANGE(0xff60, 0xff6f) AM_DEVREADWRITE("ide", bus_master_ide_controller_device, bmdma_r, bmdma_w)
ADDRESS_MAP_END