Xbox console driver now uses the base common machine setup with Chihiro [Samuele Zannoli]

This commit is contained in:
yz70s 2015-08-11 13:16:05 +02:00
parent 447ef6b30b
commit cc6f34f81c

View File

@ -11,76 +11,56 @@
#include "emu.h"
#include "cpu/i386/i386.h"
//#include "machine/lpci.h"
//#include "machine/pic8259.h"
//#include "machine/pit8253.h"
//#include "machine/idectrl.h"
//#include "machine/idehd.h"
//#include "machine/naomigd.h"
//#include "video/poly.h"
//#include "bitmap.h"
//#include "debug/debugcon.h"
//#include "debug/debugcmd.h"
//#include "debug/debugcpu.h"
//#include "includes/chihiro.h"
#include "machine/lpci.h"
#include "machine/pic8259.h"
#include "machine/pit8253.h"
#include "machine/idectrl.h"
#include "machine/idehd.h"
#include "video/poly.h"
#include "bitmap.h"
#include "debug/debugcon.h"
#include "debug/debugcmd.h"
#include "debug/debugcpu.h"
#include "includes/chihiro.h"
#include "includes/xbox.h"
#define CPU_DIV 64
/*!
@todo - Inheritance with chihiro_state
*/
class xbox_state : public driver_device
class xbox_state : public xbox_base_state
{
public:
xbox_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu")
xbox_state(const machine_config &mconfig, device_type type, const char *tag) :
xbox_base_state(mconfig, type, tag),
usbhack_index(-1),
usbhack_counter(0)
{ }
// devices
required_device<cpu_device> m_maincpu;
// screen updates
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_PALETTE_INIT(xbox);
protected:
// driver_device overrides
virtual void machine_start();
virtual void machine_reset();
virtual void video_start();
virtual void hack_eeprom();
virtual void hack_usb();
struct chihiro_devices {
bus_master_ide_controller_device *ide;
} xbox_devs;
int usbhack_index;
int usbhack_counter;
};
void xbox_state::video_start()
{
}
UINT32 xbox_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
return 0;
}
static ADDRESS_MAP_START(xbox_map, AS_PROGRAM, 32, xbox_state)
AM_RANGE(0x00000000, 0x07ffffff) AM_RAM // 128 megabytes
AM_RANGE(0xf0000000, 0xf0ffffff) AM_RAM
// AM_RANGE(0xfd000000, 0xfdffffff) AM_RAM AM_READWRITE(geforce_r, geforce_w)
// AM_RANGE(0xfed00000, 0xfed003ff) AM_READWRITE(usbctrl_r, usbctrl_w)
// AM_RANGE(0xfe800000, 0xfe85ffff) AM_READWRITE(audio_apu_r, audio_apu_w)
// AM_RANGE(0xfec00000, 0xfec001ff) AM_READWRITE(audio_ac93_r, audio_ac93_w)
AM_RANGE(0xff000000, 0xff07ffff) AM_ROM AM_REGION("bios", 0) AM_MIRROR(0x00f80000)
AM_IMPORT_FROM(xbox_base_map)
ADDRESS_MAP_END
static ADDRESS_MAP_START(xbox_map_io, AS_IO, 32, xbox_state)
// AM_RANGE(0x0020, 0x0023) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0xffffffff)
// AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8("pit8254", pit8254_device, read, write, 0xffffffff)
// AM_RANGE(0x00a0, 0x00a3) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, 0xffffffff)
// AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE("ide", bus_master_ide_controller_device, read_cs0, write_cs0)
// AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_legacy_device, read, write)
// AM_RANGE(0x4000, 0x40ff) AM_READWRITE(mediaboard_r, mediaboard_w)
// AM_RANGE(0x8000, 0x80ff) AM_READWRITE(dummy_r, dummy_w)
// AM_RANGE(0xc000, 0xc0ff) AM_READWRITE(smbus_r, smbus_w)
// AM_RANGE(0xff60, 0xff67) AM_DEVREADWRITE("ide", bus_master_ide_controller_device, bmdma_r, bmdma_w)
AM_IMPORT_FROM(xbox_base_map_io)
ADDRESS_MAP_END
static INPUT_PORTS_START( xbox )
@ -140,41 +120,67 @@ static INPUT_PORTS_START( xbox )
INPUT_PORTS_END
void xbox_state::hack_eeprom()
{
// 8003b744,3b744=0x90 0x90
/*m_maincpu->space(0).write_byte(0x3b744, 0x90);
m_maincpu->space(0).write_byte(0x3b745, 0x90);
m_maincpu->space(0).write_byte(0x3b766, 0xc9);
m_maincpu->space(0).write_byte(0x3b767, 0xc3);*/
}
/*static const struct {
const char *game_name;
struct {
UINT32 address;
UINT8 write_byte;
} modify[16];
} hacks[] = { { "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 } } } };*/
void xbox_state::hack_usb()
{
int p;
if (usbhack_counter == 0)
p = 0;
else if (usbhack_counter == 1) // after game loaded
p = usbhack_index;
else
p = -1;
if (p >= 0) {
/*for (int a = 0; a < 16; a++) {
if (hacks[p].modify[a].address == 0)
break;
m_maincpu->space(0).write_byte(hacks[p].modify[a].address, hacks[p].modify[a].write_byte);
}*/
}
usbhack_counter++;
}
void xbox_state::machine_start()
{
xbox_base_state::machine_start();
xbox_devs.ide = machine().device<bus_master_ide_controller_device>("ide");
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;
// savestates
save_item(NAME(usbhack_counter));
}
void xbox_state::machine_reset()
{
}
PALETTE_INIT_MEMBER(xbox_state, xbox)
{
}
static MACHINE_CONFIG_START( xbox, xbox_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", PENTIUM3, 733333333/CPU_DIV) /* Wrong! family 6 model 8 stepping 10 */
static MACHINE_CONFIG_DERIVED_CLASS(xbox, xbox_base, xbox_state)
MCFG_CPU_MODIFY("maincpu")
MCFG_CPU_PROGRAM_MAP(xbox_map)
MCFG_CPU_IO_MAP(xbox_map_io)
// MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(chihiro_state, irq_callback)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
// MCFG_SCREEN_REFRESH_RATE(60)
// MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
MCFG_SCREEN_UPDATE_DRIVER(xbox_state, screen_update)
// MCFG_SCREEN_SIZE(32*8, 32*8)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
MCFG_SCREEN_RAW_PARAMS(8000000/2, 442, 0, 320, 264, 0, 240) /* generic NTSC video timing, change accordingly */
MCFG_SCREEN_PALETTE("palette")
MCFG_PALETTE_ADD("palette", 8)
MCFG_PALETTE_INIT_OWNER(xbox_state, xbox)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")