Compare commits

...

10 Commits

Author SHA1 Message Date
Schuay
7f0e82fe48 fix/sdl3-gamepad-bugs (#19)
Four SDL3 gamepad fixes, all affecting real users with Switch controllers.

**Crash on reconnect / broken motion** — `GetFeaturesFlag()` was calling `SDL_DestroyProperties()` on properties owned by SDL internally, causing a use-after-free. This breaks gyro after the first read and crashes on reconnect. Fix: just don't destroy them.

**Thread safety in `GetGamepads()`** — was locking the wrong objects and holding locks across `yield` boundaries, which is undefined behavior with `System.Threading.Lock`. Fix: snapshot IDs under `_lock`, iterate outside it.

**Rumble NPE on disconnect** — `UpdateRumble()` called `_gamepad.Rumble()` without a null check; throws if the controller disconnects mid-update. Fix: `_gamepad?.Rumble(...)`.

**Linux: HIDAPI conflicts with `hid_nintendo`** — when the `hid_nintendo` kernel module is loaded, it provides evdev nodes for both the gamepad and IMU that SDL3's evdev backend correctly combines. HIDAPI conflicts with it, breaking gyro and wireless hotplug. Fix: detect `/sys/module/hid_nintendo` at startup and disable HIDAPI for Switch controllers automatically. Overridable via `SDL_JOYSTICK_HIDAPI_SWITCH=1`.

Tested with an 8BitDo Ultimate Bluetooth Controller on Linux.

Co-authored-by: schuay <36006+schuay@users.noreply.github.com>
Reviewed-on: https://git.ryujinx.app/projects/Ryubing/pulls/19
2026-04-18 13:54:25 +00:00
Max
69c22a744e [HID] Updated SDL3 package from 2025.920.0 -> 2026.320.0 (#9)
Should provide support for Nintendo Switch 2 controllers, new Steam hardware (controller, frame), and potentially [Switch as a gamepad via hekate](https://github.com/CTCaer/hekate/blob/master/bdk/usb/usb_gadget_hid.c).

Reviewed-on: https://git.ryujinx.app/projects/Ryubing/pulls/9
2026-04-17 23:56:15 +00:00
Xam
35b1531102 HLE: CaptureManager: SaveScreenShot: properly handle screenshot image data (#18)
no way this was working before, and if it did, just pure luck, unsafe blind copy of bytes as is and zero checks.

i only tested tomodachi, but should fix all games that were crashing on saving screenshots

the crash was happening because the screenshot buffer was bigger than the bitmap buffer, so marshall.copy() was raising an unhandhled expection crashing the emu.

on top of this, because the data was just copied as is, the result image was garbled.

[fixes #304](https://github.com/Ryubing/Issues/issues/304)

Reviewed-on: https://git.ryujinx.app/projects/Ryubing/pulls/18
2026-04-17 23:08:33 +00:00
ryuadmin
ea1185e96a damnit 2026-04-17 22:00:49 +00:00
ryuadmin
31e0430b06 Rework labeler.yml for different label names and differing project structure 2026-04-17 21:59:57 +00:00
WilliamWsyHK
efb8658194 Update zh-tw Translations (#17)
Co-authored-by: WilliamWsyHK <WilliamWsyHK@users.noreply.github.com>
Reviewed-on: https://git.ryujinx.app/projects/Ryubing/pulls/17
2026-04-17 21:44:26 +00:00
ryuadmin
e909ea3210 bump labeler action to v6 2026-04-16 06:24:51 +00:00
sh0inx
2a688abeec Merge pull request 'i18n : New Translation for French (fr_FR )and Spanish (es_ES)' (#14) from Babib3l/Ryubing:ryujinx-Fr-Es-Translations into master
Reviewed-on: https://git.ryujinx.app/projects/Ryubing/pulls/14
2026-04-15 20:28:26 +00:00
Babib3l
9f88d68268 fix: drop stale GitLab locale rebase leftovers 2026-04-14 00:27:54 +02:00
Babib3l
fe685c3f8f Rebase locale updates for GitLab and FR/ES translations 2026-04-14 00:27:46 +02:00
10 changed files with 49 additions and 42 deletions

View File

@@ -10,6 +10,10 @@ gpu:
- changed-files:
- any-glob-to-any-file: ['src/Ryujinx.Graphics.*/**', 'src/Spv.Generator/**', 'src/Ryujinx.ShaderTools/**']
input:
- changed-files:
- any-glob-to-any-file: ['src/Ryujinx.Input*/**', 'src/Ryujinx/UI/Views/Input/**']
'graphics-backend:opengl':
- changed-files:
- any-glob-to-any-file: 'src/Ryujinx.Graphics.OpenGL/**'
@@ -18,17 +22,17 @@ gpu:
- changed-files:
- any-glob-to-any-file: ['src/Ryujinx.Graphics.Vulkan/**', 'src/Spv.Generator/**']
'graphics-backend:metal':
- changed-files:
- any-glob-to-any-file: ['src/Ryujinx.Graphics.Metal/**', 'src/Ryujinx.Graphics.Metal.SharpMetalExtensions/**']
gui:
- changed-files:
- any-glob-to-any-file: ['src/Ryujinx/**', 'src/Ryujinx.UI.Common/**', 'src/Ryujinx.UI.LocaleGenerator/**']
- any-glob-to-any-file: ['src/Ryujinx/**', 'src/Ryujinx.UI.LocaleGenerator/**']
horizon:
'horizon/hle':
- changed-files:
- any-glob-to-any-file: ['src/Ryujinx.HLE/**', 'src/Ryujinx.Horizon/**']
- any-glob-to-any-file: ['src/Ryujinx.HLE/**', 'src/Ryujinx.HLE.Generators/**', 'src/Ryujinx.Horizon/**']
i18n:
- changed-files:
- any-glob-to-any-file: ['assets/**/*.json', 'src/Ryujinx.UI.LocaleGenerator/**']
kernel:
- changed-files:
@@ -44,4 +48,4 @@ documentation:
ldn:
- changed-files:
- any-glob-to-any-file: 'src/Ryujinx.HLE/HOS/Services/Ldn/**'
- any-glob-to-any-file: ['src/Ryujinx.HLE/HOS/Services/Ldn/**', 'src/Ryujinx/UI/Windows/LdnGamesListWindow.*', 'src/Ryujinx/UI/ViewModels/LdnGamesListViewModel.cs']

View File

@@ -18,7 +18,7 @@ jobs:
ref: master
- name: Update labels based on changes
uses: actions/labeler@v5
uses: actions/labeler@v6
with:
repo-token: ${{ secrets.LABELER_TOKEN }}
configuration-path: .forgejo/labeler.yml

View File

@@ -16,7 +16,7 @@
<PackageVersion Include="Projektanker.Icons.Avalonia" Version="9.6.2" />
<PackageVersion Include="Projektanker.Icons.Avalonia.FontAwesome" Version="9.6.2" />
<PackageVersion Include="Projektanker.Icons.Avalonia.MaterialDesign" Version="9.6.2" />
<PackageVersion Include="ppy.SDL3-CS" Version="2025.920.0" />
<PackageVersion Include="ppy.SDL3-CS" Version="2026.320.0" />
<PackageVersion Include="CommandLineParser" Version="2.9.1" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageVersion Include="Concentus" Version="2.2.2" />

View File

@@ -22,7 +22,7 @@
"tr_TR": "",
"uk_UA": "",
"zh_CN": "启动 RenderDoc 帧捕获",
"zh_TW": ""
"zh_TW": "啟動 RenderDoc 畫格擷取"
}
},
{
@@ -47,7 +47,7 @@
"tr_TR": "",
"uk_UA": "",
"zh_CN": "结束 RenderDoc 帧捕获",
"zh_TW": ""
"zh_TW": "停止 RenderDoc 畫格擷取"
}
},
{
@@ -72,7 +72,7 @@
"tr_TR": "",
"uk_UA": "",
"zh_CN": "丢弃 RenderDoc 帧捕获",
"zh_TW": ""
"zh_TW": "捨棄 RenderDoc 畫格擷取"
}
},
{
@@ -97,7 +97,7 @@
"tr_TR": "",
"uk_UA": "",
"zh_CN": "结束当前正在进行的 RenderDoc 帧捕获,并立即丢弃其结果。",
"zh_TW": ""
"zh_TW": "停止正在執行的 RenderDoc 畫格擷取,且立即捨棄其結果。"
}
}
]

View File

@@ -582,8 +582,8 @@
"de_DE": "",
"el_GR": "",
"en_US": "Restart Emulation",
"es_ES": "",
"fr_FR": "",
"es_ES": "Reiniciar Emulación",
"fr_FR": "Redémarrer l'Émulation",
"he_IL": "",
"it_IT": "",
"ja_JP": "",
@@ -597,7 +597,7 @@
"tr_TR": "",
"uk_UA": "",
"zh_CN": "",
"zh_TW": ""
"zh_TW": "重新啟動模擬"
}
},
{
@@ -11332,8 +11332,8 @@
"de_DE": "Speichern",
"el_GR": "",
"en_US": "Save",
"es_ES": "",
"fr_FR": "",
"es_ES": "Guardar",
"fr_FR": "Sauvegarder",
"he_IL": "",
"it_IT": "",
"ja_JP": "",
@@ -11347,7 +11347,7 @@
"tr_TR": "",
"uk_UA": "",
"zh_CN": "",
"zh_TW": ""
"zh_TW": "儲存"
}
},
{

View File

@@ -118,8 +118,11 @@ namespace Ryujinx.HLE.HOS.Services.Caps
}
// NOTE: The saved JPEG file doesn't have the limitation in the extra EXIF data.
using SKBitmap bitmap = new(new SKImageInfo(1280, 720, SKColorType.Rgba8888));
Marshal.Copy(screenshotData, 0, bitmap.GetPixels(), screenshotData.Length);
using SKBitmap bitmap = new(new SKImageInfo(1280, 720, SKColorType.Rgba8888, SKAlphaType.Premul));
int dataLen = screenshotData.Length > bitmap.ByteCount ? bitmap.ByteCount : screenshotData.Length;
Marshal.Copy(screenshotData, 0, bitmap.GetPixels(), dataLen);
using SKData data = bitmap.Encode(SKEncodedImageFormat.Jpeg, 80);
using FileStream file = File.OpenWrite(filePath);
data.SaveTo(file);

