From ee97679d8febdb72e55493f9fd5c371082edef1d Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 17 Nov 2011 11:31:47 +0000 Subject: [PATCH] made jaguar coexist in mame and mess (no whatsnew) --- src/mame/audio/jaguar.c | 32 ++++++++++++++++++++------------ src/mame/drivers/jaguar.c | 23 ++++++++++++++++------- src/mame/includes/jaguar.h | 5 +---- src/mame/video/jagobj.c | 10 +++------- 4 files changed, 40 insertions(+), 30 deletions(-) diff --git a/src/mame/audio/jaguar.c b/src/mame/audio/jaguar.c index be8823d8fd2..75df9e439bc 100644 --- a/src/mame/audio/jaguar.c +++ b/src/mame/audio/jaguar.c @@ -262,7 +262,9 @@ void cojag_sound_init(running_machine &machine) } #if ENABLE_SPEEDUP_HACKS - machine.device("audiocpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xf1a100, 0xf1a103, FUNC(dsp_flags_w)); + if (jaguar_hacks_enabled) + machine.device("audiocpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xf1a100, 0xf1a103, FUNC(dsp_flags_w)); + #endif } @@ -369,18 +371,24 @@ static WRITE32_HANDLER( dsp_flags_w ) TIMER_DEVICE_CALLBACK( jaguar_serial_callback ) { - /* assert the A2S IRQ on CPU #2 (DSP) */ - cputag_set_input_line(timer.machine(), "audiocpu", 1, ASSERT_LINE); - jaguar_dsp_resume(timer.machine()); + if (jaguar_hacks_enabled) { + /* assert the A2S IRQ on CPU #2 (DSP) */ + cputag_set_input_line(timer.machine(), "audiocpu", 1, ASSERT_LINE); + jaguar_dsp_resume(timer.machine()); - /* fix flaky code in interrupt handler which thwarts our speedup */ - if ((jaguar_dsp_ram[0x3e/4] & 0xffff) == 0xbfbc && - (jaguar_dsp_ram[0x42/4] & 0xffff) == 0xe400) - { - /* move the store r28,(r29) into the branch delay slot, swapping it with */ - /* the nop that's currently there */ - jaguar_dsp_ram[0x3e/4] = (jaguar_dsp_ram[0x3e/4] & 0xffff0000) | 0xe400; - jaguar_dsp_ram[0x42/4] = (jaguar_dsp_ram[0x42/4] & 0xffff0000) | 0xbfbc; + /* fix flaky code in interrupt handler which thwarts our speedup */ + if ((jaguar_dsp_ram[0x3e/4] & 0xffff) == 0xbfbc && + (jaguar_dsp_ram[0x42/4] & 0xffff) == 0xe400) + { + /* move the store r28,(r29) into the branch delay slot, swapping it with */ + /* the nop that's currently there */ + jaguar_dsp_ram[0x3e/4] = (jaguar_dsp_ram[0x3e/4] & 0xffff0000) | 0xe400; + jaguar_dsp_ram[0x42/4] = (jaguar_dsp_ram[0x42/4] & 0xffff0000) | 0xbfbc; + } + } else { + /* assert the A2S IRQ on CPU #2 (DSP) */ + cputag_set_input_line(timer.machine(), "audiocpu", 1, ASSERT_LINE); + jaguar_dsp_resume(timer.machine()); } } diff --git a/src/mame/drivers/jaguar.c b/src/mame/drivers/jaguar.c index a2916da749c..80ac802d689 100644 --- a/src/mame/drivers/jaguar.c +++ b/src/mame/drivers/jaguar.c @@ -390,6 +390,7 @@ UINT32 *jaguar_dsp_ram; UINT32 *jaguar_wave_rom; UINT32* high_rom_base; UINT8 cojag_is_r3000; +bool jaguar_hacks_enabled; static int is_jaguar; @@ -950,7 +951,7 @@ static READ32_HANDLER( gpu_jump_r ) { #if ENABLE_SPEEDUP_HACKS /* spin if we're allowed */ - jaguar_gpu_suspend(space->machine()); + if (jaguar_hacks_enabled) jaguar_gpu_suspend(space->machine()); #endif /* no command is pending */ @@ -1800,6 +1801,7 @@ static void jaguar_fix_endian( running_machine &machine, UINT32 addr, UINT32 siz static DRIVER_INIT( jaguar ) { + jaguar_hacks_enabled = false; state_save_register_global(machine, joystick_data); using_cart = 0; @@ -2317,6 +2319,7 @@ static void cojag_common_init(running_machine &machine, UINT16 gpu_jump_offs, UI static DRIVER_INIT( area51a ) { + jaguar_hacks_enabled = true; cojag_common_init(machine, 0x5c4, 0x5a0); #if ENABLE_SPEEDUP_HACKS @@ -2332,6 +2335,7 @@ static DRIVER_INIT( area51a ) static DRIVER_INIT( area51 ) { + jaguar_hacks_enabled = true; cojag_common_init(machine, 0x0c0, 0x09e); #if ENABLE_SPEEDUP_HACKS @@ -2347,6 +2351,7 @@ static DRIVER_INIT( area51 ) static DRIVER_INIT( maxforce ) { + jaguar_hacks_enabled = true; cojag_state *state = machine.driver_data(); cojag_common_init(machine, 0x0c0, 0x09e); @@ -2363,6 +2368,7 @@ static DRIVER_INIT( maxforce ) static DRIVER_INIT( area51mx ) { + jaguar_hacks_enabled = true; cojag_state *state = machine.driver_data(); cojag_common_init(machine, 0x0c0, 0x09e); @@ -2378,6 +2384,7 @@ static DRIVER_INIT( area51mx ) static DRIVER_INIT( a51mxr3k ) { + jaguar_hacks_enabled = true; cojag_state *state = machine.driver_data(); cojag_common_init(machine, 0x0c0, 0x09e); @@ -2394,6 +2401,7 @@ static DRIVER_INIT( a51mxr3k ) static DRIVER_INIT( fishfren ) { + jaguar_hacks_enabled = true; cojag_common_init(machine, 0x578, 0x554); #if ENABLE_SPEEDUP_HACKS @@ -2425,16 +2433,17 @@ static void init_freeze_common(running_machine &machine, offs_t main_speedup_add #endif } -static DRIVER_INIT( freezeat ) { init_freeze_common(machine, 0x1001a9f4); } -static DRIVER_INIT( freezeat2 ) { init_freeze_common(machine, 0x1001a8c4); } -static DRIVER_INIT( freezeat3 ) { init_freeze_common(machine, 0x1001a134); } -static DRIVER_INIT( freezeat4 ) { init_freeze_common(machine, 0x1001a134); } -static DRIVER_INIT( freezeat5 ) { init_freeze_common(machine, 0x10019b34); } -static DRIVER_INIT( freezeat6 ) { init_freeze_common(machine, 0x10019684); } +static DRIVER_INIT( freezeat ) { jaguar_hacks_enabled = true; init_freeze_common(machine, 0x1001a9f4); } +static DRIVER_INIT( freezeat2 ) { jaguar_hacks_enabled = true; init_freeze_common(machine, 0x1001a8c4); } +static DRIVER_INIT( freezeat3 ) { jaguar_hacks_enabled = true; init_freeze_common(machine, 0x1001a134); } +static DRIVER_INIT( freezeat4 ) { jaguar_hacks_enabled = true; init_freeze_common(machine, 0x1001a134); } +static DRIVER_INIT( freezeat5 ) { jaguar_hacks_enabled = true; init_freeze_common(machine, 0x10019b34); } +static DRIVER_INIT( freezeat6 ) { jaguar_hacks_enabled = true; init_freeze_common(machine, 0x10019684); } static DRIVER_INIT( vcircle ) { + jaguar_hacks_enabled = true; cojag_common_init(machine, 0x5c0, 0x5a0); #if ENABLE_SPEEDUP_HACKS diff --git a/src/mame/includes/jaguar.h b/src/mame/includes/jaguar.h index 9fe61e1f220..ee83856ce14 100644 --- a/src/mame/includes/jaguar.h +++ b/src/mame/includes/jaguar.h @@ -5,11 +5,7 @@ *************************************************************************/ #ifndef ENABLE_SPEEDUP_HACKS -#ifndef MESS #define ENABLE_SPEEDUP_HACKS 1 -#else -#define ENABLE_SPEEDUP_HACKS 0 -#endif /* MESS */ #endif /* CoJag and Jaguar have completely different XTALs, pixel clock in Jaguar is the same as the GPU one */ @@ -26,6 +22,7 @@ extern UINT32 *jaguar_gpu_ram; extern UINT32 *jaguar_gpu_clut; extern UINT32 *jaguar_dsp_ram; extern UINT32 *jaguar_wave_rom; +extern bool jaguar_hacks_enabled; /*----------- defined in audio/jaguar.c -----------*/ diff --git a/src/mame/video/jagobj.c b/src/mame/video/jagobj.c index 1f8195fcf46..937f196b0dc 100644 --- a/src/mame/video/jagobj.c +++ b/src/mame/video/jagobj.c @@ -972,10 +972,8 @@ static UINT32 *process_branch(running_machine &machine, UINT32 *objdata, int vc, UINT32 link = (lower >> 24) | ((upper & 0x7ff) << 8); int taken = 0; -#ifndef MESS - if ((ypos & 1) && ypos != 0x7ff) - fprintf(stderr, " branch cc=%d ypos=%X link=%06X - \n", cc, ypos, link << 3); -#endif +// if ((ypos & 1) && ypos != 0x7ff) +// fprintf(stderr, " branch cc=%d ypos=%X link=%06X - \n", cc, ypos, link << 3); switch (cc) { @@ -1091,9 +1089,7 @@ static void process_object_list(running_machine &machine, int vc, UINT16 *_scanl logerror("stop = %08X-%08X\n", objdata[0], objdata[1]); if (interrupt) { -#ifndef MESS - fprintf(stderr, "stop int=%d\n", interrupt); -#endif +// fprintf(stderr, "stop int=%d\n", interrupt); cpu_irq_state |= 4; update_cpu_irq(machine); }