From owner-svn-ports-head@freebsd.org Fri Mar 31 13:10:04 2017 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1BAE0D2740E; Fri, 31 Mar 2017 13:10:04 +0000 (UTC) (envelope-from jbeich@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA793BC3; Fri, 31 Mar 2017 13:10:03 +0000 (UTC) (envelope-from jbeich@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2VDA2cm058234; Fri, 31 Mar 2017 13:10:02 GMT (envelope-from jbeich@FreeBSD.org) Received: (from jbeich@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2VDA2q8058225; Fri, 31 Mar 2017 13:10:02 GMT (envelope-from jbeich@FreeBSD.org) Message-Id: <201703311310.v2VDA2q8058225@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jbeich set sender to jbeich@FreeBSD.org using -f From: Jan Beich Date: Fri, 31 Mar 2017 13:10:02 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r437353 - in head: . emulators emulators/ppsspp emulators/ppsspp-qt4 emulators/ppsspp-qt5 emulators/ppsspp/files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Mar 2017 13:10:04 -0000 Author: jbeich Date: Fri Mar 31 13:10:02 2017 New Revision: 437353 URL: https://svnweb.freebsd.org/changeset/ports/437353 Log: emulators/ppsspp: update to 1.4 Changes: http://ppsspp.org/#news Changes: https://github.com/hrydgard/ppsspp/releases/tag/v1.4 Added: head/emulators/ppsspp/files/extra-patch-old-joy (contents, props changed) head/emulators/ppsspp/files/pkg-message.in (contents, props changed) Deleted: head/emulators/ppsspp-qt4/ Modified: head/MOVED head/emulators/Makefile (contents, props changed) head/emulators/ppsspp-qt5/Makefile (contents, props changed) head/emulators/ppsspp/Makefile (contents, props changed) head/emulators/ppsspp/distinfo (contents, props changed) head/emulators/ppsspp/files/patch-Common_MemoryUtil.cpp (contents, props changed) Modified: head/MOVED ============================================================================== --- head/MOVED Fri Mar 31 12:52:45 2017 (r437352) +++ head/MOVED Fri Mar 31 13:10:02 2017 (r437353) @@ -9169,3 +9169,4 @@ devel/libytnef|converters/ytnef|2017-03- databases/py-sqlalchemy08|databases/py-sqlalchemy10|2017-03-29|Has expired: Upstream has declared this version EoL: please migrate to databases/py-sqlalchemy10 devel/py3-meson||2017-03-30|Removed deskutils/kchmviewer-kde4|deskutils/kchmviewer|2017-03-31|Renamed to drop the -kde4 suffix +emulators/ppsspp-qt4|emulators/ppsspp-qt5|2017-03-31|Qt4 support was removed upstream Modified: head/emulators/Makefile ============================================================================== --- head/emulators/Makefile Fri Mar 31 12:52:45 2017 (r437352) +++ head/emulators/Makefile Fri Mar 31 13:10:02 2017 (r437353) @@ -108,7 +108,6 @@ SUBDIR += pipelight SUBDIR += playonbsd SUBDIR += ppsspp - SUBDIR += ppsspp-qt4 SUBDIR += ppsspp-qt5 SUBDIR += py-gns3-converter SUBDIR += py-nova Modified: head/emulators/ppsspp-qt5/Makefile ============================================================================== --- head/emulators/ppsspp-qt5/Makefile Fri Mar 31 12:52:45 2017 (r437352) +++ head/emulators/ppsspp-qt5/Makefile Fri Mar 31 13:10:02 2017 (r437353) @@ -1,6 +1,6 @@ # $FreeBSD$ -PORTREVISION= 1 +PORTREVISION= 0 PKGNAMESUFFIX= -qt5 MASTERDIR= ${.CURDIR}/../ppsspp Modified: head/emulators/ppsspp/Makefile ============================================================================== --- head/emulators/ppsspp/Makefile Fri Mar 31 12:52:45 2017 (r437352) +++ head/emulators/ppsspp/Makefile Fri Mar 31 13:10:02 2017 (r437353) @@ -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 Modified: head/emulators/ppsspp/distinfo ============================================================================== --- head/emulators/ppsspp/distinfo Fri Mar 31 12:52:45 2017 (r437352) +++ head/emulators/ppsspp/distinfo Fri Mar 31 13:10:02 2017 (r437353) @@ -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 Added: head/emulators/ppsspp/files/extra-patch-old-joy ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/emulators/ppsspp/files/extra-patch-old-joy Fri Mar 31 13:10:02 2017 (r437353) @@ -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 +-#include +- +-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::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::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::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 SDLJoyButtonMap; ++ std::map SDLJoyAxisMap; ++ ++ std::vector joys; + bool registeredAsEventHandler; +- std::vector controllers; +- std::map 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()); Modified: head/emulators/ppsspp/files/patch-Common_MemoryUtil.cpp ============================================================================== --- head/emulators/ppsspp/files/patch-Common_MemoryUtil.cpp Fri Mar 31 12:52:45 2017 (r437352) +++ head/emulators/ppsspp/files/patch-Common_MemoryUtil.cpp Fri Mar 31 13:10:02 2017 (r437353) @@ -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 #endif -+#if defined(__FreeBSD__) -+/* setrlimit(2) */ -+#include -+#include ++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#include +#endif + - #ifdef __SYMBIAN32__ - #include - #define CODECHUNK_SIZE 1024*1024*20 -@@ -142,6 +149,21 @@ void* AllocateExecutableMemory(size_t si + #ifndef _WIN32 + #include + #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) { Added: head/emulators/ppsspp/files/pkg-message.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/emulators/ppsspp/files/pkg-message.in Fri Mar 31 13:10:02 2017 (r437353) @@ -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.