mirror of
https://github.com/libretro/beetle-lynx-libretro.git
synced 2024-11-23 00:00:50 +00:00
Cleanups
This commit is contained in:
parent
de0d520d67
commit
a9eb7397be
18
Makefile
18
Makefile
@ -29,7 +29,7 @@ core = lynx
|
|||||||
NEED_BPP = 32
|
NEED_BPP = 32
|
||||||
NEED_BLIP = 1
|
NEED_BLIP = 1
|
||||||
NEED_STEREO_SOUND = 1
|
NEED_STEREO_SOUND = 1
|
||||||
CORE_DEFINE := -DWANT_LYNX_EMU
|
CORE_DEFINE :=
|
||||||
NEED_CRC32 = 1
|
NEED_CRC32 = 1
|
||||||
|
|
||||||
prefix := /usr
|
prefix := /usr
|
||||||
@ -313,7 +313,6 @@ else ifneq (,$(findstring armv,$(platform)))
|
|||||||
fpic := -fPIC
|
fpic := -fPIC
|
||||||
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
|
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
|
||||||
CC = gcc
|
CC = gcc
|
||||||
IS_X86 = 0
|
|
||||||
ifneq (,$(findstring cortexa8,$(platform)))
|
ifneq (,$(findstring cortexa8,$(platform)))
|
||||||
FLAGS += -marm -mcpu=cortex-a8
|
FLAGS += -marm -mcpu=cortex-a8
|
||||||
ASFLAGS += -mcpu=cortex-a8
|
ASFLAGS += -mcpu=cortex-a8
|
||||||
@ -356,7 +355,6 @@ else ifeq ($(platform), windows_msvc2010_x64)
|
|||||||
|
|
||||||
NO_GCC := 1
|
NO_GCC := 1
|
||||||
WINDOWS_VERSION = 1
|
WINDOWS_VERSION = 1
|
||||||
IS_X86 = 1
|
|
||||||
|
|
||||||
PATH := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/bin/amd64"):$(PATH)
|
PATH := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/bin/amd64"):$(PATH)
|
||||||
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../IDE")
|
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../IDE")
|
||||||
@ -373,7 +371,6 @@ else ifeq ($(platform), windows_msvc2010_x64)
|
|||||||
export INCLUDE := $(INCLUDE)
|
export INCLUDE := $(INCLUDE)
|
||||||
export LIB := $(LIB);$(WindowsSdkDir)
|
export LIB := $(LIB);$(WindowsSdkDir)
|
||||||
TARGET := $(TARGET_NAME)_libretro.dll
|
TARGET := $(TARGET_NAME)_libretro.dll
|
||||||
PSS_STYLE :=2
|
|
||||||
LDFLAGS += -DLL
|
LDFLAGS += -DLL
|
||||||
|
|
||||||
# Windows MSVC 2010 x86
|
# Windows MSVC 2010 x86
|
||||||
@ -383,7 +380,6 @@ else ifeq ($(platform), windows_msvc2010_x86)
|
|||||||
|
|
||||||
NO_GCC := 1
|
NO_GCC := 1
|
||||||
WINDOWS_VERSION = 1
|
WINDOWS_VERSION = 1
|
||||||
IS_X86 = 1
|
|
||||||
|
|
||||||
PATH := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/bin"):$(PATH)
|
PATH := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/bin"):$(PATH)
|
||||||
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../IDE")
|
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../IDE")
|
||||||
@ -400,7 +396,6 @@ else ifeq ($(platform), windows_msvc2010_x86)
|
|||||||
export INCLUDE := $(INCLUDE)
|
export INCLUDE := $(INCLUDE)
|
||||||
export LIB := $(LIB);$(WindowsSdkDir)
|
export LIB := $(LIB);$(WindowsSdkDir)
|
||||||
TARGET := $(TARGET_NAME)_libretro.dll
|
TARGET := $(TARGET_NAME)_libretro.dll
|
||||||
PSS_STYLE :=2
|
|
||||||
LDFLAGS += -DLL
|
LDFLAGS += -DLL
|
||||||
|
|
||||||
# Windows MSVC 2005 x86
|
# Windows MSVC 2005 x86
|
||||||
@ -410,7 +405,6 @@ else ifeq ($(platform), windows_msvc2005_x86)
|
|||||||
|
|
||||||
NO_GCC := 1
|
NO_GCC := 1
|
||||||
WINDOWS_VERSION = 1
|
WINDOWS_VERSION = 1
|
||||||
IS_X86 = 1
|
|
||||||
|
|
||||||
PATH := $(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../../VC/bin"):$(PATH)
|
PATH := $(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../../VC/bin"):$(PATH)
|
||||||
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../IDE")
|
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../IDE")
|
||||||
@ -423,7 +417,6 @@ else ifeq ($(platform), windows_msvc2005_x86)
|
|||||||
export INCLUDE := $(INCLUDE);$(INETSDK)/Include;libretro-common/include/compat/msvc
|
export INCLUDE := $(INCLUDE);$(INETSDK)/Include;libretro-common/include/compat/msvc
|
||||||
export LIB := $(LIB);$(WindowsSdkDir);$(INETSDK)/Lib
|
export LIB := $(LIB);$(WindowsSdkDir);$(INETSDK)/Lib
|
||||||
TARGET := $(TARGET_NAME)_libretro.dll
|
TARGET := $(TARGET_NAME)_libretro.dll
|
||||||
PSS_STYLE :=2
|
|
||||||
LDFLAGS += -DLL
|
LDFLAGS += -DLL
|
||||||
CFLAGS += -D_CRT_SECURE_NO_DEPRECATE
|
CFLAGS += -D_CRT_SECURE_NO_DEPRECATE
|
||||||
LIBS =
|
LIBS =
|
||||||
@ -437,12 +430,10 @@ else ifeq ($(platform), xbox1_msvc2003)
|
|||||||
|
|
||||||
NO_GCC := 1
|
NO_GCC := 1
|
||||||
WINDOWS_VERSION = 1
|
WINDOWS_VERSION = 1
|
||||||
IS_X86 = 1
|
|
||||||
|
|
||||||
export INCLUDE := $(XDK)/xbox/include
|
export INCLUDE := $(XDK)/xbox/include
|
||||||
export LIB := $(XDK)/xbox/lib
|
export LIB := $(XDK)/xbox/lib
|
||||||
PATH := $(call unixcygpath,$(XDK)/xbox/bin/vc71):$(PATH)
|
PATH := $(call unixcygpath,$(XDK)/xbox/bin/vc71):$(PATH)
|
||||||
PSS_STYLE :=2
|
|
||||||
CFLAGS += -D_XBOX -D_XBOX1
|
CFLAGS += -D_XBOX -D_XBOX1
|
||||||
CXXFLAGS += -D_XBOX -D_XBOX1
|
CXXFLAGS += -D_XBOX -D_XBOX1
|
||||||
STATIC_LINKING=1
|
STATIC_LINKING=1
|
||||||
@ -454,7 +445,6 @@ else ifeq ($(platform), windows_msvc2003_x86)
|
|||||||
|
|
||||||
NO_GCC := 1
|
NO_GCC := 1
|
||||||
WINDOWS_VERSION = 1
|
WINDOWS_VERSION = 1
|
||||||
IS_X86 = 1
|
|
||||||
|
|
||||||
PATH := $(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../../Vc7/bin"):$(PATH)
|
PATH := $(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../../Vc7/bin"):$(PATH)
|
||||||
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../IDE")
|
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../IDE")
|
||||||
@ -467,7 +457,6 @@ else ifeq ($(platform), windows_msvc2003_x86)
|
|||||||
export INCLUDE := $(INCLUDE);$(INETSDK)/Include;libretro-common/include/compat/msvc
|
export INCLUDE := $(INCLUDE);$(INETSDK)/Include;libretro-common/include/compat/msvc
|
||||||
export LIB := $(LIB);$(WindowsSdkDir);$(INETSDK)/Lib
|
export LIB := $(LIB);$(WindowsSdkDir);$(INETSDK)/Lib
|
||||||
TARGET := $(TARGET_NAME)_libretro.dll
|
TARGET := $(TARGET_NAME)_libretro.dll
|
||||||
PSS_STYLE :=2
|
|
||||||
LDFLAGS += -DLL
|
LDFLAGS += -DLL
|
||||||
CFLAGS += -D_CRT_SECURE_NO_DEPRECATE
|
CFLAGS += -D_CRT_SECURE_NO_DEPRECATE
|
||||||
WINDOWS_VERSION=1
|
WINDOWS_VERSION=1
|
||||||
@ -480,7 +469,6 @@ else ifneq (,$(findstring windows_msvc2017,$(platform)))
|
|||||||
|
|
||||||
NO_GCC := 1
|
NO_GCC := 1
|
||||||
WINDOWS_VERSION = 1
|
WINDOWS_VERSION = 1
|
||||||
IS_X86 = 1
|
|
||||||
|
|
||||||
PlatformSuffix = $(subst windows_msvc2017_,,$(platform))
|
PlatformSuffix = $(subst windows_msvc2017_,,$(platform))
|
||||||
ifneq (,$(findstring desktop,$(PlatformSuffix)))
|
ifneq (,$(findstring desktop,$(PlatformSuffix)))
|
||||||
@ -566,7 +554,6 @@ else ifneq (,$(findstring windows_msvc2017,$(platform)))
|
|||||||
export INCLUDE := $(INCLUDE);$(WindowsSDKSharedIncludeDir);$(WindowsSDKUCRTIncludeDir);$(WindowsSDKUMIncludeDir)
|
export INCLUDE := $(INCLUDE);$(WindowsSDKSharedIncludeDir);$(WindowsSDKUCRTIncludeDir);$(WindowsSDKUMIncludeDir)
|
||||||
export LIB := $(LIB);$(WindowsSDKUCRTLibDir);$(WindowsSDKUMLibDir)
|
export LIB := $(LIB);$(WindowsSDKUCRTLibDir);$(WindowsSDKUMLibDir)
|
||||||
TARGET := $(TARGET_NAME)_libretro.dll
|
TARGET := $(TARGET_NAME)_libretro.dll
|
||||||
PSS_STYLE :=2
|
|
||||||
LDFLAGS += -DLL
|
LDFLAGS += -DLL
|
||||||
|
|
||||||
# Windows
|
# Windows
|
||||||
@ -574,7 +561,6 @@ else
|
|||||||
TARGET := $(TARGET_NAME)_libretro.dll
|
TARGET := $(TARGET_NAME)_libretro.dll
|
||||||
CC ?= gcc
|
CC ?= gcc
|
||||||
CXX ?= g++
|
CXX ?= g++
|
||||||
IS_X86 = 1
|
|
||||||
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
|
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
|
||||||
LDFLAGS += -static-libgcc -static-libstdc++ -lwinmm
|
LDFLAGS += -static-libgcc -static-libstdc++ -lwinmm
|
||||||
endif
|
endif
|
||||||
@ -614,7 +600,7 @@ LDFLAGS += $(fpic) $(SHARED)
|
|||||||
FLAGS += $(fpic) $(NEW_GCC_FLAGS)
|
FLAGS += $(fpic) $(NEW_GCC_FLAGS)
|
||||||
FLAGS += $(INCFLAGS) $(INCFLAGS_PLATFORM)
|
FLAGS += $(INCFLAGS) $(INCFLAGS_PLATFORM)
|
||||||
|
|
||||||
FLAGS += $(ENDIANNESS_DEFINES) -DSIZEOF_DOUBLE=8 $(WARNINGS) -DMEDNAFEN_VERSION=\"1.24.0\" -DPACKAGE=\"mednafen\" -DMEDNAFEN_VERSION_NUMERIC=1240 -DPSS_STYLE=1 -DMPC_FIXED_POINT $(CORE_DEFINE) -DSTDC_HEADERS -D__STDC_LIMIT_MACROS -D__LIBRETRO__ -D_LOW_ACCURACY_ $(EXTRA_INCLUDES) $(SOUND_DEFINE)
|
FLAGS += $(ENDIANNESS_DEFINES) $(WARNINGS) -DMEDNAFEN_VERSION_NUMERIC=1240 $(CORE_DEFINE) -DSTDC_HEADERS -D__STDC_LIMIT_MACROS -D__LIBRETRO__ $(EXTRA_INCLUDES) $(SOUND_DEFINE)
|
||||||
|
|
||||||
ifneq ($(SANITIZER),)
|
ifneq ($(SANITIZER),)
|
||||||
CFLAGS += -fsanitize=$(SANITIZER)
|
CFLAGS += -fsanitize=$(SANITIZER)
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
SOURCES_CXX :=
|
|
||||||
SOURCES_C :=
|
|
||||||
|
|
||||||
MEDNAFEN_DIR := $(CORE_DIR)/mednafen
|
MEDNAFEN_DIR := $(CORE_DIR)/mednafen
|
||||||
CORE_EMU_DIR := $(MEDNAFEN_DIR)/lynx
|
CORE_EMU_DIR := $(MEDNAFEN_DIR)/lynx
|
||||||
LIBRETRO_COMM_DIR := $(CORE_DIR)/libretro-common
|
LIBRETRO_COMM_DIR := $(CORE_DIR)/libretro-common
|
||||||
@ -11,8 +8,8 @@ ifneq (,$(findstring msvc2003,$(platform)))
|
|||||||
INCFLAGS += -I$(LIBRETRO_COMM_DIR)/include/compat/msvc
|
INCFLAGS += -I$(LIBRETRO_COMM_DIR)/include/compat/msvc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(HAVE_GRIFFIN),1)
|
SOURCES_C :=
|
||||||
SOURCES_CXX += \
|
SOURCES_CXX := \
|
||||||
$(CORE_EMU_DIR)/cart.cpp \
|
$(CORE_EMU_DIR)/cart.cpp \
|
||||||
$(CORE_EMU_DIR)/c65c02.cpp \
|
$(CORE_EMU_DIR)/c65c02.cpp \
|
||||||
$(CORE_EMU_DIR)/memmap.cpp \
|
$(CORE_EMU_DIR)/memmap.cpp \
|
||||||
@ -21,17 +18,11 @@ SOURCES_CXX += \
|
|||||||
$(CORE_EMU_DIR)/rom.cpp \
|
$(CORE_EMU_DIR)/rom.cpp \
|
||||||
$(CORE_EMU_DIR)/susie.cpp \
|
$(CORE_EMU_DIR)/susie.cpp \
|
||||||
$(CORE_EMU_DIR)/system.cpp
|
$(CORE_EMU_DIR)/system.cpp
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(NEED_BLIP), 1)
|
ifeq ($(NEED_BLIP), 1)
|
||||||
SOURCES_CXX += $(MEDNAFEN_DIR)/sound/Blip_Buffer.cpp
|
SOURCES_CXX += $(MEDNAFEN_DIR)/sound/Blip_Buffer.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(NEED_THREADING), 1)
|
|
||||||
FLAGS += -DWANT_THREADING
|
|
||||||
SOURCES_C += $(CORE_DIR)/threads.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(NEED_CRC32), 1)
|
ifeq ($(NEED_CRC32), 1)
|
||||||
FLAGS += -DWANT_CRC32
|
FLAGS += -DWANT_CRC32
|
||||||
SOURCES_C += $(CORE_DIR)/scrc32.c
|
SOURCES_C += $(CORE_DIR)/scrc32.c
|
||||||
@ -41,10 +32,6 @@ ifeq ($(NEED_DEINTERLACER), 1)
|
|||||||
FLAGS += -DNEED_DEINTERLACER
|
FLAGS += -DNEED_DEINTERLACER
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(IS_X86), 1)
|
|
||||||
FLAGS += -DARCH_X86
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(NEED_BPP), 8)
|
ifeq ($(NEED_BPP), 8)
|
||||||
FLAGS += -DWANT_8BPP
|
FLAGS += -DWANT_8BPP
|
||||||
endif
|
endif
|
||||||
@ -53,10 +40,6 @@ ifeq ($(NEED_BPP), 16)
|
|||||||
FLAGS += -DWANT_16BPP
|
FLAGS += -DWANT_16BPP
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(NEED_BPP), 32)
|
|
||||||
FLAGS += -DWANT_32BPP
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(WANT_NEW_API), 1)
|
ifeq ($(WANT_NEW_API), 1)
|
||||||
FLAGS += -DWANT_NEW_API
|
FLAGS += -DWANT_NEW_API
|
||||||
endif
|
endif
|
||||||
@ -77,7 +60,6 @@ ifneq ($(HAVE_NO_LANGEXTRA), 1)
|
|||||||
FLAGS += -DHAVE_NO_LANGEXTRA
|
FLAGS += -DHAVE_NO_LANGEXTRA
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(HAVE_GRIFFIN), 1)
|
|
||||||
SOURCES_CXX += \
|
SOURCES_CXX += \
|
||||||
$(MEDNAFEN_DIR)/settings.cpp \
|
$(MEDNAFEN_DIR)/settings.cpp \
|
||||||
$(MEDNAFEN_DIR)/state.cpp \
|
$(MEDNAFEN_DIR)/state.cpp \
|
||||||
@ -104,4 +86,3 @@ endif
|
|||||||
|
|
||||||
SOURCES_C += \
|
SOURCES_C += \
|
||||||
$(MEDNAFEN_DIR)/file.c
|
$(MEDNAFEN_DIR)/file.c
|
||||||
endif
|
|
||||||
|
@ -8,17 +8,11 @@ NEED_BPP := 32
|
|||||||
NEED_BLIP := 1
|
NEED_BLIP := 1
|
||||||
NEED_STEREO_SOUND := 1
|
NEED_STEREO_SOUND := 1
|
||||||
NEED_CRC32 := 1
|
NEED_CRC32 := 1
|
||||||
IS_X86 := 0
|
|
||||||
FLAGS :=
|
FLAGS :=
|
||||||
|
|
||||||
ifeq ($(TARGET_ARCH),x86)
|
|
||||||
IS_X86 := 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
include $(CORE_DIR)/Makefile.common
|
include $(CORE_DIR)/Makefile.common
|
||||||
|
|
||||||
COREFLAGS := -funroll-loops $(INCFLAGS) -DMEDNAFEN_VERSION=\"0.9.26\" -DMEDNAFEN_VERSION_NUMERIC=926 -DPSS_STYLE=1 -D__LIBRETRO__ -D_LOW_ACCURACY_ -DINLINE="inline" $(FLAGS)
|
COREFLAGS := -funroll-loops $(INCFLAGS) -DMEDNAFEN_VERSION_NUMERIC=926 -D__LIBRETRO__ -DINLINE="inline" $(FLAGS)
|
||||||
COREFLAGS += -DWANT_LYNX_EMU
|
|
||||||
|
|
||||||
GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
|
GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
|
||||||
ifneq ($(GIT_VERSION)," unknown")
|
ifneq ($(GIT_VERSION)," unknown")
|
||||||
|
219
libretro.cpp
219
libretro.cpp
@ -15,9 +15,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static char slash = '\\';
|
#define SLASH "\\"
|
||||||
#else
|
#else
|
||||||
static char slash = '/';
|
#define SLASH "/"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct retro_perf_callback perf_cb;
|
struct retro_perf_callback perf_cb;
|
||||||
@ -31,7 +31,6 @@ static retro_input_poll_t input_poll_cb;
|
|||||||
static retro_input_state_t input_state_cb;
|
static retro_input_state_t input_state_cb;
|
||||||
|
|
||||||
static bool overscan;
|
static bool overscan;
|
||||||
static double last_sound_rate;
|
|
||||||
static MDFN_PixelFormat last_pixel_format;
|
static MDFN_PixelFormat last_pixel_format;
|
||||||
|
|
||||||
static unsigned rotate_mode;
|
static unsigned rotate_mode;
|
||||||
@ -42,12 +41,6 @@ static unsigned select_pressed_last_frame;
|
|||||||
|
|
||||||
static MDFN_Surface *surf;
|
static MDFN_Surface *surf;
|
||||||
|
|
||||||
static bool failed_init;
|
|
||||||
|
|
||||||
static void hookup_ports(bool force);
|
|
||||||
|
|
||||||
static bool initial_ports_hookup = false;
|
|
||||||
|
|
||||||
static bool libretro_supports_option_categories = false;
|
static bool libretro_supports_option_categories = false;
|
||||||
|
|
||||||
static char retro_system_directory[4096];
|
static char retro_system_directory[4096];
|
||||||
@ -73,8 +66,6 @@ MDFNGI *MDFNGameInfo = &EmulatedLynx;
|
|||||||
|
|
||||||
#define FB_MAX_HEIGHT FB_HEIGHT
|
#define FB_MAX_HEIGHT FB_HEIGHT
|
||||||
|
|
||||||
const char *mednafen_core_str = MEDNAFEN_CORE_NAME;
|
|
||||||
|
|
||||||
static void check_system_specs(void)
|
static void check_system_specs(void)
|
||||||
{
|
{
|
||||||
unsigned level = 0;
|
unsigned level = 0;
|
||||||
@ -83,14 +74,13 @@ static void check_system_specs(void)
|
|||||||
|
|
||||||
void retro_init(void)
|
void retro_init(void)
|
||||||
{
|
{
|
||||||
|
const char *dir = NULL;
|
||||||
struct retro_log_callback log;
|
struct retro_log_callback log;
|
||||||
if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
|
if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
|
||||||
log_cb = log.log;
|
log_cb = log.log;
|
||||||
else
|
else
|
||||||
log_cb = NULL;
|
log_cb = NULL;
|
||||||
|
|
||||||
const char *dir = NULL;
|
|
||||||
|
|
||||||
if (environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &dir) && dir)
|
if (environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &dir) && dir)
|
||||||
snprintf(retro_system_directory, sizeof(retro_system_directory), "%s", dir);
|
snprintf(retro_system_directory, sizeof(retro_system_directory), "%s", dir);
|
||||||
|
|
||||||
@ -102,7 +92,7 @@ void retro_init(void)
|
|||||||
check_system_specs();
|
check_system_specs();
|
||||||
|
|
||||||
libretro_set_core_options(environ_cb,
|
libretro_set_core_options(environ_cb,
|
||||||
&libretro_supports_option_categories);
|
&libretro_supports_option_categories);
|
||||||
|
|
||||||
if (environ_cb(RETRO_ENVIRONMENT_GET_INPUT_BITMASKS, NULL))
|
if (environ_cb(RETRO_ENVIRONMENT_GET_INPUT_BITMASKS, NULL))
|
||||||
libretro_supports_input_bitmasks = true;
|
libretro_supports_input_bitmasks = true;
|
||||||
@ -118,16 +108,6 @@ bool retro_load_game_special(unsigned, const struct retro_game_info *, size_t)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_volume (uint32_t *ptr, unsigned number)
|
|
||||||
{
|
|
||||||
switch(number)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
*ptr = number;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void check_variables(void)
|
static void check_variables(void)
|
||||||
{
|
{
|
||||||
struct retro_variable var = {0};
|
struct retro_variable var = {0};
|
||||||
@ -179,42 +159,31 @@ static uint8_t input_buf[2];
|
|||||||
static bool MDFNI_LoadGame(const uint8_t *data, size_t size)
|
static bool MDFNI_LoadGame(const uint8_t *data, size_t size)
|
||||||
{
|
{
|
||||||
if (!data || !size)
|
if (!data || !size)
|
||||||
{
|
MDFNGameInfo = NULL;
|
||||||
MDFN_indent(-2);
|
|
||||||
MDFNGameInfo = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
MDFNFILE *GameFile = file_open_mem(data, size);
|
MDFNFILE *GameFile = file_open_mem(data, size);
|
||||||
|
|
||||||
if (!GameFile)
|
if (!GameFile)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
MDFNGameInfo = &EmulatedLynx;
|
MDFNGameInfo = &EmulatedLynx;
|
||||||
|
|
||||||
MDFN_indent(1);
|
|
||||||
|
|
||||||
MDFN_printf("Using module: lynx\n\n");
|
|
||||||
MDFN_indent(1);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Load per-game settings
|
// Load per-game settings
|
||||||
//
|
//
|
||||||
// Maybe we should make a "pgcfg" subdir, and automatically load all files in it?
|
// Maybe we should make a "pgcfg" subdir,
|
||||||
|
// and automatically load all files in it?
|
||||||
// End load per-game settings
|
// End load per-game settings
|
||||||
//
|
//
|
||||||
char bios_path[2048];
|
char bios_path[2048];
|
||||||
snprintf(bios_path, sizeof(bios_path), "%s%c%s", retro_system_directory, slash, "lynxboot.img");
|
snprintf(bios_path, sizeof(bios_path),"%s" SLASH "%s", retro_system_directory, "lynxboot.img");
|
||||||
|
|
||||||
MDFN_printf("Loading bios: %s\n", bios_path);
|
|
||||||
|
|
||||||
Load(GameFile, bios_path);
|
Load(GameFile, bios_path);
|
||||||
|
|
||||||
MDFN_LoadGameCheats(NULL);
|
MDFN_LoadGameCheats(NULL);
|
||||||
MDFNMP_InstallReadPatches();
|
MDFNMP_InstallReadPatches();
|
||||||
|
|
||||||
MDFN_indent(-2);
|
return true;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool init_pix_format(void)
|
static bool init_pix_format(void)
|
||||||
@ -255,7 +224,7 @@ static bool init_pix_format(void)
|
|||||||
|
|
||||||
bool retro_load_game(const struct retro_game_info *info)
|
bool retro_load_game(const struct retro_game_info *info)
|
||||||
{
|
{
|
||||||
if (!info || failed_init)
|
if (!info)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
struct retro_input_descriptor desc[] = {
|
struct retro_input_descriptor desc[] = {
|
||||||
@ -445,42 +414,31 @@ static void update_input(void)
|
|||||||
rotate_screen_last_frame = rotate_screen;
|
rotate_screen_last_frame = rotate_screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void retro_run()
|
void retro_run(void)
|
||||||
{
|
{
|
||||||
input_poll_cb();
|
static int16_t sound_buf[0x10000];
|
||||||
|
static double last_sound_rate;
|
||||||
|
EmulateSpecStruct spec = {0};
|
||||||
|
bool updated = false;
|
||||||
|
|
||||||
|
input_poll_cb();
|
||||||
update_input();
|
update_input();
|
||||||
|
|
||||||
static int16_t sound_buf[0x10000];
|
spec.surface = surf;
|
||||||
static MDFN_Rect rects[FB_MAX_HEIGHT];
|
spec.SoundRate = 44100;
|
||||||
rects[0].w = ~0;
|
spec.SoundBuf = sound_buf;
|
||||||
|
spec.SoundBufMaxSize = sizeof(sound_buf) / 2;
|
||||||
EmulateSpecStruct spec = {0};
|
spec.SoundBufSize = 0;
|
||||||
spec.surface = surf;
|
|
||||||
spec.SoundRate = 44100;
|
|
||||||
spec.SoundBuf = sound_buf;
|
|
||||||
spec.LineWidths = rects;
|
|
||||||
spec.SoundBufMaxSize = sizeof(sound_buf) / 2;
|
|
||||||
spec.SoundVolume = 1.0;
|
|
||||||
spec.soundmultiplier = 1.0;
|
|
||||||
spec.SoundBufSize = 0;
|
|
||||||
spec.VideoFormatChanged = false;
|
|
||||||
spec.SoundFormatChanged = false;
|
spec.SoundFormatChanged = false;
|
||||||
|
|
||||||
if (spec.SoundRate != last_sound_rate)
|
if (spec.SoundRate != last_sound_rate)
|
||||||
{
|
{
|
||||||
spec.SoundFormatChanged = true;
|
spec.SoundFormatChanged = true;
|
||||||
last_sound_rate = spec.SoundRate;
|
last_sound_rate = spec.SoundRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
Emulate(&spec);
|
Emulate(&spec);
|
||||||
|
|
||||||
int16 *const SoundBuf = spec.SoundBuf + spec.SoundBufSizeALMS * 2;
|
|
||||||
int32 SoundBufSize = spec.SoundBufSize - spec.SoundBufSizeALMS;
|
|
||||||
const int32 SoundBufMaxSize = spec.SoundBufMaxSize - spec.SoundBufSizeALMS;
|
|
||||||
|
|
||||||
spec.SoundBufSize = spec.SoundBufSizeALMS + SoundBufSize;
|
|
||||||
|
|
||||||
unsigned width = spec.DisplayRect.w;
|
unsigned width = spec.DisplayRect.w;
|
||||||
unsigned height = spec.DisplayRect.h;
|
unsigned height = spec.DisplayRect.h;
|
||||||
unsigned pitch = FB_WIDTH << (system_color_depth >> 4);
|
unsigned pitch = FB_WIDTH << (system_color_depth >> 4);
|
||||||
@ -489,8 +447,8 @@ void retro_run()
|
|||||||
|
|
||||||
audio_batch_cb(spec.SoundBuf, spec.SoundBufSize);
|
audio_batch_cb(spec.SoundBuf, spec.SoundBufSize);
|
||||||
|
|
||||||
bool updated = false;
|
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE,
|
||||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
|
&updated) && updated)
|
||||||
check_variables();
|
check_variables();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,9 +502,7 @@ unsigned retro_api_version(void)
|
|||||||
return RETRO_API_VERSION;
|
return RETRO_API_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
void retro_set_controller_port_device(unsigned in_port, unsigned device)
|
void retro_set_controller_port_device(unsigned in_port, unsigned device) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void retro_set_environment(retro_environment_t cb)
|
void retro_set_environment(retro_environment_t cb)
|
||||||
{
|
{
|
||||||
@ -586,8 +542,6 @@ void retro_set_video_refresh(retro_video_refresh_t cb)
|
|||||||
video_cb = cb;
|
video_cb = cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t serialize_size;
|
|
||||||
|
|
||||||
size_t retro_serialize_size(void)
|
size_t retro_serialize_size(void)
|
||||||
{
|
{
|
||||||
StateMem st;
|
StateMem st;
|
||||||
@ -603,7 +557,7 @@ size_t retro_serialize_size(void)
|
|||||||
|
|
||||||
free(st.data);
|
free(st.data);
|
||||||
|
|
||||||
return serialize_size = st.len;
|
return st.len;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool retro_serialize(void *data, size_t size)
|
bool retro_serialize(void *data, size_t size)
|
||||||
@ -654,114 +608,5 @@ size_t retro_get_memory_size(unsigned type)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void retro_cheat_reset(void)
|
void retro_cheat_reset(void) { }
|
||||||
{}
|
void retro_cheat_set(unsigned, bool, const char *) { }
|
||||||
|
|
||||||
void retro_cheat_set(unsigned, bool, const char *)
|
|
||||||
{}
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
static void sanitize_path(std::string &path)
|
|
||||||
{
|
|
||||||
size_t size = path.size();
|
|
||||||
for (size_t i = 0; i < size; i++)
|
|
||||||
if (path[i] == '/')
|
|
||||||
path[i] = '\\';
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void MDFND_DispMessage(unsigned char *str)
|
|
||||||
{
|
|
||||||
if (log_cb)
|
|
||||||
log_cb(RETRO_LOG_INFO, "%s", str);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MDFND_MidSync(const EmulateSpecStruct *)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void MDFN_MidLineUpdate(EmulateSpecStruct *espec, int y)
|
|
||||||
{
|
|
||||||
//MDFND_MidLineUpdate(espec, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* forward declarations */
|
|
||||||
extern void MDFND_DispMessage(unsigned char *str);
|
|
||||||
|
|
||||||
static int curindent = 0;
|
|
||||||
|
|
||||||
void MDFN_indent(int indent)
|
|
||||||
{
|
|
||||||
curindent += indent;
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint8 lastchar = 0;
|
|
||||||
|
|
||||||
void MDFN_printf(const char *format, ...)
|
|
||||||
{
|
|
||||||
char *format_temp;
|
|
||||||
char *temp;
|
|
||||||
unsigned int x, newlen;
|
|
||||||
|
|
||||||
va_list ap;
|
|
||||||
va_start(ap,format);
|
|
||||||
|
|
||||||
|
|
||||||
// First, determine how large our format_temp buffer needs to be.
|
|
||||||
uint8 lastchar_backup = lastchar; // Save lastchar!
|
|
||||||
for(newlen=x=0;x<strlen(format);x++)
|
|
||||||
{
|
|
||||||
if(lastchar == '\n' && format[x] != '\n')
|
|
||||||
{
|
|
||||||
int y;
|
|
||||||
for(y=0;y<curindent;y++)
|
|
||||||
newlen++;
|
|
||||||
}
|
|
||||||
newlen++;
|
|
||||||
lastchar = format[x];
|
|
||||||
}
|
|
||||||
|
|
||||||
format_temp = (char *)malloc(newlen + 1); // Length + NULL character, duh
|
|
||||||
|
|
||||||
// Now, construct our format_temp string
|
|
||||||
lastchar = lastchar_backup; // Restore lastchar
|
|
||||||
for(newlen=x=0;x<strlen(format);x++)
|
|
||||||
{
|
|
||||||
if(lastchar == '\n' && format[x] != '\n')
|
|
||||||
{
|
|
||||||
int y;
|
|
||||||
for(y=0;y<curindent;y++)
|
|
||||||
format_temp[newlen++] = ' ';
|
|
||||||
}
|
|
||||||
format_temp[newlen++] = format[x];
|
|
||||||
lastchar = format[x];
|
|
||||||
}
|
|
||||||
|
|
||||||
format_temp[newlen] = 0;
|
|
||||||
|
|
||||||
temp = new char[4096];
|
|
||||||
vsnprintf(temp, 4096, format_temp, ap);
|
|
||||||
free(format_temp);
|
|
||||||
|
|
||||||
if (log_cb)
|
|
||||||
log_cb(RETRO_LOG_INFO, "%s", temp);
|
|
||||||
delete[] temp;
|
|
||||||
|
|
||||||
va_end(ap);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MDFN_PrintError(const char *format, ...)
|
|
||||||
{
|
|
||||||
char *temp;
|
|
||||||
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
va_start(ap, format);
|
|
||||||
|
|
||||||
temp = new char[4096];
|
|
||||||
vsnprintf(temp, 4096, format, ap);
|
|
||||||
if (log_cb)
|
|
||||||
log_cb(RETRO_LOG_ERROR, "%s\n", temp);
|
|
||||||
delete[] temp;
|
|
||||||
|
|
||||||
va_end(ap);
|
|
||||||
}
|
|
||||||
|
@ -185,17 +185,3 @@ void FlipByteOrder(uint8 *src, uint32 count)
|
|||||||
start++;
|
start++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Endian_V_LE_to_NE(void *src, uint32 bytesize)
|
|
||||||
{
|
|
||||||
#ifdef MSB_FIRST
|
|
||||||
FlipByteOrder((uint8 *)src, bytesize);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void Endian_V_NE_to_LE(void *src, uint32 bytesize)
|
|
||||||
{
|
|
||||||
#ifdef MSB_FIRST
|
|
||||||
FlipByteOrder((uint8 *)src, bytesize);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
@ -179,24 +179,11 @@ typedef struct
|
|||||||
// The framebuffer pointed to by surface->pixels is written to by the system emulation code.
|
// The framebuffer pointed to by surface->pixels is written to by the system emulation code.
|
||||||
MDFN_Surface *surface;
|
MDFN_Surface *surface;
|
||||||
|
|
||||||
// Will be set to TRUE if the video pixel format has changed since the last call to Emulate(), FALSE otherwise.
|
|
||||||
// Will be set to TRUE on the first call to the Emulate() function/method
|
|
||||||
bool VideoFormatChanged;
|
|
||||||
|
|
||||||
// Set by the system emulation code every frame, to denote the horizontal and vertical offsets of the image, and the size
|
// Set by the system emulation code every frame, to denote the horizontal and vertical offsets of the image, and the size
|
||||||
// of the image. If the emulated system sets the elements of LineWidths, then the horizontal offset(x) and width(w) of this structure
|
// of the image. If the emulated system sets the elements of LineWidths, then the horizontal offset(x) and width(w) of this structure
|
||||||
// are ignored while drawing the image.
|
// are ignored while drawing the image.
|
||||||
MDFN_Rect DisplayRect;
|
MDFN_Rect DisplayRect;
|
||||||
|
|
||||||
// Pointer to an array of MDFN_Rect, number of elements = fb_height, set by the driver code. Individual MDFN_Rect structs written
|
|
||||||
// to by system emulation code. If the emulated system doesn't support multiple screen widths per frame, or if you handle
|
|
||||||
// such a situation by outputting at a constant width-per-frame that is the least-common-multiple of the screen widths, then
|
|
||||||
// you can ignore this. If you do wish to use this, you must set all elements every frame.
|
|
||||||
MDFN_Rect *LineWidths;
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
bool *IsFMV;
|
|
||||||
|
|
||||||
// Set(optionally) by emulation code. If InterlaceOn is true, then assume field height is 1/2 DisplayRect.h, and
|
// Set(optionally) by emulation code. If InterlaceOn is true, then assume field height is 1/2 DisplayRect.h, and
|
||||||
// only every other line in surface (with the start line defined by InterlacedField) has valid data
|
// only every other line in surface (with the start line defined by InterlacedField) has valid data
|
||||||
// (it's up to internal Mednafen code to deinterlace it).
|
// (it's up to internal Mednafen code to deinterlace it).
|
||||||
@ -227,70 +214,12 @@ typedef struct
|
|||||||
|
|
||||||
// Number of frames currently in internal sound buffer. Set by the system emulation code, to be read by the driver code.
|
// Number of frames currently in internal sound buffer. Set by the system emulation code, to be read by the driver code.
|
||||||
int32 SoundBufSize;
|
int32 SoundBufSize;
|
||||||
int32 SoundBufSizeALMS; // SoundBufSize value at last MidSync(), 0
|
|
||||||
// if mid sync isn't implemented for the emulation module in use.
|
|
||||||
|
|
||||||
// Number of cycles that this frame consumed, using MDFNGI::MasterClock as a time base.
|
|
||||||
// Set by emulation code.
|
|
||||||
int64 MasterCycles;
|
|
||||||
int64 MasterCyclesALMS; // MasterCycles value at last MidSync(), 0
|
|
||||||
// if mid sync isn't implemented for the emulation module in use.
|
|
||||||
|
|
||||||
// Current sound volume(0.000...<=volume<=1.000...). If, after calling Emulate(), it is still != 1, Mednafen will handle it internally.
|
|
||||||
// Emulation modules can handle volume themselves if they like, for speed reasons. If they do, afterwards, they should set its value to 1.
|
|
||||||
double SoundVolume;
|
|
||||||
|
|
||||||
// Current sound speed multiplier. Set by the driver code. If, after calling Emulate(), it is still != 1, Mednafen will handle it internally
|
|
||||||
// by resampling the audio. This means that emulation modules can handle(and set the value to 1 after handling it) it if they want to get the most
|
|
||||||
// performance possible. HOWEVER, emulation modules must make sure the value is in a range(with minimum and maximum) that their code can handle
|
|
||||||
// before they try to handle it.
|
|
||||||
double soundmultiplier;
|
|
||||||
|
|
||||||
// True if we want to rewind one frame. Set by the driver code.
|
|
||||||
bool NeedRewind;
|
|
||||||
|
|
||||||
// Sound reversal during state rewinding is normally done in mednafen.cpp, but
|
|
||||||
// individual system emulation code can also do it if this is set, and clear it after it's done.
|
|
||||||
// (Also, the driver code shouldn't touch this variable)
|
|
||||||
bool NeedSoundReverse;
|
|
||||||
|
|
||||||
} EmulateSpecStruct;
|
} EmulateSpecStruct;
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
MODPRIO_INTERNAL_EXTRA_LOW = 0, // For "cdplay" module, mostly.
|
|
||||||
|
|
||||||
MODPRIO_INTERNAL_LOW = 10,
|
|
||||||
MODPRIO_EXTERNAL_LOW = 20,
|
|
||||||
MODPRIO_INTERNAL_HIGH = 30,
|
|
||||||
MODPRIO_EXTERNAL_HIGH = 40
|
|
||||||
} ModPrio;
|
|
||||||
|
|
||||||
class CDIF;
|
|
||||||
|
|
||||||
#define MDFN_MASTERCLOCK_FIXED(n) ((int64)((double)(n) * (1LL << 32)))
|
#define MDFN_MASTERCLOCK_FIXED(n) ((int64)((double)(n) * (1LL << 32)))
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
// Time base for EmulateSpecStruct::MasterCycles
|
|
||||||
int64 MasterClock;
|
|
||||||
|
|
||||||
uint32 fps; // frames per second * 65536 * 256, truncated
|
|
||||||
|
|
||||||
// multires is a hint that, if set, indicates that the system has fairly programmable video modes(particularly, the ability
|
|
||||||
// to display multiple horizontal resolutions, such as the PCE, PC-FX, or Genesis). In practice, it will cause the driver
|
|
||||||
// code to set the linear interpolation on by default.
|
|
||||||
//
|
|
||||||
// lcm_width and lcm_height are the least common multiples of all possible
|
|
||||||
// resolutions in the frame buffer as specified by DisplayRect/LineWidths(Ex for PCE: widths of 256, 341.333333, 512,
|
|
||||||
// lcm = 1024)
|
|
||||||
//
|
|
||||||
// nominal_width and nominal_height specify the resolution that Mednafen should display
|
|
||||||
// the framebuffer image in at 1x scaling, scaled from the dimensions of DisplayRect, and optionally the LineWidths array
|
|
||||||
// passed through espec to the Emulate() function.
|
|
||||||
//
|
|
||||||
bool multires;
|
|
||||||
|
|
||||||
int lcm_width;
|
int lcm_width;
|
||||||
int lcm_height;
|
int lcm_height;
|
||||||
|
|
||||||
@ -302,17 +231,10 @@ typedef struct
|
|||||||
int fb_width; // Width of the framebuffer(not necessarily width of the image). MDFN_Surface width should be >= this.
|
int fb_width; // Width of the framebuffer(not necessarily width of the image). MDFN_Surface width should be >= this.
|
||||||
int fb_height; // Height of the framebuffer passed to the Emulate() function(not necessarily height of the image)
|
int fb_height; // Height of the framebuffer passed to the Emulate() function(not necessarily height of the image)
|
||||||
|
|
||||||
int soundchan; // Number of output sound channels.
|
|
||||||
|
|
||||||
int rotated;
|
int rotated;
|
||||||
|
|
||||||
int soundrate; /* For Ogg Vorbis expansion sound wacky support. 0 for default. */
|
int soundrate; /* For Ogg Vorbis expansion sound wacky support. 0 for default. */
|
||||||
|
|
||||||
VideoSystems VideoSystem;
|
|
||||||
GameMediumTypes GameType;
|
|
||||||
|
|
||||||
const char *DesiredInput; // Desired input device for the input ports, NULL for don't care
|
|
||||||
|
|
||||||
double mouse_sensitivity;
|
double mouse_sensitivity;
|
||||||
} MDFNGI;
|
} MDFNGI;
|
||||||
|
|
||||||
|
@ -1,175 +0,0 @@
|
|||||||
// Sets up common environment for Shay Green's libraries.
|
|
||||||
// To change configuration options, modify blargg_config.h, not this file.
|
|
||||||
|
|
||||||
#ifndef BLARGG_COMMON_H
|
|
||||||
#define BLARGG_COMMON_H
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
#undef BLARGG_COMMON_H
|
|
||||||
// allow blargg_config.h to #include blargg_common.h
|
|
||||||
#include "blargg_config.h"
|
|
||||||
#ifndef BLARGG_COMMON_H
|
|
||||||
#define BLARGG_COMMON_H
|
|
||||||
|
|
||||||
// STATIC_CAST(T,expr): Used in place of static_cast<T> (expr)
|
|
||||||
#ifndef STATIC_CAST
|
|
||||||
#define STATIC_CAST(T,expr) ((T) (expr))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// blargg_err_t (0 on success, otherwise error string)
|
|
||||||
#ifndef blargg_err_t
|
|
||||||
typedef const char* blargg_err_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// blargg_vector - very lightweight vector of POD types (no constructor/destructor)
|
|
||||||
template<class T>
|
|
||||||
class blargg_vector {
|
|
||||||
T* begin_;
|
|
||||||
size_t size_;
|
|
||||||
public:
|
|
||||||
blargg_vector() : begin_( 0 ), size_( 0 ) { }
|
|
||||||
~blargg_vector() { free( begin_ ); }
|
|
||||||
size_t size() const { return size_; }
|
|
||||||
T* begin() const { return begin_; }
|
|
||||||
T* end() const { return begin_ + size_; }
|
|
||||||
blargg_err_t resize( size_t n )
|
|
||||||
{
|
|
||||||
void* p = realloc( begin_, n * sizeof (T) );
|
|
||||||
if ( !p && n )
|
|
||||||
return "Out of memory";
|
|
||||||
begin_ = (T*) p;
|
|
||||||
size_ = n;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
void clear() { void* p = begin_; begin_ = 0; size_ = 0; free( p ); }
|
|
||||||
T& operator [] ( size_t n ) const
|
|
||||||
{
|
|
||||||
assert( n <= size_ ); // <= to allow past-the-end value
|
|
||||||
return begin_ [n];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifndef BLARGG_DISABLE_NOTHROW
|
|
||||||
#if __cplusplus < 199711
|
|
||||||
#define BLARGG_THROWS( spec )
|
|
||||||
#else
|
|
||||||
#define BLARGG_THROWS( spec ) throw spec
|
|
||||||
#endif
|
|
||||||
#define BLARGG_DISABLE_NOTHROW \
|
|
||||||
void* operator new ( size_t s ) BLARGG_THROWS(()) { return malloc( s ); }\
|
|
||||||
void operator delete ( void* p ) { free( p ); }
|
|
||||||
#define BLARGG_NEW new
|
|
||||||
#else
|
|
||||||
#include <new>
|
|
||||||
#define BLARGG_NEW new (std::nothrow)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define BLARGG_4CHAR( a, b, c, d ) \
|
|
||||||
((a&0xFF)*0x1000000L + (b&0xFF)*0x10000L + (c&0xFF)*0x100L + (d&0xFF))
|
|
||||||
|
|
||||||
// BOOST_STATIC_ASSERT( expr ): Generates compile error if expr is 0.
|
|
||||||
#ifndef BOOST_STATIC_ASSERT
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
// MSVC6 (_MSC_VER < 1300) fails for use of __LINE__ when /Zl is specified
|
|
||||||
#define BOOST_STATIC_ASSERT( expr ) \
|
|
||||||
void blargg_failed_( int (*arg) [2 / (int) !!(expr) - 1] )
|
|
||||||
#else
|
|
||||||
// Some other compilers fail when declaring same function multiple times in class,
|
|
||||||
// so differentiate them by line
|
|
||||||
#define BOOST_STATIC_ASSERT( expr ) \
|
|
||||||
void blargg_failed_( int (*arg) [2 / !!(expr) - 1] [__LINE__] )
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// BLARGG_COMPILER_HAS_BOOL: If 0, provides bool support for old compiler. If 1,
|
|
||||||
// compiler is assumed to support bool. If undefined, availability is determined.
|
|
||||||
#ifndef BLARGG_COMPILER_HAS_BOOL
|
|
||||||
#if defined (__MWERKS__)
|
|
||||||
#if !__option(bool)
|
|
||||||
#define BLARGG_COMPILER_HAS_BOOL 0
|
|
||||||
#endif
|
|
||||||
#elif defined (_MSC_VER)
|
|
||||||
#if _MSC_VER < 1100
|
|
||||||
#define BLARGG_COMPILER_HAS_BOOL 0
|
|
||||||
#endif
|
|
||||||
#elif defined (__GNUC__)
|
|
||||||
// supports bool
|
|
||||||
#elif __cplusplus < 199711
|
|
||||||
#define BLARGG_COMPILER_HAS_BOOL 0
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#if defined (BLARGG_COMPILER_HAS_BOOL) && !BLARGG_COMPILER_HAS_BOOL
|
|
||||||
// If you get errors here, modify your blargg_config.h file
|
|
||||||
typedef int bool;
|
|
||||||
const bool true = 1;
|
|
||||||
const bool false = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// blargg_long/blargg_ulong = at least 32 bits, int if it's big enough
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
#if INT_MAX >= 0x7FFFFFFF
|
|
||||||
typedef int blargg_long;
|
|
||||||
#else
|
|
||||||
typedef long blargg_long;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UINT_MAX >= 0xFFFFFFFF
|
|
||||||
typedef unsigned blargg_ulong;
|
|
||||||
#else
|
|
||||||
typedef unsigned long blargg_ulong;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// BOOST::int8_t etc.
|
|
||||||
|
|
||||||
// HAVE_STDINT_H: If defined, use <stdint.h> for int8_t etc.
|
|
||||||
#if defined (HAVE_STDINT_H)
|
|
||||||
#include <stdint.h>
|
|
||||||
#define BOOST
|
|
||||||
|
|
||||||
// HAVE_INTTYPES_H: If defined, use <stdint.h> for int8_t etc.
|
|
||||||
#elif defined (HAVE_INTTYPES_H)
|
|
||||||
#include <inttypes.h>
|
|
||||||
#define BOOST
|
|
||||||
|
|
||||||
#else
|
|
||||||
struct BOOST
|
|
||||||
{
|
|
||||||
#if UCHAR_MAX == 0xFF && SCHAR_MAX == 0x7F
|
|
||||||
typedef signed char int8_t;
|
|
||||||
typedef unsigned char uint8_t;
|
|
||||||
#else
|
|
||||||
// No suitable 8-bit type available
|
|
||||||
typedef struct see_blargg_common_h int8_t;
|
|
||||||
typedef struct see_blargg_common_h uint8_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if USHRT_MAX == 0xFFFF
|
|
||||||
typedef short int16_t;
|
|
||||||
typedef unsigned short uint16_t;
|
|
||||||
#else
|
|
||||||
// No suitable 16-bit type available
|
|
||||||
typedef struct see_blargg_common_h int16_t;
|
|
||||||
typedef struct see_blargg_common_h uint16_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ULONG_MAX == 0xFFFFFFFF
|
|
||||||
typedef long int32_t;
|
|
||||||
typedef unsigned long uint32_t;
|
|
||||||
#elif UINT_MAX == 0xFFFFFFFF
|
|
||||||
typedef int int32_t;
|
|
||||||
typedef unsigned int uint32_t;
|
|
||||||
#else
|
|
||||||
// No suitable 32-bit type available
|
|
||||||
typedef struct see_blargg_common_h int32_t;
|
|
||||||
typedef struct see_blargg_common_h uint32_t;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif
|
|
@ -1,27 +0,0 @@
|
|||||||
// Library configuration. Modify this file as necessary.
|
|
||||||
|
|
||||||
#ifndef BLARGG_CONFIG_H
|
|
||||||
#define BLARGG_CONFIG_H
|
|
||||||
|
|
||||||
// Uncomment to use zlib for transparent decompression of gzipped files
|
|
||||||
//#define HAVE_ZLIB_H
|
|
||||||
|
|
||||||
// Uncomment to support only the listed game music types. See gme_type_list.cpp
|
|
||||||
// for a list of all types.
|
|
||||||
//#define GME_TYPE_LIST gme_nsf_type, gme_gbs_type
|
|
||||||
|
|
||||||
// Uncomment to enable platform-specific optimizations
|
|
||||||
//#define BLARGG_NONPORTABLE 1
|
|
||||||
|
|
||||||
// Uncomment to use faster, lower quality sound synthesis
|
|
||||||
//#define BLIP_BUFFER_FAST 1
|
|
||||||
|
|
||||||
// Uncomment if you get errors in the bool section of blargg_common.h
|
|
||||||
//#define BLARGG_COMPILER_HAS_BOOL 1
|
|
||||||
|
|
||||||
// Use standard config.h if present
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,124 +0,0 @@
|
|||||||
// CPU Byte Order Utilities
|
|
||||||
|
|
||||||
// Game_Music_Emu 0.5.2
|
|
||||||
#ifndef BLARGG_ENDIAN
|
|
||||||
#define BLARGG_ENDIAN
|
|
||||||
|
|
||||||
#include "blargg_common.h"
|
|
||||||
|
|
||||||
// BLARGG_CPU_CISC: Defined if CPU has very few general-purpose registers (< 16)
|
|
||||||
#if defined (_M_IX86) || defined (_M_IA64) || defined (__i486__) || \
|
|
||||||
defined (__x86_64__) || defined (__ia64__) || defined (__i386__)
|
|
||||||
#define BLARGG_CPU_X86 1
|
|
||||||
#define BLARGG_CPU_CISC 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (__powerpc__) || defined (__ppc__) || defined (__POWERPC__) || defined (__powerc)
|
|
||||||
#define BLARGG_CPU_POWERPC 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline void blargg_verify_byte_order()
|
|
||||||
{
|
|
||||||
#ifndef NDEBUG
|
|
||||||
#ifdef MSB_FIRST
|
|
||||||
volatile int i = 1;
|
|
||||||
assert( *(volatile char*) &i == 0 );
|
|
||||||
#else
|
|
||||||
volatile int i = 1;
|
|
||||||
assert( *(volatile char*) &i != 0 );
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
inline unsigned get_le16( void const* p ) {
|
|
||||||
return ((unsigned char const*) p) [1] * 0x100u +
|
|
||||||
((unsigned char const*) p) [0];
|
|
||||||
}
|
|
||||||
inline unsigned get_be16( void const* p ) {
|
|
||||||
return ((unsigned char const*) p) [0] * 0x100u +
|
|
||||||
((unsigned char const*) p) [1];
|
|
||||||
}
|
|
||||||
inline blargg_ulong get_le32( void const* p ) {
|
|
||||||
return ((unsigned char const*) p) [3] * 0x01000000u +
|
|
||||||
((unsigned char const*) p) [2] * 0x00010000u +
|
|
||||||
((unsigned char const*) p) [1] * 0x00000100u +
|
|
||||||
((unsigned char const*) p) [0];
|
|
||||||
}
|
|
||||||
inline blargg_ulong get_be32( void const* p ) {
|
|
||||||
return ((unsigned char const*) p) [0] * 0x01000000u +
|
|
||||||
((unsigned char const*) p) [1] * 0x00010000u +
|
|
||||||
((unsigned char const*) p) [2] * 0x00000100u +
|
|
||||||
((unsigned char const*) p) [3];
|
|
||||||
}
|
|
||||||
inline void set_le16( void* p, unsigned n ) {
|
|
||||||
((unsigned char*) p) [1] = (unsigned char) (n >> 8);
|
|
||||||
((unsigned char*) p) [0] = (unsigned char) n;
|
|
||||||
}
|
|
||||||
inline void set_be16( void* p, unsigned n ) {
|
|
||||||
((unsigned char*) p) [0] = (unsigned char) (n >> 8);
|
|
||||||
((unsigned char*) p) [1] = (unsigned char) n;
|
|
||||||
}
|
|
||||||
inline void set_le32( void* p, blargg_ulong n ) {
|
|
||||||
((unsigned char*) p) [3] = (unsigned char) (n >> 24);
|
|
||||||
((unsigned char*) p) [2] = (unsigned char) (n >> 16);
|
|
||||||
((unsigned char*) p) [1] = (unsigned char) (n >> 8);
|
|
||||||
((unsigned char*) p) [0] = (unsigned char) n;
|
|
||||||
}
|
|
||||||
inline void set_be32( void* p, blargg_ulong n ) {
|
|
||||||
((unsigned char*) p) [0] = (unsigned char) (n >> 24);
|
|
||||||
((unsigned char*) p) [1] = (unsigned char) (n >> 16);
|
|
||||||
((unsigned char*) p) [2] = (unsigned char) (n >> 8);
|
|
||||||
((unsigned char*) p) [3] = (unsigned char) n;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if BLARGG_NONPORTABLE
|
|
||||||
/* Optimized implementation if byte order is known */
|
|
||||||
#ifdef MSB_FIRST
|
|
||||||
#define GET_BE16( addr ) (*(BOOST::uint16_t*) (addr))
|
|
||||||
#define GET_BE32( addr ) (*(BOOST::uint32_t*) (addr))
|
|
||||||
#define SET_BE16( addr, data ) (void) (*(BOOST::uint16_t*) (addr) = (data))
|
|
||||||
#define SET_BE32( addr, data ) (void) (*(BOOST::uint32_t*) (addr) = (data))
|
|
||||||
#else
|
|
||||||
#define GET_LE16( addr ) (*(BOOST::uint16_t*) (addr))
|
|
||||||
#define GET_LE32( addr ) (*(BOOST::uint32_t*) (addr))
|
|
||||||
#define SET_LE16( addr, data ) (void) (*(BOOST::uint16_t*) (addr) = (data))
|
|
||||||
#define SET_LE32( addr, data ) (void) (*(BOOST::uint32_t*) (addr) = (data))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if BLARGG_CPU_POWERPC && defined (__MWERKS__)
|
|
||||||
// PowerPC has special byte-reversed instructions
|
|
||||||
// to do: assumes that PowerPC is running in big-endian mode
|
|
||||||
// to do: implement for other compilers which don't support these macros
|
|
||||||
#define GET_LE16( addr ) (__lhbrx( (addr), 0 ))
|
|
||||||
#define GET_LE32( addr ) (__lwbrx( (addr), 0 ))
|
|
||||||
#define SET_LE16( addr, data ) (__sthbrx( (data), (addr), 0 ))
|
|
||||||
#define SET_LE32( addr, data ) (__stwbrx( (data), (addr), 0 ))
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef GET_LE16
|
|
||||||
#define GET_LE16( addr ) get_le16( addr )
|
|
||||||
#define GET_LE32( addr ) get_le32( addr )
|
|
||||||
#define SET_LE16( addr, data ) set_le16( addr, data )
|
|
||||||
#define SET_LE32( addr, data ) set_le32( addr, data )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef GET_BE16
|
|
||||||
#define GET_BE16( addr ) get_be16( addr )
|
|
||||||
#define GET_BE32( addr ) get_be32( addr )
|
|
||||||
#define SET_BE16( addr, data ) set_be16( addr, data )
|
|
||||||
#define SET_BE32( addr, data ) set_be32( addr, data )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// auto-selecting versions
|
|
||||||
|
|
||||||
inline void set_le( BOOST::uint16_t* p, unsigned n ) { SET_LE16( p, n ); }
|
|
||||||
inline void set_le( BOOST::uint32_t* p, blargg_ulong n ) { SET_LE32( p, n ); }
|
|
||||||
inline void set_be( BOOST::uint16_t* p, unsigned n ) { SET_BE16( p, n ); }
|
|
||||||
inline void set_be( BOOST::uint32_t* p, blargg_ulong n ) { SET_BE32( p, n ); }
|
|
||||||
inline unsigned get_le( BOOST::uint16_t* p ) { return GET_LE16( p ); }
|
|
||||||
inline blargg_ulong get_le( BOOST::uint32_t* p ) { return GET_LE32( p ); }
|
|
||||||
inline unsigned get_be( BOOST::uint16_t* p ) { return GET_BE16( p ); }
|
|
||||||
inline blargg_ulong get_be( BOOST::uint32_t* p ) { return GET_BE32( p ); }
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,78 +0,0 @@
|
|||||||
// Included at the beginning of library source files, after all other #include lines
|
|
||||||
#ifndef BLARGG_SOURCE_H
|
|
||||||
#define BLARGG_SOURCE_H
|
|
||||||
|
|
||||||
// If debugging is enabled, abort program if expr is false. Meant for checking
|
|
||||||
// internal state and consistency. A failed assertion indicates a bug in the module.
|
|
||||||
// void assert( bool expr );
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
// If debugging is enabled and expr is false, abort program. Meant for checking
|
|
||||||
// caller-supplied parameters and operations that are outside the control of the
|
|
||||||
// module. A failed requirement indicates a bug outside the module.
|
|
||||||
// void require( bool expr );
|
|
||||||
#undef require
|
|
||||||
#define require( expr ) assert( expr )
|
|
||||||
|
|
||||||
// Like printf() except output goes to debug log file. Might be defined to do
|
|
||||||
// nothing (not even evaluate its arguments).
|
|
||||||
// void dprintf( const char* format, ... );
|
|
||||||
inline void blargg_dprintf_( const char*, ... ) { }
|
|
||||||
#undef dprintf
|
|
||||||
#define dprintf (1) ? (void) 0 : blargg_dprintf_
|
|
||||||
|
|
||||||
// If enabled, evaluate expr and if false, make debug log entry with source file
|
|
||||||
// and line. Meant for finding situations that should be examined further, but that
|
|
||||||
// don't indicate a problem. In all cases, execution continues normally.
|
|
||||||
#undef check
|
|
||||||
#define check( expr ) ((void) 0)
|
|
||||||
|
|
||||||
// If expr yields error string, return it from current function, otherwise continue.
|
|
||||||
#undef RETURN_ERR
|
|
||||||
#define RETURN_ERR( expr ) do { \
|
|
||||||
blargg_err_t blargg_return_err_ = (expr); \
|
|
||||||
if ( blargg_return_err_ ) return blargg_return_err_; \
|
|
||||||
} while ( 0 )
|
|
||||||
|
|
||||||
// If ptr is 0, return out of memory error string.
|
|
||||||
#undef CHECK_ALLOC
|
|
||||||
#define CHECK_ALLOC( ptr ) do { if ( (ptr) == 0 ) return "Out of memory"; } while ( 0 )
|
|
||||||
|
|
||||||
// Avoid any macros which evaluate their arguments multiple times
|
|
||||||
#undef min
|
|
||||||
#undef max
|
|
||||||
|
|
||||||
// using const references generates crappy code, and I am currenly only using these
|
|
||||||
// for built-in types, so they take arguments by value
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
inline T min( T x, T y )
|
|
||||||
{
|
|
||||||
if ( x < y )
|
|
||||||
return x;
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
inline T max( T x, T y )
|
|
||||||
{
|
|
||||||
if ( x < y )
|
|
||||||
return y;
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: good idea? bad idea?
|
|
||||||
#undef byte
|
|
||||||
#define byte byte_
|
|
||||||
typedef unsigned char byte;
|
|
||||||
|
|
||||||
// deprecated
|
|
||||||
#define BLARGG_CHECK_ALLOC CHECK_ALLOC
|
|
||||||
#define BLARGG_RETURN_ERR RETURN_ERR
|
|
||||||
|
|
||||||
// BLARGG_SOURCE_BEGIN: If defined, #included, allowing redefition of dprintf and check
|
|
||||||
#ifdef BLARGG_SOURCE_BEGIN
|
|
||||||
#include BLARGG_SOURCE_BEGIN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -226,7 +226,6 @@ CCart::CCart(MDFNFILE *fp)
|
|||||||
|
|
||||||
// Calculate file's CRC32
|
// Calculate file's CRC32
|
||||||
mCRC32 = crc32(0, fp->data, gamesize);
|
mCRC32 = crc32(0, fp->data, gamesize);
|
||||||
MDFN_printf("File CRC32: 0x%08X.\n", mCRC32);
|
|
||||||
|
|
||||||
// Checkout the header bytes
|
// Checkout the header bytes
|
||||||
file_read(fp, raw_header, sizeof(LYNX_HEADER), 1);
|
file_read(fp, raw_header, sizeof(LYNX_HEADER), 1);
|
||||||
@ -243,10 +242,7 @@ CCart::CCart(MDFNFILE *fp)
|
|||||||
header.page_size_bank0 = gamesize >> 8; // Hard workaround...
|
header.page_size_bank0 = gamesize >> 8; // Hard workaround...
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
gamesize -= HEADER_RAW_SIZE;
|
gamesize -= HEADER_RAW_SIZE;
|
||||||
MDFN_printf("Found LYNX header!\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -272,8 +268,6 @@ CCart::CCart(MDFNFILE *fp)
|
|||||||
LYNX_DB db = CheckHash(mCRC32);
|
LYNX_DB db = CheckHash(mCRC32);
|
||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
MDFN_printf("Found lynx rom in database.\n");
|
|
||||||
MDFN_printf("Title: %s.\n", db.name);
|
|
||||||
header.page_size_bank0 = db.filesize >> 8;
|
header.page_size_bank0 = db.filesize >> 8;
|
||||||
header.rotation = db.rotation;
|
header.rotation = db.rotation;
|
||||||
}
|
}
|
||||||
@ -283,45 +277,37 @@ CCart::CCart(MDFNFILE *fp)
|
|||||||
strncpy(mName, (char *)&header.cartname, 32);
|
strncpy(mName, (char *)&header.cartname, 32);
|
||||||
strncpy(mManufacturer, (char *)&header.manufname, 16);
|
strncpy(mManufacturer, (char *)&header.manufname, 16);
|
||||||
|
|
||||||
MDFN_printf("Cart Name: %s\n", mName);
|
|
||||||
MDFN_printf("Manufacturer: %s\n", mManufacturer);
|
|
||||||
|
|
||||||
// Setup rotation
|
// Setup rotation
|
||||||
mRotation=header.rotation;
|
mRotation=header.rotation;
|
||||||
if(mRotation!=CART_NO_ROTATE && mRotation!=CART_ROTATE_LEFT && mRotation!=CART_ROTATE_RIGHT) mRotation=CART_NO_ROTATE;
|
if(mRotation!=CART_NO_ROTATE && mRotation!=CART_ROTATE_LEFT && mRotation!=CART_ROTATE_RIGHT) mRotation=CART_NO_ROTATE;
|
||||||
|
|
||||||
// Set the filetypes
|
// Set the filetypes
|
||||||
|
|
||||||
CTYPE banktype0,banktype1;
|
CTYPE banktype1;
|
||||||
|
|
||||||
switch(header.page_size_bank0)
|
switch(header.page_size_bank0)
|
||||||
{
|
{
|
||||||
case 0x000:
|
case 0x000:
|
||||||
banktype0=UNUSED;
|
|
||||||
mMaskBank0=0;
|
mMaskBank0=0;
|
||||||
mShiftCount0=0;
|
mShiftCount0=0;
|
||||||
mCountMask0=0;
|
mCountMask0=0;
|
||||||
break;
|
break;
|
||||||
case 0x100:
|
case 0x100:
|
||||||
banktype0=C64K;
|
|
||||||
mMaskBank0=0x00ffff;
|
mMaskBank0=0x00ffff;
|
||||||
mShiftCount0=8;
|
mShiftCount0=8;
|
||||||
mCountMask0=0x0ff;
|
mCountMask0=0x0ff;
|
||||||
break;
|
break;
|
||||||
case 0x200:
|
case 0x200:
|
||||||
banktype0=C128K;
|
|
||||||
mMaskBank0=0x01ffff;
|
mMaskBank0=0x01ffff;
|
||||||
mShiftCount0=9;
|
mShiftCount0=9;
|
||||||
mCountMask0=0x1ff;
|
mCountMask0=0x1ff;
|
||||||
break;
|
break;
|
||||||
case 0x400:
|
case 0x400:
|
||||||
banktype0=C256K;
|
|
||||||
mMaskBank0=0x03ffff;
|
mMaskBank0=0x03ffff;
|
||||||
mShiftCount0=10;
|
mShiftCount0=10;
|
||||||
mCountMask0=0x3ff;
|
mCountMask0=0x3ff;
|
||||||
break;
|
break;
|
||||||
case 0x800:
|
case 0x800:
|
||||||
banktype0=C512K;
|
|
||||||
mMaskBank0=0x07ffff;
|
mMaskBank0=0x07ffff;
|
||||||
mShiftCount0=11;
|
mShiftCount0=11;
|
||||||
mCountMask0=0x7ff;
|
mCountMask0=0x7ff;
|
||||||
|
@ -100,10 +100,9 @@ void CMemMap::Reset(void)
|
|||||||
|
|
||||||
INLINE void CMemMap::Poke(uint32 addr, uint8 data)
|
INLINE void CMemMap::Poke(uint32 addr, uint8 data)
|
||||||
{
|
{
|
||||||
int newstate,loop;
|
int loop;
|
||||||
|
|
||||||
// FC00-FCFF Susie area
|
// FC00-FCFF Susie area
|
||||||
newstate=(data&0x01)?false:true;
|
int newstate=(data&0x01)?false:true;
|
||||||
if(newstate!=mSusieEnabled)
|
if(newstate!=mSusieEnabled)
|
||||||
{
|
{
|
||||||
mSusieEnabled=newstate;
|
mSusieEnabled=newstate;
|
||||||
@ -210,6 +209,3 @@ int CMemMap::StateAction(StateMem *sm, int load, int data_only)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//END OF FILE
|
|
||||||
|
@ -858,7 +858,6 @@ void CMikie::Poke(uint32 addr,uint8 data)
|
|||||||
{
|
{
|
||||||
C6502_REGS regs;
|
C6502_REGS regs;
|
||||||
mSystem.GetRegs(regs);
|
mSystem.GetRegs(regs);
|
||||||
MDFN_printf("Runtime Alert - System Halted\nCMikie::Poke(SYSCTL1) - Lynx power down occurred at PC=$%04x.\nResetting system.\n",regs.PC);
|
|
||||||
mSystem.Reset();
|
mSystem.Reset();
|
||||||
gSystemHalt=true;
|
gSystemHalt=true;
|
||||||
}
|
}
|
||||||
|
@ -177,10 +177,8 @@ void CSusie::DoMathMultiply(void)
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
uint32 result;
|
|
||||||
|
|
||||||
// Basic multiply is ALWAYS unsigned, sign conversion is done later
|
// Basic multiply is ALWAYS unsigned, sign conversion is done later
|
||||||
result=(uint32)mMATHABCD.Words.AB*(uint32)mMATHABCD.Words.CD;
|
uint32 result=(uint32)mMATHABCD.Words.AB*(uint32)mMATHABCD.Words.CD;
|
||||||
mMATHEFGH.Long=result;
|
mMATHEFGH.Long=result;
|
||||||
|
|
||||||
if(mSPRSYS_SignedMath)
|
if(mSPRSYS_SignedMath)
|
||||||
@ -319,7 +317,6 @@ uint32 CSusie::PaintSprites(void)
|
|||||||
|
|
||||||
cycles_used+=6*SPR_RDWR_CYC;
|
cycles_used+=6*SPR_RDWR_CYC;
|
||||||
|
|
||||||
bool enable_sizing=false;
|
|
||||||
bool enable_stretch=false;
|
bool enable_stretch=false;
|
||||||
bool enable_tilt=false;
|
bool enable_tilt=false;
|
||||||
|
|
||||||
@ -328,8 +325,6 @@ uint32 CSusie::PaintSprites(void)
|
|||||||
switch(mSPRCTL1_ReloadDepth)
|
switch(mSPRCTL1_ReloadDepth)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
enable_sizing=true;
|
|
||||||
|
|
||||||
mSPRHSIZ.Val16=RAM_PEEKW(mTMPADR.Val16); // Sprite Horizontal size
|
mSPRHSIZ.Val16=RAM_PEEKW(mTMPADR.Val16); // Sprite Horizontal size
|
||||||
mTMPADR.Val16+=2;
|
mTMPADR.Val16+=2;
|
||||||
|
|
||||||
@ -340,7 +335,6 @@ uint32 CSusie::PaintSprites(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
enable_sizing=true;
|
|
||||||
enable_stretch=true;
|
enable_stretch=true;
|
||||||
|
|
||||||
mSPRHSIZ.Val16=RAM_PEEKW(mTMPADR.Val16); // Sprite Horizontal size
|
mSPRHSIZ.Val16=RAM_PEEKW(mTMPADR.Val16); // Sprite Horizontal size
|
||||||
@ -356,7 +350,6 @@ uint32 CSusie::PaintSprites(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
enable_sizing=true;
|
|
||||||
enable_stretch=true;
|
enable_stretch=true;
|
||||||
enable_tilt=true;
|
enable_tilt=true;
|
||||||
|
|
||||||
|
@ -227,16 +227,10 @@ void Load(MDFNFILE *fp, const char *bios_path)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
MDFNGameInfo->fps = (uint32)(59.8 * 65536 * 256);
|
|
||||||
|
|
||||||
if(MDFN_GetSettingB("lynx.lowpass"))
|
if(MDFN_GetSettingB("lynx.lowpass"))
|
||||||
{
|
|
||||||
lynxie->mMikie->miksynth.treble_eq(-35);
|
lynxie->mMikie->miksynth.treble_eq(-35);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
lynxie->mMikie->miksynth.treble_eq(0);
|
lynxie->mMikie->miksynth.treble_eq(0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CloseGame(void)
|
void CloseGame(void)
|
||||||
@ -252,9 +246,6 @@ void Emulate(EmulateSpecStruct *espec)
|
|||||||
espec->DisplayRect.w = 160;
|
espec->DisplayRect.w = 160;
|
||||||
espec->DisplayRect.h = 102;
|
espec->DisplayRect.h = 102;
|
||||||
|
|
||||||
if(espec->VideoFormatChanged)
|
|
||||||
lynxie->DisplaySetAttributes(espec->surface->bpp);
|
|
||||||
|
|
||||||
if(espec->SoundFormatChanged)
|
if(espec->SoundFormatChanged)
|
||||||
{
|
{
|
||||||
lynxie->mMikie->mikbuf.set_sample_rate(espec->SoundRate ? espec->SoundRate : 44100, 60);
|
lynxie->mMikie->mikbuf.set_sample_rate(espec->SoundRate ? espec->SoundRate : 44100, 60);
|
||||||
@ -319,8 +310,6 @@ void Emulate(EmulateSpecStruct *espec)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
espec->MasterCycles = gSystemCycleCount - lynxie->mMikie->startTS;
|
|
||||||
|
|
||||||
if(espec->SoundBuf)
|
if(espec->SoundBuf)
|
||||||
{
|
{
|
||||||
lynxie->mMikie->mikbuf.end_frame((gSystemCycleCount - lynxie->mMikie->startTS) >> 2);
|
lynxie->mMikie->mikbuf.end_frame((gSystemCycleCount - lynxie->mMikie->startTS) >> 2);
|
||||||
@ -433,11 +422,6 @@ static InputInfoStruct InputInfo =
|
|||||||
|
|
||||||
MDFNGI EmulatedLynx =
|
MDFNGI EmulatedLynx =
|
||||||
{
|
{
|
||||||
MDFN_MASTERCLOCK_FIXED(16000000),
|
|
||||||
0,
|
|
||||||
|
|
||||||
false, // Multires possible?
|
|
||||||
|
|
||||||
160, // lcm_width
|
160, // lcm_width
|
||||||
102, // lcm_height
|
102, // lcm_height
|
||||||
NULL, // Dummy
|
NULL, // Dummy
|
||||||
@ -448,7 +432,5 @@ MDFNGI EmulatedLynx =
|
|||||||
|
|
||||||
160, // Framebuffer width
|
160, // Framebuffer width
|
||||||
102, // Framebuffer height
|
102, // Framebuffer height
|
||||||
|
|
||||||
2, // Number of output sound channels
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
#ifndef __MDFN_MEDNAFEN_DRIVER_H
|
|
||||||
#define __MDFN_MEDNAFEN_DRIVER_H
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
/* Indent stdout newlines +- "indent" amount */
|
|
||||||
void MDFN_indent(int indent);
|
|
||||||
void MDFN_printf(const char *format, ...);
|
|
||||||
|
|
||||||
#ifdef WANT_THREADING
|
|
||||||
/* Being threading support. */
|
|
||||||
// Mostly based off SDL's prototypes and semantics.
|
|
||||||
// Driver code should actually define MDFN_Thread and MDFN_Mutex.
|
|
||||||
|
|
||||||
struct MDFN_Thread;
|
|
||||||
struct MDFN_Mutex;
|
|
||||||
|
|
||||||
MDFN_Thread *MDFND_CreateThread(int (*fn)(void *), void *data);
|
|
||||||
void MDFND_WaitThread(MDFN_Thread *thread, int *status);
|
|
||||||
void MDFND_KillThread(MDFN_Thread *thread);
|
|
||||||
|
|
||||||
MDFN_Mutex *MDFND_CreateMutex(void);
|
|
||||||
void MDFND_DestroyMutex(MDFN_Mutex *mutex);
|
|
||||||
int MDFND_LockMutex(MDFN_Mutex *mutex);
|
|
||||||
int MDFND_UnlockMutex(MDFN_Mutex *mutex);
|
|
||||||
|
|
||||||
/* End threading support. */
|
|
||||||
#endif
|
|
||||||
#endif
|
|
@ -42,9 +42,6 @@ void Endian_A16_BE_to_NE(void *src, uint32 nelements);
|
|||||||
void Endian_A32_LE_to_NE(void *src, uint32 nelements);
|
void Endian_A32_LE_to_NE(void *src, uint32 nelements);
|
||||||
void Endian_A64_LE_to_NE(void *src, uint32 nelements);
|
void Endian_A64_LE_to_NE(void *src, uint32 nelements);
|
||||||
|
|
||||||
void Endian_V_LE_to_NE(void *src, uint32 bytesize);
|
|
||||||
void Endian_V_NE_to_LE(void *src, uint32 bytesize);
|
|
||||||
|
|
||||||
void FlipByteOrder(uint8 *src, uint32 count);
|
void FlipByteOrder(uint8 *src, uint32 count);
|
||||||
|
|
||||||
// The following functions can encode/decode to unaligned addresses.
|
// The following functions can encode/decode to unaligned addresses.
|
||||||
@ -122,11 +119,6 @@ static inline uint16 MDFN_de16lsb(const uint8 *morp)
|
|||||||
return(morp[0] | (morp[1] << 8));
|
return(morp[0] | (morp[1] << 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32 MDFN_de24lsb(const uint8 *morp)
|
|
||||||
{
|
|
||||||
return(morp[0]|(morp[1]<<8)|(morp[2]<<16));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint32 MDFN_de32lsb(const uint8 *morp)
|
static inline uint32 MDFN_de32lsb(const uint8 *morp)
|
||||||
{
|
{
|
||||||
return(morp[0]|(morp[1]<<8)|(morp[2]<<16)|(morp[3]<<24));
|
return(morp[0]|(morp[1]<<8)|(morp[2]<<16)|(morp[3]<<24));
|
||||||
@ -153,15 +145,4 @@ static inline uint16 MDFN_de16msb(const uint8 *morp)
|
|||||||
return(morp[1] | (morp[0] << 8));
|
return(morp[1] | (morp[0] << 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32 MDFN_de24msb(const uint8 *morp)
|
|
||||||
{
|
|
||||||
return((morp[2]<<0)|(morp[1]<<8)|(morp[0]<<16));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline uint32 MDFN_de32msb(const uint8 *morp)
|
|
||||||
{
|
|
||||||
return(morp[3]|(morp[2]<<8)|(morp[1]<<16)|(morp[0]<<24));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
#ifndef _MDFN_MEMORY_H
|
|
||||||
#define _MDFN_MEMORY_H
|
|
||||||
|
|
||||||
// These functions can be used from driver code or from internal Mednafen code.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#define MDFN_malloc(size, purpose) malloc(size)
|
|
||||||
#define MDFN_calloc(nmemb, size, purpose) calloc(nmemb, size)
|
|
||||||
#define MDFN_realloc(ptr, size, purpose) realloc(ptr, size)
|
|
||||||
|
|
||||||
#define MDFN_malloc_real(size, purpose) malloc(size)
|
|
||||||
#define MDFN_calloc_real(nmemb, size, purpose) calloc(nmemb, size)
|
|
||||||
#define MDFN_realloc_real(ptr, size, purpose) realloc(ptr, size)
|
|
||||||
#define MDFN_free(ptr) free(ptr)
|
|
||||||
|
|
||||||
static inline void MDFN_FastU32MemsetM8(uint32_t *array, uint32_t value_32, unsigned int u32len)
|
|
||||||
{
|
|
||||||
for(uint32_t *ai = array; ai < array + u32len; ai += 2)
|
|
||||||
{
|
|
||||||
ai[0] = value_32;
|
|
||||||
ai[1] = value_32;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,32 +1,25 @@
|
|||||||
#ifndef _MEDNAFEN_H
|
#ifndef _MEDNAFEN_H
|
||||||
#define _MEDNAFEN_H
|
#define _MEDNAFEN_H
|
||||||
|
|
||||||
#include "mednafen-types.h"
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "git.h"
|
#include "git.h"
|
||||||
|
|
||||||
|
#include "mednafen-types.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define strcasecmp _stricmp
|
#define strcasecmp _stricmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern MDFNGI *MDFNGameInfo;
|
extern MDFNGI *MDFNGameInfo;
|
||||||
|
|
||||||
#include "settings.h"
|
|
||||||
|
|
||||||
void MDFN_PrintError(const char *format, ...);
|
|
||||||
void MDFN_printf(const char *format, ...);
|
|
||||||
|
|
||||||
void MDFN_LoadGameCheats(void *override);
|
void MDFN_LoadGameCheats(void *override);
|
||||||
void MDFN_FlushGameCheats(int nosave);
|
void MDFN_FlushGameCheats(int nosave);
|
||||||
|
|
||||||
void MDFN_MidSync(EmulateSpecStruct *espec);
|
void MDFN_MidSync(EmulateSpecStruct *espec);
|
||||||
void MDFN_MidLineUpdate(EmulateSpecStruct *espec, int y);
|
|
||||||
|
|
||||||
#include "mednafen-driver.h"
|
|
||||||
|
|
||||||
#include "mednafen-memory.h"
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,10 +15,7 @@
|
|||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mednafen.h"
|
|
||||||
#include <errno.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <string>
|
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
bool MDFN_GetSettingB(const char *name)
|
bool MDFN_GetSettingB(const char *name)
|
||||||
|
Loading…
Reference in New Issue
Block a user