2011-07-14 00:49:52 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Genesis Plus
|
2021-08-09 16:05:24 +02:00
|
|
|
* Action Replay / Pro Action Replay hardware support
|
2011-07-14 00:49:52 +02:00
|
|
|
*
|
2021-08-08 16:48:49 +02:00
|
|
|
* Copyright (C) 2009-2021 Eke-Eke (Genesis Plus GX)
|
2011-07-14 00:49:52 +02:00
|
|
|
*
|
----------------------
Genesis Plus GX 1.6.0
----------------------
[Core/Sound]
---------------
* added YM2413 emulation in Master System compatibility mode.
* fixed SN76489 noise boost initialization.
* minor YM2612 core optimizations.
[Core/VDP]
---------------
* added accurate emulation of SG-1000, Master System (315-5124, 315-5246) & Game Gear VDP.
* added support for all TMS9918 rendering modes.
* improved Mega Drive VDP timings accuracy in Master System Compatibility mode.
* fixed color palette initialization.
* fixed shifted sprites rendering in Mode 4.
* modified pixel rendering support (pixel depth is now forced at compilation time).
[Core/CPU]
---------------
* optimized 68k core (rewrote 68k interrupt handling, removed multiple CPU types support & unused code) for 5~8% speed improvment
[Core/IO]
---------------
* added accurate emulation of Master System (315-5216, 315-5237, 315-5297) & Game Gear I/O controllers.
* added Terebi Oekaki tablet emulation.
* improved Mouse emulation (fixes mouse support in Cannon Fodder).
* improved Justifier emulation (fixes gun support in Lethal Enforcers 2).
* improved 6-Buttons control pad emulation (fixes Duke Nukem 3D)
* modified lightgun emulation to use common key inputs for all devices.
* 2-buttons controller is now picked by default for Master System games.
[Core/MD]
---------------
* added copy-protection hardware emulation for some new dumped games (Tiny Toon Adventures 3, Mighty Morphin Power Rangers & The Battle of Red Cliffs).
* added Game Toshokan in EEPROM database (verified on real cartridge).
* fixed Micro Machines 2 - Turbo Tournament EEPROM size (verified on real cartridge).
* modified SRAM banswitch hardware emulation to be more compatible with some hacks.
[Core/MS]
---------------
* added Cyborg Z to Korean mapper database.
[Core/GG]
---------------
* added 93C46 EEPROM emulation (Majors Pro Baseball, World Series Baseball & World Series Baseball 95).
[Core/General]
---------------
* added support for .mdx ROM format.
* added Game Gear & SG-1000 ROM support.
* added accurate emulation of SG-1000, Master System (I, II) & Game Gear hardware models for 100% compatibility.
* updated to new Genesis Plus license (see http://cgfm2.emuviews.com/)
* removed DOS port
* various code cleanup.
[Gamecube/Wii]
---------------
* IMPORTANT: cheats, screenshots & save files are now stored in console-specific directories (ex: /snaps/md, /cheats/ms, /saves/gg, ...)
* added 8-bit Action Replay & Game Genie codes support (for Master System & Game Gear games).
* improved audio/video synchronization for PAL games in 50Hz TV modes (now use VSYNC like NTSC games in 60hz modes).
* improved gun cursor positioning accuracy.
* improved horizontal scaling & screenshots rendering in H32 mode.
* fixed a bug with ROM file extension handling that would affect cheats, snapshots, sram & savestate files.
* removed ARAM/injected ROM support (unused).
* removed WPAD_ and PAD_ update from VSYNC callback.
* increased GCC inlining limits for some speed improvment.
* compiled with devkitPPC r24 & libogc 1.8.7.
2011-08-07 19:49:46 +02:00
|
|
|
* Redistribution and use of this code or any derivative works are permitted
|
|
|
|
* provided that the following conditions are met:
|
2011-07-14 00:49:52 +02:00
|
|
|
*
|
----------------------
Genesis Plus GX 1.6.0
----------------------
[Core/Sound]
---------------
* added YM2413 emulation in Master System compatibility mode.
* fixed SN76489 noise boost initialization.
* minor YM2612 core optimizations.
[Core/VDP]
---------------
* added accurate emulation of SG-1000, Master System (315-5124, 315-5246) & Game Gear VDP.
* added support for all TMS9918 rendering modes.
* improved Mega Drive VDP timings accuracy in Master System Compatibility mode.
* fixed color palette initialization.
* fixed shifted sprites rendering in Mode 4.
* modified pixel rendering support (pixel depth is now forced at compilation time).
[Core/CPU]
---------------
* optimized 68k core (rewrote 68k interrupt handling, removed multiple CPU types support & unused code) for 5~8% speed improvment
[Core/IO]
---------------
* added accurate emulation of Master System (315-5216, 315-5237, 315-5297) & Game Gear I/O controllers.
* added Terebi Oekaki tablet emulation.
* improved Mouse emulation (fixes mouse support in Cannon Fodder).
* improved Justifier emulation (fixes gun support in Lethal Enforcers 2).
* improved 6-Buttons control pad emulation (fixes Duke Nukem 3D)
* modified lightgun emulation to use common key inputs for all devices.
* 2-buttons controller is now picked by default for Master System games.
[Core/MD]
---------------
* added copy-protection hardware emulation for some new dumped games (Tiny Toon Adventures 3, Mighty Morphin Power Rangers & The Battle of Red Cliffs).
* added Game Toshokan in EEPROM database (verified on real cartridge).
* fixed Micro Machines 2 - Turbo Tournament EEPROM size (verified on real cartridge).
* modified SRAM banswitch hardware emulation to be more compatible with some hacks.
[Core/MS]
---------------
* added Cyborg Z to Korean mapper database.
[Core/GG]
---------------
* added 93C46 EEPROM emulation (Majors Pro Baseball, World Series Baseball & World Series Baseball 95).
[Core/General]
---------------
* added support for .mdx ROM format.
* added Game Gear & SG-1000 ROM support.
* added accurate emulation of SG-1000, Master System (I, II) & Game Gear hardware models for 100% compatibility.
* updated to new Genesis Plus license (see http://cgfm2.emuviews.com/)
* removed DOS port
* various code cleanup.
[Gamecube/Wii]
---------------
* IMPORTANT: cheats, screenshots & save files are now stored in console-specific directories (ex: /snaps/md, /cheats/ms, /saves/gg, ...)
* added 8-bit Action Replay & Game Genie codes support (for Master System & Game Gear games).
* improved audio/video synchronization for PAL games in 50Hz TV modes (now use VSYNC like NTSC games in 60hz modes).
* improved gun cursor positioning accuracy.
* improved horizontal scaling & screenshots rendering in H32 mode.
* fixed a bug with ROM file extension handling that would affect cheats, snapshots, sram & savestate files.
* removed ARAM/injected ROM support (unused).
* removed WPAD_ and PAD_ update from VSYNC callback.
* increased GCC inlining limits for some speed improvment.
* compiled with devkitPPC r24 & libogc 1.8.7.
2011-08-07 19:49:46 +02:00
|
|
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
|
|
|
* product or activity.
|
2011-07-14 00:49:52 +02:00
|
|
|
*
|
----------------------
Genesis Plus GX 1.6.0
----------------------
[Core/Sound]
---------------
* added YM2413 emulation in Master System compatibility mode.
* fixed SN76489 noise boost initialization.
* minor YM2612 core optimizations.
[Core/VDP]
---------------
* added accurate emulation of SG-1000, Master System (315-5124, 315-5246) & Game Gear VDP.
* added support for all TMS9918 rendering modes.
* improved Mega Drive VDP timings accuracy in Master System Compatibility mode.
* fixed color palette initialization.
* fixed shifted sprites rendering in Mode 4.
* modified pixel rendering support (pixel depth is now forced at compilation time).
[Core/CPU]
---------------
* optimized 68k core (rewrote 68k interrupt handling, removed multiple CPU types support & unused code) for 5~8% speed improvment
[Core/IO]
---------------
* added accurate emulation of Master System (315-5216, 315-5237, 315-5297) & Game Gear I/O controllers.
* added Terebi Oekaki tablet emulation.
* improved Mouse emulation (fixes mouse support in Cannon Fodder).
* improved Justifier emulation (fixes gun support in Lethal Enforcers 2).
* improved 6-Buttons control pad emulation (fixes Duke Nukem 3D)
* modified lightgun emulation to use common key inputs for all devices.
* 2-buttons controller is now picked by default for Master System games.
[Core/MD]
---------------
* added copy-protection hardware emulation for some new dumped games (Tiny Toon Adventures 3, Mighty Morphin Power Rangers & The Battle of Red Cliffs).
* added Game Toshokan in EEPROM database (verified on real cartridge).
* fixed Micro Machines 2 - Turbo Tournament EEPROM size (verified on real cartridge).
* modified SRAM banswitch hardware emulation to be more compatible with some hacks.
[Core/MS]
---------------
* added Cyborg Z to Korean mapper database.
[Core/GG]
---------------
* added 93C46 EEPROM emulation (Majors Pro Baseball, World Series Baseball & World Series Baseball 95).
[Core/General]
---------------
* added support for .mdx ROM format.
* added Game Gear & SG-1000 ROM support.
* added accurate emulation of SG-1000, Master System (I, II) & Game Gear hardware models for 100% compatibility.
* updated to new Genesis Plus license (see http://cgfm2.emuviews.com/)
* removed DOS port
* various code cleanup.
[Gamecube/Wii]
---------------
* IMPORTANT: cheats, screenshots & save files are now stored in console-specific directories (ex: /snaps/md, /cheats/ms, /saves/gg, ...)
* added 8-bit Action Replay & Game Genie codes support (for Master System & Game Gear games).
* improved audio/video synchronization for PAL games in 50Hz TV modes (now use VSYNC like NTSC games in 60hz modes).
* improved gun cursor positioning accuracy.
* improved horizontal scaling & screenshots rendering in H32 mode.
* fixed a bug with ROM file extension handling that would affect cheats, snapshots, sram & savestate files.
* removed ARAM/injected ROM support (unused).
* removed WPAD_ and PAD_ update from VSYNC callback.
* increased GCC inlining limits for some speed improvment.
* compiled with devkitPPC r24 & libogc 1.8.7.
2011-08-07 19:49:46 +02:00
|
|
|
* - Redistributions that are modified from the original source must include the
|
|
|
|
* complete source code, including the source code for all components used by a
|
|
|
|
* binary built from the modified sources. However, as a special exception, the
|
|
|
|
* source code distributed need not include anything that is normally distributed
|
|
|
|
* (in either source or binary form) with the major components (compiler, kernel,
|
|
|
|
* and so on) of the operating system on which the executable runs, unless that
|
|
|
|
* component itself accompanies the executable.
|
|
|
|
*
|
|
|
|
* - Redistributions must reproduce the above copyright notice, this list of
|
|
|
|
* conditions and the following disclaimer in the documentation and/or other
|
|
|
|
* materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
****************************************************************************************/
|
2011-07-14 00:49:52 +02:00
|
|
|
|
|
|
|
#include "shared.h"
|
|
|
|
|
|
|
|
#define TYPE_PRO1 0x12
|
|
|
|
#define TYPE_PRO2 0x22
|
|
|
|
|
|
|
|
static struct
|
|
|
|
{
|
|
|
|
uint8 enabled;
|
|
|
|
uint8 status;
|
2021-08-09 16:05:24 +02:00
|
|
|
uint8 ram[0x10000];
|
2011-07-14 00:49:52 +02:00
|
|
|
uint16 regs[13];
|
|
|
|
uint16 old[4];
|
|
|
|
uint16 data[4];
|
|
|
|
uint32 addr[4];
|
|
|
|
} action_replay;
|
|
|
|
|
|
|
|
static void ar_write_regs(uint32 address, uint32 data);
|
2021-08-09 16:05:24 +02:00
|
|
|
static void ar2_write_reg(uint32 address, uint32 data);
|
2011-07-14 00:49:52 +02:00
|
|
|
static void ar_write_ram_8(uint32 address, uint32 data);
|
|
|
|
|
|
|
|
void areplay_init(void)
|
|
|
|
{
|
2021-08-09 16:05:24 +02:00
|
|
|
action_replay.enabled = action_replay.status = 0;
|
2011-07-14 00:49:52 +02:00
|
|
|
|
2021-08-09 16:05:24 +02:00
|
|
|
/* try to load Action Replay ROM file (max. 64KB) */
|
|
|
|
if (load_archive(AR_ROM, cart.lockrom, 0x10000, NULL) > 0)
|
2011-07-14 00:49:52 +02:00
|
|
|
{
|
2021-08-09 16:05:24 +02:00
|
|
|
/* detect Action Replay board type */
|
|
|
|
if (!memcmp(cart.lockrom + 0x120, "ACTION REPLAY ", 16))
|
2011-07-14 00:49:52 +02:00
|
|
|
{
|
2021-08-09 16:05:24 +02:00
|
|
|
/* normal Action Replay (32KB ROM) */
|
|
|
|
action_replay.enabled = TYPE_AR;
|
|
|
|
|
|
|
|
/* $0000-$7fff mirrored into $8000-$ffff */
|
|
|
|
memcpy(cart.lockrom + 0x8000, cart.lockrom, 0x8000);
|
2011-07-14 00:49:52 +02:00
|
|
|
|
2021-08-09 16:05:24 +02:00
|
|
|
/* internal registers mapped at $010000-$01ffff */
|
|
|
|
m68k.memory_map[0x01].write16 = ar_write_regs;
|
|
|
|
}
|
|
|
|
else
|
2011-07-14 00:49:52 +02:00
|
|
|
{
|
2014-08-25 00:30:18 +02:00
|
|
|
/* Read stack pointer MSB */
|
2021-08-09 16:05:24 +02:00
|
|
|
uint8 sp = cart.lockrom[0x01];
|
2011-07-14 00:49:52 +02:00
|
|
|
|
|
|
|
/* Detect board version */
|
2021-08-09 16:05:24 +02:00
|
|
|
if ((sp == 0x42) && !memcmp(cart.lockrom + 0x120, "ACTION REPLAY 2 ", 16))
|
2011-07-14 00:49:52 +02:00
|
|
|
{
|
2021-08-09 16:05:24 +02:00
|
|
|
/* PRO Action Replay (2x32KB ROM) */
|
2011-07-14 00:49:52 +02:00
|
|
|
action_replay.enabled = TYPE_PRO1;
|
|
|
|
|
|
|
|
/* internal registers mapped at $010000-$01ffff */
|
[Core/SCD]
----------
* added Mega CD / Sega CD hardware emulation (incl. Sub 68K, CDD, CDC, PCM, GFX
rotation/scaling, etc)
* added .ISO & .BIN CD image file support
* added 512K backup cartridge RAM support
* added savestate support for CD games
NOTES:
~~~~~~
* to play CD games, original BIOS ROM files are required in /genplus/bios/
directory: unzip & rename them to bios_CD_U.bin, bios_CD_E.bin, bios_CD_J.bin
* CD audio tracks (CD-DA) are not supported (yet)
[Core/CPU]
----------
* modified 68k core for Mega CD / Sega CD support
[Core/VDP]
---------------
* improved DMA accuracy
* added support for 8-bit VRAM writes with undocumented code value (verified on
real hardware by Nemesis)
[Gamecube/Wii]
---------------
* modified Master System & Game Gear "BIOS" support (files should be named
bios_U.sms, bios_J.sms, bios_E.sms & bios.gg and copied to /genplus/bios
directory).
* replaced "Hard Reset" button by a Soft Reset for systems having a Reset button
(Mega Drive / Genesis & Master System)
* State & SRAM files are now only compressed when saving to Gamecube Memory
Cards
* various fixes & cleanup.
[Core/SCD]
----------
* added Mega CD / Sega CD hardware emulation (incl. Sub 68K, CDD, CDC, PCM, GFX
rotation/scaling, etc)
* added .ISO & .BIN CD image file support
* added 512K backup cartridge RAM support
* added savestate support for CD games
NOTES:
~~~~~~
* to play CD games, original BIOS ROM files are required in /genplus/bios/
directory: unzip & rename them to bios_CD_U.bin, bios_CD_E.bin, bios_CD_J.bin
* CD audio tracks (CD-DA) are not supported (yet)
[Core/CPU]
----------
* modified 68k core for Mega CD / Sega CD support
[Core/VDP]
---------------
* improved DMA accuracy
* added support for 8-bit VRAM writes with undocumented code value (verified on
real hardware by Nemesis)
[Gamecube/Wii]
---------------
* modified Master System & Game Gear "BIOS" support (files should be named
bios_U.sms, bios_J.sms, bios_E.sms & bios.gg and copied to /genplus/bios
directory).
* replaced "Hard Reset" button by a Soft Reset for systems having a Reset button
(Mega Drive / Genesis & Master System)
* State & SRAM files are now only compressed when saving to Gamecube Memory
Cards
* various fixes & cleanup.
2012-07-05 21:22:12 +02:00
|
|
|
m68k.memory_map[0x01].write16 = ar_write_regs;
|
2011-07-14 00:49:52 +02:00
|
|
|
}
|
2021-08-09 16:05:24 +02:00
|
|
|
else if ((sp == 0x60) && !memcmp(cart.lockrom + 0x3c6, "ACTION REPLAY II", 16))
|
2011-07-14 00:49:52 +02:00
|
|
|
{
|
2021-08-09 16:05:24 +02:00
|
|
|
/* PRO Action Replay 2 (2x32KB ROM) */
|
2011-07-14 00:49:52 +02:00
|
|
|
action_replay.enabled = TYPE_PRO2;
|
|
|
|
|
2021-08-09 16:05:24 +02:00
|
|
|
/* internal register mapped at $100000-$10ffff */
|
|
|
|
m68k.memory_map[0x10].write16 = ar2_write_reg;
|
2011-07-14 00:49:52 +02:00
|
|
|
}
|
|
|
|
|
2021-08-09 16:05:24 +02:00
|
|
|
/* internal RAM (64KB), mapped at $420000-$42ffff or $600000-$60ffff */
|
2011-07-14 00:49:52 +02:00
|
|
|
if (action_replay.enabled)
|
|
|
|
{
|
2014-08-25 00:30:18 +02:00
|
|
|
m68k.memory_map[sp].base = action_replay.ram;
|
|
|
|
m68k.memory_map[sp].read8 = NULL;
|
|
|
|
m68k.memory_map[sp].read16 = NULL;
|
|
|
|
m68k.memory_map[sp].write8 = ar_write_ram_8;
|
|
|
|
m68k.memory_map[sp].write16 = NULL;
|
2011-07-14 00:49:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-25 00:30:18 +02:00
|
|
|
#ifdef LSB_FIRST
|
2021-08-09 16:05:24 +02:00
|
|
|
if (action_replay.enabled)
|
2011-07-14 00:49:52 +02:00
|
|
|
{
|
2021-08-09 16:05:24 +02:00
|
|
|
int i;
|
|
|
|
for (i= 0; i<0x10000; i+=2)
|
|
|
|
{
|
|
|
|
/* Byteswap ROM */
|
|
|
|
uint8 temp = cart.lockrom[i];
|
|
|
|
cart.lockrom[i] = cart.lockrom[i+1];
|
|
|
|
cart.lockrom[i+1] = temp;
|
|
|
|
}
|
2011-07-14 00:49:52 +02:00
|
|
|
}
|
2014-08-25 00:30:18 +02:00
|
|
|
#endif
|
2021-08-09 16:05:24 +02:00
|
|
|
}
|
2011-07-14 00:49:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void areplay_shutdown(void)
|
|
|
|
{
|
|
|
|
/* clear existing patches */
|
|
|
|
areplay_set_status(AR_SWITCH_OFF);
|
|
|
|
|
|
|
|
/* disable device by default */
|
|
|
|
action_replay.enabled = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void areplay_reset(int hard)
|
|
|
|
{
|
|
|
|
if (action_replay.enabled)
|
|
|
|
{
|
|
|
|
if (hard || (action_replay.status == AR_SWITCH_TRAINER))
|
|
|
|
{
|
|
|
|
/* reset internal registers */
|
|
|
|
memset(action_replay.regs, 0, sizeof(action_replay.regs));
|
|
|
|
memset(action_replay.old, 0, sizeof(action_replay.old));
|
|
|
|
memset(action_replay.data, 0, sizeof(action_replay.data));
|
|
|
|
memset(action_replay.addr, 0, sizeof(action_replay.addr));
|
|
|
|
|
|
|
|
/* by default, internal ROM is mapped at $000000-$00FFFF */
|
2021-08-09 16:05:24 +02:00
|
|
|
m68k.memory_map[0].base = cart.lockrom;
|
2011-07-14 00:49:52 +02:00
|
|
|
|
|
|
|
/* reset internal RAM on power-on */
|
|
|
|
if (hard)
|
|
|
|
{
|
|
|
|
memset(action_replay.ram,0xff,0x10000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int areplay_get_status(void)
|
|
|
|
{
|
|
|
|
if (action_replay.enabled)
|
|
|
|
{
|
|
|
|
return action_replay.status;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void areplay_set_status(int status)
|
|
|
|
{
|
|
|
|
if (action_replay.enabled)
|
|
|
|
{
|
|
|
|
/* no Trainer mode for normal Action Replay */
|
|
|
|
if ((action_replay.enabled == TYPE_AR) && (status == AR_SWITCH_TRAINER))
|
|
|
|
{
|
|
|
|
status = AR_SWITCH_OFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check status changes */
|
|
|
|
switch (status)
|
|
|
|
{
|
|
|
|
case AR_SWITCH_OFF:
|
|
|
|
case AR_SWITCH_TRAINER:
|
|
|
|
{
|
|
|
|
/* check that patches were previously enabled */
|
|
|
|
if (action_replay.status == AR_SWITCH_ON)
|
|
|
|
{
|
|
|
|
/* restore original data */
|
|
|
|
*(uint16 *)(cart.rom + action_replay.addr[0]) = action_replay.old[0];
|
|
|
|
*(uint16 *)(cart.rom + action_replay.addr[1]) = action_replay.old[1];
|
|
|
|
*(uint16 *)(cart.rom + action_replay.addr[2]) = action_replay.old[2];
|
|
|
|
*(uint16 *)(cart.rom + action_replay.addr[3]) = action_replay.old[3];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case AR_SWITCH_ON:
|
|
|
|
{
|
|
|
|
/* check that patches were previously disabled */
|
|
|
|
if (action_replay.status != AR_SWITCH_ON)
|
|
|
|
{
|
|
|
|
/* decode patch data */
|
|
|
|
action_replay.data[0] = action_replay.regs[0];
|
|
|
|
action_replay.data[1] = action_replay.regs[4];
|
|
|
|
action_replay.data[2] = action_replay.regs[7];
|
|
|
|
action_replay.data[3] = action_replay.regs[10];
|
|
|
|
|
|
|
|
/* decode patch address ($000000-$7fffff) */
|
|
|
|
action_replay.addr[0] = (action_replay.regs[1] | ((action_replay.regs[2] & 0x3f00) << 8)) << 1;
|
|
|
|
action_replay.addr[1] = (action_replay.regs[5] | ((action_replay.regs[6] & 0x3f00) << 8)) << 1;
|
|
|
|
action_replay.addr[2] = (action_replay.regs[8] | ((action_replay.regs[9] & 0x3f00) << 8)) << 1;
|
|
|
|
action_replay.addr[3] = (action_replay.regs[11] | ((action_replay.regs[12] & 0x3f00) << 8)) << 1;
|
|
|
|
|
|
|
|
/* save original data */
|
|
|
|
action_replay.old[0] = *(uint16 *)(cart.rom + action_replay.addr[0]);
|
|
|
|
action_replay.old[1] = *(uint16 *)(cart.rom + action_replay.addr[1]);
|
|
|
|
action_replay.old[2] = *(uint16 *)(cart.rom + action_replay.addr[2]);
|
|
|
|
action_replay.old[3] = *(uint16 *)(cart.rom + action_replay.addr[3]);
|
|
|
|
|
|
|
|
/* patch new data */
|
|
|
|
*(uint16 *)(cart.rom + action_replay.addr[0]) = action_replay.data[0];
|
|
|
|
*(uint16 *)(cart.rom + action_replay.addr[1]) = action_replay.data[1];
|
|
|
|
*(uint16 *)(cart.rom + action_replay.addr[2]) = action_replay.data[2];
|
|
|
|
*(uint16 *)(cart.rom + action_replay.addr[3]) = action_replay.data[3];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* update status */
|
|
|
|
action_replay.status = status;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ar_write_regs(uint32 address, uint32 data)
|
|
|
|
{
|
|
|
|
/* register offset */
|
|
|
|
int offset = (address & 0xffff) >> 1;
|
|
|
|
if (offset > 12)
|
|
|
|
{
|
|
|
|
m68k_unused_16_w(address,data);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* update internal register */
|
|
|
|
action_replay.regs[offset] = data;
|
|
|
|
|
|
|
|
/* MODE register */
|
|
|
|
if (action_replay.regs[3] == 0xffff)
|
|
|
|
{
|
|
|
|
/* check switch status */
|
|
|
|
if (action_replay.status == AR_SWITCH_ON)
|
|
|
|
{
|
|
|
|
/* reset existing patches */
|
|
|
|
areplay_set_status(AR_SWITCH_OFF);
|
|
|
|
areplay_set_status(AR_SWITCH_ON);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* enable Cartridge ROM */
|
[Core/SCD]
----------
* added Mega CD / Sega CD hardware emulation (incl. Sub 68K, CDD, CDC, PCM, GFX
rotation/scaling, etc)
* added .ISO & .BIN CD image file support
* added 512K backup cartridge RAM support
* added savestate support for CD games
NOTES:
~~~~~~
* to play CD games, original BIOS ROM files are required in /genplus/bios/
directory: unzip & rename them to bios_CD_U.bin, bios_CD_E.bin, bios_CD_J.bin
* CD audio tracks (CD-DA) are not supported (yet)
[Core/CPU]
----------
* modified 68k core for Mega CD / Sega CD support
[Core/VDP]
---------------
* improved DMA accuracy
* added support for 8-bit VRAM writes with undocumented code value (verified on
real hardware by Nemesis)
[Gamecube/Wii]
---------------
* modified Master System & Game Gear "BIOS" support (files should be named
bios_U.sms, bios_J.sms, bios_E.sms & bios.gg and copied to /genplus/bios
directory).
* replaced "Hard Reset" button by a Soft Reset for systems having a Reset button
(Mega Drive / Genesis & Master System)
* State & SRAM files are now only compressed when saving to Gamecube Memory
Cards
* various fixes & cleanup.
[Core/SCD]
----------
* added Mega CD / Sega CD hardware emulation (incl. Sub 68K, CDD, CDC, PCM, GFX
rotation/scaling, etc)
* added .ISO & .BIN CD image file support
* added 512K backup cartridge RAM support
* added savestate support for CD games
NOTES:
~~~~~~
* to play CD games, original BIOS ROM files are required in /genplus/bios/
directory: unzip & rename them to bios_CD_U.bin, bios_CD_E.bin, bios_CD_J.bin
* CD audio tracks (CD-DA) are not supported (yet)
[Core/CPU]
----------
* modified 68k core for Mega CD / Sega CD support
[Core/VDP]
---------------
* improved DMA accuracy
* added support for 8-bit VRAM writes with undocumented code value (verified on
real hardware by Nemesis)
[Gamecube/Wii]
---------------
* modified Master System & Game Gear "BIOS" support (files should be named
bios_U.sms, bios_J.sms, bios_E.sms & bios.gg and copied to /genplus/bios
directory).
* replaced "Hard Reset" button by a Soft Reset for systems having a Reset button
(Mega Drive / Genesis & Master System)
* State & SRAM files are now only compressed when saving to Gamecube Memory
Cards
* various fixes & cleanup.
2012-07-05 21:22:12 +02:00
|
|
|
m68k.memory_map[0].base = cart.rom;
|
2011-07-14 00:49:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-09 16:05:24 +02:00
|
|
|
static void ar2_write_reg(uint32 address, uint32 data)
|
2011-07-14 00:49:52 +02:00
|
|
|
{
|
|
|
|
/* enable Cartridge ROM */
|
|
|
|
if (((address & 0xff) == 0x78) && (data == 0xffff))
|
|
|
|
{
|
[Core/SCD]
----------
* added Mega CD / Sega CD hardware emulation (incl. Sub 68K, CDD, CDC, PCM, GFX
rotation/scaling, etc)
* added .ISO & .BIN CD image file support
* added 512K backup cartridge RAM support
* added savestate support for CD games
NOTES:
~~~~~~
* to play CD games, original BIOS ROM files are required in /genplus/bios/
directory: unzip & rename them to bios_CD_U.bin, bios_CD_E.bin, bios_CD_J.bin
* CD audio tracks (CD-DA) are not supported (yet)
[Core/CPU]
----------
* modified 68k core for Mega CD / Sega CD support
[Core/VDP]
---------------
* improved DMA accuracy
* added support for 8-bit VRAM writes with undocumented code value (verified on
real hardware by Nemesis)
[Gamecube/Wii]
---------------
* modified Master System & Game Gear "BIOS" support (files should be named
bios_U.sms, bios_J.sms, bios_E.sms & bios.gg and copied to /genplus/bios
directory).
* replaced "Hard Reset" button by a Soft Reset for systems having a Reset button
(Mega Drive / Genesis & Master System)
* State & SRAM files are now only compressed when saving to Gamecube Memory
Cards
* various fixes & cleanup.
[Core/SCD]
----------
* added Mega CD / Sega CD hardware emulation (incl. Sub 68K, CDD, CDC, PCM, GFX
rotation/scaling, etc)
* added .ISO & .BIN CD image file support
* added 512K backup cartridge RAM support
* added savestate support for CD games
NOTES:
~~~~~~
* to play CD games, original BIOS ROM files are required in /genplus/bios/
directory: unzip & rename them to bios_CD_U.bin, bios_CD_E.bin, bios_CD_J.bin
* CD audio tracks (CD-DA) are not supported (yet)
[Core/CPU]
----------
* modified 68k core for Mega CD / Sega CD support
[Core/VDP]
---------------
* improved DMA accuracy
* added support for 8-bit VRAM writes with undocumented code value (verified on
real hardware by Nemesis)
[Gamecube/Wii]
---------------
* modified Master System & Game Gear "BIOS" support (files should be named
bios_U.sms, bios_J.sms, bios_E.sms & bios.gg and copied to /genplus/bios
directory).
* replaced "Hard Reset" button by a Soft Reset for systems having a Reset button
(Mega Drive / Genesis & Master System)
* State & SRAM files are now only compressed when saving to Gamecube Memory
Cards
* various fixes & cleanup.
2012-07-05 21:22:12 +02:00
|
|
|
m68k.memory_map[0].base = cart.rom;
|
2011-07-14 00:49:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ar_write_ram_8(uint32 address, uint32 data)
|
|
|
|
{
|
|
|
|
/* byte writes are handled as word writes, with LSB duplicated in MSB (/LWR is not used) */
|
|
|
|
*(uint16 *)(action_replay.ram + (address & 0xfffe)) = (data | (data << 8));
|
|
|
|
}
|