Working on getting libretro updated
This commit is contained in:
parent
fec17c7900
commit
9324318373
|
@ -1,4 +1,5 @@
|
||||||
TILED_RENDERING = 0
|
TILED_RENDERING=0
|
||||||
|
STATIC_LINKING=0
|
||||||
|
|
||||||
ifeq ($(platform),)
|
ifeq ($(platform),)
|
||||||
platform = unix
|
platform = unix
|
||||||
|
@ -18,6 +19,10 @@ endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
TARGET_NAME = vbam
|
TARGET_NAME = vbam
|
||||||
|
GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
|
||||||
|
ifneq ($(GIT_VERSION)," unknown")
|
||||||
|
CXXFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(platform), unix)
|
ifeq ($(platform), unix)
|
||||||
TARGET := $(TARGET_NAME)_libretro.so
|
TARGET := $(TARGET_NAME)_libretro.so
|
||||||
|
@ -41,7 +46,9 @@ endif
|
||||||
ifeq ($(OSX_LT_MAVERICKS),"YES")
|
ifeq ($(OSX_LT_MAVERICKS),"YES")
|
||||||
fpic += -mmacosx-version-min=10.5
|
fpic += -mmacosx-version-min=10.5
|
||||||
endif
|
endif
|
||||||
else ifeq ($(platform), ios)
|
|
||||||
|
# iOS
|
||||||
|
else ifneq (,$(findstring ios,$(platform)))
|
||||||
TARGET := $(TARGET_NAME)_libretro_ios.dylib
|
TARGET := $(TARGET_NAME)_libretro_ios.dylib
|
||||||
fpic := -fPIC
|
fpic := -fPIC
|
||||||
SHARED := -dynamiclib -DLSB_FIRST
|
SHARED := -dynamiclib -DLSB_FIRST
|
||||||
|
@ -52,12 +59,14 @@ endif
|
||||||
|
|
||||||
CC = clang -arch armv7 -isysroot $(IOSSDK)
|
CC = clang -arch armv7 -isysroot $(IOSSDK)
|
||||||
CXX = clang++ -arch armv7 -isysroot $(IOSSDK)
|
CXX = clang++ -arch armv7 -isysroot $(IOSSDK)
|
||||||
OSXVER = `sw_vers -productVersion | cut -d. -f 2`
|
ifeq ($(platform),ios9)
|
||||||
OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"`
|
CC += -miphoneos-version-min=8.0
|
||||||
ifeq ($(OSX_LT_MAVERICKS),"YES")
|
CXX += -miphoneos-version-min=8.0
|
||||||
CC += -miphoneos-version-min=5.0
|
SHARED += -miphoneos-version-min=8.0
|
||||||
CXX += -miphoneos-version-min=5.0
|
else
|
||||||
SHARED += -miphoneos-version-min=5.0
|
CC += -miphoneos-version-min=5.0
|
||||||
|
CXX += -miphoneos-version-min=5.0
|
||||||
|
SHARED += -miphoneos-version-min=5.0
|
||||||
endif
|
endif
|
||||||
TILED_RENDERING = 1
|
TILED_RENDERING = 1
|
||||||
else ifeq ($(platform), theos_ios)
|
else ifeq ($(platform), theos_ios)
|
||||||
|
@ -80,6 +89,26 @@ else ifeq ($(platform), qnx)
|
||||||
CC = qcc -Vgcc_ntoarmv7le
|
CC = qcc -Vgcc_ntoarmv7le
|
||||||
CXX = QCC -Vgcc_ntoarmv7le_cpp
|
CXX = QCC -Vgcc_ntoarmv7le_cpp
|
||||||
AR = QCC -Vgcc_ntoarmv7le
|
AR = QCC -Vgcc_ntoarmv7le
|
||||||
|
else ifeq ($(platform), vita)
|
||||||
|
TARGET := $(TARGET_NAME)_libretro_vita.a
|
||||||
|
CC = arm-vita-eabi-gcc
|
||||||
|
CXX = arm-vita-eabi-g++
|
||||||
|
AR = arm-vita-eabi-ar
|
||||||
|
__FLAGS := -marm -mtune=cortex-a9 -mcpu=cortex-a9 -mfloat-abi=hard -mword-relocations
|
||||||
|
__FLAGS += -fno-optimize-sibling-calls -fno-strict-aliasing -fno-partial-inlining -fno-tree-vrp
|
||||||
|
__FLAGS += -ffast-math -fsingle-precision-constant -funroll-loops -ftracer
|
||||||
|
__FLAGS += -DVITA -I../vita -Wno-attributes
|
||||||
|
|
||||||
|
CFLAGS += $(__FLAGS)
|
||||||
|
CXXFLAGS += $(__FLAGS)
|
||||||
|
CXXFLAGS += -fno-exceptions -fno-rtti
|
||||||
|
STATIC_LINKING=1
|
||||||
|
TILED_RENDERING=1
|
||||||
|
USE_CHEATS=0
|
||||||
|
USE_TWEAKS=1
|
||||||
|
USE_THREADED_RENDERER=1
|
||||||
|
USE_MOTION_SENSOR=1
|
||||||
|
HAVE_NEON=1
|
||||||
else
|
else
|
||||||
TARGET := $(TARGET_NAME)_libretro.dll
|
TARGET := $(TARGET_NAME)_libretro.dll
|
||||||
LDFLAGS += -Wl,-no-undefined -Wl,--version-script=link.T
|
LDFLAGS += -Wl,-no-undefined -Wl,--version-script=link.T
|
||||||
|
@ -130,11 +159,16 @@ else
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
$(TARGET): $(OBJS)
|
$(TARGET): $(OBJS)
|
||||||
|
ifeq ($(STATIC_LINKING), 1)
|
||||||
|
$(AR) rcs $@ $(OBJS)
|
||||||
|
else
|
||||||
$(CXX) -o $@ $(SHARED) $(OBJS) $(LDFLAGS) $(LIBS)
|
$(CXX) -o $@ $(SHARED) $(OBJS) $(LDFLAGS) $(LIBS)
|
||||||
|
endif
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OBJS)
|
rm -f $(OBJS)
|
||||||
rm -f $(TARGET)
|
rm -f $(TARGET)
|
||||||
|
rm -f *.a
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -2,6 +2,11 @@ LOCAL_PATH := $(call my-dir)
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
|
||||||
|
ifneq ($(GIT_VERSION)," unknown")
|
||||||
|
LOCAL_CXXFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET_ARCH),arm)
|
ifeq ($(TARGET_ARCH),arm)
|
||||||
LOCAL_CFLAGS += -DANDROID_ARM
|
LOCAL_CFLAGS += -DANDROID_ARM
|
||||||
LOCAL_ARM_MODE := arm
|
LOCAL_ARM_MODE := arm
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "SoundRetro.h"
|
#include "SoundRetro.h"
|
||||||
#include "libretro.h"
|
#include "libretro.h"
|
||||||
|
@ -27,6 +29,8 @@
|
||||||
#define RETRO_DEVICE_GBA_ALT1 RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 1)
|
#define RETRO_DEVICE_GBA_ALT1 RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 1)
|
||||||
#define RETRO_DEVICE_GBA_ALT2 RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 2)
|
#define RETRO_DEVICE_GBA_ALT2 RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 2)
|
||||||
|
|
||||||
|
#define ISHEXDEC ((codeLine[cursor]>='0') && (codeLine[cursor]<='9')) || ((codeLine[cursor]>='a') && (codeLine[cursor]<='f')) || ((codeLine[cursor]>='A') && (codeLine[cursor]<='F'))
|
||||||
|
|
||||||
static retro_log_printf_t log_cb;
|
static retro_log_printf_t log_cb;
|
||||||
static retro_video_refresh_t video_cb;
|
static retro_video_refresh_t video_cb;
|
||||||
static retro_input_poll_t poll_cb;
|
static retro_input_poll_t poll_cb;
|
||||||
|
@ -213,7 +217,7 @@ void retro_get_system_info(struct retro_system_info *info)
|
||||||
{
|
{
|
||||||
info->need_fullpath = false;
|
info->need_fullpath = false;
|
||||||
info->valid_extensions = "gba";
|
info->valid_extensions = "gba";
|
||||||
info->library_version = "git";
|
info->library_version = "git" GIT_VERSION;
|
||||||
info->library_name = "VBA-M";
|
info->library_name = "VBA-M";
|
||||||
info->block_extract = false;
|
info->block_extract = false;
|
||||||
}
|
}
|
||||||
|
@ -585,6 +589,7 @@ void retro_cheat_reset(void)
|
||||||
|
|
||||||
void retro_cheat_set(unsigned index, bool enabled, const char* code)
|
void retro_cheat_set(unsigned index, bool enabled, const char* code)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
const char *begin, *c;
|
const char *begin, *c;
|
||||||
|
|
||||||
begin = c = code;
|
begin = c = code;
|
||||||
|
@ -623,6 +628,54 @@ void retro_cheat_set(unsigned index, bool enabled, const char* code)
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (*c++);
|
} while (*c++);
|
||||||
|
*/
|
||||||
|
std::string codeLine=code;
|
||||||
|
std::string name="cheat_"+index;
|
||||||
|
int matchLength=0;
|
||||||
|
std::vector<std::string> codeParts;
|
||||||
|
int cursor;
|
||||||
|
|
||||||
|
//Break the code into Parts
|
||||||
|
for (cursor=0;;cursor++)
|
||||||
|
{
|
||||||
|
if (ISHEXDEC){
|
||||||
|
matchLength++;
|
||||||
|
} else {
|
||||||
|
if (matchLength){
|
||||||
|
if (matchLength>8){
|
||||||
|
codeParts.push_back(codeLine.substr(cursor-matchLength,8));
|
||||||
|
codeParts.push_back(codeLine.substr(cursor-matchLength+8,matchLength-8));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
codeParts.push_back(codeLine.substr(cursor-matchLength,matchLength));
|
||||||
|
}
|
||||||
|
matchLength=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!codeLine[cursor]){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Add to core
|
||||||
|
for (cursor=0;cursor<codeParts.size();cursor+=2){
|
||||||
|
std::string codeString;
|
||||||
|
codeString+=codeParts[cursor];
|
||||||
|
|
||||||
|
if (codeParts[cursor+1].length()==8){
|
||||||
|
codeString+=codeParts[cursor+1];
|
||||||
|
cheatsAddGSACode(codeString.c_str(),name.c_str(),true);
|
||||||
|
} else if (codeParts[cursor+1].length()==4) {
|
||||||
|
codeString+=" ";
|
||||||
|
codeString+=codeParts[cursor+1];
|
||||||
|
cheatsAddCBACode(codeString.c_str(),name.c_str());
|
||||||
|
} else {
|
||||||
|
codeString+=" ";
|
||||||
|
codeString+=codeParts[cursor+1];
|
||||||
|
log_cb(RETRO_LOG_ERROR, "[VBA] Invalid cheat code '%s'\n", codeString.c_str());
|
||||||
|
}
|
||||||
|
log_cb(RETRO_LOG_INFO, "[VBA] Cheat code added: '%s'\n", codeString.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool retro_load_game(const struct retro_game_info *game)
|
bool retro_load_game(const struct retro_game_info *game)
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
#include <string.h>
|
Loading…
Reference in New Issue