mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-04 01:45:08 +01:00
Merge git://github.com/ekeeke/Genesis-Plus-GX
Conflicts: libretro/libretro.c
This commit is contained in:
commit
5df07b84b8
155
Makefile.win32
155
Makefile.win32
@ -6,9 +6,9 @@
|
|||||||
#
|
#
|
||||||
# Defines :
|
# Defines :
|
||||||
# -DLSB_FIRST : for little endian systems.
|
# -DLSB_FIRST : for little endian systems.
|
||||||
# -DBUILD_TABLES: do not use const tables for 68k instructions (obsolete)
|
|
||||||
# -DLOGERROR : enable message logging
|
# -DLOGERROR : enable message logging
|
||||||
# -DLOGVDP : enable VDP debug messages
|
# -DLOGVDP : enable VDP debug messages
|
||||||
|
# -DLOGSOUND : enable AUDIO debug messages
|
||||||
# -DLOG_SCD : enable SCD debug messages
|
# -DLOG_SCD : enable SCD debug messages
|
||||||
# -DLOG_CDD : enable CDD debug messages
|
# -DLOG_CDD : enable CDD debug messages
|
||||||
# -DLOG_CDC : enable CDC debug messages
|
# -DLOG_CDC : enable CDC debug messages
|
||||||
@ -23,125 +23,124 @@ NAME = gen_sdl.exe
|
|||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = `sdl-config --cflags` -march=i686 -O6 -fomit-frame-pointer -Wall -Wno-strict-aliasing -ansi -std=c89 -pedantic-errors
|
CFLAGS = `sdl-config --cflags` -march=i686 -O6 -fomit-frame-pointer -Wall -Wno-strict-aliasing -ansi -std=c89 -pedantic-errors
|
||||||
#-ansi -pedantic-errors
|
|
||||||
#-g -ggdb -pg
|
#-g -ggdb -pg
|
||||||
#-fomit-frame-pointer
|
#-fomit-frame-pointer
|
||||||
LDFLAGS =
|
#LDFLAGS = -pg
|
||||||
DEFINES = -DLSB_FIRST -DUSE_16BPP_RENDERING
|
DEFINES = -DLSB_FIRST -DUSE_16BPP_RENDERING
|
||||||
|
|
||||||
INCLUDES = -I. -I.. -I../z80 -I../m68k -I../sound -I../input_hw -I../cart_hw -I../cd_hw -I../cart_hw/svp -I../ntsc
|
INCLUDES = -Isource -Isource/z80 -Isource/m68k -Isource/sound -Isource/input_hw -Isource/cart_hw -Isource/cd_hw -Isource/cart_hw/svp -Isource/ntsc -Isource/win
|
||||||
LIBS = `sdl-config --libs` -lz -lm
|
LIBS = `sdl-config --libs` -lz -lm
|
||||||
|
|
||||||
OBJECTS = obj/z80.o
|
OBJDIR = ./build_sdl
|
||||||
|
|
||||||
OBJECTS += obj/m68kcpu.o \
|
OBJECTS = $(OBJDIR)/z80.o
|
||||||
obj/s68kcpu.o \
|
|
||||||
|
|
||||||
OBJECTS += obj/genesis.o \
|
OBJECTS += $(OBJDIR)/m68kcpu.o \
|
||||||
obj/vdp_ctrl.o \
|
$(OBJDIR)/s68kcpu.o
|
||||||
obj/vdp_render.o \
|
|
||||||
obj/system.o \
|
|
||||||
obj/io_ctrl.o \
|
|
||||||
obj/mem68k.o \
|
|
||||||
obj/memz80.o \
|
|
||||||
obj/membnk.o \
|
|
||||||
obj/state.o
|
|
||||||
|
|
||||||
OBJECTS += obj/input.o \
|
OBJECTS += $(OBJDIR)/genesis.o \
|
||||||
obj/gamepad.o \
|
$(OBJDIR)/vdp_ctrl.o \
|
||||||
obj/lightgun.o \
|
$(OBJDIR)/vdp_render.o \
|
||||||
obj/mouse.o \
|
$(OBJDIR)/system.o \
|
||||||
obj/activator.o \
|
$(OBJDIR)/io_ctrl.o \
|
||||||
obj/xe_a1p.o \
|
$(OBJDIR)/mem68k.o \
|
||||||
obj/teamplayer.o \
|
$(OBJDIR)/memz80.o \
|
||||||
obj/paddle.o \
|
$(OBJDIR)/membnk.o \
|
||||||
obj/sportspad.o \
|
$(OBJDIR)/state.o \
|
||||||
obj/terebi_oekaki.o
|
$(OBJDIR)/loadrom.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/input.o \
|
||||||
|
$(OBJDIR)/gamepad.o \
|
||||||
|
$(OBJDIR)/lightgun.o \
|
||||||
|
$(OBJDIR)/mouse.o \
|
||||||
|
$(OBJDIR)/activator.o \
|
||||||
|
$(OBJDIR)/xe_a1p.o \
|
||||||
|
$(OBJDIR)/teamplayer.o \
|
||||||
|
$(OBJDIR)/paddle.o \
|
||||||
|
$(OBJDIR)/sportspad.o \
|
||||||
|
$(OBJDIR)/terebi_oekaki.o
|
||||||
|
|
||||||
OBJECTS += obj/sound.o \
|
OBJECTS += $(OBJDIR)/sound.o \
|
||||||
obj/sn76489.o \
|
$(OBJDIR)/sn76489.o \
|
||||||
obj/ym2413.o \
|
$(OBJDIR)/ym2413.o \
|
||||||
obj/ym2612.o
|
$(OBJDIR)/ym2612.o
|
||||||
|
|
||||||
OBJECTS += obj/blip_buf.o
|
OBJECTS += $(OBJDIR)/blip_buf.o
|
||||||
|
|
||||||
OBJECTS += obj/eq.o \
|
OBJECTS += $(OBJDIR)/eq.o
|
||||||
|
|
||||||
OBJECTS += obj/sram.o \
|
OBJECTS += $(OBJDIR)/sram.o \
|
||||||
obj/svp.o \
|
$(OBJDIR)/svp.o \
|
||||||
obj/ssp16.o \
|
$(OBJDIR)/ssp16.o \
|
||||||
obj/ggenie.o \
|
$(OBJDIR)/ggenie.o \
|
||||||
obj/areplay.o \
|
$(OBJDIR)/areplay.o \
|
||||||
obj/eeprom_93c.o \
|
$(OBJDIR)/eeprom_93c.o \
|
||||||
obj/eeprom_i2c.o \
|
$(OBJDIR)/eeprom_i2c.o \
|
||||||
obj/eeprom_spi.o \
|
$(OBJDIR)/eeprom_spi.o \
|
||||||
obj/md_cart.o \
|
$(OBJDIR)/md_cart.o \
|
||||||
obj/sms_cart.o
|
$(OBJDIR)/sms_cart.o
|
||||||
|
|
||||||
OBJECTS += obj/scd.o \
|
OBJECTS += $(OBJDIR)/scd.o \
|
||||||
obj/cdd.o \
|
$(OBJDIR)/cdd.o \
|
||||||
obj/cdc.o \
|
$(OBJDIR)/cdc.o \
|
||||||
obj/gfx.o \
|
$(OBJDIR)/gfx.o \
|
||||||
obj/pcm.o \
|
$(OBJDIR)/pcm.o \
|
||||||
obj/cd_cart.o
|
$(OBJDIR)/cd_cart.o
|
||||||
|
|
||||||
OBJECTS += obj/main.o \
|
OBJECTS += $(OBJDIR)/sms_ntsc.o \
|
||||||
obj/config.o \
|
$(OBJDIR)/md_ntsc.o
|
||||||
obj/error.o \
|
|
||||||
obj/unzip.o \
|
|
||||||
obj/fileio.o \
|
|
||||||
obj/loadrom.o
|
|
||||||
|
|
||||||
OBJECTS += obj/sms_ntsc.o \
|
OBJECTS += $(OBJDIR)/main.o \
|
||||||
obj/md_ntsc.o
|
$(OBJDIR)/config.o \
|
||||||
|
$(OBJDIR)/error.o \
|
||||||
|
$(OBJDIR)/unzip.o \
|
||||||
|
$(OBJDIR)/fileio.o
|
||||||
|
|
||||||
OBJECTS += obj/icon.o
|
OBJECTS += $(OBJDIR)/icon.o
|
||||||
|
|
||||||
all: $(NAME)
|
all: $(NAME)
|
||||||
|
|
||||||
$(NAME): $(OBJECTS)
|
$(NAME): $(OBJDIR) $(OBJECTS)
|
||||||
$(CC) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@ -Wl,-Map,genplus.map
|
$(CC) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@
|
||||||
|
|
||||||
obj/%.o : ../%.c ../%.h
|
$(OBJDIR) :
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : source/%.c source/%.h
|
||||||
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
obj/%.o : ../asm/%.s
|
$(OBJDIR)/%.o : source/sound/%.c source/sound/%.h
|
||||||
$(AS) $< -o $@
|
|
||||||
|
|
||||||
obj/%.o : ../sound/%.c ../sound/%.h
|
|
||||||
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
|
||||||
obj/%.o : ../sound/%.c
|
|
||||||
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
obj/%.o : ../input_hw/%.c ../input_hw/%.h
|
$(OBJDIR)/%.o : source/input_hw/%.c source/input_hw/%.h
|
||||||
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
obj/%.o : ../cart_hw/%.c ../cart_hw/%.h
|
$(OBJDIR)/%.o : source/cart_hw/%.c source/cart_hw/%.h
|
||||||
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
obj/%.o : ../cart_hw/svp/%.c
|
$(OBJDIR)/%.o : source/cart_hw/svp/%.c
|
||||||
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
|
||||||
obj/%.o : ../cart_hw/svp/%.c ../cart_hw/svp/%.h
|
|
||||||
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
obj/%.o : ../cd_hw/%.c
|
$(OBJDIR)/%.o : source/cart_hw/svp/%.c source/cart_hw/svp/%.h
|
||||||
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
obj/%.o : ../z80/%.c ../z80/%.h
|
$(OBJDIR)/%.o : source/cd_hw/%.c source/cd_hw/%.h
|
||||||
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
obj/%.o : ../m68k/%.c
|
$(OBJDIR)/%.o : source/z80/%.c source/z80/%.h
|
||||||
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
obj/%.o : ./%.c ./%.h
|
$(OBJDIR)/%.o : source/m68k/%.c
|
||||||
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
obj/%.o : ../ntsc/%.c ../ntsc/%.h
|
$(OBJDIR)/%.o : source/ntsc/%.c source/ntsc/%.h
|
||||||
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
obj/icon.o :
|
$(OBJDIR)/%.o : source/win/%.c source/win/%.h
|
||||||
windres icon.rc $@
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/icon.o :
|
||||||
|
windres source/win/icon.rc $@
|
||||||
|
|
||||||
pack :
|
pack :
|
||||||
strip $(NAME)
|
strip $(NAME)
|
||||||
|
@ -213,7 +213,7 @@ static void config_default(void)
|
|||||||
config.psg_preamp = 150;
|
config.psg_preamp = 150;
|
||||||
config.fm_preamp = 100;
|
config.fm_preamp = 100;
|
||||||
config.hq_fm = 1;
|
config.hq_fm = 1;
|
||||||
config.psgBoostNoise = 0;
|
config.psgBoostNoise = 1;
|
||||||
config.filter = 0;
|
config.filter = 0;
|
||||||
config.lp_range = 50;
|
config.lp_range = 50;
|
||||||
config.low_freq = 880;
|
config.low_freq = 880;
|
||||||
@ -221,7 +221,6 @@ static void config_default(void)
|
|||||||
config.lg = 1.0;
|
config.lg = 1.0;
|
||||||
config.mg = 1.0;
|
config.mg = 1.0;
|
||||||
config.hg = 1.0;
|
config.hg = 1.0;
|
||||||
config.rolloff = 0.990;
|
|
||||||
config.dac_bits = 14;
|
config.dac_bits = 14;
|
||||||
config.ym2413 = 2; /* AUTO */
|
config.ym2413 = 2; /* AUTO */
|
||||||
|
|
||||||
@ -243,6 +242,7 @@ static void config_default(void)
|
|||||||
config.yscale = 0;
|
config.yscale = 0;
|
||||||
config.aspect = 0;
|
config.aspect = 0;
|
||||||
config.overscan = 0; /* 3 == FULL */
|
config.overscan = 0; /* 3 == FULL */
|
||||||
|
config.gg_extra = 0; /* 1 = show extended Game Gear screen (256x192) */
|
||||||
#if defined(USE_NTSC)
|
#if defined(USE_NTSC)
|
||||||
config.ntsc = 1;
|
config.ntsc = 1;
|
||||||
#endif
|
#endif
|
||||||
@ -272,12 +272,9 @@ static void config_default(void)
|
|||||||
config.hot_swap &= 1;
|
config.hot_swap &= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const double pal_fps = 53203424.0 / (3420.0 * 313.0);
|
|
||||||
static const double ntsc_fps = 53693175.0 / (3420.0 * 262.0);
|
|
||||||
|
|
||||||
static void init_audio(void)
|
static void init_audio(void)
|
||||||
{
|
{
|
||||||
audio_init(44100, vdp_pal ? pal_fps : ntsc_fps);
|
audio_init(44100, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void configure_controls(void)
|
static void configure_controls(void)
|
||||||
@ -978,6 +975,7 @@ void retro_init(void)
|
|||||||
|
|
||||||
void retro_deinit(void)
|
void retro_deinit(void)
|
||||||
{
|
{
|
||||||
|
audio_shutdown();
|
||||||
#if defined(USE_NTSC)
|
#if defined(USE_NTSC)
|
||||||
free(md_ntsc);
|
free(md_ntsc);
|
||||||
free(sms_ntsc);
|
free(sms_ntsc);
|
||||||
|
@ -751,11 +751,21 @@ void cdd_read_audio(unsigned int samples)
|
|||||||
blip_add_delta_fast(blip[1], i, delta);
|
blip_add_delta_fast(blip[1], i, delta);
|
||||||
|
|
||||||
/* update CD-DA fader volume (one step/sample) */
|
/* update CD-DA fader volume (one step/sample) */
|
||||||
if (curVol < endVol) curVol++;
|
if (curVol < endVol)
|
||||||
else if (curVol > endVol) curVol--;
|
{
|
||||||
|
/* fade-in */
|
||||||
/* audio is muted */
|
curVol++;
|
||||||
if (!endVol) break;
|
}
|
||||||
|
else if (curVol > endVol)
|
||||||
|
{
|
||||||
|
/* fade-out */
|
||||||
|
curVol--;
|
||||||
|
}
|
||||||
|
else if (!curVol)
|
||||||
|
{
|
||||||
|
/* audio will remain muted until next setup */
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* save current CD-DA fader volume */
|
/* save current CD-DA fader volume */
|
||||||
|
@ -99,9 +99,9 @@ void config_default(void)
|
|||||||
config.psg_preamp = 150;
|
config.psg_preamp = 150;
|
||||||
config.fm_preamp = 100;
|
config.fm_preamp = 100;
|
||||||
config.hq_fm = 1;
|
config.hq_fm = 1;
|
||||||
config.psgBoostNoise = 0;
|
config.psgBoostNoise = 1;
|
||||||
config.filter = 0;
|
config.filter = 0;
|
||||||
config.lp_range = 50;
|
config.lp_range = 60;
|
||||||
config.low_freq = 880;
|
config.low_freq = 880;
|
||||||
config.high_freq = 5000;
|
config.high_freq = 5000;
|
||||||
config.lg = 1.0;
|
config.lg = 1.0;
|
||||||
|
@ -903,11 +903,11 @@ static void soundmenu ()
|
|||||||
config.psg_preamp = (int)(psg_volume * 100.0 + 0.5);
|
config.psg_preamp = (int)(psg_volume * 100.0 + 0.5);
|
||||||
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
||||||
{
|
{
|
||||||
SN76489_Config(config.psg_preamp, config.psgBoostNoise, 0xff);
|
SN76489_Config(0, config.psg_preamp, config.psgBoostNoise, 0xff);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SN76489_Config(config.psg_preamp, config.psgBoostNoise, io_reg[6]);
|
SN76489_Config(0, config.psg_preamp, config.psgBoostNoise, io_reg[6]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -918,11 +918,11 @@ static void soundmenu ()
|
|||||||
sprintf (items[5].text, "PSG Noise Boost: %s", config.psgBoostNoise ? "ON":"OFF");
|
sprintf (items[5].text, "PSG Noise Boost: %s", config.psgBoostNoise ? "ON":"OFF");
|
||||||
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
||||||
{
|
{
|
||||||
SN76489_Config(config.psg_preamp, config.psgBoostNoise, 0xff);
|
SN76489_Config(0, config.psg_preamp, config.psgBoostNoise, 0xff);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SN76489_Config(config.psg_preamp, config.psgBoostNoise, io_reg[6]);
|
SN76489_Config(0, config.psg_preamp, config.psgBoostNoise, io_reg[6]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1629,7 +1629,7 @@ int gx_video_Update(void)
|
|||||||
|
|
||||||
/* copy EFB to XFB */
|
/* copy EFB to XFB */
|
||||||
GX_DrawDone();
|
GX_DrawDone();
|
||||||
GX_CopyDisp(xfb[whichfb], GX_FALSE);
|
GX_CopyDisp(xfb[whichfb], GX_TRUE);
|
||||||
GX_Flush();
|
GX_Flush();
|
||||||
|
|
||||||
/* XFB is ready to be displayed */
|
/* XFB is ready to be displayed */
|
||||||
|
@ -547,7 +547,7 @@ void io_gg_write(unsigned int offset, unsigned int data)
|
|||||||
|
|
||||||
case 6: /* PSG Stereo output control */
|
case 6: /* PSG Stereo output control */
|
||||||
io_reg[6] = data;
|
io_reg[6] = data;
|
||||||
SN76489_Config(config.psg_preamp, config.psgBoostNoise, data);
|
SN76489_Config(Z80.cycles, config.psg_preamp, config.psgBoostNoise, data);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default: /* Read-only */
|
default: /* Read-only */
|
||||||
|
@ -157,29 +157,6 @@ void SN76489_Reset()
|
|||||||
SN76489.clocks = 0;
|
SN76489.clocks = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SN76489_Config(int preAmp, int boostNoise, int stereo)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i=0; i<4; i++)
|
|
||||||
{
|
|
||||||
/* stereo channel pre-amplification */
|
|
||||||
SN76489.PreAmp[i][0] = preAmp * ((stereo >> (i*2)) & 1);
|
|
||||||
SN76489.PreAmp[i][1] = preAmp * ((stereo >> (i*2 + 1)) & 1);
|
|
||||||
|
|
||||||
/* noise channel boost */
|
|
||||||
if (i == 3)
|
|
||||||
{
|
|
||||||
SN76489.PreAmp[3][0] = SN76489.PreAmp[3][0] << boostNoise;
|
|
||||||
SN76489.PreAmp[3][1] = SN76489.PreAmp[3][1] << boostNoise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* update stereo channel amplitude */
|
|
||||||
SN76489.Channel[i][0]= (PSGVolumeValues[SN76489.Registers[i*2 + 1]] * SN76489.PreAmp[i][0]) / 100;
|
|
||||||
SN76489.Channel[i][1]= (PSGVolumeValues[SN76489.Registers[i*2 + 1]] * SN76489.PreAmp[i][1]) / 100;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void *SN76489_GetContextPtr(void)
|
void *SN76489_GetContextPtr(void)
|
||||||
{
|
{
|
||||||
return (uint8 *)&SN76489;
|
return (uint8 *)&SN76489;
|
||||||
@ -331,6 +308,39 @@ static void SN76489_RunUntil(unsigned int clocks)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SN76489_Config(unsigned int clocks, int preAmp, int boostNoise, int stereo)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* cycle-accurate Game Gear stereo */
|
||||||
|
if (clocks > SN76489.clocks)
|
||||||
|
{
|
||||||
|
/* Run chip until current timestamp */
|
||||||
|
SN76489_RunUntil(clocks);
|
||||||
|
|
||||||
|
/* Update internal M-cycle counter */
|
||||||
|
SN76489.clocks += ((clocks - SN76489.clocks + PSG_MCYCLES_RATIO - 1) / PSG_MCYCLES_RATIO) * PSG_MCYCLES_RATIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0; i<4; i++)
|
||||||
|
{
|
||||||
|
/* stereo channel pre-amplification */
|
||||||
|
SN76489.PreAmp[i][0] = preAmp * ((stereo >> (i + 4)) & 1);
|
||||||
|
SN76489.PreAmp[i][1] = preAmp * ((stereo >> (i + 0)) & 1);
|
||||||
|
|
||||||
|
/* noise channel boost */
|
||||||
|
if (i == 3)
|
||||||
|
{
|
||||||
|
SN76489.PreAmp[3][0] = SN76489.PreAmp[3][0] << boostNoise;
|
||||||
|
SN76489.PreAmp[3][1] = SN76489.PreAmp[3][1] << boostNoise;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* update stereo channel amplitude */
|
||||||
|
SN76489.Channel[i][0]= (PSGVolumeValues[SN76489.Registers[i*2 + 1]] * SN76489.PreAmp[i][0]) / 100;
|
||||||
|
SN76489.Channel[i][1]= (PSGVolumeValues[SN76489.Registers[i*2 + 1]] * SN76489.PreAmp[i][1]) / 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SN76489_Update(unsigned int clocks)
|
void SN76489_Update(unsigned int clocks)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -424,7 +434,7 @@ void SN76489_Write(unsigned int clocks, unsigned int data)
|
|||||||
SN76489.NoiseShiftRegister = NoiseInitialState;
|
SN76489.NoiseShiftRegister = NoiseInitialState;
|
||||||
|
|
||||||
/* set noise signal generator frequency */
|
/* set noise signal generator frequency */
|
||||||
SN76489.NoiseFreq = (0x10 << (data&0x3)) * PSG_MCYCLES_RATIO;
|
SN76489.NoiseFreq = 0x10 << (data&0x3);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
extern void SN76489_Init(blip_t* left, blip_t* right, int type);
|
extern void SN76489_Init(blip_t* left, blip_t* right, int type);
|
||||||
extern void SN76489_Reset(void);
|
extern void SN76489_Reset(void);
|
||||||
extern void SN76489_Config(int preAmp, int boostNoise, int stereo);
|
extern void SN76489_Config(unsigned int clocks, int preAmp, int boostNoise, int stereo);
|
||||||
extern void SN76489_Write(unsigned int clocks, unsigned int data);
|
extern void SN76489_Write(unsigned int clocks, unsigned int data);
|
||||||
extern void SN76489_Update(unsigned int cycles);
|
extern void SN76489_Update(unsigned int cycles);
|
||||||
extern void *SN76489_GetContextPtr(void);
|
extern void *SN76489_GetContextPtr(void);
|
||||||
|
@ -102,7 +102,7 @@ void sound_init( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize PSG chip */
|
/* Initialize PSG chip */
|
||||||
SN76489_Config(config.psg_preamp, config.psgBoostNoise, 0xff);
|
SN76489_Config(0, config.psg_preamp, config.psgBoostNoise, 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sound_reset(void)
|
void sound_reset(void)
|
||||||
|
@ -117,12 +117,12 @@ int state_load(unsigned char *state)
|
|||||||
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
||||||
{
|
{
|
||||||
SN76489_Init(snd.blips[0][0], snd.blips[0][1], SN_INTEGRATED);
|
SN76489_Init(snd.blips[0][0], snd.blips[0][1], SN_INTEGRATED);
|
||||||
SN76489_Config(config.psg_preamp, config.psgBoostNoise, 0xff);
|
SN76489_Config(0, config.psg_preamp, config.psgBoostNoise, 0xff);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SN76489_Init(snd.blips[0][0], snd.blips[0][1], (system_hw < SYSTEM_MARKIII) ? SN_DISCRETE : SN_INTEGRATED);
|
SN76489_Init(snd.blips[0][0], snd.blips[0][1], (system_hw < SYSTEM_MARKIII) ? SN_DISCRETE : SN_INTEGRATED);
|
||||||
SN76489_Config(config.psg_preamp, config.psgBoostNoise, io_reg[6]);
|
SN76489_Config(0, config.psg_preamp, config.psgBoostNoise, io_reg[6]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 68000 */
|
/* 68000 */
|
||||||
|
@ -12,8 +12,8 @@ void set_config_defaults(void)
|
|||||||
config.psg_preamp = 150;
|
config.psg_preamp = 150;
|
||||||
config.fm_preamp = 100;
|
config.fm_preamp = 100;
|
||||||
config.hq_fm = 1;
|
config.hq_fm = 1;
|
||||||
config.psgBoostNoise = 0;
|
config.psgBoostNoise = 1;
|
||||||
config.filter = 1;
|
config.filter = 0;
|
||||||
config.low_freq = 200;
|
config.low_freq = 200;
|
||||||
config.high_freq = 8000;
|
config.high_freq = 8000;
|
||||||
config.lg = 1.0;
|
config.lg = 1.0;
|
||||||
@ -34,7 +34,7 @@ void set_config_defaults(void)
|
|||||||
config.lock_on = 0; /* = OFF (can be TYPE_SK, TYPE_GG & TYPE_AR) */
|
config.lock_on = 0; /* = OFF (can be TYPE_SK, TYPE_GG & TYPE_AR) */
|
||||||
|
|
||||||
/* display options */
|
/* display options */
|
||||||
config.overscan = 0; /* = both ON (0 = no borders , 1 = vertical borders only, 2 = horizontal borders only) */
|
config.overscan = 0; /* 3 = all borders (0 = no borders , 1 = vertical borders only, 2 = horizontal borders only) */
|
||||||
config.gg_extra = 0; /* 1 = show extended Game Gear screen (256x192) */
|
config.gg_extra = 0; /* 1 = show extended Game Gear screen (256x192) */
|
||||||
config.render = 0; /* 1 = double resolution output (only when interlaced mode 2 is enabled) */
|
config.render = 0; /* 1 = double resolution output (only when interlaced mode 2 is enabled) */
|
||||||
|
|
||||||
|
@ -892,7 +892,6 @@ int main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
system_shutdown();
|
|
||||||
audio_shutdown();
|
audio_shutdown();
|
||||||
error_shutdown();
|
error_shutdown();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user