Update libretro port

This commit is contained in:
twinaphex
2014-03-30 22:35:00 +02:00
parent 30b4c60b21
commit 73bf72aa6c
20 changed files with 5762 additions and 3654 deletions

View File

@@ -1,4 +1,6 @@
DEBUG = 0 DEBUG = 0
EXTERNAL_ZLIB = 0
WANT_GRIFFIN = 0
ifeq ($(platform),) ifeq ($(platform),)
platform = unix platform = unix
@@ -24,53 +26,111 @@ else ifneq ($(findstring MINGW,$(shell uname -a)),)
system_platform = win system_platform = win
endif endif
TARGET_NAME := fceumm
ifeq ($(platform), unix) ifeq ($(platform), unix)
TARGET := libretro.so TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC fpic := -fPIC
SHARED := -shared -Wl,--version-script=src/drivers/libretro/link.T -Wl,-no-undefined SHARED := -shared -Wl,--version-script=src/drivers/libretro/link.T -Wl,-no-undefined
ENDIANNESS_DEFINES = -DLSB_FIRST -DLOCAL_LE=1 ENDIANNESS_DEFINES = -DLSB_FIRST -DLOCAL_LE=1
ZLIB_DIR := ./src/zlib ZLIB_DIR := ./src/zlib
else ifeq ($(platform), osx) else ifeq ($(platform), osx)
TARGET := libretro.dylib TARGET := $(TARGET_NAME)_libretro.dylib
fpic := -fPIC fpic := -fPIC -mmacosx-version-min=10.6
SHARED := -dynamiclib SHARED := -dynamiclib
ENDIANNESS_DEFINES = -DLSB_FIRST -DLOCAL_LE=1 ENDIANNESS_DEFINES = -DLSB_FIRST -DLOCAL_LE=1
CFLAGS += -DHAVE_ASPRINTF CFLAGS += -DHAVE_ASPRINTF
ZLIB_DIR := ./src/zlib
else ifeq ($(platform), qnx)
TARGET := $(TARGET_NAME)_libretro_qnx.so
fpic := -fPIC
SHARED := -shared -Wl,--version-script=src/drivers/libretro/link.T -Wl,-no-undefined
ENDIANNESS_DEFINES = -DLSB_FIRST -DLOCAL_LE=1
ZLIB_DIR := ./src/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), ios)
TARGET := $(TARGET_NAME)_libretro_ios.dylib
fpic := -fPIC
SHARED := -dynamiclib
ENDIANNESS_DEFINES = -DLSB_FIRST -DLOCAL_LE=1
CFLAGS += -DHAVE_ASPRINTF -DIOS
ZLIB_DIR := ./src/zlib
CC = clang -arch armv7 -isysroot $(IOSSDK) -miphoneos-version-min=5.0
CFLAGS += -DIOS -miphoneos-version-min=5.0
else ifeq ($(platform), ps3) 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 CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
PLATFORM_DEFINES := -D__CELLOS_LV2 PLATFORM_DEFINES := -D__CELLOS_LV2
STATIC_LINKING = 1
else ifeq ($(platform), sncps3) else ifeq ($(platform), sncps3)
TARGET := libretro_ps3.a TARGET := $(TARGET_NAME)_libretro_ps3.a
CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
PLATFORM_DEFINES := -D__CELLOS_LV2 PLATFORM_DEFINES := -D__CELLOS_LV2
STATIC_LINKING = 1
else ifeq ($(platform), psp1)
TARGET := $(TARGET_NAME)_libretro_psp1.a
CC = psp-gcc$(EXE_EXT)
CXX = psp-g++$(EXE_EXT)
AR = psp-ar$(EXE_EXT)
PLATFORM_DEFINES := -DPSP -G0 -DLSB_FIRST -DHAVE_ASPRINTF
STATIC_LINKING = 1
else ifeq ($(platform), psl1ght) else ifeq ($(platform), psl1ght)
TARGET := libretro_psl1ght.a TARGET := $(TARGET_NAME)_libretro_psl1ght.a
CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT) CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT) AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
PLATFORM_DEFINES := -D__CELLOS_LV2 -DHAVE_ASPRINTF PLATFORM_DEFINES := -D__CELLOS_LV2 -DHAVE_ASPRINTF
STATIC_LINKING = 1
else ifeq ($(platform), xenon) else ifeq ($(platform), xenon)
TARGET := libretro_xenon360.a TARGET := $(TARGET_NAME)_libretro_xenon360.a
CC = xenon-gcc$(EXE_EXT) CC = xenon-gcc$(EXE_EXT)
AR = xenon-ar$(EXE_EXT) AR = xenon-ar$(EXE_EXT)
PLATFORM_DEFINES := -D__LIBXENON__ PLATFORM_DEFINES := -D__LIBXENON__
CFLAGS += -DHAVE_ASPRINTF CFLAGS += -DHAVE_ASPRINTF
STATIC_LINKING = 1
else ifeq ($(platform), ngc) else ifeq ($(platform), ngc)
TARGET := libretro_ngc.a TARGET := $(TARGET_NAME)_libretro_ngc.a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT) CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT) AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
PLATFORM_DEFINES := -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float PLATFORM_DEFINES := -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float
CFLAGS += -DHAVE_ASPRINTF CFLAGS += -DHAVE_ASPRINTF
STATIC_LINKING = 1
else ifeq ($(platform), wii) else ifeq ($(platform), wii)
TARGET := libretro_wii.a TARGET := $(TARGET_NAME)_libretro_wii.a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT) CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT) AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
PLATFORM_DEFINES := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float PLATFORM_DEFINES := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float
CFLAGS += -DHAVE_ASPRINTF CFLAGS += -DHAVE_ASPRINTF
STATIC_LINKING = 1
else ifneq (,$(findstring armv,$(platform)))
TARGET := $(TARGET_NAME)_libretro.so
SHARED := -shared -Wl,--version-script=src/drivers/libretro/link.T -Wl,-no-undefined
ENDIANNESS_DEFINES = -DLSB_FIRST -DLOCAL_LE=1
fpic := -fPIC
CC = gcc
ZLIB_DIR := ./src/zlib
ifneq (,$(findstring cortexa8,$(platform)))
PLATFORM_DEFINES += -marm -mcpu=cortex-a8
else ifneq (,$(findstring cortexa9,$(platform)))
PLATFORM_DEFINES += -marm -mcpu=cortex-a9
endif
PLATFORM_DEFINES += -marm
ifneq (,$(findstring neon,$(platform)))
PLATFORM_DEFINES += -mfpu=neon
HAVE_NEON = 1
endif
ifneq (,$(findstring softfloat,$(platform)))
PLATFORM_DEFINES += -mfloat-abi=softfp
else ifneq (,$(findstring hardfloat,$(platform)))
PLATFORM_DEFINES += -mfloat-abi=hard
endif
PLATFORM_DEFINES += -DARM
else else
TARGET := retro.dll TARGET := $(TARGET_NAME)_libretro.dll
CC = gcc CC = gcc
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=src/drivers/libretro/link.T SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=src/drivers/libretro/link.T
ENDIANNESS_DEFINES = -DLSB_FIRST -DLOCAL_LE=1 ENDIANNESS_DEFINES = -DLSB_FIRST -DLOCAL_LE=1
@@ -83,23 +143,34 @@ else
CFLAGS += -O3 -DNDEBUG CFLAGS += -O3 -DNDEBUG
endif endif
ifeq ($(EXTERNAL_ZLIB), 1)
ZLIB_DIR :=
CFLAGS += -DHAVE_EXTERNAL_ZLIB
LDFLAGS += -lz
endif
LIBRETRO_DIR := ./src/drivers/libretro LIBRETRO_DIR := ./src/drivers/libretro
FCEU_DIR := ./src FCEU_DIR := ./src
FCEU_SRC_DIRS := $(LIBRETRO_DIR) $(FCEU_DIR) $(FCEU_DIR)/boards $(FCEU_DIR)/input $(FCEU_DIR)/mappers $(ZLIB_DIR) ifeq ($(WANT_GRIFFIN), 1)
CFLAGS += -DWANT_GRIFFIN
FCEU_SRC_DIRS := $(FCEU_DIR)/boards $(FCEU_DIR)/input $(FCEU_DIR)/mappers $(ZLIB_DIR)
FCEU_CSRCS := $(foreach dir,$(FCEU_SRC_DIRS),$(wildcard $(dir)/*.c))
FCEU_CSRCS += $(LIBRETRO_DIR)/griffin.c $(FCEU_DIR)/ines.c $(FCEU_DIR)/unif.c
else
FCEU_SRC_DIRS := $(LIBRETRO_DIR) $(FCEU_DIR) $(FCEU_DIR)/boards $(FCEU_DIR)/input $(FCEU_DIR)/mappers $(ZLIB_DIR)
FCEU_CSRCS := $(foreach dir,$(FCEU_SRC_DIRS),$(wildcard $(dir)/*.c))
endif
FCEU_CSRCS := $(foreach dir,$(FCEU_SRC_DIRS),$(wildcard $(dir)/*.c))
FCEU_COBJ := $(FCEU_CSRCS:.c=.o) FCEU_COBJ := $(FCEU_CSRCS:.c=.o)
OBJS := $(FCEU_COBJ) OBJS := $(FCEU_COBJ)
FCEU_DEFINES := -D__LIBRETRO__ -DSOUND_QUALITY=0 -DPATH_MAX=1024 -DINLINE=inline -DPSS_STYLE=1 -DFCEU_VERSION_NUMERIC=9813 $(PLATFORM_DEFINES) FCEU_DEFINES := -D__LIBRETRO__ -DSOUND_QUALITY=0 -DPATH_MAX=1024 -DINLINE=inline -DPSS_STYLE=1 -DFCEU_VERSION_NUMERIC=9813 -DFRONTEND_SUPPORTS_RGB565 $(PLATFORM_DEFINES)
ifeq ($(platform), sncps3) ifeq ($(platform), sncps3)
CODE_DEFINES =
WARNING_DEFINES = WARNING_DEFINES =
else else
CODE_DEFINES = -std=gnu99
WARNING_DEFINES = -Wno-write-strings WARNING_DEFINES = -Wno-write-strings
endif endif
@@ -109,18 +180,18 @@ LDFLAGS += -lm
INCDIRS := -I$(LIBRETRO_DIR) -I$(FCEU_DIR) -I$(FCEU_DIR)/input -I$(FCEU_DIR)/boards -I$(FCEU_DIR)/mappers INCDIRS := -I$(LIBRETRO_DIR) -I$(FCEU_DIR) -I$(FCEU_DIR)/input -I$(FCEU_DIR)/boards -I$(FCEU_DIR)/mappers
LIBS := LIBS :=
ifeq ($(platform), psp1)
INCDIRS += -I$(shell psp-config --pspsdk-path)/include
endif
ifeq ($(EXTERNAL_ZLIB), 0)
INCDIRS += -I$(FCEU_DIR)/zlib
endif
all: $(TARGET)
$(TARGET): $(OBJS) $(TARGET): $(OBJS)
ifeq ($(platform), ps3) ifeq ($(STATIC_LINKING), 1)
$(AR) rcs $@ $(OBJS)
else ifeq ($(platform), sncps3)
$(AR) rcs $@ $(OBJS)
else ifeq ($(platform), psl1ght)
$(AR) rcs $@ $(OBJS)
else ifeq ($(platform), xenon)
$(AR) rcs $@ $(OBJS)
else ifeq ($(platform), ngc)
$(AR) rcs $@ $(OBJS)
else ifeq ($(platform), wii)
$(AR) rcs $@ $(OBJS) $(AR) rcs $@ $(OBJS)
else else
$(CC) -o $@ $(SHARED) $(OBJS) $(CFLAGS) $(LDFLAGS) $(LIBS) $(CC) -o $@ $(SHARED) $(OBJS) $(CFLAGS) $(LDFLAGS) $(LIBS)

View File

@@ -0,0 +1,92 @@
#ifndef _S_CRC32_H
#define _S_CRC32_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef HAVE_EXTERNAL_ZLIB
static const unsigned long crc_table[256] = {
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
0x2d02ef8dL
};
#define DO1_CRC32(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8);
#define DO2_CRC32(buf) DO1_CRC32(buf); DO1_CRC32(buf);
#define DO4_CRC32(buf) DO2_CRC32(buf); DO2_CRC32(buf);
#define DO8_CRC32(buf) DO4_CRC32(buf); DO4_CRC32(buf);
unsigned long crc32(unsigned long crc, const unsigned char *buf, unsigned int len)
{
if (buf == 0) return 0L;
crc = crc ^ 0xffffffffL;
while (len >= 8)
{
DO8_CRC32(buf);
len -= 8;
}
if (len) do {
DO1_CRC32(buf);
} while (--len);
return crc ^ 0xffffffffL;
}
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,35 @@
#ifdef WANT_GRIFFIN
#include "drivers/libretro/libretro.c"
#include "drivers/libretro/memstream.c"
#include "cart.c"
#include "crc32.c"
#include "fceu.c"
#include "fceustr.c"
#include "file.c"
#include "general.c"
#include "md5.c"
#include "movie.c"
#include "nsf.c"
#include "ppu.c"
#include "vsuni.c"
#include "x6502.c"
#include "cheat.c"
#include "debug.c"
#include "fceu-endian.c"
#include "fds.c"
#include "filter.c"
#include "input.c"
#include "memory.c"
#include "netplay.c"
#include "palette.c"
#include "state.c"
#include "video.c"
#include "wave.c"
#include "sound.c"
//#include "ines.c"
//#include "unif.c"
#endif

View File

@@ -2,20 +2,30 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := libretro ifeq ($(TARGET_ARCH),arm)
FCEU_SRC_DIRS := ../../../../src ../../../../src/boards ../../../../src/input ../../../../src/mappers LOCAL_CFLAGS += -DANDROID_ARM
LOCAL_ARM_MODE := arm
endif
FCEU_SRC_FILES := $(wildcard $(LOCAL_PATH)/../../../../src/*.c) \ ifeq ($(TARGET_ARCH),x86)
$(wildcard $(LOCAL_PATH)/../../../../src/boards/*.c) \ LOCAL_CFLAGS += -DANDROID_X86
$(wildcard $(LOCAL_PATH)/../../../../src/input/*.c) \ endif
$(wildcard $(LOCAL_PATH)/../../../../src/mappers/*.c)
FCEU_SRC_FILES := $(FCEU_SRC_FILES:$(LOCAL_PATH)/%=%) ifeq ($(TARGET_ARCH),mips)
LOCAL_CFLAGS += -DANDROID_MIPS -D__mips__ -D__MIPSEL__
endif
LOCAL_SRC_FILES = ../libretro/libretro.c \ FCEU_DIR := ../../..
../libretro/memstream.c \ LIBRETRO_DIR := ..
$(FCEU_SRC_FILES)
LOCAL_CFLAGS = -DINLINE=inline -DSOUND_QUALITY=0 -DPATH_MAX=1024 -DPSS_STYLE=1 -DLSB_FIRST -D__LIBRETRO__ -DHAVE_ASPRINTF LOCAL_MODULE := retro
FCEU_SRC_DIRS := $(FCEU_DIR) $(FCEU_DIR)/boards $(FCEU_DIR)/input $(FCEU_DIR)/mappers $(FCEU_DIR)/zlib
FCEU_SRC_FILES := $(foreach dir,$(FCEU_SRC_DIRS),$(wildcard $(dir)/*.c))
LOCAL_SRC_FILES = $(LIBRETRO_DIR)/libretro.c $(LIBRETRO_DIR)/memstream.c $(FCEU_SRC_FILES)
LOCAL_CFLAGS += -DINLINE=inline -DSOUND_QUALITY=0 -DPSS_STYLE=1 -DLSB_FIRST -D__LIBRETRO__ -DHAVE_ASPRINTF -DFCEU_VERSION_NUMERIC=9813 -DFRONTEND_SUPPORTS_RGB565
LOCAL_C_INCLUDES = $(LOCAL_PATH)/$(FCEU_DIR)
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)

View File

@@ -0,0 +1 @@
APP_ABI := all

View File

@@ -1,11 +1,8 @@
#ifdef __LIBRETRO__
#define GENERAL_LIBRETRO
#endif
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdarg.h>
#ifdef _MSC_VER #ifdef _MSC_VER
#define snprintf _snprintf #define snprintf _snprintf
@@ -13,21 +10,21 @@
#include "libretro.h" #include "libretro.h"
#include "fceu.h" #include "../../fceu.h"
#include "fceu-endian.h" #include "../../fceu-endian.h"
#include "input.h" #include "../../input.h"
#include "state.h" #include "../..//state.h"
#include "ppu.h" #include "../../ppu.h"
#include "cart.h" #include "../../cart.h"
#include "x6502.h" #include "../../x6502.h"
#include "git.h" #include "../../git.h"
#include "palette.h" #include "../../palette.h"
#include "sound.h" #include "../../sound.h"
#include "file.h" #include "../../file.h"
#include "cheat.h" #include "../../cheat.h"
#include "ines.h" #include "../../ines.h"
#include "unif.h" #include "../../unif.h"
#include "fds.h" #include "../../fds.h"
#include <string.h> #include <string.h>
#include "memstream.h" #include "memstream.h"
@@ -37,18 +34,24 @@ static retro_input_poll_t poll_cb = NULL;
static retro_input_state_t input_cb = NULL; static retro_input_state_t input_cb = NULL;
static retro_audio_sample_batch_t audio_batch_cb = NULL; static retro_audio_sample_batch_t audio_batch_cb = NULL;
static retro_environment_t environ_cb = NULL; static retro_environment_t environ_cb = NULL;
static bool use_overscan;
/* emulator-specific variables */ /* emulator-specific variables */
static uint16_t palette[256]; #ifdef PSP
#include "pspgu.h"
static __attribute__((aligned(16))) uint16_t retro_palette[256];
#else
static uint16_t retro_palette[256];
#endif
static int32 *sound = 0; static int32 *sound = 0;
static uint32 JSReturn[2]; static uint32 JSReturn[2];
static uint32 current_palette = 0; static uint32 current_palette = 0;
int PPUViewScanline = 0; int PPUViewScanline=0;
int PPUViewer = 0; int PPUViewer=0;
int UpdatePPUView = 0;
/* extern forward decls.*/ /* extern forward decls.*/
extern FCEUGI *GameInfo; extern FCEUGI *GameInfo;
@@ -58,49 +61,79 @@ extern CartInfo UNIFCart;
/* emulator-specific callback functions */ /* emulator-specific callback functions */
const char * GetKeyboard(void) { void UpdatePPUView(int refreshchr) { }
const char * GetKeyboard(void)
{
return ""; return "";
} }
int FCEUD_SendData(void *data, uint32 len) { int FCEUD_SendData(void *data, uint32 len)
{
return 1; return 1;
} }
void FCEUD_SetPalette(unsigned char index, unsigned char r, unsigned char g, unsigned char b) { #if defined (PSP)
r >>= 3; #define RED_SHIFT 0
g >>= 3; #define GREEN_SHIFT 5
b >>= 3; #define BLUE_SHIFT 11
palette[index] = (r << 10) | (g << 5) | (b << 0); #define RED_EXPAND 3
#define GREEN_EXPAND 2
#define BLUE_EXPAND 3
#elif defined (FRONTEND_SUPPORTS_RGB565)
#define RED_SHIFT 11
#define GREEN_SHIFT 5
#define BLUE_SHIFT 0
#define RED_EXPAND 3
#define GREEN_EXPAND 2
#define BLUE_EXPAND 3
#else
#define RED_SHIFT 10
#define GREEN_SHIFT 5
#define BLUE_SHIFT 0
#define RED_EXPAND 3
#define GREEN_EXPAND 3
#define BLUE_EXPAND 3
#endif
void FCEUD_SetPalette(unsigned char index, unsigned char r, unsigned char g, unsigned char b)
{
r >>= RED_EXPAND;
g >>= GREEN_EXPAND;
b >>= BLUE_EXPAND;
retro_palette[index] = (r << RED_SHIFT) | (g << GREEN_SHIFT) | (b << BLUE_SHIFT);
} }
bool FCEUD_ShouldDrawInputAids(void) { bool FCEUD_ShouldDrawInputAids (void)
{
return 1; return 1;
} }
void FCEUD_PrintError(char *c) { void FCEUD_PrintError(char *c)
} { }
void FCEUD_Message(char *s) { void FCEUD_Message(char *s)
} { }
void FCEUD_NetworkClose(void) { void FCEUD_NetworkClose(void)
} { }
void FCEUD_GetPalette(uint8 i, uint8 *r, uint8 *g, uint8 *b) { void FCEUD_GetPalette(uint8 i,uint8 *r, uint8 *g, uint8 *b) { }
}
void FCEUD_SoundToggle(void) { void FCEUD_SoundToggle (void)
{
FCEUI_SetSoundVolume(100); FCEUI_SetSoundVolume(100);
} }
void FCEUD_VideoChanged(void) { void FCEUD_VideoChanged (void)
} { }
FILE *FCEUD_UTF8fopen(const char *n, const char *m) { FILE *FCEUD_UTF8fopen(const char *n, const char *m)
{
return fopen(n, m); return fopen(n, m);
} }
#define MAX_PAH 1024 #define MAX_PATH 1024
/*palette for FCEU*/ /*palette for FCEU*/
#define MAXPAL 13 #define MAXPAL 13
@@ -111,6 +144,7 @@ struct st_palettes {
unsigned int data[64]; unsigned int data[64];
}; };
struct st_palettes palettes[] = { struct st_palettes palettes[] = {
{ "asqrealc", "AspiringSquire's Real palette", { "asqrealc", "AspiringSquire's Real palette",
{ 0x6c6c6c, 0x00268e, 0x0000a8, 0x400094, { 0x6c6c6c, 0x00268e, 0x0000a8, 0x400094,
@@ -128,7 +162,8 @@ struct st_palettes palettes[] = {
0xffffff, 0xb0d4ff, 0xc4c4ff, 0xe8b8ff, 0xffffff, 0xb0d4ff, 0xc4c4ff, 0xe8b8ff,
0xffb0ff, 0xffb8e8, 0xffc4c4, 0xffd4a8, 0xffb0ff, 0xffb8e8, 0xffc4c4, 0xffd4a8,
0xffe890, 0xf0f4a4, 0xc0ffc0, 0xacf4f0, 0xffe890, 0xf0f4a4, 0xc0ffc0, 0xacf4f0,
0xa0e8ff, 0xc2c2c2, 0x202020, 0x101010 } }, 0xa0e8ff, 0xc2c2c2, 0x202020, 0x101010 }
},
{ "loopy", "Loopy's palette", { "loopy", "Loopy's palette",
{ 0x757575, 0x271b8f, 0x0000ab, 0x47009f, { 0x757575, 0x271b8f, 0x0000ab, 0x47009f,
0x8f0077, 0xab0013, 0xa70000, 0x7f0b00, 0x8f0077, 0xab0013, 0xa70000, 0x7f0b00,
@@ -145,7 +180,8 @@ struct st_palettes palettes[] = {
0xffffff, 0xabe7ff, 0xc7d7ff, 0xd7cbff, 0xffffff, 0xabe7ff, 0xc7d7ff, 0xd7cbff,
0xffc7ff, 0xffc7db, 0xffbfb3, 0xffdbab, 0xffc7ff, 0xffc7db, 0xffbfb3, 0xffdbab,
0xffe7a3, 0xe3ffa3, 0xabf3bf, 0xb3ffcf, 0xffe7a3, 0xe3ffa3, 0xabf3bf, 0xb3ffcf,
0x9ffff3, 0x000000, 0x000000, 0x000000 } }, 0x9ffff3, 0x000000, 0x000000, 0x000000 }
},
{ "quor", "Quor's palette", { "quor", "Quor's palette",
{ 0x3f3f3f, 0x001f3f, 0x00003f, 0x1f003f, { 0x3f3f3f, 0x001f3f, 0x00003f, 0x1f003f,
0x3f003f, 0x3f0020, 0x3f0000, 0x3f2000, 0x3f003f, 0x3f0020, 0x3f0000, 0x3f2000,
@@ -162,7 +198,8 @@ struct st_palettes palettes[] = {
0xffffff, 0xc0dfff, 0xc0c0ff, 0xdfc0ff, 0xffffff, 0xc0dfff, 0xc0c0ff, 0xdfc0ff,
0xffc0ff, 0xffc0e0, 0xffc0c0, 0xffe0c0, 0xffc0ff, 0xffc0e0, 0xffc0c0, 0xffe0c0,
0xffffc0, 0xe0ffc0, 0xc0ffc0, 0xc0ffe0, 0xffffc0, 0xe0ffc0, 0xc0ffc0, 0xc0ffe0,
0xc0ffff, 0x000000, 0x000000, 0x000000 } }, 0xc0ffff, 0x000000, 0x000000, 0x000000 }
},
{ "chris", "Chris Covell's palette", { "chris", "Chris Covell's palette",
{ 0x808080, 0x003DA6, 0x0012B0, 0x440096, { 0x808080, 0x003DA6, 0x0012B0, 0x440096,
0xA1005E, 0xC70028, 0xBA0600, 0x8C1700, 0xA1005E, 0xC70028, 0xBA0600, 0x8C1700,
@@ -179,7 +216,8 @@ struct st_palettes palettes[] = {
0xFFFFFF, 0xA6FCFF, 0xB3ECFF, 0xDAABEB, 0xFFFFFF, 0xA6FCFF, 0xB3ECFF, 0xDAABEB,
0xFFA8F9, 0xFFABB3, 0xFFD2B0, 0xFFEFA6, 0xFFA8F9, 0xFFABB3, 0xFFD2B0, 0xFFEFA6,
0xFFF79C, 0xD7E895, 0xA6EDAF, 0xA2F2DA, 0xFFF79C, 0xD7E895, 0xA6EDAF, 0xA2F2DA,
0x99FFFC, 0xDDDDDD, 0x111111, 0x111111 } }, 0x99FFFC, 0xDDDDDD, 0x111111, 0x111111 }
},
{ "matt", "Matthew Conte's palette", { "matt", "Matthew Conte's palette",
{ 0x808080, 0x0000bb, 0x3700bf, 0x8400a6, { 0x808080, 0x0000bb, 0x3700bf, 0x8400a6,
0xbb006a, 0xb7001e, 0xb30000, 0x912600, 0xbb006a, 0xb7001e, 0xb30000, 0x912600,
@@ -196,7 +234,8 @@ struct st_palettes palettes[] = {
0xffffff, 0x84bfff, 0xbbbbff, 0xd0bbff, 0xffffff, 0x84bfff, 0xbbbbff, 0xd0bbff,
0xffbfea, 0xffbfcc, 0xffc4b7, 0xffccae, 0xffbfea, 0xffbfcc, 0xffc4b7, 0xffccae,
0xffd9a2, 0xcce199, 0xaeeeb7, 0xaaf7ee, 0xffd9a2, 0xcce199, 0xaeeeb7, 0xaaf7ee,
0xb3eeff, 0xdddddd, 0x111111, 0x111111 } }, 0xb3eeff, 0xdddddd, 0x111111, 0x111111 }
},
{ "pasofami", "PasoFami/99 palette", { "pasofami", "PasoFami/99 palette",
{ 0x7f7f7f, 0x0000ff, 0x0000bf, 0x472bbf, { 0x7f7f7f, 0x0000ff, 0x0000bf, 0x472bbf,
0x970087, 0xab0023, 0xab1300, 0x8b1700, 0x970087, 0xab0023, 0xab1300, 0x8b1700,
@@ -213,7 +252,8 @@ struct st_palettes palettes[] = {
0xffffff, 0xa7e7ff, 0xb8b8f8, 0xd8b8f8, 0xffffff, 0xa7e7ff, 0xb8b8f8, 0xd8b8f8,
0xf8b8f8, 0xfba7c3, 0xf0d0b0, 0xffe3ab, 0xf8b8f8, 0xfba7c3, 0xf0d0b0, 0xffe3ab,
0xfbdb7b, 0xd8f878, 0xb8f8b8, 0xb8f8d8, 0xfbdb7b, 0xd8f878, 0xb8f8b8, 0xb8f8d8,
0x00ffff, 0xf8d8f8, 0x000000, 0x000000 } }, 0x00ffff, 0xf8d8f8, 0x000000, 0x000000 }
},
{ "crashman", "CrashMan's palette", { "crashman", "CrashMan's palette",
{ 0x585858, 0x001173, 0x000062, 0x472bbf, { 0x585858, 0x001173, 0x000062, 0x472bbf,
0x970087, 0x910009, 0x6f1100, 0x4c1008, 0x970087, 0x910009, 0x6f1100, 0x4c1008,
@@ -230,7 +270,8 @@ struct st_palettes palettes[] = {
0xffffff, 0xa7e7ff, 0xb8b8f8, 0xd8b8f8, 0xffffff, 0xa7e7ff, 0xb8b8f8, 0xd8b8f8,
0xe6a6ff, 0xf29dc4, 0xf0c0b0, 0xfce4b0, 0xe6a6ff, 0xf29dc4, 0xf0c0b0, 0xfce4b0,
0xe0e01e, 0xd8f878, 0xc0e890, 0x95f7c8, 0xe0e01e, 0xd8f878, 0xc0e890, 0x95f7c8,
0x98e0e8, 0xf8d8f8, 0x000000, 0x000000 } }, 0x98e0e8, 0xf8d8f8, 0x000000, 0x000000 }
},
{ "mess", "MESS palette", { "mess", "MESS palette",
{ 0x747474, 0x24188c, 0x0000a8, 0x44009c, { 0x747474, 0x24188c, 0x0000a8, 0x44009c,
0x8c0074, 0xa80010, 0xa40000, 0x7c0800, 0x8c0074, 0xa80010, 0xa40000, 0x7c0800,
@@ -247,7 +288,8 @@ struct st_palettes palettes[] = {
0xfcfcfc, 0xa8e4fc, 0xc4d4fc, 0xd4c8fc, 0xfcfcfc, 0xa8e4fc, 0xc4d4fc, 0xd4c8fc,
0xfcc4fc, 0xfcc4d8, 0xfcbcb0, 0xfcd8a8, 0xfcc4fc, 0xfcc4d8, 0xfcbcb0, 0xfcd8a8,
0xfce4a0, 0xe0fca0, 0xa8f0bc, 0xb0fccc, 0xfce4a0, 0xe0fca0, 0xa8f0bc, 0xb0fccc,
0x9cfcf0, 0x000000, 0x000000, 0x000000 } }, 0x9cfcf0, 0x000000, 0x000000, 0x000000 }
},
{ "zaphod-cv", "Zaphod's VS Castlevania palette", { "zaphod-cv", "Zaphod's VS Castlevania palette",
{ 0x7f7f7f, 0xffa347, 0x0000bf, 0x472bbf, { 0x7f7f7f, 0xffa347, 0x0000bf, 0x472bbf,
0x970087, 0xf85898, 0xab1300, 0xf8b8f8, 0x970087, 0xf85898, 0xab1300, 0xf8b8f8,
@@ -264,7 +306,8 @@ struct st_palettes palettes[] = {
0xffffff, 0xa7e7ff, 0x5bdb57, 0xe75f13, 0xffffff, 0xa7e7ff, 0x5bdb57, 0xe75f13,
0x004358, 0x0000ff, 0xe7005b, 0x00b800, 0x004358, 0x0000ff, 0xe7005b, 0x00b800,
0xfbdb7b, 0xd8f878, 0x8b1700, 0xffe3ab, 0xfbdb7b, 0xd8f878, 0x8b1700, 0xffe3ab,
0x00ffff, 0xab0023, 0x000000, 0x000000 } }, 0x00ffff, 0xab0023, 0x000000, 0x000000 }
},
{ "zaphod-smb", "Zaphod's VS SMB palette", { "zaphod-smb", "Zaphod's VS SMB palette",
{ 0x626a00, 0x0000ff, 0x006a77, 0x472bbf, { 0x626a00, 0x0000ff, 0x006a77, 0x472bbf,
0x970087, 0xab0023, 0xab1300, 0xb74800, 0x970087, 0xab0023, 0xab1300, 0xb74800,
@@ -281,7 +324,8 @@ struct st_palettes palettes[] = {
0xffffff, 0xa7e7ff, 0x590400, 0xbb0000, 0xffffff, 0xa7e7ff, 0x590400, 0xbb0000,
0xf8b8f8, 0xfba7c3, 0xffffff, 0x00e3e1, 0xf8b8f8, 0xfba7c3, 0xffffff, 0x00e3e1,
0xfbdb7b, 0xffae00, 0xb8f8b8, 0xb8f8d8, 0xfbdb7b, 0xffae00, 0xb8f8b8, 0xb8f8d8,
0x00ff00, 0xf8d8f8, 0xffaaaa, 0x004000 } }, 0x00ff00, 0xf8d8f8, 0xffaaaa, 0x004000 }
},
{ "vs-drmar", "VS Dr. Mario palette", { "vs-drmar", "VS Dr. Mario palette",
{ 0x5f97ff, 0x000000, 0x000000, 0x47009f, { 0x5f97ff, 0x000000, 0x000000, 0x47009f,
0x00ab00, 0xffffff, 0xabe7ff, 0x000000, 0x00ab00, 0xffffff, 0xabe7ff, 0x000000,
@@ -298,7 +342,8 @@ struct st_palettes palettes[] = {
0x00ebdb, 0x000000, 0x000000, 0x000000, 0x00ebdb, 0x000000, 0x000000, 0x000000,
0x000000, 0x000000, 0xf3bf3f, 0x000000, 0x000000, 0x000000, 0xf3bf3f, 0x000000,
0x005100, 0x000000, 0xc7d7ff, 0xffdbab, 0x005100, 0x000000, 0xc7d7ff, 0xffdbab,
0x000000, 0x000000, 0x000000, 0x000000 } }, 0x000000, 0x000000, 0x000000, 0x000000 }
},
{ "vs-cv", "VS Castlevania palette", { "vs-cv", "VS Castlevania palette",
{ 0xaf7f00, 0xffa347, 0x008b8b, 0x472bbf, { 0xaf7f00, 0xffa347, 0x008b8b, 0x472bbf,
0x970087, 0xf85898, 0xab1300, 0xf8b8f8, 0x970087, 0xf85898, 0xab1300, 0xf8b8f8,
@@ -315,7 +360,8 @@ struct st_palettes palettes[] = {
0xffffff, 0xa7e7ff, 0x5bdb57, 0x6b88ff, 0xffffff, 0xa7e7ff, 0x5bdb57, 0x6b88ff,
0x004358, 0x0000ff, 0xe7005b, 0x00b800, 0x004358, 0x0000ff, 0xe7005b, 0x00b800,
0xfbdb7b, 0xffa347, 0x8b1700, 0xffe3ab, 0xfbdb7b, 0xffa347, 0x8b1700, 0xffe3ab,
0xb8f818, 0xab0023, 0x000000, 0x007800 } }, 0xb8f818, 0xab0023, 0x000000, 0x007800 }
},
{ "vs-smb", "VS SMB/VS Ice Climber palette", { "vs-smb", "VS SMB/VS Ice Climber palette",
{ 0xaf7f00, 0x0000ff, 0x008b8b, 0x472bbf, { 0xaf7f00, 0x0000ff, 0x008b8b, 0x472bbf,
0x970087, 0xab0023, 0x0000ff, 0xe75f13, 0x970087, 0xab0023, 0x0000ff, 0xe75f13,
@@ -332,117 +378,155 @@ struct st_palettes palettes[] = {
0xffffff, 0xa7e7ff, 0xb8b8f8, 0xf83800, 0xffffff, 0xa7e7ff, 0xb8b8f8, 0xf83800,
0xf8b8f8, 0xfba7c3, 0xffffff, 0x00ffff, 0xf8b8f8, 0xfba7c3, 0xffffff, 0x00ffff,
0xfbdb7b, 0xffa347, 0xb8f8b8, 0xb8f8d8, 0xfbdb7b, 0xffa347, 0xb8f8b8, 0xb8f8d8,
0xb8f818, 0xf8d8f8, 0x000000, 0x007800 } } 0xb8f818, 0xf8d8f8, 0x000000, 0x007800 }
}
}; };
unsigned retro_api_version(void) { unsigned retro_api_version(void)
{
return RETRO_API_VERSION; return RETRO_API_VERSION;
} }
void retro_set_video_refresh(retro_video_refresh_t cb) { void retro_set_video_refresh(retro_video_refresh_t cb)
{
video_cb = cb; video_cb = cb;
} }
void retro_set_audio_sample(retro_audio_sample_t cb) { void retro_set_audio_sample(retro_audio_sample_t cb)
} { }
void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb) { void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb)
{
audio_batch_cb = cb; audio_batch_cb = cb;
} }
void retro_set_input_poll(retro_input_poll_t cb) { void retro_set_input_poll(retro_input_poll_t cb)
{
poll_cb = cb; poll_cb = cb;
} }
void retro_set_input_state(retro_input_state_t cb) { void retro_set_input_state(retro_input_state_t cb)
{
input_cb = cb; input_cb = cb;
} }
void retro_set_controller_port_device(unsigned a, unsigned b) { void retro_set_controller_port_device(unsigned a, unsigned b)
} {}
void retro_set_environment(retro_environment_t cb) { void retro_set_environment(retro_environment_t cb)
{
static const struct retro_variable vars[] = {
{ "nes_palette", "Color Palette; asqrealc|loopy|quor|chris|matt|pasofami|crashman|mess|zaphod-cv|zaphod-smb|vs-drmar|vs-cv|vs-smb" },
{ NULL, NULL },
};
environ_cb = cb; environ_cb = cb;
cb(RETRO_ENVIRONMENT_SET_VARIABLES, (void*)vars);
} }
void retro_get_system_info(struct retro_system_info *info) { void retro_get_system_info(struct retro_system_info *info)
{
info->need_fullpath = true; info->need_fullpath = true;
info->valid_extensions = "fds|FDS|zip|ZIP|nes|NES|unif|UNIF"; info->valid_extensions = "fds|nes|unif";
info->library_version = "r88 (SVN)"; info->library_version = "98.13mm (SVN)";
info->library_name = "FCEUmm"; info->library_name = "FCEUmm";
info->block_extract = false; info->block_extract = false;
} }
void retro_get_system_av_info(struct retro_system_av_info *info) { void retro_get_system_av_info(struct retro_system_av_info *info)
info->geometry.base_width = 256; {
info->geometry.base_height = 240; unsigned width = use_overscan ? 256 : (256 - 16);
info->geometry.max_width = 256; unsigned height = use_overscan ? 240 : (240 - 16);
info->geometry.max_height = 240; info->geometry.base_width = width;
info->geometry.base_height = height;
info->geometry.max_width = width;
info->geometry.max_height = height;
info->geometry.aspect_ratio = 4.0 / 3.0;
info->timing.sample_rate = 32050.0; info->timing.sample_rate = 32050.0;
if (FSettings.PAL) if (FSettings.PAL)
info->timing.fps = 838977920.0 / 16777215.0; info->timing.fps = 838977920.0/16777215.0;
else else
info->timing.fps = 1008307711.0 / 16777215.0; info->timing.fps = 1008307711.0/16777215.0;
info->timing.sample_rate = 32040.5; info->timing.sample_rate = 32040.5;
} }
void retro_init(void) { void retro_init(void)
{
#ifdef FRONTEND_SUPPORTS_RGB565
enum retro_pixel_format 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
PowerNES(); PowerNES();
} }
static void emulator_set_input(void) { static void emulator_set_input(void)
// ?!?!?!?! Why does this matter?! {
#if defined(__CELLOS_LV2__) || defined(_XBOX) || defined(GEKKO) // <-- big endian
FCEUI_SetInput(0, SI_GAMEPAD, &JSReturn[0], 0); FCEUI_SetInput(0, SI_GAMEPAD, &JSReturn[0], 0);
FCEUI_SetInput(1, SI_GAMEPAD, &JSReturn[0], 0); FCEUI_SetInput(1, SI_GAMEPAD, &JSReturn[0], 0);
#else
FCEUI_SetInput(0, SI_GAMEPAD, &JSReturn[0], 0);
FCEUI_SetInput(1, SI_GAMEPAD, &JSReturn[1], 0);
#endif
} }
static void emulator_set_custom_palette(void) { static void emulator_set_custom_palette (void)
if (current_palette == 0) { {
uint8 i,r,g,b;
if (current_palette == 0)
{
FCEU_ResetPalette(); /* Do palette reset*/ FCEU_ResetPalette(); /* Do palette reset*/
} else { return;
/* Now setup this palette*/
uint8 i, r, g, b;
for (i = 0; i < 64; i++) {
r = palettes[current_palette - 1].data[i] >> 16;
g = (palettes[current_palette - 1].data[i] & 0xff00) >> 8;
b = (palettes[current_palette - 1].data[i] & 0xff);
FCEUD_SetPalette(i, r, g, b);
FCEUD_SetPalette(i + 64, r, g, b);
FCEUD_SetPalette(i + 128, r, g, b);
FCEUD_SetPalette(i + 192, r, g, b);
} }
/* Setup this palette*/
for ( i = 0; i < 64; i++ )
{
r = palettes[current_palette-1].data[i] >> 16;
g = ( palettes[current_palette-1].data[i] & 0xff00 ) >> 8;
b = ( palettes[current_palette-1].data[i] & 0xff );
FCEUD_SetPalette( i, r, g, b);
FCEUD_SetPalette( i+64, r, g, b);
FCEUD_SetPalette( i+128, r, g, b);
FCEUD_SetPalette( i+192, r, g, b);
} }
} }
static void fceu_init(const char * full_path) { static bool fceu_init(const char * full_path)
{
char* dir=NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &dir) && dir)
{
FCEUI_SetBaseDirectory(dir);
}
FCEUI_Initialize(); FCEUI_Initialize();
FCEUI_SetSoundVolume(256); FCEUI_SetSoundVolume(256);
FCEUI_Sound(32050); FCEUI_Sound(32050);
GameInfo = FCEUI_LoadGame(full_path); GameInfo = FCEUI_LoadGame(full_path);
if (!GameInfo) return false;
emulator_set_input(); emulator_set_input();
emulator_set_custom_palette(); emulator_set_custom_palette();
FCEUD_SoundToggle(); FCEUD_SoundToggle();
return true;
} }
void retro_deinit(void) { void retro_deinit (void)
{
FCEUI_CloseGame();
FCEUI_Kill();
} }
void retro_reset(void) { void retro_reset(void)
{
ResetNES(); ResetNES();
} }
typedef struct { typedef struct
{
unsigned retro; unsigned retro;
unsigned nes; unsigned nes;
} keymap; } keymap;
@@ -458,7 +542,8 @@ static const keymap bindmap[] = {
{ RETRO_DEVICE_ID_JOYPAD_RIGHT, JOY_RIGHT }, { RETRO_DEVICE_ID_JOYPAD_RIGHT, JOY_RIGHT },
}; };
static void update_input(void) { static void update_input(void)
{
unsigned i; unsigned i;
unsigned char pad[2]; unsigned char pad[2];
@@ -467,47 +552,152 @@ static void update_input(void) {
poll_cb(); poll_cb();
for (i = 0; i < 8; i++) { for ( i = 0; i < 8; i++)
pad[0] |= input_cb(0, RETRO_DEVICE_JOYPAD, 0, bindmap[i].retro) ? bindmap[i].nes : 0; pad[0] |= input_cb(0, RETRO_DEVICE_JOYPAD, 0, bindmap[i].retro) ? bindmap[i].nes : 0;
pad[1] |= input_cb(1, RETRO_DEVICE_JOYPAD, 0, bindmap[i].retro) ? bindmap[i].nes : 0;
}
// This shouldn't matter. Why? Something very weird is going on. for ( i = 0; i < 8; i++)
#if defined(__CELLOS_LV2__) || defined(_XBOX360) || defined(GEKKO) // <-- big endian pad[1] |= input_cb(1, RETRO_DEVICE_JOYPAD, 0, bindmap[i].retro) ? bindmap[i].nes : 0;
JSReturn[0] = pad[0] | (pad[1] << 8); JSReturn[0] = pad[0] | (pad[1] << 8);
#else
JSReturn[0] = pad[0];
JSReturn[1] = pad[1];
#endif
} }
void retro_run(void) { static void check_variables(void)
unsigned y, x; {
struct retro_variable var = {0};
var.key = "nes_palette";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
unsigned orig_value = current_palette;
if (strcmp(var.value, "asqreal") == 0)
current_palette = 0;
else if (strcmp(var.value, "loopy") == 0)
current_palette = 1;
else if (strcmp(var.value, "quor") == 0)
current_palette = 2;
else if (strcmp(var.value, "chris") == 0)
current_palette = 3;
else if (strcmp(var.value, "matt") == 0)
current_palette = 4;
else if (strcmp(var.value, "matt") == 0)
current_palette = 5;
else if (strcmp(var.value, "pasofami") == 0)
current_palette = 6;
else if (strcmp(var.value, "crashman") == 0)
current_palette = 7;
else if (strcmp(var.value, "mess") == 0)
current_palette = 8;
else if (strcmp(var.value, "zaphod-cv") == 0)
current_palette = 9;
else if (strcmp(var.value, "zaphod-smb") == 0)
current_palette = 10;
else if (strcmp(var.value, "vs-drmar") == 0)
current_palette = 11;
else if (strcmp(var.value, "vs-cv") == 0)
current_palette = 12;
else if (strcmp(var.value, "vs-smb") == 0)
current_palette = 13;
if (current_palette != orig_value)
emulator_set_custom_palette();
}
}
void retro_run(void)
{
unsigned y, x, width, height, pitch;
uint8_t *gfx; uint8_t *gfx;
int32 ssize;
bool updated;
#ifndef PSP
static uint16_t video_out[256 * 240]; static uint16_t video_out[256 * 240];
int32 ssize = 0; #endif
ssize = 0;
updated = false;
update_input(); update_input();
FCEUI_Emulate(&gfx, &sound, &ssize, 0); FCEUI_Emulate(&gfx, &sound, &ssize, 0);
gfx = XBuf; #ifdef PSP
for (y = 0; y < 240; y++) static unsigned int __attribute__((aligned(16))) d_list[32];
for (x = 0; x < 256; x++, gfx++) void* const texture_vram_p = (void*) (0x44200000 - (256 * 256)); // max VRAM address - frame size
video_out[y * 256 + x] = palette[*gfx];
video_cb(video_out, 256, 240, 512); sceKernelDcacheWritebackRange(retro_palette,256 * 2);
sceKernelDcacheWritebackRange(XBuf, 256*240 );
sceGuStart(GU_DIRECT, d_list);
// sceGuCopyImage doesnt seem to work correctly with GU_PSM_T8
// so we use GU_PSM_4444 ( 2 Bytes per pixel ) instead
// with half the values for pitch / width / x offset
if (use_overscan)
sceGuCopyImage(GU_PSM_4444, 0, 0, 128, 240, 128, XBuf, 0, 0, 128, texture_vram_p);
else
sceGuCopyImage(GU_PSM_4444, 4, 4, 120, 224, 128, XBuf, 0, 0, 128, texture_vram_p);
sceGuTexSync();
sceGuTexImage(0, 256, 256, 256, texture_vram_p);
sceGuTexMode(GU_PSM_T8, 0, 0, GU_FALSE);
sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGB);
sceGuDisable(GU_BLEND);
sceGuClutMode(GU_PSM_5650, 0, 0xFF, 0);
sceGuClutLoad(32, retro_palette);
sceGuFinish();
#endif
if (use_overscan)
{
width = 256;
height = 240;
#ifdef PSP
pitch = 256;
video_cb(texture_vram_p, width, height, pitch);
#else
pitch = 512;
gfx = XBuf;
for (y = 0; y < height; y++)
for ( x = 0; x < width; x++, gfx++)
video_out[y * width + x] = retro_palette[*gfx];
video_cb(video_out, width, height, pitch);
#endif
}
else
{
width = 256 - 16;
height = 240 - 16;
#ifdef PSP
pitch = 256;
video_cb(texture_vram_p, width, height, pitch);
#else
pitch = 512 - 32;
gfx = XBuf + 8 + 256 * 8;
for (y = 0; y < height; y++, gfx += 16)
for ( x = 0; x < width; x++, gfx++)
video_out[y * width + x] = retro_palette[*gfx];
video_cb(video_out, width, height, pitch);
#endif
}
for (y = 0; y < ssize; y++) for (y = 0; y < ssize; y++)
sound[y] = (sound[y] << 16) | (sound[y] & 0xffff); sound[y] = (sound[y] << 16) | (sound[y] & 0xffff);
audio_batch_cb((const int16_t*)sound, ssize); audio_batch_cb((const int16_t*)sound, ssize);
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
check_variables();
} }
static unsigned serialize_size = 0; static unsigned serialize_size = 0;
size_t retro_serialize_size(void) { size_t retro_serialize_size(void)
if (serialize_size == 0) { {
if (serialize_size == 0)
{
/* Something arbitrarily big.*/ /* Something arbitrarily big.*/
uint8_t *buffer = (uint8_t*)malloc(1000000); uint8_t *buffer = (uint8_t*)malloc(1000000);
memstream_set_buffer(buffer, 1000000); memstream_set_buffer(buffer, 1000000);
@@ -520,52 +710,63 @@ size_t retro_serialize_size(void) {
return serialize_size; return serialize_size;
} }
bool retro_serialize(void *data, size_t size) { bool retro_serialize(void *data, size_t size)
{
if (size != retro_serialize_size()) if (size != retro_serialize_size())
return FALSE; return false;
memstream_set_buffer((uint8_t*)data, size); memstream_set_buffer((uint8_t*)data, size);
FCEUSS_Save(""); FCEUSS_Save("");
return TRUE; return true;
} }
bool retro_unserialize(const void * data, size_t size) { bool retro_unserialize(const void * data, size_t size)
{
if (size != retro_serialize_size()) if (size != retro_serialize_size())
return FALSE; return false;
memstream_set_buffer((uint8_t*)data, size); memstream_set_buffer((uint8_t*)data, size);
FCEUSS_Load(""); FCEUSS_Load("");
return TRUE; return true;
} }
void retro_cheat_reset(void) { void retro_cheat_reset(void)
} {}
void retro_cheat_set(unsigned a, bool b, const char* c) { void retro_cheat_set(unsigned a, bool b, const char* c)
} { }
bool retro_load_game(const struct retro_game_info *game) { bool retro_load_game(const struct retro_game_info *game)
fceu_init(game->path); {
if (!fceu_init(game->path)) return false;
check_variables();
return TRUE; if (!environ_cb(RETRO_ENVIRONMENT_GET_OVERSCAN, &use_overscan))
use_overscan = true;
return true;
} }
bool retro_load_game_special( bool retro_load_game_special(
unsigned game_type, unsigned game_type,
const struct retro_game_info *info, size_t num_info const struct retro_game_info *info, size_t num_info
) { )
{
return false; return false;
} }
void retro_unload_game(void) { void retro_unload_game(void)
{
FCEUI_CloseGame(); FCEUI_CloseGame();
} }
unsigned retro_get_region(void) { unsigned retro_get_region(void)
{
return FSettings.PAL ? RETRO_REGION_PAL : RETRO_REGION_NTSC; return FSettings.PAL ? RETRO_REGION_PAL : RETRO_REGION_NTSC;
} }
void *retro_get_memory_data(unsigned id) { void *retro_get_memory_data(unsigned id)
{
if (id != RETRO_MEMORY_SAVE_RAM) if (id != RETRO_MEMORY_SAVE_RAM)
return NULL; return NULL;
@@ -577,7 +778,8 @@ void *retro_get_memory_data(unsigned id) {
return 0; return 0;
} }
size_t retro_get_memory_size(unsigned id) { size_t retro_get_memory_size(unsigned id)
{
if (id != RETRO_MEMORY_SAVE_RAM) if (id != RETRO_MEMORY_SAVE_RAM)
return 0; return 0;

995
src/drivers/libretro/libretro.h Normal file → Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -9,20 +9,23 @@ static uint8_t *g_buffer = NULL;
static size_t g_size = 0; static size_t g_size = 0;
static size_t g_last_file_size = 0; static size_t g_last_file_size = 0;
struct memstream { struct memstream
{
uint8_t *m_buf; uint8_t *m_buf;
size_t m_size; size_t m_size;
size_t m_ptr; size_t m_ptr;
size_t m_max_ptr; size_t m_max_ptr;
bool writing; unsigned writing;
}; };
static void memstream_update_ptr(memstream_t *stream) { static void memstream_update_ptr(memstream_t *stream)
{
if (stream->m_ptr > stream->m_max_ptr) if (stream->m_ptr > stream->m_max_ptr)
stream->m_max_ptr = stream->m_ptr; stream->m_max_ptr = stream->m_ptr;
} }
static void memstream_init(memstream_t *stream, uint8_t *buffer, size_t max_size, bool writing) { static void memstream_init(memstream_t *stream, uint8_t *buffer, size_t max_size, unsigned writing)
{
stream->m_buf = buffer; stream->m_buf = buffer;
stream->m_size = max_size; stream->m_size = max_size;
stream->m_ptr = 0; stream->m_ptr = 0;
@@ -30,16 +33,19 @@ static void memstream_init(memstream_t *stream, uint8_t *buffer, size_t max_size
stream->writing = writing; stream->writing = writing;
} }
void memstream_set_buffer(uint8_t *buffer, size_t size) { void memstream_set_buffer(uint8_t *buffer, size_t size)
{
g_buffer = buffer; g_buffer = buffer;
g_size = size; g_size = size;
} }
size_t memstream_get_last_size(void) { size_t memstream_get_last_size(void)
{
return g_last_file_size; return g_last_file_size;
} }
memstream_t *memstream_open(bool writing) { memstream_t *memstream_open(unsigned writing)
{
memstream_t *stream; memstream_t *stream;
if (!g_buffer || !g_size) if (!g_buffer || !g_size)
return NULL; return NULL;
@@ -51,12 +57,14 @@ memstream_t *memstream_open(bool writing) {
return stream; return stream;
} }
void memstream_close(memstream_t *stream) { void memstream_close(memstream_t *stream)
{
g_last_file_size = stream->writing ? stream->m_max_ptr : stream->m_size; g_last_file_size = stream->writing ? stream->m_max_ptr : stream->m_size;
free(stream); free(stream);
} }
size_t memstream_read(memstream_t *stream, void *data, size_t bytes) { size_t memstream_read(memstream_t *stream, void *data, size_t bytes)
{
size_t avail = stream->m_size - stream->m_ptr; size_t avail = stream->m_size - stream->m_ptr;
if (bytes > avail) if (bytes > avail)
bytes = avail; bytes = avail;
@@ -67,7 +75,8 @@ size_t memstream_read(memstream_t *stream, void *data, size_t bytes) {
return bytes; return bytes;
} }
size_t memstream_write(memstream_t *stream, const void *data, size_t bytes) { size_t memstream_write(memstream_t *stream, const void *data, size_t bytes)
{
size_t avail = stream->m_size - stream->m_ptr; size_t avail = stream->m_size - stream->m_ptr;
if (bytes > avail) if (bytes > avail)
bytes = avail; bytes = avail;
@@ -78,7 +87,8 @@ size_t memstream_write(memstream_t *stream, const void *data, size_t bytes) {
return bytes; return bytes;
} }
int memstream_seek(memstream_t *stream, int offset, int whence) { int memstream_seek(memstream_t *stream, int offset, int whence)
{
size_t ptr; size_t ptr;
if (whence == SEEK_SET) if (whence == SEEK_SET)
ptr = offset; ptr = offset;
@@ -89,18 +99,22 @@ int memstream_seek(memstream_t *stream, int offset, int whence) {
else else
return -1; return -1;
if (ptr <= stream->m_size) { if (ptr <= stream->m_size)
{
stream->m_ptr = ptr; stream->m_ptr = ptr;
return 0; return 0;
} else }
else
return -1; return -1;
} }
size_t memstream_pos(memstream_t *stream) { size_t memstream_pos(memstream_t *stream)
{
return stream->m_ptr; return stream->m_ptr;
} }
int memstream_getc(memstream_t *stream) { int memstream_getc(memstream_t *stream)
{
if (stream->m_ptr >= stream->m_size) if (stream->m_ptr >= stream->m_size)
return EOF; return EOF;
else else
@@ -109,7 +123,8 @@ int memstream_getc(memstream_t *stream) {
memstream_update_ptr(stream); memstream_update_ptr(stream);
} }
void memstream_putc(memstream_t *stream, int c) { void memstream_putc(memstream_t *stream, int c)
{
if (stream->m_ptr < stream->m_size) if (stream->m_ptr < stream->m_size)
stream->m_buf[stream->m_ptr++] = c; stream->m_buf[stream->m_ptr++] = c;

View File

@@ -8,12 +8,11 @@
#else #else
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0
typedef unsigned char bool;
#endif #endif
typedef struct memstream memstream_t; typedef struct memstream memstream_t;
memstream_t *memstream_open(bool writing); memstream_t *memstream_open(unsigned writing);
void memstream_close(memstream_t *stream); void memstream_close(memstream_t *stream);
size_t memstream_read(memstream_t *stream, void *data, size_t bytes); size_t memstream_read(memstream_t *stream, void *data, size_t bytes);

View File

@@ -0,0 +1,47 @@
@SET VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE
@SET VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio .NET 2003
@SET FrameworkDir=C:\WINDOWS\Microsoft.NET\Framework
@SET FrameworkVersion=v1.1.4322
@SET FrameworkSDKDir=C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1
@rem Root of Visual Studio common files.
@if "%VSINSTALLDIR%"=="" goto Usage
@if "%VCINSTALLDIR%"=="" set VCINSTALLDIR=%VSINSTALLDIR%
@rem
@rem Root of Visual Studio ide installed files.
@rem
@set DevEnvDir=%VSINSTALLDIR%
@rem
@rem Root of Visual C++ installed files.
@rem
@set MSVCDir=%VCINSTALLDIR%\VC7
@rem
@echo Setting environment for using Microsoft Visual Studio .NET 2003 tools.
@echo (If you have another version of Visual Studio or Visual C++ installed and wish
@echo to use its tools from the command line, run vcvars32.bat for that version.)
@rem
@REM %VCINSTALLDIR%\Common7\Tools dir is added only for real setup.
@set PATH=%DevEnvDir%;%MSVCDir%\BIN;%VCINSTALLDIR%\Common7\Tools;%VCINSTALLDIR%\Common7\Tools\bin\prerelease;%VCINSTALLDIR%\Common7\Tools\bin;%FrameworkSDKDir%\bin;%FrameworkDir%\%FrameworkVersion%;%PATH%;
@set INCLUDE=%MSVCDir%\ATLMFC\INCLUDE;%MSVCDir%\INCLUDE;%FrameworkSDKDir%\include;%INCLUDE%;%XDK%\xbox\include
@set LIB=%MSVCDir%\ATLMFC\LIB;%MSVCDir%\LIB;%MSVCDir%\PlatformSDK\lib;%XDK%\lib;%XDK%\xbox\lib;%LIB%
@goto end
:Usage
@echo. VSINSTALLDIR variable is not set.
@echo.
@echo SYNTAX: %0
@goto end
:end
devenv /clean Release_LTCG msvc-2003-xbox1.sln
devenv /build Release_LTCG msvc-2003-xbox1.sln
exit

View File

@@ -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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

View File

@@ -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.sln /p:Configuration=Release /target:clean
msbuild msvc-2010.sln /p:Configuration=Release
exit

View File

@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 11.00 Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010 # Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fceu-next", "msvc-2010\msvc-2010.vcxproj", "{0CE28350-1810-43E8-BB42-EC5C562C1C66}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fceu-next-360", "msvc-2010\msvc-2010.vcxproj", "{3FF56BB8-80B9-4477-9B55-248DFEFF7469}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -9,10 +9,10 @@ Global
Release|Win32 = Release|Win32 Release|Win32 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0CE28350-1810-43E8-BB42-EC5C562C1C66}.Debug|Win32.ActiveCfg = Debug|Win32 {3FF56BB8-80B9-4477-9B55-248DFEFF7469}.Debug|Win32.ActiveCfg = Debug|Win32
{0CE28350-1810-43E8-BB42-EC5C562C1C66}.Debug|Win32.Build.0 = Debug|Win32 {3FF56BB8-80B9-4477-9B55-248DFEFF7469}.Debug|Win32.Build.0 = Debug|Win32
{0CE28350-1810-43E8-BB42-EC5C562C1C66}.Release|Win32.ActiveCfg = Release|Win32 {3FF56BB8-80B9-4477-9B55-248DFEFF7469}.Release|Win32.ActiveCfg = Release|Win32
{0CE28350-1810-43E8-BB42-EC5C562C1C66}.Release|Win32.Build.0 = Release|Win32 {3FF56BB8-80B9-4477-9B55-248DFEFF7469}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@@ -1,4 +1,4 @@
LIBRARY "libretro-prboom msvc2010" LIBRARY "msvc-2010"
EXPORTS EXPORTS
retro_set_environment retro_set_environment
retro_set_video_refresh retro_set_video_refresh

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff