mirror of
https://github.com/libretro/Genesis-Plus-GX-Wide.git
synced 2024-11-26 18:10:21 +00:00
resync with non-wide
This commit is contained in:
parent
f634cc53fd
commit
bd809949e8
10
HISTORY.txt
10
HISTORY.txt
@ -29,6 +29,8 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke)
|
||||
* improved CDD "play" command accuracy (fixes "Snatcher" Act 2 starting cutscene)
|
||||
* improved CDD status report accuracy (fixes track looping with Mode 1 patched games using MSU-MD driver)
|
||||
* improved Word-RAM byte access accuracy (verified on schematics)
|
||||
* improved GFX processing accuracy to halt it while Word RAM is allocated to Main CPU in 2M mode
|
||||
* improved GFX timing accuracy (fixes "Night Striker" crashing after completing a game)
|
||||
* disabled 68k and Z80 access to PRG-RAM when SUB-CPU is running (fixes "Dungeon Explorer")
|
||||
* disabled CD hardware reset on Soft-Reset (verified on real hardware)
|
||||
* fixed potential load issues with non-zero backup RAM cart
|
||||
@ -78,6 +80,7 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke)
|
||||
---------------
|
||||
* added new SMS Power dumps in internal database
|
||||
* added support for Korean XX-in-1 mappers (thanks to Bock from SMS Power)
|
||||
* added missing GG-MS games in internal game database
|
||||
* improved console hardware auto-detection
|
||||
* improved emulation accuracy of SG-1000 & Mark-III hardware
|
||||
* improved emulation accuracy of Japanese Master System I/O chip (315-5297)
|
||||
@ -94,6 +97,7 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke)
|
||||
---------------
|
||||
* added support for new SMS Power Korean dumps (Star Soldier & Pippols)
|
||||
* added support for SG-1000 II clone hardware (2KB RAM + integrated VDP/PSG chip 315-5066)
|
||||
* added support for SG-1000 II hardware with 8KB RAM extension adapter
|
||||
* fixed SG-1000 internal RAM size (1KB instead of 2KB)
|
||||
* fixed savestates for games using external RAM
|
||||
* restored SG-1000 Pause button support
|
||||
@ -125,6 +129,8 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke)
|
||||
|
||||
[Core/VDP]
|
||||
---------------
|
||||
* added support for background color changes during HBLANK when display is disabled (fixes incorrect colored line in Yuu Yuu Hakusho)
|
||||
* added optional enhanced 2-cell vertical scroll rendering mode (credits to AlexKiri)
|
||||
* implemented proper FIFO ring-buffer & unused bits behavior on CRAM/VSRAM reads (verified on real hardware by Nemesis)
|
||||
* improved accuracy of DMA Copy/Fill & added support for CRAM/VSRAM Fill (verified on real hardware by Nemesis)
|
||||
* improved V28/V30 mode switching during active display (verified on real hardware)
|
||||
@ -133,6 +139,7 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke)
|
||||
* improved FIFO timings accuracy (fixes "Overdrive" Demo)
|
||||
* improved H-Counter accuracy in H32 mode
|
||||
* improved VDP status timing accuracy
|
||||
* improved HBLANK flag timing accuracy (verified on real hardware by Nemesis)
|
||||
* improved DMA timing accuracy during blanking (verified on real hardware by Mask of Destiny)
|
||||
* improved accuracy of Master System color palette brightness range (verified against real hardware)
|
||||
* fixed misaligned buffer writes in Mode 4 when -DALIGN_LONG option is used
|
||||
@ -168,8 +175,11 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke)
|
||||
* added configurable NTSC filter
|
||||
* added configurable FPS display & toggleable fast-forward key combo
|
||||
(HOME + MINUS with Wii controllers or R TRIGGER + START with Gamecube controller)
|
||||
* added configurable menu key combo
|
||||
* added 50hz progressive mode (576p) support for emulation
|
||||
* added WiiU GamePad Controller support on vWii (Fix94)
|
||||
* added support for Sega CD / Mega-CD PRG-RAM and Word-RAM cheat codes
|
||||
* added configurable overclock setting for M68K, S68K and Z80 CPUs
|
||||
* reduced SRAM files size
|
||||
* improved A/V Sync: when VSYNC is enabled, audio resampler output rate is now adjusted (+/-0,1 %)
|
||||
to always keep audio & video synchronized and input lag is reduced by one frame.
|
||||
|
@ -26,7 +26,7 @@ INCLUDES := core core/m68k core/z80 core/sound core/tremor core/ntsc core/input_
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
CFLAGS = -O3 -fomit-frame-pointer -Wall -Wno-strict-aliasing $(MACHDEP) $(INCLUDE) -DUSE_LIBTREMOR -DDISABLE_MANY_OGG_OPEN_FILES -DUSE_16BPP_RENDERING -DALT_RENDERER -DBLIP_INVERT
|
||||
CFLAGS = -O3 -fomit-frame-pointer -Wall -Wno-strict-aliasing $(MACHDEP) $(INCLUDE) -DUSE_LIBTREMOR -DDISABLE_MANY_OGG_OPEN_FILES -DUSE_16BPP_RENDERING -DALT_RENDERER -DBLIP_INVERT -DM68K_OVERCLOCK_SHIFT=20 -DZ80_OVERCLOCK_SHIFT=20
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
|
||||
LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
||||
|
@ -30,7 +30,7 @@ INCLUDES := core core/m68k core/z80 core/sound core/tremor core/ntsc core/input_
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
CFLAGS = -O3 -fomit-frame-pointer -Wall -Wno-strict-aliasing $(MACHDEP) $(INCLUDE) -DMAXROMSIZE=15728640 -DUSE_LIBTREMOR -DUSE_LIBCHDR -DUSE_16BPP_RENDERING -DALT_RENDERER -DBLIP_INVERT -DHW_RVL -DCPU_IS_BIG_ENDIAN=1 -DWORDS_BIGENDIAN=1 -DPACKAGE_VERSION=\"1.3.2\" -DFLAC_API_EXPORTS -DFLAC__HAS_OGG=0 -DHAVE_LROUND -DHAVE_STDINT_H -DHAVE_SYS_PARAM_H -D_7ZIP_ST
|
||||
CFLAGS = -O3 -fomit-frame-pointer -Wall -Wno-strict-aliasing $(MACHDEP) $(INCLUDE) -DMAXROMSIZE=15728640 -DUSE_LIBTREMOR -DUSE_LIBCHDR -DUSE_16BPP_RENDERING -DALT_RENDERER -DBLIP_INVERT -DHW_RVL -DCPU_IS_BIG_ENDIAN=1 -DWORDS_BIGENDIAN=1 -DPACKAGE_VERSION=\"1.3.2\" -DFLAC_API_EXPORTS -DFLAC__HAS_OGG=0 -DHAVE_LROUND -DHAVE_STDINT_H -DHAVE_SYS_PARAM_H -D_7ZIP_ST -DM68K_OVERCLOCK_SHIFT=20 -DZ80_OVERCLOCK_SHIFT=20
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
|
||||
LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
||||
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 3.8 MiB After Width: | Height: | Size: 3.8 MiB |
Binary file not shown.
Before Width: | Height: | Size: 4.0 MiB After Width: | Height: | Size: 4.0 MiB |
@ -47,7 +47,7 @@
|
||||
|
||||
T_EEPROM_93C eeprom_93c;
|
||||
|
||||
void eeprom_93c_init()
|
||||
void eeprom_93c_init(void)
|
||||
{
|
||||
/* default eeprom state */
|
||||
memset(&eeprom_93c, 0, sizeof(T_EEPROM_93C));
|
||||
|
@ -65,7 +65,7 @@ typedef struct
|
||||
extern T_EEPROM_93C eeprom_93c;
|
||||
|
||||
/* Function prototypes */
|
||||
extern void eeprom_93c_init();
|
||||
extern void eeprom_93c_init(void);
|
||||
extern void eeprom_93c_write(unsigned char data);
|
||||
extern unsigned char eeprom_93c_read(void);
|
||||
|
||||
|
@ -179,7 +179,7 @@ static struct
|
||||
/* I2C EEPROM mapper initialization */
|
||||
/********************************************************************/
|
||||
|
||||
void eeprom_i2c_init()
|
||||
void eeprom_i2c_init(void)
|
||||
{
|
||||
int i = sizeof(i2c_database) / sizeof(T_I2C_GAME) - 1;
|
||||
|
||||
@ -246,7 +246,7 @@ void eeprom_i2c_init()
|
||||
/* I2C EEPROM internal */
|
||||
/********************************************************************/
|
||||
|
||||
INLINE void Detect_START()
|
||||
INLINE void Detect_START(void)
|
||||
{
|
||||
/* detect SDA HIGH to LOW transition while SCL is held HIGH */
|
||||
if (eeprom_i2c.old_scl && eeprom_i2c.scl)
|
||||
@ -273,7 +273,7 @@ INLINE void Detect_START()
|
||||
}
|
||||
}
|
||||
|
||||
INLINE void Detect_STOP()
|
||||
INLINE void Detect_STOP(void)
|
||||
{
|
||||
/* detect SDA LOW to HIGH transition while SCL is held HIGH */
|
||||
if (eeprom_i2c.old_scl && eeprom_i2c.scl)
|
||||
|
@ -40,6 +40,6 @@
|
||||
#define _EEPROM_I2C_H_
|
||||
|
||||
/* Function prototypes */
|
||||
extern void eeprom_i2c_init();
|
||||
extern void eeprom_i2c_init(void);
|
||||
|
||||
#endif
|
||||
|
@ -72,7 +72,7 @@ typedef struct
|
||||
|
||||
static T_EEPROM_SPI spi_eeprom;
|
||||
|
||||
void eeprom_spi_init()
|
||||
void eeprom_spi_init(void)
|
||||
{
|
||||
/* reset eeprom state */
|
||||
memset(&spi_eeprom, 0, sizeof(T_EEPROM_SPI));
|
||||
|
@ -40,7 +40,7 @@
|
||||
#define _EEPROM_SPI_H_
|
||||
|
||||
/* Function prototypes */
|
||||
extern void eeprom_spi_init();
|
||||
extern void eeprom_spi_init(void);
|
||||
extern void eeprom_spi_write(unsigned char data);
|
||||
extern unsigned int eeprom_spi_read(unsigned int address);
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Genesis Plus
|
||||
* MegaSD flashcart CD hardware interface overlay & enhanced ROM mappers
|
||||
*
|
||||
* Copyright (C) 2020-2021 Eke-Eke (Genesis Plus GX)
|
||||
* Copyright (C) 2020-2022 Eke-Eke (Genesis Plus GX)
|
||||
*
|
||||
* Redistribution and use of this code or any derivative works are permitted
|
||||
* provided that the following conditions are met:
|
||||
@ -91,10 +91,13 @@ void megasd_reset(void)
|
||||
m68k.memory_map[0x03].write16 = megasd_ctrl_write_word;
|
||||
zbank_memory_map[0x03].read = megasd_ctrl_read_byte;
|
||||
|
||||
/* reset CD hardware */
|
||||
pcm_reset();
|
||||
cdd_reset();
|
||||
scd.regs[0x36>>1].byte.h = 0x01;
|
||||
/* reset CD hardware (only if not already emulated) */
|
||||
if (system_hw != SYSTEM_MCD)
|
||||
{
|
||||
pcm_reset();
|
||||
cdd_reset();
|
||||
scd.regs[0x36>>1].byte.h = 0x01;
|
||||
}
|
||||
}
|
||||
|
||||
int megasd_context_save(uint8 *state)
|
||||
@ -102,9 +105,14 @@ int megasd_context_save(uint8 *state)
|
||||
int bufferptr = 0;
|
||||
|
||||
save_param(&megasd_hw, sizeof(megasd_hw));
|
||||
bufferptr += cdd_context_save(&state[bufferptr]);
|
||||
bufferptr += pcm_context_save(&state[bufferptr]);
|
||||
save_param(&scd.regs[0x36>>1].byte.h, 1);
|
||||
|
||||
/* save needed CD hardware state (only if not already saved) */
|
||||
if (system_hw != SYSTEM_MCD)
|
||||
{
|
||||
bufferptr += cdd_context_save(&state[bufferptr]);
|
||||
bufferptr += pcm_context_save(&state[bufferptr]);
|
||||
save_param(&scd.regs[0x36>>1].byte.h, 1);
|
||||
}
|
||||
|
||||
return bufferptr;
|
||||
}
|
||||
@ -114,9 +122,14 @@ int megasd_context_load(uint8 *state)
|
||||
int bufferptr = 0;
|
||||
|
||||
load_param(&megasd_hw, sizeof(megasd_hw));
|
||||
bufferptr += cdd_context_load(&state[bufferptr], STATE_VERSION);
|
||||
bufferptr += pcm_context_load(&state[bufferptr]);
|
||||
load_param(&scd.regs[0x36>>1].byte.h, 1);
|
||||
|
||||
/* load needed CD hardware state (only if not already loaded) */
|
||||
if (system_hw != SYSTEM_MCD)
|
||||
{
|
||||
bufferptr += cdd_context_load(&state[bufferptr], STATE_VERSION);
|
||||
bufferptr += pcm_context_load(&state[bufferptr]);
|
||||
load_param(&scd.regs[0x36>>1].byte.h, 1);
|
||||
}
|
||||
|
||||
return bufferptr;
|
||||
}
|
||||
@ -335,7 +348,15 @@ void megasd_update_cdda(unsigned int samples)
|
||||
|
||||
while (samples > 0)
|
||||
{
|
||||
/* attempt to read remaing needed samples by default */
|
||||
/* check if audio playback is paused or stopped */
|
||||
if (scd.regs[0x36>>1].byte.h == 0x01)
|
||||
{
|
||||
/* clear remaining needed CD-DA samples without updating counters */
|
||||
cdd_read_audio(samples);
|
||||
break;
|
||||
}
|
||||
|
||||
/* attempt to read remaining needed samples by default */
|
||||
count = samples;
|
||||
|
||||
/* check against fade out remaining samples */
|
||||
@ -353,7 +374,7 @@ void megasd_update_cdda(unsigned int samples)
|
||||
/* read required CD-DA samples */
|
||||
cdd_read_audio(count);
|
||||
|
||||
/* adjust remaing needed samples count */
|
||||
/* adjust remaining needed samples count */
|
||||
samples -= count;
|
||||
|
||||
/* check if fade out is still in progress */
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Genesis Plus
|
||||
* MegaSD flashcart CD hardware interface overlay & enhanced ROM mappers
|
||||
*
|
||||
* Copyright (C) 2020-2021 Eke-Eke (Genesis Plus GX)
|
||||
* Copyright (C) 2020-2022 Eke-Eke (Genesis Plus GX)
|
||||
*
|
||||
* Redistribution and use of this code or any derivative works are permitted
|
||||
* provided that the following conditions are met:
|
||||
|
@ -45,7 +45,6 @@
|
||||
#define MAPPER_RAM_2K (0x02)
|
||||
#define MAPPER_RAM_8K (0x03)
|
||||
#define MAPPER_RAM_8K_EXT1 (0x04)
|
||||
#define MAPPER_RAM_8K_EXT2 (0x05)
|
||||
#define MAPPER_SEGA (0x10)
|
||||
#define MAPPER_SEGA_X (0x11)
|
||||
#define MAPPER_93C46 (0x12)
|
||||
@ -160,7 +159,7 @@ static const rominfo_t game_list[] =
|
||||
/* games using 8KB external RAM (volatile) */
|
||||
{0x092F29D6, 0, 0, 0, MAPPER_RAM_8K, SYSTEM_SG, REGION_JAPAN_NTSC}, /* The Castle (J) */
|
||||
|
||||
/* games requiring SG-1000 II 8K RAM extension adapters */
|
||||
/* games requiring SG-1000 II 8K RAM extension adapter (type A) */
|
||||
{0xCE5648C3, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Bomberman Special [DahJee] (TW) */
|
||||
{0x223397A1, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* King's Valley (TW) */
|
||||
{0x281D2888, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Knightmare (TW) */
|
||||
@ -172,11 +171,13 @@ static const rominfo_t game_list[] =
|
||||
{0xFC87463C, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Yie Ar Kung-Fu II (TW) */
|
||||
{0xDF7CBFA5, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Pippols (TW) */
|
||||
{0xE0816BB7, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Star Soldier (TW) */
|
||||
{0x69FC1494, 0, 0, 0, MAPPER_RAM_8K_EXT2, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Bomberman Special (TW) */
|
||||
{0xFFC4EE3F, 0, 0, 0, MAPPER_RAM_8K_EXT2, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Magical Kid Wiz (TW) */
|
||||
{0x2E366CCF, 0, 0, 0, MAPPER_RAM_8K_EXT2, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* The Castle (TW) */
|
||||
{0xAAAC12CF, 0, 0, 0, MAPPER_RAM_8K_EXT2, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Rally-X (TW) */
|
||||
{0xD2EDD329, 0, 0, 0, MAPPER_RAM_8K_EXT2, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Road Fighter (TW) */
|
||||
|
||||
/* games requiring SG-1000 II 8K RAM extension adapter (type B) */
|
||||
{0x69FC1494, 0, 0, 0, MAPPER_NONE, SYSTEM_SGII_RAM_EXT, REGION_JAPAN_NTSC}, /* Bomberman Special (TW) */
|
||||
{0xFFC4EE3F, 0, 0, 0, MAPPER_NONE, SYSTEM_SGII_RAM_EXT, REGION_JAPAN_NTSC}, /* Magical Kid Wiz (TW) */
|
||||
{0x2E366CCF, 0, 0, 0, MAPPER_NONE, SYSTEM_SGII_RAM_EXT, REGION_JAPAN_NTSC}, /* The Castle (TW) */
|
||||
{0xAAAC12CF, 0, 0, 0, MAPPER_NONE, SYSTEM_SGII_RAM_EXT, REGION_JAPAN_NTSC}, /* Rally-X (TW) */
|
||||
{0xD2EDD329, 0, 0, 0, MAPPER_NONE, SYSTEM_SGII_RAM_EXT, REGION_JAPAN_NTSC}, /* Road Fighter (TW) */
|
||||
|
||||
/* games requiring 2KB internal RAM (SG-1000 II clone hardware) */
|
||||
{0x7F7F009D, 0, 0, 0, MAPPER_NONE, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Circus Charlie (KR) */
|
||||
@ -226,36 +227,40 @@ static const rominfo_t game_list[] =
|
||||
{0xE5F789B9, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Predator 2 [SMS-GG] */
|
||||
{0x311D2863, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Prince of Persia [A][SMS-GG] */
|
||||
{0x45F058D6, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Prince of Persia [B][SMS-GG] */
|
||||
{0x9C76FB3A, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Rastan Saga [SMS-GG] */
|
||||
{0x56201996, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* R.C. Grand Prix [SMS-GG] */
|
||||
{0x10DBBEF4, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Super Kick Off [SMS-GG] */
|
||||
{0xC8381DEF, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Taito Chase H.Q [SMS-GG] */
|
||||
{0xDA8E95A9, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* WWF Wrestlemania Steel Cage Challenge [SMS-GG] */
|
||||
{0x9942B69B, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Castle of Illusion - Starring Mickey Mouse (J) [SMS-GG] */
|
||||
{0x7BB81E3D, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Taito Chase H.Q (J) [SMS-GG] */
|
||||
{0x6630E5FD, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Aerial Assault (TW) [SMS-GG] */
|
||||
{0x6F8E46CF, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Alex Kidd in Miracle World (TW) [SMS-GG] */
|
||||
{0x5E4B454E, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Argos no Juujiken (TW) [SMS-GG] */
|
||||
{0x98F64975, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Black Belt (TW) [SMS-GG] */
|
||||
{0x55f929ce, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Choplifter (TW) [SMS-GG] */
|
||||
{0x9942B69B, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Castle of Illusion - Starring Mickey Mouse (J) [SMS-GG] */
|
||||
{0x55F929CE, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Choplifter (TW) [SMS-GG] */
|
||||
{0xAD9FF469, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Cyber Shinobi, The (TW) [SMS-GG] */
|
||||
{0xFB163003, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Doki Doki Penguin Land - Uchuu-Daibouken (TW) [SMS-GG] */
|
||||
{0xF4F848C2, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Double Dragon (TW) [SMS-GG] */
|
||||
{0x96e16fe4, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* E-SWAT [v1] (TW) [SMS-GG] */
|
||||
{0x96E16FE4, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* E-SWAT [v1] (TW) [SMS-GG] */
|
||||
{0xB948752E, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Final Bubble Bobble (TW) [SMS-GG] */
|
||||
{0x44136A72, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Forgotten Worlds (TW) [SMS-GG] */
|
||||
{0x6FE448A5, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Great Basketball (TW) [SMS-GG] */
|
||||
{0xB6207F0D, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Hokuto no Ken (TW) [SMS-GG] */
|
||||
{0x4762E022, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Kung Fu Kid (TW) [SMS-GG] */
|
||||
{0x7EAED675, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Lord of Sword (TW) [SMS-GG] */
|
||||
{0x3382D73F, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Olympic Gold (TW) [SMS-GG] */
|
||||
{0x354BEE78, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Paperboy [v1] (TW) [SMS-GG] */
|
||||
{0xCAFD2D83, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Prince of Persia (TW) [SMS-GG] */
|
||||
{0xCACDF759, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Quartet (TW) [SMS-GG] */
|
||||
{0xE532716F, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* R-Type (TW) [SMS-GG] */
|
||||
{0x9C76FB3A, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Rastan Saga (J) [SMS-GG] */
|
||||
{0x7D59283B, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Scramble Spirits (TW) [SMS-GG] */
|
||||
{0x89EFCC22, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Secret Command (TW) [SMS-GG] */
|
||||
{0xD0263024, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Seishun Scandal (TW) [SMS-GG] */
|
||||
{0xAB67C6BD, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Shadow Dancer - The Secret Of Shinobi (TW) [SMS-GG] */
|
||||
{0xAC2EA669, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Shadow of the Beast (TW) [SMS-GG] */
|
||||
{0x63A7F906, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Strider (TW) [SMS-GG] */
|
||||
{0xD282EF71, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Submarine Attack (TW) [SMS-GG] */
|
||||
{0x7BB81E3D, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Taito Chase H.Q (J) [SMS-GG] */
|
||||
{0x98CF1254, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Thunder Blade (TW) [SMS-GG] */
|
||||
|
||||
/* games requiring 3-D Glasses */
|
||||
@ -879,13 +884,13 @@ static void mapper_reset(void)
|
||||
int i;
|
||||
|
||||
/* reset $C000-$FFFF mapping */
|
||||
if (cart_rom.mapper == MAPPER_RAM_8K_EXT2)
|
||||
if (system_hw == SYSTEM_SG)
|
||||
{
|
||||
/* 8KB RAM extension adapter (type B) */
|
||||
/* original SG-1000 hardware has only 1KB internal RAM */
|
||||
for (i = 0x30; i < 0x40; i++)
|
||||
{
|
||||
/* $C000-$FFFF mapped to 8KB external RAM (mirrored) */
|
||||
z80_readmap[i] = z80_writemap[i] = &work_ram[(i & 0x07) << 10];
|
||||
/* $C000-$FFFF mapped to 1KB internal RAM (mirrored) */
|
||||
z80_readmap[i] = z80_writemap[i] = &work_ram[0];
|
||||
}
|
||||
}
|
||||
else if (system_hw == SYSTEM_SGII)
|
||||
@ -897,18 +902,9 @@ static void mapper_reset(void)
|
||||
z80_readmap[i] = z80_writemap[i] = &work_ram[(i & 0x01) << 10];
|
||||
}
|
||||
}
|
||||
else if (system_hw == SYSTEM_SG)
|
||||
{
|
||||
/* default SG-1000 hardware has only 1KB internal RAM */
|
||||
for (i = 0x30; i < 0x40; i++)
|
||||
{
|
||||
/* $C000-$FFFF mapped to 1KB internal RAM (mirrored) */
|
||||
z80_readmap[i] = z80_writemap[i] = &work_ram[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Mark III / Master System / Game Gear hardware */
|
||||
/* Mark III / Master System / Game Gear hardware or SG-1000 II hardware with 8KB RAM extension adapter (type B) */
|
||||
for (i = 0x30; i < 0x40; i++)
|
||||
{
|
||||
/* $C000-$FFFF mapped to 8KB internal RAM (mirrored) */
|
||||
|
@ -59,7 +59,7 @@ T_SRAM sram;
|
||||
*
|
||||
* Assuming max. 64k backup RAM throughout
|
||||
****************************************************************************/
|
||||
void sram_init()
|
||||
void sram_init(void)
|
||||
{
|
||||
/* disable Backup RAM by default */
|
||||
sram.detected = sram.on = sram.custom = sram.start = sram.end = 0;
|
||||
|
@ -51,7 +51,7 @@ typedef struct
|
||||
} T_SRAM;
|
||||
|
||||
/* Function prototypes */
|
||||
extern void sram_init();
|
||||
extern void sram_init(void);
|
||||
extern unsigned int sram_read_byte(unsigned int address);
|
||||
extern unsigned int sram_read_word(unsigned int address);
|
||||
extern void sram_write_byte(unsigned int address, unsigned int data);
|
||||
|
222
core/cd_hw/gfx.c
222
core/cd_hw/gfx.c
@ -586,132 +586,146 @@ INLINE void gfx_render(uint32 bufferIndex, uint32 width)
|
||||
|
||||
void gfx_start(unsigned int base, int cycles)
|
||||
{
|
||||
/* make sure 2M mode is enabled */
|
||||
if (!(scd.regs[0x02>>1].byte.l & 0x04))
|
||||
uint32 mask;
|
||||
|
||||
/* trace vector pointer */
|
||||
gfx.tracePtr = (uint16 *)(scd.word_ram_2M + ((base << 2) & 0x3fff8));
|
||||
|
||||
/* stamps & stamp map size */
|
||||
switch ((scd.regs[0x58>>1].byte.l >> 1) & 0x03)
|
||||
{
|
||||
uint32 mask;
|
||||
|
||||
/* trace vector pointer */
|
||||
gfx.tracePtr = (uint16 *)(scd.word_ram_2M + ((base << 2) & 0x3fff8));
|
||||
case 0:
|
||||
gfx.dotMask = 0x07ffff; /* 256x256 dots/map */
|
||||
gfx.stampShift = 11 + 4; /* 16x16 dots/stamps */
|
||||
gfx.mapShift = 4; /* 16x16 stamps/map */
|
||||
mask = 0x3fe00; /* 512 bytes/table */
|
||||
break;
|
||||
|
||||
/* stamps & stamp map size */
|
||||
switch ((scd.regs[0x58>>1].byte.l >> 1) & 0x03)
|
||||
{
|
||||
case 0:
|
||||
gfx.dotMask = 0x07ffff; /* 256x256 dots/map */
|
||||
gfx.stampShift = 11 + 4; /* 16x16 dots/stamps */
|
||||
gfx.mapShift = 4; /* 16x16 stamps/map */
|
||||
mask = 0x3fe00; /* 512 bytes/table */
|
||||
break;
|
||||
case 1:
|
||||
gfx.dotMask = 0x07ffff; /* 256x256 dots/map */
|
||||
gfx.stampShift = 11 + 5; /* 32x32 dots/stamps */
|
||||
gfx.mapShift = 3; /* 8x8 stamps/map */
|
||||
mask = 0x3ff80; /* 128 bytes/table */
|
||||
break;
|
||||
|
||||
case 1:
|
||||
gfx.dotMask = 0x07ffff; /* 256x256 dots/map */
|
||||
gfx.stampShift = 11 + 5; /* 32x32 dots/stamps */
|
||||
gfx.mapShift = 3; /* 8x8 stamps/map */
|
||||
mask = 0x3ff80; /* 128 bytes/table */
|
||||
break;
|
||||
case 2:
|
||||
gfx.dotMask = 0x7fffff; /* 4096*4096 dots/map */
|
||||
gfx.stampShift = 11 + 4; /* 16x16 dots/stamps */
|
||||
gfx.mapShift = 8; /* 256x256 stamps/map */
|
||||
mask = 0x20000; /* 131072 bytes/table */
|
||||
break;
|
||||
|
||||
case 2:
|
||||
gfx.dotMask = 0x7fffff; /* 4096*4096 dots/map */
|
||||
gfx.stampShift = 11 + 4; /* 16x16 dots/stamps */
|
||||
gfx.mapShift = 8; /* 256x256 stamps/map */
|
||||
mask = 0x20000; /* 131072 bytes/table */
|
||||
break;
|
||||
|
||||
case 3:
|
||||
gfx.dotMask = 0x7fffff; /* 4096*4096 dots/map */
|
||||
gfx.stampShift = 11 + 5; /* 32x32 dots/stamps */
|
||||
gfx.mapShift = 7; /* 128x128 stamps/map */
|
||||
mask = 0x38000; /* 32768 bytes/table */
|
||||
break;
|
||||
}
|
||||
|
||||
/* stamp map table base address */
|
||||
gfx.mapPtr = (uint16 *)(scd.word_ram_2M + ((scd.regs[0x5a>>1].w << 2) & mask));
|
||||
|
||||
/* image buffer column offset (64 pixels/cell, minus 7 pixels to restart at cell beginning) */
|
||||
gfx.bufferOffset = (((scd.regs[0x5c>>1].byte.l & 0x1f) + 1) << 6) - 7;
|
||||
|
||||
/* image buffer start index in dot units (2 pixels/byte) */
|
||||
gfx.bufferStart = (scd.regs[0x5e>>1].w << 3) & 0x7ffc0;
|
||||
|
||||
/* add image buffer horizontal dot offset */
|
||||
gfx.bufferStart += (scd.regs[0x60>>1].byte.l & 0x3f);
|
||||
|
||||
/* reset GFX chip cycle counter */
|
||||
gfx.cycles = cycles;
|
||||
|
||||
/* update GFX chip timings (see AC3:Thunderhawk / Thunderstrike) */
|
||||
gfx.cyclesPerLine = 4 * 5 * scd.regs[0x62>>1].w;
|
||||
|
||||
/* start graphics operation */
|
||||
scd.regs[0x58>>1].byte.h = 0x80;
|
||||
case 3:
|
||||
gfx.dotMask = 0x7fffff; /* 4096*4096 dots/map */
|
||||
gfx.stampShift = 11 + 5; /* 32x32 dots/stamps */
|
||||
gfx.mapShift = 7; /* 128x128 stamps/map */
|
||||
mask = 0x38000; /* 32768 bytes/table */
|
||||
break;
|
||||
}
|
||||
|
||||
/* stamp map table base address */
|
||||
gfx.mapPtr = (uint16 *)(scd.word_ram_2M + ((scd.regs[0x5a>>1].w << 2) & mask));
|
||||
|
||||
/* image buffer column offset (64 pixels/cell, minus 7 pixels to restart at cell beginning) */
|
||||
gfx.bufferOffset = (((scd.regs[0x5c>>1].byte.l & 0x1f) + 1) << 6) - 7;
|
||||
|
||||
/* image buffer start index in dot units (2 pixels/byte) */
|
||||
gfx.bufferStart = (scd.regs[0x5e>>1].w << 3) & 0x7ffc0;
|
||||
|
||||
/* add image buffer horizontal dot offset */
|
||||
gfx.bufferStart += (scd.regs[0x60>>1].byte.l & 0x3f);
|
||||
|
||||
/* reset GFX chip cycle counter */
|
||||
gfx.cycles = cycles;
|
||||
|
||||
/* update GFX chip timings (see AC3:Thunderhawk / Thunderstrike, Night Striker) */
|
||||
/* number of Word-RAM accesses per image buffer rendered line: */
|
||||
/* . 4 initial read accesses (Xposition, Yposition, Xoffset and Yoffset) */
|
||||
/* . 2 read accesses per rendered pixels (stamp map + stamp pixel data) */
|
||||
/* . 1 read-modify-write access per group of 4 rendered pixels */
|
||||
/* each access (read or read-modify-write) takes 3 SUB-CPU cycles by default */
|
||||
/* each access can be delayed by 1 to 3 CPU cycles in case of refresh or SUB-CPU access occuring on the same Word-RAM bank (not emulated) */
|
||||
/* reference: https://github.com/MiSTer-devel/MegaCD_MiSTer/blob/master/docs/mcd%20logs/graphics_operations_and_68k_wordram_access.jpg */
|
||||
/* TODO: figure what happen exactly when pixel offset is different from 0 */
|
||||
/* for the moment, one additional read-modify-write access is assumed at the start if pixel offset is not aligned to 4 pixels */
|
||||
gfx.cyclesPerLine = 4 * 3 * (4 + 2 * scd.regs[0x62>>1].w + ((scd.regs[0x62>>1].w + (scd.regs[0x60>>1].byte.l & 0x03) + 3) >> 2));
|
||||
|
||||
/* start graphics operation */
|
||||
scd.regs[0x58>>1].byte.h = 0x80;
|
||||
}
|
||||
|
||||
void gfx_update(int cycles)
|
||||
{
|
||||
/* synchronize GFX chip with SUB-CPU */
|
||||
cycles -= gfx.cycles;
|
||||
|
||||
/* make sure SUB-CPU is ahead */
|
||||
if (cycles > 0)
|
||||
/* make sure Word-RAM is assigned to SUB-CPU in 2M mode */
|
||||
if ((scd.regs[0x02>>1].byte.l & 0x05) != 0x01)
|
||||
{
|
||||
/* number of lines to process */
|
||||
unsigned int lines = (cycles + gfx.cyclesPerLine - 1) / gfx.cyclesPerLine;
|
||||
/* synchronize GFX processing with SUB-CPU */
|
||||
cycles -= gfx.cycles;
|
||||
|
||||
/* check against remaining lines */
|
||||
if (lines < scd.regs[0x64>>1].byte.l)
|
||||
/* make sure SUB-CPU is ahead */
|
||||
if (cycles > 0)
|
||||
{
|
||||
/* update Vdot remaining size */
|
||||
scd.regs[0x64>>1].byte.l -= lines;
|
||||
/* number of lines to process */
|
||||
unsigned int lines = (cycles + gfx.cyclesPerLine - 1) / gfx.cyclesPerLine;
|
||||
|
||||
/* increment cycle counter */
|
||||
gfx.cycles += lines * gfx.cyclesPerLine;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* process remaining lines */
|
||||
lines = scd.regs[0x64>>1].byte.l;
|
||||
|
||||
/* clear Vdot remaining size */
|
||||
scd.regs[0x64>>1].byte.l = 0;
|
||||
|
||||
/* end of graphics operation */
|
||||
scd.regs[0x58>>1].byte.h = 0;
|
||||
|
||||
/* SUB-CPU idle on register $58 polling ? */
|
||||
if (s68k.stopped & (1<<0x08))
|
||||
/* check against remaining lines */
|
||||
if (lines < scd.regs[0x64>>1].byte.l)
|
||||
{
|
||||
/* sync SUB-CPU with GFX chip */
|
||||
s68k.cycles = scd.cycles;
|
||||
/* update Vdot remaining size */
|
||||
scd.regs[0x64>>1].byte.l -= lines;
|
||||
|
||||
/* restart SUB-CPU */
|
||||
s68k.stopped = 0;
|
||||
/* increment cycle counter */
|
||||
gfx.cycles += lines * gfx.cyclesPerLine;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* process remaining lines */
|
||||
lines = scd.regs[0x64>>1].byte.l;
|
||||
|
||||
/* clear Vdot remaining size */
|
||||
scd.regs[0x64>>1].byte.l = 0;
|
||||
|
||||
/* end of graphics operation */
|
||||
scd.regs[0x58>>1].byte.h = 0;
|
||||
|
||||
/* SUB-CPU idle on register $58 polling ? */
|
||||
if (s68k.stopped & (1<<0x08))
|
||||
{
|
||||
/* sync SUB-CPU with GFX chip */
|
||||
s68k.cycles = scd.cycles;
|
||||
|
||||
/* restart SUB-CPU */
|
||||
s68k.stopped = 0;
|
||||
#ifdef LOG_SCD
|
||||
error("s68k started from %d cycles\n", s68k.cycles);
|
||||
error("s68k started from %d cycles\n", s68k.cycles);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* level 1 interrupt enabled ? */
|
||||
if (scd.regs[0x32>>1].byte.l & 0x02)
|
||||
{
|
||||
/* trigger level 1 interrupt */
|
||||
scd.pending |= (1 << 1);
|
||||
|
||||
/* update IRQ level */
|
||||
s68k_update_irq((scd.pending & scd.regs[0x32>>1].byte.l) >> 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* level 1 interrupt enabled ? */
|
||||
if (scd.regs[0x32>>1].byte.l & 0x02)
|
||||
/* render lines */
|
||||
while (lines--)
|
||||
{
|
||||
/* trigger level 1 interrupt */
|
||||
scd.pending |= (1 << 1);
|
||||
/* process dots to image buffer */
|
||||
gfx_render(gfx.bufferStart, scd.regs[0x62>>1].w);
|
||||
|
||||
/* update IRQ level */
|
||||
s68k_update_irq((scd.pending & scd.regs[0x32>>1].byte.l) >> 1);
|
||||
/* increment image buffer start index for next line (8 pixels/line) */
|
||||
gfx.bufferStart += 8;
|
||||
}
|
||||
}
|
||||
|
||||
/* render lines */
|
||||
while (lines--)
|
||||
{
|
||||
/* process dots to image buffer */
|
||||
gfx_render(gfx.bufferStart, scd.regs[0x62>>1].w);
|
||||
|
||||
/* increment image buffer start index for next line (8 pixels/line) */
|
||||
gfx.bufferStart += 8;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* GFX processing is halted */
|
||||
gfx.cycles = cycles;
|
||||
}
|
||||
}
|
||||
|
@ -934,6 +934,13 @@ static void scd_write_byte(unsigned int address, unsigned int data)
|
||||
/* RET bit set in 2M mode */
|
||||
if (data & 0x01)
|
||||
{
|
||||
/* check if graphics operation is running */
|
||||
if (scd.regs[0x58>>1].byte.h & 0x80)
|
||||
{
|
||||
/* synchronize GFX processing with SUB-CPU */
|
||||
gfx_update(s68k.cycles);
|
||||
}
|
||||
|
||||
/* Word-RAM is returned to MAIN-CPU */
|
||||
scd.dmna = 0;
|
||||
|
||||
@ -1198,6 +1205,13 @@ static void scd_write_word(unsigned int address, unsigned int data)
|
||||
/* RET bit set in 2M mode */
|
||||
if (data & 0x01)
|
||||
{
|
||||
/* check if graphics operation is running */
|
||||
if (scd.regs[0x58>>1].byte.h & 0x80)
|
||||
{
|
||||
/* synchronize GFX processing with SUB-CPU */
|
||||
gfx_update(s68k.cycles);
|
||||
}
|
||||
|
||||
/* Word-RAM is returned to MAIN-CPU */
|
||||
scd.dmna = 0;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Support for SG-1000, Mark-III, Master System, Game Gear, Mega Drive & Mega CD hardware
|
||||
*
|
||||
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
||||
* Copyright (C) 2007-2021 Eke-Eke (Genesis Plus GX)
|
||||
* Copyright (C) 2007-2022 Eke-Eke (Genesis Plus GX)
|
||||
*
|
||||
* Redistribution and use of this code or any derivative works are permitted
|
||||
* provided that the following conditions are met:
|
||||
@ -223,6 +223,7 @@ void gen_init(void)
|
||||
/* SG-1000 hardware */
|
||||
case SYSTEM_SG:
|
||||
case SYSTEM_SGII:
|
||||
case SYSTEM_SGII_RAM_EXT:
|
||||
{
|
||||
z80_writeport = z80_sg_port_w;
|
||||
z80_readport = z80_sg_port_r;
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Support for SG-1000, Mark-III, Master System, Game Gear, Mega Drive & Mega CD hardware
|
||||
*
|
||||
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
||||
* Copyright (C) 2007-2021 Eke-Eke (Genesis Plus GX)
|
||||
* Copyright (C) 2007-2022 Eke-Eke (Genesis Plus GX)
|
||||
*
|
||||
* Redistribution and use of this code or any derivative works are permitted
|
||||
* provided that the following conditions are met:
|
||||
|
@ -56,7 +56,7 @@ void mouse_reset(int port)
|
||||
mouse.Port = port;
|
||||
}
|
||||
|
||||
unsigned char mouse_read()
|
||||
unsigned char mouse_read(void)
|
||||
{
|
||||
unsigned int temp = 0x00;
|
||||
int x = input.analog[mouse.Port][0];
|
||||
|
@ -348,7 +348,7 @@ void s68k_pulse_halt(void)
|
||||
CPU_STOPPED |= STOP_LEVEL_HALT;
|
||||
}
|
||||
|
||||
void s68k_clear_halt()
|
||||
void s68k_clear_halt(void)
|
||||
{
|
||||
/* Clear the HALT line on the CPU */
|
||||
CPU_STOPPED &= ~STOP_LEVEL_HALT;
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Main 68k bus handlers
|
||||
*
|
||||
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
||||
* Copyright (C) 2007-2019 Eke-Eke (Genesis Plus GX)
|
||||
* Copyright (C) 2007-2022 Eke-Eke (Genesis Plus GX)
|
||||
*
|
||||
* Redistribution and use of this code or any derivative works are permitted
|
||||
* provided that the following conditions are met:
|
||||
@ -777,7 +777,7 @@ void ctrl_io_write_byte(unsigned int address, unsigned int data)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* writing 0 to DMNA in 1M mode actually set DMNA bit */
|
||||
/* writing 0 to DMNA in 1M mode actually sets DMNA bit */
|
||||
data |= 0x02;
|
||||
|
||||
/* update BK0-1 & DMNA bits */
|
||||
@ -787,19 +787,32 @@ void ctrl_io_write_byte(unsigned int address, unsigned int data)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* writing 0 in 2M mode does nothing */
|
||||
/* writing 0 to DMNA in 2M mode does nothing */
|
||||
if (data & 0x02)
|
||||
{
|
||||
/* Word-RAM is assigned to SUB-CPU */
|
||||
scd.dmna = 1;
|
||||
|
||||
/* clear RET bit */
|
||||
/* clear RET bit and update BK0-1 & DMNA bits */
|
||||
scd.regs[0x03>>1].byte.l = (scd.regs[0x03>>1].byte.l & ~0xc3) | (data & 0xc2);
|
||||
|
||||
/* check if graphics operation is running */
|
||||
if (scd.regs[0x58>>1].byte.h & 0x80)
|
||||
{
|
||||
/* relative SUB-CPU cycle counter */
|
||||
unsigned int cycles = (m68k.cycles * SCYCLES_PER_LINE) / MCYCLES_PER_LINE;
|
||||
|
||||
/* synchronize GFX processing with SUB-CPU (only if not already ahead) */
|
||||
if (gfx.cycles < cycles)
|
||||
{
|
||||
gfx.cycles = cycles;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* update BK0-1 bits */
|
||||
/* update BK0-1 bits only */
|
||||
scd.regs[0x03>>1].byte.l = (scd.regs[0x02>>1].byte.l & ~0xc0) | (data & 0xc0);
|
||||
return;
|
||||
}
|
||||
@ -1014,7 +1027,7 @@ void ctrl_io_write_word(unsigned int address, unsigned int data)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* writing 0 to DMNA in 1M mode actually set DMNA bit */
|
||||
/* writing 0 to DMNA in 1M mode actually sets DMNA bit */
|
||||
data |= 0x02;
|
||||
|
||||
/* update WP0-7, BK0-1 & DMNA bits */
|
||||
@ -1024,19 +1037,32 @@ void ctrl_io_write_word(unsigned int address, unsigned int data)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* writing 0 in 2M mode does nothing */
|
||||
/* writing 0 to DMNA in 2M mode does nothing */
|
||||
if (data & 0x02)
|
||||
{
|
||||
/* Word-RAM is assigned to SUB-CPU */
|
||||
scd.dmna = 1;
|
||||
|
||||
/* clear RET bit */
|
||||
/* clear RET bit and update WP0-7 & BK0-1 bits */
|
||||
scd.regs[0x02>>1].w = (scd.regs[0x02>>1].w & ~0xffc3) | (data & 0xffc2);
|
||||
|
||||
/* check if graphics operation is running */
|
||||
if (scd.regs[0x58>>1].byte.h & 0x80)
|
||||
{
|
||||
/* relative SUB-CPU cycle counter */
|
||||
unsigned int cycles = (m68k.cycles * SCYCLES_PER_LINE) / MCYCLES_PER_LINE;
|
||||
|
||||
/* synchronize GFX processing with SUB-CPU (only if not already ahead) */
|
||||
if (gfx.cycles < cycles)
|
||||
{
|
||||
gfx.cycles = cycles;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* update WP0-7 & BK0-1 bits */
|
||||
/* update WP0-7 & BK0-1 bits only */
|
||||
scd.regs[0x02>>1].w = (scd.regs[0x02>>1].w & ~0xffc0) | (data & 0xffc0);
|
||||
return;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Main 68k bus handlers
|
||||
*
|
||||
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
||||
* Copyright (C) 2007-2019 Eke-Eke (Genesis Plus GX)
|
||||
* Copyright (C) 2007-2022 Eke-Eke (Genesis Plus GX)
|
||||
*
|
||||
* Redistribution and use of this code or any derivative works are permitted
|
||||
* provided that the following conditions are met:
|
||||
|
@ -114,7 +114,7 @@ void psg_init(PSG_TYPE type)
|
||||
psg.noiseBitMask = noiseBitMask[type];
|
||||
}
|
||||
|
||||
void psg_reset()
|
||||
void psg_reset(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -779,7 +779,7 @@ INLINE void CSMKeyControll(FM_CH *CH)
|
||||
ym2612.OPN.SL3.key_csm = 1;
|
||||
}
|
||||
|
||||
INLINE void INTERNAL_TIMER_A()
|
||||
INLINE void INTERNAL_TIMER_A(void)
|
||||
{
|
||||
if (ym2612.OPN.ST.mode & 0x01)
|
||||
{
|
||||
@ -1034,7 +1034,7 @@ INLINE void set_sl_rr(FM_SLOT *SLOT,int v)
|
||||
}
|
||||
|
||||
/* advance LFO to next sample */
|
||||
INLINE void advance_lfo()
|
||||
INLINE void advance_lfo(void)
|
||||
{
|
||||
if (ym2612.OPN.lfo_timer_overflow) /* LFO enabled ? */
|
||||
{
|
||||
|
@ -760,7 +760,7 @@ void system_frame_scd(int do_skip)
|
||||
|
||||
/* active screen width */
|
||||
bitmap.viewport.w = 256 + ((reg[12] & 0x01) << 6);
|
||||
bitmap.viewport.w += config.h40_extra_columns * 8;
|
||||
bitmap.viewport.w += config.h40_extra_columns * 8;
|
||||
|
||||
/* check viewport changes */
|
||||
if (bitmap.viewport.h != bitmap.viewport.oh)
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Support for 16-bit & 8-bit hardware modes
|
||||
*
|
||||
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
||||
* Copyright (C) 2007-2021 Eke-Eke (Genesis Plus GX)
|
||||
* Copyright (C) 2007-2022 Eke-Eke (Genesis Plus GX)
|
||||
*
|
||||
* Redistribution and use of this code or any derivative works are permitted
|
||||
* provided that the following conditions are met:
|
||||
@ -45,17 +45,18 @@
|
||||
#include "blip_buf.h"
|
||||
|
||||
/* Supported hardware models */
|
||||
#define SYSTEM_SG 0x10
|
||||
#define SYSTEM_SGII 0x11
|
||||
#define SYSTEM_MARKIII 0x12
|
||||
#define SYSTEM_SMS 0x20
|
||||
#define SYSTEM_SMS2 0x21
|
||||
#define SYSTEM_GG 0x40
|
||||
#define SYSTEM_GGMS 0x41
|
||||
#define SYSTEM_MD 0x80
|
||||
#define SYSTEM_PBC 0x81
|
||||
#define SYSTEM_PICO 0x82
|
||||
#define SYSTEM_MCD 0x84
|
||||
#define SYSTEM_SG 0x01
|
||||
#define SYSTEM_SGII 0x02
|
||||
#define SYSTEM_SGII_RAM_EXT 0x03
|
||||
#define SYSTEM_MARKIII 0x10
|
||||
#define SYSTEM_SMS 0x20
|
||||
#define SYSTEM_SMS2 0x21
|
||||
#define SYSTEM_GG 0x40
|
||||
#define SYSTEM_GGMS 0x41
|
||||
#define SYSTEM_MD 0x80
|
||||
#define SYSTEM_PBC 0x81
|
||||
#define SYSTEM_PICO 0x82
|
||||
#define SYSTEM_MCD 0x84
|
||||
|
||||
/* NTSC & PAL Master Clock frequencies */
|
||||
#define MCLOCK_NTSC 53693175
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Support for SG-1000 (TMS99xx & 315-5066), Master System (315-5124 & 315-5246), Game Gear & Mega Drive VDP
|
||||
*
|
||||
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
||||
* Copyright (C) 2007-2017 Eke-Eke (Genesis Plus GX)
|
||||
* Copyright (C) 2007-2022 Eke-Eke (Genesis Plus GX)
|
||||
*
|
||||
* Redistribution and use of this code or any derivative works are permitted
|
||||
* provided that the following conditions are met:
|
||||
@ -58,6 +58,12 @@ static void vdp_set_all_vram(const uint8 *src);
|
||||
bg_name_dirty[name] |= (1 << ((addr >> 2) & 7)); \
|
||||
}
|
||||
|
||||
/* HBLANK flag timings */
|
||||
#define HBLANK_H32_START_MCYCLE (280)
|
||||
#define HBLANK_H32_END_MCYCLE (860)
|
||||
#define HBLANK_H40_START_MCYCLE (228)
|
||||
#define HBLANK_H40_END_MCYCLE (872)
|
||||
|
||||
/* VDP context */
|
||||
uint8 ALIGNED_(4) sat[0x400]; /* Internal copy of sprite attribute table */
|
||||
uint8 ALIGNED_(4) vram[0x10000]; /* Video RAM (64K x 8-bit) */
|
||||
@ -147,6 +153,8 @@ static int fifo_idx; /* FIFO write index */
|
||||
static int fifo_byte_access; /* FIFO byte access flag */
|
||||
static uint32 fifo_cycles; /* FIFO next access cycle */
|
||||
static int *fifo_timing; /* FIFO slots timing table */
|
||||
static int hblank_start_cycle; /* HBLANK flag set cycle */
|
||||
static int hblank_end_cycle; /* HBLANK flag clear cycle */
|
||||
|
||||
/* set Z80 or 68k interrupt lines */
|
||||
static void (*set_irq_line)(unsigned int level);
|
||||
@ -333,6 +341,10 @@ void vdp_reset(void)
|
||||
/* default FIFO access slots timings */
|
||||
fifo_timing = (int *)fifo_timing_h32;
|
||||
|
||||
/* default HBLANK flag timings */
|
||||
hblank_start_cycle = HBLANK_H32_START_MCYCLE;
|
||||
hblank_end_cycle = HBLANK_H32_END_MCYCLE;
|
||||
|
||||
/* default overscan area */
|
||||
if ((system_hw == SYSTEM_GG) && !config.gg_extra)
|
||||
{
|
||||
@ -372,6 +384,7 @@ void vdp_reset(void)
|
||||
{
|
||||
case SYSTEM_SG:
|
||||
case SYSTEM_SGII:
|
||||
case SYSTEM_SGII_RAM_EXT:
|
||||
{
|
||||
/* SG-1000 (TMS99xx) or SG-1000 II (315-5066) VDP */
|
||||
vdp_z80_data_w = vdp_z80_data_w_sg;
|
||||
@ -698,7 +711,6 @@ void vdp_dma_update(unsigned int cycles)
|
||||
/* Check if DMA is finished */
|
||||
if (!dma_length)
|
||||
{
|
||||
/* DMA source address registers are incremented during DMA (even DMA Fill) */
|
||||
if (config.vdp_fix_dma_boundary_bug) {
|
||||
/*
|
||||
* NOTICE: VDP has a hardware bug where DMA transfer source address is not incremented properly,
|
||||
@ -1238,9 +1250,12 @@ unsigned int vdp_68k_ctrl_r(unsigned int cycles)
|
||||
temp |= 0x08;
|
||||
}
|
||||
|
||||
/* Adjust cycle count relatively to start of line */
|
||||
cycles -= mcycles_vdp;
|
||||
|
||||
/* Cycle-accurate VINT flag (Ex-Mutants, Tyrant / Mega-Lo-Mania, Marvel Land) */
|
||||
/* this allows VINT flag to be read just before vertical interrupt is being triggered */
|
||||
if ((v_counter == bitmap.viewport.h) && (cycles >= (mcycles_vdp + 788)))
|
||||
if ((v_counter == bitmap.viewport.h) && (cycles >= 788))
|
||||
{
|
||||
/* check Z80 interrupt state to assure VINT has not already been triggered (and flag cleared) */
|
||||
if (Z80.irq_state != ASSERT_LINE)
|
||||
@ -1249,15 +1264,14 @@ unsigned int vdp_68k_ctrl_r(unsigned int cycles)
|
||||
}
|
||||
}
|
||||
|
||||
/* Cycle-accurate HBLANK flag (Sonic 3 & Sonic 2 "VS Modes", Bugs Bunny Double Trouble, Lemmings 2, Mega Turrican, V.R Troopers, Gouketsuji Ichizoku,...) */
|
||||
/* NB: this is not 100% accurate (see hvc.h for horizontal events timings in H32 and H40 mode) but is close enough to make no noticeable difference for games */
|
||||
if ((cycles % MCYCLES_PER_LINE) < 588)
|
||||
/* Cycle-accurate HBLANK flag (Sonic 3 & Sonic 2 "VS Modes", Bugs Bunny Double Trouble, Lemmings 2, Mega Turrican, V.R Troopers, Gouketsuji Ichizoku, Ultraverse Prime, ...) */
|
||||
if ((cycles >= hblank_start_cycle) && (cycles < hblank_end_cycle))
|
||||
{
|
||||
temp |= 0x04;
|
||||
}
|
||||
|
||||
#ifdef LOGVDP
|
||||
error("[%d(%d)][%d(%d)] VDP 68k status read -> 0x%x (0x%x) (%x)\n", v_counter, (v_counter + (cycles - mcycles_vdp)/MCYCLES_PER_LINE)%lines_per_frame, cycles, cycles%MCYCLES_PER_LINE, temp, status, m68k_get_reg(M68K_REG_PC));
|
||||
error("[%d(%d)][%d(%d)] VDP 68k status read -> 0x%x (0x%x) (%x)\n", v_counter, (v_counter + cycles/MCYCLES_PER_LINE)%lines_per_frame, cycles + mcycles_vdp, cycles%MCYCLES_PER_LINE, temp, status, m68k_get_reg(M68K_REG_PC));
|
||||
#endif
|
||||
return (temp);
|
||||
}
|
||||
@ -2030,6 +2044,10 @@ static void vdp_reg_w(unsigned int r, unsigned int d, unsigned int cycles)
|
||||
|
||||
/* FIFO access slots timings */
|
||||
fifo_timing = (int *)fifo_timing_h40;
|
||||
|
||||
/* HBLANK flag timings */
|
||||
hblank_start_cycle = HBLANK_H32_START_MCYCLE;
|
||||
hblank_end_cycle = HBLANK_H32_END_MCYCLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2050,6 +2068,10 @@ static void vdp_reg_w(unsigned int r, unsigned int d, unsigned int cycles)
|
||||
|
||||
/* FIFO access slots timings */
|
||||
fifo_timing = (int *)fifo_timing_h32;
|
||||
|
||||
/* HBLANK flag timings */
|
||||
hblank_start_cycle = HBLANK_H40_START_MCYCLE;
|
||||
hblank_end_cycle = HBLANK_H40_END_MCYCLE;
|
||||
}
|
||||
|
||||
/* Active screen width modified during VBLANK will be applied on upcoming frame */
|
||||
@ -2263,8 +2285,8 @@ static void vdp_bus_w(unsigned int data)
|
||||
color_update_m5(0x00, data);
|
||||
}
|
||||
|
||||
/* CRAM modified during HBLANK (Striker, Zero the Kamikaze, etc) */
|
||||
if ((v_counter < bitmap.viewport.h) && (reg[1] & 0x40) && (m68k.cycles <= (mcycles_vdp + 860)))
|
||||
/* CRAM modified during HBLANK (Striker, Zero the Kamikaze, Yuu Yuu Hakusho, etc) */
|
||||
if ((v_counter < bitmap.viewport.h) && (m68k.cycles <= (mcycles_vdp + 860)) && ((reg[1] & 0x40) || (index == border)))
|
||||
{
|
||||
/* Remap current line */
|
||||
remap_line(v_counter);
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Support for SG-1000 (TMS99xx & 315-5066), Master System (315-5124 & 315-5246), Game Gear & Mega Drive VDP
|
||||
*
|
||||
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
||||
* Copyright (C) 2007-2017 Eke-Eke (Genesis Plus GX)
|
||||
* Copyright (C) 2007-2022 Eke-Eke (Genesis Plus GX)
|
||||
*
|
||||
* Redistribution and use of this code or any derivative works are permitted
|
||||
* provided that the following conditions are met:
|
||||
|
@ -1042,6 +1042,7 @@ void color_update_m4(int index, unsigned int data)
|
||||
|
||||
case SYSTEM_SG:
|
||||
case SYSTEM_SGII:
|
||||
case SYSTEM_SGII_RAM_EXT:
|
||||
{
|
||||
/* Fixed TMS99xx palette */
|
||||
if (index & 0x0F)
|
||||
@ -1540,7 +1541,6 @@ void render_bg_m5(int line)
|
||||
pf_row_mask = playfield_row_mask;
|
||||
pf_shift = playfield_shift;
|
||||
|
||||
|
||||
/* Window & Plane A */
|
||||
a = (reg[18] & 0x1F) << 3;
|
||||
w = (reg[18] >> 7) & 1;
|
||||
@ -1668,7 +1668,7 @@ void render_bg_m5(int line)
|
||||
|
||||
/* Plane A line buffer */
|
||||
dst = (uint32 *)&linebuf[1][0x20 + (start << 4)];
|
||||
|
||||
|
||||
start_real = start + (config.h40_extra_columns / 4);
|
||||
end_real = end - (config.h40_extra_columns / 4);
|
||||
|
||||
@ -1721,7 +1721,7 @@ void render_bg_m5_vs(int line)
|
||||
w = (reg[18] >> 7) & 1;
|
||||
|
||||
/* Plane B width */
|
||||
|
||||
|
||||
end = bitmap.viewport.w >> 4;
|
||||
|
||||
/* Plane B horizontal scroll */
|
||||
@ -1767,7 +1767,7 @@ void render_bg_m5_vs(int line)
|
||||
|
||||
for(column = 0; column < end; column++, index++)
|
||||
{
|
||||
int column_capped = column - (config.h40_extra_columns / 4);
|
||||
int column_capped = column - (config.h40_extra_columns / 4);
|
||||
column_capped = MAX(0, MIN(column_capped, 19));
|
||||
/* Plane B vertical scroll */
|
||||
#ifdef LSB_FIRST
|
||||
@ -1885,7 +1885,7 @@ void render_bg_m5_vs(int line)
|
||||
|
||||
/* Plane A line buffer */
|
||||
dst = (uint32 *)&linebuf[1][0x20 + (start << 4)];
|
||||
|
||||
|
||||
start_real = start + (config.h40_extra_columns / 4);
|
||||
end_real = end - (config.h40_extra_columns / 4);
|
||||
|
||||
@ -1905,7 +1905,7 @@ void render_bg_m5_vs(int line)
|
||||
}
|
||||
|
||||
/* Enhanced function that allows each cell to be vscrolled individually, instead of being limited to 2-cell */
|
||||
void render_bg_m5_vs_enhanced(int line)
|
||||
void render_bg_m5_vs_enhanced(int line)
|
||||
{
|
||||
int column, v_offset;
|
||||
int start_real, end_real;
|
||||
@ -1939,7 +1939,7 @@ void render_bg_m5_vs_enhanced(int line)
|
||||
w = (reg[18] >> 7) & 1;
|
||||
|
||||
/* Plane B width */
|
||||
|
||||
|
||||
end = bitmap.viewport.w >> 4;
|
||||
|
||||
/* Plane B horizontal scroll */
|
||||
@ -1985,7 +1985,7 @@ void render_bg_m5_vs_enhanced(int line)
|
||||
|
||||
for(column = 0; column < end; column++, index++)
|
||||
{
|
||||
int column_capped = column - (config.h40_extra_columns / 4);
|
||||
int column_capped = column - (config.h40_extra_columns / 4);
|
||||
column_capped = MAX(0, MIN(column_capped, 19));
|
||||
/* Plane B vertical scroll */
|
||||
#ifdef LSB_FIRST
|
||||
@ -1999,7 +1999,7 @@ void render_bg_m5_vs_enhanced(int line)
|
||||
if (column >= (config.h40_extra_columns / 4) && column < (config.h40_extra_columns / 4) + 19)
|
||||
{
|
||||
/* The offset of the intermediary cell is an average of the offsets of the current 2-cell and the next 2-cell. */
|
||||
|
||||
|
||||
v_offset = ((int)next_v_line - (int)v_line) / 2;
|
||||
v_offset = (abs(v_offset) >= config.enhanced_vscroll_limit) ? 0 : v_offset;
|
||||
}
|
||||
@ -2204,7 +2204,7 @@ void render_bg_m5_vs_enhanced(int line)
|
||||
|
||||
/* Plane A line buffer */
|
||||
dst = (uint32 *)&linebuf[1][0x20 + (start << 4)];
|
||||
|
||||
|
||||
start_real = start + (config.h40_extra_columns / 4);
|
||||
end_real = end - (config.h40_extra_columns / 4);
|
||||
|
||||
@ -2257,7 +2257,7 @@ void render_bg_m5_im2(int line)
|
||||
w = (reg[18] >> 7) & 1;
|
||||
|
||||
/* Plane B width */
|
||||
|
||||
|
||||
end = bitmap.viewport.w >> 4;
|
||||
|
||||
/* Plane B scroll */
|
||||
@ -2379,7 +2379,7 @@ void render_bg_m5_im2(int line)
|
||||
|
||||
/* Plane A line buffer */
|
||||
dst = (uint32 *)&linebuf[1][0x20 + (start << 4)];
|
||||
|
||||
|
||||
start_real = start + (config.h40_extra_columns / 4);
|
||||
end_real = end - (config.h40_extra_columns / 4);
|
||||
|
||||
@ -2432,7 +2432,7 @@ void render_bg_m5_im2_vs(int line)
|
||||
w = (reg[18] >> 7) & 1;
|
||||
|
||||
/* Plane B width */
|
||||
|
||||
|
||||
end = bitmap.viewport.w >> 4;
|
||||
|
||||
/* Plane B horizontal scroll */
|
||||
@ -2560,7 +2560,7 @@ void render_bg_m5_im2_vs(int line)
|
||||
|
||||
for(column = start; column < end; column++, index++)
|
||||
{
|
||||
int column_capped = column - (config.h40_extra_columns / 4);
|
||||
int column_capped = column - (config.h40_extra_columns / 4);
|
||||
column_capped = MAX(0, MIN(column_capped, 19));
|
||||
/* Plane A vertical scroll */
|
||||
#ifdef LSB_FIRST
|
||||
@ -2595,7 +2595,7 @@ void render_bg_m5_im2_vs(int line)
|
||||
|
||||
/* Plane A line buffer */
|
||||
dst = (uint32 *)&linebuf[1][0x20 + (start << 4)];
|
||||
|
||||
|
||||
start_real = start + (config.h40_extra_columns / 4);
|
||||
end_real = end - (config.h40_extra_columns / 4);
|
||||
|
||||
@ -2740,8 +2740,8 @@ void render_bg_m5(int line)
|
||||
|
||||
/* Pattern row index */
|
||||
v_line = (line & 7) << 3;
|
||||
|
||||
int start_real = start + (config.h40_extra_columns / 4);
|
||||
|
||||
int start_real = start + (config.h40_extra_columns / 4);
|
||||
int end_real = end - (config.h40_extra_columns / 4);
|
||||
|
||||
for(column = start; column < end; column++)
|
||||
@ -2940,7 +2940,7 @@ void render_bg_m5_vs(int line)
|
||||
|
||||
/* Pattern row index */
|
||||
v_line = (line & 7) << 3;
|
||||
|
||||
|
||||
int start_real = start + (config.h40_extra_columns / 4);
|
||||
int end_real = end - (config.h40_extra_columns / 4);
|
||||
|
||||
@ -2987,7 +2987,7 @@ void render_bg_m5_vs(int line)
|
||||
|
||||
for(column = 0; column < width; column++, index++)
|
||||
{
|
||||
int column_capped = column - (config.h40_extra_columns / 4);
|
||||
int column_capped = column - (config.h40_extra_columns / 4);
|
||||
column_capped = MAX(0, MIN(column_capped, 19));
|
||||
/* Plane B vertical scroll */
|
||||
#ifdef LSB_FIRST
|
||||
@ -3205,8 +3205,8 @@ void render_bg_m5_vs_enhanced(int line)
|
||||
|
||||
/* Pattern row index */
|
||||
v_line = (line & 7) << 3;
|
||||
|
||||
int start_real = start + (config.h40_extra_columns / 4);
|
||||
|
||||
int start_real = start + (config.h40_extra_columns / 4);
|
||||
int end_real = end - (config.h40_extra_columns / 4);
|
||||
|
||||
for(column = start; column < end; column++)
|
||||
@ -3252,7 +3252,7 @@ void render_bg_m5_vs_enhanced(int line)
|
||||
|
||||
for(column = 0; column < width; column++, index++)
|
||||
{
|
||||
int column_capped = column - (config.h40_extra_columns / 4);
|
||||
int column_capped = column - (config.h40_extra_columns / 4);
|
||||
column_capped = MAX(0, MIN(column_capped, 19));
|
||||
/* Plane B vertical scroll */
|
||||
#ifdef LSB_FIRST
|
||||
@ -3495,8 +3495,8 @@ void render_bg_m5_im2(int line)
|
||||
|
||||
/* Pattern row index */
|
||||
v_line = ((line & 7) << 1 | odd) << 3;
|
||||
|
||||
int start_real = start + (config.h40_extra_columns / 4);
|
||||
|
||||
int start_real = start + (config.h40_extra_columns / 4);
|
||||
int end_real = end - (config.h40_extra_columns / 4);
|
||||
|
||||
for(column = start; column < end; column++)
|
||||
@ -3697,8 +3697,8 @@ void render_bg_m5_im2_vs(int line)
|
||||
|
||||
/* Pattern row index */
|
||||
v_line = ((line & 7) << 1 | odd) << 3;
|
||||
|
||||
int start_real = start + (config.h40_extra_columns / 4);
|
||||
|
||||
int start_real = start + (config.h40_extra_columns / 4);
|
||||
int end_real = end - (config.h40_extra_columns / 4);
|
||||
|
||||
for(column = start; column < end; column++)
|
||||
@ -4725,11 +4725,12 @@ void parse_satb_m5(int line)
|
||||
|
||||
/* Update sprite list (only name, attribute & xpos are parsed from VRAM) */
|
||||
object_info->attr = p[link + 2];
|
||||
|
||||
|
||||
if (config.h40_extra_columns > 0)
|
||||
object_info->xpos = p[link + 3];
|
||||
else
|
||||
object_info->xpos = p[link + 3] & 0x1ff;
|
||||
|
||||
object_info->ypos = ypos;
|
||||
object_info->size = size & 0x0f;
|
||||
|
||||
@ -5012,7 +5013,7 @@ void render_line(int line)
|
||||
/* Left-most column blanking */
|
||||
if (reg[0] & 0x20)
|
||||
{
|
||||
if (system_hw > SYSTEM_SGII)
|
||||
if (system_hw >= SYSTEM_MARKIII)
|
||||
{
|
||||
memset(&linebuf[0][0x20], 0x40, 8);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
*
|
||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
||||
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
|
||||
* Copyright (C) 2022 AlexKiri (enhanced vscroll mode rendering function)
|
||||
*
|
||||
* Redistribution and use of this code or any derivative works are permitted
|
||||
* provided that the following conditions are met:
|
||||
|
@ -57,7 +57,7 @@ void set_config_defaults(void)
|
||||
config.mono = 0;
|
||||
|
||||
/* system options */
|
||||
config.system = 0; /* = AUTO (or SYSTEM_SG, SYSTEM_MARKIII, SYSTEM_SMS, SYSTEM_SMS2, SYSTEM_GG, SYSTEM_MD) */
|
||||
config.system = 0; /* = AUTO (or SYSTEM_SG, SYSTEM_SGII, SYSTEM_SGII_RAM_EXT, SYSTEM_MARKIII, SYSTEM_SMS, SYSTEM_SMS2, SYSTEM_GG, SYSTEM_MD) */
|
||||
config.region_detect = 0; /* = AUTO (1 = USA, 2 = EUROPE, 3 = JAPAN/NTSC, 4 = JAPAN/PAL) */
|
||||
config.vdp_mode = 0; /* = AUTO (1 = NTSC, 2 = PAL) */
|
||||
config.master_clock = 0; /* = AUTO (1 = NTSC, 2 = PAL) */
|
||||
|
@ -960,7 +960,7 @@ static int gcw0menu(void)
|
||||
SDL_FreeSurface(tempbgSurface);
|
||||
SDL_FreeSurface(bgSurface);
|
||||
}
|
||||
else if ( (system_hw == SYSTEM_SG) || (system_hw == SYSTEM_SGII) ) //SG-1000 I&II
|
||||
else if ( (system_hw == SYSTEM_SG)|| (system_hw == SYSTEM_SGII) || (system_hw == SYSTEM_SGII_RAM_EXT) ) //SG-1000 I&II
|
||||
{
|
||||
SDL_Surface *tempbgSurface;
|
||||
SDL_Surface *bgSurface;
|
||||
|
@ -119,9 +119,9 @@ char* get_save_directory(void) {
|
||||
|
||||
char pathname[MAXPATHLEN];
|
||||
|
||||
if(system_hw <= SYSTEM_MARKIII){
|
||||
if(system_hw < SYSTEM_MARKIII){
|
||||
system_dir = "/saves/sg";
|
||||
} else if (system_hw > SYSTEM_MARKIII && system_hw <= SYSTEM_SMS2) {
|
||||
} else if (system_hw >= SYSTEM_MARKIII && system_hw <= SYSTEM_SMS2) {
|
||||
system_dir = "/saves/ms";
|
||||
} else if (system_hw > SYSTEM_SMS2 && system_hw <= SYSTEM_GGMS) {
|
||||
system_dir = "/saves/gg";
|
||||
|
@ -127,6 +127,9 @@ void config_default(void)
|
||||
config.add_on = HW_ADDON_AUTO;
|
||||
config.hot_swap = 0;
|
||||
config.cd_latency = 1;
|
||||
config.m68k_overclock = 1.0;
|
||||
config.s68k_overclock = 1.0;
|
||||
config.z80_overclock = 1.0;
|
||||
|
||||
/* video options */
|
||||
config.xshift = 0;
|
||||
|
@ -103,7 +103,7 @@ typedef struct
|
||||
t_input_config input[MAX_INPUTS];
|
||||
uint16 pad_keymap[4][MAX_KEYS+1];
|
||||
#ifdef HW_RVL
|
||||
uint32 wpad_keymap[4*3+1][MAX_KEYS];
|
||||
uint32 wpad_keymap[4*3+1][MAX_KEYS+1];
|
||||
uint8 autosleep;
|
||||
int32 calx;
|
||||
int32 caly;
|
||||
@ -126,6 +126,9 @@ typedef struct
|
||||
float ntsc_artifacts;
|
||||
float ntsc_fringing;
|
||||
float ntsc_bleed;
|
||||
float m68k_overclock;
|
||||
float s68k_overclock;
|
||||
float z80_overclock;
|
||||
char sys_rom[12][256];
|
||||
} t_config;
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Genesis Plus GX Cheats menu
|
||||
*
|
||||
* Copyright Eke-Eke (2010-2019)
|
||||
* Copyright Eke-Eke (2010-2022)
|
||||
*
|
||||
* Redistribution and use of this code or any derivative works are permitted
|
||||
* provided that the following conditions are met:
|
||||
@ -456,7 +456,33 @@ static void apply_cheats(void)
|
||||
{
|
||||
if (cheatlist[i].enable)
|
||||
{
|
||||
if (cheatlist[i].address < cart.romsize)
|
||||
/* detect Work RAM patch */
|
||||
if (cheatlist[i].address >= 0xFF0000)
|
||||
{
|
||||
/* add RAM patch */
|
||||
cheatIndexes[maxRAMcheats++] = i;
|
||||
}
|
||||
|
||||
/* check if Mega-CD game is running */
|
||||
else if ((system_hw == SYSTEM_MCD) && !scd.cartridge.boot)
|
||||
{
|
||||
/* detect PRG-RAM patch (Sub-CPU side) */
|
||||
if (cheatlist[i].address < 0x80000)
|
||||
{
|
||||
/* add RAM patch */
|
||||
cheatIndexes[maxRAMcheats++] = i;
|
||||
}
|
||||
|
||||
/* detect Word-RAM patch (Main-CPU side)*/
|
||||
else if ((cheatlist[i].address >= 0x200000) && (cheatlist[i].address < 0x240000))
|
||||
{
|
||||
/* add RAM patch */
|
||||
cheatIndexes[maxRAMcheats++] = i;
|
||||
}
|
||||
}
|
||||
|
||||
/* detect cartridge ROM patch */
|
||||
else if (cheatlist[i].address < cart.romsize)
|
||||
{
|
||||
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
||||
{
|
||||
@ -489,20 +515,20 @@ static void apply_cheats(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (cheatlist[i].address >= 0xFF0000)
|
||||
{
|
||||
/* add RAM patch */
|
||||
cheatIndexes[maxRAMcheats++] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void clear_cheats(void)
|
||||
{
|
||||
int i = maxcheats;
|
||||
int i;
|
||||
|
||||
/* disable cheats in reversed order in case the same address is used by multiple patches */
|
||||
/* no ROM patches with Mega-CD games */
|
||||
if ((system_hw == SYSTEM_MCD) && !scd.cartridge.boot)
|
||||
return;
|
||||
|
||||
/* disable cheats in reversed order in case the same address is used by multiple ROM patches */
|
||||
i = maxcheats;
|
||||
while (i > 0)
|
||||
{
|
||||
if (cheatlist[i-1].enable)
|
||||
@ -1501,6 +1527,8 @@ void CheatLoad(void)
|
||||
****************************************************************************/
|
||||
void RAMCheatUpdate(void)
|
||||
{
|
||||
uint8 *base;
|
||||
uint32 mask;
|
||||
int index, cnt = maxRAMcheats;
|
||||
|
||||
while (cnt)
|
||||
@ -1508,16 +1536,36 @@ void RAMCheatUpdate(void)
|
||||
/* get cheat index */
|
||||
index = cheatIndexes[--cnt];
|
||||
|
||||
/* detect destination RAM */
|
||||
switch ((cheatlist[index].address >> 20) & 0xf)
|
||||
{
|
||||
case 0x0: /* Mega-CD PRG-RAM (512 KB) */
|
||||
base = scd.prg_ram;
|
||||
mask = 0x7fffe;
|
||||
break;
|
||||
|
||||
case 0x2: /* Mega-CD 2M Word-RAM (256 KB) */
|
||||
base = scd.word_ram_2M;
|
||||
mask = 0x3fffe;
|
||||
break;
|
||||
|
||||
default: /* Work-RAM (64 KB) */
|
||||
base = work_ram;
|
||||
mask = 0xfffe;
|
||||
break;
|
||||
}
|
||||
|
||||
/* apply RAM patch */
|
||||
if (cheatlist[index].data & 0xFF00)
|
||||
{
|
||||
/* word patch */
|
||||
*(u16 *)(work_ram + (cheatlist[index].address & 0xFFFE)) = cheatlist[index].data;
|
||||
*(u16 *)(base + (cheatlist[index].address & mask)) = cheatlist[index].data;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* byte patch */
|
||||
work_ram[cheatlist[index].address & 0xFFFF] = cheatlist[index].data;
|
||||
mask |= 1;
|
||||
base[cheatlist[index].address & mask] = cheatlist[index].data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Genesis Plus GX Cheats menu
|
||||
*
|
||||
* Copyright Eke-Eke (2010-2019)
|
||||
* Copyright Eke-Eke (2010-2022)
|
||||
*
|
||||
* Redistribution and use of this code or any derivative works are permitted
|
||||
* provided that the following conditions are met:
|
||||
|
@ -392,6 +392,9 @@ static gui_item items_system[] =
|
||||
{NULL,NULL,"Lock-On: SONIC&KNUCKLES", "Select Lock-On cartridge type", 56,132,276,48},
|
||||
{NULL,NULL,"Cartridge Swap: OFF", "Enable/Disable cartridge hot swap", 56,132,276,48},
|
||||
{NULL,NULL,"BIOS & Lock-On ROM paths", "Configure Boot ROM & Lock-On ROM paths", 56,132,276,48},
|
||||
{NULL,NULL,"Main 68k Overclock: 3.0x", "Adjust Mega Drive /Genesis CPU clock speed", 56,132,276,48},
|
||||
{NULL,NULL,"Sub 68k Overclock: 3.0x", "Adjust Sega CD / Mega-CD CPU clock speed", 56,132,276,48},
|
||||
{NULL,NULL,"Z80 Overclock: 3.0x", "Adjust Z80 CPU clock speed", 56,132,276,48},
|
||||
{NULL,NULL,"SVP Cycles: 1500", "Adjust SVP chip emulation speed", 56,132,276,48}
|
||||
};
|
||||
|
||||
@ -1297,6 +1300,8 @@ static void systemmenu ()
|
||||
sprintf (items[0].text, "System: SG-1000");
|
||||
else if (config.system == SYSTEM_SGII)
|
||||
sprintf (items[0].text, "System: SG-1000 II");
|
||||
else if (config.system == SYSTEM_SGII_RAM_EXT)
|
||||
sprintf (items[0].text, "System: SG-1000 + RAM EXT.");
|
||||
else if (config.system == SYSTEM_MARKIII)
|
||||
sprintf (items[0].text, "System: MARK-III");
|
||||
else if (config.system == SYSTEM_SMS)
|
||||
@ -1356,14 +1361,29 @@ static void systemmenu ()
|
||||
|
||||
sprintf (items[10].text, "Cartridge Swap: %s", (config.hot_swap & 1) ? "ON":"OFF");
|
||||
|
||||
if (config.m68k_overclock > 1.0)
|
||||
sprintf (items[12].text, "Main 68k Overclock: %1.1fx", config.m68k_overclock);
|
||||
else
|
||||
sprintf (items[12].text, "Main 68k Overclock: OFF");
|
||||
|
||||
if (config.s68k_overclock > 1.0)
|
||||
sprintf (items[13].text, "Sub 68k Overclock: %1.1fx", config.s68k_overclock);
|
||||
else
|
||||
sprintf (items[13].text, "Sub 68k Overclock: OFF");
|
||||
|
||||
if (config.z80_overclock > 1.0)
|
||||
sprintf (items[14].text, "Z80 Overclock: %1.1fx", config.z80_overclock);
|
||||
else
|
||||
sprintf (items[14].text, "Z80 Overclock: OFF");
|
||||
|
||||
if (svp)
|
||||
{
|
||||
sprintf (items[12].text, "SVP Cycles: %d", SVP_cycles);
|
||||
m->max_items = 13;
|
||||
sprintf (items[15].text, "SVP Cycles: %d", SVP_cycles);
|
||||
m->max_items = 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
m->max_items = 12;
|
||||
m->max_items = 15;
|
||||
}
|
||||
|
||||
GUI_InitMenu(m);
|
||||
@ -1398,6 +1418,12 @@ static void systemmenu ()
|
||||
if (system_hw) system_hw = SYSTEM_SGII;
|
||||
}
|
||||
else if (config.system == SYSTEM_SGII)
|
||||
{
|
||||
config.system = SYSTEM_SGII_RAM_EXT;
|
||||
sprintf (items[0].text, "System: SG-1000 + RAM EXT.");
|
||||
if (system_hw) system_hw = SYSTEM_SGII_RAM_EXT;
|
||||
}
|
||||
else if (config.system == SYSTEM_SGII_RAM_EXT)
|
||||
{
|
||||
config.system = SYSTEM_MARKIII;
|
||||
sprintf (items[0].text, "System: MARK-III");
|
||||
@ -1634,10 +1660,40 @@ static void systemmenu ()
|
||||
break;
|
||||
}
|
||||
|
||||
case 12: /*** SVP cycles per line ***/
|
||||
case 12: /*** Main 68k Overclock ***/
|
||||
{
|
||||
GUI_OptionBox(m,0,"Main 68k Overclock Ratio",(void *)&config.m68k_overclock,0.1,1.0,3.0,0);
|
||||
if (config.m68k_overclock > 1.0)
|
||||
sprintf (items[12].text, "Main 68k Overclock: %1.1fx", config.m68k_overclock);
|
||||
else
|
||||
sprintf (items[12].text, "Main 68k Overclock: OFF");
|
||||
break;
|
||||
}
|
||||
|
||||
case 13: /*** Sub 68k Overclock ***/
|
||||
{
|
||||
GUI_OptionBox(m,0,"Sub 68k Overclock Ratio",(void *)&config.s68k_overclock,0.1,1.0,3.0,0);
|
||||
if (config.s68k_overclock > 1.0)
|
||||
sprintf (items[13].text, "Sub 68k Overclock: %1.1fx", config.s68k_overclock);
|
||||
else
|
||||
sprintf (items[13].text, "Sub 68k Overclock: OFF");
|
||||
break;
|
||||
}
|
||||
|
||||
case 14: /*** Z80 Overclock ***/
|
||||
{
|
||||
GUI_OptionBox(m,0,"Z80 Overclock Ratio",(void *)&config.z80_overclock,0.1,1.0,3.0,0);
|
||||
if (config.z80_overclock > 1.0)
|
||||
sprintf (items[14].text, "Z80 Overclock: %1.1fx", config.z80_overclock);
|
||||
else
|
||||
sprintf (items[14].text, "Z80 Overclock: OFF");
|
||||
break;
|
||||
}
|
||||
|
||||
case 15: /*** SVP cycles per line ***/
|
||||
{
|
||||
GUI_OptionBox(m,0,"SVP Cycles",(void *)&SVP_cycles,1,1,1500,1);
|
||||
sprintf (items[12].text, "SVP Cycles: %d", SVP_cycles);
|
||||
sprintf (items[15].text, "SVP Cycles: %d", SVP_cycles);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1707,6 +1763,11 @@ static void systemmenu ()
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize CPU overclock ratio */
|
||||
m68k.cycle_ratio = (100 << M68K_OVERCLOCK_SHIFT) / (int)(config.m68k_overclock * 100.0);
|
||||
s68k.cycle_ratio = (100 << M68K_OVERCLOCK_SHIFT) / (int)(config.s68k_overclock * 100.0);
|
||||
z80_cycle_ratio = (100 << Z80_OVERCLOCK_SHIFT) / (int)(config.z80_overclock * 100.0);
|
||||
|
||||
GUI_DeleteMenu(m);
|
||||
}
|
||||
|
||||
@ -2034,27 +2095,27 @@ static void videomenu ()
|
||||
}
|
||||
|
||||
case VI_OFFSET+2: /*** NTSC Sharpness ***/
|
||||
GUI_OptionBox(m,update_bgm,"NTSC Sharpness",(void *)&config.ntsc_sharpness,0.01,-1.0,1.0,0);
|
||||
GUI_OptionBox(m,0,"NTSC Sharpness",(void *)&config.ntsc_sharpness,0.01,-1.0,1.0,0);
|
||||
sprintf(items[VI_OFFSET+2].text, "NTSC Sharpness: %1.2f", config.ntsc_sharpness);
|
||||
break;
|
||||
|
||||
case VI_OFFSET+3: /*** NTSC Resolution ***/
|
||||
GUI_OptionBox(m,update_bgm,"NTSC Resolution",(void *)&config.ntsc_resolution,0.01,0.0,1.0,0);
|
||||
GUI_OptionBox(m,0,"NTSC Resolution",(void *)&config.ntsc_resolution,0.01,0.0,1.0,0);
|
||||
sprintf(items[VI_OFFSET+3].text, "NTSC Resolution: %1.2f", config.ntsc_resolution);
|
||||
break;
|
||||
|
||||
case VI_OFFSET+4: /*** NTSC Artifacts ***/
|
||||
GUI_OptionBox(m,update_bgm,"NTSC Artifacts",(void *)&config.ntsc_artifacts,0.01,-1.0,0.0,0);
|
||||
GUI_OptionBox(m,0,"NTSC Artifacts",(void *)&config.ntsc_artifacts,0.01,-1.0,0.0,0);
|
||||
sprintf(items[VI_OFFSET+4].text, "NTSC Artifacts: %1.2f", config.ntsc_artifacts);
|
||||
break;
|
||||
|
||||
case VI_OFFSET+5: /*** NTSC Color Bleed ***/
|
||||
GUI_OptionBox(m,update_bgm,"NTSC Color Bleed",(void *)&config.ntsc_bleed,0.01,-1.0,1.0,0);
|
||||
GUI_OptionBox(m,0,"NTSC Color Bleed",(void *)&config.ntsc_bleed,0.01,-1.0,1.0,0);
|
||||
sprintf(items[VI_OFFSET+5].text, "NTSC Color Bleed: %1.2f", config.ntsc_bleed);
|
||||
break;
|
||||
|
||||
case VI_OFFSET+6: /*** NTSC Color Fringing ***/
|
||||
GUI_OptionBox(m,update_bgm,"NTSC Color Fringing",(void *)&config.ntsc_fringing,0.01,-1.0,1.0,0);
|
||||
GUI_OptionBox(m,0,"NTSC Color Fringing",(void *)&config.ntsc_fringing,0.01,-1.0,1.0,0);
|
||||
sprintf(items[VI_OFFSET+6].text, "NTSC Color Fringing: %1.2f", config.ntsc_fringing);
|
||||
break;
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Genesis Plus GX input support
|
||||
*
|
||||
* Copyright Eke-Eke (2007-2019)
|
||||
* Copyright Eke-Eke (2007-2022)
|
||||
*
|
||||
* Redistribution and use of this code or any derivative works are permitted
|
||||
* provided that the following conditions are met:
|
||||
@ -73,7 +73,7 @@
|
||||
|
||||
#ifdef HW_RVL
|
||||
|
||||
#define PAD_UP 0
|
||||
#define PAD_UP 0
|
||||
#define PAD_DOWN 1
|
||||
#define PAD_LEFT 2
|
||||
#define PAD_RIGHT 3
|
||||
@ -522,7 +522,7 @@ static int wpad_StickX(WPADData *data, u8 right)
|
||||
int min = js->min.x;
|
||||
int max = js->max.x;
|
||||
int center = js->center.x;
|
||||
|
||||
|
||||
/* some 3rd party controllers return invalid analog sticks calibration data */
|
||||
if ((min >= center) || (max <= center))
|
||||
{
|
||||
@ -580,7 +580,7 @@ static int wpad_StickY(WPADData *data, u8 right)
|
||||
int min = js->min.y;
|
||||
int max = js->max.y;
|
||||
int center = js->center.y;
|
||||
|
||||
|
||||
/* some 3rd party controllers return invalid analog sticks calibration data */
|
||||
if ((min >= center) || (max <= center))
|
||||
{
|
||||
@ -593,7 +593,7 @@ static int wpad_StickY(WPADData *data, u8 right)
|
||||
/* value returned could be above calibration limits */
|
||||
if (pos > max) return 127;
|
||||
if (pos < min) return -128;
|
||||
|
||||
|
||||
/* adjust against center position */
|
||||
pos -= center;
|
||||
|
||||
@ -784,7 +784,50 @@ static void wpad_config(u8 exp, int chan, int first_key, int last_key)
|
||||
}
|
||||
}
|
||||
|
||||
/* re-enable background PAD scanning and exit */
|
||||
/* Configurable menu key */
|
||||
GUI_MsgBoxUpdate(0,"Press key(s) for MENU");
|
||||
|
||||
/* reset key combo */
|
||||
config.wpad_keymap[4*exp + chan][KEY_MENU] = 0;
|
||||
|
||||
/* wait for user input */
|
||||
p = 0;
|
||||
while (!p)
|
||||
{
|
||||
VIDEO_WaitVSync();
|
||||
if (exp <= WPAD_EXP_CLASSIC)
|
||||
{
|
||||
WPAD_ScanPads();
|
||||
p = WPAD_ButtonsHeld(chan);
|
||||
}
|
||||
else
|
||||
{
|
||||
WiiDRC_ScanPads();
|
||||
p = WiiDRC_ButtonsHeld();
|
||||
}
|
||||
}
|
||||
|
||||
/* register keys until none are pressed anymore */
|
||||
while (p)
|
||||
{
|
||||
/* update key combo */
|
||||
config.wpad_keymap[4*exp + chan][KEY_MENU] |= p;
|
||||
|
||||
/* update WPAD status */
|
||||
VIDEO_WaitVSync();
|
||||
if (exp <= WPAD_EXP_CLASSIC)
|
||||
{
|
||||
WPAD_ScanPads();
|
||||
p = WPAD_ButtonsHeld(chan);
|
||||
}
|
||||
else
|
||||
{
|
||||
WiiDRC_ScanPads();
|
||||
p = WiiDRC_ButtonsHeld();
|
||||
}
|
||||
}
|
||||
|
||||
/* re-enable background WPAD scanning and exit */
|
||||
inputs_disabled = 0;
|
||||
}
|
||||
|
||||
@ -813,20 +856,15 @@ static void wpad_update(s8 chan, u8 i, u32 exp)
|
||||
|
||||
p = WiiDRC_ButtonsHeld();
|
||||
|
||||
/* Default Wii controller menu keys */
|
||||
/* Default fast-forward key combo */
|
||||
if (WiiDRC_ButtonsDown() & WIIDRC_BUTTON_HOME)
|
||||
{
|
||||
/* Default fast-forward key combo */
|
||||
if (p & WIIDRC_BUTTON_MINUS)
|
||||
{
|
||||
audioSync ^= AUDIO_WAIT;
|
||||
videoSync = (audioSync && config.vsync && (gc_pal != vdp_pal)) ? VIDEO_WAIT : 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Return to emulator settings */
|
||||
ConfigRequested = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Left Analog Stick */
|
||||
@ -847,6 +885,13 @@ static void wpad_update(s8 chan, u8 i, u32 exp)
|
||||
/* Retrieve current key mapping */
|
||||
u32 *wpad_keymap = config.wpad_keymap[4*exp + chan];
|
||||
|
||||
/* User configurable menu combo */
|
||||
if ((p & wpad_keymap[KEY_MENU]) == wpad_keymap[KEY_MENU])
|
||||
{
|
||||
ConfigRequested = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Emulated device */
|
||||
switch (input.dev[i])
|
||||
{
|
||||
@ -912,7 +957,7 @@ static void wpad_update(s8 chan, u8 i, u32 exp)
|
||||
{
|
||||
input.analog[i+1][0] = (x + 128);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
input.analog[i+1][0] = (y + 128);
|
||||
}
|
||||
@ -1351,7 +1396,6 @@ int gx_input_FindDevices(void)
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
void gx_input_SetDefault(void)
|
||||
{
|
||||
int i,j;
|
||||
@ -1383,6 +1427,7 @@ void gx_input_SetDefault(void)
|
||||
config.wpad_keymap[4*WPAD_EXP_NONE + i][KEY_BUTTONY] = 0;
|
||||
config.wpad_keymap[4*WPAD_EXP_NONE + i][KEY_BUTTONZ] = 0;
|
||||
config.wpad_keymap[4*WPAD_EXP_NONE + i][KEY_MODE] = 0;
|
||||
config.wpad_keymap[4*WPAD_EXP_NONE + i][KEY_MENU] = WPAD_BUTTON_HOME;
|
||||
|
||||
/* Wiimote + Nunchuk */
|
||||
config.wpad_keymap[4*WPAD_EXP_NUNCHUK + i][KEY_BUTTONA] = WPAD_NUNCHUK_BUTTON_Z;
|
||||
@ -1393,6 +1438,7 @@ void gx_input_SetDefault(void)
|
||||
config.wpad_keymap[4*WPAD_EXP_NUNCHUK + i][KEY_BUTTONY] = WPAD_BUTTON_1;
|
||||
config.wpad_keymap[4*WPAD_EXP_NUNCHUK + i][KEY_BUTTONZ] = WPAD_BUTTON_2;
|
||||
config.wpad_keymap[4*WPAD_EXP_NUNCHUK + i][KEY_MODE] = WPAD_BUTTON_MINUS;
|
||||
config.wpad_keymap[4*WPAD_EXP_NUNCHUK + i][KEY_MENU] = WPAD_BUTTON_HOME;
|
||||
|
||||
/* Classic Controller */
|
||||
config.wpad_keymap[4*WPAD_EXP_CLASSIC + i][KEY_BUTTONA] = WPAD_CLASSIC_BUTTON_Y;
|
||||
@ -1403,6 +1449,7 @@ void gx_input_SetDefault(void)
|
||||
config.wpad_keymap[4*WPAD_EXP_CLASSIC + i][KEY_BUTTONY] = WPAD_CLASSIC_BUTTON_ZR;
|
||||
config.wpad_keymap[4*WPAD_EXP_CLASSIC + i][KEY_BUTTONZ] = WPAD_CLASSIC_BUTTON_X;
|
||||
config.wpad_keymap[4*WPAD_EXP_CLASSIC + i][KEY_MODE] = WPAD_CLASSIC_BUTTON_MINUS;
|
||||
config.wpad_keymap[4*WPAD_EXP_CLASSIC + i][KEY_MENU] = WPAD_CLASSIC_BUTTON_HOME;
|
||||
|
||||
/* WiiU GamePad Controller */
|
||||
config.wpad_keymap[4*3][KEY_BUTTONA] = WIIDRC_BUTTON_Y;
|
||||
@ -1413,6 +1460,7 @@ void gx_input_SetDefault(void)
|
||||
config.wpad_keymap[4*3][KEY_BUTTONY] = WIIDRC_BUTTON_R;
|
||||
config.wpad_keymap[4*3][KEY_BUTTONZ] = WIIDRC_BUTTON_X;
|
||||
config.wpad_keymap[4*3][KEY_MODE] = WIIDRC_BUTTON_MINUS;
|
||||
config.wpad_keymap[4*3][KEY_MENU] = WIIDRC_BUTTON_HOME;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1684,7 +1732,7 @@ void gx_input_UpdateEmu(void)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Return to emulator settings */
|
||||
/* Return to main menu */
|
||||
ConfigRequested = 1;
|
||||
return;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Genesis Plus GX input support
|
||||
*
|
||||
* Copyright Eke-Eke (2007-2019)
|
||||
* Copyright Eke-Eke (2007-2022)
|
||||
*
|
||||
* Redistribution and use of this code or any derivative works are permitted
|
||||
* provided that the following conditions are met:
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Genesis Plus GX
|
||||
*
|
||||
* Copyright Eke-Eke (2007-2021), based on original work from Softdev (2006)
|
||||
* Copyright Eke-Eke (2007-2022), based on original work from Softdev (2006)
|
||||
*
|
||||
* Redistribution and use of this code or any derivative works are permitted
|
||||
* provided that the following conditions are met:
|
||||
@ -282,6 +282,11 @@ void reloadrom(void)
|
||||
config.hot_swap |= 2;
|
||||
}
|
||||
|
||||
/* Initialize CPU overclock ratio */
|
||||
m68k.cycle_ratio = (100 << M68K_OVERCLOCK_SHIFT) / (int)(config.m68k_overclock * 100.0);
|
||||
s68k.cycle_ratio = (100 << M68K_OVERCLOCK_SHIFT) / (int)(config.s68k_overclock * 100.0);
|
||||
z80_cycle_ratio = (100 << Z80_OVERCLOCK_SHIFT) / (int)(config.z80_overclock * 100.0);
|
||||
|
||||
/* Auto-Load Backup RAM */
|
||||
slot_autoload(0,config.s_device);
|
||||
|
||||
|
@ -1366,6 +1366,8 @@ static void check_variables(bool first_run)
|
||||
config.system = SYSTEM_SG;
|
||||
else if (var.value && !strcmp(var.value, "sg-1000 II"))
|
||||
config.system = SYSTEM_SGII;
|
||||
else if (var.value && !strcmp(var.value, "sg-1000 II + ram ext."))
|
||||
config.system = SYSTEM_SGII_RAM_EXT;
|
||||
else if (var.value && !strcmp(var.value, "mark-III"))
|
||||
config.system = SYSTEM_MARKIII;
|
||||
else if (var.value && !strcmp(var.value, "master system"))
|
||||
@ -1976,6 +1978,7 @@ static void check_variables(bool first_run)
|
||||
else if (var.value && !strcmp(var.value, "enabled"))
|
||||
config.vdp_fix_dma_boundary_bug = 1;
|
||||
}
|
||||
|
||||
#ifdef USE_PER_SOUND_CHANNELS_CONFIG
|
||||
var.key = psg_channel_volume_base_str;
|
||||
for (c = 0; c < 4; c++)
|
||||
@ -2341,7 +2344,33 @@ static void apply_cheats(void)
|
||||
{
|
||||
if (cheatlist[i].enable)
|
||||
{
|
||||
if (cheatlist[i].address < cart.romsize)
|
||||
/* detect Work RAM patch */
|
||||
if (cheatlist[i].address >= 0xFF0000)
|
||||
{
|
||||
/* add RAM patch */
|
||||
cheatIndexes[maxRAMcheats++] = i;
|
||||
}
|
||||
|
||||
/* check if Mega-CD game is running */
|
||||
else if ((system_hw == SYSTEM_MCD) && !scd.cartridge.boot)
|
||||
{
|
||||
/* detect PRG-RAM patch (Sub-CPU side) */
|
||||
if (cheatlist[i].address < 0x80000)
|
||||
{
|
||||
/* add RAM patch */
|
||||
cheatIndexes[maxRAMcheats++] = i;
|
||||
}
|
||||
|
||||
/* detect Word-RAM patch (Main-CPU side)*/
|
||||
else if ((cheatlist[i].address >= 0x200000) && (cheatlist[i].address < 0x240000))
|
||||
{
|
||||
/* add RAM patch */
|
||||
cheatIndexes[maxRAMcheats++] = i;
|
||||
}
|
||||
}
|
||||
|
||||
/* detect cartridge ROM patch */
|
||||
else if (cheatlist[i].address < cart.romsize)
|
||||
{
|
||||
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
||||
{
|
||||
@ -2371,19 +2400,20 @@ static void apply_cheats(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (cheatlist[i].address >= 0xFF0000)
|
||||
{
|
||||
/* add RAM patch */
|
||||
cheatIndexes[maxRAMcheats++] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void clear_cheats(void)
|
||||
{
|
||||
int i = maxcheats;
|
||||
/* disable cheats in reversed order in case the same address is used by multiple patches */
|
||||
int i;
|
||||
|
||||
/* no ROM patches with Mega-CD games */
|
||||
if ((system_hw == SYSTEM_MCD) && !scd.cartridge.boot)
|
||||
return;
|
||||
|
||||
/* disable cheats in reversed order in case the same address is used by multiple ROM patches */
|
||||
i = maxcheats;
|
||||
while (i > 0)
|
||||
{
|
||||
if (cheatlist[i-1].enable)
|
||||
@ -2420,21 +2450,45 @@ static void clear_cheats(void)
|
||||
****************************************************************************/
|
||||
static void RAMCheatUpdate(void)
|
||||
{
|
||||
uint8_t *base;
|
||||
uint32_t mask;
|
||||
int index, cnt = maxRAMcheats;
|
||||
|
||||
while (cnt)
|
||||
{
|
||||
/* get cheat index */
|
||||
index = cheatIndexes[--cnt];
|
||||
|
||||
/* detect destination RAM */
|
||||
switch ((cheatlist[index].address >> 20) & 0xf)
|
||||
{
|
||||
case 0x0: /* Mega-CD PRG-RAM (512 KB) */
|
||||
base = scd.prg_ram;
|
||||
mask = 0x7fffe;
|
||||
break;
|
||||
|
||||
case 0x2: /* Mega-CD 2M Word-RAM (256 KB) */
|
||||
base = scd.word_ram_2M;
|
||||
mask = 0x3fffe;
|
||||
break;
|
||||
|
||||
default: /* Work-RAM (64 KB) */
|
||||
base = work_ram;
|
||||
mask = 0xfffe;
|
||||
break;
|
||||
}
|
||||
|
||||
/* apply RAM patch */
|
||||
if (cheatlist[index].data & 0xFF00)
|
||||
{
|
||||
/* 16-bit patch */
|
||||
*(uint16_t *)(work_ram + (cheatlist[index].address & 0xFFFE)) = cheatlist[index].data;
|
||||
/* word patch */
|
||||
*(uint16_t *)(base + (cheatlist[index].address & mask)) = cheatlist[index].data;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 8-bit patch */
|
||||
work_ram[cheatlist[index].address & 0xFFFF] = cheatlist[index].data;
|
||||
/* byte patch */
|
||||
mask |= 1;
|
||||
base[cheatlist[index].address & mask] = cheatlist[index].data;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2483,7 +2537,7 @@ void ROMCheatUpdate(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void set_memory_maps()
|
||||
static void set_memory_maps(void)
|
||||
{
|
||||
if (system_hw == SYSTEM_MCD)
|
||||
{
|
||||
@ -3519,7 +3573,11 @@ size_t retro_get_memory_size(unsigned id)
|
||||
}
|
||||
}
|
||||
case RETRO_MEMORY_SYSTEM_RAM:
|
||||
if (system_hw == SYSTEM_SMS || system_hw == SYSTEM_SMS2 || system_hw == SYSTEM_GG || system_hw == SYSTEM_GGMS)
|
||||
if (system_hw == SYSTEM_SG)
|
||||
return 0x00400;
|
||||
else if (system_hw == SYSTEM_SGII)
|
||||
return 0x00800;
|
||||
else if (system_hw == SYSTEM_SGII_RAM_EXT || system_hw == SYSTEM_SMS || system_hw == SYSTEM_SMS2 || system_hw == SYSTEM_GG || system_hw == SYSTEM_GGMS || system_hw == SYSTEM_PBC)
|
||||
return 0x02000;
|
||||
else
|
||||
return 0x10000;
|
||||
|
@ -102,14 +102,15 @@ struct retro_core_option_v2_definition option_defs_us[] = {
|
||||
NULL,
|
||||
"system",
|
||||
{
|
||||
{ "auto", "Auto" },
|
||||
{ "sg-1000", "SG-1000" },
|
||||
{ "sg-1000 II", "SG-1000 II" },
|
||||
{ "mark-III", "Mark III" },
|
||||
{ "master system", "Master System" },
|
||||
{ "master system II", "Master System II" },
|
||||
{ "game gear", "Game Gear" },
|
||||
{ "mega drive / genesis", "Mega Drive/Genesis" },
|
||||
{ "auto", "Auto" },
|
||||
{ "sg-1000", "SG-1000" },
|
||||
{ "sg-1000 II", "SG-1000 II" },
|
||||
{ "sg-1000 II + ram ext.","SG-1000 II + RAM Ext."},
|
||||
{ "mark-III", "Mark III" },
|
||||
{ "master system", "Master System" },
|
||||
{ "master system II", "Master System II" },
|
||||
{ "game gear", "Game Gear" },
|
||||
{ "mega drive / genesis", "Mega Drive/Genesis" },
|
||||
{ NULL, NULL },
|
||||
},
|
||||
"auto"
|
||||
@ -825,7 +826,7 @@ struct retro_core_option_v2_definition option_defs_us[] = {
|
||||
},
|
||||
{
|
||||
CORE_NAME "_enhanced_vscroll",
|
||||
"Enchanced per-tile vertical scroll",
|
||||
"Enhanced per-tile vertical scroll",
|
||||
NULL,
|
||||
"Allows each individual cell to be scrolled vertically, instead of 16px 2-cell, by averaging out with the vscroll value of the neighbouring cell. This hack only applies to few games that use 2-cell vertical scroll mode.",
|
||||
NULL,
|
||||
@ -839,7 +840,7 @@ struct retro_core_option_v2_definition option_defs_us[] = {
|
||||
},
|
||||
{
|
||||
CORE_NAME "_enhanced_vscroll_limit",
|
||||
"Enchanced per-tile vertical scroll limit",
|
||||
"Enhanced per-tile vertical scroll limit",
|
||||
NULL,
|
||||
"Only when Enchance per-tile vertical scroll is enabled. Adjusts the limit of the vertical scroll enhancement. When the vscroll difference between neighbouring tiles is bigger than this limit, the enhancement is disabled.",
|
||||
NULL,
|
||||
|
@ -26,7 +26,7 @@ void set_config_defaults(void)
|
||||
config.mono = 0;
|
||||
|
||||
/* system options */
|
||||
config.system = 0; /* = AUTO (or SYSTEM_SG, SYSTEM_MARKIII, SYSTEM_SMS, SYSTEM_SMS2, SYSTEM_GG, SYSTEM_MD) */
|
||||
config.system = 0; /* = AUTO (or SYSTEM_SG, SYSTEM_SGII, SYSTEM_SGII_RAM_EXT, SYSTEM_MARKIII, SYSTEM_SMS, SYSTEM_SMS2, SYSTEM_GG, SYSTEM_MD) */
|
||||
config.region_detect = 0; /* = AUTO (1 = USA, 2 = EUROPE, 3 = JAPAN/NTSC, 4 = JAPAN/PAL) */
|
||||
config.vdp_mode = 0; /* = AUTO (1 = NTSC, 2 = PAL) */
|
||||
config.master_clock = 0; /* = AUTO (1 = NTSC, 2 = PAL) */
|
||||
|
@ -29,7 +29,7 @@ void set_config_defaults(void)
|
||||
config.mono = 0;
|
||||
|
||||
/* system options */
|
||||
config.system = 0; /* = AUTO (or SYSTEM_SG, SYSTEM_MARKIII, SYSTEM_SMS, SYSTEM_SMS2, SYSTEM_GG, SYSTEM_MD) */
|
||||
config.system = 0; /* = AUTO (or SYSTEM_SG, SYSTEM_SGII, SYSTEM_SGII_RAM_EXT, SYSTEM_MARKIII, SYSTEM_SMS, SYSTEM_SMS2, SYSTEM_GG, SYSTEM_MD) */
|
||||
config.region_detect = 0; /* = AUTO (1 = USA, 2 = EUROPE, 3 = JAPAN/NTSC, 4 = JAPAN/PAL) */
|
||||
config.vdp_mode = 0; /* = AUTO (1 = NTSC, 2 = PAL) */
|
||||
config.master_clock = 0; /* = AUTO (1 = NTSC, 2 = PAL) */
|
||||
|
Loading…
Reference in New Issue
Block a user