git: 440a957b9145 - 2021Q4 - emulators/yuzu: update to s20211127

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Sun, 19 Dec 2021 00:19:59 UTC
The branch 2021Q4 has been updated by jbeich:

URL: https://cgit.FreeBSD.org/ports/commit/?id=440a957b91450f013a822699c263ba83d962fce4

commit 440a957b91450f013a822699c263ba83d962fce4
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2021-11-27 10:52:08 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2021-12-19 00:18:38 +0000

    emulators/yuzu: update to s20211127
    
    Changes:        https://github.com/yuzu-emu/yuzu/compare/157985f55...564f10527
    (cherry picked from commit ff9778994a93afde54a1f0c47960146e9599e58a)
---
 emulators/yuzu/Makefile         |  4 +-
 emulators/yuzu/distinfo         |  6 +--
 emulators/yuzu/files/patch-sdl2 | 90 +++++++++++++----------------------------
 3 files changed, 33 insertions(+), 67 deletions(-)

diff --git a/emulators/yuzu/Makefile b/emulators/yuzu/Makefile
index ad6a9df344a9..e154038666ec 100644
--- a/emulators/yuzu/Makefile
+++ b/emulators/yuzu/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	yuzu
-PORTVERSION=	s20211126
+PORTVERSION=	s20211127
 PORTREVISION?=	0
 CATEGORIES=	emulators
 
@@ -33,7 +33,7 @@ LIB_DEPENDS=	liblz4.so:archivers/liblz4 \
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	yuzu-emu
-GH_TAGNAME=	157985f55
+GH_TAGNAME=	564f10527
 GH_TUPLE=	yuzu-emu:mbedtls:v2.16.9-115-g8c88150ca:mbedtls/externals/mbedtls \
 		KhronosGroup:SPIRV-Headers:1.5.4.raytracing.fixed-32-ga3fdfe8:SPIRV_Headers/externals/sirit/externals/SPIRV-Headers \
 		KhronosGroup:Vulkan-Headers:v1.2.180:Vulkan_Headers/externals/Vulkan-Headers \
diff --git a/emulators/yuzu/distinfo b/emulators/yuzu/distinfo
index 5e6ff7249201..49ddb8eb79a5 100644
--- a/emulators/yuzu/distinfo
+++ b/emulators/yuzu/distinfo
@@ -1,6 +1,6 @@
-TIMESTAMP = 1637969920
-SHA256 (yuzu-emu-yuzu-s20211126-157985f55_GH0.tar.gz) = b6567e3c21ddca94df29e3d5e978a26ff038a9e2a34f4a5108880c6607aebdb4
-SIZE (yuzu-emu-yuzu-s20211126-157985f55_GH0.tar.gz) = 4398693
+TIMESTAMP = 1638010328
+SHA256 (yuzu-emu-yuzu-s20211127-564f10527_GH0.tar.gz) = 55c1a4ff15460bb5f455d8d7a41e5e09ecb1471c79afcaac8e87a45b0cbd951e
+SIZE (yuzu-emu-yuzu-s20211127-564f10527_GH0.tar.gz) = 4408527
 SHA256 (yuzu-emu-mbedtls-v2.16.9-115-g8c88150ca_GH0.tar.gz) = 8cd6d075b4da0ad5fb995eb37390e2e6088be8d41ab1cdfc7e7e4256bd991450
 SIZE (yuzu-emu-mbedtls-v2.16.9-115-g8c88150ca_GH0.tar.gz) = 2679189
 SHA256 (KhronosGroup-SPIRV-Headers-1.5.4.raytracing.fixed-32-ga3fdfe8_GH0.tar.gz) = bd629d6296dd374eb2aeff923c75895ba0f3ce6448dad89763930e65b954e0cb
