PPSSPP vcore
This commit is contained in:
commit
0da2f38d13
6 changed files with 2525 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*.so
|
||||
*.o
|
141
Makefile
Normal file
141
Makefile
Normal file
|
@ -0,0 +1,141 @@
|
|||
STATIC_LINKING := 0
|
||||
AR := ar
|
||||
|
||||
ifeq ($(platform),)
|
||||
platform = unix
|
||||
ifeq ($(shell uname -a),)
|
||||
platform = win
|
||||
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
platform = win
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
platform = osx
|
||||
else ifneq ($(findstring win,$(shell uname -a)),)
|
||||
platform = win
|
||||
endif
|
||||
endif
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
ifeq ($(shell uname -a),)
|
||||
EXE_EXT = .exe
|
||||
system_platform = win
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
system_platform = osx
|
||||
arch = intel
|
||||
ifeq ($(shell uname -p),powerpc)
|
||||
arch = ppc
|
||||
endif
|
||||
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
system_platform = win
|
||||
endif
|
||||
|
||||
TARGET_NAME := teampandory_ppsspp_vcore
|
||||
LIBM = -lm
|
||||
|
||||
ifeq ($(ARCHFLAGS),)
|
||||
ifeq ($(archs),ppc)
|
||||
ARCHFLAGS = -arch ppc -arch ppc64
|
||||
else
|
||||
ARCHFLAGS = -arch i386 -arch x86_64
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(platform), osx)
|
||||
ifndef ($(NOUNIVERSAL))
|
||||
CFLAGS += $(ARCHFLAGS)
|
||||
LFLAGS += $(ARCHFLAGS)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(STATIC_LINKING), 1)
|
||||
EXT := a
|
||||
endif
|
||||
|
||||
ifeq ($(platform), unix)
|
||||
EXT ?= so
|
||||
TARGET := $(TARGET_NAME)_libretro.$(EXT)
|
||||
fpic := -fPIC
|
||||
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
||||
else ifeq ($(platform), linux-portable)
|
||||
TARGET := $(TARGET_NAME)_libretro.$(EXT)
|
||||
fpic := -fPIC -nostdlib
|
||||
SHARED := -shared -Wl,--version-script=link.T
|
||||
LIBM :=
|
||||
else ifneq (,$(findstring osx,$(platform)))
|
||||
TARGET := $(TARGET_NAME)_libretro.dylib
|
||||
fpic := -fPIC
|
||||
SHARED := -dynamiclib
|
||||
else ifneq (,$(findstring ios,$(platform)))
|
||||
TARGET := $(TARGET_NAME)_libretro_ios.dylib
|
||||
fpic := -fPIC
|
||||
SHARED := -dynamiclib
|
||||
|
||||
ifeq ($(IOSSDK),)
|
||||
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
|
||||
endif
|
||||
|
||||
DEFINES := -DIOS
|
||||
CC = cc -arch armv7 -isysroot $(IOSSDK)
|
||||
ifeq ($(platform),ios9)
|
||||
CC += -miphoneos-version-min=8.0
|
||||
CFLAGS += -miphoneos-version-min=8.0
|
||||
else
|
||||
CC += -miphoneos-version-min=5.0
|
||||
CFLAGS += -miphoneos-version-min=5.0
|
||||
endif
|
||||
else ifneq (,$(findstring qnx,$(platform)))
|
||||
TARGET := $(TARGET_NAME)_libretro_qnx.so
|
||||
fpic := -fPIC
|
||||
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
||||
else ifeq ($(platform), emscripten)
|
||||
TARGET := $(TARGET_NAME)_libretro_emscripten.bc
|
||||
fpic := -fPIC
|
||||
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
||||
else ifeq ($(platform), vita)
|
||||
TARGET := $(TARGET_NAME)_vita.a
|
||||
CC = arm-vita-eabi-gcc
|
||||
AR = arm-vita-eabi-ar
|
||||
CFLAGS += -Wl,-q -Wall -O3
|
||||
STATIC_LINKING = 1
|
||||
else
|
||||
CC = gcc
|
||||
TARGET := $(TARGET_NAME)_libretro.dll
|
||||
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined
|
||||
endif
|
||||
|
||||
LDFLAGS += $(LIBM)
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0 -g
|
||||
else
|
||||
CFLAGS += -O3
|
||||
endif
|
||||
|
||||
OBJECTS := libretro-teampandory-ppsspp-vcore.o
|
||||
CFLAGS += -Wall -pedantic $(fpic)
|
||||
|
||||
ifneq (,$(findstring qnx,$(platform)))
|
||||
CFLAGS += -Wc,-std=c99
|
||||
else
|
||||
CFLAGS += -std=gnu99
|
||||
endif
|
||||
|
||||
CFLAGS += -I.
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJECTS)
|
||||
ifeq ($(STATIC_LINKING), 1)
|
||||
$(AR) rcs $@ $(OBJECTS)
|
||||
else
|
||||
$(CC) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LDFLAGS)
|
||||
endif
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) $(fpic) -c -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f $(OBJECTS) $(TARGET)
|
||||
|
||||
.PHONY: clean
|
||||
|
204
libretro-teampandory-ppsspp-vcore.c
Normal file
204
libretro-teampandory-ppsspp-vcore.c
Normal file
|
@ -0,0 +1,204 @@
|
|||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <libretro.h>
|
||||
|
||||
static uint32_t *frame_buf;
|
||||
static struct retro_log_callback logging;
|
||||
static retro_log_printf_t log_cb;
|
||||
|
||||
static void fallback_log(enum retro_log_level level, const char *fmt, ...)
|
||||
{
|
||||
(void)level;
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
vfprintf(stderr, fmt, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
void retro_init(void)
|
||||
{
|
||||
frame_buf = calloc(320 * 240, sizeof(uint32_t));
|
||||
}
|
||||
|
||||
void retro_deinit(void)
|
||||
{
|
||||
free(frame_buf);
|
||||
frame_buf = NULL;
|
||||
}
|
||||
|
||||
unsigned retro_api_version(void)
|
||||
{
|
||||
return RETRO_API_VERSION;
|
||||
}
|
||||
|
||||
void retro_set_controller_port_device(unsigned port, unsigned device)
|
||||
{
|
||||
log_cb(RETRO_LOG_INFO, "Plugging device %u into port %u.\n", device, port);
|
||||
}
|
||||
|
||||
void retro_get_system_info(struct retro_system_info *info)
|
||||
{
|
||||
memset(info, 0, sizeof(*info));
|
||||
info->library_name = "TeamPandory - PPSSPP VCore";
|
||||
info->library_version = "1.0.0";
|
||||
info->need_fullpath = true;
|
||||
info->valid_extensions = "elf|iso|cso|prx|pbp";
|
||||
}
|
||||
|
||||
static retro_video_refresh_t video_cb;
|
||||
static retro_audio_sample_t audio_cb;
|
||||
static retro_audio_sample_batch_t audio_batch_cb;
|
||||
static retro_environment_t environ_cb;
|
||||
static retro_input_poll_t input_poll_cb;
|
||||
static retro_input_state_t input_state_cb;
|
||||
|
||||
void retro_get_system_av_info(struct retro_system_av_info *info)
|
||||
{
|
||||
float aspect = 4.0f / 3.0f;
|
||||
float sampling_rate = 30000.0f;
|
||||
|
||||
info->timing = (struct retro_system_timing) {
|
||||
.fps = 60.0,
|
||||
.sample_rate = sampling_rate,
|
||||
};
|
||||
|
||||
info->geometry = (struct retro_game_geometry) {
|
||||
.base_width = 320,
|
||||
.base_height = 240,
|
||||
.max_width = 320,
|
||||
.max_height = 240,
|
||||
.aspect_ratio = aspect,
|
||||
};
|
||||
}
|
||||
|
||||
void retro_set_environment(retro_environment_t cb)
|
||||
{
|
||||
environ_cb = cb;
|
||||
|
||||
bool no_content = true;
|
||||
cb(RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME, &no_content);
|
||||
|
||||
if (cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &logging))
|
||||
log_cb = logging.log;
|
||||
else
|
||||
log_cb = fallback_log;
|
||||
}
|
||||
|
||||
void retro_set_audio_sample(retro_audio_sample_t cb)
|
||||
{
|
||||
audio_cb = cb;
|
||||
}
|
||||
|
||||
void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb)
|
||||
{
|
||||
audio_batch_cb = cb;
|
||||
}
|
||||
|
||||
void retro_set_input_poll(retro_input_poll_t cb)
|
||||
{
|
||||
input_poll_cb = cb;
|
||||
}
|
||||
|
||||
void retro_set_input_state(retro_input_state_t cb)
|
||||
{
|
||||
input_state_cb = cb;
|
||||
}
|
||||
|
||||
void retro_set_video_refresh(retro_video_refresh_t cb)
|
||||
{
|
||||
video_cb = cb;
|
||||
}
|
||||
|
||||
void retro_reset(void)
|
||||
{
|
||||
// Nothing needs to happen when the game is reset.
|
||||
}
|
||||
|
||||
/**
|
||||
* libretro callback; Called every game tick.
|
||||
*
|
||||
* Once the core has run, we will attempt to exit, since Bash is done.
|
||||
*/
|
||||
void retro_run(void)
|
||||
{
|
||||
// Clear the display.
|
||||
unsigned stride = 320;
|
||||
video_cb(frame_buf, 320, 240, stride << 2);
|
||||
|
||||
// Shutdown the environment now that Bash has loaded and quit.
|
||||
environ_cb(RETRO_ENVIRONMENT_SHUTDOWN, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* libretro callback; Called when a game is to be loaded.
|
||||
*/
|
||||
bool retro_load_game(const struct retro_game_info *info)
|
||||
{
|
||||
char command[512] = "/tmp/pandorygrub ppsspp ";
|
||||
|
||||
// Check if there is content to load.
|
||||
if (info != NULL && info->path != NULL && info->path[0] != '\0') {
|
||||
sprintf(command, "%s \"%s\"", command, info->path);
|
||||
}
|
||||
|
||||
// Run FFPlay.
|
||||
return system(command) != -1;
|
||||
}
|
||||
|
||||
void retro_unload_game(void)
|
||||
{
|
||||
// Nothing needs to happen when the game unloads.
|
||||
}
|
||||
|
||||
unsigned retro_get_region(void)
|
||||
{
|
||||
return RETRO_REGION_NTSC;
|
||||
}
|
||||
|
||||
bool retro_load_game_special(unsigned game_type, const struct retro_game_info *info, size_t num_info)
|
||||
{
|
||||
return retro_load_game(info);
|
||||
}
|
||||
|
||||
size_t retro_serialize_size(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool retro_serialize(void *data_, size_t size)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool retro_unserialize(const void *data_, size_t size)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void *retro_get_memory_data(unsigned id)
|
||||
{
|
||||
(void)id;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t retro_get_memory_size(unsigned id)
|
||||
{
|
||||
(void)id;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void retro_cheat_reset(void)
|
||||
{
|
||||
// Nothing.
|
||||
}
|
||||
|
||||
void retro_cheat_set(unsigned index, bool enabled, const char *code)
|
||||
{
|
||||
(void)index;
|
||||
(void)enabled;
|
||||
(void)code;
|
||||
}
|
2162
libretro.h
Normal file
2162
libretro.h
Normal file
File diff suppressed because it is too large
Load diff
4
link.T
Normal file
4
link.T
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
global: retro_*;
|
||||
local: *;
|
||||
};
|
12
teampandory_ppsspp_vcore_libretro.info
Normal file
12
teampandory_ppsspp_vcore_libretro.info
Normal file
|
@ -0,0 +1,12 @@
|
|||
display_name = "Team Pandory - PPSSPP VCore"
|
||||
authors = "@dajoho & @emuchicken"
|
||||
supported_extensions = "elf|iso|cso|prx|pbp"
|
||||
corename = "Team Pandory - PPSSPP Virtual Passthrough Core"
|
||||
manufacturer = "Linux"
|
||||
categories = "Emulator"
|
||||
systemname = "Game"
|
||||
database = "Game"
|
||||
license = "GPL"
|
||||
permissions = ""
|
||||
display_version = "1.0.0"
|
||||
smeupports_no_game = "true"
|
Loading…
Add table
Add a link
Reference in a new issue