aboutsummaryrefslogtreecommitdiffstats
path: root/emulators
diff options
context:
space:
mode:
authorjbeich <jbeich@FreeBSD.org>2017-03-31 21:10:02 +0800
committerjbeich <jbeich@FreeBSD.org>2017-03-31 21:10:02 +0800
commit064f9430ec9aa66689b106103b066ce7a0fac23b (patch)
tree4de2003111cc1ac75e97ffab3db6c1eb0f3eb671 /emulators
parent3e5744dc7e0d11f66313226649692c6f5f7f7f37 (diff)
downloadfreebsd-ports-gnome-064f9430ec9aa66689b106103b066ce7a0fac23b.tar.gz
freebsd-ports-gnome-064f9430ec9aa66689b106103b066ce7a0fac23b.tar.zst
freebsd-ports-gnome-064f9430ec9aa66689b106103b066ce7a0fac23b.zip
emulators/ppsspp: update to 1.4
Changes: http://ppsspp.org/#news Changes: https://github.com/hrydgard/ppsspp/releases/tag/v1.4
Diffstat (limited to 'emulators')
-rw-r--r--emulators/Makefile1
-rw-r--r--emulators/ppsspp-qt4/Makefile10
-rw-r--r--emulators/ppsspp-qt5/Makefile2
-rw-r--r--emulators/ppsspp/Makefile63
-rw-r--r--emulators/ppsspp/distinfo22
-rw-r--r--emulators/ppsspp/files/extra-patch-old-joy463
-rw-r--r--emulators/ppsspp/files/patch-Common_MemoryUtil.cpp23
-rw-r--r--emulators/ppsspp/files/pkg-message.in7
8 files changed, 521 insertions, 70 deletions
diff --git a/emulators/Makefile b/emulators/Makefile
index 6ab9799fe892..bbc806bb635d 100644
--- a/emulators/Makefile
+++ b/emulators/Makefile
@@ -108,7 +108,6 @@
SUBDIR += pipelight
SUBDIR += playonbsd
SUBDIR += ppsspp
- SUBDIR += ppsspp-qt4
SUBDIR += ppsspp-qt5
SUBDIR += py-gns3-converter
SUBDIR += py-nova
diff --git a/emulators/ppsspp-qt4/Makefile b/emulators/ppsspp-qt4/Makefile
deleted file mode 100644
index 15190b432e88..000000000000
--- a/emulators/ppsspp-qt4/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# $FreeBSD$
-
-PORTREVISION= 1
-PKGNAMESUFFIX= -qt4
-
-MASTERDIR= ${.CURDIR}/../ppsspp
-
-OPTIONS_SLAVE= QT4
-
-.include "${MASTERDIR}/Makefile"
diff --git a/emulators/ppsspp-qt5/Makefile b/emulators/ppsspp-qt5/Makefile
index ce0f451bc9d5..e436926eb3db 100644
--- a/emulators/ppsspp-qt5/Makefile
+++ b/emulators/ppsspp-qt5/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-PORTREVISION= 1
+PORTREVISION= 0
PKGNAMESUFFIX= -qt5
MASTERDIR= ${.CURDIR}/../ppsspp
diff --git a/emulators/ppsspp/Makefile b/emulators/ppsspp/Makefile
index 2d4cb619305e..88b9efcbbd69 100644
--- a/emulators/ppsspp/Makefile
+++ b/emulators/ppsspp/Makefile
@@ -2,19 +2,14 @@
PORTNAME= ppsspp
DISTVERSIONPREFIX= v
-DISTVERSION?= 1.3
-PORTREVISION?= 4
+DISTVERSION?= 1.4
+PORTREVISION?= 0
CATEGORIES= emulators
# XXX Get from Debian once #697821 lands
MASTER_SITES= https://bazaar.launchpad.net/~sergio-br2/${PORTNAME}/debian-sdl/download/5/${PORTNAME}.1-20140802045408-dd26dik367ztj5xg-8/:manpage
DISTFILES= ${PORTNAME}.1:manpage
EXTRACT_ONLY= ${DISTFILES:N*\:manpage:C/:.*//}
-.ifndef PKGNAMESUFFIX
-PATCH_SITES= https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
-PATCHFILES= 7a7e4ed23f5f.patch:-p1
-.endif
-
MAINTAINER= jbeich@FreeBSD.org
COMMENT= PSP emulator in C++ with dynarec JIT for x86, ARM, MIPS
@@ -27,25 +22,26 @@ RUN_DEPENDS= xdg-open:devel/xdg-utils
USE_GITHUB= yes
GH_ACCOUNT= hrydgard
-GH_TUPLE?= hrydgard:${PORTNAME}-lang:cdf4a8d:lang/lang \
- Kingcom:armips:1ffab37:armips/ext/armips
+GH_TUPLE?= hrydgard:glslang:b16f7e68:glslang/ext/glslang \
+ hrydgard:${PORTNAME}-lang:ed0bbfb:lang/assets/lang \
+ KhronosGroup:SPIRV-Cross:6381b2f:SPIRV/ext/SPIRV-Cross \
+ Kingcom:armips:v0.9-26-g770365d:armips/ext/armips \
+ Kingcom:tinyformat:Release-2.0.1-7-gb7f5a22:tinyformat/ext/armips/ext/tinyformat
CONFLICTS_INSTALL= ${PORTNAME}-*
-# [QT4] FakeJit.cpp:42:37: error: no matching constructor for initialization of 'JitBlockCache'
# [QT5] c++: error: the clang compiler does not support '-march=armv7-a'
# [SDL] SplineCommon.cpp:639:17: error: use of undeclared identifier 'AllocateAlignedMemory'
BROKEN_aarch64= https://github.com/hrydgard/ppsspp/issues/9032
-USES= compiler:c++11-lib localbase:ldflags pkgconfig
-EXCLUDE= glew snappy libzip zlib
+USES= cmake:outsource compiler:c++11-lib localbase:ldflags pkgconfig
+EXCLUDE= libzip zlib
EXTRACT_AFTER_ARGS=${EXCLUDE:S,^,--exclude ,}
-USE_GL= glew glu
+USE_GL= gl glew glu
USE_SDL= sdl2 # joystick
CMAKE_ARGS= -DUSE_SYSTEM_FFMPEG=on
-QMAKE_SOURCE_PATH= ${WRKSRC}/Qt/PPSSPPQt.pro
-QMAKE_ARGS= CONFIG+="system_ffmpeg" LREL_TOOL="${LRELEASE}"
-NO_INSTALL= yes # ports/202949
+SUB_FILES= pkg-message
+PORTDATA= assets ${PORTNAME}
DESKTOP_ENTRIES="PPSSPP" \
"" \
@@ -54,51 +50,46 @@ DESKTOP_ENTRIES="PPSSPP" \
"Game;Emulator;" \
""
+OPTIONS_DEFINE= OLDJOY
OPTIONS_SINGLE= GUI
-OPTIONS_SINGLE_GUI= QT4 QT5 SDL
+OPTIONS_SINGLE_GUI= QT5 SDL
OPTIONS_SLAVE?= SDL
OPTIONS_EXCLUDE:= ${OPTIONS_SINGLE_GUI}
-QT4_USES= qmake:outsource
-QT4_USE= QT4=qmake_build,moc_build,rcc_build,uic_build,linguisttools_build,gui,opengl
-QT5_USES= qmake:outsource
+OLDJOY_DESC= Old joystick support with fixed button mappings (deprecated)
+OLDJOY_EXTRA_PATCHES= ${PATCHDIR}/extra-patch-old-joy
QT5_USE= QT5=qmake_build,buildtools_build,linguisttools_build,gui,opengl,widgets
-SDL_USES= cmake:outsource
+QT5_CMAKE_BOOL= USING_QT_UI
+QT5_VARS= EXENAME=PPSSPPQt
SDL_BUILD_DEPENDS= png>=1.6:graphics/png
SDL_LIB_DEPENDS= libpng.so:graphics/png
-SDL_VARS= PORTDATA+="assets ${PORTNAME}"
+SDL_VARS= EXENAME=PPSSPPSDL
post-patch:
+ @${REINPLACE_CMD} -e 's/Linux/${OPSYS}/' \
+ ${WRKSRC}/assets/gamecontrollerdb.txt
@${REINPLACE_CMD} -e 's,/usr/share,${PREFIX}/share,' \
${WRKSRC}/UI/NativeApp.cpp
- @${REINPLACE_CMD} -e 's,/usr,${LOCALBASE},' \
- ${WRKSRC}/Qt/*.pr*
@${REINPLACE_CMD} \
-e 's/"unknown"/"${GH_TAGNAME}"/' \
-e 's/^\(VERSION =\).*/\1 ${GH_TAGNAME}/' \
- ${WRKSRC}/git-version.cmake \
- ${WRKSRC}/Qt/Settings.pri
+ ${WRKSRC}/git-version.cmake
-do-install-SDL-on:
+do-install:
# cmake doesn't pack assets into the app unlike qmake
(cd ${INSTALL_WRKSRC} && ${COPYTREE_SHARE} \
"${PORTDATA:N${PORTNAME}}" ${STAGEDIR}${DATADIR})
# Install the app alongside assets to avoid warnings with GetExeDirectory()
- ${INSTALL_PROGRAM} ${INSTALL_WRKSRC}/${PORTNAME:tu}* \
+ ${INSTALL_PROGRAM} ${INSTALL_WRKSRC}/${EXENAME} \
${STAGEDIR}${DATADIR}/${PORTNAME}
- ${LN} -sf ${DATADIR}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
-
-do-install-SDL-off:
- ${INSTALL_PROGRAM} ${INSTALL_WRKSRC}/${PORTNAME} \
- ${STAGEDIR}${PREFIX}/bin
+ ${LN} -sf ../${DATADIR_REL}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
-post-install:
${INSTALL_MAN} ${_DISTDIR}/${PORTNAME}.1 \
${STAGEDIR}${MAN1PREFIX}/man/man1
- (cd ${WRKSRC}/assets/unix-icons && ${COPYTREE_SHARE} \
+ (cd ${WRKSRC}/icons && ${COPYTREE_SHARE} \
"hicolor" ${STAGEDIR}${PREFIX}/share/icons)
${MKDIR} ${STAGEDIR}${PREFIX}/share/icons/hicolor/scalable/apps
- ${INSTALL_DATA} ${WRKSRC}/assets/unix-icons/icon-512.svg \
+ ${INSTALL_DATA} ${WRKSRC}/icons/icon-512.svg \
${STAGEDIR}${PREFIX}/share/icons/hicolor/scalable/apps/${PORTNAME}.svg
.include <bsd.port.mk>
diff --git a/emulators/ppsspp/distinfo b/emulators/ppsspp/distinfo
index 3ee9431d0f3c..1a590bfdcbc1 100644
--- a/emulators/ppsspp/distinfo
+++ b/emulators/ppsspp/distinfo
@@ -1,11 +1,15 @@
-TIMESTAMP = 1473519574
+TIMESTAMP = 1490963049
SHA256 (ppsspp.1) = 64a7cca4c3a5fc6ad5b63399edef9056b0c85ea68fed00fb7e97f4b2724e503b
SIZE (ppsspp.1) = 1598
-SHA256 (hrydgard-ppsspp-v1.3_GH0.tar.gz) = ada81d1bdbb0ec7d1395d3473602087767bb2deb2a8b015ddcfd1f5d08609a52
-SIZE (hrydgard-ppsspp-v1.3_GH0.tar.gz) = 15384301
-SHA256 (hrydgard-ppsspp-lang-cdf4a8d_GH0.tar.gz) = 32ddb92389fef5b9244e70f183d2977a28d95ac5db74b56eb66383f2bc70b157
-SIZE (hrydgard-ppsspp-lang-cdf4a8d_GH0.tar.gz) = 249259
-SHA256 (Kingcom-armips-1ffab37_GH0.tar.gz) = ebfcc89e2bc983330fa5131ecbd324812f4679c9f04134ffea8f2658780a1c64
-SIZE (Kingcom-armips-1ffab37_GH0.tar.gz) = 146794
-SHA256 (7a7e4ed23f5f.patch) = 62038974cdb06d1f6d4cbae8c9e22bafbf718d7acaff6ebe15b4d9b1f3e1f2e3
-SIZE (7a7e4ed23f5f.patch) = 1241
+SHA256 (hrydgard-ppsspp-v1.4_GH0.tar.gz) = d801fbdc0063cd351392af488a65fc66021f45eb1edbabe7bce069ce0d68d5a6
+SIZE (hrydgard-ppsspp-v1.4_GH0.tar.gz) = 18909397
+SHA256 (hrydgard-glslang-b16f7e68_GH0.tar.gz) = 81066af7201fcfc4262a27c3b89a9e71d01b29f10d723c6389b827d0df3ac81c
+SIZE (hrydgard-glslang-b16f7e68_GH0.tar.gz) = 1682426
+SHA256 (hrydgard-ppsspp-lang-ed0bbfb_GH0.tar.gz) = a1e9dbb96e151e47f47a7cfb13833b3e059c372a364b6b5788043768d286a1aa
+SIZE (hrydgard-ppsspp-lang-ed0bbfb_GH0.tar.gz) = 268264
+SHA256 (KhronosGroup-SPIRV-Cross-6381b2f_GH0.tar.gz) = f09cc4f37ed8f8453929186ebdfbe7228e07a6a4c11227e0b6b7c7365d9cf915
+SIZE (KhronosGroup-SPIRV-Cross-6381b2f_GH0.tar.gz) = 193130
+SHA256 (Kingcom-armips-v0.9-26-g770365d_GH0.tar.gz) = e6c52967082658082544f83875cc08e50227ff788d3553e0b0bc28abdb2615ed
+SIZE (Kingcom-armips-v0.9-26-g770365d_GH0.tar.gz) = 163606
+SHA256 (Kingcom-tinyformat-Release-2.0.1-7-gb7f5a22_GH0.tar.gz) = d86b5b4592047254c5118d0639e51d00869b3adc2f2c5419fdf29381ca42011e
+SIZE (Kingcom-tinyformat-Release-2.0.1-7-gb7f5a22_GH0.tar.gz) = 22286
diff --git a/emulators/ppsspp/files/extra-patch-old-joy b/emulators/ppsspp/files/extra-patch-old-joy
new file mode 100644
index 000000000000..2c21cf9cb720
--- /dev/null
+++ b/emulators/ppsspp/files/extra-patch-old-joy
@@ -0,0 +1,463 @@
+The patch reverts SDL_GameController API usage from:
+
+https://github.com/hrydgard/ppsspp/commit/67425d7d477d
+https://github.com/hrydgard/ppsspp/commit/db2cc49e0dd1
+https://github.com/hrydgard/ppsspp/commit/e4a0a3cea3bc
+https://github.com/hrydgard/ppsspp/commit/182b9e0fdae3
+https://github.com/hrydgard/ppsspp/commit/d6b81236626f
+https://github.com/hrydgard/ppsspp/commit/b058b987ad0f
+https://github.com/hrydgard/ppsspp/commit/1b699363ca4d
+
+--- SDL/SDLJoystick.cpp.orig 2017-03-30 12:14:27 UTC
++++ SDL/SDLJoystick.cpp
+@@ -1,12 +1,7 @@
+ #include "SDL/SDLJoystick.h"
+ #include "Core/Config.h"
+-#include "Common/FileUtil.h"
+-#include "file/vfs.h"
+
+ #include <iostream>
+-#include <string>
+-
+-using namespace std;
+
+ static int SDLJoystickEventHandlerWrapper(void* userdata, SDL_Event* event)
+ {
+@@ -17,65 +12,32 @@ static int SDLJoystickEventHandlerWrappe
+ SDLJoystick::SDLJoystick(bool init_SDL ) : registeredAsEventHandler(false) {
+ SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
+ if (init_SDL) {
+- SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER);
+- }
+-
+- const char *dbPath = "gamecontrollerdb.txt";
+- cout << "loading control pad mappings from " << dbPath << ": ";
+-
+- size_t size;
+- u8 *mappingData = VFSReadFile(dbPath, &size);
+- if (mappingData) {
+- SDL_RWops *rw = SDL_RWFromConstMem(mappingData, size);
+- // 1 to free the rw after use
+- if (SDL_GameControllerAddMappingsFromRW(rw, 1) == -1) {
+- cout << "Failed to read mapping data - corrupt?" << endl;
+- }
+- delete[] mappingData;
+- } else {
+- cout << "gamecontrollerdb.txt missing" << endl;
++ SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO);
+ }
+- cout << "SUCCESS!" << endl;
+- setUpControllers();
+-}
+
+-void SDLJoystick::setUpControllers() {
+ int numjoys = SDL_NumJoysticks();
++ SDL_JoystickEventState(SDL_ENABLE);
+ for (int i = 0; i < numjoys; i++) {
+- setUpController(i);
+- }
+- if (controllers.size() > 0) {
+- cout << "pad 1 has been assigned to control pad: " << SDL_GameControllerName(controllers.front()) << endl;
++ joys.push_back(SDL_JoystickOpen(i));
++// printf("Initialized joystick %d: %s",i,SDL_JoystickNameForIndex(i));
++ if(strstr(SDL_JoystickNameForIndex(i),"PLAYSTATION(R)3 Controller"))
++ g_Config.bPS3Controller = true;
+ }
+-}
+
+-void SDLJoystick::setUpController(int deviceIndex) {
+- if (SDL_IsGameController(deviceIndex)) {
+- SDL_GameController *controller = SDL_GameControllerOpen(deviceIndex);
+- if (controller) {
+- if (SDL_GameControllerGetAttached(controller)) {
+- controllers.push_back(controller);
+- controllerDeviceMap[SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(controller))] = deviceIndex;
+- cout << "found control pad: " << SDL_GameControllerName(controller) << ", loading mapping: ";
+- auto mapping = SDL_GameControllerMapping(controller);
+- if (mapping == NULL) {
+- cout << "FAILED" << endl;
+- } else {
+- cout << "SUCCESS, mapping is:" << endl << mapping << endl;
+- }
+- } else {
+- SDL_GameControllerClose(controller);
+- }
+- }
+- }
++ if (g_Config.bPS3Controller)
++ fillMappingPS3();
++ else
++ fillMapping();
++
++
+ }
+
+ SDLJoystick::~SDLJoystick() {
+ if (registeredAsEventHandler) {
+ SDL_DelEventWatch(SDLJoystickEventHandlerWrapper, this);
+ }
+- for (auto & controller : controllers) {
+- SDL_GameControllerClose(controller);
++ for (SDL_Joystick *joy : joys) {
++ SDL_JoystickClose(joy);
+ }
+ }
+
+@@ -84,107 +46,124 @@ void SDLJoystick::registerEventHandler()
+ registeredAsEventHandler = true;
+ }
+
+-keycode_t SDLJoystick::getKeycodeForButton(SDL_GameControllerButton button) {
+- switch (button) {
+- case SDL_CONTROLLER_BUTTON_DPAD_UP:
+- return NKCODE_DPAD_UP;
+- case SDL_CONTROLLER_BUTTON_DPAD_DOWN:
+- return NKCODE_DPAD_DOWN;
+- case SDL_CONTROLLER_BUTTON_DPAD_LEFT:
+- return NKCODE_DPAD_LEFT;
+- case SDL_CONTROLLER_BUTTON_DPAD_RIGHT:
+- return NKCODE_DPAD_RIGHT;
+- case SDL_CONTROLLER_BUTTON_A:
+- return NKCODE_BUTTON_2;
+- case SDL_CONTROLLER_BUTTON_B:
+- return NKCODE_BUTTON_3;
+- case SDL_CONTROLLER_BUTTON_X:
+- return NKCODE_BUTTON_4;
+- case SDL_CONTROLLER_BUTTON_Y:
+- return NKCODE_BUTTON_1;
+- case SDL_CONTROLLER_BUTTON_RIGHTSHOULDER:
+- return NKCODE_BUTTON_5;
+- case SDL_CONTROLLER_BUTTON_LEFTSHOULDER:
+- return NKCODE_BUTTON_6;
+- case SDL_CONTROLLER_BUTTON_START:
+- return NKCODE_BUTTON_10;
+- case SDL_CONTROLLER_BUTTON_BACK:
+- return NKCODE_BUTTON_9; // select button
+- case SDL_CONTROLLER_BUTTON_GUIDE:
+- return NKCODE_BACK; // pause menu
+- case SDL_CONTROLLER_BUTTON_LEFTSTICK:
+- return NKCODE_BUTTON_THUMBL;
+- case SDL_CONTROLLER_BUTTON_RIGHTSTICK:
+- return NKCODE_BUTTON_THUMBR;
+- case SDL_CONTROLLER_BUTTON_INVALID:
+- default:
+- return NKCODE_UNKNOWN;
+- }
+-}
+-
+ void SDLJoystick::ProcessInput(SDL_Event &event){
+ switch (event.type) {
+- case SDL_CONTROLLERBUTTONDOWN:
+- if (event.cbutton.state == SDL_PRESSED) {
+- auto code = getKeycodeForButton((SDL_GameControllerButton)event.cbutton.button);
+- if (code != NKCODE_UNKNOWN) {
++ case SDL_JOYAXISMOTION:
++ {
++ std::map<int, int>::const_iterator i = SDLJoyAxisMap.find(event.jaxis.axis);
++ int deviceIndex = getDeviceIndex(event.jaxis.which);
++ if (i != SDLJoyAxisMap.end() && deviceIndex >= 0) {
++ AxisInput axis;
++ axis.axisId = i->second;
++ // 1.2 to try to approximate the PSP's clamped rectangular range.
++ axis.value = 1.2 * event.jaxis.value / 32767.0f;
++ if (axis.value > 1.0f) axis.value = 1.0f;
++ if (axis.value < -1.0f) axis.value = -1.0f;
++ axis.deviceId = DEVICE_ID_PAD_0 + deviceIndex;
++ axis.flags = 0;
++ NativeAxis(axis);
++ }
++ break;
++ }
++
++ case SDL_JOYBUTTONDOWN:
++ {
++ std::map<int, int>::const_iterator i = SDLJoyButtonMap.find(event.jbutton.button);
++ int deviceIndex = getDeviceIndex(event.jbutton.which);
++ if (i != SDLJoyButtonMap.end() && deviceIndex >= 0) {
+ KeyInput key;
+ key.flags = KEY_DOWN;
+- key.keyCode = code;
+- key.deviceId = DEVICE_ID_PAD_0 + getDeviceIndex(event.cbutton.which);
++ key.keyCode = i->second;
++ key.deviceId = DEVICE_ID_PAD_0 + deviceIndex;
+ NativeKey(key);
+ }
++ break;
+ }
+- break;
+- case SDL_CONTROLLERBUTTONUP:
+- if (event.cbutton.state == SDL_RELEASED) {
+- auto code = getKeycodeForButton((SDL_GameControllerButton)event.cbutton.button);
+- if (code != NKCODE_UNKNOWN) {
++
++ case SDL_JOYBUTTONUP:
++ {
++ std::map<int, int>::const_iterator i = SDLJoyButtonMap.find(event.jbutton.button);
++ int deviceIndex = getDeviceIndex(event.jbutton.which);
++ if (i != SDLJoyButtonMap.end() && deviceIndex >= 0) {
+ KeyInput key;
+ key.flags = KEY_UP;
+- key.keyCode = code;
+- key.deviceId = DEVICE_ID_PAD_0 + getDeviceIndex(event.cbutton.which);
++ key.keyCode = i->second;
++ key.deviceId = DEVICE_ID_PAD_0 + deviceIndex;
+ NativeKey(key);
+ }
++ break;
+ }
+- break;
+- case SDL_CONTROLLERAXISMOTION:
+- AxisInput axis;
+- axis.axisId = event.caxis.axis;
+- // 1.2 to try to approximate the PSP's clamped rectangular range.
+- axis.value = 1.2 * event.caxis.value / 32767.0f;
+- if (axis.value > 1.0f) axis.value = 1.0f;
+- if (axis.value < -1.0f) axis.value = -1.0f;
+- axis.deviceId = DEVICE_ID_PAD_0 + getDeviceIndex(event.caxis.which);
+- axis.flags = 0;
+- NativeAxis(axis);
+- break;
+- case SDL_CONTROLLERDEVICEREMOVED:
+- // for removal events, "which" is the instance ID for SDL_CONTROLLERDEVICEREMOVED
+- for (auto it = controllers.begin(); it != controllers.end(); ++it) {
+- if (SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(*it)) == event.cdevice.which) {
+- SDL_GameControllerClose(*it);
+- controllers.erase(it);
++
++ case SDL_JOYHATMOTION:
++ {
++ int deviceIndex = getDeviceIndex(event.jhat.which);
++ if (deviceIndex < 0) {
+ break;
+ }
++#ifdef _WIN32
++ KeyInput key;
++ key.deviceId = DEVICE_ID_PAD_0 + deviceIndex;
++
++ key.flags = (event.jhat.value & SDL_HAT_UP)?KEY_DOWN:KEY_UP;
++ key.keyCode = NKCODE_DPAD_UP;
++ NativeKey(key);
++ key.flags = (event.jhat.value & SDL_HAT_LEFT)?KEY_DOWN:KEY_UP;
++ key.keyCode = NKCODE_DPAD_LEFT;
++ NativeKey(key);
++ key.flags = (event.jhat.value & SDL_HAT_DOWN)?KEY_DOWN:KEY_UP;
++ key.keyCode = NKCODE_DPAD_DOWN;
++ NativeKey(key);
++ key.flags = (event.jhat.value & SDL_HAT_RIGHT)?KEY_DOWN:KEY_UP;
++ key.keyCode = NKCODE_DPAD_RIGHT;
++ NativeKey(key);
++#else
++ AxisInput axisX;
++ AxisInput axisY;
++ axisX.axisId = JOYSTICK_AXIS_HAT_X;
++ axisY.axisId = JOYSTICK_AXIS_HAT_Y;
++ axisX.deviceId = DEVICE_ID_PAD_0 + deviceIndex;
++ axisY.deviceId = DEVICE_ID_PAD_0 + deviceIndex;
++ axisX.value = 0.0f;
++ axisY.value = 0.0f;
++ if (event.jhat.value & SDL_HAT_LEFT) axisX.value = -1.0f;
++ if (event.jhat.value & SDL_HAT_RIGHT) axisX.value = 1.0f;
++ if (event.jhat.value & SDL_HAT_DOWN) axisY.value = 1.0f;
++ if (event.jhat.value & SDL_HAT_UP) axisY.value = -1.0f;
++ NativeAxis(axisX);
++ NativeAxis(axisY);
++#endif
++ break;
+ }
+- break;
+- case SDL_CONTROLLERDEVICEADDED:
+- // for add events, "which" is the device index!
+- int prevNumControllers = controllers.size();
+- setUpController(event.cdevice.which);
+- if (prevNumControllers == 0 && controllers.size() > 0) {
+- cout << "pad 1 has been assigned to control pad: " << SDL_GameControllerName(controllers.front()) << endl;
++
++ case SDL_JOYDEVICEADDED:
++ {
++ int deviceIndex = event.jdevice.which;
++ if (deviceIndex >= joys.size()) {
++ joys.resize(deviceIndex+1);
++ }
++ joys[deviceIndex] = SDL_JoystickOpen(deviceIndex);
++ SDL_JoystickEventState(SDL_ENABLE);
++ break;
++ }
++
++ case SDL_JOYDEVICEREMOVED:
++ {
++ int deviceIndex = getDeviceIndex(event.jdevice.which);
++ if (deviceIndex >= 0) {
++ SDL_JoystickClose(joys[deviceIndex]);
++ joys[deviceIndex] = 0;
++ }
++ break;
+ }
+- break;
+ }
+ }
+
+ int SDLJoystick::getDeviceIndex(int instanceId) {
+- auto it = controllerDeviceMap.find(instanceId);
+- if (it == controllerDeviceMap.end()) {
+- // could not find device
+- return -1;
++ for (int i = 0; i < joys.size(); i++) {
++ SDL_Joystick *joy = joys[i];
++ if (SDL_JoystickInstanceID(joy) == instanceId) {
++ return i;
++ }
+ }
+- return it->second;
++ return -1;
+ }
+--- SDL/SDLJoystick.h.orig 2017-03-30 12:14:27 UTC
++++ SDL/SDLJoystick.h
+@@ -1,9 +1,11 @@
+ #pragma once
+ #ifdef _WIN32
+ #include "SDL/SDL.h"
++#include "SDL/SDL_joystick.h"
+ #include "SDL/SDL_thread.h"
+ #else
+ #include "SDL.h"
++#include "SDL_joystick.h"
+ #include "SDL_thread.h"
+ #endif
+
+@@ -21,11 +23,119 @@ public:
+ void ProcessInput(SDL_Event &event);
+
+ private:
+- void setUpController(int deviceIndex);
+- void setUpControllers();
+- keycode_t getKeycodeForButton(SDL_GameControllerButton button);
+- int getDeviceIndex(int instanceId);
++ void fillMappingPS3()
++ {
++ SDLJoyButtonMap[14] = NKCODE_BUTTON_1; // Cross
++ SDLJoyButtonMap[13] = NKCODE_BUTTON_2; // Circle
++ SDLJoyButtonMap[15] = NKCODE_BUTTON_3; // Sqlare
++ SDLJoyButtonMap[12] = NKCODE_BUTTON_4; // Triangle
++ SDLJoyButtonMap[10] = NKCODE_BUTTON_5; // L1
++ SDLJoyButtonMap[11] = NKCODE_BUTTON_6; // R1
++ SDLJoyButtonMap[8] = NKCODE_BUTTON_7; // L2
++ SDLJoyButtonMap[9] = NKCODE_BUTTON_8; // R2
++ SDLJoyButtonMap[0] = NKCODE_BUTTON_9; // Select
++ SDLJoyButtonMap[3] = NKCODE_BUTTON_10; // Start
++ SDLJoyButtonMap[1] = NKCODE_BUTTON_11; // L3
++ SDLJoyButtonMap[2] = NKCODE_BUTTON_12; // R3
++ SDLJoyButtonMap[16] = NKCODE_BUTTON_13; // PS
++ SDLJoyButtonMap[4] = NKCODE_DPAD_UP;
++ SDLJoyButtonMap[6] = NKCODE_DPAD_DOWN;
++ SDLJoyButtonMap[7] = NKCODE_DPAD_LEFT;
++ SDLJoyButtonMap[5] = NKCODE_DPAD_RIGHT;
++ SDLJoyAxisMap[0] = JOYSTICK_AXIS_X;
++ SDLJoyAxisMap[1] = JOYSTICK_AXIS_Y;
++ SDLJoyAxisMap[2] = JOYSTICK_AXIS_Z;
++ SDLJoyAxisMap[3] = JOYSTICK_AXIS_RZ;
++ }
++ void fillMapping()
++ {
++ //TODO: C++11 aggregate initialization
++ //would remove runtime overhead completely
++
++ // Mapping on Windows
++#ifdef _WIN32
++ SDLJoyButtonMap[0] = NKCODE_BUTTON_2;
++ SDLJoyButtonMap[1] = NKCODE_BUTTON_3;
++ SDLJoyButtonMap[2] = NKCODE_BUTTON_4;
++ SDLJoyButtonMap[3] = NKCODE_BUTTON_1;
++ SDLJoyButtonMap[4] = NKCODE_BUTTON_7;
++ SDLJoyButtonMap[5] = NKCODE_BUTTON_8;
++ SDLJoyButtonMap[6] = NKCODE_BUTTON_9;
++ SDLJoyButtonMap[7] = NKCODE_BUTTON_10;
++ SDLJoyButtonMap[8] = NKCODE_BUTTON_11;
++ SDLJoyButtonMap[9] = NKCODE_BUTTON_12;
++ SDLJoyButtonMap[10] = NKCODE_BUTTON_5;
++ SDLJoyButtonMap[11] = NKCODE_BUTTON_6;
++ SDLJoyButtonMap[12] = NKCODE_BUTTON_7;
++ SDLJoyButtonMap[13] = NKCODE_BUTTON_8;
++ SDLJoyButtonMap[14] = NKCODE_BUTTON_9;
++
++ SDLJoyAxisMap[0] = JOYSTICK_AXIS_X;
++ SDLJoyAxisMap[1] = JOYSTICK_AXIS_Y;
++ SDLJoyAxisMap[2] = JOYSTICK_AXIS_Z;
++ SDLJoyAxisMap[3] = JOYSTICK_AXIS_RZ;
++ SDLJoyAxisMap[4] = JOYSTICK_AXIS_LTRIGGER;
++ SDLJoyAxisMap[5] = JOYSTICK_AXIS_RTRIGGER;
++ // Mapping on MacOSX to match X360 controller
++#elif __APPLE__
++ SDLJoyButtonMap[0] = NKCODE_DPAD_UP;
++ SDLJoyButtonMap[1] = NKCODE_DPAD_DOWN;
++ SDLJoyButtonMap[2] = NKCODE_DPAD_LEFT;
++ SDLJoyButtonMap[3] = NKCODE_DPAD_RIGHT;
++ SDLJoyButtonMap[4] = NKCODE_BUTTON_10;
++ SDLJoyButtonMap[5] = NKCODE_BUTTON_9;
++ SDLJoyButtonMap[6] = NKCODE_BUTTON_5;
++ SDLJoyButtonMap[7] = NKCODE_BUTTON_6;
++ SDLJoyButtonMap[8] = NKCODE_BUTTON_7;
++ SDLJoyButtonMap[9] = NKCODE_BUTTON_8;
++ SDLJoyButtonMap[10] = NKCODE_BUTTON_SELECT;
++ SDLJoyButtonMap[11] = NKCODE_BUTTON_2;
++ SDLJoyButtonMap[12] = NKCODE_BUTTON_3;
++ SDLJoyButtonMap[13] = NKCODE_BUTTON_4;
++ SDLJoyButtonMap[14] = NKCODE_BUTTON_1;
++ SDLJoyButtonMap[15] = NKCODE_BUTTON_11;
++ SDLJoyButtonMap[16] = NKCODE_BUTTON_12;
++
++ SDLJoyAxisMap[0] = JOYSTICK_AXIS_X;
++ SDLJoyAxisMap[1] = JOYSTICK_AXIS_Y;
++ SDLJoyAxisMap[2] = JOYSTICK_AXIS_Z;
++ SDLJoyAxisMap[3] = JOYSTICK_AXIS_RZ;
++ SDLJoyAxisMap[4] = JOYSTICK_AXIS_LTRIGGER;
++ SDLJoyAxisMap[5] = JOYSTICK_AXIS_RTRIGGER;
++ // Mapping on Linux/Android/Other to match X360 and wii-u pro controller
++#else
++ SDLJoyButtonMap[0] = NKCODE_BUTTON_1;
++ SDLJoyButtonMap[1] = NKCODE_BUTTON_2;
++ SDLJoyButtonMap[2] = NKCODE_BUTTON_3;
++ SDLJoyButtonMap[3] = NKCODE_BUTTON_4;
++ SDLJoyButtonMap[4] = NKCODE_BUTTON_5;
++ SDLJoyButtonMap[5] = NKCODE_BUTTON_6;
++ SDLJoyButtonMap[6] = NKCODE_BUTTON_7;
++ SDLJoyButtonMap[7] = NKCODE_BUTTON_8;
++ SDLJoyButtonMap[8] = NKCODE_BUTTON_9;
++ SDLJoyButtonMap[9] = NKCODE_BUTTON_10;
++ SDLJoyButtonMap[10] = NKCODE_BUTTON_11;
++ SDLJoyButtonMap[11] = NKCODE_BUTTON_12;
++ SDLJoyButtonMap[12] = NKCODE_BUTTON_13;
++ SDLJoyButtonMap[13] = NKCODE_DPAD_UP;
++ SDLJoyButtonMap[14] = NKCODE_DPAD_DOWN;
++ SDLJoyButtonMap[15] = NKCODE_DPAD_LEFT;
++ SDLJoyButtonMap[16] = NKCODE_DPAD_RIGHT;
++
++ SDLJoyAxisMap[0] = JOYSTICK_AXIS_X;
++ SDLJoyAxisMap[1] = JOYSTICK_AXIS_Y;
++ SDLJoyAxisMap[2] = JOYSTICK_AXIS_Z;
++ SDLJoyAxisMap[3] = JOYSTICK_AXIS_RZ;
++ SDLJoyAxisMap[4] = JOYSTICK_AXIS_LTRIGGER;
++ SDLJoyAxisMap[5] = JOYSTICK_AXIS_RTRIGGER;
++
++#endif
++ }
++ std::map<int, int> SDLJoyButtonMap;
++ std::map<int, int> SDLJoyAxisMap;
++
++ std::vector<SDL_Joystick *> joys;
+ bool registeredAsEventHandler;
+- std::vector<SDL_GameController *> controllers;
+- std::map<int, int> controllerDeviceMap;
++
++ int getDeviceIndex(int instanceId);
+ };
+--- ext/native/base/PCMain.cpp.orig 2017-03-30 12:14:27 UTC
++++ ext/native/base/PCMain.cpp
+@@ -399,7 +399,7 @@ int main(int argc, char *argv[]) {
+ NativeGetAppInfo(&app_name, &app_name_nice, &landscape, &version);
+
+ bool joystick_enabled = true;
+- if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER | SDL_INIT_AUDIO) < 0) {
++ if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO) < 0) {
+ joystick_enabled = false;
+ if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
+ fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError());
diff --git a/emulators/ppsspp/files/patch-Common_MemoryUtil.cpp b/emulators/ppsspp/files/patch-Common_MemoryUtil.cpp
index 5bba28f595f1..4338aeeaae6f 100644
--- a/emulators/ppsspp/files/patch-Common_MemoryUtil.cpp
+++ b/emulators/ppsspp/files/patch-Common_MemoryUtil.cpp
@@ -1,25 +1,22 @@
---- Common/MemoryUtil.cpp.orig 2015-02-26 20:05:06 UTC
+--- Common/MemoryUtil.cpp.orig 2015-11-19 15:07:48 UTC
+++ Common/MemoryUtil.cpp
-@@ -49,6 +49,13 @@ static SYSTEM_INFO sys_info;
- #define round_page(x) ((((uintptr_t)(x)) + PAGE_MASK) & ~(PAGE_MASK))
+@@ -32,6 +32,10 @@
+ #include <mach/vm_param.h>
#endif
-+#if defined(__FreeBSD__)
-+/* setrlimit(2) */
-+#include <sys/types.h>
-+#include <sys/time.h>
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#include <sys/resource.h>
+#endif
+
- #ifdef __SYMBIAN32__
- #include <e32std.h>
- #define CODECHUNK_SIZE 1024*1024*20
-@@ -142,6 +149,21 @@ void* AllocateExecutableMemory(size_t si
+ #ifndef _WIN32
+ #include <unistd.h>
+ #endif
+@@ -149,6 +153,21 @@ void *AllocateExecutableMemory(size_t si
map_hint = (char*)round_page(&hint_location) - 0x20000000; // 0.5gb lower than our approximate location
else
map_hint = (char*)0x20000000; // 0.5GB mark in memory
+
-+#if defined(__FreeBSD__)
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ // XXX Fix maximum data segment size (data + BSS + heap) to 256 MB.
+ // This allows avoiding calling mmap(2) with MAP_FIXED.
+ // On FreeBSD, without lowering this limit, calling mmap(2)
@@ -34,5 +31,5 @@
+ }
+#endif
}
- else if (exec && (uintptr_t) map_hint > 0xFFFFFFFFULL)
+ else if ((uintptr_t) map_hint > 0xFFFFFFFFULL)
{
diff --git a/emulators/ppsspp/files/pkg-message.in b/emulators/ppsspp/files/pkg-message.in
new file mode 100644
index 000000000000..cf6946b3fb95
--- /dev/null
+++ b/emulators/ppsspp/files/pkg-message.in
@@ -0,0 +1,7 @@
+Known issues:
+- Videos are garbled since multimedia/ffmpeg update to 3.2, see #9026
+- %%DATADIR%%/assets/gamecontrollerdb.txt cannot be used
+ as is because SDL_JoystickGetGUID is a stub on FreeBSD. Create the
+ file using controllermap (or antimicro) then check with testgamecontroller
+ it's detected (pay attention to guid). If you have trouble making it
+ work try OLDJOY option for v1.3 behavior.