diff --git a/emulators/yuzu/files/patch-sdl2 b/emulators/yuzu/files/patch-sdl2
index 37341e782041..2eb05a0a0049 100644
--- a/emulators/yuzu/files/patch-sdl2
+++ b/emulators/yuzu/files/patch-sdl2
@@ -19,9 +19,9 @@ CMake Error at CMakeLists.txt:397 (find_package):
  
          # Some installations don't set SDL2_LIBRARIES
          if("${SDL2_LIBRARIES}" STREQUAL "")
---- src/input_common/sdl/sdl_impl.cpp.orig	2021-09-18 00:25:51 UTC
-+++ src/input_common/sdl/sdl_impl.cpp
-@@ -64,6 +64,7 @@ class SDLJoystick { (public)
+--- src/input_common/drivers/sdl_driver.cpp.orig	2021-11-27 10:52:08 UTC
++++ src/input_common/drivers/sdl_driver.cpp
+@@ -39,6 +39,7 @@ class SDLJoystick { (public)
      }
  
      void EnableMotion() {
@@ -29,38 +29,39 @@ CMake Error at CMakeLists.txt:397 (find_package):
          if (sdl_controller) {
              SDL_GameController* controller = sdl_controller.get();
              if (SDL_GameControllerHasSensor(controller, SDL_SENSOR_ACCEL) && !has_accel) {
-@@ -75,6 +76,7 @@ class SDLJoystick { (public)
+@@ -50,6 +51,7 @@ class SDLJoystick { (public)
                  has_gyro = true;
              }
          }
 +#endif
      }
  
-     void SetButton(int button, bool value) {
-@@ -88,6 +90,7 @@ class SDLJoystick { (public)
-         }
+     bool HasGyro() const {
+@@ -60,6 +62,7 @@ class SDLJoystick { (public)
+         return has_accel;
      }
  
 +#if SDL_VERSION_ATLEAST(2,0,14)
-     void SetMotion(SDL_ControllerSensorEvent event) {
+     bool UpdateMotion(SDL_ControllerSensorEvent event) {
          constexpr float gravity_constant = 9.80665f;
          std::lock_guard lock{mutex};
-@@ -115,6 +118,7 @@ class SDLJoystick { (public)
-         motion.UpdateRotation(time_difference * 1000);
-         motion.UpdateOrientation(time_difference * 1000);
+@@ -87,6 +90,7 @@ class SDLJoystick { (public)
+         motion.delta_timestamp = time_difference * 1000;
+         return true;
      }
 +#endif
  
-     bool GetButton(int button) const {
-         std::lock_guard lock{mutex};
-@@ -429,12 +433,14 @@ void SDLState::HandleGameControllerEvent(const SDL_Eve
+     BasicMotion GetMotion() {
+         return motion;
+@@ -362,6 +366,7 @@ void SDLDriver::HandleGameControllerEvent(const SDL_Ev
          }
          break;
      }
 +#if SDL_VERSION_ATLEAST(2,0,14)
      case SDL_CONTROLLERSENSORUPDATE: {
          if (auto joystick = GetSDLJoystickBySDLID(event.csensor.which)) {
-             joystick->SetMotion(event.csensor);
+             if (joystick->UpdateMotion(event.csensor)) {
+@@ -371,6 +376,7 @@ void SDLDriver::HandleGameControllerEvent(const SDL_Ev
          }
          break;
      }
@@ -68,50 +69,25 @@ CMake Error at CMakeLists.txt:397 (find_package):
      case SDL_JOYDEVICEREMOVED:
          LOG_DEBUG(Input, "Controller removed with Instance_ID {}", event.jdevice.which);
          CloseJoystick(SDL_JoystickFromInstanceID(event.jdevice.which));
-@@ -890,20 +896,26 @@ SDLState::SDLState() {
-     RegisterFactory<MotionDevice>("sdl", motion_factory);
+@@ -392,7 +398,7 @@ SDLDriver::SDLDriver(const std::string& input_engine_)
  
      if (!Settings::values.enable_raw_input) {
-+#if SDL_VERSION_ATLEAST(2,0,14)
          // Disable raw input. When enabled this setting causes SDL to die when a web applet opens
-         SDL_SetHint(SDL_HINT_JOYSTICK_RAWINPUT, "0");
-+#endif
+-        SDL_SetHint(SDL_HINT_JOYSTICK_RAWINPUT, "0");
++        SDL_SetHint("SDL_JOYSTICK_RAWINPUT", "0");
      }
  
+     // Prevent SDL from adding undesired axis
+@@ -400,7 +406,7 @@ SDLDriver::SDLDriver(const std::string& input_engine_)
+ 
      // Enable HIDAPI rumble. This prevents SDL from disabling motion on PS4 and PS5 controllers
      SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, "1");
-+#if SDL_VERSION_ATLEAST(2,0,16)
-     SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "1");
-+#endif
+-    SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "1");
++    SDL_SetHint("SDL_JOYSTICK_HIDAPI_PS5_RUMBLE", "1");
+     SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
  
-+#if SDL_VERSION_ATLEAST(2,0,16)
-     // Tell SDL2 to use the hidapi driver. This will allow joycons to be detected as a
-     // GameController and not a generic one
-     SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "1");
- 
-     // Turn off Pro controller home led
-     SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED, "0");
-+#endif
- 
-     // If the frontend is going to manage the event loop, then we don't start one here
-     start_thread = SDL_WasInit(SDL_INIT_JOYSTICK) == 0;
-@@ -1110,6 +1122,7 @@ Common::ParamPackage SDLEventToMotionParamPackage(SDLS
-         }
-         break;
-     }
-+#if SDL_VERSION_ATLEAST(2,0,14)
-     case SDL_CONTROLLERSENSORUPDATE: {
-         bool is_motion_shaking = false;
-         constexpr float gyro_threshold = 5.0f;
-@@ -1139,6 +1152,7 @@ Common::ParamPackage SDLEventToMotionParamPackage(SDLS
-         }
-         break;
-     }
-+#endif
-     }
-     return {};
- }
-@@ -1244,6 +1258,7 @@ ButtonBindings SDLState::GetNintendoButtonBinding(
+     // Use hidapi driver for joycons. This will allow joycons to be detected as a GameController and
+@@ -670,6 +676,7 @@ ButtonBindings SDLDriver::GetNintendoButtonBinding(
      auto sl_button = SDL_CONTROLLER_BUTTON_LEFTSHOULDER;
      auto sr_button = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER;
  
@@ -119,7 +95,7 @@ CMake Error at CMakeLists.txt:397 (find_package):
      if (joystick->IsJoyconLeft()) {
          sl_button = SDL_CONTROLLER_BUTTON_PADDLE2;
          sr_button = SDL_CONTROLLER_BUTTON_PADDLE4;
-@@ -1252,6 +1267,7 @@ ButtonBindings SDLState::GetNintendoButtonBinding(
+@@ -678,6 +685,7 @@ ButtonBindings SDLDriver::GetNintendoButtonBinding(
          sl_button = SDL_CONTROLLER_BUTTON_PADDLE3;
          sr_button = SDL_CONTROLLER_BUTTON_PADDLE1;
      }
@@ -127,13 +103,3 @@ CMake Error at CMakeLists.txt:397 (find_package):
  
      return {
          std::pair{Settings::NativeButton::A, SDL_CONTROLLER_BUTTON_A},
-@@ -1552,7 +1568,9 @@ class SDLMotionPoller final : public SDLPoller { (publ
-             [[fallthrough]];
-         case SDL_JOYBUTTONUP:
-         case SDL_JOYHATMOTION:
-+#if SDL_VERSION_ATLEAST(2,0,14)
-         case SDL_CONTROLLERSENSORUPDATE:
-+#endif
-             return {SDLEventToMotionParamPackage(state, event)};
-         }
-         return std::nullopt;