mirror of
https://github.com/holub/mame
synced 2025-04-24 09:20:02 +03:00
chihiro.cpp,xbox.cpp: remove USB_HACK_ENABLED define, now usb can be disabled per game, in xbox console usb is always enabled (nw)
This commit is contained in:
parent
db34b4a7bd
commit
d762eb9618
@ -712,20 +712,21 @@ void chihiro_state::hack_eeprom()
|
||||
|
||||
static const struct {
|
||||
const char *game_name;
|
||||
const bool disable_usb;
|
||||
struct {
|
||||
UINT32 address;
|
||||
UINT8 write_byte;
|
||||
} modify[16];
|
||||
} hacks[3] = { { "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", { { 0x12e4cf, 0x01 }, { 0x12e4d0, 0x00 }, { 0x4793e, 0x01 }, { 0x4793f, 0x00 }, { 0x47aa3, 0x01 }, { 0x47aa4, 0x00 }, { 0x14f2b6, 0x84 }, { 0x14f2d1, 0x75 }, { 0x8732f, 0x7d }, { 0x87384, 0x7d }, { 0x87388, 0xeb }, { 0, 0 } } },
|
||||
{ "crtaxihr", { { 0x121dce/*f6dce*/, 0xeb }, { 0x121deb/*f6deb*/, 0xeb }, { 0x121fa0/*f6fa0*/, 0xeb }, { 0x14ada5/*11fda5*/, 0x90 }, { 0x14ada6/*11fda6*/, 0x90 }, /*{ 0x8d0bc 620bc , 0xeb },*/ { 0, 0 } } }
|
||||
};
|
||||
} hacks[3] = { { "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", true, { { 0x12e4cf, 0x01 }, { 0x12e4d0, 0x00 }, { 0x4793e, 0x01 }, { 0x4793f, 0x00 }, { 0x47aa3, 0x01 }, { 0x47aa4, 0x00 }, { 0x14f2b6, 0x84 }, { 0x14f2d1, 0x75 }, { 0x8732f, 0x7d }, { 0x87384, 0x7d }, { 0x87388, 0xeb }, { 0, 0 } } },
|
||||
{ "crtaxihr", false, { { 0, 0 } } }, //{ 0x121dce/*f6dce*/, 0xeb }, { 0x121deb/*f6deb*/, 0xeb }, { 0x121fa0/*f6fa0*/, 0xeb }, { 0x14ada5/*11fda5*/, 0x90 }, { 0x14ada6/*11fda6*/, 0x90 }, { 0, 0 } } }
|
||||
};
|
||||
|
||||
void chihiro_state::hack_usb()
|
||||
{
|
||||
int p;
|
||||
|
||||
if (usbhack_counter == 0)
|
||||
if ((usbhack_counter == 0) && (usb_hack_enabled))
|
||||
p = 0;
|
||||
else if (usbhack_counter == 1) // after game loaded
|
||||
p = usbhack_index;
|
||||
@ -1142,7 +1143,7 @@ int ohci_hlean2131sc_device::handle_nonstandard_request(int endpoint, USBSetupPa
|
||||
}
|
||||
else if (setup->bRequest == 0x1b)
|
||||
{
|
||||
endpoints[endpoint].buffer[0] = 0x99; //
|
||||
endpoints[endpoint].buffer[0] = 0; //
|
||||
}
|
||||
else if (setup->bRequest == 0x1d)
|
||||
{
|
||||
@ -1571,6 +1572,8 @@ void chihiro_state::machine_start()
|
||||
for (int a = 1; a < 3; a++)
|
||||
if (strcmp(machine().basename(), hacks[a].game_name) == 0) {
|
||||
usbhack_index = a;
|
||||
if (hacks[a].disable_usb == true)
|
||||
usb_hack_enabled = true;
|
||||
break;
|
||||
}
|
||||
usbhack_counter = 0;
|
||||
|
@ -32,9 +32,7 @@ class xbox_state : public xbox_base_state
|
||||
{
|
||||
public:
|
||||
xbox_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
xbox_base_state(mconfig, type, tag),
|
||||
usbhack_index(-1),
|
||||
usbhack_counter(0)
|
||||
xbox_base_state(mconfig, type, tag)
|
||||
{ }
|
||||
|
||||
protected:
|
||||
@ -44,13 +42,10 @@ protected:
|
||||
virtual void video_start() override;
|
||||
|
||||
virtual void hack_eeprom() override;
|
||||
virtual void hack_usb() override;
|
||||
|
||||
struct chihiro_devices {
|
||||
bus_master_ide_controller_device *ide;
|
||||
} xbox_devs;
|
||||
int usbhack_index;
|
||||
int usbhack_counter;
|
||||
};
|
||||
|
||||
void xbox_state::video_start()
|
||||
@ -133,26 +128,19 @@ void xbox_state::hack_eeprom()
|
||||
m_maincpu->space(0).write_byte(0x375f0, m_maincpu->space(0).read_byte(0x375f0) & 0xfe); // internal hub not used
|
||||
}
|
||||
|
||||
void xbox_state::hack_usb()
|
||||
{
|
||||
// not needed
|
||||
}
|
||||
|
||||
void xbox_state::machine_start()
|
||||
{
|
||||
ohci_game_controller_device *usb_device;
|
||||
|
||||
xbox_base_state::machine_start();
|
||||
xbox_devs.ide = machine().device<bus_master_ide_controller_device>("ide");
|
||||
usbhack_index = -1;
|
||||
usbhack_counter = 0;
|
||||
usb_device = machine().device<ohci_game_controller_device>("ohci_gamepad");
|
||||
if (usb_device != nullptr) {
|
||||
usb_device->initialize(machine(), ohci_usb);
|
||||
ohci_usb->usb_ohci_plug(3, usb_device); // connect to root hub port 3, chihiro needs to use 1 and 2
|
||||
}
|
||||
// savestates
|
||||
save_item(NAME(usbhack_counter));
|
||||
//save_item(NAME(item));
|
||||
}
|
||||
|
||||
void xbox_state::machine_reset()
|
||||
|
@ -13,6 +13,7 @@ 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);
|
||||
@ -111,6 +112,7 @@ 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;
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#define LOG_PCI
|
||||
//#define LOG_AUDIO
|
||||
#define USB_HACK_ENABLED
|
||||
|
||||
void xbox_base_state::dump_string_command(int ref, int params, const char **param)
|
||||
{
|
||||
@ -1049,19 +1048,18 @@ WRITE8_MEMBER(xbox_base_state::superiors232_write)
|
||||
|
||||
READ32_MEMBER(xbox_base_state::ohci_usb_r)
|
||||
{
|
||||
#ifdef USB_HACK_ENABLED
|
||||
if (offset == 0) { /* hacks needed until usb (and jvs) is implemented */
|
||||
hack_usb();
|
||||
}
|
||||
#endif
|
||||
if (usb_hack_enabled)
|
||||
if (offset == 0) /* hacks needed until usb (and jvs) is implemented */
|
||||
{
|
||||
hack_usb();
|
||||
}
|
||||
return ohci_usb->read(space, offset, mem_mask);
|
||||
}
|
||||
|
||||
WRITE32_MEMBER(xbox_base_state::ohci_usb_w)
|
||||
{
|
||||
#ifndef USB_HACK_ENABLED
|
||||
ohci_usb->write(space, offset, mem_mask);
|
||||
#endif
|
||||
if (!usb_hack_enabled)
|
||||
ohci_usb->write(space, offset, data, mem_mask);
|
||||
}
|
||||
|
||||
READ32_MEMBER(xbox_base_state::ohci_usb2_r)
|
||||
@ -1077,11 +1075,8 @@ ADDRESS_MAP_START(xbox_base_map, AS_PROGRAM, 32, xbox_base_state)
|
||||
AM_RANGE(0x00000000, 0x07ffffff) AM_RAM AM_SHARE("nv2a_share") // 128 megabytes
|
||||
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)
|
||||
#ifdef USB_HACK_ENABLED
|
||||
AM_RANGE(0xfed00000, 0xfed003ff) AM_READWRITE(ohci_usb_r, ohci_usb_w)
|
||||
#else
|
||||
AM_RANGE(0xfed00000, 0xfed00fff) AM_DEVREADWRITE("ohci_usb", ohci_usb_controller, read, write)
|
||||
#endif
|
||||
//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)
|
||||
|
Loading…
Reference in New Issue
Block a user