Date: Thu, 20 May 2021 14:22:29 GMT From: Jan Beich <jbeich@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: bd9872793c6e - main - emulators/yuzu: unbreak with sdl < 2.0.14 after c61770cb8015 Message-ID: <202105201422.14KEMT2N056920@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by jbeich: URL: https://cgit.FreeBSD.org/ports/commit/?id=bd9872793c6e27cff9aef8891905ff8200f79986 commit bd9872793c6e27cff9aef8891905ff8200f79986 Author: Jan Beich <jbeich@FreeBSD.org> AuthorDate: 2021-05-20 13:54:35 +0000 Commit: Jan Beich <jbeich@FreeBSD.org> CommitDate: 2021-05-20 14:21:38 +0000 emulators/yuzu: unbreak with sdl < 2.0.14 after c61770cb8015 src/input_common/sdl/sdl_impl.cpp:95:20: error: 'SDL_ControllerSensorEvent' has not been declared 95 | void SetMotion(SDL_ControllerSensorEvent event) { | ^~~~~~~~~~~~~~~~~~~~~~~~~ src/input_common/sdl/sdl_impl.cpp: In member function 'void InputCommon::SDL::SDLJoystick::EnableMotion()': src/input_common/sdl/sdl_impl.cpp:79:17: error: 'SDL_GameControllerHasSensor' was not declared in this scope; did you mean 'SDL_GameControllerGetVendor'? 79 | if (SDL_GameControllerHasSensor(controller, SDL_SENSOR_ACCEL) && !has_accel) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ | SDL_GameControllerGetVendor src/input_common/sdl/sdl_impl.cpp:80:17: error: 'SDL_GameControllerSetSensorEnabled' was not declared in this scope; did you mean 'SDL_GameControllerGetVendor'? 80 | SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_ACCEL, SDL_TRUE); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | SDL_GameControllerGetVendor src/input_common/sdl/sdl_impl.cpp:83:17: error: 'SDL_GameControllerHasSensor' was not declared in this scope; did you mean 'SDL_GameControllerGetVendor'? 83 | if (SDL_GameControllerHasSensor(controller, SDL_SENSOR_GYRO) && !has_gyro) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ | SDL_GameControllerGetVendor src/input_common/sdl/sdl_impl.cpp:84:17: error: 'SDL_GameControllerSetSensorEnabled' was not declared in this scope; did you mean 'SDL_GameControllerGetVendor'? 84 | SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_GYRO, SDL_TRUE); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | SDL_GameControllerGetVendor src/input_common/sdl/sdl_impl.cpp: In member function 'void InputCommon::SDL::SDLJoystick::SetMotion(int)': src/input_common/sdl/sdl_impl.cpp:98:37: error: request for member 'timestamp' in 'event', which is of non-class type 'int' 98 | u64 time_difference = event.timestamp - last_motion_update; | ^~~~~~~~~ src/input_common/sdl/sdl_impl.cpp:99:36: error: request for member 'timestamp' in 'event', which is of non-class type 'int' 99 | last_motion_update = event.timestamp; | ^~~~~~~~~ src/input_common/sdl/sdl_impl.cpp:100:23: error: request for member 'sensor' in 'event', which is of non-class type 'int' 100 | switch (event.sensor) { | ^~~~~~ src/input_common/sdl/sdl_impl.cpp:102:56: error: request for member 'data' in 'event', which is of non-class type 'int' 102 | const Common::Vec3f acceleration = {-event.data[0], event.data[2], -event.data[1]}; | ^~~~ src/input_common/sdl/sdl_impl.cpp:102:71: error: request for member 'data' in 'event', which is of non-class type 'int' 102 | const Common::Vec3f acceleration = {-event.data[0], event.data[2], -event.data[1]}; | ^~~~ src/input_common/sdl/sdl_impl.cpp:102:87: error: request for member 'data' in 'event', which is of non-class type 'int' 102 | const Common::Vec3f acceleration = {-event.data[0], event.data[2], -event.data[1]}; | ^~~~ src/input_common/sdl/sdl_impl.cpp:102:94: error: could not convert '{<expression error>, <expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'const Vec3f' {aka 'const Common::Vec3<float>'} 102 | const Common::Vec3f acceleration = {-event.data[0], event.data[2], -event.data[1]}; | ^ | | | <brace-enclosed initializer list> src/input_common/sdl/sdl_impl.cpp:107:52: error: request for member 'data' in 'event', which is of non-class type 'int' 107 | const Common::Vec3f gyroscope = {event.data[0], -event.data[2], event.data[1]}; | ^~~~ src/input_common/sdl/sdl_impl.cpp:107:68: error: request for member 'data' in 'event', which is of non-class type 'int' 107 | const Common::Vec3f gyroscope = {event.data[0], -event.data[2], event.data[1]}; | ^~~~ src/input_common/sdl/sdl_impl.cpp:107:83: error: request for member 'data' in 'event', which is of non-class type 'int' 107 | const Common::Vec3f gyroscope = {event.data[0], -event.data[2], event.data[1]}; | ^~~~ src/input_common/sdl/sdl_impl.cpp:107:90: error: could not convert '{<expression error>, <expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'const Vec3f' {aka 'const Common::Vec3<float>'} 107 | const Common::Vec3f gyroscope = {event.data[0], -event.data[2], event.data[1]}; | ^ | | | <brace-enclosed initializer list> src/input_common/sdl/sdl_impl.cpp: In member function 'void InputCommon::SDL::SDLState::HandleGameControllerEvent(const SDL_Event&)': src/input_common/sdl/sdl_impl.cpp:355:10: error: 'SDL_CONTROLLERSENSORUPDATE' was not declared in this scope; did you mean 'SDL_CONTROLLERBUTTONUP'? 355 | case SDL_CONTROLLERSENSORUPDATE: { | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | SDL_CONTROLLERBUTTONUP src/input_common/sdl/sdl_impl.cpp:356:57: error: 'const SDL_Event' {aka 'const union SDL_Event'} has no member named 'csensor'; did you mean 'sensor'? 356 | if (auto joystick = GetSDLJoystickBySDLID(event.csensor.which)) { | ^~~~~~~ | sensor src/input_common/sdl/sdl_impl.cpp:357:39: error: 'const SDL_Event' {aka 'const union SDL_Event'} has no member named 'csensor'; did you mean 'sensor'? 357 | joystick->SetMotion(event.csensor); | ^~~~~~~ | sensor src/input_common/sdl/sdl_impl.cpp: In function 'Common::ParamPackage InputCommon::SDL::{anonymous}::SDLEventToMotionParamPackage(InputCommon::SDL::SDLState&, const SDL_Event&)': src/input_common/sdl/sdl_impl.cpp:1008:10: error: 'SDL_CONTROLLERSENSORUPDATE' was not declared in this scope; did you mean 'SDL_CONTROLLERBUTTONUP'? 1008 | case SDL_CONTROLLERSENSORUPDATE: { | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | SDL_CONTROLLERBUTTONUP src/input_common/sdl/sdl_impl.cpp:1012:19: error: 'const SDL_Event' {aka 'const union SDL_Event'} has no member named 'csensor'; did you mean 'sensor'? 1012 | if (event.csensor.sensor == SDL_SENSOR_ACCEL) { | ^~~~~~~ | sensor src/input_common/sdl/sdl_impl.cpp:1013:56: error: 'const SDL_Event' {aka 'const union SDL_Event'} has no member named 'csensor'; did you mean 'sensor'? 1013 | const Common::Vec3f acceleration = {-event.csensor.data[0], event.csensor.data[2], | ^~~~~~~ | sensor src/input_common/sdl/sdl_impl.cpp:1013:79: error: 'const SDL_Event' {aka 'const union SDL_Event'} has no member named 'csensor'; did you mean 'sensor'? 1013 | const Common::Vec3f acceleration = {-event.csensor.data[0], event.csensor.data[2], | ^~~~~~~ | sensor src/input_common/sdl/sdl_impl.cpp:1014:56: error: 'const SDL_Event' {aka 'const union SDL_Event'} has no member named 'csensor'; did you mean 'sensor'? 1014 | -event.csensor.data[1]}; | ^~~~~~~ | sensor src/input_common/sdl/sdl_impl.cpp:1014:71: error: could not convert '{<expression error>, <expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'const Vec3f' {aka 'const Common::Vec3<float>'} 1014 | -event.csensor.data[1]}; | ^ | | | <brace-enclosed initializer list> src/input_common/sdl/sdl_impl.cpp:1020:19: error: 'const SDL_Event' {aka 'const union SDL_Event'} has no member named 'csensor'; did you mean 'sensor'? 1020 | if (event.csensor.sensor == SDL_SENSOR_GYRO) { | ^~~~~~~ | sensor src/input_common/sdl/sdl_impl.cpp:1021:52: error: 'const SDL_Event' {aka 'const union SDL_Event'} has no member named 'csensor'; did you mean 'sensor'? 1021 | const Common::Vec3f gyroscope = {event.csensor.data[0], -event.csensor.data[2], | ^~~~~~~ | sensor src/input_common/sdl/sdl_impl.cpp:1021:76: error: 'const SDL_Event' {aka 'const union SDL_Event'} has no member named 'csensor'; did you mean 'sensor'? 1021 | const Common::Vec3f gyroscope = {event.csensor.data[0], -event.csensor.data[2], | ^~~~~~~ | sensor src/input_common/sdl/sdl_impl.cpp:1022:52: error: 'const SDL_Event' {aka 'const union SDL_Event'} has no member named 'csensor'; did you mean 'sensor'? 1022 | event.csensor.data[1]}; | ^~~~~~~ | sensor src/input_common/sdl/sdl_impl.cpp:1022:67: error: could not convert '{<expression error>, <expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'const Vec3f' {aka 'const Common::Vec3<float>'} 1022 | event.csensor.data[1]}; | ^ | | | <brace-enclosed initializer list> src/input_common/sdl/sdl_impl.cpp:1032:69: error: 'const SDL_Event' {aka 'const union SDL_Event'} has no member named 'csensor'; did you mean 'sensor'? 1032 | if (const auto joystick = state.GetSDLJoystickBySDLID(event.csensor.which)) { | ^~~~~~~ | sensor src/input_common/sdl/sdl_impl.cpp: In member function 'std::optional<Common::ParamPackage> InputCommon::SDL::Polling::SDLMotionPoller::FromEvent(const SDL_Event&) const': src/input_common/sdl/sdl_impl.cpp:1300:14: error: 'SDL_CONTROLLERSENSORUPDATE' was not declared in this scope; did you mean 'SDL_CONTROLLERBUTTONUP'? 1300 | case SDL_CONTROLLERSENSORUPDATE: | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | SDL_CONTROLLERBUTTONUP Reported by: pkg-fallout --- emulators/yuzu/files/patch-sdl2 | 77 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 2 deletions(-) diff --git a/emulators/yuzu/files/patch-sdl2 b/emulators/yuzu/files/patch-sdl2 index a540dc413999..6eda6f9d8d2e 100644 --- a/emulators/yuzu/files/patch-sdl2 +++ b/emulators/yuzu/files/patch-sdl2 @@ -22,13 +22,86 @@ CMake Error at externals/CMakeLists.txt:54 (add_subdirectory): if (SDL2_FOUND) --- src/input_common/sdl/sdl_impl.cpp.orig 2021-05-19 22:47:48 UTC +++ src/input_common/sdl/sdl_impl.cpp -@@ -797,7 +797,9 @@ SDLState::SDLState() { +@@ -74,6 +74,7 @@ class SDLJoystick { (public) + } + + void EnableMotion() { ++#if SDL_VERSION_ATLEAST(2,0,14) + if (sdl_controller) { + SDL_GameController* controller = sdl_controller.get(); + if (SDL_GameControllerHasSensor(controller, SDL_SENSOR_ACCEL) && !has_accel) { +@@ -85,6 +86,7 @@ class SDLJoystick { (public) + has_gyro = true; + } + } ++#endif + } + + void SetButton(int button, bool value) { +@@ -92,6 +94,7 @@ class SDLJoystick { (public) + state.buttons.insert_or_assign(button, value); + } + ++#if SDL_VERSION_ATLEAST(2,0,14) + void SetMotion(SDL_ControllerSensorEvent event) { + constexpr float gravity_constant = 9.80665f; + std::lock_guard lock{mutex}; +@@ -119,6 +122,7 @@ class SDLJoystick { (public) + motion.UpdateRotation(time_difference * 1000); + motion.UpdateOrientation(time_difference * 1000); + } ++#endif + + bool GetButton(int button) const { + std::lock_guard lock{mutex}; +@@ -352,12 +356,14 @@ void SDLState::HandleGameControllerEvent(const SDL_Eve + } + break; + } ++#if SDL_VERSION_ATLEAST(2,0,14) + case SDL_CONTROLLERSENSORUPDATE: { + if (auto joystick = GetSDLJoystickBySDLID(event.csensor.which)) { + joystick->SetMotion(event.csensor); + } + break; + } ++#endif + case SDL_JOYDEVICEREMOVED: + LOG_DEBUG(Input, "Controller removed with Instance_ID {}", event.jdevice.which); + CloseJoystick(SDL_JoystickFromInstanceID(event.jdevice.which)); +@@ -797,7 +803,9 @@ SDLState::SDLState() { // Enable HIDAPI rumble. This prevents SDL from disabling motion on PS4 and PS5 controllers SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, "1"); -+#ifdef SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE ++#if SDL_VERSION_ATLEAST(2,0,15) SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "1"); +#endif // Tell SDL2 to use the hidapi driver. This will allow joycons to be detected as a // GameController and not a generic one +@@ -1003,6 +1011,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; +@@ -1032,6 +1041,7 @@ Common::ParamPackage SDLEventToMotionParamPackage(SDLS + } + break; + } ++#endif + } + return {}; + } +@@ -1295,7 +1305,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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105201422.14KEMT2N056920>