mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-10 21:05:12 +01:00
This commit is contained in:
commit
ac55e5a720
@ -1,79 +0,0 @@
|
||||
SOURCES_C := $(GENPLUS_SRC_DIR)/genesis.c \
|
||||
$(GENPLUS_SRC_DIR)/vdp_ctrl.c \
|
||||
$(GENPLUS_SRC_DIR)/vdp_render.c \
|
||||
$(GENPLUS_SRC_DIR)/system.c \
|
||||
$(GENPLUS_SRC_DIR)/io_ctrl.c \
|
||||
$(GENPLUS_SRC_DIR)/loadrom.c \
|
||||
$(GENPLUS_SRC_DIR)/mem68k.c \
|
||||
$(GENPLUS_SRC_DIR)/state.c \
|
||||
$(GENPLUS_SRC_DIR)/memz80.c \
|
||||
$(GENPLUS_SRC_DIR)/membnk.c \
|
||||
$(GENPLUS_SRC_DIR)/input_hw/activator.c \
|
||||
$(GENPLUS_SRC_DIR)/input_hw/gamepad.c \
|
||||
$(GENPLUS_SRC_DIR)/input_hw/input.c \
|
||||
$(GENPLUS_SRC_DIR)/input_hw/lightgun.c \
|
||||
$(GENPLUS_SRC_DIR)/input_hw/mouse.c \
|
||||
$(GENPLUS_SRC_DIR)/input_hw/paddle.c \
|
||||
$(GENPLUS_SRC_DIR)/input_hw/sportspad.c \
|
||||
$(GENPLUS_SRC_DIR)/input_hw/teamplayer.c \
|
||||
$(GENPLUS_SRC_DIR)/input_hw/xe_1ap.c \
|
||||
$(GENPLUS_SRC_DIR)/input_hw/terebi_oekaki.c \
|
||||
$(GENPLUS_SRC_DIR)/input_hw/graphic_board.c \
|
||||
$(GENPLUS_SRC_DIR)/cd_hw/cd_cart.c \
|
||||
$(GENPLUS_SRC_DIR)/cd_hw/cdc.c \
|
||||
$(GENPLUS_SRC_DIR)/cd_hw/cdd.c \
|
||||
$(GENPLUS_SRC_DIR)/cd_hw/gfx.c \
|
||||
$(GENPLUS_SRC_DIR)/cd_hw/pcm.c \
|
||||
$(GENPLUS_SRC_DIR)/cd_hw/scd.c \
|
||||
$(GENPLUS_SRC_DIR)/cart_hw/areplay.c \
|
||||
$(GENPLUS_SRC_DIR)/cart_hw/md_cart.c \
|
||||
$(GENPLUS_SRC_DIR)/cart_hw/sms_cart.c \
|
||||
$(GENPLUS_SRC_DIR)/cart_hw/eeprom_93c.c \
|
||||
$(GENPLUS_SRC_DIR)/cart_hw/eeprom_i2c.c \
|
||||
$(GENPLUS_SRC_DIR)/cart_hw/eeprom_spi.c \
|
||||
$(GENPLUS_SRC_DIR)/cart_hw/ggenie.c \
|
||||
$(GENPLUS_SRC_DIR)/cart_hw/sram.c \
|
||||
$(GENPLUS_SRC_DIR)/cart_hw/svp/ssp16.c \
|
||||
$(GENPLUS_SRC_DIR)/cart_hw/svp/svp.c \
|
||||
$(GENPLUS_SRC_DIR)/ntsc/md_ntsc.c \
|
||||
$(GENPLUS_SRC_DIR)/ntsc/sms_ntsc.c \
|
||||
$(GENPLUS_SRC_DIR)/sound/eq.c \
|
||||
$(GENPLUS_SRC_DIR)/sound/sound.c \
|
||||
$(GENPLUS_SRC_DIR)/sound/ym2612.c \
|
||||
$(GENPLUS_SRC_DIR)/sound/ym2413.c \
|
||||
$(GENPLUS_SRC_DIR)/sound/sn76489.c \
|
||||
$(GENPLUS_SRC_DIR)/sound/blip_buf.c \
|
||||
$(GENPLUS_SRC_DIR)/z80/z80.c \
|
||||
$(GENPLUS_SRC_DIR)/m68k/m68kcpu.c \
|
||||
$(GENPLUS_SRC_DIR)/m68k/s68kcpu.c \
|
||||
$(TREMOR_SRC_DIR)/bitwise.c \
|
||||
$(TREMOR_SRC_DIR)/block.c \
|
||||
$(TREMOR_SRC_DIR)/codebook.c \
|
||||
$(TREMOR_SRC_DIR)/floor0.c \
|
||||
$(TREMOR_SRC_DIR)/floor1.c \
|
||||
$(TREMOR_SRC_DIR)/framing.c \
|
||||
$(TREMOR_SRC_DIR)/info.c \
|
||||
$(TREMOR_SRC_DIR)/mapping0.c \
|
||||
$(TREMOR_SRC_DIR)/mdct.c \
|
||||
$(TREMOR_SRC_DIR)/registry.c \
|
||||
$(TREMOR_SRC_DIR)/res012.c \
|
||||
$(TREMOR_SRC_DIR)/sharedbook.c \
|
||||
$(TREMOR_SRC_DIR)/synthesis.c \
|
||||
$(TREMOR_SRC_DIR)/vorbisfile.c \
|
||||
$(TREMOR_SRC_DIR)/window.c \
|
||||
$(LIBRETRO_DIR)/libretro.c
|
||||
|
||||
ifeq ($(WANT_CRC32), 1)
|
||||
SOURCES_C += $(LIBRETRO_DIR)/scrc32.c
|
||||
endif
|
||||
|
||||
INCFLAGS += -I$(GENPLUS_SRC_DIR) \
|
||||
-I$(GENPLUS_SRC_DIR)/sound \
|
||||
-I$(GENPLUS_SRC_DIR)/input_hw \
|
||||
-I$(GENPLUS_SRC_DIR)/cart_hw \
|
||||
-I$(GENPLUS_SRC_DIR)/cd_hw \
|
||||
-I$(GENPLUS_SRC_DIR)/cart_hw/svp \
|
||||
-I$(GENPLUS_SRC_DIR)/m68k \
|
||||
-I$(GENPLUS_SRC_DIR)/z80 \
|
||||
-I$(GENPLUS_SRC_DIR)/ntsc \
|
||||
-I$(LIBRETRO_DIR)
|
@ -203,19 +203,19 @@ endif
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0 -g
|
||||
else ifeq ($(platform),qnx)
|
||||
CFLAGS += -Os -DNDEBUG
|
||||
CFLAGS += -Os -DNDEBUG
|
||||
else ifeq ($(platform), emscripten)
|
||||
CFLAGS += -O2 -DNDEBUG
|
||||
CFLAGS += -O2 -DNDEBUG
|
||||
else
|
||||
CFLAGS += -O3 -DNDEBUG
|
||||
CFLAGS += -O3 -DNDEBUG
|
||||
endif
|
||||
|
||||
CORE_DIR := .
|
||||
GENPLUS_SRC_DIR := $(CORE_DIR)/core
|
||||
TREMOR_SRC_DIR := $(GENPLUS_SRC_DIR)/tremor
|
||||
|
||||
TREMOR_SRC_DIR := $(CORE_DIR)/core/tremor
|
||||
LIBRETRO_DIR := $(CORE_DIR)/libretro
|
||||
|
||||
include Makefile.common
|
||||
|
||||
include $(LIBRETRO_DIR)/Makefile.common
|
||||
|
||||
OBJECTS := $(SOURCES_C:.c=.o)
|
||||
|
||||
|
19
libretro/Makefile.common
Normal file
19
libretro/Makefile.common
Normal file
@ -0,0 +1,19 @@
|
||||
GENPLUS_SRC_DIR := $(CORE_DIR)/core \
|
||||
$(CORE_DIR)/core/z80 \
|
||||
$(CORE_DIR)/core/m68k \
|
||||
$(CORE_DIR)/core/ntsc \
|
||||
$(CORE_DIR)/core/sound \
|
||||
$(CORE_DIR)/core/input_hw \
|
||||
$(CORE_DIR)/core/cd_hw \
|
||||
$(CORE_DIR)/core/cart_hw \
|
||||
$(CORE_DIR)/core/cart_hw/svp
|
||||
|
||||
SOURCES_C = $(foreach dir,$(GENPLUS_SRC_DIR),$(wildcard $(dir)/*.c)) \
|
||||
$(foreach dir,$(TREMOR_SRC_DIR),$(wildcard $(dir)/*.c)) \
|
||||
$(LIBRETRO_DIR)/libretro.c
|
||||
|
||||
ifeq ($(WANT_CRC32), 1)
|
||||
SOURCES_C += $(LIBRETRO_DIR)/scrc32.c
|
||||
endif
|
||||
|
||||
INCFLAGS += $(foreach dir,$(GENPLUS_SRC_DIR),-I$(dir)) -I$(LIBRETRO_DIR)
|
@ -5,8 +5,8 @@ include $(CLEAR_VARS)
|
||||
WANT_CRC32 := 1
|
||||
|
||||
CORE_DIR := ../..
|
||||
GENPLUS_SRC_DIR := $(CORE_DIR)/core
|
||||
TREMOR_SRC_DIR := $(GENPLUS_SRC_DIR)/tremor
|
||||
|
||||
TREMOR_SRC_DIR := $(CORE_DIR)/core/tremor
|
||||
LIBRETRO_DIR := ..
|
||||
|
||||
LOCAL_MODULE := retro
|
||||
@ -16,19 +16,11 @@ LOCAL_CFLAGS += -DANDROID_ARM
|
||||
LOCAL_ARM_MODE := arm
|
||||
endif
|
||||
|
||||
include $(CORE_DIR)/Makefile.common
|
||||
include $(LIBRETRO_DIR)/Makefile.common
|
||||
|
||||
LOCAL_SRC_FILES := $(SOURCES_C)
|
||||
|
||||
LOCAL_C_INCLUDES = $(LOCAL_PATH)/$(GENPLUS_SRC_DIR) \
|
||||
$(LOCAL_PATH)/$(GENPLUS_SRC_DIR)/sound \
|
||||
$(LOCAL_PATH)/$(GENPLUS_SRC_DIR)/input_hw \
|
||||
$(LOCAL_PATH)/$(GENPLUS_SRC_DIR)/cd_hw \
|
||||
$(LOCAL_PATH)/$(GENPLUS_SRC_DIR)/cart_hw \
|
||||
$(LOCAL_PATH)/$(GENPLUS_SRC_DIR)/cart_hw/svp \
|
||||
$(LOCAL_PATH)/$(GENPLUS_SRC_DIR)/m68k \
|
||||
$(LOCAL_PATH)/$(GENPLUS_SRC_DIR)/z80 \
|
||||
$(LOCAL_PATH)/$(GENPLUS_SRC_DIR)/ntsc \
|
||||
LOCAL_C_INCLUDES = $(foreach dir,$(GENPLUS_SRC_DIR),$(LOCAL_PATH)/$(dir)) \
|
||||
$(LOCAL_PATH)/$(TREMOR_SRC_DIR) \
|
||||
$(LOCAL_PATH)/$(LIBRETRO_DIR)
|
||||
|
||||
|
@ -31,7 +31,6 @@
|
||||
|
||||
#include "shared.h"
|
||||
#include "libretro.h"
|
||||
#include "state.h"
|
||||
#include "md_ntsc.h"
|
||||
#include "sms_ntsc.h"
|
||||
|
||||
@ -66,6 +65,7 @@ static uint8_t brm_format[0x40] =
|
||||
0x52,0x41,0x4d,0x5f,0x43,0x41,0x52,0x54,0x52,0x49,0x44,0x47,0x45,0x5f,0x5f,0x5f
|
||||
};
|
||||
|
||||
static bool is_running = 0;
|
||||
static uint8_t temp[0x10000];
|
||||
static int16 soundbuffer[3068];
|
||||
static uint16_t bitmap_data_[720 * 576];
|
||||
@ -448,6 +448,7 @@ static void config_default(void)
|
||||
config.overscan = 0;
|
||||
config.gg_extra = 0;
|
||||
config.ntsc = 0;
|
||||
config.lcd = 0;
|
||||
config.render = 0;
|
||||
|
||||
/* input options */
|
||||
@ -854,6 +855,15 @@ static void check_variables(void)
|
||||
update_viewports = true;
|
||||
}
|
||||
|
||||
var.key = "lcd_filter";
|
||||
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
|
||||
{
|
||||
if (strcmp(var.value, "disabled") == 0)
|
||||
config.lcd = 0;
|
||||
else if (strcmp(var.value, "enabled") == 0)
|
||||
config.lcd = (uint8)(0.80 * 256);
|
||||
}
|
||||
|
||||
var.key = "overscan";
|
||||
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
|
||||
{
|
||||
@ -947,6 +957,7 @@ void retro_set_environment(retro_environment_t cb)
|
||||
{ "ym2413", "Master System FM; auto|disabled|enabled" },
|
||||
{ "dac_bits", "YM2612 DAC quantization; disabled|enabled" },
|
||||
{ "blargg_ntsc_filter", "Blargg NTSC filter; disabled|monochrome|composite|svideo|rgb" },
|
||||
{ "lcd_filter", "LCD Ghosting filter; disabled|enabled" },
|
||||
{ "overscan", "Borders; disabled|top/bottom|left/right|full" },
|
||||
{ "gg_extra", "Game Gear extended screen; disabled|enabled" },
|
||||
{ "render", "Interlaced mode 2 output; single field|double field" },
|
||||
@ -1222,6 +1233,7 @@ bool retro_load_game(const struct retro_game_info *info)
|
||||
audio_init(44100, vdp_pal ? pal_fps : ntsc_fps);
|
||||
system_init();
|
||||
system_reset();
|
||||
is_running = false;
|
||||
|
||||
if (system_hw == SYSTEM_MCD)
|
||||
bram_load();
|
||||
@ -1270,7 +1282,27 @@ size_t retro_get_memory_size(unsigned id)
|
||||
switch (id)
|
||||
{
|
||||
case RETRO_MEMORY_SAVE_RAM:
|
||||
return 0x10000;
|
||||
{
|
||||
/* if emulation is not running, we assume the frontend is requesting SRAM size for loading */
|
||||
if (!is_running)
|
||||
{
|
||||
/* max supported size is returned */
|
||||
return 0x10000;
|
||||
}
|
||||
|
||||
/* otherwise, we assume this is for saving and we need to check if SRAM data has been modified */
|
||||
/* this is obviously not %100 safe since the frontend could still be trying to load SRAM while emulation is running */
|
||||
/* a better solution would be that the frontend itself checks if data has been modified before writing it to a file */
|
||||
int i;
|
||||
for (i=0xffff; i>=0; i--)
|
||||
{
|
||||
if (sram.sram[i] != 0xff)
|
||||
{
|
||||
/* only save modified size */
|
||||
return (i+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
return 0;
|
||||
@ -1325,6 +1357,7 @@ void retro_reset(void) { system_reset(); }
|
||||
void retro_run(void)
|
||||
{
|
||||
bool updated = false;
|
||||
is_running = true;
|
||||
|
||||
if (system_hw == SYSTEM_MCD)
|
||||
system_frame_scd(0);
|
||||
|
Loading…
Reference in New Issue
Block a user