Index: head/emulators/ppsspp/Makefile =================================================================== --- head/emulators/ppsspp/Makefile (revision 564654) +++ head/emulators/ppsspp/Makefile (revision 564655) @@ -1,109 +1,97 @@ # $FreeBSD$ PORTNAME= ppsspp DISTVERSIONPREFIX= v -DISTVERSION?= 1.10.3 +DISTVERSION?= 1.11 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/:.*//} MAINTAINER= jbeich@FreeBSD.org COMMENT= PSP emulator in C++ with dynarec JIT for x86, ARM, MIPS LICENSE= GPLv2+ # Bi-endian architectures default to big for some reason NOT_FOR_ARCHS= mips mips64 powerpc powerpc64 powerpcspe sparc64 NOT_FOR_ARCHS_REASON= only little-endian is supported, see \ https://github.com/hrydgard/ppsspp/issues/8823 LIB_DEPENDS= libzip.so:archivers/libzip \ libsnappy.so:archivers/snappy \ libavcodec.so:multimedia/ffmpeg RUN_DEPENDS= xdg-open:devel/xdg-utils USE_GITHUB= yes GH_ACCOUNT= hrydgard GH_TUPLE?= hrydgard:glslang:8.13.3559-76-gd0850f87:glslang/ext/glslang \ - hrydgard:${PORTNAME}-lang:1c64b8f:lang/assets/lang \ + hrydgard:miniupnp:miniupnpd_2_1-354-g7e229dd:miniupnp/ext/miniupnp \ + hrydgard:${PORTNAME}-lang:567b225:lang/assets/lang \ KhronosGroup:SPIRV-Cross:2019-05-20-60-ga1f7c8dc:SPIRV/ext/SPIRV-Cross \ Kingcom:armips:v0.10.0-28-g7885552:armips/ext/armips CONFLICTS_INSTALL= ${PORTNAME}-* USES= cmake compiler:c++11-lib gl localbase:ldflags pkgconfig EXCLUDE= libzip zlib EXTRACT_AFTER_ARGS=${EXCLUDE:S,^,--exclude ,} USE_GL= gl glew glu CMAKE_ON= USE_SYSTEM_FFMPEG USE_SYSTEM_LIBZIP USE_SYSTEM_SNAPPY USE_WAYLAND_WSI CMAKE_OFF= USE_DISCORD SUB_FILES= pkg-message -PORTDATA= assets ${PORTNAME} +PORTDATA= assets DESKTOP_ENTRIES="PPSSPP" \ "" \ "${PORTNAME}" \ "${PORTNAME} %f" \ "Game;Emulator;" \ "" -OPTIONS_DEFINE= OLDJOY VULKAN +OPTIONS_DEFINE= VULKAN OPTIONS_DEFAULT=VULKAN OPTIONS_SINGLE= GUI OPTIONS_SINGLE_GUI= LIBRETRO QT5 SDL OPTIONS_SLAVE?= SDL OPTIONS_EXCLUDE:= ${OPTIONS_EXCLUDE} ${OPTIONS_SINGLE_GUI} LIBRETRO_DESC= libretro core for games/retroarch LIBRETRO_CMAKE_BOOL= LIBRETRO LIBRETRO_PLIST_FILES= lib/libretro/${PORTNAME}_libretro.so LIBRETRO_VARS= CONFLICTS_INSTALL= DESKTOP_ENTRIES= PLIST= PORTDATA= PKGMESSAGE= SUB_FILES= -OLDJOY_DESC= Old joystick support with fixed button mappings (deprecated) -OLDJOY_EXTRA_PATCHES= ${PATCHDIR}/extra-patch-old-joy QT5_USES= qt:5 sdl QT5_USE= QT=qmake_build,buildtools_build,linguisttools_build,gui,multimedia,opengl,widgets QT5_USE+= SDL=sdl2 # audio, joystick 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_USES= sdl SDL_USE= SDL=sdl2 SDL_VARS= EXENAME=PPSSPPSDL VULKAN_DESC= Vulkan renderer VULKAN_RUN_DEPENDS= ${LOCALBASE}/lib/libvulkan.so:graphics/vulkan-loader 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/"unknown"/"${DISTVERSIONFULL}"/' \ ${WRKSRC}/git-version.cmake do-install-QT5-on do-install-SDL-on: -# 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}/${EXENAME} \ - ${STAGEDIR}${DATADIR}/${PORTNAME} - ${LN} -sf ../${DATADIR_REL}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin - + ${MV} ${STAGEDIR}${PREFIX}/bin/${EXENAME} \ + ${STAGEDIR}${PREFIX}/bin/${PORTNAME} ${INSTALL_MAN} ${_DISTDIR}/${PORTNAME}.1 \ ${STAGEDIR}${PREFIX}/share/man/man1 - (cd ${WRKSRC}/icons && ${COPYTREE_SHARE} \ - "hicolor" ${STAGEDIR}${PREFIX}/share/icons) - ${MKDIR} ${STAGEDIR}${PREFIX}/share/icons/hicolor/scalable/apps - ${INSTALL_DATA} ${WRKSRC}/icons/icon-512.svg \ - ${STAGEDIR}${PREFIX}/share/icons/hicolor/scalable/apps/${PORTNAME}.svg do-install-LIBRETRO-on: ${MKDIR} ${STAGEDIR}${PREFIX}/${LIBRETRO_PLIST_FILES:H} ${INSTALL_LIB} ${BUILD_WRKSRC}/lib/${LIBRETRO_PLIST_FILES:T} \ ${STAGEDIR}${PREFIX}/${LIBRETRO_PLIST_FILES:H} .include Index: head/emulators/ppsspp/distinfo =================================================================== --- head/emulators/ppsspp/distinfo (revision 564654) +++ head/emulators/ppsspp/distinfo (revision 564655) @@ -1,13 +1,15 @@ -TIMESTAMP = 1594551856 +TIMESTAMP = 1612734236 SHA256 (ppsspp.1) = 64a7cca4c3a5fc6ad5b63399edef9056b0c85ea68fed00fb7e97f4b2724e503b SIZE (ppsspp.1) = 1598 -SHA256 (hrydgard-ppsspp-v1.10.3_GH0.tar.gz) = 92a0931c0817529202679f926632510658f3aeea83e2a1663f9cce595b505421 -SIZE (hrydgard-ppsspp-v1.10.3_GH0.tar.gz) = 16956980 +SHA256 (hrydgard-ppsspp-v1.11_GH0.tar.gz) = 2e7be70623a34b0d3900d4b2b4011b15e83b7915b70c3a3f4b301faed5274523 +SIZE (hrydgard-ppsspp-v1.11_GH0.tar.gz) = 30064888 SHA256 (hrydgard-glslang-8.13.3559-76-gd0850f87_GH0.tar.gz) = d4484a9401b976c35e6522e02fb765f99e2675933c9d98aabb4b4f05ac964b1a SIZE (hrydgard-glslang-8.13.3559-76-gd0850f87_GH0.tar.gz) = 3135708 -SHA256 (hrydgard-ppsspp-lang-1c64b8f_GH0.tar.gz) = e8125e5228c0c6f323a3b80da1d4f636532844e723f10d5de1b892621f8e9d96 -SIZE (hrydgard-ppsspp-lang-1c64b8f_GH0.tar.gz) = 620586 +SHA256 (hrydgard-miniupnp-miniupnpd_2_1-354-g7e229dd_GH0.tar.gz) = 6d0d7b179b4720771e90a84a6e233251305e1bdada1573276bc225e41364f5d9 +SIZE (hrydgard-miniupnp-miniupnpd_2_1-354-g7e229dd_GH0.tar.gz) = 438700 +SHA256 (hrydgard-ppsspp-lang-567b225_GH0.tar.gz) = 7f52741014ffaa442b51036f5e37844d66e6652fb726a5781ba194d1758a1a51 +SIZE (hrydgard-ppsspp-lang-567b225_GH0.tar.gz) = 658751 SHA256 (KhronosGroup-SPIRV-Cross-2019-05-20-60-ga1f7c8dc_GH0.tar.gz) = 2a07055247a14c0112d6e35634de93f832ac88e08828d9147e3a20d8d46600b2 SIZE (KhronosGroup-SPIRV-Cross-2019-05-20-60-ga1f7c8dc_GH0.tar.gz) = 816026 SHA256 (Kingcom-armips-v0.10.0-28-g7885552_GH0.tar.gz) = 040a8d01b1c0e65b77ede9dd6713b6f6290346a29d300138454335362a396d6c SIZE (Kingcom-armips-v0.10.0-28-g7885552_GH0.tar.gz) = 197207 Index: head/emulators/ppsspp/files/extra-patch-old-joy =================================================================== --- head/emulators/ppsspp/files/extra-patch-old-joy (revision 564654) +++ head/emulators/ppsspp/files/extra-patch-old-joy (nonexistent) @@ -1,499 +0,0 @@ -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 -https://github.com/hrydgard/ppsspp/commit/ac0052c6af92 -https://github.com/hrydgard/ppsspp/commit/53daa0d844af - ---- Core/Config.h.orig 2019-10-16 19:38:27 UTC -+++ Core/Config.h -@@ -83,6 +83,7 @@ struct Config { (public) - bool bPauseExitsEmulator; - - bool bPauseMenuExitsEmulator; -+ bool bPS3Controller; - - // Core - bool bIgnoreBadMemAccess; ---- SDL/SDLJoystick.cpp.orig 2019-10-16 19:38:27 UTC -+++ SDL/SDLJoystick.cpp -@@ -1,13 +1,8 @@ - #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) - { - static_cast(userdata)->ProcessInput(*event); -@@ -17,79 +12,30 @@ static int SDLJoystickEventHandlerWrapper(void* userda - 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); -+ SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO); - } - -- 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; -- } -- cout << "SUCCESS!" << endl; -- setUpControllers(); --} -- --void SDLJoystick::setUpControllers() { - int numjoys = SDL_NumJoysticks(); -+ SDL_JoystickEventState(SDL_ENABLE); - for (int i = 0; i < numjoys; i++) { -- setUpController(i); -+ 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; - } -- if (controllers.size() > 0) { -- cout << "pad 1 has been assigned to control pad: " << SDL_GameControllerName(controllers.front()) << endl; -- } --} - --void SDLJoystick::setUpController(int deviceIndex) { -- if (!SDL_IsGameController(deviceIndex)) { -- cout << "Control pad device " << deviceIndex << " not supported by SDL game controller database, attempting to create default mapping..." << endl; -- int cbGUID = 33; -- char pszGUID[cbGUID]; -- SDL_Joystick* joystick = SDL_JoystickOpen(deviceIndex); -- SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick), pszGUID, cbGUID); -- // create default mapping - this is the PS3 dual shock mapping -- std::string mapping = string(pszGUID) + "," + string(SDL_JoystickName(joystick)) + ",x:b3,a:b0,b:b1,y:b2,back:b8,guide:b10,start:b9,dpleft:b15,dpdown:b14,dpright:b16,dpup:b13,leftshoulder:b4,lefttrigger:a2,rightshoulder:b6,rightshoulder:b5,righttrigger:a5,leftstick:b7,leftstick:b11,rightstick:b12,leftx:a0,lefty:a1,rightx:a3,righty:a4"; -- if (SDL_GameControllerAddMapping(mapping.c_str()) == 1){ -- cout << "Added default mapping ok" << endl; -- } else { -- cout << "Failed to add default mapping" << endl; -- } -- SDL_JoystickClose(joystick); -- } -- 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; -- cout << "Could not find mapping in SDL2 controller database" << 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); - } - } - -@@ -98,107 +44,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 * g_Config.fXInputAnalogSensitivity / 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 * g_Config.fXInputAnalogSensitivity / 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; - } -- break; -+ -+ case SDL_JOYDEVICEREMOVED: -+ { -+ int deviceIndex = getDeviceIndex(event.jdevice.which); -+ if (deviceIndex >= 0) { -+ SDL_JoystickClose(joys[deviceIndex]); -+ joys[deviceIndex] = 0; -+ } -+ 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 2019-10-16 19:38:27 UTC -+++ SDL/SDLJoystick.h -@@ -1,9 +1,11 @@ - #pragma once - #ifdef _MSC_VER - #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 @@ class SDLJoystick{ (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); - }; ---- SDL/SDLMain.cpp.orig 2019-10-16 19:38:27 UTC -+++ SDL/SDLMain.cpp -@@ -417,7 +417,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) { - fprintf(stderr, "Failed to initialize SDL with joystick support. Retrying without.\n"); - joystick_enabled = false; - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) { ---- UI/NativeApp.cpp.orig 2019-10-16 19:38:27 UTC -+++ UI/NativeApp.cpp -@@ -555,6 +555,8 @@ void NativeInit(int argc, const char *argv[], const ch - fileToLog = argv[i] + strlen("--log="); - if (!strncmp(argv[i], "--state=", strlen("--state=")) && strlen(argv[i]) > strlen("--state=")) - stateToLoad = argv[i] + strlen("--state="); -+ if (!strncmp(argv[1], "--PS3", strlen("--PS3"))) -+ g_Config.bPS3Controller = true; - #if !defined(MOBILE_DEVICE) - if (!strncmp(argv[i], "--escape-exit", strlen("--escape-exit"))) - g_Config.bPauseExitsEmulator = true; Property changes on: head/emulators/ppsspp/files/extra-patch-old-joy ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/emulators/ppsspp/files/pkg-message.in =================================================================== --- head/emulators/ppsspp/files/pkg-message.in (revision 564654) +++ head/emulators/ppsspp/files/pkg-message.in (revision 564655) @@ -1,12 +1,11 @@ [ { type: install message: <= 13.0, sysutils/iichid or multimedia/webcamd. + If your joystick isn't detected consider defining SDL_GAMECONTROLLERCONFIG + in environ(7) after generating the entry via controllermap (or antimicro). EOM } ] Index: head/emulators/ppsspp/pkg-plist =================================================================== --- head/emulators/ppsspp/pkg-plist (revision 564654) +++ head/emulators/ppsspp/pkg-plist (revision 564655) @@ -1,12 +1,14 @@ bin/ppsspp +@comment share/applications/PPSSPPSDL.desktop +@comment share/applications/PPSSPPQt.desktop share/icons/hicolor/128x128/apps/ppsspp.png share/icons/hicolor/16x16/apps/ppsspp.png share/icons/hicolor/24x24/apps/ppsspp.png share/icons/hicolor/256x256/apps/ppsspp.png share/icons/hicolor/32x32/apps/ppsspp.png share/icons/hicolor/48x48/apps/ppsspp.png share/icons/hicolor/512x512/apps/ppsspp.png share/icons/hicolor/64x64/apps/ppsspp.png share/icons/hicolor/96x96/apps/ppsspp.png -share/icons/hicolor/scalable/apps/ppsspp.svg share/man/man1/ppsspp.1.gz +share/pixmaps/ppsspp.svg