View File

@@ -151,7 +151,9 @@ namespace Ryujinx.Input.SDL3
result |= GamepadFeaturesFlag.Led;
}
SDL_UnlockProperties(propID);
SDL_DestroyProperties(propID);
// NOTE: Do not call SDL_DestroyProperties here. These properties are owned
// internally by SDL and are freed when SDL_CloseGamepad is called (in Dispose).
return result;
}

View File

@@ -331,28 +331,18 @@ namespace Ryujinx.Input.SDL3
public IEnumerable<IGamepad> GetGamepads()
{
lock (_gamepadsIds)
string[] ids;
lock (_lock)
{
foreach (var gamepad in _gamepadsIds)
{
yield return GetGamepad(gamepad.Value);
}
ids = _gamepadsIds.Values
.Concat(_joyConsIds.Values)
.Concat(_linkedJoyConsIds.Values)
.ToArray();
}
lock (_joyConsIds)
foreach (string id in ids)
{
foreach (var gamepad in _joyConsIds)
{
yield return GetGamepad(gamepad.Value);
}
}
lock (_linkedJoyConsIds)
{
foreach (var gamepad in _linkedJoyConsIds)
{
yield return GetGamepad(gamepad.Value);
}
yield return GetGamepad(id);
}
}
}

View File

@@ -563,7 +563,7 @@ namespace Ryujinx.Input.HLE
float low = Math.Min(1f, (float)((rightVibrationValue.AmplitudeLow * 0.85 + rightVibrationValue.AmplitudeHigh * 0.15) * controllerConfig.Rumble.StrongRumble));
float high = Math.Min(1f, (float)((leftVibrationValue.AmplitudeLow * 0.15 + leftVibrationValue.AmplitudeHigh * 0.85) * controllerConfig.Rumble.WeakRumble));
_gamepad.Rumble(low, high, uint.MaxValue);
_gamepad?.Rumble(low, high, uint.MaxValue);
Logger.Debug?.Print(LogClass.Hid, $"Effect for {controllerConfig.PlayerIndex} " +
$"L.low.amp={leftVibrationValue.AmplitudeLow}, " +

View File

@@ -61,6 +61,14 @@ namespace Ryujinx.SDL3.Common
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "1");
SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1");
// When hid_nintendo is loaded, it creates separate evdev devices for the gamepad
// and IMU which SDL3's evdev backend combines via UNIQ matching. Using HIDAPI
// instead conflicts with the kernel driver and breaks motion and hotplug.
if (OperatingSystem.IsLinux() && Directory.Exists("/sys/module/hid_nintendo"))
{
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_SWITCH, "0");
}
// NOTE: As of SDL3 2.24.0, joycons are combined by default but the motion source only come from one of them.
// We disable this behavior for now.
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS, "0");