diff -Nru libretro-genesisplusgx-0.6~filthypants2/Makefile.libretro libretro-genesisplusgx-0.6~filthypants4/Makefile.libretro --- libretro-genesisplusgx-0.6~filthypants2/Makefile.libretro 2012-10-17 20:00:51.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/Makefile.libretro 2013-04-29 16:28:55.000000000 +0000 @@ -1,6 +1,6 @@ -NTSC = 0 DEBUG = 0 LOGSOUND = 0 +FRONTEND_SUPPORTS_RGB565 = 1 GENPLUS_SRC_DIR := source LIBRETRO_DIR := libretro @@ -29,50 +29,76 @@ system_platform = win endif +TARGET_NAME := genesis_plus_gx + ifeq ($(platform), unix) - TARGET := libretro.so + TARGET := $(TARGET_NAME)_libretro.so fpic := -fPIC SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined -lz ENDIANNESS_DEFINES := -DLSB_FIRST PLATFORM_DEFINES := -DHAVE_ZLIB else ifeq ($(platform), osx) - TARGET := libretro.dylib + TARGET := $(TARGET_NAME)_libretro.dylib + fpic := -fPIC + SHARED := -dynamiclib -lz + ENDIANNESS_DEFINES := -DLSB_FIRST + PLATFORM_DEFINES := -DHAVE_ZLIB +else ifeq ($(platform), ios) + TARGET := $(TARGET_NAME)_libretro.dylib fpic := -fPIC SHARED := -dynamiclib -lz ENDIANNESS_DEFINES := -DLSB_FIRST PLATFORM_DEFINES := -DHAVE_ZLIB + + CC = clang -arch armv7 -isysroot $(IOSSDK) +else ifeq ($(platform), qnx) + TARGET := $(TARGET_NAME)_libretro.so + fpic := -fPIC + SHARED := -lm -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined -lz + ENDIANNESS_DEFINES := -DLSB_FIRST + PLATFORM_DEFINES := -DHAVE_ZLIB + CC = qcc -Vgcc_ntoarmv7le + AR = qcc -Vgcc_ntoarmv7le + PLATFORM_DEFINES := -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp else ifeq ($(platform), sncps3) - TARGET := libretro_ps3.a + TARGET := $(TARGET_NAME)_libretro_ps3.a CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe PLATFORM_DEFINES := -D__CELLOS_LV2 -DALT_RENDER else ifeq ($(platform), ps3) - TARGET := libretro_ps3.a + TARGET := $(TARGET_NAME)_libretro_ps3.a CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe PLATFORM_DEFINES := -D__CELLOS_LV2 -DALT_RENDER else ifeq ($(platform), psl1ght) - TARGET := libretro_psl1ght.a$(EXE_EXT) + TARGET := $(TARGET_NAME)_libretro_psl1ght.a$(EXE_EXT) CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT) AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT) PLATFORM_DEFINES := -D__CELLOS_LV2 -DALT_RENDER +else ifeq ($(platform), psp1) + TARGET := $(TARGET_NAME)_libretro_psp1.a$(EXE_EXT) + CC = psp-gcc$(EXE_EXT) + AR = psp-ar$(EXE_EXT) + ENDIANNESS_DEFINES := -DLSB_FIRST + PLATFORM_DEFINES := -DPSP + CFLAGS += -G0 else ifeq ($(platform), xenon) - TARGET := libretro_xenon360.a + TARGET := $(TARGET_NAME)_libretro_xenon360.a CC = xenon-gcc$(EXE_EXT) AR = xenon-ar$(EXE_EXT) PLATFORM_DEFINES := -D__LIBXENON__ -DALT_RENDER else ifeq ($(platform), ngc) - TARGET := libretro_ngc.a + TARGET := $(TARGET_NAME)_libretro_ngc.a CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT) AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT) PLATFORM_DEFINES := -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -DALT_RENDER else ifeq ($(platform), wii) - TARGET := libretro_wii.a + TARGET := $(TARGET_NAME)_libretro_wii.a CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT) AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT) PLATFORM_DEFINES := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DALT_RENDER else - TARGET := retro.dll + TARGET := $(TARGET_NAME)_retro.dll CC = gcc SHARED := -shared -static-libgcc -static-libstdc++ -Wl,--version-script=libretro/link.T -Wl,--no-undefined -lz @@ -80,10 +106,6 @@ PLATFORM_DEFINES := -DHAVE_ZLIB endif -ifeq ($(NTSC), 1) - CFLAGS += -DUSE_NTSC -endif - ifeq ($(DEBUG), 1) CFLAGS += -O0 -g else @@ -145,15 +167,16 @@ LIBRETRO_CFLAGS := -DLOGSOUND endif -ifeq ($(platform), sncps3) -CODE_DEFINES = -else -CODE_DEFINES = -std=gnu99 -endif - DEFINES := CFLAGS += $(fpic) $(DEFINES) $(CODE_DEFINES) +ifeq ($(FRONTEND_SUPPORTS_RGB565), 1) +# if you have a new frontend that supports RGB565 +BPP_DEFINES = -DUSE_16BPP_RENDERING -DFRONTEND_SUPPORTS_RGB565 +else +BPP_DEFINES = -DUSE_15BPP_RENDERING +endif + LIBRETRO_CFLAGS += -I$(GENPLUS_SRC_DIR) \ -I$(GENPLUS_SRC_DIR)/sound \ -I$(GENPLUS_SRC_DIR)/input_hw \ @@ -164,7 +187,7 @@ -I$(GENPLUS_SRC_DIR)/z80 \ -I$(GENPLUS_SRC_DIR)/ntsc \ -I$(LIBRETRO_DIR) \ - -DUSE_15BPP_RENDERING \ + $(BPP_DEFINES) \ $(ENDIANNESS_DEFINES) \ $(PLATFORM_DEFINES) \ -DINLINE="static inline" \ @@ -185,6 +208,8 @@ $(AR) rcs $@ $(LIBRETRO_OBJ) else ifeq ($(platform), psl1ght) $(AR) rcs $@ $(LIBRETRO_OBJ) +else ifeq ($(platform), psp1) + $(AR) rcs $@ $(LIBRETRO_OBJ) else ifeq ($(platform), xenon) $(AR) rcs $@ $(LIBRETRO_OBJ) else ifeq ($(platform), ngc) diff -Nru libretro-genesisplusgx-0.6~filthypants2/debian/changelog libretro-genesisplusgx-0.6~filthypants4/debian/changelog --- libretro-genesisplusgx-0.6~filthypants2/debian/changelog 2012-10-17 20:02:58.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/debian/changelog 2013-04-29 21:06:47.000000000 +0000 @@ -1,5 +1,5 @@ -libretro-genesisplusgx (0.6~filthypants2) quantal; urgency=low +libretro-genesisplusgx (0.6~filthypants4) raring; urgency=low * Updated to latest git. - -- Hunter Kaller (hizzlekizzle) Fri, 17 Aug 2012 13:24:59 -0500 + -- Hunter Kaller (hizzlekizzle) Mon, 29 Apr 2013 13:24:59 -0500 diff -Nru libretro-genesisplusgx-0.6~filthypants2/debian/rules libretro-genesisplusgx-0.6~filthypants4/debian/rules --- libretro-genesisplusgx-0.6~filthypants2/debian/rules 2012-08-17 17:08:43.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/debian/rules 2013-04-29 21:07:10.000000000 +0000 @@ -47,7 +47,7 @@ dh_installdirs # Add here commands to install the package into debian/libretro-genesisplusgx. - cp libretro.so $(CURDIR)/debian/libretro-genesisplusgx/usr/lib/libretro-genesisplusgx.so + cp genesis_plus_gx_libretro.so $(CURDIR)/debian/libretro-genesisplusgx/usr/lib/libretro-genesisplusgx.so # Build architecture-independent files here. binary-indep: install diff -Nru libretro-genesisplusgx-0.6~filthypants2/libretro/jni/Android.mk libretro-genesisplusgx-0.6~filthypants4/libretro/jni/Android.mk --- libretro-genesisplusgx-0.6~filthypants2/libretro/jni/Android.mk 2012-10-17 20:00:51.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/libretro/jni/Android.mk 2013-04-29 16:28:55.000000000 +0000 @@ -6,6 +6,12 @@ LIBRETRO_DIR := ../ LOCAL_MODULE := retro + +ifeq ($(TARGET_ARCH),arm) +LOCAL_CFLAGS += -DANDROID_ARM +LOCAL_ARM_MODE := arm +endif + LOCAL_SRC_FILES := $(GENPLUS_SRC_DIR)/genesis.c \ $(GENPLUS_SRC_DIR)/vdp_ctrl.c \ $(GENPLUS_SRC_DIR)/vdp_render.c \ @@ -67,6 +73,6 @@ $(LOCAL_PATH)/$(GENPLUS_SRC_DIR)/ntsc \ $(LOCAL_PATH)/$(LIBRETRO_DIR) -LOCAL_CFLAGS = -DINLINE="static inline" -DUSE_15BPP_RENDERING -DLSB_FIRST -D__LIBRETRO__ +LOCAL_CFLAGS = -ffast-math -O3 -funroll-loops -DINLINE="static inline" -DUSE_16BPP_RENDERING -DLSB_FIRST -D__LIBRETRO__ -DFRONTEND_SUPPORTS_RGB565 -DALIGN_LONG -DALIGN_WORD include $(BUILD_SHARED_LIBRARY) diff -Nru libretro-genesisplusgx-0.6~filthypants2/libretro/jni/Application.mk libretro-genesisplusgx-0.6~filthypants4/libretro/jni/Application.mk --- libretro-genesisplusgx-0.6~filthypants2/libretro/jni/Application.mk 1970-01-01 00:00:00.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/libretro/jni/Application.mk 2013-04-29 16:28:55.000000000 +0000 @@ -0,0 +1 @@ +APP_ABI := all diff -Nru libretro-genesisplusgx-0.6~filthypants2/libretro/libretro.c libretro-genesisplusgx-0.6~filthypants4/libretro/libretro.c --- libretro-genesisplusgx-0.6~filthypants2/libretro/libretro.c 2012-10-17 20:00:51.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/libretro/libretro.c 2013-04-29 16:28:55.000000000 +0000 @@ -25,7 +25,6 @@ static int vwidth; static int vheight; -static bool failed_init; char rom_filename[256]; @@ -37,7 +36,19 @@ static retro_environment_t environ_cb; static retro_audio_sample_batch_t audio_batch_cb; -void retro_set_environment(retro_environment_t cb) { environ_cb = cb; } +void retro_set_environment(retro_environment_t cb) +{ + static const struct retro_variable vars[] = { + { "blargg_ntsc_filter", "Blargg NTSC filter; disabled|monochrome|composite|svideo|rgb" }, + { "overscan", "Overscan mode; 0|1|2|3" }, + { "gg_extra", "Game Gear extended screen; disabled|enabled" }, + { NULL, NULL }, + }; + + environ_cb = cb; + cb(RETRO_ENVIRONMENT_SET_VARIABLES, (void*)vars); +} + void retro_set_video_refresh(retro_video_refresh_t cb) { video_cb = cb; } void retro_set_audio_sample(retro_audio_sample_t cb) { (void)cb; } void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb) { audio_batch_cb = cb; } @@ -243,9 +254,7 @@ config.aspect = 0; config.overscan = 0; /* 3 == FULL */ config.gg_extra = 0; /* 1 = show extended Game Gear screen (256x192) */ -#if defined(USE_NTSC) - config.ntsc = 1; -#endif + config.ntsc = 0; config.vsync = 1; /* AUTO */ config.render = 0; @@ -292,8 +301,9 @@ for(i = 0; i < MAX_INPUTS; i++) { config.input[i].padtype = DEVICE_PAD6B; - input.system[i] = SYSTEM_MD_GAMEPAD; } + input.system[0] = SYSTEM_MD_GAMEPAD; + input.system[1] = SYSTEM_MD_GAMEPAD; break; case SYSTEM_GG: case SYSTEM_SMS: @@ -701,7 +711,7 @@ void retro_get_system_info(struct retro_system_info *info) { info->library_name = "Genesis Plus GX"; - info->library_version = "v1.7.1"; + info->library_version = "v1.7.3"; info->valid_extensions = "md|smd|bin|cue|gen|zip|MD|SMD|bin|iso|ISO|CUE|GEN|ZIP|sms|SMS|gg|GG|sg|SG"; info->block_extract = false; info->need_fullpath = true; @@ -778,12 +788,11 @@ for (i = 0; i < 10; i++) system_frame_sms(0); - retro_reset(); + vwidth = bitmap.viewport.w + (bitmap.viewport.x * 2); + vheight = bitmap.viewport.h + (bitmap.viewport.y * 2); - vwidth = bitmap.viewport.w; - vheight = bitmap.viewport.h; + retro_reset(); -#if defined(USE_NTSC) if (config.ntsc) { if (system_hw & SYSTEM_MD) @@ -791,8 +800,8 @@ else vwidth = SMS_NTSC_OUT_WIDTH(vwidth); } -#endif + geom.aspect_ratio = 4.0 / 3.0; geom.base_width = vwidth; geom.base_height = vheight; geom.max_width = 1024; @@ -828,7 +837,7 @@ if (!size) { /* close CD tray to force system reset */ - cdd.status = CD_STOP; + cdd.status = NO_DISC; /* load game file */ size = load_rom(filename); @@ -837,10 +846,95 @@ return size > 0; } +static void check_variables(void) +{ + bool update_viewports = false; + static bool last_ntsc_val_same; + struct retro_variable var = {0}; + + var.key = "blargg_ntsc_filter"; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var)) + { + unsigned orig_value = config.ntsc; + + update_viewports = true; + + if (strcmp(var.value, "disabled") == 0) + config.ntsc = 0; + else if (strcmp(var.value, "monochrome") == 0) + { + config.ntsc = 1; + sms_ntsc_init(sms_ntsc, &sms_ntsc_monochrome); + md_ntsc_init(md_ntsc, &md_ntsc_monochrome); + } + else if (strcmp(var.value, "composite") == 0) + { + config.ntsc = 1; + sms_ntsc_init(sms_ntsc, &sms_ntsc_composite); + md_ntsc_init(md_ntsc, &md_ntsc_composite); + } + else if (strcmp(var.value, "svideo") == 0) + { + config.ntsc = 1; + sms_ntsc_init(sms_ntsc, &sms_ntsc_svideo); + md_ntsc_init(md_ntsc, &md_ntsc_svideo); + } + else if (strcmp(var.value, "rgb") == 0) + { + config.ntsc = 1; + sms_ntsc_init(sms_ntsc, &sms_ntsc_rgb); + md_ntsc_init(md_ntsc, &md_ntsc_rgb); + } + + if (orig_value != config.ntsc) + update_viewports = true; + } + + var.key = "overscan"; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var)) + { + unsigned orig_value = config.overscan; + + if (strcmp(var.value, "0") == 0) + config.overscan = 0; + else if (strcmp(var.value, "1") == 0) + config.overscan = 1; + else if (strcmp(var.value, "2") == 0) + config.overscan = 2; + else if (strcmp(var.value, "3") == 0) + config.overscan = 3; + + if (orig_value != config.overscan) + update_viewports = true; + } + + var.key = "gg_extra"; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var)) + { + unsigned orig_value = config.gg_extra; + + if (strcmp(var.value, "disabled") == 0) + config.gg_extra = 0; + else if (strcmp(var.value, "enabled") == 0) + config.gg_extra = 1; + + if (orig_value != config.gg_extra) + update_viewports = true; + } + + if (update_viewports) + retro_set_viewport_dimensions(); +} + bool retro_load_game(const struct retro_game_info *info) { const char *full_path; const char *dir; + char slash; + extract_directory(g_rom_dir, info->path, sizeof(g_rom_dir)); if (!environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &dir) || !dir) @@ -848,28 +942,26 @@ fprintf(stderr, "[genplus]: Defaulting system directory to %s.\n", g_rom_dir); dir = g_rom_dir; } -#if defined(_WIN32) && !defined(_XBOX360) - const char slash[] = "\\"; -#elif defined(_WIN32) && defined(_XBOX360) - const char slash[] = ""; +#if defined(_WIN32) + slash = '\\'; #else - const char slash[] = "/"; + slash = '/'; #endif - snprintf(CD_BRAM_EU, sizeof(CD_BRAM_EU), "%s%sscd_E.brm", dir, slash); - snprintf(CD_BRAM_US, sizeof(CD_BRAM_US), "%s%sscd_U.brm", dir, slash); - snprintf(CD_BRAM_JP, sizeof(CD_BRAM_JP), "%s%sscd_J.brm", dir, slash); - snprintf(CD_BIOS_EU, sizeof(CD_BIOS_EU), "%s%sbios_CD_E.bin", dir, slash); - snprintf(CD_BIOS_US, sizeof(CD_BIOS_US), "%s%sbios_CD_U.bin", dir, slash); - snprintf(CD_BIOS_JP, sizeof(CD_BIOS_JP), "%s%sbios_CD_J.bin", dir, slash); - snprintf(MS_BIOS_EU, sizeof(MS_BIOS_EU), "%s%sbios_E.sms", dir, slash); - snprintf(MS_BIOS_US, sizeof(MS_BIOS_US), "%s%sbios_U.sms", dir, slash); - snprintf(MS_BIOS_JP, sizeof(MS_BIOS_JP), "%s%sbios_J.sms", dir, slash); - snprintf(GG_BIOS, sizeof(GG_BIOS), "%s%sbios.gg", dir, slash); - snprintf(SK_ROM, sizeof(SK_ROM), "%s%ssk.bin", dir, slash); - snprintf(SK_UPMEM, sizeof(SK_UPMEM), "%s%ssk2chip.bin", dir, slash); - snprintf(GG_ROM, sizeof(GG_ROM), "%s%sggenie.bin", dir, slash); - snprintf(AR_ROM, sizeof(AR_ROM), "%s%sareplay.bin", dir, slash); + snprintf(CD_BRAM_EU, sizeof(CD_BRAM_EU), "%s%cscd_E.brm", dir, slash); + snprintf(CD_BRAM_US, sizeof(CD_BRAM_US), "%s%cscd_U.brm", dir, slash); + snprintf(CD_BRAM_JP, sizeof(CD_BRAM_JP), "%s%cscd_J.brm", dir, slash); + snprintf(CD_BIOS_EU, sizeof(CD_BIOS_EU), "%s%cbios_CD_E.bin", dir, slash); + snprintf(CD_BIOS_US, sizeof(CD_BIOS_US), "%s%cbios_CD_U.bin", dir, slash); + snprintf(CD_BIOS_JP, sizeof(CD_BIOS_JP), "%s%cbios_CD_J.bin", dir, slash); + snprintf(MS_BIOS_EU, sizeof(MS_BIOS_EU), "%s%cbios_E.sms", dir, slash); + snprintf(MS_BIOS_US, sizeof(MS_BIOS_US), "%s%cbios_U.sms", dir, slash); + snprintf(MS_BIOS_JP, sizeof(MS_BIOS_JP), "%s%cbios_J.sms", dir, slash); + snprintf(GG_BIOS, sizeof(GG_BIOS), "%s%cbios.gg", dir, slash); + snprintf(SK_ROM, sizeof(SK_ROM), "%s%csk.bin", dir, slash); + snprintf(SK_UPMEM, sizeof(SK_UPMEM), "%s%csk2chip.bin", dir, slash); + snprintf(GG_ROM, sizeof(GG_ROM), "%s%cggenie.bin", dir, slash); + snprintf(AR_ROM, sizeof(AR_ROM), "%s%careplay.bin", dir, slash); fprintf(stderr, "Sega CD EU BRAM should be located at: %s\n", CD_BRAM_EU); fprintf(stderr, "Sega CD US BRAM should be located at: %s\n", CD_BRAM_US); fprintf(stderr, "Sega CD JP BRAM should be located at: %s\n", CD_BRAM_JP); @@ -886,11 +978,7 @@ fprintf(stderr, "Action Replay ROM should be located at: %s\n", AR_ROM); snprintf(DEFAULT_PATH, sizeof(DEFAULT_PATH), g_rom_dir); -#ifdef _XBOX - snprintf(CART_BRAM, sizeof(CART_BRAM), "%s\\cart.brm", g_rom_dir); -#else - snprintf(CART_BRAM, sizeof(CART_BRAM), "%s/cart.brm", g_rom_dir); -#endif + snprintf(CART_BRAM, sizeof(CART_BRAM), "%s%ccart.brm", g_rom_dir, slash); fprintf(stderr, "BRAM file is located at: %s\n", CART_BRAM); @@ -914,6 +1002,8 @@ retro_set_viewport_dimensions(); + check_variables(); + return TRUE; } @@ -965,28 +1055,28 @@ void retro_init(void) { - unsigned level; -#if defined(USE_NTSC) + unsigned level, rgb565; sms_ntsc = calloc(1, sizeof(sms_ntsc_t)); md_ntsc = calloc(1, sizeof(md_ntsc_t)); - sms_ntsc_init(sms_ntsc, &sms_ntsc_composite); - md_ntsc_init(md_ntsc, &md_ntsc_composite); -#endif level = 1; environ_cb(RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL, &level); + +#ifdef FRONTEND_SUPPORTS_RGB565 + rgb565 = RETRO_PIXEL_FORMAT_RGB565; + if(environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &rgb565)) + fprintf(stderr, "Frontend supports RGB565 - will use that instead of XRGB1555.\n"); +#endif } void retro_deinit(void) { audio_shutdown(); -#if defined(USE_NTSC) free(md_ntsc); free(sms_ntsc); -#endif } -void retro_reset(void) { gen_reset(0); } +void retro_reset(void) { system_reset(); } int16 soundbuffer[3068]; @@ -1088,6 +1178,7 @@ void retro_run(void) { int aud; + bool updated = false; if (system_hw == SYSTEM_MCD) system_frame_scd(0); @@ -1096,13 +1187,12 @@ else system_frame_sms(0); -#if defined(USE_NTSC) - video_cb(bitmap_data_ + bitmap.viewport.y * 1024, config.ntsc ? vwidth : bitmap.viewport.w, bitmap.viewport.h, 2048); -#else - video_cb(bitmap_data_ + bitmap.viewport.x + bitmap.viewport.y * 1024, bitmap.viewport.w, bitmap.viewport.h, 2048); -#endif + video_cb(bitmap.data, config.ntsc ? vwidth : (bitmap.viewport.w + (bitmap.viewport.x * 2)), bitmap.viewport.h + (bitmap.viewport.y * 2), bitmap.pitch); aud = audio_update(soundbuffer) << 1; audio_batch_cb(soundbuffer, aud >> 1); + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated) + check_variables(); } diff -Nru libretro-genesisplusgx-0.6~filthypants2/libretro/libretro.h libretro-genesisplusgx-0.6~filthypants4/libretro/libretro.h --- libretro-genesisplusgx-0.6~filthypants2/libretro/libretro.h 2012-08-16 13:22:12.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/libretro/libretro.h 2013-04-29 16:28:55.000000000 +0000 @@ -3,11 +3,13 @@ #include #include +#include +// Hack applied for MSVC when compiling in C89 mode as it isn't C99 compliant. #ifdef __cplusplus extern "C" { #else -#if defined(_MSC_VER) && !defined(__cplusplus) +#if defined(_MSC_VER) && !defined(SN_TARGET_PS3) && !defined(__cplusplus) #define bool unsigned char #define true 1 #define false 0 @@ -16,21 +18,73 @@ #endif #endif +// Used for checking API/ABI mismatches that can break libretro implementations. +// It is not incremented for compatible changes to the API. #define RETRO_API_VERSION 1 +// Libretro's fundamental device abstractions. #define RETRO_DEVICE_MASK 0xff #define RETRO_DEVICE_NONE 0 + +// The JOYPAD is called RetroPad. It is essentially a Super Nintendo controller, +// but with additional L2/R2/L3/R3 buttons, similar to a PS1 DualShock. #define RETRO_DEVICE_JOYPAD 1 + +// The mouse is a simple mouse, similar to Super Nintendo's mouse. +// X and Y coordinates are reported relatively to last poll (poll callback). +// It is up to the libretro implementation to keep track of where the mouse pointer is supposed to be on the screen. +// The frontend must make sure not to interfere with its own hardware mouse pointer. #define RETRO_DEVICE_MOUSE 2 + +// KEYBOARD device lets one poll for raw key pressed. +// It is poll based, so input callback will return with the current pressed state. #define RETRO_DEVICE_KEYBOARD 3 + +// Lightgun X/Y coordinates are reported relatively to last poll, similar to mouse. #define RETRO_DEVICE_LIGHTGUN 4 + +// The ANALOG device is an extension to JOYPAD (RetroPad). +// Similar to DualShock it adds two analog sticks. +// This is treated as a separate device type as it returns values in the full analog range +// of [-0x8000, 0x7fff]. Positive X axis is right. Positive Y axis is down. +// Only use ANALOG type when polling for analog values of the axes. #define RETRO_DEVICE_ANALOG 5 +// Abstracts the concept of a pointing mechanism, e.g. touch. +// This allows libretro to query in absolute coordinates where on the screen a mouse (or something similar) is being placed. +// For a touch centric device, coordinates reported are the coordinates of the press. +// +// Coordinates in X and Y are reported as: +// [-0x7fff, 0x7fff]: -0x7fff corresponds to the far left/top of the screen, +// and 0x7fff corresponds to the far right/bottom of the screen. +// The "screen" is here defined as area that is passed to the frontend and later displayed on the monitor. +// The frontend is free to scale/resize this screen as it sees fit, however, +// (X, Y) = (-0x7fff, -0x7fff) will correspond to the top-left pixel of the game image, etc. +// +// To check if the pointer coordinates are valid (e.g. a touch display actually being touched), +// PRESSED returns 1 or 0. +// If using a mouse, PRESSED will usually correspond to the left mouse button. +// PRESSED will only return 1 if the pointer is inside the game screen. +// +// For multi-touch, the index variable can be used to successively query more presses. +// If index = 0 returns true for _PRESSED, coordinates can be extracted +// with _X, _Y for index = 0. One can then query _PRESSED, _X, _Y with index = 1, and so on. +// Eventually _PRESSED will return false for an index. No further presses are registered at this point. +#define RETRO_DEVICE_POINTER 6 + +// These device types are specializations of the base types above. +// They should only be used in retro_set_controller_type() to inform libretro implementations +// about use of a very specific device type. +// +// In input state callback, however, only the base type should be used in the 'device' field. #define RETRO_DEVICE_JOYPAD_MULTITAP ((1 << 8) | RETRO_DEVICE_JOYPAD) #define RETRO_DEVICE_LIGHTGUN_SUPER_SCOPE ((1 << 8) | RETRO_DEVICE_LIGHTGUN) #define RETRO_DEVICE_LIGHTGUN_JUSTIFIER ((2 << 8) | RETRO_DEVICE_LIGHTGUN) #define RETRO_DEVICE_LIGHTGUN_JUSTIFIERS ((3 << 8) | RETRO_DEVICE_LIGHTGUN) +// Buttons for the RetroPad (JOYPAD). +// The placement of these is equivalent to placements on the Super Nintendo controller. +// L2/R2/L3/R3 buttons correspond to the PS1 DualShock. #define RETRO_DEVICE_ID_JOYPAD_B 0 #define RETRO_DEVICE_ID_JOYPAD_Y 1 #define RETRO_DEVICE_ID_JOYPAD_SELECT 2 @@ -48,16 +102,19 @@ #define RETRO_DEVICE_ID_JOYPAD_L3 14 #define RETRO_DEVICE_ID_JOYPAD_R3 15 +// Index / Id values for ANALOG device. #define RETRO_DEVICE_INDEX_ANALOG_LEFT 0 #define RETRO_DEVICE_INDEX_ANALOG_RIGHT 1 #define RETRO_DEVICE_ID_ANALOG_X 0 #define RETRO_DEVICE_ID_ANALOG_Y 1 +// Id values for MOUSE. #define RETRO_DEVICE_ID_MOUSE_X 0 #define RETRO_DEVICE_ID_MOUSE_Y 1 #define RETRO_DEVICE_ID_MOUSE_LEFT 2 #define RETRO_DEVICE_ID_MOUSE_RIGHT 3 +// Id values for LIGHTGUN types. #define RETRO_DEVICE_ID_LIGHTGUN_X 0 #define RETRO_DEVICE_ID_LIGHTGUN_Y 1 #define RETRO_DEVICE_ID_LIGHTGUN_TRIGGER 2 @@ -66,15 +123,35 @@ #define RETRO_DEVICE_ID_LIGHTGUN_PAUSE 5 #define RETRO_DEVICE_ID_LIGHTGUN_START 6 +// Id values for POINTER. +#define RETRO_DEVICE_ID_POINTER_X 0 +#define RETRO_DEVICE_ID_POINTER_Y 1 +#define RETRO_DEVICE_ID_POINTER_PRESSED 2 + +// Returned from retro_get_region(). #define RETRO_REGION_NTSC 0 #define RETRO_REGION_PAL 1 +// Passed to retro_get_memory_data/size(). +// If the memory type doesn't apply to the implementation NULL/0 can be returned. #define RETRO_MEMORY_MASK 0xff + +// Regular save ram. This ram is usually found on a game cartridge, backed up by a battery. +// If save game data is too complex for a single memory buffer, +// the SYSTEM_DIRECTORY environment callback can be used. #define RETRO_MEMORY_SAVE_RAM 0 + +// Some games have a built-in clock to keep track of time. +// This memory is usually just a couple of bytes to keep track of time. #define RETRO_MEMORY_RTC 1 + +// System ram lets a frontend peek into a game systems main RAM. #define RETRO_MEMORY_SYSTEM_RAM 2 + +// Video ram lets a frontend peek into a game systems video RAM (VRAM). #define RETRO_MEMORY_VIDEO_RAM 3 +// Special memory types. #define RETRO_MEMORY_SNES_BSX_RAM ((1 << 8) | RETRO_MEMORY_SAVE_RAM) #define RETRO_MEMORY_SNES_BSX_PRAM ((2 << 8) | RETRO_MEMORY_SAVE_RAM) #define RETRO_MEMORY_SNES_SUFAMI_TURBO_A_RAM ((3 << 8) | RETRO_MEMORY_SAVE_RAM) @@ -82,11 +159,182 @@ #define RETRO_MEMORY_SNES_GAME_BOY_RAM ((5 << 8) | RETRO_MEMORY_SAVE_RAM) #define RETRO_MEMORY_SNES_GAME_BOY_RTC ((6 << 8) | RETRO_MEMORY_RTC) +// Special game types passed into retro_load_game_special(). +// Only used when multiple ROMs are required. #define RETRO_GAME_TYPE_BSX 0x101 #define RETRO_GAME_TYPE_BSX_SLOTTED 0x102 #define RETRO_GAME_TYPE_SUFAMI_TURBO 0x103 #define RETRO_GAME_TYPE_SUPER_GAME_BOY 0x104 +// Keysyms used for ID in input state callback when polling RETRO_KEYBOARD. +enum retro_key +{ + RETROK_UNKNOWN = 0, + RETROK_FIRST = 0, + RETROK_BACKSPACE = 8, + RETROK_TAB = 9, + RETROK_CLEAR = 12, + RETROK_RETURN = 13, + RETROK_PAUSE = 19, + RETROK_ESCAPE = 27, + RETROK_SPACE = 32, + RETROK_EXCLAIM = 33, + RETROK_QUOTEDBL = 34, + RETROK_HASH = 35, + RETROK_DOLLAR = 36, + RETROK_AMPERSAND = 38, + RETROK_QUOTE = 39, + RETROK_LEFTPAREN = 40, + RETROK_RIGHTPAREN = 41, + RETROK_ASTERISK = 42, + RETROK_PLUS = 43, + RETROK_COMMA = 44, + RETROK_MINUS = 45, + RETROK_PERIOD = 46, + RETROK_SLASH = 47, + RETROK_0 = 48, + RETROK_1 = 49, + RETROK_2 = 50, + RETROK_3 = 51, + RETROK_4 = 52, + RETROK_5 = 53, + RETROK_6 = 54, + RETROK_7 = 55, + RETROK_8 = 56, + RETROK_9 = 57, + RETROK_COLON = 58, + RETROK_SEMICOLON = 59, + RETROK_LESS = 60, + RETROK_EQUALS = 61, + RETROK_GREATER = 62, + RETROK_QUESTION = 63, + RETROK_AT = 64, + RETROK_LEFTBRACKET = 91, + RETROK_BACKSLASH = 92, + RETROK_RIGHTBRACKET = 93, + RETROK_CARET = 94, + RETROK_UNDERSCORE = 95, + RETROK_BACKQUOTE = 96, + RETROK_a = 97, + RETROK_b = 98, + RETROK_c = 99, + RETROK_d = 100, + RETROK_e = 101, + RETROK_f = 102, + RETROK_g = 103, + RETROK_h = 104, + RETROK_i = 105, + RETROK_j = 106, + RETROK_k = 107, + RETROK_l = 108, + RETROK_m = 109, + RETROK_n = 110, + RETROK_o = 111, + RETROK_p = 112, + RETROK_q = 113, + RETROK_r = 114, + RETROK_s = 115, + RETROK_t = 116, + RETROK_u = 117, + RETROK_v = 118, + RETROK_w = 119, + RETROK_x = 120, + RETROK_y = 121, + RETROK_z = 122, + RETROK_DELETE = 127, + + RETROK_KP0 = 256, + RETROK_KP1 = 257, + RETROK_KP2 = 258, + RETROK_KP3 = 259, + RETROK_KP4 = 260, + RETROK_KP5 = 261, + RETROK_KP6 = 262, + RETROK_KP7 = 263, + RETROK_KP8 = 264, + RETROK_KP9 = 265, + RETROK_KP_PERIOD = 266, + RETROK_KP_DIVIDE = 267, + RETROK_KP_MULTIPLY = 268, + RETROK_KP_MINUS = 269, + RETROK_KP_PLUS = 270, + RETROK_KP_ENTER = 271, + RETROK_KP_EQUALS = 272, + + RETROK_UP = 273, + RETROK_DOWN = 274, + RETROK_RIGHT = 275, + RETROK_LEFT = 276, + RETROK_INSERT = 277, + RETROK_HOME = 278, + RETROK_END = 279, + RETROK_PAGEUP = 280, + RETROK_PAGEDOWN = 281, + + RETROK_F1 = 282, + RETROK_F2 = 283, + RETROK_F3 = 284, + RETROK_F4 = 285, + RETROK_F5 = 286, + RETROK_F6 = 287, + RETROK_F7 = 288, + RETROK_F8 = 289, + RETROK_F9 = 290, + RETROK_F10 = 291, + RETROK_F11 = 292, + RETROK_F12 = 293, + RETROK_F13 = 294, + RETROK_F14 = 295, + RETROK_F15 = 296, + + RETROK_NUMLOCK = 300, + RETROK_CAPSLOCK = 301, + RETROK_SCROLLOCK = 302, + RETROK_RSHIFT = 303, + RETROK_LSHIFT = 304, + RETROK_RCTRL = 305, + RETROK_LCTRL = 306, + RETROK_RALT = 307, + RETROK_LALT = 308, + RETROK_RMETA = 309, + RETROK_LMETA = 310, + RETROK_LSUPER = 311, + RETROK_RSUPER = 312, + RETROK_MODE = 313, + RETROK_COMPOSE = 314, + + RETROK_HELP = 315, + RETROK_PRINT = 316, + RETROK_SYSREQ = 317, + RETROK_BREAK = 318, + RETROK_MENU = 319, + RETROK_POWER = 320, + RETROK_EURO = 321, + RETROK_UNDO = 322, + + RETROK_LAST, + + RETROK_DUMMY = INT_MAX // Ensure sizeof(enum) == sizeof(int) +}; + +enum retro_mod +{ + RETROKMOD_NONE = 0x0000, + + RETROKMOD_SHIFT = 0x01, + RETROKMOD_CTRL = 0x02, + RETROKMOD_ALT = 0x04, + RETROKMOD_META = 0x08, + + RETROKMOD_NUMLOCK = 0x10, + RETROKMOD_CAPSLOCK = 0x20, + RETROKMOD_SCROLLOCK = 0x40, + + RETROKMOD_DUMMY = INT_MAX // Ensure sizeof(enum) == sizeof(int) +}; + +// If set, this call is not part of the public libretro API yet. It can change or be removed at any time. +#define RETRO_ENVIRONMENT_EXPERIMENTAL 0x10000 // Environment commands. #define RETRO_ENVIRONMENT_SET_ROTATION 1 // const unsigned * -- @@ -99,21 +347,10 @@ // Boolean value whether or not the implementation should use overscan, or crop away overscan. // #define RETRO_ENVIRONMENT_GET_CAN_DUPE 3 // bool * -- - // Boolean value whether or not RetroArch supports frame duping, + // Boolean value whether or not frontend supports frame duping, // passing NULL to video frame callback. // -#define RETRO_ENVIRONMENT_GET_VARIABLE 4 // struct retro_variable * -- - // Interface to aquire user-defined information from environment - // that cannot feasibly be supported in a multi-system way. - // Mostly used for obscure, - // specific features that the user can tap into when neseccary. - // -#define RETRO_ENVIRONMENT_SET_VARIABLES 5 // const struct retro_variable * -- - // Allows an implementation to signal the environment - // which variables it might want to check for later using GET_VARIABLE. - // 'data' points to an array of retro_variable structs terminated by a { NULL, NULL } element. - // retro_variable::value should contain a human readable description of the key. - // +// Environ 4, 5 are no longer supported (GET_VARIABLE / SET_VARIABLES), and reserved to avoid possible ABI clash. #define RETRO_ENVIRONMENT_SET_MESSAGE 6 // const struct retro_message * -- // Sets a message to be displayed in implementation-specific manner for a certain amount of 'frames'. // Should not be used for trivial messages, which should simply be logged to stderr. @@ -131,10 +368,11 @@ // // It can be used by the frontend to potentially warn // about too demanding implementations. - // + // // The levels are "floating", but roughly defined as: - // 1: Low-powered devices such as Raspberry Pi, smart phones, tablets, etc. - // 2: Medium-spec consoles, such as PS3/360, with sub-par CPUs. + // 0: Low-powered embedded devices such as Raspberry Pi + // 1: 6th generation consoles, such as Wii/Xbox 1, and phones, tablets, etc. + // 2: 7th generation consoles, such as PS3/360, with sub-par CPUs. // 3: Modern desktop/laptops with reasonably powerful CPUs. // 4: High-end desktops with very powerful CPUs. // @@ -154,14 +392,180 @@ #define RETRO_ENVIRONMENT_SET_PIXEL_FORMAT 10 // const enum retro_pixel_format * -- // Sets the internal pixel format used by the implementation. - // The default pixel format is RETRO_PIXEL_FORMAT_XRGB1555. + // The default pixel format is RETRO_PIXEL_FORMAT_0RGB1555. + // This pixel format however, is deprecated (see enum retro_pixel_format). // If the call returns false, the frontend does not support this pixel format. // This function should be called inside retro_load_game() or retro_get_system_av_info(). + // +#define RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS 11 + // const struct retro_input_descriptor * -- + // Sets an array of retro_input_descriptors. + // It is up to the frontend to present this in a usable way. + // The array is terminated by retro_input_descriptor::description being set to NULL. + // This function can be called at any time, but it is recommended to call it as early as possible. +#define RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK 12 + // const struct retro_keyboard_callback * -- + // Sets a callback function used to notify core about keyboard events. + // +#define RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE 13 + // const struct retro_disk_control_callback * -- + // Sets an interface which frontend can use to eject and insert disk images. + // This is used for games which consist of multiple images and must be manually + // swapped out by the user (e.g. PSX). +#define RETRO_ENVIRONMENT_SET_HW_RENDER (14 | RETRO_ENVIRONMENT_EXPERIMENTAL) + // struct retro_hw_render_callback * -- + // NOTE: This call is currently very experimental, and should not be considered part of the public API. + // The interface could be changed or removed at any time. + // Sets an interface to let a libretro core render with hardware acceleration. + // Should be called in retro_load_game(). + // If successful, libretro cores will be able to render to a frontend-provided framebuffer. + // The size of this framebuffer will be at least as large as max_width/max_height provided in get_av_info(). + // If HW rendering is used, pass only RETRO_HW_FRAME_BUFFER_VALID or NULL to retro_video_refresh_t. +#define RETRO_ENVIRONMENT_GET_VARIABLE 15 + // struct retro_variable * -- + // Interface to aquire user-defined information from environment + // that cannot feasibly be supported in a multi-system way. + // 'key' should be set to a key which has already been set by SET_VARIABLES. + // 'data' will be set to a value or NULL. + // +#define RETRO_ENVIRONMENT_SET_VARIABLES 16 + // const struct retro_variable * -- + // Allows an implementation to signal the environment + // which variables it might want to check for later using GET_VARIABLE. + // This allows the frontend to present these variables to a user dynamically. + // This should be called as early as possible (ideally in retro_set_environment). + // + // 'data' points to an array of retro_variable structs terminated by a { NULL, NULL } element. + // retro_variable::key should be namespaced to not collide with other implementations' keys. E.g. A core called 'foo' should use keys named as 'foo_option'. + // retro_variable::value should contain a human readable description of the key as well as a '|' delimited list of expected values. + // The number of possible options should be very limited, i.e. it should be feasible to cycle through options without a keyboard. + // First entry should be treated as a default. + // + // Example entry: + // { "foo_option", "Speed hack coprocessor X; false|true" } + // + // Text before first ';' is description. This ';' must be followed by a space, and followed by a list of possible values split up with '|'. + // Only strings are operated on. The possible values will generally be displayed and stored as-is by the frontend. + // +#define RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE 17 + // bool * -- + // Result is set to true if some variables are updated by + // frontend since last call to RETRO_ENVIRONMENT_GET_VARIABLE. + // Variables should be queried with GET_VARIABLE. + +// Pass this to retro_video_refresh_t if rendering to hardware. +// Passing NULL to retro_video_refresh_t is still a frame dupe as normal. +#define RETRO_HW_FRAME_BUFFER_VALID ((void*)-1) + +// Invalidates the current HW context. +// If called, all GPU resources must be reinitialized. +// Usually called when frontend reinits video driver. +// Also called first time video driver is initialized, allowing libretro core to init resources. +typedef void (*retro_hw_context_reset_t)(void); +// Gets current framebuffer which is to be rendered to. Could change every frame potentially. +typedef uintptr_t (*retro_hw_get_current_framebuffer_t)(void); + +// Get a symbol from HW context. +typedef void (*retro_proc_address_t)(void); +typedef retro_proc_address_t (*retro_hw_get_proc_address_t)(const char *sym); + +enum retro_hw_context_type +{ + RETRO_HW_CONTEXT_NONE = 0, + RETRO_HW_CONTEXT_OPENGL, // OpenGL 2.x. Latest version available before 3.x+. + RETRO_HW_CONTEXT_OPENGLES2, // GLES 2.0 + + RETRO_HW_CONTEXT_DUMMY = INT_MAX +}; + +struct retro_hw_render_callback +{ + enum retro_hw_context_type context_type; // Which API to use. Set by libretro core. + retro_hw_context_reset_t context_reset; // Set by libretro core. + retro_hw_get_current_framebuffer_t get_current_framebuffer; // Set by frontend. + retro_hw_get_proc_address_t get_proc_address; // Set by frontend. + bool depth; // Set if render buffers should have depth component attached. +}; + +// Callback type passed in RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK. Called by the frontend in response to keyboard events. +// down is set if the key is being pressed, or false if it is being released. +// keycode is the RETROK value of the char. +// character is the text character of the pressed key. (UTF-32). +// key_modifiers is a set of RETROKMOD values or'ed together. +typedef void (*retro_keyboard_event_t)(bool down, unsigned keycode, uint32_t character, uint16_t key_modifiers); + +struct retro_keyboard_callback +{ + retro_keyboard_event_t callback; +}; + +// Callbacks for RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE. +// Should be set for implementations which can swap out multiple disk images in runtime. +// If the implementation can do this automatically, it should strive to do so. +// However, there are cases where the user must manually do so. +// +// Overview: To swap a disk image, eject the disk image with set_eject_state(true). +// Set the disk index with set_image_index(index). Insert the disk again with set_eject_state(false). + +// If ejected is true, "ejects" the virtual disk tray. +// When ejected, the disk image index can be set. +typedef bool (*retro_set_eject_state_t)(bool ejected); +// Gets current eject state. The initial state is 'not ejected'. +typedef bool (*retro_get_eject_state_t)(void); +// Gets current disk index. First disk is index 0. +// If return value is >= get_num_images(), no disk is currently inserted. +typedef unsigned (*retro_get_image_index_t)(void); +// Sets image index. Can only be called when disk is ejected. +// The implementation supports setting "no disk" by using an index >= get_num_images(). +typedef bool (*retro_set_image_index_t)(unsigned index); +// Gets total number of images which are available to use. +typedef unsigned (*retro_get_num_images_t)(void); +// +// Replaces the disk image associated with index. +// Arguments to pass in info have same requirements as retro_load_game(). +// Virtual disk tray must be ejected when calling this. +// Replacing a disk image with info = NULL will remove the disk image from the internal list. +// As a result, calls to get_image_index() can change. +// +// E.g. replace_image_index(1, NULL), and previous get_image_index() returned 4 before. +// Index 1 will be removed, and the new index is 3. +struct retro_game_info; +typedef bool (*retro_replace_image_index_t)(unsigned index, const struct retro_game_info *info); +// Adds a new valid index (get_num_images()) to the internal disk list. +// This will increment subsequent return values from get_num_images() by 1. +// This image index cannot be used until a disk image has been set with replace_image_index. +typedef bool (*retro_add_image_index_t)(void); + +struct retro_disk_control_callback +{ + retro_set_eject_state_t set_eject_state; + retro_get_eject_state_t get_eject_state; + + retro_get_image_index_t get_image_index; + retro_set_image_index_t set_image_index; + retro_get_num_images_t get_num_images; + + retro_replace_image_index_t replace_image_index; + retro_add_image_index_t add_image_index; +}; enum retro_pixel_format { - RETRO_PIXEL_FORMAT_0RGB1555 = 0, // 0RGB1555, native endian. 0 bit must be set to 0. - RETRO_PIXEL_FORMAT_XRGB8888 // XRGB8888, native endian. X bits are ignored. + // 0RGB1555, native endian. 0 bit must be set to 0. + // This pixel format is default for compatibility concerns only. + // If a 15/16-bit pixel format is desired, consider using RGB565. + RETRO_PIXEL_FORMAT_0RGB1555 = 0, + + // XRGB8888, native endian. X bits are ignored. + RETRO_PIXEL_FORMAT_XRGB8888 = 1, + + // RGB565, native endian. This pixel format is the recommended format to use if a 15/16-bit format is desired + // as it is the pixel format that is typically available on a wide range of low-power devices. + // It is also natively supported in APIs like OpenGL ES. + RETRO_PIXEL_FORMAT_RGB565 = 2, + + // Ensure sizeof() == sizeof(int). + RETRO_PIXEL_FORMAT_UNKNOWN = INT_MAX }; struct retro_message @@ -170,8 +574,25 @@ unsigned frames; // Duration in frames of message. }; +// Describes how the libretro implementation maps a libretro input bind +// to its internal input system through a human readable string. +// This string can be used to better let a user configure input. +struct retro_input_descriptor +{ + // Associates given parameters with a description. + unsigned port; + unsigned device; + unsigned index; + unsigned id; + + const char *description; // Human readable description for parameters. + // The pointer must remain valid until retro_unload_game() is called. +}; + struct retro_system_info { + // All pointers are owned by libretro implementation, and pointers must remain valid until retro_deinit() is called. + const char *library_name; // Descriptive name of library. Should not contain any version numbers, etc. const char *library_version; // Descriptive version of core. @@ -240,6 +661,8 @@ // Render a frame. Pixel format is 15-bit 0RGB1555 native endian unless changed (see RETRO_ENVIRONMENT_SET_PIXEL_FORMAT). // Width and height specify dimensions of buffer. // Pitch specifices length in bytes between two lines in buffer. +// For performance reasons, it is highly recommended to have a frame that is packed in memory, i.e. pitch == width * byte_per_pixel. +// Certain graphic APIs, such as OpenGL ES, do not like textures that are not packed in memory. typedef void (*retro_video_refresh_t)(const void *data, unsigned width, unsigned height, size_t pitch); // Renders a single audio frame. Should only be used if implementation generates a single sample at a time. @@ -279,6 +702,8 @@ // Gets information about system audio/video timings and geometry. // Can be called only after retro_load_game() has successfully completed. +// NOTE: The implementation of this function might not initialize every variable if needed. +// E.g. geom.aspect_ratio might not be initialized if core doesn't desire a particular aspect ratio. void retro_get_system_av_info(struct retro_system_av_info *info); // Sets device to be used for player 'port'. diff -Nru libretro-genesisplusgx-0.6~filthypants2/libretro/msvc/msvc-2003-xbox1/msvc-2003-xbox1.vcproj libretro-genesisplusgx-0.6~filthypants4/libretro/msvc/msvc-2003-xbox1/msvc-2003-xbox1.vcproj --- libretro-genesisplusgx-0.6~filthypants2/libretro/msvc/msvc-2003-xbox1/msvc-2003-xbox1.vcproj 2012-08-23 17:06:29.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/libretro/msvc/msvc-2003-xbox1/msvc-2003-xbox1.vcproj 2013-04-29 16:28:55.000000000 +0000 @@ -22,7 +22,7 @@ Optimization="0" OptimizeForProcessor="2" AdditionalIncludeDirectories=""$(SolutionDir)\..\..\source";"$(SolutionDir)\..\..\source\cd_hw";"$(SolutionDir)\..\..\source\cart_hw";"$(SolutionDir)\..\..\source\sound";"$(SolutionDir)\..\..\source\z80";"$(SolutionDir)\..\..\";"$(SolutionDir)";"$(SolutionDir)\..\..\source\m68k";"$(SolutionDir)\..\..\source\input_hw";"$(SolutionDir)\..\..\source\cart_hw\svp";"$(SolutionDir)\..\..\source\ntsc";"$(SolutionDir)\..\..\libretro";"$(SolutionDir)\msvc-2003-xbox1"" - PreprocessorDefinitions="_DEBUG;_XBOX;_XBOX1;_LIB;__LIBRETRO__;LSB_FIRST;USE_15BPP_RENDERING;INLINE=static _inline;__restrict=" + PreprocessorDefinitions="_DEBUG;_XBOX;_XBOX1;_LIB;__LIBRETRO__;LSB_FIRST;USE_16BPP_RENDERING;INLINE=static _inline;__restrict=;FRONTEND_SUPPORTS_RGB565" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="1" @@ -36,7 +36,7 @@ Name="VCCustomBuildTool"/> + OutputFile="$(OutDir)/genesis_plus_gx_libretro_xdk.lib"/> + OutputFile="$(OutDir)/genesis_plus_gx_libretro_xdk.lib"/> + OutputFile="$(OutDir)/genesis_plus_gx_libretro_xdk.lib"/> + OutputFile="$(OutDir)/genesis_plus_gx_libretro_xdk.lib"/> + OutputFile="$(OutDir)/genesis_plus_gx_libretro_xdk.lib"/> + RelativePath="..\..\..\source\cart_hw\eeprom_93c.c"> + + + + + + + + + + + + + + + + RelativePath="..\..\..\source\cart_hw\eeprom_i2c.c"> + + + + + + + + + + + + + + + + RelativePath="..\..\..\source\cart_hw\eeprom_spi.c"> + + + + + + + + + + + + + + + + RelativePath="..\..\..\source\cart_hw\ggenie.c"> + + @@ -295,15 +388,12 @@ Name="sound" Filter=""> + RelativePath="..\..\..\source\sound\blip_buf.c"> - - + + + - - @@ -46,9 +47,8 @@ - + - @@ -103,7 +103,7 @@ Level3 Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;MSVC2010_EXPORTS;_CRT_SECURE_NO_WARNINGS;INLINE=static _inline;__inline__=_inline;__extension__=;LSB_FIRST;__LIBRETRO__;USE_15BPP_RENDERING;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;MSVC2010_EXPORTS;_CRT_SECURE_NO_WARNINGS;INLINE=static _inline;__inline__=_inline;__extension__=;LSB_FIRST;__LIBRETRO__;USE_16BPP_RENDERING;FRONTEND_SUPPORTS_RGB565;%(PreprocessorDefinitions) $(SolutionDir)/../../source;$(SolutionDir)/../../utils/zlib;$(SolutionDir)/../../source/cart_hw/svp;$(SolutionDir)/../../libretro;$(SolutionDir)/../../source/m68k;$(SolutionDir)/../../source/z80;$(SolutionDir)/../../source/input_hw;$(SolutionDir)/../../source/cart_hw;$(SolutionDir)/../../source/sound;$(SolutionDir)/../../source/ntsc;$(SolutionDir)/../../source/cd_hw;%(AdditionalIncludeDirectories) @@ -120,7 +120,7 @@ MaxSpeed true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;MSVC2010_EXPORTS;_CRT_SECURE_NO_WARNINGS;INLINE=static _inline;__inline__=_inline;__extension__=;LSB_FIRST;__LIBRETRO__;USE_15BPP_RENDERING;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;MSVC2010_EXPORTS;_CRT_SECURE_NO_WARNINGS;INLINE=static _inline;__inline__=_inline;__extension__=;LSB_FIRST;__LIBRETRO__;USE_16BPP_RENDERING;FRONTEND_SUPPORTS_RGB565;%(PreprocessorDefinitions) $(SolutionDir)/../../source;$(SolutionDir)/../../utils/zlib;$(SolutionDir)/../../source/cart_hw/svp;$(SolutionDir)/../../libretro;$(SolutionDir)/../../source/m68k;$(SolutionDir)/../../source/z80;$(SolutionDir)/../../source/input_hw;$(SolutionDir)/../../source/cart_hw;$(SolutionDir)/../../source/sound;$(SolutionDir)/../../source/ntsc;$(SolutionDir)/../../source/cd_hw;%(AdditionalIncludeDirectories) @@ -134,4 +134,4 @@ - \ No newline at end of file + diff -Nru libretro-genesisplusgx-0.6~filthypants2/libretro/msvc/msvc-2010/msvc-2010.vcxproj.filters libretro-genesisplusgx-0.6~filthypants4/libretro/msvc/msvc-2010/msvc-2010.vcxproj.filters --- libretro-genesisplusgx-0.6~filthypants2/libretro/msvc/msvc-2010/msvc-2010.vcxproj.filters 2012-08-15 15:21:19.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/libretro/msvc/msvc-2010/msvc-2010.vcxproj.filters 2013-04-29 16:28:55.000000000 +0000 @@ -54,18 +54,12 @@ Source Files\cart_hw - - Source Files\cart_hw - Source Files\cart_hw Source Files\cart_hw - - Source Files\cart_hw - Source Files\cart_hw @@ -117,15 +111,9 @@ Source Files\sound - - Source Files\sound - Source Files\sound - - Source Files\sound - Source Files\sound @@ -189,5 +177,17 @@ Source Files\libretro + + Source Files\cart_hw + + + Source Files\cart_hw + + + Source Files\cart_hw + + + Source Files\sound + \ No newline at end of file diff -Nru libretro-genesisplusgx-0.6~filthypants2/libretro/msvc/msvc-2010-360/msvc-2010-360.vcxproj libretro-genesisplusgx-0.6~filthypants4/libretro/msvc/msvc-2010-360/msvc-2010-360.vcxproj --- libretro-genesisplusgx-0.6~filthypants2/libretro/msvc/msvc-2010-360/msvc-2010-360.vcxproj 2012-08-23 17:06:29.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/libretro/msvc/msvc-2010-360/msvc-2010-360.vcxproj 2013-04-29 16:28:55.000000000 +0000 @@ -27,13 +27,70 @@ - - - - - - - + + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + + + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + + + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + + + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + + + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + + + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + + + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + + + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + @@ -76,9 +133,15 @@ - + + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + - @@ -151,22 +214,22 @@ - $(OutDir)libretro_xdk360$(TargetExt) + $(OutDir)genesis_plus_gx_libretro_xdk360$(TargetExt) - $(OutDir)libretro_xdk360$(TargetExt) + $(OutDir)genesis_plus_gx_libretro_xdk360$(TargetExt) - $(OutDir)libretro_xdk360$(TargetExt) + $(OutDir)genesis_plus_gx_libretro_xdk360$(TargetExt) - $(OutDir)libretro_xdk360$(TargetExt) + $(OutDir)genesis_plus_gx_libretro_xdk360$(TargetExt) - $(OutDir)libretro_xdk360$(TargetExt) + $(OutDir)genesis_plus_gx_libretro_xdk360$(TargetExt) - $(OutDir)libretro_xdk360$(TargetExt) + $(OutDir)genesis_plus_gx_libretro_xdk360$(TargetExt) @@ -179,9 +242,9 @@ false $(OutDir)$(ProjectName).pch MultiThreadedDebug - _DEBUG;_XBOX;_XBOX360;_LIB;INLINE=static _inline;__attribute__=;__inline__=_inline;__extension__=;USE_15BPP_RENDERING;__LIBRETRO__;%(PreprocessorDefinitions) + _DEBUG;_XBOX;_XBOX360;_LIB;INLINE=static _inline;__attribute__=;__inline__=_inline;__extension__=;USE_16BPP_RENDERING;__LIBRETRO__;FRONTEND_SUPPORTS_RGB565;%(PreprocessorDefinitions) Callcap - $(SolutionDir)\..\..\libretro;$(SolutionDir)\..\..\source;$(SolutionDir)\..\..\source\m68k;$(SolutionDir)\..\..\source\sound;$(SolutionDir)\..\..\source\cart_hw;$(SolutionDir)\..\..\source\cart_hw\svp;$(SolutionDir)\..\..\source\input_hw;$(SolutionDir)\..\..\source\ntsc;$(SolutionDir)\..\..\source\z80;$(SolutionDir)\..\..\source\cd_hw;%(AdditionalIncludeDirectories) + $(SolutionDir)\..\..\source;$(SolutionDir)\..\..\source\cd_hw;$(SolutionDir)\..\..\source\cart_hw;$(SolutionDir)\..\..\source\sound;$(SolutionDir)\..\..\source\z80;$(SolutionDir)\..\..\source\m68k;$(SolutionDir)\..\..\source\input_hw;$(SolutionDir)\..\..\source\cart_hw\svp;$(SolutionDir)\..\..\source\ntsc;$(SolutionDir)\..\;$(SolutionDir)\..\..\;%(AdditionalIncludeDirectories) CompileAsC @@ -200,9 +263,9 @@ false $(OutDir)$(ProjectName).pch MultiThreadedDebug - _DEBUG;_XBOX;_XBOX360;_LIB;%(PreprocessorDefinitions);INLINE=static _inline;__attribute__=;__inline__=_inline;__extension__=;USE_15BPP_RENDERING;__LIBRETRO__ + _DEBUG;_XBOX;_XBOX360;_LIB;%(PreprocessorDefinitions);INLINE=static _inline;__attribute__=;__inline__=_inline;__extension__=;USE_16BPP_RENDERING;__LIBRETRO__;FRONTEND_SUPPORTS_RGB565 Callcap - $(SolutionDir)\..\..\libretro;$(SolutionDir)\..\..\source;$(SolutionDir)\..\..\source\m68k;$(SolutionDir)\..\..\source\sound;$(SolutionDir)\..\..\source\cart_hw;$(SolutionDir)\..\..\source\cart_hw\svp;$(SolutionDir)\..\..\source\input_hw;$(SolutionDir)\..\..\source\ntsc;$(SolutionDir)\..\..\source\z80;$(SolutionDir)\..\..\source\cd_hw;%(AdditionalIncludeDirectories) + $(SolutionDir)\..\..\source;$(SolutionDir)\..\..\source\cd_hw;$(SolutionDir)\..\..\source\cart_hw;$(SolutionDir)\..\..\source\sound;$(SolutionDir)\..\..\source\z80;$(SolutionDir)\..\..\source\m68k;$(SolutionDir)\..\..\source\input_hw;$(SolutionDir)\..\..\source\cart_hw\svp;$(SolutionDir)\..\..\source\ntsc;$(SolutionDir)\..\;$(SolutionDir)\..\..\;%(AdditionalIncludeDirectories) CompileAsC @@ -222,9 +285,9 @@ false $(OutDir)$(ProjectName).pch MultiThreaded - NDEBUG;_XBOX;_XBOX360;PROFILE;_LIB;__LIBRETRO__;USE_15BPP_RENDERING;INLINE=static _inline;%(PreprocessorDefinitions) + NDEBUG;_XBOX;_XBOX360;PROFILE;_LIB;__LIBRETRO__;USE_16BPP_RENDERING;INLINE=static _inline;FRONTEND_SUPPORTS_RGB565;%(PreprocessorDefinitions) Callcap - $(SolutionDir)\..\..\libretro;$(SolutionDir)\..\..\source;$(SolutionDir)\..\..\source\m68k;$(SolutionDir)\..\..\source\sound;$(SolutionDir)\..\..\source\cart_hw;$(SolutionDir)\..\..\source\cart_hw\svp;$(SolutionDir)\..\..\source\input_hw;$(SolutionDir)\..\..\source\ntsc;$(SolutionDir)\..\..\source\z80;$(SolutionDir)\..\..\source\cd_hw;%(AdditionalIncludeDirectories) + $(SolutionDir)\..\..\source;$(SolutionDir)\..\..\source\cd_hw;$(SolutionDir)\..\..\source\cart_hw;$(SolutionDir)\..\..\source\sound;$(SolutionDir)\..\..\source\z80;$(SolutionDir)\..\..\source\m68k;$(SolutionDir)\..\..\source\input_hw;$(SolutionDir)\..\..\source\cart_hw\svp;$(SolutionDir)\..\..\source\ntsc;$(SolutionDir)\..\;$(SolutionDir)\..\..\;%(AdditionalIncludeDirectories) CompileAsC @@ -248,8 +311,8 @@ false $(OutDir)$(ProjectName).pch MultiThreaded - NDEBUG;_XBOX;_XBOX360;PROFILE;FASTCAP;_LIB;__LIBRETRO__;USE_15BPP_RENDERING;INLINE=static _inline;%(PreprocessorDefinitions) - $(SolutionDir)\..\..\libretro;$(SolutionDir)\..\..\source;$(SolutionDir)\..\..\source\m68k;$(SolutionDir)\..\..\source\sound;$(SolutionDir)\..\..\source\cart_hw;$(SolutionDir)\..\..\source\cart_hw\svp;$(SolutionDir)\..\..\source\input_hw;$(SolutionDir)\..\..\source\ntsc;$(SolutionDir)\..\..\source\z80;$(SolutionDir)\..\..\source\cd_hw;%(AdditionalIncludeDirectories) + NDEBUG;_XBOX;_XBOX360;PROFILE;FASTCAP;_LIB;__LIBRETRO__;USE_16BPP_RENDERING;INLINE=static _inline;FRONTEND_SUPPORTS_RGB565;%(PreprocessorDefinitions) + $(SolutionDir)\..\..\source;$(SolutionDir)\..\..\source\cd_hw;$(SolutionDir)\..\..\source\cart_hw;$(SolutionDir)\..\..\source\sound;$(SolutionDir)\..\..\source\z80;$(SolutionDir)\..\..\source\m68k;$(SolutionDir)\..\..\source\input_hw;$(SolutionDir)\..\..\source\cart_hw\svp;$(SolutionDir)\..\..\source\ntsc;$(SolutionDir)\..\;$(SolutionDir)\..\..\;%(AdditionalIncludeDirectories) CompileAsC @@ -271,8 +334,8 @@ false $(OutDir)$(ProjectName).pch MultiThreaded - NDEBUG;_XBOX;_XBOX360;_LIB;INLINE=static _inline;__inline__=_inline;__extension__=;USE_15BPP_RENDERING;__LIBRETRO__;%(PreprocessorDefinitions) - $(SolutionDir)\..\..\libretro;$(SolutionDir)\..\..\source;$(SolutionDir)\..\..\source\m68k;$(SolutionDir)\..\..\source\sound;$(SolutionDir)\..\..\source\cart_hw;$(SolutionDir)\..\..\source\cart_hw\svp;$(SolutionDir)\..\..\source\input_hw;$(SolutionDir)\..\..\source\ntsc;$(SolutionDir)\..\..\source\z80;$(SolutionDir)\..\..\source\cd_hw;%(AdditionalIncludeDirectories) + NDEBUG;_XBOX;_XBOX360;_LIB;INLINE=static _inline;__inline__=_inline;__extension__=;USE_16BPP_RENDERING;__LIBRETRO__;FRONTEND_SUPPORTS_RGB565;%(PreprocessorDefinitions) + $(SolutionDir)\..\..\source;$(SolutionDir)\..\..\source\cd_hw;$(SolutionDir)\..\..\source\cart_hw;$(SolutionDir)\..\..\source\sound;$(SolutionDir)\..\..\source\z80;$(SolutionDir)\..\..\source\m68k;$(SolutionDir)\..\..\source\input_hw;$(SolutionDir)\..\..\source\cart_hw\svp;$(SolutionDir)\..\..\source\ntsc;$(SolutionDir)\..\;$(SolutionDir)\..\..\;%(AdditionalIncludeDirectories) CompileAsC @@ -294,8 +357,8 @@ false $(OutDir)$(ProjectName).pch MultiThreaded - NDEBUG;_XBOX;_XBOX360;LTCG;_LIB;INLINE=static _inline;__inline__=_inline;__extension__=;USE_15BPP_RENDERING;__LIBRETRO__;%(PreprocessorDefinitions) - $(SolutionDir)\..\..\libretro;$(SolutionDir)\..\..\source;$(SolutionDir)\..\..\source\m68k;$(SolutionDir)\..\..\source\sound;$(SolutionDir)\..\..\source\cart_hw;$(SolutionDir)\..\..\source\cart_hw\svp;$(SolutionDir)\..\..\source\input_hw;$(SolutionDir)\..\..\source\ntsc;$(SolutionDir)\..\..\source\z80;$(SolutionDir)\..\..\source\cd_hw;%(AdditionalIncludeDirectories) + NDEBUG;_XBOX;_XBOX360;LTCG;_LIB;INLINE=static _inline;__inline__=_inline;__extension__=;USE_16BPP_RENDERING;__LIBRETRO__;FRONTEND_SUPPORTS_RGB565;%(PreprocessorDefinitions) + $(SolutionDir)\..\..\source;$(SolutionDir)\..\..\source\cd_hw;$(SolutionDir)\..\..\source\cart_hw;$(SolutionDir)\..\..\source\sound;$(SolutionDir)\..\..\source\z80;$(SolutionDir)\..\..\source\m68k;$(SolutionDir)\..\..\source\input_hw;$(SolutionDir)\..\..\source\cart_hw\svp;$(SolutionDir)\..\..\source\ntsc;$(SolutionDir)\..\;$(SolutionDir)\..\..\;%(AdditionalIncludeDirectories) CompileAsC @@ -307,4 +370,4 @@ - \ No newline at end of file + diff -Nru libretro-genesisplusgx-0.6~filthypants2/libretro/msvc/msvc-2010-360/msvc-2010-360.vcxproj.filters libretro-genesisplusgx-0.6~filthypants4/libretro/msvc/msvc-2010-360/msvc-2010-360.vcxproj.filters --- libretro-genesisplusgx-0.6~filthypants2/libretro/msvc/msvc-2010-360/msvc-2010-360.vcxproj.filters 2012-08-15 15:21:19.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/libretro/msvc/msvc-2010-360/msvc-2010-360.vcxproj.filters 2013-04-29 16:28:55.000000000 +0000 @@ -74,15 +74,9 @@ Source Files\sound - - Source Files\sound - Source Files\sound - - Source Files\sound - Source Files\sound @@ -143,18 +137,12 @@ Source Files\cart_hw - - Source Files\cart_hw - Source Files\cart_hw Source Files\cart_hw - - Source Files\cart_hw - Source Files\cart_hw @@ -182,5 +170,17 @@ Source Files\cd_hw + + Source Files\sound + + + Source Files\cart_hw + + + Source Files\cart_hw + + + Source Files\cart_hw + \ No newline at end of file diff -Nru libretro-genesisplusgx-0.6~filthypants2/libretro/msvc/msvc-2010-360.bat libretro-genesisplusgx-0.6~filthypants4/libretro/msvc/msvc-2010-360.bat --- libretro-genesisplusgx-0.6~filthypants2/libretro/msvc/msvc-2010-360.bat 1970-01-01 00:00:00.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/libretro/msvc/msvc-2010-360.bat 2013-04-29 16:28:55.000000000 +0000 @@ -0,0 +1,124 @@ +@echo off + +@echo Setting environment for using Microsoft Visual Studio 2010 x86 tools. + +@call :GetVSCommonToolsDir +@if "%VS100COMNTOOLS%"=="" goto error_no_VS100COMNTOOLSDIR + +@call "%VS100COMNTOOLS%VCVarsQueryRegistry.bat" 32bit No64bit + +@if "%VSINSTALLDIR%"=="" goto error_no_VSINSTALLDIR +@if "%FrameworkDir32%"=="" goto error_no_FrameworkDIR32 +@if "%FrameworkVersion32%"=="" goto error_no_FrameworkVer32 +@if "%Framework35Version%"=="" goto error_no_Framework35Version + +@set FrameworkDir=%FrameworkDir32% +@set FrameworkVersion=%FrameworkVersion32% + +@if not "%WindowsSdkDir%" == "" ( + @set "PATH=%WindowsSdkDir%bin\NETFX 4.0 Tools;%WindowsSdkDir%bin;%PATH%" + @set "INCLUDE=%WindowsSdkDir%include;%INCLUDE%" + @set "LIB=%WindowsSdkDir%lib;%LIB%" +) + +@rem +@rem Root of Visual Studio IDE installed files. +@rem +@set DevEnvDir=%VSINSTALLDIR%Common7\IDE\ + +@rem PATH +@rem ---- +@if exist "%VSINSTALLDIR%Team Tools\Performance Tools" ( + @set "PATH=%VSINSTALLDIR%Team Tools\Performance Tools;%PATH%" +) +@if exist "%ProgramFiles%\HTML Help Workshop" set PATH=%ProgramFiles%\HTML Help Workshop;%PATH% +@if exist "%ProgramFiles(x86)%\HTML Help Workshop" set PATH=%ProgramFiles(x86)%\HTML Help Workshop;%PATH% +@if exist "%VCINSTALLDIR%VCPackages" set PATH=%VCINSTALLDIR%VCPackages;%PATH% +@set PATH=%FrameworkDir%%Framework35Version%;%PATH% +@set PATH=%FrameworkDir%%FrameworkVersion%;%PATH% +@set PATH=%VSINSTALLDIR%Common7\Tools;%PATH% +@if exist "%VCINSTALLDIR%BIN" set PATH=%VCINSTALLDIR%BIN;%PATH% +@set PATH=%DevEnvDir%;%PATH% + +@if exist "%VSINSTALLDIR%VSTSDB\Deploy" ( + @set "PATH=%VSINSTALLDIR%VSTSDB\Deploy;%PATH%" +) + +@if not "%FSHARPINSTALLDIR%" == "" ( + @set "PATH=%FSHARPINSTALLDIR%;%PATH%" +) + +@rem INCLUDE +@rem ------- +@if exist "%VCINSTALLDIR%ATLMFC\INCLUDE" set INCLUDE=%VCINSTALLDIR%ATLMFC\INCLUDE;%INCLUDE% +@if exist "%VCINSTALLDIR%INCLUDE" set INCLUDE=%VCINSTALLDIR%INCLUDE;%INCLUDE% + +@rem LIB +@rem --- +@if exist "%VCINSTALLDIR%ATLMFC\LIB" set LIB=%VCINSTALLDIR%ATLMFC\LIB;%LIB% +@if exist "%VCINSTALLDIR%LIB" set LIB=%VCINSTALLDIR%LIB;%LIB% + +@rem LIBPATH +@rem ------- +@if exist "%VCINSTALLDIR%ATLMFC\LIB" set LIBPATH=%VCINSTALLDIR%ATLMFC\LIB;%LIBPATH% +@if exist "%VCINSTALLDIR%LIB" set LIBPATH=%VCINSTALLDIR%LIB;%LIBPATH% +@set LIBPATH=%FrameworkDir%%Framework35Version%;%LIBPATH% +@set LIBPATH=%FrameworkDir%%FrameworkVersion%;%LIBPATH% + +@goto end + +@REM ----------------------------------------------------------------------- +:GetVSCommonToolsDir +@set VS100COMNTOOLS= +@call :GetVSCommonToolsDirHelper32 HKLM > nul 2>&1 +@if errorlevel 1 call :GetVSCommonToolsDirHelper32 HKCU > nul 2>&1 +@if errorlevel 1 call :GetVSCommonToolsDirHelper64 HKLM > nul 2>&1 +@if errorlevel 1 call :GetVSCommonToolsDirHelper64 HKCU > nul 2>&1 +@exit /B 0 + +:GetVSCommonToolsDirHelper32 +@for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v "10.0"') DO ( + @if "%%i"=="10.0" ( + @SET "VS100COMNTOOLS=%%k" + ) +) +@if "%VS100COMNTOOLS%"=="" exit /B 1 +@SET "VS100COMNTOOLS=%VS100COMNTOOLS%Common7\Tools\" +@exit /B 0 + +:GetVSCommonToolsDirHelper64 +@for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" /v "10.0"') DO ( + @if "%%i"=="10.0" ( + @SET "VS100COMNTOOLS=%%k" + ) +) +@if "%VS100COMNTOOLS%"=="" exit /B 1 +@SET "VS100COMNTOOLS=%VS100COMNTOOLS%Common7\Tools\" +@exit /B 0 + +@REM ----------------------------------------------------------------------- +:error_no_VS100COMNTOOLSDIR +@echo ERROR: Cannot determine the location of the VS Common Tools folder. +@goto end + +:error_no_VSINSTALLDIR +@echo ERROR: Cannot determine the location of the VS installation. +@goto end + +:error_no_FrameworkDIR32 +@echo ERROR: Cannot determine the location of the .NET Framework 32bit installation. +@goto end + +:error_no_FrameworkVer32 +@echo ERROR: Cannot determine the version of the .NET Framework 32bit installation. +@goto end + +:error_no_Framework35Version +@echo ERROR: Cannot determine the .NET Framework 3.5 version. +@goto end + +:end + +msbuild msvc-2010-360.sln /p:Configuration=Release_LTCG /target:clean +msbuild msvc-2010-360.sln /p:Configuration=Release_LTCG +exit diff -Nru libretro-genesisplusgx-0.6~filthypants2/libretro/msvc/msvc-2010-360.sln libretro-genesisplusgx-0.6~filthypants4/libretro/msvc/msvc-2010-360.sln --- libretro-genesisplusgx-0.6~filthypants2/libretro/msvc/msvc-2010-360.sln 2012-08-15 15:21:19.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/libretro/msvc/msvc-2010-360.sln 2013-04-29 16:28:55.000000000 +0000 @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genesis-next-msvc-2010-360", "msvc-2010-360/msvc-2010-360.vcxproj", "{00CE82EC-E948-4BB6-B726-23BF1571B05A}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genesis-next-msvc-2010-360", "msvc-2010-360\msvc-2010-360.vcxproj", "{00CE82EC-E948-4BB6-B726-23BF1571B05A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,16 +15,22 @@ GlobalSection(ProjectConfigurationPlatforms) = postSolution {00CE82EC-E948-4BB6-B726-23BF1571B05A}.CodeAnalysis|Xbox 360.ActiveCfg = CodeAnalysis|Xbox 360 {00CE82EC-E948-4BB6-B726-23BF1571B05A}.CodeAnalysis|Xbox 360.Build.0 = CodeAnalysis|Xbox 360 + {00CE82EC-E948-4BB6-B726-23BF1571B05A}.CodeAnalysis|Xbox 360.Deploy.0 = CodeAnalysis|Xbox 360 {00CE82EC-E948-4BB6-B726-23BF1571B05A}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360 {00CE82EC-E948-4BB6-B726-23BF1571B05A}.Debug|Xbox 360.Build.0 = Debug|Xbox 360 + {00CE82EC-E948-4BB6-B726-23BF1571B05A}.Debug|Xbox 360.Deploy.0 = Debug|Xbox 360 {00CE82EC-E948-4BB6-B726-23BF1571B05A}.Profile_FastCap|Xbox 360.ActiveCfg = Profile_FastCap|Xbox 360 {00CE82EC-E948-4BB6-B726-23BF1571B05A}.Profile_FastCap|Xbox 360.Build.0 = Profile_FastCap|Xbox 360 + {00CE82EC-E948-4BB6-B726-23BF1571B05A}.Profile_FastCap|Xbox 360.Deploy.0 = Profile_FastCap|Xbox 360 {00CE82EC-E948-4BB6-B726-23BF1571B05A}.Profile|Xbox 360.ActiveCfg = Profile|Xbox 360 {00CE82EC-E948-4BB6-B726-23BF1571B05A}.Profile|Xbox 360.Build.0 = Profile|Xbox 360 + {00CE82EC-E948-4BB6-B726-23BF1571B05A}.Profile|Xbox 360.Deploy.0 = Profile|Xbox 360 {00CE82EC-E948-4BB6-B726-23BF1571B05A}.Release_LTCG|Xbox 360.ActiveCfg = Release_LTCG|Xbox 360 {00CE82EC-E948-4BB6-B726-23BF1571B05A}.Release_LTCG|Xbox 360.Build.0 = Release_LTCG|Xbox 360 + {00CE82EC-E948-4BB6-B726-23BF1571B05A}.Release_LTCG|Xbox 360.Deploy.0 = Release_LTCG|Xbox 360 {00CE82EC-E948-4BB6-B726-23BF1571B05A}.Release|Xbox 360.ActiveCfg = Release|Xbox 360 {00CE82EC-E948-4BB6-B726-23BF1571B05A}.Release|Xbox 360.Build.0 = Release|Xbox 360 + {00CE82EC-E948-4BB6-B726-23BF1571B05A}.Release|Xbox 360.Deploy.0 = Release|Xbox 360 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff -Nru libretro-genesisplusgx-0.6~filthypants2/libretro/qnx/playbook/.cproject libretro-genesisplusgx-0.6~filthypants4/libretro/qnx/playbook/.cproject --- libretro-genesisplusgx-0.6~filthypants2/libretro/qnx/playbook/.cproject 1970-01-01 00:00:00.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/libretro/qnx/playbook/.cproject 2013-04-29 16:28:55.000000000 +0000 @@ -0,0 +1,606 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru libretro-genesisplusgx-0.6~filthypants2/libretro/qnx/playbook/.project libretro-genesisplusgx-0.6~filthypants4/libretro/qnx/playbook/.project --- libretro-genesisplusgx-0.6~filthypants2/libretro/qnx/playbook/.project 1970-01-01 00:00:00.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/libretro/qnx/playbook/.project 2013-04-29 16:28:55.000000000 +0000 @@ -0,0 +1,323 @@ + + + genesis-plus-gx + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.buildArguments + + + + org.eclipse.cdt.make.core.buildCommand + make + + + org.eclipse.cdt.make.core.buildLocation + ${workspace_loc:/genesis-plus-gx/Device-Release} + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + com.qnx.tools.bbt.xml.core.bbtXMLValidationBuilder + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + com.qnx.tools.ide.bbt.core.bbtnature + + + + src/activator.c + 1 + PARENT-3-PROJECT_LOC/source/input_hw/activator.c + + + src/areplay.c + 1 + PARENT-3-PROJECT_LOC/source/cart_hw/areplay.c + + + src/blip_buf.c + 1 + PARENT-3-PROJECT_LOC/source/sound/blip_buf.c + + + src/cd_cart.c + 1 + PARENT-3-PROJECT_LOC/source/cd_hw/cd_cart.c + + + src/cdc.c + 1 + PARENT-3-PROJECT_LOC/source/cd_hw/cdc.c + + + src/cdd.c + 1 + PARENT-3-PROJECT_LOC/source/cd_hw/cdd.c + + + src/eeprom_93c.c + 1 + PARENT-3-PROJECT_LOC/source/cart_hw/eeprom_93c.c + + + src/eeprom_i2c.c + 1 + PARENT-3-PROJECT_LOC/source/cart_hw/eeprom_i2c.c + + + src/eeprom_spi.c + 1 + PARENT-3-PROJECT_LOC/source/cart_hw/eeprom_spi.c + + + src/eq.c + 1 + PARENT-3-PROJECT_LOC/source/sound/eq.c + + + src/gamepad.c + 1 + PARENT-3-PROJECT_LOC/source/input_hw/gamepad.c + + + src/genesis.c + 1 + PARENT-3-PROJECT_LOC/source/genesis.c + + + src/gfx.c + 1 + PARENT-3-PROJECT_LOC/source/cd_hw/gfx.c + + + src/ggenie.c + 1 + PARENT-3-PROJECT_LOC/source/cart_hw/ggenie.c + + + src/input.c + 1 + PARENT-3-PROJECT_LOC/source/input_hw/input.c + + + src/io_ctrl.c + 1 + PARENT-3-PROJECT_LOC/source/io_ctrl.c + + + src/libretro.c + 1 + PARENT-2-PROJECT_LOC/libretro.c + + + src/lightgun.c + 1 + PARENT-3-PROJECT_LOC/source/input_hw/lightgun.c + + + src/loadrom.c + 1 + PARENT-3-PROJECT_LOC/source/loadrom.c + + + src/m68kcpu.c + 1 + PARENT-3-PROJECT_LOC/source/m68k/m68kcpu.c + + + src/md_cart.c + 1 + PARENT-3-PROJECT_LOC/source/cart_hw/md_cart.c + + + src/md_ntsc.c + 1 + PARENT-3-PROJECT_LOC/source/ntsc/md_ntsc.c + + + src/mem68k.c + 1 + PARENT-3-PROJECT_LOC/source/mem68k.c + + + src/membnk.c + 1 + PARENT-3-PROJECT_LOC/source/membnk.c + + + src/memz80.c + 1 + PARENT-3-PROJECT_LOC/source/memz80.c + + + src/mouse.c + 1 + PARENT-3-PROJECT_LOC/source/input_hw/mouse.c + + + src/paddle.c + 1 + PARENT-3-PROJECT_LOC/source/input_hw/paddle.c + + + src/pcm.c + 1 + PARENT-3-PROJECT_LOC/source/cd_hw/pcm.c + + + src/s68kcpu.c + 1 + PARENT-3-PROJECT_LOC/source/m68k/s68kcpu.c + + + src/scd.c + 1 + PARENT-3-PROJECT_LOC/source/cd_hw/scd.c + + + src/scrc32.c + 1 + PARENT-2-PROJECT_LOC/scrc32.c + + + src/sms_cart.c + 1 + PARENT-3-PROJECT_LOC/source/cart_hw/sms_cart.c + + + src/sms_ntsc.c + 1 + PARENT-3-PROJECT_LOC/source/ntsc/sms_ntsc.c + + + src/sn76489.c + 1 + PARENT-3-PROJECT_LOC/source/sound/sn76489.c + + + src/sound.c + 1 + PARENT-3-PROJECT_LOC/source/sound/sound.c + + + src/sportspad.c + 1 + PARENT-3-PROJECT_LOC/source/input_hw/sportspad.c + + + src/sram.c + 1 + PARENT-3-PROJECT_LOC/source/cart_hw/sram.c + + + src/ssp16.c + 1 + PARENT-3-PROJECT_LOC/source/cart_hw/svp/ssp16.c + + + src/state.c + 1 + PARENT-3-PROJECT_LOC/source/state.c + + + src/svp.c + 1 + PARENT-3-PROJECT_LOC/source/cart_hw/svp/svp.c + + + src/system.c + 1 + PARENT-3-PROJECT_LOC/source/system.c + + + src/teamplayer.c + 1 + PARENT-3-PROJECT_LOC/source/input_hw/teamplayer.c + + + src/terebi_oekaki.c + 1 + PARENT-3-PROJECT_LOC/source/input_hw/terebi_oekaki.c + + + src/vdp_ctrl.c + 1 + PARENT-3-PROJECT_LOC/source/vdp_ctrl.c + + + src/vdp_render.c + 1 + PARENT-3-PROJECT_LOC/source/vdp_render.c + + + src/xe_a1p.c + 1 + PARENT-3-PROJECT_LOC/source/input_hw/xe_a1p.c + + + src/ym2413.c + 1 + PARENT-3-PROJECT_LOC/source/sound/ym2413.c + + + src/ym2612.c + 1 + PARENT-3-PROJECT_LOC/source/sound/ym2612.c + + + src/z80.c + 1 + PARENT-3-PROJECT_LOC/source/z80/z80.c + + + diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/cart_hw/md_cart.c libretro-genesisplusgx-0.6~filthypants4/source/cart_hw/md_cart.c --- libretro-genesisplusgx-0.6~filthypants2/source/cart_hw/md_cart.c 2012-10-17 20:00:51.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/cart_hw/md_cart.c 2013-04-29 16:28:55.000000000 +0000 @@ -2,7 +2,7 @@ * Genesis Plus * Mega Drive cartridge hardware support * - * Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX) * * Most cartridge protections were initially documented by Haze * (http://haze.mameworld.info/) @@ -46,7 +46,7 @@ #include "eeprom_spi.h" #include "gamepad.h" -#define CART_CNT (48) +#define CART_CNT (53) /* Cart database entry */ typedef struct @@ -67,6 +67,8 @@ static uint32 mapper_sf004_r(uint32 address); static void mapper_t5740_w(uint32 address, uint32 data); static uint32 mapper_t5740_r(uint32 address); +static uint32 mapper_smw_64_r(uint32 address); +static void mapper_smw_64_w(uint32 address, uint32 data); static void mapper_realtec_w(uint32 address, uint32 data); static void mapper_seganet_w(uint32 address, uint32 data); static void mapper_32k_w(uint32 data); @@ -77,10 +79,13 @@ static void default_regs_w(uint32 address, uint32 data); static uint32 default_regs_r(uint32 address); static uint32 default_regs_r_16(uint32 address); +static uint32 custom_regs_r(uint32 address); static void custom_regs_w(uint32 address, uint32 data); static void custom_alt_regs_w(uint32 address, uint32 data); static uint32 topshooter_r(uint32 address); static void topshooter_w(uint32 address, uint32 data); +static uint32 tekken_regs_r(uint32 address); +static void tekken_regs_w(uint32 address, uint32 data); /* Games that need extra hardware emulation: - copy protection device @@ -94,14 +99,20 @@ {0xffff,0xf863,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},1,0,NULL,NULL,NULL,mapper_realtec_w}}, /* Earth Defense */ {0xffff,0x44fb,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},1,0,NULL,NULL,NULL,mapper_realtec_w}}, + + +/* RADICA (Volume 1) (bad dump ?) */ + {0x0000,0x2326,0x00,0x00,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},0,1,mapper_radica_r,NULL,NULL,NULL}}, /* RADICA (Volume 1) */ - {0x0000,0x2326,0x00,0x00,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},0,0,mapper_radica_r,NULL,NULL,NULL}}, + {0x24f4,0xfc84,0x00,0x00,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},0,0,mapper_radica_r,NULL,NULL,NULL}}, /* RADICA (Volume 2) */ - {0x4f10,0x0836,0x00,0x00,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},0,0,mapper_radica_r,NULL,NULL,NULL}}, -/* RADICA (Volume 1) (byteswapped version) */ - {0xf424,0x9f82,0x00,0x00,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},0,0,mapper_radica_r,NULL,NULL,NULL}}, + {0x104f,0x32e9,0x00,0x00,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},0,0,mapper_radica_r,NULL,NULL,NULL}}, + + /* Tenchi wo Kurau III: Sangokushi Gaiden - Chinese Fighter */ {0x9490,0x8180,0x40,0x6f,{{0x00,0x00,0x00,0x00},{0xf0000c,0xf0000c,0xf0000c,0xf0000c},{0x400000,0x400004,0x400008,0x40000c},0,1,NULL,NULL,default_regs_r,custom_alt_regs_w}}, + + /* Top Fighter */ {0x4eb9,0x5d8b,0x60,0x7f,{{0x00,0x00,0x00,0x00},{0xf00007,0xf00007,0xf00007,0xffffff},{0x600001,0x600003,0x600005,0x000000},0,1,NULL,NULL,default_regs_r,custom_regs_w}}, /* Soul Edge VS Samurai Spirits */ @@ -116,6 +127,12 @@ {0x0000,0x7d6e,0x60,0x7f,{{0x00,0x00,0x00,0x00},{0xf00007,0xf00007,0xf00007,0xffffff},{0x600001,0x600003,0x600005,0x000000},0,1,NULL,NULL,default_regs_r,custom_regs_w}}, /* Pokemon Stadium */ {0x0000,0x843c,0x70,0x7f,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},0,1,NULL,NULL,NULL,custom_regs_w}}, + + +/* Tekken 3 Special (original dump) (a bootleg version also exists, with patched protection & different boot routine which reads unused !TIME mapped area) */ + {0x0000,0xc2f0,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},0,0,NULL,NULL,tekken_regs_r,tekken_regs_w}}, + + /* Lion King 2 */ {0xffff,0x1d9b,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xfffffd,0xfffffd,0xffffff,0xffffff},{0x400000,0x400004,0x000000,0x000000},0,0,NULL,NULL,default_regs_r,default_regs_w}}, /* Squirell King */ @@ -130,20 +147,35 @@ {0xffff,0x5d98,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xfffffd,0xfffffd,0xffffff,0xffffff},{0x400000,0x400004,0x000000,0x000000},0,0,NULL,NULL,default_regs_r,default_regs_w}}, /* (*) Shui Hu - Feng Yun Zhuan (patched ROM, unused registers) */ {0x3332,0x872b,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xfffffd,0xfffffd,0xffffff,0xffffff},{0x400000,0x400004,0x000000,0x000000},0,0,NULL,NULL,default_regs_r,default_regs_w}}, + + /* (*) Chao Ji Da Fu Weng (patched ROM, various words witten to register, long word also read from $7E0000, unknown banking hardware ?) */ {0xa697,0xa697,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x000000,0x000000,0x000000},0,0,NULL,NULL,NULL,default_regs_w}}, + /* (*) Aq Renkan Awa (patched ROM, ON/OFF bit sequence is written to register, unknown banking hardware ?) */ {0x8104,0x0517,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400001,0x000000,0x000000,0x000000},0,0,NULL,NULL,NULL,default_regs_w}}, -/* (*) Jiu Ji Ma Jiang II - Ye Yan Bian (patched ROM, using expected register value - $0f - crashes the game) (uses 16-bits reads) */ - {0x0c44,0xba81,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x400006},0,0,NULL,NULL,default_regs_r_16,NULL}}, + + /* (*) Tun Shi Tian Di III (patched ROM, unused register) */ {0x0000,0x9c5e,0x40,0x40,{{0xab,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400046,0x000000,0x000000,0x000000},0,0,NULL,NULL,default_regs_r,NULL}}, + + /* Ma Jiang Qing Ren - Ji Ma Jiang Zhi */ {0x0000,0x7037,0x40,0x40,{{0x90,0xd3,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x401000,0x000000,0x000000},0,0,NULL,NULL,default_regs_r,NULL}}, +/* Super Majon Club */ + {0x0000,0x3b95,0x40,0x40,{{0x90,0xd3,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x401000,0x000000,0x000000},0,0,NULL,NULL,default_regs_r,NULL}}, +/* Feng Kuang Tao Hua Yuan (original version from Creaton Softec Inc) (a bootleg version also exists with patched protection and minor title screen variations) */ + {0x0000,0x9dc4,0x40,0x40,{{0x90,0xd3,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x401000,0x000000,0x000000},0,0,NULL,NULL,default_regs_r,NULL}}, + + +/* (*) Jiu Ji Ma Jiang II - Ye Yan Bian (patched ROM, using expected register value - $0f - crashes the game) (uses 16-bits reads) */ + {0x0c44,0xba81,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x400006},0,0,NULL,NULL,default_regs_r_16,NULL}}, /* 16 Zhang Ma Jiang (uses 16-bits reads) */ {0xfb40,0x4bed,0x40,0x40,{{0x00,0xaa,0x00,0xf0},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x400002,0x000000,0x400006},0,0,NULL,NULL,default_regs_r_16,NULL}}, -/* King of Fighter 98 */ - {0x0000,0xd0a0,0x48,0x4f,{{0x00,0x00,0xaa,0xf0},{0xffffff,0xffffff,0xfc0000,0xfc0000},{0x000000,0x000000,0x480000,0x4c0000},0,0,NULL,NULL,default_regs_r,NULL}}, +/* 16 Tiles Mahjong II (uses 16-bits reads) */ + {0xffff,0x0903,0x40,0x40,{{0x00,0x00,0xc9,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x400004,0x000000},0,0,NULL,NULL,default_regs_r_16,NULL}}, + + /* Super Bubble Bobble */ {0x0000,0x16cd,0x40,0x40,{{0x55,0x0f,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x000000,0x000000},0,0,NULL,NULL,default_regs_r,NULL}}, /* Tenchi wo Kurau II - The Battle of Red Cliffs (Unl) */ @@ -160,12 +192,20 @@ {0xffff,0xd472,0x40,0x40,{{0x63,0x98,0xc9,0x18},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,NULL,NULL,default_regs_r,NULL}}, /* 777 Casino (For first one, 0x55 works as well. Other values are never used so they are guessed from on other unlicensed games using similar mapper) */ {0x0000,0xf8d9,0x40,0x40,{{0x63,0x98,0xc9,0x18},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,NULL,NULL,default_regs_r,NULL}}, +/* Wu Kong Wai Zhuan (original) (a bootleg version also exists, with patched protection & modified SRAM test routine ?) */ + {0x0000,0x19ff,0x40,0x40,{{0x63,0x98,0xc9,0x18},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,NULL,NULL,default_regs_r,NULL}}, /* Soul Blade */ {0x0000,0x0c5b,0x40,0x40,{{0x63,0x98,0xc9,0xf0},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,NULL,NULL,default_regs_r,NULL}}, -/* Rockman X3 (half-patched ROM, two last register values are not used, 0xaa/0x18 works too) */ + + +/* King of Fighter 98 */ + {0x0000,0xd0a0,0x48,0x4f,{{0x00,0x00,0xaa,0xf0},{0xffffff,0xffffff,0xfc0000,0xfc0000},{0x000000,0x000000,0x480000,0x4c0000},0,0,NULL,NULL,default_regs_r,NULL}}, + + +/* Rockman X3 (bootleg version ? two last register returned values are ignored, note that 0xaa/0x18 would work as well) */ {0x0000,0x9d0e,0x40,0x40,{{0x0c,0x00,0xc9,0xf0},{0xffffff,0xffffff,0xffffff,0xffffff},{0xa13000,0x000000,0x400004,0x400006},0,0,default_regs_r,NULL,default_regs_r,NULL}}, -/* (*) Tekken 3 Special (patched ROM, register value not used, unknown writes to $400000-$40000E, read from $400002) */ - {0x0000,0x8c6e,0x00,0x00,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0xa13000,0x000000,0x000000,0x000000},0,0,default_regs_r,NULL,NULL,NULL}}, + + /* (*) Dragon Ball Final Bout (patched ROM, in original code, different switches occurs depending on returned value $00-$0f) */ {0xc65a,0xc65a,0x00,0x00,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0xa13000,0x000000,0x000000,0x000000},0,0,default_regs_r,NULL,NULL,NULL}}, /* (*) Yang Jia Jiang - Yang Warrior Family (patched ROM, register value unused) */ @@ -174,14 +214,22 @@ {0xffff,0x0474,0x00,0x00,{{0x0a,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0xa13000,0x000000,0x000000,0x000000},0,0,default_regs_r,NULL,NULL,NULL}}, /* Super Mario World */ {0x2020,0xb4eb,0x00,0x00,{{0x1c,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0xa13000,0x000000,0x000000,0x000000},0,0,default_regs_r,NULL,NULL,NULL}}, -/* A Bug's Life */ - {0x7f7f,0x2aad,0x00,0x00,{{0x28,0x1f,0x01,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0xa13000,0xa13002,0xa1303e,0x000000},0,0,default_regs_r,NULL,NULL,NULL}}, + + /* King of Fighter 99 */ - {0x0000,0x021e,0x00,0x00,{{0x00,0x01,0x1f,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0xa13000,0xa13002,0xa1303e,0x000000},0,0,default_regs_r,NULL,NULL,NULL}}, + {0x0000,0x021e,0x00,0x00,{{0x00,0x01,0x1f,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0xa13000,0xa13002,0xa1303e,0x000000},0,0,custom_regs_r,default_regs_w,NULL,NULL}}, /* Pocket Monster */ - {0xd6fc,0x1eb1,0x00,0x00,{{0x00,0x01,0x1f,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0xa13000,0xa13002,0xa1303e,0x000000},0,0,default_regs_r,NULL,NULL,NULL}}, + {0xd6fc,0x1eb1,0x00,0x00,{{0x00,0x01,0x1f,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0xa13000,0xa13002,0xa1303e,0x000000},0,0,custom_regs_r,default_regs_w,NULL,NULL}}, +/* Pocket Monster (bootleg version ? two last register returned values are ignored & first register test has been modified) */ + {0xd6fc,0x6319,0x00,0x00,{{0x14,0x01,0x1f,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0xa13000,0xa13002,0xa1303e,0x000000},0,0,default_regs_r,m68k_unused_8_w,NULL,NULL}}, +/* A Bug's Life (bootleg version ? two last register returned values are ignored & first register test has been modified ?) */ + {0x7f7f,0x2aad,0x00,0x00,{{0x28,0x01,0x1f,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0xa13000,0xa13002,0xa1303e,0x000000},0,0,default_regs_r,m68k_unused_8_w,NULL,NULL}}, + + /* Game no Kanzume Otokuyou */ {0x0000,0xf9d1,0x00,0x00,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},0,0,NULL,mapper_seganet_w,NULL,NULL}}, + + /* Top Shooter (arcade hardware) */ {0xffff,0x3632,0x20,0x20,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},0,0,NULL,NULL,topshooter_r,topshooter_w}} }; @@ -349,107 +397,9 @@ } /********************************************** - SPECIFIC PERIPHERAL SUPPORT - ***********************************************/ - - /* default GUN settings */ - input.x_offset = 0x00; - input.y_offset = 0x00; - - /* SEGA Menacer */ - if (strstr(rominfo.international,"MENACER") != NULL) - { - /* save current setting */ - if (old_system[0] == -1) - { - old_system[0] = input.system[0]; - } - if (old_system[1] == -1) - { - old_system[1] = input.system[1]; - } - - input.system[0] = SYSTEM_MD_GAMEPAD; - input.system[1] = SYSTEM_MENACER; - input.x_offset = 0x52; - input.y_offset = 0x00; - } - else if (strstr(rominfo.international,"T2 ; THE ARCADE GAME") != NULL) - { - /* save current setting */ - if (old_system[0] == -1) - { - old_system[0] = input.system[0]; - } - if (old_system[1] == -1) - { - old_system[1] = input.system[1]; - } - - input.system[0] = SYSTEM_MD_GAMEPAD; - input.system[1] = SYSTEM_MENACER; - input.x_offset = 0x84; - input.y_offset = 0x08; - } - else if (strstr(rominfo.international,"BODY COUNT") != NULL) - { - /* save current setting */ - if (old_system[0] == -1) - { - old_system[0] = input.system[0]; - } - if (old_system[1] == -1) - { - old_system[1] = input.system[1]; - } - - input.system[0] = SYSTEM_MOUSE; - input.system[1] = SYSTEM_MENACER; - input.x_offset = 0x44; - input.y_offset = 0x18; - } - - /* KONAMI Justifiers */ - else if (strstr(rominfo.international,"LETHAL ENFORCERSII") != NULL) - { - /* save current setting */ - if (old_system[0] == -1) - { - old_system[0] = input.system[0]; - } - if (old_system[1] == -1) - { - old_system[1] = input.system[1]; - } - - input.system[0] = SYSTEM_MD_GAMEPAD; - input.system[1] = SYSTEM_JUSTIFIER; - input.x_offset = 0x18; - input.y_offset = 0x00; - } - else if (strstr(rominfo.international,"LETHAL ENFORCERS") != NULL) - { - /* save current setting */ - if (old_system[0] == -1) - { - old_system[0] = input.system[0]; - } - if (old_system[1] == -1) - { - old_system[1] = input.system[1]; - } - - input.system[0] = SYSTEM_MD_GAMEPAD; - input.system[1] = SYSTEM_JUSTIFIER; - input.x_offset = 0x00; - input.y_offset = 0x00; - } - - cart.special = 0; - - /********************************************** J-CART ***********************************************/ + cart.special = 0; if (((strstr(rominfo.product,"00000000") != NULL) && (rominfo.checksum == 0x168b)) || /* Super Skidmarks, Micro Machines Military */ ((strstr(rominfo.product,"00000000") != NULL) && (rominfo.checksum == 0x165e)) || /* Pete Sampras Tennis (1991), Micro Machines 96 */ ((strstr(rominfo.product,"00000000") != NULL) && (rominfo.checksum == 0xcee0)) || /* Micro Machines Military (bad) */ @@ -463,7 +413,7 @@ { cart.special |= HW_J_CART; - /* set default port 1 setting */ + /* force port 1 setting */ if (input.system[1] != SYSTEM_WAYPLAY) { old_system[1] = input.system[1]; @@ -566,7 +516,7 @@ memset(&cart.hw, 0, sizeof(cart.hw)); /* search for game into database */ - for (i=0; i < CART_CNT + 1; i++) + for (i=0; i 0x400000) { /* assume linear ROM mapper without bankswitching (max. 10MB) */ @@ -968,8 +945,8 @@ zbank_memory_map[i].read = NULL; } - /* 256K ROM banks #2 to #15 mapped to $040000-$3BFFFF */ - for (i=0x04; i<0x3c; i++) + /* 256K ROM banks #2 to #15 mapped to $040000-$3BFFFF (last revision) or $040000-$3FFFFF (older revisions) */ + for (i=0x04; i<(sram.start >> 16); i++) { m68k.memory_map[i].base = cart.rom + (i << 16); m68k.memory_map[i].read8 = NULL; @@ -977,8 +954,8 @@ zbank_memory_map[i].read = NULL; } - /* 32K static RAM mirrored into $3C0000-$3FFFFF (odd bytes only) */ - for (i=0x3c; i<0x40; i++) + /* 32K static RAM mirrored into $3C0000-$3FFFFF (odd bytes only) (last revision only) */ + while (i<0x40) { m68k.memory_map[i].base = sram.sram; m68k.memory_map[i].read8 = NULL; @@ -987,11 +964,12 @@ m68k.memory_map[i].write16 = NULL; zbank_memory_map[i].read = NULL; zbank_memory_map[i].write = NULL; + i++; } } else { - /* 256K ROM banks #1 to #16 mapped to $000000-$3FFFFF */ + /* 256K ROM banks #1 to #16 mapped to $000000-$3FFFFF (default) */ for (i=0x00; i<0x40; i++) { m68k.memory_map[i].base = cart.rom + (i << 16); @@ -1272,6 +1250,173 @@ } /* + Super Mario World 64 (unlicensed) mapper +*/ +static void mapper_smw_64_w(uint32 address, uint32 data) +{ + /* internal registers (saved to backup RAM) */ + switch ((address >> 16) & 0x07) + { + case 0x00: /* $60xxxx */ + { + if (address & 2) + { + /* $600003 data write mode ? */ + switch (sram.sram[0x00] & 0x07) + { + case 0x00: + { + /* update value returned at $660001-$660003 */ + sram.sram[0x06] = ((sram.sram[0x06] ^ sram.sram[0x01]) ^ data) & 0xFE; + break; + } + + case 0x01: + { + /* update value returned at $660005-$660007 */ + sram.sram[0x07] = data & 0xFE; + break; + } + + case 0x07: + { + /* update selected ROM bank (upper 512K) mapped at $610000-$61ffff */ + m68k.memory_map[0x61].base = m68k.memory_map[0x69].base = cart.rom + 0x080000 + ((data & 0x1c) << 14); + break; + } + + default: + { + /* unknown mode */ + break; + } + } + + /* $600003 data register */ + sram.sram[0x01] = data; + } + else + { + /* $600001 ctrl register */ + sram.sram[0x00] = data; + } + return; + } + + case 0x01: /* $61xxxx */ + { + if (address & 2) + { + /* $610003 ctrl register */ + sram.sram[0x02] = data; + } + return; + } + + case 0x04: /* $64xxxx */ + { + if (address & 2) + { + /* $640003 data register */ + sram.sram[0x04] = data; + } + else + { + /* $640001 data register */ + sram.sram[0x03] = data; + } + return; + } + + case 0x06: /* $66xxxx */ + { + /* unknown */ + return; + } + + case 0x07: /* $67xxxx */ + { + if (!(address & 2)) + { + /* $670001 ctrl register */ + sram.sram[0x05] = data; + + /* upper 512K ROM bank-switching enabled ? */ + if (sram.sram[0x02] & 0x80) + { + /* update selected ROM bank (upper 512K) mapped at $600000-$60ffff */ + m68k.memory_map[0x60].base = m68k.memory_map[0x68].base = cart.rom + 0x080000 + ((data & 0x1c) << 14); + } + } + return; + } + + default: /* not used */ + { + m68k_unused_8_w(address, data); + return; + } + } +} + +static uint32 mapper_smw_64_r(uint32 address) +{ + /* internal registers (saved to backup RAM) */ + switch ((address >> 16) & 0x03) + { + case 0x02: /* $66xxxx */ + { + switch ((address >> 1) & 7) + { + case 0x00: return sram.sram[0x06]; + case 0x01: return sram.sram[0x06] + 1; + case 0x02: return sram.sram[0x07]; + case 0x03: return sram.sram[0x07] + 1; + case 0x04: return sram.sram[0x08]; + case 0x05: return sram.sram[0x08] + 1; + case 0x06: return sram.sram[0x08] + 2; + case 0x07: return sram.sram[0x08] + 3; + } + } + + case 0x03: /* $67xxxx */ + { + uint8 data = (sram.sram[0x02] & 0x80) ? ((sram.sram[0x05] & 0x40) ? (sram.sram[0x03] & sram.sram[0x04]) : (sram.sram[0x03] ^ 0xFF)) : 0x00; + + if (address & 2) + { + /* $670003 */ + data &= 0x7f; + } + else + { + /* $66xxxx data registers update */ + if (sram.sram[0x05] & 0x80) + { + if (sram.sram[0x05] & 0x20) + { + /* update $660009-$66000f data register */ + sram.sram[0x08] = (sram.sram[0x04] << 2) & 0xFC; + } + else + { + /* update $660001-$660003 data register */ + sram.sram[0x06] = (sram.sram[0x01] ^ (sram.sram[0x03] << 1)) & 0xFE; + } + } + } + + return data; + } + + default: /* 64xxxx-$65xxxx */ + { + return 0x00; + } + } +} + +/* Realtec ROM bankswitch (Earth Defend, Balloon Boy & Funny World, Whac-A-Critter) (Note: register usage is inverted in TascoDlx documentation) */ @@ -1495,6 +1640,21 @@ m68k_unused_8_w(address, data); } +/* basic register shifting hardware (Bug's Life, Pocket Monster) */ +static uint32 custom_regs_r(uint32 address) +{ + int i; + for (i=0; i<4; i++) + { + if ((address & cart.hw.mask[i]) == cart.hw.addr[i]) + { + return cart.hw.regs[i] >> 1; + } + } + + return m68k_read_bus_8(address); +} + /* custom register hardware (Top Fighter, Lion King III, Super Donkey Kong 99, Mulan, Pocket Monsters II, Pokemon Stadium) */ static void custom_regs_w(uint32 address, uint32 data) { @@ -1550,7 +1710,62 @@ } -/* Top Shooter arcade board hardware */ +/* "Tekken 3 Special" custom register hardware */ +static uint32 tekken_regs_r(uint32 address) +{ + /* data output */ + if ((address & 0x0e) == 0x02) + { + /* maybe depends on mode bits ? */ + return (cart.hw.regs[0] - 1); + } + + return m68k_read_bus_16(address); +} + +static void tekken_regs_w(uint32 address, uint32 data) +{ + switch (address & 0x0e) + { + case 0x00: + { + /* data output reset ? (game writes $FF before & after protection check) */ + cart.hw.regs[0]= 0x00; + break; + } + + case 0x02: + { + /* read only ? */ + break; + } + + case 0x0c: + { + /* data output mode bit 0 ? (game writes $01) */ + break; + } + + case 0x0e: + { + /* data output mode bit 1 ? (never written by game) */ + break; + } + + default: + { + /* data input (only connected to D0 ?)*/ + if (data & 1) + { + /* 4-bit hardware register ($400004 corresponds to bit0, $400006 to bit1, etc) */ + cart.hw.regs[0] |= 1 << (((address - 0x04) >> 1) & 3); + } + break; + } + } +} + +/* "Top Shooter" arcade board hardware */ static uint32 topshooter_r(uint32 address) { if (address < 0x202000) diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/cart_hw/md_cart.h libretro-genesisplusgx-0.6~filthypants4/source/cart_hw/md_cart.h --- libretro-genesisplusgx-0.6~filthypants2/source/cart_hw/md_cart.h 2012-08-15 15:21:19.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/cart_hw/md_cart.h 2013-04-29 16:28:55.000000000 +0000 @@ -2,7 +2,7 @@ * Genesis Plus * Mega Drive cartridge hardware support * - * Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX) * * Most cartridge protections were initially documented by Haze * (http://haze.mameworld.info/) diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/cart_hw/sram.c libretro-genesisplusgx-0.6~filthypants4/source/cart_hw/sram.c --- libretro-genesisplusgx-0.6~filthypants2/source/cart_hw/sram.c 2012-10-17 20:00:51.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/cart_hw/sram.c 2013-04-29 16:28:55.000000000 +0000 @@ -2,7 +2,7 @@ * Genesis Plus * Backup RAM support * - * Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: @@ -122,15 +122,25 @@ { /* Xin Qigai Wangzi (use uncommon area) */ sram.on = 1; - sram.start = 0x400000; + sram.start = 0x400001; sram.end = 0x40ffff; } else if ((strstr(rominfo.ROMType,"SF") != NULL) && (strstr(rominfo.product,"001") != NULL)) { - /* SF-001 (use bankswitching) */ + /* SF-001 */ sram.on = 1; - sram.start = 0x3c0001; - sram.end = 0x3cffff; + if (rominfo.checksum == 0x3e08) + { + /* last revision (use bankswitching) */ + sram.start = 0x3c0001; + sram.end = 0x3cffff; + } + else + { + /* older revisions (use uncommon area) */ + sram.start = 0x400001; + sram.end = 0x40ffff; + } } else if ((strstr(rominfo.ROMType,"SF") != NULL) && (strstr(rominfo.product,"004") != NULL)) { @@ -147,7 +157,7 @@ /* Sonic 3 & Knuckles combined ROM */ /* it shows S&K header but should obviously use FRAM from Sonic 3 */ sram.on = 1; - sram.start = 0x200000; + sram.start = 0x200001; sram.end = 0x203fff; } } diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/cart_hw/sram.h libretro-genesisplusgx-0.6~filthypants4/source/cart_hw/sram.h --- libretro-genesisplusgx-0.6~filthypants2/source/cart_hw/sram.h 2012-08-15 15:21:19.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/cart_hw/sram.h 2013-04-29 16:28:55.000000000 +0000 @@ -2,7 +2,7 @@ * Genesis Plus * Backup RAM support * - * Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/cd_hw/cd_cart.c libretro-genesisplusgx-0.6~filthypants4/source/cd_hw/cd_cart.c --- libretro-genesisplusgx-0.6~filthypants2/source/cd_hw/cd_cart.c 2012-10-17 20:00:51.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/cd_hw/cd_cart.c 2013-04-29 16:28:55.000000000 +0000 @@ -264,4 +264,4 @@ } } } -} \ No newline at end of file +} diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/cd_hw/cdd.c libretro-genesisplusgx-0.6~filthypants4/source/cd_hw/cdd.c --- libretro-genesisplusgx-0.6~filthypants2/source/cd_hw/cdd.c 2012-10-17 20:00:51.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/cd_hw/cdd.c 2013-04-29 16:28:55.000000000 +0000 @@ -84,6 +84,32 @@ 685, 3167 }; +static const uint32 toc_shadow[15] = +{ + 10226, 70054, 11100, 12532, 12444, 11923, 10059, 10167, 10138, 13792, + 11637, 2547, 2521, 3856, 900 +}; + +static const uint32 toc_dungeon[13] = +{ + 2250, 22950, 16350, 24900, 13875, 19950, 13800, 15375, 17400, 17100, + 3325, 6825, 25275 +}; + +static const uint32 toc_ffight[26] = +{ + 11994, 9742, 10136, 9685, 9553, 14588, 9430, 8721, 9975, 9764, + 9704, 12796, 585, 754, 951, 624, 9047, 1068, 817, 9191, 1024, + 14562, 10320, 8627, 3795, 3047 +}; + +static const uint32 toc_ffightj[29] = +{ + 11994, 9752, 10119, 9690, 9567, 14575, 9431, 8731, 9965, 9763, + 9716, 12791, 579, 751, 958, 630, 9050, 1052, 825, 9193, 1026, + 14553, 9834, 10542, 1699, 1792, 1781, 3783, 3052 +}; + /* supported WAVE file header (16-bit stereo samples @44.1kHz) */ static const unsigned char waveHeader[32] = { @@ -91,7 +117,7 @@ 0x44,0xac,0x00,0x00,0x10,0xb1,0x02,0x00,0x04,0x00,0x10,0x00,0x64,0x61,0x74,0x61 }; -/* supported file extensions */ +/* supported WAVE file extensions */ static const char extensions[10][16] = { "%02d.wav", @@ -357,7 +383,7 @@ if (!(memcmp(lptr, "FILE", 4))) { /* check supported file types */ - if (!strstr(lptr," BINARY") && !strstr(lptr," WAVE")) + if (!strstr(lptr," BINARY") && !strstr(lptr," WAV")) { /* unsupported file type */ break; @@ -375,7 +401,7 @@ if (ptr - fname) ptr++; /* append filename characters after filepath */ - while ((*lptr != '\"') && memcmp(lptr, " BINARY", 7) && memcmp(lptr, " WAVE", 5)) + while ((*lptr != '\"') && memcmp(lptr, " BINARY", 7) && memcmp(lptr, " WAV", 4)) { *ptr++ = *lptr++; } @@ -595,7 +621,7 @@ /* Simulate audio tracks if none found */ if (cdd.toc.last == 1) { - /* Some games require specific TOC infos */ + /* Some games require exact TOC infos */ if (strstr(header + 0x180,"T-95035") != NULL) { /* Snatcher */ @@ -622,6 +648,58 @@ } while (cdd.toc.last < 52); } + else if (strstr(header + 0x180,"T-113045") != NULL) + { + /* Shadow of the Beast II */ + cdd.toc.last = cdd.toc.end = 0; + do + { + cdd.toc.tracks[cdd.toc.last].start = cdd.toc.end; + cdd.toc.tracks[cdd.toc.last].end = cdd.toc.tracks[cdd.toc.last].start + toc_shadow[cdd.toc.last]; + cdd.toc.end = cdd.toc.tracks[cdd.toc.last].end; + cdd.toc.last++; + } + while (cdd.toc.last < 15); + } + else if (strstr(header + 0x180,"T-143025") != NULL) + { + /* Dungeon Explorer */ + cdd.toc.last = cdd.toc.end = 0; + do + { + cdd.toc.tracks[cdd.toc.last].start = cdd.toc.end; + cdd.toc.tracks[cdd.toc.last].end = cdd.toc.tracks[cdd.toc.last].start + toc_dungeon[cdd.toc.last]; + cdd.toc.end = cdd.toc.tracks[cdd.toc.last].end; + cdd.toc.last++; + } + while (cdd.toc.last < 13); + } + else if (strstr(header + 0x180,"MK-4410") != NULL) + { + /* Final Fight CD (USA, Europe) */ + cdd.toc.last = cdd.toc.end = 0; + do + { + cdd.toc.tracks[cdd.toc.last].start = cdd.toc.end; + cdd.toc.tracks[cdd.toc.last].end = cdd.toc.tracks[cdd.toc.last].start + toc_ffight[cdd.toc.last]; + cdd.toc.end = cdd.toc.tracks[cdd.toc.last].end; + cdd.toc.last++; + } + while (cdd.toc.last < 26); + } + else if (strstr(header + 0x180,"G-6013") != NULL) + { + /* Final Fight CD (Japan) */ + cdd.toc.last = cdd.toc.end = 0; + do + { + cdd.toc.tracks[cdd.toc.last].start = cdd.toc.end; + cdd.toc.tracks[cdd.toc.last].end = cdd.toc.tracks[cdd.toc.last].start + toc_ffightj[cdd.toc.last]; + cdd.toc.end = cdd.toc.tracks[cdd.toc.last].end; + cdd.toc.last++; + } + while (cdd.toc.last < 29); + } else { /* default TOC (99 tracks & 2s per audio tracks) */ @@ -636,6 +714,9 @@ } } + /* Lead-out */ + cdd.toc.tracks[cdd.toc.last].start = cdd.toc.end; + /* CD loaded */ cdd.loaded = 1; return 1; @@ -798,10 +879,24 @@ error("LBA = %d (track n°%d)\n", cdd.lba, cdd.index); #endif + /* seeking disc */ + if (cdd.status == CD_SEEK) + { + /* drive latency */ + if (cdd.latency > 0) + { + cdd.latency--; + return; + } + + /* drive is ready */ + cdd.status = CD_READY; + } + /* reading disc */ - if (cdd.status == CD_PLAY) + else if (cdd.status == CD_PLAY) { - /* drive access latency */ + /* drive latency */ if (cdd.latency > 0) { cdd.latency--; @@ -839,6 +934,7 @@ } else { + cdd.status = CD_END; return; } @@ -898,6 +994,10 @@ } else if (cdd.index >= cdd.toc.last) { + /* no AUDIO track playing */ + scd.regs[0x36>>1].byte.h = 0x01; + + /* end of disc */ cdd.index = cdd.toc.last; cdd.lba = cdd.toc.end; } @@ -905,10 +1005,16 @@ /* seek to current block */ if (!cdd.index) { + /* no AUDIO track playing */ + scd.regs[0x36>>1].byte.h = 0x01; + fseek(cdd.toc.tracks[0].fd, cdd.lba * cdd.sectorSize, SEEK_SET); } else if (cdd.toc.tracks[cdd.index].fd) { + /* AUDIO track playing */ + scd.regs[0x36>>1].byte.h = 0x00; + if (cdd.lba < cdd.toc.tracks[cdd.index].start) { fseek(cdd.toc.tracks[cdd.index].fd, (cdd.toc.tracks[cdd.index].start * 2352) - cdd.toc.tracks[cdd.index].offset, SEEK_SET); @@ -950,38 +1056,37 @@ case 0x02: /* Read TOC */ { /* Infos automatically retrieved by CDD processor from Q-Channel */ - /* commands 0x00-0x02: from current block Q-Channel data field */ - /* commands 0x03-0x05: from Lead-In area Q-Channel data field */ + /* commands 0x00-0x02 (current block) and 0x03-0x05 (Lead-In) */ switch (scd.regs[0x44>>1].byte.l) { - case 0x00: /* Absolute position (MM:SS:FF) */ + case 0x00: /* Current Absolute Time (MM:SS:FF) */ { int lba = cdd.lba + 150; scd.regs[0x38>>1].w = cdd.status << 8; scd.regs[0x3a>>1].w = lut_BCD_16[(lba/75)/60]; scd.regs[0x3c>>1].w = lut_BCD_16[(lba/75)%60]; scd.regs[0x3e>>1].w = lut_BCD_16[(lba%75)]; - scd.regs[0x40>>1].byte.h = 0x00; + scd.regs[0x40>>1].byte.h = cdd.index ? 0x00 : 0x04; /* Current block flags (bit0 = mute status, bit1: pre-emphasis status, bit2: track type) */ break; } - case 0x01: /* Track relative position (MM:SS:FF) */ + case 0x01: /* Current Track Relative Time (MM:SS:FF) */ { int lba = cdd.lba - cdd.toc.tracks[cdd.index].start; scd.regs[0x38>>1].w = (cdd.status << 8) | 0x01; scd.regs[0x3a>>1].w = lut_BCD_16[(lba/75)/60]; scd.regs[0x3c>>1].w = lut_BCD_16[(lba/75)%60]; scd.regs[0x3e>>1].w = lut_BCD_16[(lba%75)]; - scd.regs[0x40>>1].byte.h = 0x00; + scd.regs[0x40>>1].byte.h = cdd.index ? 0x00 : 0x04; /* Current block flags (bit0 = mute status, bit1: pre-emphasis status, bit2: track type) */ break; } - case 0x02: /* Current track */ + case 0x02: /* Current Track Number */ { scd.regs[0x38>>1].w = (cdd.status << 8) | 0x02; scd.regs[0x3a>>1].w = (cdd.index < cdd.toc.last) ? lut_BCD_16[cdd.index + 1] : 0x0A0A; scd.regs[0x3c>>1].w = 0x0000; - scd.regs[0x3e>>1].w = 0x0000; + scd.regs[0x3e>>1].w = 0x0000; /* Disk Control Code (?) in RS6 */ scd.regs[0x40>>1].byte.h = 0x00; break; } @@ -997,17 +1102,17 @@ break; } - case 0x04: /* Number of tracks */ + case 0x04: /* First & Last Track Numbers */ { scd.regs[0x38>>1].w = (cdd.status << 8) | 0x04; scd.regs[0x3a>>1].w = 0x0001; scd.regs[0x3c>>1].w = lut_BCD_16[cdd.toc.last]; - scd.regs[0x3e>>1].w = 0x0000; - scd.regs[0x40>>1].byte.h = 0x00; + scd.regs[0x3e>>1].w = 0x0000; /* Drive Version (?) in RS6-RS7 */ + scd.regs[0x40>>1].byte.h = 0x00; /* Lead-In flags (bit0 = mute status, bit1: pre-emphasis status, bit2: track type) */ break; } - case 0x05: /* Track start (MM:SS:FF) */ + case 0x05: /* Track Start Time (MM:SS:FF) */ { int track = scd.regs[0x46>>1].byte.h * 10 + scd.regs[0x46>>1].byte.l; int lba = cdd.toc.tracks[track-1].start + 150; @@ -1015,10 +1120,10 @@ scd.regs[0x3a>>1].w = lut_BCD_16[(lba/75)/60]; scd.regs[0x3c>>1].w = lut_BCD_16[(lba/75)%60]; scd.regs[0x3e>>1].w = lut_BCD_16[(lba%75)]; - scd.regs[0x40>>1].byte.h = track % 10; + scd.regs[0x40>>1].byte.h = track % 10; /* Track Number (low digit) */ if (track == 1) { - /* data track */ + /* RS6 bit 3 is set for the first (DATA) track */ scd.regs[0x3e>>1].byte.h |= 0x08; } break; @@ -1049,10 +1154,24 @@ if (!cdd.latency) { /* Fixes a few games hanging during intro because they expect data to be read with some delay */ + /* Radical Rex needs at least one interrupt delay */ /* Wolf Team games (Anet Futatabi, Cobra Command, Road Avenger & Time Gal) need at least 6 interrupts delay */ - /* Radical Rex need at least one interrupt delay */ - /* Jeopardy need at least 9 interrupts delay (without counting seek time delay below )*/ - cdd.latency = 9; + /* Space Adventure Cobra (2nd morgue scene) needs at least 13 interrupts delay (incl. seek time, so 6 here is OK) */ + /* Jeopardy & ESPN Sunday Night NFL are picky about this as well: 7 interrupts delay (+ seek time) seems OK */ + cdd.latency = 7; + } + + /* CD drive seek time */ + /* Some delay is especially needed when playing audio tracks located at the end of the disc (ex: Sonic CD intro) */ + /* max. seek time = 1.5s = 1.5 x 75 = 112.5 CDD interrupts (rounded to 120) for 270000 sectors max on disc */ + /* Note: this is only a rough approximation, on real hardware, drive seek time is much likely not linear */ + if (lba < cdd.lba) + { + cdd.latency += (((cdd.lba - lba) * 120) / 270000); + } + else + { + cdd.latency += (((lba - cdd.lba) * 120) / 270000); } /* update current track index */ @@ -1077,12 +1196,6 @@ } else if (cdd.toc.tracks[index].fd) { - /* CD drive seek time */ - /* Some delay is also needed when playing AUDIO tracks located at the end of the disc (ex: Sonic CD intro) */ - /* max. seek time = 1.5s = 1.5 x 75 = 112.5 CDD interrupts (rounded to 120) for 270000 sectors max on disc */ - /* Note: this is only a rough approximation, on real hardware, drive seek time is much likely not linear */ - cdd.latency += ((abs(lba - cdd.lba) * 120) / 270000); - /* seek AUDIO track */ if (lba < cdd.toc.tracks[index].start) { @@ -1117,7 +1230,17 @@ (scd.regs[0x46>>1].byte.h * 10 + scd.regs[0x46>>1].byte.l)) * 75 + (scd.regs[0x48>>1].byte.h * 10 + scd.regs[0x48>>1].byte.l) - 150; - /* update current LBA (TODO: add some delay ?) */ + /* CD drive seek time (required by Switch / Panic intro - see CD_PLAY command for details)*/ + if (lba < cdd.lba) + { + cdd.latency = (((cdd.lba - lba) * 120) / 270000); + } + else + { + cdd.latency = (((lba - cdd.lba) * 120) / 270000); + } + + /* update current LBA */ cdd.lba = lba; /* update current track index */ @@ -1141,8 +1264,8 @@ /* no audio track playing */ scd.regs[0x36>>1].byte.h = 0x01; - /* update status (TODO: figure what is returned in RS1-RS8) */ - cdd.status = CD_READY; + /* update status */ + cdd.status = CD_SEEK; scd.regs[0x38>>1].w = CD_SEEK << 8; scd.regs[0x3a>>1].w = 0x0000; scd.regs[0x3c>>1].w = 0x0000; @@ -1156,7 +1279,7 @@ /* no audio track playing */ scd.regs[0x36>>1].byte.h = 0x01; - /* update status (TODO: figure what is returned in RS1-RS8) */ + /* update status */ cdd.status = CD_READY; scd.regs[0x38>>1].w = CD_READY << 8; scd.regs[0x3a>>1].w = 0x0000; @@ -1183,7 +1306,7 @@ cdd.scanOffset = CD_SCAN_SPEED; cdd.status = CD_SCAN; scd.regs[0x38>>1].w = (CD_SCAN << 8) | 0x02; - scd.regs[0x3a>>1].w = lut_BCD_16[cdd.index+1]; + scd.regs[0x3a>>1].w = (cdd.index < cdd.toc.last) ? lut_BCD_16[cdd.index + 1] : 0x0A0A; scd.regs[0x3c>>1].w = 0x0000; scd.regs[0x3e>>1].w = 0x0000; scd.regs[0x40>>1].byte.h = 0x00; @@ -1195,7 +1318,7 @@ cdd.scanOffset = -CD_SCAN_SPEED; cdd.status = CD_SCAN; scd.regs[0x38>>1].w = (CD_SCAN << 8) | 0x02; - scd.regs[0x3a>>1].w = lut_BCD_16[cdd.index+1]; + scd.regs[0x3a>>1].w = (cdd.index < cdd.toc.last) ? lut_BCD_16[cdd.index + 1] : 0x0A0A; scd.regs[0x3c>>1].w = 0x0000; scd.regs[0x3e>>1].w = 0x0000; scd.regs[0x40>>1].byte.h = 0x00; @@ -1229,6 +1352,10 @@ scd.regs[0x3c>>1].w = 0x0000; scd.regs[0x3e>>1].w = 0x0000; scd.regs[0x40>>1].w = 0x000f; + +#ifdef CD_TRAY_CALLBACK + CD_TRAY_CALLBACK +#endif return; } @@ -1243,6 +1370,10 @@ scd.regs[0x3c>>1].w = 0x0000; scd.regs[0x3e>>1].w = 0x0000; scd.regs[0x40>>1].w = 0x0001; + +#ifdef CD_TRAY_CALLBACK + CD_TRAY_CALLBACK +#endif return; } diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/cd_hw/cdd.h libretro-genesisplusgx-0.6~filthypants4/source/cd_hw/cdd.h --- libretro-genesisplusgx-0.6~filthypants2/source/cd_hw/cdd.h 2012-10-17 20:00:51.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/cd_hw/cdd.h 2013-04-29 16:28:55.000000000 +0000 @@ -50,9 +50,10 @@ #define CD_READY 0x04 #define CD_OPEN 0x05 #define CD_STOP 0x09 +#define CD_END 0x0C /* CD blocks scanning speed */ -#define CD_SCAN_SPEED 10 +#define CD_SCAN_SPEED 30 #define CD_MAX_TRACKS 100 diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/cd_hw/pcm.c libretro-genesisplusgx-0.6~filthypants4/source/cd_hw/pcm.c --- libretro-genesisplusgx-0.6~filthypants2/source/cd_hw/pcm.c 2012-10-17 20:00:51.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/cd_hw/pcm.c 2013-04-29 16:28:55.000000000 +0000 @@ -64,6 +64,16 @@ /* reset default bank */ pcm.bank = pcm.ram; + /* reset channels stereo panning */ + pcm.chan[0].pan = 0xff; + pcm.chan[1].pan = 0xff; + pcm.chan[2].pan = 0xff; + pcm.chan[3].pan = 0xff; + pcm.chan[4].pan = 0xff; + pcm.chan[5].pan = 0xff; + pcm.chan[6].pan = 0xff; + pcm.chan[7].pan = 0xff; + /* reset master clocks counter */ pcm.cycles = 0; @@ -77,15 +87,15 @@ uint8 tmp8; int bufferptr = 0; - tmp8 = (scd.pcm_hw.bank - scd.pcm_hw.ram) >> 12; + tmp8 = (pcm.bank - pcm.ram) >> 12; - save_param(scd.pcm_hw.chan, sizeof(scd.pcm_hw.chan)); - save_param(scd.pcm_hw.out, sizeof(scd.pcm_hw.out)); + save_param(pcm.chan, sizeof(pcm.chan)); + save_param(pcm.out, sizeof(pcm.out)); save_param(&tmp8, 1); - save_param(&scd.pcm_hw.enabled, sizeof(scd.pcm_hw.enabled)); - save_param(&scd.pcm_hw.status, sizeof(scd.pcm_hw.status)); - save_param(&scd.pcm_hw.index, sizeof(scd.pcm_hw.index)); - save_param(scd.pcm_hw.ram, sizeof(scd.pcm_hw.ram)); + save_param(&pcm.enabled, sizeof(pcm.enabled)); + save_param(&pcm.status, sizeof(pcm.status)); + save_param(&pcm.index, sizeof(pcm.index)); + save_param(pcm.ram, sizeof(pcm.ram)); return bufferptr; } @@ -95,16 +105,16 @@ uint8 tmp8; int bufferptr = 0; - load_param(scd.pcm_hw.chan, sizeof(scd.pcm_hw.chan)); - load_param(scd.pcm_hw.out, sizeof(scd.pcm_hw.out)); + load_param(pcm.chan, sizeof(pcm.chan)); + load_param(pcm.out, sizeof(pcm.out)); load_param(&tmp8, 1); - scd.pcm_hw.bank = &scd.pcm_hw.ram[(tmp8 & 0x0f) << 12]; + pcm.bank = &pcm.ram[(tmp8 & 0x0f) << 12]; - load_param(&scd.pcm_hw.enabled, sizeof(scd.pcm_hw.enabled)); - load_param(&scd.pcm_hw.status, sizeof(scd.pcm_hw.status)); - load_param(&scd.pcm_hw.index, sizeof(scd.pcm_hw.index)); - load_param(scd.pcm_hw.ram, sizeof(scd.pcm_hw.ram)); + load_param(&pcm.enabled, sizeof(pcm.enabled)); + load_param(&pcm.status, sizeof(pcm.status)); + load_param(&pcm.index, sizeof(pcm.index)); + load_param(pcm.ram, sizeof(pcm.ram)); return bufferptr; } @@ -209,7 +219,7 @@ } } - /* end of blib buffer frame */ + /* end of blip buffer frame */ blip_end_frame(blip[0], length); blip_end_frame(blip[1], length); diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/cd_hw/scd.c libretro-genesisplusgx-0.6~filthypants4/source/cd_hw/scd.c --- libretro-genesisplusgx-0.6~filthypants2/source/cd_hw/scd.c 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/cd_hw/scd.c 2013-04-29 16:28:55.000000000 +0000 @@ -2,7 +2,7 @@ * Genesis Plus * Mega CD / Sega CD hardware * - * Copyright (C) 2012 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2012-2013 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: @@ -92,6 +92,12 @@ /* update DMA source address */ cdc.dac.w += (words << 1); + /* check PRG-RAM write protected area */ + if (dst_index < (scd.regs[0x02>>1].byte.h << 9)) + { + return; + } + /* DMA transfer */ while (words--) { @@ -180,7 +186,7 @@ /* PCM chip & Gate-Array area */ /*--------------------------------------------------------------------------*/ -INLINE void s68k_poll_detect(reg) +static void s68k_poll_detect(reg) { /* detect SUB-CPU register polling */ if (s68k.poll.detected == (1 << reg)) @@ -206,11 +212,11 @@ } /* restart SUB-CPU polling detection */ - s68k.poll.cycle = s68k.cycles + 320; + s68k.poll.cycle = s68k.cycles + 392; s68k.poll.pc = s68k.pc; } -INLINE void s68k_poll_sync(reg) +static void s68k_poll_sync(reg) { /* relative MAIN-CPU cycle counter */ unsigned int cycles = (s68k.cycles * MCYCLES_PER_LINE) / SCYCLES_PER_LINE; @@ -285,7 +291,7 @@ if (address == 0xff8000) { /* register $00 is reserved for MAIN-CPU, we use $06 instead */ - return scd.regs[0x06 >> 1].byte.h; + return scd.regs[0x06>>1].byte.h; } /* RESET status */ @@ -299,10 +305,10 @@ if ((address >= 0xff8050) && (address <= 0xff8056)) { /* shifted 4-bit input (xxxx00) */ - uint8 bits = (scd.regs[0x4e >> 1].w >> (((address & 6) ^ 6) << 1)) << 2; + uint8 bits = (scd.regs[0x4e>>1].w >> (((address & 6) ^ 6) << 1)) << 2; /* color code */ - uint8 code = scd.regs[0x4c >> 1].byte.l; + uint8 code = scd.regs[0x4c>>1].byte.l; /* 16-bit font data (4 pixels = 16 bits) */ uint16 data = (code >> (bits & 4)) & 0x0f; @@ -320,7 +326,7 @@ } /* MAIN-CPU communication words */ - if ((address & 0xf0) == 0x10) + if ((address & 0x1f0) == 0x10) { s68k_poll_detect(address & 0x1f); } @@ -366,17 +372,24 @@ if (address == 0xff8000) { /* register $00 is reserved for MAIN-CPU, we use $06 instead */ - return scd.regs[0x06 >> 1].w; + return scd.regs[0x06>>1].w; + } + + /* Stopwatch counter (word access only ?) */ + if (address == 0xff800c) + { + /* cycle-accurate counter value */ + return (scd.regs[0x0c>>1].w + ((s68k.cycles - scd.stopwatch) / TIMERS_SCYCLES_RATIO)) & 0xfff; } /* Font data */ if ((address >= 0xff8050) && (address <= 0xff8056)) { /* shifted 4-bit input (xxxx00) */ - uint8 bits = (scd.regs[0x4e >> 1].w >> (((address & 6) ^ 6) << 1)) << 2; + uint8 bits = (scd.regs[0x4e>>1].w >> (((address & 6) ^ 6) << 1)) << 2; /* color code */ - uint8 code = scd.regs[0x4c >> 1].byte.l; + uint8 code = scd.regs[0x4c>>1].byte.l; /* 16-bit font data (4 pixels = 16 bits) */ uint16 data = (code >> (bits & 4)) & 0x0f; @@ -394,12 +407,12 @@ } /* MAIN-CPU communication words */ - if ((address & 0xf0) == 0x10) + if ((address & 0x1f0) == 0x10) { /* relative MAIN-CPU cycle counter */ unsigned int cycles = (s68k.cycles * MCYCLES_PER_LINE) / SCYCLES_PER_LINE; - /* sync MAIN-CPU with SUB-CPU */ + /* sync MAIN-CPU with SUB-CPU (Mighty Morphin Power Rangers) */ if (!m68k.stopped && (m68k.cycles < cycles)) { m68k_run(cycles); @@ -656,7 +669,7 @@ } /* update PM0-1 & MODE bits */ - scd.regs[0x02 >> 1].byte.l = (scd.regs[0x01].byte.l & ~0x1c) | (data & 0x1c); + scd.regs[0x02 >> 1].byte.l = (scd.regs[0x02 >> 1].byte.l & ~0x1c) | (data & 0x1c); return; } @@ -682,7 +695,7 @@ case 0x31: /* Timer */ { /* reload timer (one timer clock = 384 CPU cycles) */ - scd.timer = data * 384 * 4; + scd.timer = data * TIMERS_SCYCLES_RATIO; /* only non-zero data starts timer, writing zero stops it */ if (data) @@ -939,8 +952,12 @@ return; } - case 0x0c: /* Stopwatch */ + case 0x0c: /* Stopwatch (word access only) */ { + /* synchronize the counter with SUB-CPU */ + int ticks = (s68k.cycles - scd.stopwatch) / TIMERS_SCYCLES_RATIO; + scd.stopwatch += (ticks * TIMERS_SCYCLES_RATIO); + /* any writes clear the counter */ scd.regs[0x0c>>1].w = 0; return; @@ -961,7 +978,7 @@ data &= 0xff; /* reload timer (one timer clock = 384 CPU cycles) */ - scd.timer = data * 384 * 4; + scd.timer = data * TIMERS_SCYCLES_RATIO; /* only non-zero data starts timer, writing zero stops it */ if (data) @@ -1045,7 +1062,7 @@ { if (i & 2) { - /* PRG-RAM (first 128KB bank, mirrored ?) */ + /* $020000-$03FFFF (resp. $420000-$43FFFF): PRG-RAM (first 128KB bank, mirrored each 256KB) */ m68k.memory_map[i].base = scd.prg_ram + ((i & 1) << 16); m68k.memory_map[i].read8 = NULL; m68k.memory_map[i].read16 = NULL; @@ -1057,7 +1074,8 @@ } else { - /* internal ROM (128KB mirrored) (Flux expects it to be mapped at $440000-$45FFFF) */ + /* $000000-$01FFFF (resp. $400000-$41FFFF): internal ROM (128KB, mirrored each 256KB) */ + /* NB: Flux expects it to be mapped at $440000-$45FFFF */ m68k.memory_map[i].base = scd.bootrom + ((i & 1) << 16); m68k.memory_map[i].read8 = NULL; m68k.memory_map[i].read16 = NULL; @@ -1068,8 +1086,8 @@ } } - /* $200000-$23FFFF (resp. $600000-$63FFFF): Word-RAM in 2M mode (256KB) */ - for (i=base+0x20; i>1].byte.l = 0x01; - /* Reset TIMER counter */ + /* Reset Timer & Stopwatch counters */ scd.timer = 0; + scd.stopwatch = 0; /* Reset frame cycle counter */ scd.cycles = 0; @@ -1266,9 +1282,6 @@ } } - /* Stop Watch (TODO: improve timing accuracy, one unit = 384 CPU cycles) */ - scd.regs[0x0c>>1].w = (scd.regs[0x0c>>1].w + 2) & 0xfff; - /* Timer */ if (scd.timer) { @@ -1277,7 +1290,7 @@ if (scd.timer <= 0) { /* reload timer (one timer clock = 384 CPU cycles) */ - scd.timer += (scd.regs[0x30>>1].byte.l * 384 * 4); + scd.timer += (scd.regs[0x30>>1].byte.l * TIMERS_SCYCLES_RATIO); /* level 3 interrupt enabled ? */ if (scd.regs[0x32>>1].byte.l & 0x08) @@ -1299,6 +1312,24 @@ } } +void scd_end_frame(unsigned int cycles) +{ + /* run Stopwatch until end of frame */ + int ticks = (cycles - scd.stopwatch) / TIMERS_SCYCLES_RATIO; + scd.regs[0x0c>>1].w = (scd.regs[0x0c>>1].w + ticks) & 0xfff; + + /* adjust Stopwatch counter for next frame (can be negative) */ + scd.stopwatch += (ticks * TIMERS_SCYCLES_RATIO) - cycles; + + /* adjust SUB-CPU & GPU cycle counters for next frame */ + s68k.cycles -= cycles; + gfx.cycles -= cycles; + + /* reset CPU registers polling */ + m68k.poll.cycle = 0; + s68k.poll.cycle = 0; +} + int scd_context_save(uint8 *state) { uint16 tmp16; diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/cd_hw/scd.h libretro-genesisplusgx-0.6~filthypants4/source/cd_hw/scd.h --- libretro-genesisplusgx-0.6~filthypants2/source/cd_hw/scd.h 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/cd_hw/scd.h 2013-04-29 16:28:55.000000000 +0000 @@ -2,7 +2,7 @@ * Genesis Plus * Mega CD / Sega CD hardware * - * Copyright (C) 2012 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2012-2013 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: @@ -46,11 +46,15 @@ #define scd ext.cd_hw -/* 5000000 clocks/s = approx. 3184 clocks/line with a master clock of 53.693175 Mhz */ -/* TODO: use emulated master clock as reference ? */ +/* 5000000 SCD clocks/s = ~3184 clocks/line with a Master Clock of 53.693175 MHz */ +/* This would be slightly (~30 clocks) more on PAL systems because of the slower */ +/* Master Clock (53.203424 MHz) but not enough to really care about since clocks */ +/* are not running in sync anyway. */ #define SCD_CLOCK 50000000 #define SCYCLES_PER_LINE 3184 +/* Timer & Stopwatch clocks divider */ +#define TIMERS_SCYCLES_RATIO (384 * 4) /* CD hardware */ typedef struct @@ -63,6 +67,7 @@ uint8 bram[0x2000]; /* 8K Backup RAM */ reg16_t regs[0x100]; /* 256 x 16-bit ASIC registers */ uint32 cycles; /* Master clock counter */ + int32 stopwatch; /* Stopwatch counter */ int32 timer; /* Timer counter */ uint8 pending; /* Pending interrupts */ uint8 dmna; /* Pending DMNA write status */ @@ -76,6 +81,7 @@ extern void scd_init(void); extern void scd_reset(int hard); extern void scd_update(unsigned int cycles); +extern void scd_end_frame(unsigned int cycles); extern int scd_context_load(uint8 *state); extern int scd_context_save(uint8 *state); extern int scd_68k_irq_ack(int level); diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/genesis.c libretro-genesisplusgx-0.6~filthypants4/source/genesis.c --- libretro-genesisplusgx-0.6~filthypants2/source/genesis.c 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/genesis.c 2013-04-29 16:28:55.000000000 +0000 @@ -5,7 +5,7 @@ * Support for SG-1000, Mark-III, Master System, Game Gear, Mega Drive & Mega CD hardware * * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code) - * Copyright (C) 2007-2012 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: @@ -67,6 +67,7 @@ { /* initialize main 68k */ m68k_init(); + m68k.aerr_enabled = config.addr_error; /* initialize main 68k memory map */ @@ -327,8 +328,33 @@ /* reset Z80 */ z80_reset(); -} + /* some Z80 registers need to be initialized on Power ON */ + if (hard_reset) + { + /* Power Base Converter specific */ + if (system_hw == SYSTEM_PBC) + { + /* startup code logic (verified on real hardware): */ + /* 21 01 E1 : LD HL, $E101 + 25 -- -- : DEC H + F9 -- -- : LD SP,HL + C7 -- -- : RST $00 + 01 01 -- : LD BC, $xx01 + */ + Z80.hl.w.l = 0xE001; + Z80.sp.w.l = 0xDFFF; + Z80.r = 4; + } + + /* Master System specific (when BIOS is disabled) */ + else if ((system_hw & SYSTEM_SMS) && (!(config.bios & 1) || !(system_bios & SYSTEM_SMS))) + { + /* usually done by BIOS & required by some SMS games that don't initialize SP */ + Z80.sp.w.l = 0xDFFF; + } + } +} /*-----------------------------------------------------------------------*/ /* OS ROM / TMSS register control functions (Genesis mode) */ diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/genesis.h libretro-genesisplusgx-0.6~filthypants4/source/genesis.h --- libretro-genesisplusgx-0.6~filthypants2/source/genesis.h 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/genesis.h 2013-04-29 16:28:55.000000000 +0000 @@ -5,7 +5,7 @@ * Support for SG-1000, Mark-III, Master System, Game Gear, Mega Drive & Mega CD hardware * * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code) - * Copyright (C) 2007-2012 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/gx/config.c libretro-genesisplusgx-0.6~filthypants4/source/gx/config.c --- libretro-genesisplusgx-0.6~filthypants2/source/gx/config.c 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/gx/config.c 2013-04-29 16:28:55.000000000 +0000 @@ -167,7 +167,9 @@ config.gun_cursor[0] = 1; config.gun_cursor[1] = 1; config.invert_mouse = 0; - gx_input_SetDefault(); + + /* on-screen options */ + config.cd_leds = 0; /* menu options */ config.autoload = 0; @@ -219,9 +221,6 @@ /* try to restore user config */ int loaded = config_load(); - /* restore inputs */ - input_init(); - #ifndef HW_RVL /* detect progressive mode enable/disable requests */ PAD_ScanPads(); @@ -251,5 +250,11 @@ if (!loaded) { GUI_WaitPrompt("Warning","Default Settings restored"); + gx_input_SetDefault(); } + + /* default emulated inputs */ + input.system[0] = SYSTEM_MD_GAMEPAD; + input.system[1] = (config.input[1].device != -1) ? SYSTEM_MD_GAMEPAD : NO_SYSTEM; + input_init(); } diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/gx/config.h libretro-genesisplusgx-0.6~filthypants4/source/gx/config.h --- libretro-genesisplusgx-0.6~filthypants2/source/gx/config.h 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/gx/config.h 2013-04-29 16:28:55.000000000 +0000 @@ -40,7 +40,7 @@ #ifndef _CONFIG_H_ #define _CONFIG_H_ -#define CONFIG_VERSION "GENPLUS-GX 1.7.1" +#define CONFIG_VERSION "GENPLUS-GX 1.7.2" /**************************************************************************** * Config Option @@ -104,6 +104,7 @@ uint8 s_device; uint8 l_device; uint8 bg_overlay; + uint8 cd_leds; int16 screen_w; float bgm_volume; float sfx_volume; diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/gx/fileio/file_load.c libretro-genesisplusgx-0.6~filthypants4/source/gx/fileio/file_load.c --- libretro-genesisplusgx-0.6~filthypants2/source/gx/fileio/file_load.c 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/gx/fileio/file_load.c 2013-04-29 16:28:55.000000000 +0000 @@ -246,7 +246,7 @@ ****************************************************************************/ int LoadFile(int selection) { - int size = 0, filetype; + int size, cd_mode1, filetype; char filename[MAXPATHLEN]; /* file path */ @@ -270,15 +270,24 @@ /* open message box */ GUI_MsgBoxOpen("Information", "Loading game...", 1); + /* no cartridge or CD game loaded */ + size = cd_mode1 = 0; + /* check if virtual CD tray was open */ if ((system_hw == SYSTEM_MCD) && (cdd.status == CD_OPEN)) { - /* swap CD image file */ + /* swap CD image file in (without changing region, system,...) */ size = cdd_load(filename, (char *)(cdc.ram)); - /* update CD header informations */ - if (!scd.cartridge.boot) + /* check if a cartridge is currently loaded */ + if (scd.cartridge.boot) + { + /* CD Mode 1 */ + cd_mode1 = size; + } + else { + /* update game informations from CD image file header */ getrominfo((char *)(cdc.ram)); } } @@ -287,7 +296,7 @@ if (!size) { /* close CD tray to force system reset */ - cdd.status = CD_STOP; + cdd.status = NO_DISC; /* load game file */ size = load_rom(filename); @@ -295,45 +304,54 @@ if (size > 0) { - /* auto-save previous game state */ - slot_autosave(config.s_default,config.s_device); - - /* update pathname for screenshot, save & cheat files */ - if (romtype & SYSTEM_SMS) - { - /* Master System ROM file */ - filetype = 2; - sprintf(rom_filename,"ms/%s",filelist[selection].filename); - } - else if (romtype & SYSTEM_GG) + /* do not update game basename if a CD was loaded with a cartridge (Mode 1) */ + if (cd_mode1) { - /* Game Gear ROM file */ - filetype = 3; - sprintf(rom_filename,"gg/%s",filelist[selection].filename); - } - else if (romtype == SYSTEM_SG) - { - /* SG-1000 ROM file */ - filetype = 4; - sprintf(rom_filename,"sg/%s",filelist[selection].filename); - } - else if (romtype == SYSTEM_MCD) - { - /* CD image file */ + /* add CD image file to history list */ filetype = 1; - sprintf(rom_filename,"cd/%s",filelist[selection].filename); } else { - /* by default, Genesis ROM file */ - filetype = 0; - sprintf(rom_filename,"md/%s",filelist[selection].filename); - } + /* auto-save previous game state */ + slot_autosave(config.s_default,config.s_device); - /* remove file extension */ - int i = strlen(rom_filename) - 1; - while ((i > 0) && (rom_filename[i] != '.')) i--; - if (i > 0) rom_filename[i] = 0; + /* update game basename (for screenshot, save & cheat files) */ + if (romtype & SYSTEM_SMS) + { + /* Master System ROM file */ + filetype = 2; + sprintf(rom_filename,"ms/%s",filelist[selection].filename); + } + else if (romtype & SYSTEM_GG) + { + /* Game Gear ROM file */ + filetype = 3; + sprintf(rom_filename,"gg/%s",filelist[selection].filename); + } + else if (romtype == SYSTEM_SG) + { + /* SG-1000 ROM file */ + filetype = 4; + sprintf(rom_filename,"sg/%s",filelist[selection].filename); + } + else if (romtype == SYSTEM_MCD) + { + /* CD image file */ + filetype = 1; + sprintf(rom_filename,"cd/%s",filelist[selection].filename); + } + else + { + /* by default, Genesis ROM file */ + filetype = 0; + sprintf(rom_filename,"md/%s",filelist[selection].filename); + } + + /* remove file extension */ + int i = strlen(rom_filename) - 1; + while ((i > 0) && (rom_filename[i] != '.')) i--; + if (i > 0) rom_filename[i] = 0; + } /* add/move the file to the top of the history. */ history_add_file(filepath, filelist[selection].filename, filetype); diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/gx/gui/menu.c libretro-genesisplusgx-0.6~filthypants4/source/gx/gui/menu.c --- libretro-genesisplusgx-0.6~filthypants2/source/gx/gui/menu.c 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/gx/gui/menu.c 2013-04-29 16:28:55.000000000 +0000 @@ -387,7 +387,7 @@ }; /* Menu options */ -static gui_item items_prefs[9] = +static gui_item items_prefs[10] = { {NULL,NULL,"Auto ROM Load: OFF", "Enable/Disable automatic ROM loading on startup", 56,132,276,48}, {NULL,NULL,"Auto Cheats: OFF", "Enable/Disable automatic cheats activation", 56,132,276,48}, @@ -398,6 +398,7 @@ {NULL,NULL,"BGM Volume: 100", "Adjust background music volume", 56,132,276,48}, {NULL,NULL,"BG Overlay: ON", "Enable/disable background overlay", 56,132,276,48}, {NULL,NULL,"Screen Width: 658", "Adjust menu screen width in pixels", 56,132,276,48}, + {NULL,NULL,"Show CD Leds: OFF", "Enable/Disable CD leds display", 56,132,276,48}, }; /* Save Manager */ @@ -606,7 +607,7 @@ { "Menu Settings", 0,0, - 9,4,6,0, + 10,4,6,0, items_prefs, buttons_list, bg_list, @@ -673,6 +674,7 @@ sprintf (items[6].text, "BGM Volume: %1.1f", config.bgm_volume); sprintf (items[7].text, "BG Overlay: %s", config.bg_overlay ? "ON":"OFF"); sprintf (items[8].text, "Screen Width: %d", config.screen_w); + sprintf (items[9].text, "Show CD Leds: %s", config.cd_leds ? "ON":"OFF"); GUI_InitMenu(m); GUI_SlideMenuTitle(m,strlen("Menu ")); @@ -757,6 +759,11 @@ sprintf (items[8].text, "Screen Width: %d", config.screen_w); break; + case 9: /*** CD LEDS ***/ + config.cd_leds ^= 1; + sprintf (items[9].text, "Show CD Leds: %s", config.cd_leds ? "ON":"OFF"); + break; + case -1: quit = 1; break; @@ -3300,7 +3307,7 @@ }; /* autodetect loader stub */ - bool stub = FALSE; + int maxitems = 2; u32 *sig = (u32*)0x80001800; void (*reload)() = (void(*)())0x80001800; @@ -3309,10 +3316,12 @@ #else if (sig[0] == 0x7c6000a6) // SDLOAD #endif - stub = TRUE; + { + maxitems = 3; + } /* display option window */ - switch (GUI_OptionWindow(&menu_main, VERSION, items, stub ? 3:2)) + switch (GUI_OptionWindow(&menu_main, osd_version, items, maxitems)) { case 0: /* credits */ GUI_DeleteMenu(&menu_main); diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/gx/gx_input.c libretro-genesisplusgx-0.6~filthypants4/source/gx/gx_input.c --- libretro-genesisplusgx-0.6~filthypants2/source/gx/gx_input.c 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/gx/gx_input.c 2013-04-29 16:28:55.000000000 +0000 @@ -1257,13 +1257,12 @@ } #ifdef HW_RVL - /* Autodetect Wii Controllers */ - VIDEO_WaitVSync(); + /* autodetect connected Wii Controllers */ for (i=0; i<4; i++) { - /* try to autodetect connected controller */ exp = 255; WPAD_Probe(i, &exp); + if (exp == WPAD_EXP_CLASSIC) { /* use Classic Controller */ @@ -1276,7 +1275,7 @@ config.input[i].device = 2; config.input[i].port = i; } - else if (exp <= EXP_MOTION_PLUS) + else if (exp != 255) { /* use Wiimote by default */ config.input[i].device = 1; @@ -1319,10 +1318,6 @@ } } } - - /* default emulated inputs */ - input.system[0] = SYSTEM_MD_GAMEPAD; - input.system[1] = (config.input[1].device != -1) ? SYSTEM_MD_GAMEPAD : NO_SYSTEM; } void gx_input_Config(u8 chan, u8 device, u8 type) diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/gx/gx_video.c libretro-genesisplusgx-0.6~filthypants4/source/gx/gx_video.c --- libretro-genesisplusgx-0.6~filthypants2/source/gx/gx_video.c 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/gx/gx_video.c 2013-04-29 16:28:55.000000000 +0000 @@ -61,6 +61,10 @@ extern const u8 Crosshair_p1_png[]; extern const u8 Crosshair_p2_png[]; +extern const u8 CD_access_off_png[]; +extern const u8 CD_access_on_png[]; +extern const u8 CD_ready_off_png[]; +extern const u8 CD_ready_on_png[]; /*** VI ***/ GXRModeObj *vmode; /* Default Video Mode */ @@ -80,6 +84,7 @@ /*** GX Textures ***/ static u32 vwidth,vheight; static gx_texture *crosshair[2]; +static gx_texture *cd_leds[2][2]; /*** Framebuffers ***/ static u32 *xfb[2]; @@ -657,56 +662,134 @@ static void gxDrawCrosshair(gx_texture *texture, int x, int y) { - if (texture->data) - { - /* load texture object */ - GXTexObj texObj; - GX_InitTexObj(&texObj, texture->data, texture->width, texture->height, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE); - GX_InitTexObjLOD(&texObj,GX_LINEAR,GX_LIN_MIP_LIN,0.0,10.0,0.0,GX_FALSE,GX_TRUE,GX_ANISO_4); - GX_LoadTexObj(&texObj, GX_TEXMAP0); - GX_InvalidateTexAll(); + /* adjust texture dimensions to XFB->VI scaling */ + int w = (texture->width * rmode->fbWidth) / (rmode->viWidth); + int h = (texture->height * rmode->efbHeight) / (rmode->viHeight); + + /* EFB scale & shift */ + int xwidth = square[3] - square[9]; + int ywidth = square[4] - square[10]; + + /* adjust texture coordinates to EFB */ + x = (((x + bitmap.viewport.x) * xwidth) / vwidth) + square[9] - w/2; + y = (((y + bitmap.viewport.y) * ywidth) / vheight) + square[10] - h/2; - /* reset GX rendering */ - gxResetRendering(1); + /* reset GX rendering */ + gxResetRendering(1); - /* adjust texture dimensions to XFB->VI scaling */ - int w = (texture->width * rmode->fbWidth) / (rmode->viWidth); - int h = (texture->height * rmode->efbHeight) / (rmode->viHeight); - - /* adjust texture coordinates to EFB */ - int fb_w = square[3] - square[9]; - int fb_h = square[4] - square[10]; - x = (((x + bitmap.viewport.x) * fb_w) / (bitmap.viewport.w + 2*bitmap.viewport.x)) - w/2 - (fb_w/2); - y = (((y + bitmap.viewport.y) * fb_h) / (bitmap.viewport.h + 2*bitmap.viewport.y)) - h/2 - (fb_h/2); + /* load texture object */ + GXTexObj texObj; + GX_InitTexObj(&texObj, texture->data, texture->width, texture->height, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE); + GX_InitTexObjLOD(&texObj,GX_LINEAR,GX_LIN_MIP_LIN,0.0,10.0,0.0,GX_FALSE,GX_TRUE,GX_ANISO_4); + GX_LoadTexObj(&texObj, GX_TEXMAP0); + GX_InvalidateTexAll(); - /* Draw textured quad */ - GX_Begin(GX_QUADS, GX_VTXFMT0, 4); - GX_Position2s16(x,y+h); - GX_Color4u8(0xff,0xff,0xff,0xff); - GX_TexCoord2f32(0.0, 1.0); - GX_Position2s16(x+w,y+h); - GX_Color4u8(0xff,0xff,0xff,0xff); - GX_TexCoord2f32(1.0, 1.0); - GX_Position2s16(x+w,y); - GX_Color4u8(0xff,0xff,0xff,0xff); - GX_TexCoord2f32(1.0, 0.0); - GX_Position2s16(x,y); - GX_Color4u8(0xff,0xff,0xff,0xff); - GX_TexCoord2f32(0.0, 0.0); - GX_End(); + /* Draw textured quad */ + GX_Begin(GX_QUADS, GX_VTXFMT0, 4); + GX_Position2s16(x,y+h); + GX_Color4u8(0xff,0xff,0xff,0xff); + GX_TexCoord2f32(0.0, 1.0); + GX_Position2s16(x+w,y+h); + GX_Color4u8(0xff,0xff,0xff,0xff); + GX_TexCoord2f32(1.0, 1.0); + GX_Position2s16(x+w,y); + GX_Color4u8(0xff,0xff,0xff,0xff); + GX_TexCoord2f32(1.0, 0.0); + GX_Position2s16(x,y); + GX_Color4u8(0xff,0xff,0xff,0xff); + GX_TexCoord2f32(0.0, 0.0); + GX_End(); - /* restore GX rendering */ - gxResetRendering(0); + /* restore GX rendering */ + gxResetRendering(0); - /* restore texture object */ - GXTexObj texobj; - GX_InitTexObj(&texobj, texturemem, vwidth, vheight, GX_TF_RGB565, GX_CLAMP, GX_CLAMP, GX_FALSE); - if (!config.bilinear) GX_InitTexObjLOD(&texobj,GX_NEAR,GX_NEAR_MIP_NEAR,0.0,10.0,0.0,GX_FALSE,GX_FALSE,GX_ANISO_1); - GX_LoadTexObj(&texobj, GX_TEXMAP0); - GX_InvalidateTexAll(); + /* restore texture object */ + GXTexObj texobj; + GX_InitTexObj(&texobj, texturemem, vwidth, vheight, GX_TF_RGB565, GX_CLAMP, GX_CLAMP, GX_FALSE); + if (!config.bilinear) + { + GX_InitTexObjLOD(&texobj,GX_NEAR,GX_NEAR_MIP_NEAR,0.0,10.0,0.0,GX_FALSE,GX_FALSE,GX_ANISO_1); } + GX_LoadTexObj(&texobj, GX_TEXMAP0); + GX_InvalidateTexAll(); } +static void gxDrawCdLeds(gx_texture *texture_l, gx_texture *texture_r) +{ + /* adjust texture dimensions to XFB->VI scaling */ + int w = (texture_l->width * rmode->fbWidth) / (rmode->viWidth); + int h = (texture_r->height * rmode->efbHeight) / (rmode->viHeight); + + /* EFB scale & shift */ + int xwidth = square[3] - square[9]; + int ywidth = square[4] - square[10]; + + /* adjust texture coordinates to EFB */ + int xl = (((bitmap.viewport.x + 4) * xwidth) / (bitmap.viewport.w + 2*bitmap.viewport.x)) + square[9]; + int xr = xwidth - xl + 2*square[9] - w; + int y = (((bitmap.viewport.y + bitmap.viewport.h - 4) * ywidth) / vheight) + square[10] - h; + + /* reset GX rendering */ + gxResetRendering(1); + + /* load left screen texture */ + GXTexObj texObj; + GX_InitTexObj(&texObj, texture_l->data, texture_l->width, texture_l->height, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE); + GX_InitTexObjLOD(&texObj,GX_LINEAR,GX_LIN_MIP_LIN,0.0,10.0,0.0,GX_FALSE,GX_TRUE,GX_ANISO_4); + GX_LoadTexObj(&texObj, GX_TEXMAP0); + GX_InvalidateTexAll(); + + /* Draw textured quad */ + GX_Begin(GX_QUADS, GX_VTXFMT0, 4); + GX_Position2s16(xl,y+h); + GX_Color4u8(0xff,0xff,0xff,0xff); + GX_TexCoord2f32(0.0, 1.0); + GX_Position2s16(xl+w,y+h); + GX_Color4u8(0xff,0xff,0xff,0xff); + GX_TexCoord2f32(1.0, 1.0); + GX_Position2s16(xl+w,y); + GX_Color4u8(0xff,0xff,0xff,0xff); + GX_TexCoord2f32(1.0, 0.0); + GX_Position2s16(xl,y); + GX_Color4u8(0xff,0xff,0xff,0xff); + GX_TexCoord2f32(0.0, 0.0); + GX_End(); + + /* load right screen texture */ + GX_InitTexObj(&texObj, texture_r->data, texture_r->width, texture_r->height, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE); + GX_InitTexObjLOD(&texObj,GX_LINEAR,GX_LIN_MIP_LIN,0.0,10.0,0.0,GX_FALSE,GX_TRUE,GX_ANISO_4); + GX_LoadTexObj(&texObj, GX_TEXMAP0); + GX_InvalidateTexAll(); + + /* Draw textured quad */ + GX_Begin(GX_QUADS, GX_VTXFMT0, 4); + GX_Position2s16(xr,y+h); + GX_Color4u8(0xff,0xff,0xff,0xff); + GX_TexCoord2f32(0.0, 1.0); + GX_Position2s16(xr+w,y+h); + GX_Color4u8(0xff,0xff,0xff,0xff); + GX_TexCoord2f32(1.0, 1.0); + GX_Position2s16(xr+w,y); + GX_Color4u8(0xff,0xff,0xff,0xff); + GX_TexCoord2f32(1.0, 0.0); + GX_Position2s16(xr,y); + GX_Color4u8(0xff,0xff,0xff,0xff); + GX_TexCoord2f32(0.0, 0.0); + GX_End(); + + /* restore GX rendering */ + gxResetRendering(0); + + /* restore texture object */ + GXTexObj texobj; + GX_InitTexObj(&texobj, texturemem, vwidth, vheight, GX_TF_RGB565, GX_CLAMP, GX_CLAMP, GX_FALSE); + if (!config.bilinear) + { + GX_InitTexObjLOD(&texobj,GX_NEAR,GX_NEAR_MIP_NEAR,0.0,10.0,0.0,GX_FALSE,GX_FALSE,GX_ANISO_1); + } + GX_LoadTexObj(&texobj, GX_TEXMAP0); + GX_InvalidateTexAll(); +} void gxDrawRectangle(s32 x, s32 y, s32 w, s32 h, u8 alpha, GXColor color) { @@ -1375,6 +1458,12 @@ gxTextureClose(&crosshair[0]); gxTextureClose(&crosshair[1]); + /* CD leds textures */ + gxTextureClose(&cd_leds[0][0]); + gxTextureClose(&cd_leds[0][1]); + gxTextureClose(&cd_leds[1][0]); + gxTextureClose(&cd_leds[1][1]); + /* GX menu rendering */ gxResetRendering(1); gxResetMode(vmode); @@ -1520,6 +1609,18 @@ } } + /* CD leds textures */ + if (system_hw == SYSTEM_MCD) + { + if (config.cd_leds) + { + cd_leds[0][0] = gxTextureOpenPNG(CD_access_off_png,0); + cd_leds[0][1] = gxTextureOpenPNG(CD_access_on_png,0); + cd_leds[1][0] = gxTextureOpenPNG(CD_ready_off_png,0); + cd_leds[1][1] = gxTextureOpenPNG(CD_ready_on_png,0); + } + } + /* GX emulation rendering */ gxResetRendering(0); @@ -1624,6 +1725,14 @@ } } + /* CD LEDS */ + if (cd_leds[1][1]) + { + /* CD LEDS status */ + u8 mode = scd.regs[0x06 >> 1].byte.h; + gxDrawCdLeds(cd_leds[1][(mode >> 1) & 1], cd_leds[0][mode & 1]); + } + /* swap XFB */ whichfb ^= 1; Binary files /tmp/Ir_387zHDd/libretro-genesisplusgx-0.6~filthypants2/source/gx/images/CD_access_off.png and /tmp/zExJlvZxDg/libretro-genesisplusgx-0.6~filthypants4/source/gx/images/CD_access_off.png differ Binary files /tmp/Ir_387zHDd/libretro-genesisplusgx-0.6~filthypants2/source/gx/images/CD_access_on.png and /tmp/zExJlvZxDg/libretro-genesisplusgx-0.6~filthypants4/source/gx/images/CD_access_on.png differ Binary files /tmp/Ir_387zHDd/libretro-genesisplusgx-0.6~filthypants2/source/gx/images/CD_ready_off.png and /tmp/zExJlvZxDg/libretro-genesisplusgx-0.6~filthypants4/source/gx/images/CD_ready_off.png differ Binary files /tmp/Ir_387zHDd/libretro-genesisplusgx-0.6~filthypants2/source/gx/images/CD_ready_on.png and /tmp/zExJlvZxDg/libretro-genesisplusgx-0.6~filthypants4/source/gx/images/CD_ready_on.png differ diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/gx/main.c libretro-genesisplusgx-0.6~filthypants4/source/gx/main.c --- libretro-genesisplusgx-0.6~filthypants2/source/gx/main.c 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/gx/main.c 2013-04-29 16:28:55.000000000 +0000 @@ -54,6 +54,7 @@ u32 Shutdown = 0; u32 ConfigRequested = 1; +char osd_version[32]; #ifdef LOG_TIMING u64 prevtime; @@ -172,11 +173,6 @@ /* clear flag */ bitmap.viewport.changed &= ~4; } - -#ifdef HW_RVL - /* use Wii DVD light to simulate CD Drive access led */ - *(u32*)0xcd0000c0 = (*(u32*)0xcd0000c0 & ~0x20) | ((scd.regs[0x06>>1].byte.h & 0x01) << 5); -#endif } } else if ((system_hw & SYSTEM_PBC) == SYSTEM_MD) @@ -248,11 +244,6 @@ } } -#ifdef HW_RVL - /* reset Wii DVD light */ - *(u32*)0xcd0000c0 = (*(u32*)0xcd0000c0 & ~0x20); -#endif - /* stop video & audio */ gx_audio_Stop(); gx_video_Stop(); @@ -456,6 +447,10 @@ /* initialize DI interface */ DI_UseCache(0); DI_Init(); + + sprintf(osd_version, "%s (IOS %d)", VERSION, IOS_GetVersion()); +#else + sprintf(osd_version, "%s (GCN)", VERSION); #endif /* initialize video engine */ diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/gx/osd.h libretro-genesisplusgx-0.6~filthypants4/source/gx/osd.h --- libretro-genesisplusgx-0.6~filthypants2/source/gx/osd.h 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/gx/osd.h 2013-04-29 16:28:55.000000000 +0000 @@ -29,14 +29,14 @@ #include "file_load.h" #include "cheats.h" -/*************************************************/ -/* required by Genesis Plus GX core */ -/*************************************************/ - #include "config.h" #include "fileio.h" #define DEFAULT_PATH "/genplus" + +/*************************************************/ +/* required by Genesis Plus GX core */ +/*************************************************/ #define GG_ROM "/genplus/lock-on/ggenie.bin" #define AR_ROM "/genplus/lock-on/areplay.bin" #define SK_ROM "/genplus/lock-on/sk.bin" @@ -54,16 +54,22 @@ #define CD_BRAM_JP "/genplus/saves/cd/scd_J.brm" #define CART_BRAM "/genplus/saves/cd/cart.brm" -#define ALIGN_SND 0xfffffff8 /* 32 bytes aligned sound buffers (8 samples alignment) */ +/*********************************************************/ +/* implemented by Genesis Plus GX core (GC/Wii specific) */ +/*********************************************************/ -/*************************************************/ +/* 32 bytes aligned sound buffers (8 samples alignment) */ +#define ALIGN_SND 0xfffffff8 +/* use Wii DVD LED to indicate when virtual CD tray is open */ #ifdef HW_RVL -#define VERSION "Genesis Plus GX 1.7.1 (WII)" -#else -#define VERSION "Genesis Plus GX 1.7.1 (GCN)" +#define CD_TRAY_CALLBACK *(u32*)0xcd0000c0 = (*(u32*)0xcd0000c0 & ~0x20) | ((cdd.status == CD_OPEN) << 5); #endif +/*************************************************/ + +#define VERSION "Genesis Plus GX 1.7.3" + #define NO_SYNC 0 #define SYNC_VIDEO 1 #define SYNC_AUDIO 2 @@ -75,6 +81,7 @@ extern void shutdown(void); extern u32 Shutdown; extern u32 ConfigRequested; +extern char osd_version[32]; #ifdef LOG_TIMING #include diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/input_hw/input.h libretro-genesisplusgx-0.6~filthypants4/source/input_hw/input.h --- libretro-genesisplusgx-0.6~filthypants2/source/input_hw/input.h 2012-08-15 15:21:19.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/input_hw/input.h 2013-04-29 16:28:55.000000000 +0000 @@ -133,8 +133,8 @@ uint8 dev[MAX_DEVICES]; /* can be one of the DEVICE_* values */ uint16 pad[MAX_DEVICES]; /* digital inputs (any of INPUT_* values) */ int16 analog[MAX_DEVICES][2]; /* analog inputs (x/y) */ - uint8 x_offset; /* gun horizontal offset */ - uint8 y_offset; /* gun vertical offset */ + int x_offset; /* gun horizontal offset */ + int y_offset; /* gun vertical offset */ } t_input; /* Global variables */ diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/input_hw/lightgun.c libretro-genesisplusgx-0.6~filthypants4/source/input_hw/lightgun.c --- libretro-genesisplusgx-0.6~filthypants2/source/input_hw/lightgun.c 2012-08-15 15:21:19.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/input_hw/lightgun.c 2013-04-29 16:28:55.000000000 +0000 @@ -92,8 +92,8 @@ void lightgun_reset(int port) { - input.analog[port][0] = bitmap.viewport.w >> 1; - input.analog[port][1] = bitmap.viewport.h >> 1; + input.analog[port][0] = bitmap.viewport.w / 2; + input.analog[port][1] = bitmap.viewport.h / 2; lightgun.State = 0x40; lightgun.Port = 4; } @@ -103,32 +103,47 @@ /* Check that lightgun is enabled */ if (port == lightgun.Port) { - /* check if line falls within current gun Y position */ - if ((input.analog[port][1] == v_counter + input.y_offset)) + /* screen Y position */ + int y = input.analog[port][1] + input.y_offset; + + /* check if active line falls within current gun Y position */ + if ((y == v_counter) && (y < bitmap.viewport.h)) { /* HL enabled ? */ if (io_reg[5] & 0x80) { + /* screen X position */ + int x = input.analog[port][0]; + + /* Sega Menacer specific */ + if (input.system[1] == SYSTEM_MENACER) + { + /* raw position is scaled up by games */ + if (system_hw == SYSTEM_MCD) + { + x = (x * 304) / 320; + } + else + { + x = (x * 289) / 320; + } + } + /* External Interrupt ? */ if (reg[11] & 0x08) { m68k_update_irq(2); } - /* HV Counter Latch: - 1) some games does not enable HVC latch but instead use bigger X offset - --> we force the HV counter value read by the gun routine - 2) for games using H40 mode, the gun routine scales up the Hcounter value - --> H-Counter range is approx. 290 dot clocks - */ - hvc_latch = 0x10000 | (v_counter << 8); + /* force HV Counter Latch (some games does not lock HV Counter but instead use larger offset value) */ + hvc_latch = 0x10000 | (y << 8); if (reg[12] & 1) { - hvc_latch |= hc_320[((input.analog[port][0] * 290) / (2 * 320) + input.x_offset) % 210]; + hvc_latch |= hc_320[((x / 2) + input.x_offset) % 210]; } else { - hvc_latch |= hc_256[(input.analog[port][0] / 2 + input.x_offset) % 171]; + hvc_latch |= hc_256[((x / 2) + input.x_offset) % 171]; } } } diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/input_hw/terebi_oekaki.c libretro-genesisplusgx-0.6~filthypants4/source/input_hw/terebi_oekaki.c --- libretro-genesisplusgx-0.6~filthypants2/source/input_hw/terebi_oekaki.c 2012-08-15 15:21:19.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/input_hw/terebi_oekaki.c 2013-04-29 16:28:55.000000000 +0000 @@ -74,4 +74,4 @@ /* set BUSY flag */ tablet.busy = 1; -} \ No newline at end of file +} diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/loadrom.c libretro-genesisplusgx-0.6~filthypants4/source/loadrom.c --- libretro-genesisplusgx-0.6~filthypants2/source/loadrom.c 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/loadrom.c 2013-04-29 16:28:55.000000000 +0000 @@ -74,7 +74,7 @@ #define PMOUSE 8192 #define MAXCOMPANY 64 -#define MAXPERIPHERALS 14 +#define MAXPERIPHERALS 15 typedef struct { @@ -190,6 +190,7 @@ {"V", "Paddle"}, {"C", "CD-ROM"}, {"M", "Mega Mouse"}, + {"G", "Menacer"}, }; /*************************************************************************** @@ -600,7 +601,7 @@ /* Mega Drive hardware (Genesis mode) */ system_hw = SYSTEM_MD; - /* Decode .MDX format */ + /* decode .MDX format */ if (!memcmp("MDX", &extension[0], 3)) { for (i = 4; i < size - 1; i++) @@ -609,6 +610,18 @@ } size = size - 5; } + + /* auto-detect byte-swapped dumps */ + if (!memcmp((char *)(cart.rom + 0x100),"ESAGM GE ARDVI E", 16) || + !memcmp((char *)(cart.rom + 0x100),"ESAGG NESESI", 12)) + { + for(i = 0; i < size; i += 2) + { + uint8 temp = cart.rom[i]; + cart.rom[i] = cart.rom[i+1]; + cart.rom[i+1] = temp; + } + } } /* auto-detect 512 byte extra header */ @@ -655,10 +668,10 @@ scd.cartridge.boot = 0x00; } +#ifdef LSB_FIRST /* 16-bit ROM specific */ else if (system_hw == SYSTEM_MD) { -#ifdef LSB_FIRST /* Byteswap ROM to optimize 16-bit access */ for (i = 0; i < cart.romsize; i += 2) { @@ -666,20 +679,8 @@ cart.rom[i] = cart.rom[i+1]; cart.rom[i+1] = temp; } -#endif - - /* byteswapped RADICA dumps (from Haze) */ - if (((strstr(rominfo.product,"-K0101") != NULL) && (rominfo.checksum == 0xf424)) || - ((strstr(rominfo.product,"-K0109") != NULL) && (rominfo.checksum == 0x4f10))) - { - for(i = 0; i < cart.romsize; i += 2) - { - uint8 temp = cart.rom[i]; - cart.rom[i] = cart.rom[i+1]; - cart.rom[i+1] = temp; - } - } } +#endif /* Save auto-detected system hardware */ romtype = system_hw; @@ -771,6 +772,175 @@ input.system[1] = old_system[1]; } + /* default gun settings */ + input.x_offset = (input.system[1] == SYSTEM_MENACER) ? 64 : 0; + input.y_offset = 0; + + /* autodetect gun support */ + if (strstr(rominfo.international,"MENACER") != NULL) + { + /* save current setting */ + if (old_system[0] == -1) + { + old_system[0] = input.system[0]; + } + if (old_system[1] == -1) + { + old_system[1] = input.system[1]; + } + + /* force MENACER configuration */ + input.system[0] = SYSTEM_MD_GAMEPAD; + input.system[1] = SYSTEM_MENACER; + input.x_offset = 82; + input.y_offset = 0; + } + else if (strstr(rominfo.international,"T2 ; THE ARCADE GAME") != NULL) + { + /* save current setting */ + if (old_system[0] == -1) + { + old_system[0] = input.system[0]; + } + if (old_system[1] == -1) + { + old_system[1] = input.system[1]; + } + + /* force MENACER configuration */ + input.system[0] = SYSTEM_MD_GAMEPAD; + input.system[1] = SYSTEM_MENACER; + input.x_offset = 133; + input.y_offset = -8; + } + else if (strstr(rominfo.international,"BODY COUNT") != NULL) + { + /* save current setting */ + if (old_system[0] == -1) + { + old_system[0] = input.system[0]; + } + if (old_system[1] == -1) + { + old_system[1] = input.system[1]; + } + + /* force MOUSE+MENACER configuration */ + input.system[0] = SYSTEM_MOUSE; + input.system[1] = SYSTEM_MENACER; + input.x_offset = 68; + input.y_offset = -24; + } + else if (strstr(rominfo.international,"CORPSE KILLER") != NULL) + { + /* save current setting */ + if (old_system[0] == -1) + { + old_system[0] = input.system[0]; + } + if (old_system[1] == -1) + { + old_system[1] = input.system[1]; + } + + /* force MENACER configuration */ + input.system[0] = SYSTEM_MD_GAMEPAD; + input.system[1] = SYSTEM_MENACER; + input.x_offset = 64; + input.y_offset = -8; + } + else if (strstr(rominfo.international,"CRIME PATROL") != NULL) + { + /* save current setting */ + if (old_system[0] == -1) + { + old_system[0] = input.system[0]; + } + if (old_system[1] == -1) + { + old_system[1] = input.system[1]; + } + + /* force MENACER configuration */ + input.system[0] = SYSTEM_MD_GAMEPAD; + input.system[1] = SYSTEM_MENACER; + input.x_offset = 61; + input.y_offset = 0; + } + else if (strstr(rominfo.international,"MAD DOG II THE LOST GOLD") != NULL) + { + /* save current setting */ + if (old_system[0] == -1) + { + old_system[0] = input.system[0]; + } + if (old_system[1] == -1) + { + old_system[1] = input.system[1]; + } + + /* force MENACER configuration */ + input.system[0] = SYSTEM_MD_GAMEPAD; + input.system[1] = SYSTEM_MENACER; + input.x_offset = 70; + input.y_offset = 18; + } + else if (strstr(rominfo.international,"MAD DOG MCCREE") != NULL) + { + /* save current setting */ + if (old_system[0] == -1) + { + old_system[0] = input.system[0]; + } + if (old_system[1] == -1) + { + old_system[1] = input.system[1]; + } + + /* force MENACER configuration */ + input.system[0] = SYSTEM_MD_GAMEPAD; + input.system[1] = SYSTEM_MENACER; + input.x_offset = 49; + input.y_offset = 0; + } + else if (strstr(rominfo.international,"WHO SHOT JOHNNY ROCK?") != NULL) + { + /* save current setting */ + if (old_system[0] == -1) + { + old_system[0] = input.system[0]; + } + if (old_system[1] == -1) + { + old_system[1] = input.system[1]; + } + + /* force MENACER configuration */ + input.system[0] = SYSTEM_MD_GAMEPAD; + input.system[1] = SYSTEM_MENACER; + input.x_offset = 60; + input.y_offset = 30; + } + else if ((strstr(rominfo.international,"LETHAL ENFORCERS") != NULL) || + (strstr(rominfo.international,"SNATCHER") != NULL)) + { + /* save current setting */ + if (old_system[0] == -1) + { + old_system[0] = input.system[0]; + } + if (old_system[1] == -1) + { + old_system[1] = input.system[1]; + } + + /* force JUSTIFIER configuration */ + input.system[0] = SYSTEM_MD_GAMEPAD; + input.system[1] = SYSTEM_JUSTIFIER; + input.x_offset = (strstr(rominfo.international,"GUN FIGHTERS") != NULL) ? 24 : 0; + input.y_offset = 0; + } + return(1); } diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/m68k/m68k.h libretro-genesisplusgx-0.6~filthypants4/source/m68k/m68k.h --- libretro-genesisplusgx-0.6~filthypants2/source/m68k/m68k.h 2012-08-15 15:21:19.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/m68k/m68k.h 2013-04-29 16:28:55.000000000 +0000 @@ -39,9 +39,9 @@ /* ================================ INCLUDES ============================== */ /* ======================================================================== */ +#include #include "macros.h" - /* ======================================================================== */ /* ==================== ARCHITECTURE-DEPENDANT DEFINES ==================== */ /* ======================================================================== */ @@ -231,30 +231,29 @@ { cpu_memory_map memory_map[256]; /* memory mapping */ - cpu_idle_t poll; /* polling detection */ + cpu_idle_t poll; /* polling detection */ - uint cycles; /* current master cycle count */ - uint cycle_end; /* aimed master cycle count for current execution frame */ + uint cycles; /* current master cycle count */ + uint cycle_end; /* aimed master cycle count for current execution frame */ + + uint dar[16]; /* Data and Address Registers */ + uint pc; /* Program Counter */ + uint sp[5]; /* User and Interrupt Stack Pointers */ + uint ir; /* Instruction Register */ + uint t1_flag; /* Trace 1 */ + uint s_flag; /* Supervisor */ + uint x_flag; /* Extend */ + uint n_flag; /* Negative */ + uint not_z_flag; /* Zero, inverted for speedups */ + uint v_flag; /* Overflow */ + uint c_flag; /* Carry */ + uint int_mask; /* I0-I2 */ + uint int_level; /* State of interrupt pins IPL0-IPL2 -- ASG: changed from ints_pending */ + uint stopped; /* Stopped state */ + + uint pref_addr; /* Last prefetch address */ + uint pref_data; /* Data in the prefetch queue */ - uint dar[16]; /* Data and Address Registers */ - uint pc; /* Program Counter */ - uint sp[5]; /* User and Interrupt Stack Pointers */ - uint ir; /* Instruction Register */ - uint t1_flag; /* Trace 1 */ - uint s_flag; /* Supervisor */ - uint x_flag; /* Extend */ - uint n_flag; /* Negative */ - uint not_z_flag; /* Zero, inverted for speedups */ - uint v_flag; /* Overflow */ - uint c_flag; /* Carry */ - uint int_mask; /* I0-I2 */ - uint int_level; /* State of interrupt pins IPL0-IPL2 -- ASG: changed from ints_pending */ - uint stopped; /* Stopped state */ -#if M68K_EMULATE_PREFETCH - uint pref_addr; /* Last prefetch address */ - uint pref_data; /* Data in the prefetch queue */ -#endif -#if M68K_EMULATE_ADDRESS_ERROR uint instr_mode; /* Stores whether we are in instruction mode or group 0/1 exception mode */ uint run_mode; /* Stores whether we are processing a reset, bus error, address error, or something else */ uint aerr_enabled; /* Enables/deisables address error checks at runtime */ @@ -262,27 +261,16 @@ uint aerr_address; /* Address error location */ uint aerr_write_mode; /* Address error write mode */ uint aerr_fc; /* Address error FC code */ -#endif -#if M68K_EMULATE_TRACE + uint tracing; /* Tracing enable flag */ -#endif -#if M68K_EMULATE_FC + uint address_space; /* Current FC code */ -#endif /* Callbacks to host */ -#if M68K_EMULATE_INT_ACK == OPT_ON int (*int_ack_callback)(int int_line); /* Interrupt Acknowledge */ -#endif -#if M68K_EMULATE_RESET == OPT_ON void (*reset_instr_callback)(void); /* Called when a RESET instruction is encountered */ -#endif -#if M68K_TAS_HAS_CALLBACK == OPT_ON int (*tas_instr_callback)(void); /* Called when a TAS instruction is encountered, allows / disallows writeback */ -#endif -#if M68K_EMULATE_FC == OPT_ON void (*set_fc_callback)(unsigned int new_fc); /* Called when the CPU function code changes */ -#endif } m68ki_cpu_core; /* CPU cores */ diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/m68k/m68kcpu.c libretro-genesisplusgx-0.6~filthypants4/source/m68k/m68kcpu.c --- libretro-genesisplusgx-0.6~filthypants2/source/m68k/m68kcpu.c 2012-08-15 15:21:19.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/m68k/m68kcpu.c 2013-04-29 16:28:55.000000000 +0000 @@ -205,9 +205,6 @@ #ifdef LOGVDP error("[%d(%d)][%d(%d)] IRQ Level = %d(0x%02x) (%x)\n", v_counter, m68k.cycles/3420, m68k.cycles, m68k.cycles%3420,CPU_INT_LEVEL>>8,FLAG_INT_MASK,m68k_get_reg(M68K_REG_PC)); #endif - - /* Check interrupt mask to process IRQ */ - m68ki_check_interrupts(); } void m68k_set_irq(unsigned int int_level) @@ -218,9 +215,6 @@ #ifdef LOGVDP error("[%d(%d)][%d(%d)] IRQ Level = %d(0x%02x) (%x)\n", v_counter, m68k.cycles/3420, m68k.cycles, m68k.cycles%3420,CPU_INT_LEVEL>>8,FLAG_INT_MASK,m68k_get_reg(M68K_REG_PC)); #endif - - /* Check interrupt mask to process IRQ */ - m68ki_check_interrupts(); } /* IRQ latency (Fatal Rewind, Sesame's Street Counting Cafe)*/ @@ -261,6 +255,15 @@ void m68k_run(unsigned int cycles) { + /* Make sure CPU is not already ahead */ + if (m68k.cycles >= cycles) + { + return; + } + + /* Check interrupt mask to process IRQ if needed */ + m68ki_check_interrupts(); + /* Make sure we're not stopped */ if (CPU_STOPPED) { @@ -268,12 +271,12 @@ return; } - /* Return point for when we have an address error (TODO: use goto) */ - m68ki_set_address_error_trap() /* auto-disable (see m68kcpu.h) */ - /* Save end cycles count for when CPU is stopped */ m68k.cycle_end = cycles; + /* Return point for when we have an address error (TODO: use goto) */ + m68ki_set_address_error_trap() /* auto-disable (see m68kcpu.h) */ + #ifdef LOGVDP error("[%d][%d] m68k run to %d cycles (%x)\n", v_counter, m68k.cycles, cycles, m68k.pc); #endif @@ -290,8 +293,8 @@ REG_IR = m68ki_read_imm_16(); /* Execute instruction */ - m68ki_instruction_jump_table[REG_IR](); /* TODO: use labels table with goto */ - USE_CYCLES(CYC_INSTRUCTION[REG_IR]); /* TODO: move into instruction handlers */ + m68ki_instruction_jump_table[REG_IR](); + USE_CYCLES(CYC_INSTRUCTION[REG_IR]); /* Trace m68k_exception, if necessary */ m68ki_exception_if_trace(); /* auto-disable (see m68kcpu.h) */ diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/m68k/m68kcpu.h libretro-genesisplusgx-0.6~filthypants4/source/m68k/m68kcpu.h --- libretro-genesisplusgx-0.6~filthypants2/source/m68k/m68kcpu.h 2012-08-15 15:21:19.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/m68k/m68kcpu.h 2013-04-29 16:28:55.000000000 +0000 @@ -1070,28 +1070,36 @@ /* ---------------------------- Stack Functions --------------------------- */ /* Push/pull data from the stack */ +/* Optimized access assuming stack is always located in ROM/RAM [EkeEke] */ INLINE void m68ki_push_16(uint value) { REG_SP = MASK_OUT_ABOVE_32(REG_SP - 2); - m68ki_write_16(REG_SP, value); + /*m68ki_write_16(REG_SP, value);*/ + *(uint16 *)(m68ki_cpu.memory_map[(REG_SP>>16)&0xff].base + (REG_SP & 0xffff)) = value; } INLINE void m68ki_push_32(uint value) { REG_SP = MASK_OUT_ABOVE_32(REG_SP - 4); - m68ki_write_32(REG_SP, value); + /*m68ki_write_32(REG_SP, value);*/ + *(uint16 *)(m68ki_cpu.memory_map[(REG_SP>>16)&0xff].base + (REG_SP & 0xffff)) = value >> 16; + *(uint16 *)(m68ki_cpu.memory_map[((REG_SP + 2)>>16)&0xff].base + ((REG_SP + 2) & 0xffff)) = value & 0xffff; } INLINE uint m68ki_pull_16(void) { + uint sp = REG_SP; REG_SP = MASK_OUT_ABOVE_32(REG_SP + 2); - return m68ki_read_16(REG_SP-2); + return m68k_read_immediate_16(sp); + /*return m68ki_read_16(sp);*/ } INLINE uint m68ki_pull_32(void) { + uint sp = REG_SP; REG_SP = MASK_OUT_ABOVE_32(REG_SP + 4); - return m68ki_read_32(REG_SP-4); + return m68k_read_immediate_32(sp); + /*return m68ki_read_32(sp);*/ } diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/m68k/s68kcpu.c libretro-genesisplusgx-0.6~filthypants4/source/m68k/s68kcpu.c --- libretro-genesisplusgx-0.6~filthypants2/source/m68k/s68kcpu.c 2012-08-15 15:21:19.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/m68k/s68kcpu.c 2013-04-29 16:28:55.000000000 +0000 @@ -215,13 +215,19 @@ #ifdef LOG_SCD error("[%d][%d] IRQ Level = %d(0x%02x) (%x)\n", v_counter, s68k.cycles, CPU_INT_LEVEL>>8,FLAG_INT_MASK,s68k.pc); #endif - - /* Check interrupt mask to process IRQ */ - m68ki_check_interrupts(); } void s68k_run(unsigned int cycles) { + /* Make sure CPU is not already ahead */ + if (s68k.cycles >= cycles) + { + return; + } + + /* Check interrupt mask to process IRQ if needed */ + m68ki_check_interrupts(); + /* Make sure we're not stopped */ if (CPU_STOPPED) { @@ -229,11 +235,12 @@ return; } + /* Save end cycles count for when CPU is stopped */ + s68k.cycle_end = cycles; + /* Return point for when we have an address error (TODO: use goto) */ m68ki_set_address_error_trap() /* auto-disable (see m68kcpu.h) */ - /* Save end cycles count for when CPU is stopped */ - s68k.cycle_end = cycles; #ifdef LOG_SCD error("[%d][%d] s68k run to %d cycles (%x), irq mask = %x (%x)\n", v_counter, s68k.cycles, cycles, s68k.pc,FLAG_INT_MASK, CPU_INT_LEVEL); #endif @@ -249,10 +256,9 @@ /* Decode next instruction */ REG_IR = m68ki_read_imm_16(); - /* Execute instruction */ - m68ki_instruction_jump_table[REG_IR](); /* TODO: use labels table with goto */ - USE_CYCLES(CYC_INSTRUCTION[REG_IR]); /* TODO: move into instruction handlers */ + m68ki_instruction_jump_table[REG_IR](); + USE_CYCLES(CYC_INSTRUCTION[REG_IR]); /* Trace m68k_exception, if necessary */ m68ki_exception_if_trace(); /* auto-disable (see m68kcpu.h) */ diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/mem68k.c libretro-genesisplusgx-0.6~filthypants4/source/mem68k.c --- libretro-genesisplusgx-0.6~filthypants2/source/mem68k.c 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/mem68k.c 2013-04-29 16:28:55.000000000 +0000 @@ -3,7 +3,7 @@ * Main 68k bus handlers * * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code) - * Copyright (C) 2007-2012 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: @@ -48,7 +48,7 @@ #ifdef LOGERROR error("Unused read8 %08X (%08X)\n", address, m68k_get_reg(M68K_REG_PC)); #endif - address = m68k.pc | (address & 1); + address = m68k.pc | (address & 1); return READ_BYTE(m68k.memory_map[((address)>>16)&0xff].base, (address) & 0xffff); } @@ -223,7 +223,7 @@ /* I/O Control */ /*--------------------------------------------------------------------------*/ -INLINE void m68k_poll_detect(reg) +static void m68k_poll_detect(reg) { /* detect MAIN-CPU register polling */ if (m68k.poll.detected == (1 << reg)) @@ -238,6 +238,13 @@ #endif m68k.cycles = m68k.cycle_end; m68k.stopped = 1 << reg; + + /* return to current instruction */ + do + { + m68k.pc -= 2; + } + while (m68k.ir != *(uint16 *)(m68k.memory_map[(m68k.pc>>16)&0xff].base + (m68k.pc & 0xffff))); } return; } @@ -249,11 +256,11 @@ } /* restart MAIN-CPU polling detection */ - m68k.poll.cycle = m68k.cycles + 280; + m68k.poll.cycle = m68k.cycles + 840; m68k.poll.pc = m68k.pc; } -INLINE void m68k_poll_sync(reg) +static void m68k_poll_sync(reg) { /* relative SUB-CPU cycle counter */ unsigned int cycles = (m68k.cycles * SCYCLES_PER_LINE) / MCYCLES_PER_LINE; @@ -322,37 +329,49 @@ #endif if (system_hw == SYSTEM_MCD) { + /* register index ($A12000-A1203F mirrored up to $A120FF) */ + uint8 index = address & 0x3f; + /* Memory Mode */ - if (address == 0xa12003) + if (index == 0x03) { m68k_poll_detect(0x03); return scd.regs[0x03>>1].byte.l; } /* SUB-CPU communication flags */ - if (address == 0xa1200f) + if (index == 0x0f) { + /* relative SUB-CPU cycle counter */ + unsigned int cycles = (m68k.cycles * SCYCLES_PER_LINE) / MCYCLES_PER_LINE; + + /* sync SUB-CPU with MAIN-CPU (Dracula Unleashed w/ Sega CD Model 2 OS ROM) */ + if (!s68k.stopped && (s68k.cycles < cycles)) + { + s68k_run(cycles); + } + m68k_poll_detect(0x0f); return scd.regs[0x0f>>1].byte.l; } /* default registers */ - if (address < 0xa12030) + if (index < 0x30) { /* SUB-CPU communication words */ - if (address >= 0xa12020) + if (index >= 0x20) { - m68k_poll_detect((address - 0x10) & 0x1f); + m68k_poll_detect(index - 0x10); } /* register LSB */ if (address & 1) { - return scd.regs[(address >> 1) & 0xff].byte.l; + return scd.regs[index >> 1].byte.l; } /* register MSB */ - return scd.regs[(address >> 1) & 0xff].byte.h; + return scd.regs[index >> 1].byte.h; } } @@ -441,35 +460,48 @@ #endif if (system_hw == SYSTEM_MCD) { + /* register index ($A12000-A1203F mirrored up to $A120FF) */ + uint8 index = address & 0x3f; + /* Memory Mode */ - if (address == 0xa12002) + if (index == 0x02) { m68k_poll_detect(0x03); return scd.regs[0x03>>1].w; } /* CDC host data (word access only ?) */ - if (address == 0xa12008) + if (index == 0x08) { return cdc_host_r(); } /* H-INT vector (word access only ?) */ - if (address == 0xa12006) + if (index == 0x06) { return *(uint16 *)(m68k.memory_map[0].base + 0x72); } + /* Stopwatch counter (word read access only ?) */ + if (index == 0x0c) + { + /* relative SUB-CPU cycle counter */ + unsigned int cycles = (m68k.cycles * SCYCLES_PER_LINE) / MCYCLES_PER_LINE; + + /* cycle-accurate counter value */ + return (scd.regs[0x0c>>1].w + ((cycles - scd.stopwatch) / TIMERS_SCYCLES_RATIO)) & 0xfff; + } + /* default registers */ - if (address < 0xa12030) + if (index < 0x30) { /* SUB-CPU communication words */ - if (address >= 0xa12020) + if (index >= 0x20) { - m68k_poll_detect((address - 0x10) & 0x1e); + m68k_poll_detect(index - 0x10); } - return scd.regs[(address >> 1) & 0xff].w; + return scd.regs[index >> 1].w; } } @@ -565,7 +597,8 @@ #endif if (system_hw == SYSTEM_MCD) { - switch (address & 0xff) + /* register index ($A12000-A1203F mirrored up to $A120FF) */ + switch (address & 0x3f) { case 0x00: /* SUB-CPU interrupt */ { @@ -633,6 +666,12 @@ return; } + case 0x02: /* PRG-RAM Write Protection */ + { + scd.regs[0x02>>1].byte.h = data; + return; + } + case 0x03: /* Memory mode */ { m68k_poll_sync(0x02); @@ -694,14 +733,10 @@ default: { - /* default registers */ - if (address < 0xa12020) + /* MAIN-CPU communication words */ + if ((address & 0x30) == 0x10) { - /* MAIN-CPU communication words */ - if (address >= 0xa12010) - { - m68k_poll_sync(address & 0x1e); - } + m68k_poll_sync(address & 0x1e); /* register LSB */ if (address & 1) @@ -714,7 +749,7 @@ scd.regs[(address >> 1) & 0xff].byte.h = data; return; } - + /* invalid address */ m68k_unused_8_w(address, data); return; @@ -795,7 +830,8 @@ #endif if (system_hw == SYSTEM_MCD) { - switch (address & 0xfe) + /* register index ($A12000-A1203F mirrored up to $A120FF) */ + switch (address & 0x3e) { case 0x00: /* SUB-CPU interrupt & control */ { @@ -912,15 +948,10 @@ default: { - if (address < 0xa12020) + /* MAIN-CPU communication words */ + if ((address & 0x30) == 0x10) { - /* MAIN-CPU communication words */ - if (address >= 0xa12010) - { - m68k_poll_sync(address & 0x1e); - } - - /* default registers */ + m68k_poll_sync(address & 0x1e); scd.regs[(address >> 1) & 0xff].w = data; return; } diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/mem68k.h libretro-genesisplusgx-0.6~filthypants4/source/mem68k.h --- libretro-genesisplusgx-0.6~filthypants2/source/mem68k.h 2012-08-15 15:21:19.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/mem68k.h 2013-04-29 16:28:55.000000000 +0000 @@ -3,7 +3,7 @@ * Main 68k bus handlers * * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code) - * Copyright (C) 2007-2012 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/sound/blip_buf.c libretro-genesisplusgx-0.6~filthypants4/source/sound/blip_buf.c --- libretro-genesisplusgx-0.6~filthypants2/source/sound/blip_buf.c 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/sound/blip_buf.c 2013-04-29 16:28:55.000000000 +0000 @@ -8,8 +8,6 @@ #include "blip_buf.h" -#define BLIP_ASSERT 1 - #ifdef BLIP_ASSERT #include #endif @@ -236,11 +234,10 @@ buf_t const* in = SAMPLES( m ); buf_t const* end = in + count; int sum = m->integrator; - int s; do { /* Eliminate fraction */ - s = ARITH_SHIFT( sum, delta_bits ); + int s = ARITH_SHIFT( sum, delta_bits ); sum += *in++; @@ -275,24 +272,23 @@ buf_t const* in = SAMPLES( m ); buf_t const* end = in + count; int sum = m->integrator; - int s, temp; do { /* Eliminate fraction */ - s = ARITH_SHIFT( sum, delta_bits ); + int s = ARITH_SHIFT( sum, delta_bits ); sum += *in++; + + /* High-pass filter */ + sum -= s << (delta_bits - bass_shift); - /* Add to current buffer */ - temp = s + *out; + /* Add current buffer value */ + s += *out; - CLAMP( temp ); + CLAMP( s ); - *out = temp; + *out = s; out += 2; - - /* High-pass filter */ - sum -= s << (delta_bits - bass_shift); } while ( in != end ); m->integrator = sum; diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/sound/sn76489.h libretro-genesisplusgx-0.6~filthypants4/source/sound/sn76489.h --- libretro-genesisplusgx-0.6~filthypants2/source/sound/sn76489.h 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/sound/sn76489.h 2013-04-29 16:28:55.000000000 +0000 @@ -20,4 +20,4 @@ extern void *SN76489_GetContextPtr(void); extern int SN76489_GetContextSize(void); -#endif /* _SN76489_H_ */ \ No newline at end of file +#endif /* _SN76489_H_ */ diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/system.c libretro-genesisplusgx-0.6~filthypants4/source/system.c --- libretro-genesisplusgx-0.6~filthypants2/source/system.c 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/system.c 2013-04-29 16:28:55.000000000 +0000 @@ -992,15 +992,12 @@ } while (++line < (lines_per_frame - 1)); - /* reset CPU registers polling */ - m68k.poll.cycle = 0; - s68k.poll.cycle = 0; + /* prepare for next SCD frame */ + scd_end_frame(scd.cycles); /* adjust CPU cycle counters for next frame */ Z80.cycles -= mcycles_vdp; m68k.cycles -= mcycles_vdp; - s68k.cycles -= scd.cycles; - gfx.cycles -= scd.cycles; } void system_frame_sms(int do_skip) diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/vdp_ctrl.c libretro-genesisplusgx-0.6~filthypants4/source/vdp_ctrl.c --- libretro-genesisplusgx-0.6~filthypants2/source/vdp_ctrl.c 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/vdp_ctrl.c 2013-04-29 16:28:55.000000000 +0000 @@ -5,7 +5,7 @@ * Support for SG-1000, Master System (315-5124 & 315-5246), Game Gear & Mega Drive VDP * * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code) - * Copyright (C) 2007-2012 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: @@ -381,7 +381,7 @@ } /* Mega Drive specific */ - else if ((system_hw == SYSTEM_MD) && (config.bios & 1) && !(system_bios & SYSTEM_MD)) + else if (((system_hw == SYSTEM_MD) || (system_hw == SYSTEM_MCD)) && (config.bios & 1) && !(system_bios & SYSTEM_MD)) { /* force registers initialization (only if TMSS model is emulated and BOOT ROM is not loaded) */ vdp_reg_w(0 , 0x04, 0); @@ -479,8 +479,8 @@ load_param(&cached_write, sizeof(cached_write)); /* restore FIFO timings */ - fifo_latency = 214 - (reg[12] & 1) * 24; - fifo_latency <<= ((code & 0x0F) == 0x01); + fifo_latency = (reg[12] & 1) ? 190 : 214; + fifo_latency <<= ((code & 0x0F) < 0x03); /* restore current NTSC/PAL mode */ if (system_hw & SYSTEM_MD) @@ -567,8 +567,9 @@ if (status & 8) { /* Process DMA until the end of VBLANK */ - /* NOTE: This is not 100% accurate since rate should be recalculated if */ - /* display width is changed during VBLANK but no games actually do this */ + /* NOTE: DMA timings can not change during VBLANK because active display width cannot be modified. */ + /* Indeed, writing VDP registers during DMA is either impossible (when doing DMA from 68k bus, CPU */ + /* is locked) or will abort DMA operation (in case of DMA Fill or Copy). */ dma_cycles = (lines_per_frame * MCYCLES_PER_LINE) - cycles; } else @@ -745,8 +746,8 @@ /* DMA source address */ dma_src = (reg[22] << 8) | reg[21]; - /* Transfer from SVP DRAM ($300000-$31ffff) or CD Word-RAM ($200000-$3fffff/$600000-$7fffff) */ - if (((system_hw == SYSTEM_MCD) && ((reg[23] & 0x70) == ((scd.cartridge.boot >> 1) + 0x10))) || (svp && ((reg[23] & 0x70) == 0x10))) + /* Transfer from SVP ROM/RAM ($000000-$3fffff) or CD Word-RAM ($200000-$3fffff/$600000-$7fffff) */ + if (((system_hw == SYSTEM_MCD) && ((reg[23] & 0x70) == ((scd.cartridge.boot >> 1) + 0x10))) || (svp && !(reg[23] & 0x60))) { /* source data is available with one cycle delay, i.e first word written by VDP is */ /* previous data being held on 68k bus at that time, then source words are written */ @@ -777,9 +778,11 @@ Each VRAM access is byte wide, so one VRAM write (word) need twice cycles. + Note: Invalid code 0x02 (register write) apparently behaves the same as VRAM + access, although no data is written in this case (fixes Clue menu) */ - fifo_latency = 214 - (reg[12] & 1) * 24; - fifo_latency <<= ((code & 0x0F) == 0x01); + fifo_latency = (reg[12] & 1) ? 190 : 214; + fifo_latency <<= ((code & 0x0F) < 0x03); } /* Mega Drive VDP control port specific (MS compatibility mode) */ @@ -1998,7 +2001,7 @@ } /* Adjust FIFO timings for VRAM writes */ - fifo_latency <<= ((code & 0x0F) == 0x01); + fifo_latency <<= ((code & 0x0F) < 0x03); /* Active display width modified during HBLANK (Bugs Bunny Double Trouble) */ if ((v_counter < bitmap.viewport.h) && (cycles <= (mcycles_vdp + 860))) @@ -2973,7 +2976,7 @@ static void vdp_dma_copy(unsigned int length) { /* VRAM read/write operation only */ - if ((code & 0x1F) == 0x10) + if ((code & 0x1E) == 0x10) { int name; uint8 data; diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/vdp_ctrl.h libretro-genesisplusgx-0.6~filthypants4/source/vdp_ctrl.h --- libretro-genesisplusgx-0.6~filthypants2/source/vdp_ctrl.h 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/vdp_ctrl.h 2013-04-29 16:28:55.000000000 +0000 @@ -5,7 +5,7 @@ * Support for SG-1000, Master System (315-5124 & 315-5246), Game Gear & Mega Drive VDP * * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code) - * Copyright (C) 2007-2012 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/vdp_render.c libretro-genesisplusgx-0.6~filthypants4/source/vdp_render.c --- libretro-genesisplusgx-0.6~filthypants2/source/vdp_render.c 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/vdp_render.c 2013-04-29 16:28:56.000000000 +0000 @@ -1521,11 +1521,11 @@ #ifdef LSB_FIRST uint32 shift = (xscroll >> 16) & 0x0F; uint32 index = pf_col_mask + 1 - ((xscroll >> 20) & pf_col_mask); - uint32 v_line = (line + ((yscroll >> 16) & 0x3FF)) & pf_row_mask; + uint32 v_line = (line + (yscroll >> 16)) & pf_row_mask; #else uint32 shift = (xscroll & 0x0F); uint32 index = pf_col_mask + 1 - ((xscroll >> 4) & pf_col_mask); - uint32 v_line = (line + (yscroll & 0x3FF)) & pf_row_mask; + uint32 v_line = (line + yscroll) & pf_row_mask; #endif /* Plane B name table */ @@ -1578,11 +1578,11 @@ #ifdef LSB_FIRST shift = (xscroll & 0x0F); index = pf_col_mask + start + 1 - ((xscroll >> 4) & pf_col_mask); - v_line = (line + (yscroll & 0x3FF)) & pf_row_mask; + v_line = (line + yscroll) & pf_row_mask; #else shift = (xscroll >> 16) & 0x0F; index = pf_col_mask + start + 1 - ((xscroll >> 20) & pf_col_mask); - v_line = (line + ((yscroll >> 16) & 0x3FF)) & pf_row_mask; + v_line = (line + (yscroll >> 16)) & pf_row_mask; #endif /* Plane A name table */ @@ -1683,7 +1683,6 @@ if (reg[12] & 1) { yscroll = vs[19] & (vs[19] >> 16); - yscroll &= 0x3FF; } if(shift) @@ -1713,9 +1712,9 @@ { /* Plane B vertical scroll */ #ifdef LSB_FIRST - v_line = (line + ((vs[column] >> 16) & 0x3FF)) & pf_row_mask; + v_line = (line + (vs[column] >> 16)) & pf_row_mask; #else - v_line = (line + (vs[column] & 0x3FF)) & pf_row_mask; + v_line = (line + vs[column]) & pf_row_mask; #endif /* Plane B name table */ @@ -1793,9 +1792,9 @@ { /* Plane A vertical scroll */ #ifdef LSB_FIRST - v_line = (line + (vs[column] & 0x3FF)) & pf_row_mask; + v_line = (line + vs[column]) & pf_row_mask; #else - v_line = (line + ((vs[column] >> 16) & 0x3FF)) & pf_row_mask; + v_line = (line + (vs[column] >> 16)) & pf_row_mask; #endif /* Plane A name table */ @@ -1858,11 +1857,11 @@ #ifdef LSB_FIRST uint32 shift = (xscroll >> 16) & 0x0F; uint32 index = pf_col_mask + 1 - ((xscroll >> 20) & pf_col_mask); - uint32 v_line = (line + ((yscroll >> 17) & 0x3FF)) & pf_row_mask; + uint32 v_line = (line + (yscroll >> 17)) & pf_row_mask; #else uint32 shift = (xscroll & 0x0F); uint32 index = pf_col_mask + 1 - ((xscroll >> 4) & pf_col_mask); - uint32 v_line = (line + ((yscroll >> 1) & 0x3FF)) & pf_row_mask; + uint32 v_line = (line + (yscroll >> 1)) & pf_row_mask; #endif /* Plane B name table */ @@ -1915,11 +1914,11 @@ #ifdef LSB_FIRST shift = (xscroll & 0x0F); index = pf_col_mask + start + 1 - ((xscroll >> 4) & pf_col_mask); - v_line = (line + ((yscroll >> 1) & 0x3FF)) & pf_row_mask; + v_line = (line + (yscroll >> 1)) & pf_row_mask; #else shift = (xscroll >> 16) & 0x0F; index = pf_col_mask + start + 1 - ((xscroll >> 20) & pf_col_mask); - v_line = (line + ((yscroll >> 17) & 0x3FF)) & pf_row_mask; + v_line = (line + (yscroll >> 17)) & pf_row_mask; #endif /* Plane A name table */ @@ -2021,7 +2020,6 @@ if (reg[12] & 1) { yscroll = (vs[19] >> 1) & (vs[19] >> 17); - yscroll &= 0x3FF; } if(shift) @@ -2051,9 +2049,9 @@ { /* Plane B vertical scroll */ #ifdef LSB_FIRST - v_line = (line + ((vs[column] >> 17) & 0x3FF)) & pf_row_mask; + v_line = (line + (vs[column] >> 17)) & pf_row_mask; #else - v_line = (line + ((vs[column] >> 1) & 0x3FF)) & pf_row_mask; + v_line = (line + (vs[column] >> 1)) & pf_row_mask; #endif /* Plane B name table */ @@ -2131,9 +2129,9 @@ { /* Plane A vertical scroll */ #ifdef LSB_FIRST - v_line = (line + ((vs[column] >> 1) & 0x3FF)) & pf_row_mask; + v_line = (line + (vs[column] >> 1)) & pf_row_mask; #else - v_line = (line + ((vs[column] >> 17) & 0x3FF)) & pf_row_mask; + v_line = (line + (vs[column] >> 17)) & pf_row_mask; #endif /* Plane A name table */ @@ -2178,6 +2176,7 @@ int column, start, end; uint32 atex, atbuf, *src, *dst; uint32 shift, index, v_line, *nt; + uint8 *lb; /* Scroll Planes common data */ uint32 xscroll = *(uint32 *)&vram[hscb + ((line & hscroll_mask) << 2)]; @@ -2223,11 +2222,11 @@ #ifdef LSB_FIRST shift = (xscroll & 0x0F); index = pf_col_mask + start + 1 - ((xscroll >> 4) & pf_col_mask); - v_line = (line + (yscroll & 0x3FF)) & pf_row_mask; + v_line = (line + yscroll) & pf_row_mask; #else shift = (xscroll >> 16) & 0x0F; index = pf_col_mask + start + 1 - ((xscroll >> 20) & pf_col_mask); - v_line = (line + ((yscroll >> 16) & 0x3FF)) & pf_row_mask; + v_line = (line + (yscroll >> 16)) & pf_row_mask; #endif /* Background line buffer */ @@ -2297,11 +2296,11 @@ #ifdef LSB_FIRST shift = (xscroll >> 16) & 0x0F; index = pf_col_mask + 1 - ((xscroll >> 20) & pf_col_mask); - v_line = (line + ((yscroll >> 16) & 0x3FF)) & pf_row_mask; + v_line = (line + (yscroll >> 16)) & pf_row_mask; #else shift = (xscroll & 0x0F); index = pf_col_mask + 1 - ((xscroll >> 4) & pf_col_mask); - v_line = (line + (yscroll & 0x3FF)) & pf_row_mask; + v_line = (line + yscroll) & pf_row_mask; #endif /* Plane B name table */ @@ -2311,7 +2310,7 @@ v_line = (v_line & 7) << 3; /* Background line buffer */ - uint8 *lb = &linebuf[0][0x20]; + lb = &linebuf[0][0x20]; if(shift) { @@ -2334,6 +2333,7 @@ int column, start, end; uint32 atex, atbuf, *src, *dst; uint32 shift, index, v_line, *nt; + uint8 *lb; /* Scroll Planes common data */ uint32 xscroll = *(uint32 *)&vram[hscb + ((line & hscroll_mask) << 2)]; @@ -2372,7 +2372,6 @@ if (reg[12] & 1) { yscroll = vs[19] & (vs[19] >> 16); - yscroll &= 0x3FF; } /* Number of columns to draw */ @@ -2428,9 +2427,9 @@ { /* Plane A vertical scroll */ #ifdef LSB_FIRST - v_line = (line + (vs[column] & 0x3FF)) & pf_row_mask; + v_line = (line + vs[column]) & pf_row_mask; #else - v_line = (line + ((vs[column] >> 16) & 0x3FF)) & pf_row_mask; + v_line = (line + (vs[column] >> 16)) & pf_row_mask; #endif /* Plane A name table */ @@ -2483,7 +2482,7 @@ #endif /* Background line buffer */ - uint8 *lb = &linebuf[0][0x20]; + lb = &linebuf[0][0x20]; if(shift) { @@ -2507,9 +2506,9 @@ { /* Plane B vertical scroll */ #ifdef LSB_FIRST - v_line = (line + ((vs[column] >> 16) & 0x3FF)) & pf_row_mask; + v_line = (line + (vs[column] >> 16)) & pf_row_mask; #else - v_line = (line + (vs[column] & 0x3FF)) & pf_row_mask; + v_line = (line + vs[column]) & pf_row_mask; #endif /* Plane B name table */ @@ -2528,6 +2527,7 @@ int column, start, end; uint32 atex, atbuf, *src, *dst; uint32 shift, index, v_line, *nt; + uint8 *lb; /* Scroll Planes common data */ int odd = odd_frame; @@ -2574,11 +2574,11 @@ #ifdef LSB_FIRST shift = (xscroll & 0x0F); index = pf_col_mask + start + 1 - ((xscroll >> 4) & pf_col_mask); - v_line = (line + ((yscroll >> 1) & 0x3FF)) & pf_row_mask; + v_line = (line + (yscroll >> 1)) & pf_row_mask; #else shift = (xscroll >> 16) & 0x0F; index = pf_col_mask + start + 1 - ((xscroll >> 20) & pf_col_mask); - v_line = (line + ((yscroll >> 17) & 0x3FF)) & pf_row_mask; + v_line = (line + (yscroll >> 17)) & pf_row_mask; #endif /* Background line buffer */ @@ -2648,11 +2648,11 @@ #ifdef LSB_FIRST shift = (xscroll >> 16) & 0x0F; index = pf_col_mask + 1 - ((xscroll >> 20) & pf_col_mask); - v_line = (line + ((yscroll >> 17) & 0x3FF)) & pf_row_mask; + v_line = (line + (yscroll >> 17)) & pf_row_mask; #else shift = (xscroll & 0x0F); index = pf_col_mask + 1 - ((xscroll >> 4) & pf_col_mask); - v_line = (line + ((yscroll >> 1) & 0x3FF)) & pf_row_mask; + v_line = (line + (yscroll >> 1)) & pf_row_mask; #endif /* Plane B name table */ @@ -2662,7 +2662,7 @@ v_line = (((v_line & 7) << 1) | odd) << 3; /* Background line buffer */ - uint8 *lb = &linebuf[0][0x20]; + lb = &linebuf[0][0x20]; if(shift) { @@ -2685,6 +2685,7 @@ int column, start, end; uint32 atex, atbuf, *src, *dst; uint32 shift, index, v_line, *nt; + uint8 *lb; /* common data */ int odd = odd_frame; @@ -2725,7 +2726,6 @@ { /* only in 40-cell mode, verified on MD2 */ yscroll = (vs[19] >> 1) & (vs[19] >> 17); - yscroll &= 0x3FF; } /* Number of columns to draw */ @@ -2781,9 +2781,9 @@ { /* Plane A vertical scroll */ #ifdef LSB_FIRST - v_line = (line + ((vs[column] >> 1) & 0x3FF)) & pf_row_mask; + v_line = (line + (vs[column] >> 1)) & pf_row_mask; #else - v_line = (line + ((vs[column] >> 17) & 0x3FF)) & pf_row_mask; + v_line = (line + (vs[column] >> 17)) & pf_row_mask; #endif /* Plane A name table */ @@ -2836,7 +2836,7 @@ #endif /* Background line buffer */ - uint8 *lb = &linebuf[0][0x20]; + lb = &linebuf[0][0x20]; if(shift) { @@ -2860,9 +2860,9 @@ { /* Plane B vertical scroll */ #ifdef LSB_FIRST - v_line = (line + ((vs[column] >> 17) & 0x3FF)) & pf_row_mask; + v_line = (line + (vs[column] >> 17)) & pf_row_mask; #else - v_line = (line + ((vs[column] >> 1) & 0x3FF)) & pf_row_mask; + v_line = (line + (vs[column] >> 1)) & pf_row_mask; #endif /* Plane B name table */ diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/win/fileio.c libretro-genesisplusgx-0.6~filthypants4/source/win/fileio.c --- libretro-genesisplusgx-0.6~filthypants2/source/win/fileio.c 2012-08-15 15:21:19.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/win/fileio.c 2013-04-29 16:28:56.000000000 +0000 @@ -41,7 +41,6 @@ ****************************************************************************************/ #include "shared.h" -#include #include static int check_zip(char *filename); diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/win/main.c libretro-genesisplusgx-0.6~filthypants4/source/win/main.c --- libretro-genesisplusgx-0.6~filthypants2/source/win/main.c 2012-10-17 20:00:52.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/win/main.c 2013-04-29 16:28:56.000000000 +0000 @@ -1,4 +1,8 @@ +#ifdef __WIN32__ #include +#else +#define MessageBox(owner, text, caption, type) printf("%s: %s\n", caption, text) +#endif #include "SDL.h" #include "SDL_thread.h" @@ -148,7 +152,6 @@ sdl_video.surf_bitmap = SDL_CreateRGBSurface(SDL_SWSURFACE, 720, 576, 16, 0, 0, 0, 0); sdl_video.frames_rendered = 0; SDL_ShowCursor(0); - return 1; } @@ -197,7 +200,8 @@ /* clear destination surface */ SDL_FillRect(sdl_video.surf_screen, 0, 0); - /*if (config.render && (interlaced || config.ntsc)) rect.h *= 2; +#if 0 + if (config.render && (interlaced || config.ntsc)) rect.h *= 2; if (config.ntsc) rect.w = (reg[12]&1) ? MD_NTSC_OUT_WIDTH(rect.w) : SMS_NTSC_OUT_WIDTH(rect.w); if (config.ntsc) { @@ -233,7 +237,8 @@ free(md_ntsc); md_ntsc = NULL; } - } */ + } +#endif } SDL_BlitSurface(sdl_video.surf_bitmap, &sdl_video.srect, sdl_video.surf_screen, &sdl_video.drect); @@ -257,19 +262,25 @@ unsigned ticks; } sdl_sync; -/* sync */ - static Uint32 sdl_sync_timer_callback(Uint32 interval) { - char caption[100]; SDL_SemPost(sdl_sync.sem_sync); sdl_sync.ticks++; if (sdl_sync.ticks == (vdp_pal ? 50 : 20)) { - int fps = vdp_pal ? (sdl_video.frames_rendered / 3) : sdl_video.frames_rendered; + SDL_Event event; + SDL_UserEvent userevent; + + userevent.type = SDL_USEREVENT; + userevent.code = vdp_pal ? (sdl_video.frames_rendered / 3) : sdl_video.frames_rendered; + userevent.data1 = NULL; + userevent.data2 = NULL; sdl_sync.ticks = sdl_video.frames_rendered = 0; - sprintf(caption,"%d fps - %s", fps, (rominfo.international[0] != 0x20) ? rominfo.international : rominfo.domestic); - SDL_WM_SetCaption(caption, NULL); + + event.type = SDL_USEREVENT; + event.user = userevent; + + SDL_PushEvent(&event); } return interval; } @@ -312,6 +323,13 @@ break; } + case SDLK_F1: + { + if (SDL_ShowCursor(-1)) SDL_ShowCursor(0); + else SDL_ShowCursor(1); + break; + } + case SDLK_F2: { if (fullscreen) fullscreen = 0; @@ -484,13 +502,15 @@ { case DEVICE_LIGHTGUN: { - /* get mouse (absolute values) */ + /* get mouse coordinates (absolute values) */ int x,y; int state = SDL_GetMouseState(&x,&y); - /* Calculate X Y axis values */ - input.analog[joynum][0] = (x * bitmap.viewport.w) / VIDEO_WIDTH; - input.analog[joynum][1] = (y * bitmap.viewport.h) / VIDEO_HEIGHT; + /* X axis */ + input.analog[joynum][0] = x - (VIDEO_WIDTH-bitmap.viewport.w)/2; + + /* Y axis */ + input.analog[joynum][1] = y - (VIDEO_HEIGHT-bitmap.viewport.h)/2; /* TRIGGER, B, C (Menacer only), START (Menacer & Justifier only) */ if(state & SDL_BUTTON_LMASK) input.pad[joynum] |= INPUT_A; @@ -658,8 +678,6 @@ break; } } - - free (keystate); return 1; } @@ -834,13 +852,25 @@ { switch(event.type) { + case SDL_USEREVENT: + { + char caption[100]; + sprintf(caption,"Genesis Plus GX - %d fps - %s)", event.user.code, (rominfo.international[0] != 0x20) ? rominfo.international : rominfo.domestic); + SDL_WM_SetCaption(caption, NULL); + break; + } + case SDL_QUIT: + { running = 0; break; + } case SDL_KEYDOWN: + { running = sdl_control_update(event.key.keysym.sym); break; + } } } diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/win/osd.h libretro-genesisplusgx-0.6~filthypants4/source/win/osd.h --- libretro-genesisplusgx-0.6~filthypants2/source/win/osd.h 2012-08-15 15:21:19.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/win/osd.h 2013-04-29 16:28:56.000000000 +0000 @@ -6,7 +6,6 @@ #include #include #include -#include #include #include diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/z80/z80.c libretro-genesisplusgx-0.6~filthypants4/source/z80/z80.c --- libretro-genesisplusgx-0.6~filthypants2/source/z80/z80.c 2012-08-15 15:21:19.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/z80/z80.c 2013-04-29 16:28:56.000000000 +0000 @@ -31,6 +31,7 @@ * This Z80 emulator assumes a ZiLOG NMOS model. * * Additional changes [Eke-Eke]: + * - Removed z80_burn function (unused) * - Discarded multi-chip support (unused) * - Fixed cycle counting for FD and DD prefixed instructions * - Fixed behavior of chained FD and DD prefixes (R register should be only incremented by one @@ -3358,11 +3359,9 @@ Z80.daisy = config; Z80.irq_callback = irqcallback; - /* Reset registers to their initial values (NB: should be random on real hardware) */ - AF = BC = DE = HL = 0; + /* Clear registers values (NB: should be random on real hardware ?) */ + AF = BC = DE = HL = SP = IX = IY =0; F = ZF; /* Zero flag is set */ - IX = IY = 0xffff; /* IX and IY are FFFF after a reset! (from MAME) */ - SP = 0xdfff; /* required by some SMS games that don't initialize SP */ /* setup cycle tables */ cc[Z80_TABLE_op] = cc_op; @@ -3412,20 +3411,6 @@ } /**************************************************************************** - * Burn 'cycles' T-states. Adjust R register for the lost time - ****************************************************************************/ -void z80_burn(unsigned int cycles) -{ - if( cycles > 0 ) - { - /* NOP takes 4 cycles per instruction */ - int n = (cycles + 3) / 4; - R += n; - Z80.cycles += 4 * n * 15; - } -} - -/**************************************************************************** * Get all registers in given buffer ****************************************************************************/ void z80_get_context (void *dst) diff -Nru libretro-genesisplusgx-0.6~filthypants2/source/z80/z80.h libretro-genesisplusgx-0.6~filthypants4/source/z80/z80.h --- libretro-genesisplusgx-0.6~filthypants2/source/z80/z80.h 2012-08-15 15:21:19.000000000 +0000 +++ libretro-genesisplusgx-0.6~filthypants4/source/z80/z80.h 2013-04-29 16:28:56.000000000 +0000 @@ -62,7 +62,6 @@ extern void z80_init(const void *config, int (*irqcallback)(int)); extern void z80_reset (void); extern void z80_run(unsigned int cycles); -extern void z80_burn(unsigned int cycles); extern void z80_get_context (void *dst); extern void z80_set_context (void *src); extern void z80_set_irq_line(unsigned int state);