Compare commits
39 Commits
Canary-1.2
...
65ecc0822e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65ecc0822e | ||
|
|
05b4bd8c61 | ||
|
|
20111a651c | ||
|
|
659e580f4d | ||
|
|
e6339ac950 | ||
|
|
9d59c7265c | ||
|
|
b33fe6facc | ||
|
|
ceaaf4137c | ||
|
|
3f2e189407 | ||
|
|
30e790ced4 | ||
|
|
5e8af26516 | ||
|
|
9356b68f26 | ||
|
|
14aafebaa6 | ||
|
|
4518666a04 | ||
|
|
4399edaa9f | ||
|
|
4e77bcb55a | ||
|
|
3cbd7dc1a1 | ||
|
|
536f792558 | ||
|
|
7a451ab160 | ||
|
|
99c7c3fb14 | ||
|
|
09e7b660f4 | ||
|
|
69dfd8c60e | ||
|
|
8e50dd9fa6 | ||
|
|
68c03051ad | ||
|
|
a837294b11 | ||
|
|
f1c0cc8076 | ||
|
|
6dec7ff8ba | ||
|
|
20fdbff964 | ||
|
|
e426680cb0 | ||
|
|
7863e97cb0 | ||
|
|
c4dea0ee28 | ||
|
|
e0b6a01e9d | ||
|
|
e509ffa716 | ||
|
|
714c68b548 | ||
|
|
fec197d9ec | ||
|
|
a4b2feef79 | ||
|
|
ad7d9d1ce0 | ||
|
|
86f9544910 | ||
|
|
e9ecbd44fc |
@@ -1,7 +1,7 @@
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td align="center" width="25%">
|
||||
<img src="https://raw.githubusercontent.com/Ryubing/ryuassets/refs/heads/main/RyujinxApp_1024.png" alt="Ryujinx" >
|
||||
<img src="https://raw.githubusercontent.com/Ryubing/Assets/refs/heads/main/RyujinxApp_1024.png" alt="Ryujinx" >
|
||||
</td>
|
||||
<td align="center" width="75%">
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.SDL2.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -36,6 +37,7 @@ namespace Ryujinx.Input.SDL2
|
||||
SDL2Driver.Instance.Initialize();
|
||||
SDL2Driver.Instance.OnJoyStickConnected += HandleJoyStickConnected;
|
||||
SDL2Driver.Instance.OnJoystickDisconnected += HandleJoyStickDisconnected;
|
||||
SDL2Driver.Instance.OnJoyBatteryUpdated += HandleJoyBatteryUpdated;
|
||||
|
||||
// Add already connected gamepads
|
||||
int numJoysticks = SDL_NumJoysticks();
|
||||
@@ -83,19 +85,30 @@ namespace Ryujinx.Input.SDL2
|
||||
|
||||
private void HandleJoyStickDisconnected(int joystickInstanceId)
|
||||
{
|
||||
bool joyConPairDisconnected = false;
|
||||
if (!_gamepadsInstanceIdsMapping.Remove(joystickInstanceId, out string id))
|
||||
return;
|
||||
|
||||
lock (_lock)
|
||||
{
|
||||
_gamepadsIds.Remove(id);
|
||||
if (!SDL2JoyConPair.IsCombinable(_gamepadsIds))
|
||||
{
|
||||
_gamepadsIds.Remove(SDL2JoyConPair.Id);
|
||||
joyConPairDisconnected = true;
|
||||
}
|
||||
}
|
||||
|
||||
OnGamepadDisconnected?.Invoke(id);
|
||||
if (joyConPairDisconnected)
|
||||
{
|
||||
OnGamepadDisconnected?.Invoke(SDL2JoyConPair.Id);
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleJoyStickConnected(int joystickDeviceId, int joystickInstanceId)
|
||||
{
|
||||
bool joyConPairConnected = false;
|
||||
if (SDL_IsGameController(joystickDeviceId) == SDL_bool.SDL_TRUE)
|
||||
{
|
||||
if (_gamepadsInstanceIdsMapping.ContainsKey(joystickInstanceId))
|
||||
@@ -120,13 +133,29 @@ namespace Ryujinx.Input.SDL2
|
||||
_gamepadsIds.Insert(joystickDeviceId, id);
|
||||
else
|
||||
_gamepadsIds.Add(id);
|
||||
if (SDL2JoyConPair.IsCombinable(_gamepadsIds))
|
||||
{
|
||||
_gamepadsIds.Remove(SDL2JoyConPair.Id);
|
||||
_gamepadsIds.Add(SDL2JoyConPair.Id);
|
||||
joyConPairConnected = true;
|
||||
}
|
||||
}
|
||||
|
||||
OnGamepadConnected?.Invoke(id);
|
||||
if (joyConPairConnected)
|
||||
{
|
||||
OnGamepadConnected?.Invoke(SDL2JoyConPair.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleJoyBatteryUpdated(int joystickDeviceId, SDL_JoystickPowerLevel powerLevel)
|
||||
{
|
||||
Logger.Info?.Print(LogClass.Hid,
|
||||
$"{SDL_GameControllerNameForIndex(joystickDeviceId)} power level: {powerLevel}");
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
@@ -157,6 +186,14 @@ namespace Ryujinx.Input.SDL2
|
||||
|
||||
public IGamepad GetGamepad(string id)
|
||||
{
|
||||
if (id == SDL2JoyConPair.Id)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
return SDL2JoyConPair.GetGamepad(_gamepadsIds);
|
||||
}
|
||||
}
|
||||
|
||||
int joystickIndex = GetJoystickIndexByGamepadId(id);
|
||||
|
||||
if (joystickIndex == -1)
|
||||
@@ -165,12 +202,16 @@ namespace Ryujinx.Input.SDL2
|
||||
}
|
||||
|
||||
nint gamepadHandle = SDL_GameControllerOpen(joystickIndex);
|
||||
|
||||
if (gamepadHandle == nint.Zero)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (SDL_GameControllerName(gamepadHandle).StartsWith(SDL2JoyCon.Prefix))
|
||||
{
|
||||
return new SDL2JoyCon(gamepadHandle, id);
|
||||
}
|
||||
|
||||
return new SDL2Gamepad(gamepadHandle, id);
|
||||
}
|
||||
|
||||
|
||||
413
src/Ryujinx.Input.SDL2/SDL2JoyCon.cs
Normal file
413
src/Ryujinx.Input.SDL2/SDL2JoyCon.cs
Normal file
@@ -0,0 +1,413 @@
|
||||
using Ryujinx.Common.Configuration.Hid;
|
||||
using Ryujinx.Common.Configuration.Hid.Controller;
|
||||
using Ryujinx.Common.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Threading;
|
||||
using static SDL2.SDL;
|
||||
|
||||
namespace Ryujinx.Input.SDL2
|
||||
{
|
||||
internal class SDL2JoyCon : IGamepad
|
||||
{
|
||||
private bool HasConfiguration => _configuration != null;
|
||||
|
||||
private readonly record struct ButtonMappingEntry(GamepadButtonInputId To, GamepadButtonInputId From)
|
||||
{
|
||||
public bool IsValid => To is not GamepadButtonInputId.Unbound && From is not GamepadButtonInputId.Unbound;
|
||||
}
|
||||
|
||||
private StandardControllerInputConfig _configuration;
|
||||
|
||||
private readonly Dictionary<GamepadButtonInputId,SDL_GameControllerButton> _leftButtonsDriverMapping = new()
|
||||
{
|
||||
{ GamepadButtonInputId.LeftStick , SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_LEFTSTICK },
|
||||
{GamepadButtonInputId.DpadUp ,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_Y},
|
||||
{GamepadButtonInputId.DpadDown ,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_A},
|
||||
{GamepadButtonInputId.DpadLeft ,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_B},
|
||||
{GamepadButtonInputId.DpadRight ,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_X},
|
||||
{GamepadButtonInputId.Minus ,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_START},
|
||||
{GamepadButtonInputId.LeftShoulder,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_PADDLE2},
|
||||
{GamepadButtonInputId.LeftTrigger,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_PADDLE4},
|
||||
{GamepadButtonInputId.SingleRightTrigger0,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_RIGHTSHOULDER},
|
||||
{GamepadButtonInputId.SingleLeftTrigger0,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_LEFTSHOULDER},
|
||||
};
|
||||
private readonly Dictionary<GamepadButtonInputId,SDL_GameControllerButton> _rightButtonsDriverMapping = new()
|
||||
{
|
||||
{GamepadButtonInputId.RightStick,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_LEFTSTICK},
|
||||
{GamepadButtonInputId.A,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_B},
|
||||
{GamepadButtonInputId.B,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_Y},
|
||||
{GamepadButtonInputId.X,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_A},
|
||||
{GamepadButtonInputId.Y,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_X},
|
||||
{GamepadButtonInputId.Plus,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_START},
|
||||
{GamepadButtonInputId.RightShoulder,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_PADDLE1},
|
||||
{GamepadButtonInputId.RightTrigger,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_PADDLE3},
|
||||
{GamepadButtonInputId.SingleRightTrigger1,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_RIGHTSHOULDER},
|
||||
{GamepadButtonInputId.SingleLeftTrigger1,SDL_GameControllerButton.SDL_CONTROLLER_BUTTON_LEFTSHOULDER}
|
||||
};
|
||||
|
||||
private readonly Dictionary<GamepadButtonInputId, SDL_GameControllerButton> _buttonsDriverMapping;
|
||||
private readonly Lock _userMappingLock = new();
|
||||
|
||||
private readonly List<ButtonMappingEntry> _buttonsUserMapping;
|
||||
|
||||
private readonly StickInputId[] _stickUserMapping = new StickInputId[(int)StickInputId.Count]
|
||||
{
|
||||
StickInputId.Unbound, StickInputId.Left, StickInputId.Right,
|
||||
};
|
||||
|
||||
public GamepadFeaturesFlag Features { get; }
|
||||
|
||||
private nint _gamepadHandle;
|
||||
|
||||
private enum JoyConType
|
||||
{
|
||||
Left, Right
|
||||
}
|
||||
|
||||
public const string Prefix = "Nintendo Switch Joy-Con";
|
||||
public const string LeftName = "Nintendo Switch Joy-Con (L)";
|
||||
public const string RightName = "Nintendo Switch Joy-Con (R)";
|
||||
|
||||
private readonly JoyConType _joyConType;
|
||||
|
||||
public SDL2JoyCon(nint gamepadHandle, string driverId)
|
||||
{
|
||||
_gamepadHandle = gamepadHandle;
|
||||
_buttonsUserMapping = new List<ButtonMappingEntry>(10);
|
||||
|
||||
Name = SDL_GameControllerName(_gamepadHandle);
|
||||
Id = driverId;
|
||||
Features = GetFeaturesFlag();
|
||||
|
||||
// Enable motion tracking
|
||||
if (Features.HasFlag(GamepadFeaturesFlag.Motion))
|
||||
{
|
||||
if (SDL_GameControllerSetSensorEnabled(_gamepadHandle, SDL_SensorType.SDL_SENSOR_ACCEL,
|
||||
SDL_bool.SDL_TRUE) != 0)
|
||||
{
|
||||
Logger.Error?.Print(LogClass.Hid,
|
||||
$"Could not enable data reporting for SensorType {SDL_SensorType.SDL_SENSOR_ACCEL}.");
|
||||
}
|
||||
|
||||
if (SDL_GameControllerSetSensorEnabled(_gamepadHandle, SDL_SensorType.SDL_SENSOR_GYRO,
|
||||
SDL_bool.SDL_TRUE) != 0)
|
||||
{
|
||||
Logger.Error?.Print(LogClass.Hid,
|
||||
$"Could not enable data reporting for SensorType {SDL_SensorType.SDL_SENSOR_GYRO}.");
|
||||
}
|
||||
}
|
||||
|
||||
switch (Name)
|
||||
{
|
||||
case LeftName:
|
||||
{
|
||||
_buttonsDriverMapping = _leftButtonsDriverMapping;
|
||||
_joyConType = JoyConType.Left;
|
||||
break;
|
||||
}
|
||||
case RightName:
|
||||
{
|
||||
_buttonsDriverMapping = _rightButtonsDriverMapping;
|
||||
_joyConType = JoyConType.Right;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private GamepadFeaturesFlag GetFeaturesFlag()
|
||||
{
|
||||
GamepadFeaturesFlag result = GamepadFeaturesFlag.None;
|
||||
|
||||
if (SDL_GameControllerHasSensor(_gamepadHandle, SDL_SensorType.SDL_SENSOR_ACCEL) == SDL_bool.SDL_TRUE &&
|
||||
SDL_GameControllerHasSensor(_gamepadHandle, SDL_SensorType.SDL_SENSOR_GYRO) == SDL_bool.SDL_TRUE)
|
||||
{
|
||||
result |= GamepadFeaturesFlag.Motion;
|
||||
}
|
||||
|
||||
int error = SDL_GameControllerRumble(_gamepadHandle, 0, 0, 100);
|
||||
|
||||
if (error == 0)
|
||||
{
|
||||
result |= GamepadFeaturesFlag.Rumble;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public string Id { get; }
|
||||
public string Name { get; }
|
||||
public bool IsConnected => SDL_GameControllerGetAttached(_gamepadHandle) == SDL_bool.SDL_TRUE;
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && _gamepadHandle != nint.Zero)
|
||||
{
|
||||
SDL_GameControllerClose(_gamepadHandle);
|
||||
|
||||
_gamepadHandle = nint.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
|
||||
public void SetTriggerThreshold(float triggerThreshold)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Rumble(float lowFrequency, float highFrequency, uint durationMs)
|
||||
{
|
||||
if (!Features.HasFlag(GamepadFeaturesFlag.Rumble))
|
||||
return;
|
||||
|
||||
ushort lowFrequencyRaw = (ushort)(lowFrequency * ushort.MaxValue);
|
||||
ushort highFrequencyRaw = (ushort)(highFrequency * ushort.MaxValue);
|
||||
|
||||
if (durationMs == uint.MaxValue)
|
||||
{
|
||||
if (SDL_GameControllerRumble(_gamepadHandle, lowFrequencyRaw, highFrequencyRaw, SDL_HAPTIC_INFINITY) !=
|
||||
0)
|
||||
Logger.Error?.Print(LogClass.Hid, "Rumble is not supported on this game controller.");
|
||||
}
|
||||
else if (durationMs > SDL_HAPTIC_INFINITY)
|
||||
{
|
||||
Logger.Error?.Print(LogClass.Hid, $"Unsupported rumble duration {durationMs}");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SDL_GameControllerRumble(_gamepadHandle, lowFrequencyRaw, highFrequencyRaw, durationMs) != 0)
|
||||
Logger.Error?.Print(LogClass.Hid, "Rumble is not supported on this game controller.");
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 GetMotionData(MotionInputId inputId)
|
||||
{
|
||||
SDL_SensorType sensorType = inputId switch
|
||||
{
|
||||
MotionInputId.Accelerometer => SDL_SensorType.SDL_SENSOR_ACCEL,
|
||||
MotionInputId.Gyroscope => SDL_SensorType.SDL_SENSOR_GYRO,
|
||||
_ => SDL_SensorType.SDL_SENSOR_INVALID
|
||||
};
|
||||
|
||||
if (!Features.HasFlag(GamepadFeaturesFlag.Motion) || sensorType is SDL_SensorType.SDL_SENSOR_INVALID)
|
||||
return Vector3.Zero;
|
||||
|
||||
const int ElementCount = 3;
|
||||
|
||||
unsafe
|
||||
{
|
||||
float* values = stackalloc float[ElementCount];
|
||||
|
||||
int result = SDL_GameControllerGetSensorData(_gamepadHandle, sensorType, (nint)values, ElementCount);
|
||||
|
||||
if (result != 0)
|
||||
return Vector3.Zero;
|
||||
|
||||
Vector3 value = _joyConType switch
|
||||
{
|
||||
JoyConType.Left => new Vector3(-values[2], values[1], values[0]),
|
||||
JoyConType.Right => new Vector3(values[2], values[1], -values[0])
|
||||
};
|
||||
|
||||
return inputId switch
|
||||
{
|
||||
MotionInputId.Gyroscope => RadToDegree(value),
|
||||
MotionInputId.Accelerometer => GsToMs2(value),
|
||||
_ => value
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static Vector3 RadToDegree(Vector3 rad) => rad * (180 / MathF.PI);
|
||||
|
||||
private static Vector3 GsToMs2(Vector3 gs) => gs / SDL_STANDARD_GRAVITY;
|
||||
|
||||
public void SetConfiguration(InputConfig configuration)
|
||||
{
|
||||
lock (_userMappingLock)
|
||||
{
|
||||
_configuration = (StandardControllerInputConfig)configuration;
|
||||
|
||||
_buttonsUserMapping.Clear();
|
||||
|
||||
// First update sticks
|
||||
_stickUserMapping[(int)StickInputId.Left] = (StickInputId)_configuration.LeftJoyconStick.Joystick;
|
||||
_stickUserMapping[(int)StickInputId.Right] = (StickInputId)_configuration.RightJoyconStick.Joystick;
|
||||
|
||||
|
||||
switch (_joyConType)
|
||||
{
|
||||
case JoyConType.Left:
|
||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftStick, (GamepadButtonInputId)_configuration.LeftJoyconStick.StickButton));
|
||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadUp, (GamepadButtonInputId)_configuration.LeftJoycon.DpadUp));
|
||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadDown, (GamepadButtonInputId)_configuration.LeftJoycon.DpadDown));
|
||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadLeft, (GamepadButtonInputId)_configuration.LeftJoycon.DpadLeft));
|
||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadRight, (GamepadButtonInputId)_configuration.LeftJoycon.DpadRight));
|
||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Minus, (GamepadButtonInputId)_configuration.LeftJoycon.ButtonMinus));
|
||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftShoulder, (GamepadButtonInputId)_configuration.LeftJoycon.ButtonL));
|
||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftTrigger, (GamepadButtonInputId)_configuration.LeftJoycon.ButtonZl));
|
||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleRightTrigger0, (GamepadButtonInputId)_configuration.LeftJoycon.ButtonSr));
|
||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleLeftTrigger0, (GamepadButtonInputId)_configuration.LeftJoycon.ButtonSl));
|
||||
break;
|
||||
case JoyConType.Right:
|
||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.RightStick, (GamepadButtonInputId)_configuration.RightJoyconStick.StickButton));
|
||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.A, (GamepadButtonInputId)_configuration.RightJoycon.ButtonA));
|
||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.B, (GamepadButtonInputId)_configuration.RightJoycon.ButtonB));
|
||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.X, (GamepadButtonInputId)_configuration.RightJoycon.ButtonX));
|
||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Y, (GamepadButtonInputId)_configuration.RightJoycon.ButtonY));
|
||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Plus, (GamepadButtonInputId)_configuration.RightJoycon.ButtonPlus));
|
||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.RightShoulder, (GamepadButtonInputId)_configuration.RightJoycon.ButtonR));
|
||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.RightTrigger, (GamepadButtonInputId)_configuration.RightJoycon.ButtonZr));
|
||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleRightTrigger1, (GamepadButtonInputId)_configuration.RightJoycon.ButtonSr));
|
||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleLeftTrigger1, (GamepadButtonInputId)_configuration.RightJoycon.ButtonSl));
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
SetTriggerThreshold(_configuration.TriggerThreshold);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetLed(uint packedRgb)
|
||||
{
|
||||
}
|
||||
|
||||
public GamepadStateSnapshot GetStateSnapshot()
|
||||
{
|
||||
return IGamepad.GetStateSnapshot(this);
|
||||
}
|
||||
|
||||
public GamepadStateSnapshot GetMappedStateSnapshot()
|
||||
{
|
||||
GamepadStateSnapshot rawState = GetStateSnapshot();
|
||||
GamepadStateSnapshot result = default;
|
||||
|
||||
lock (_userMappingLock)
|
||||
{
|
||||
if (_buttonsUserMapping.Count == 0)
|
||||
return rawState;
|
||||
|
||||
|
||||
// ReSharper disable once ForeachCanBePartlyConvertedToQueryUsingAnotherGetEnumerator
|
||||
foreach (ButtonMappingEntry entry in _buttonsUserMapping)
|
||||
{
|
||||
if (!entry.IsValid)
|
||||
continue;
|
||||
|
||||
// Do not touch state of button already pressed
|
||||
if (!result.IsPressed(entry.To))
|
||||
{
|
||||
result.SetPressed(entry.To, rawState.IsPressed(entry.From));
|
||||
}
|
||||
}
|
||||
|
||||
(float leftStickX, float leftStickY) = rawState.GetStick(_stickUserMapping[(int)StickInputId.Left]);
|
||||
(float rightStickX, float rightStickY) = rawState.GetStick(_stickUserMapping[(int)StickInputId.Right]);
|
||||
|
||||
result.SetStick(StickInputId.Left, leftStickX, leftStickY);
|
||||
result.SetStick(StickInputId.Right, rightStickX, rightStickY);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private static float ConvertRawStickValue(short value)
|
||||
{
|
||||
const float ConvertRate = 1.0f / (short.MaxValue + 0.5f);
|
||||
|
||||
return value * ConvertRate;
|
||||
}
|
||||
|
||||
private JoyconConfigControllerStick<GamepadInputId, Common.Configuration.Hid.Controller.StickInputId>
|
||||
GetLogicalJoyStickConfig(StickInputId inputId)
|
||||
{
|
||||
switch (inputId)
|
||||
{
|
||||
case StickInputId.Left:
|
||||
if (_configuration.RightJoyconStick.Joystick ==
|
||||
Common.Configuration.Hid.Controller.StickInputId.Left)
|
||||
return _configuration.RightJoyconStick;
|
||||
else
|
||||
return _configuration.LeftJoyconStick;
|
||||
case StickInputId.Right:
|
||||
if (_configuration.LeftJoyconStick.Joystick ==
|
||||
Common.Configuration.Hid.Controller.StickInputId.Right)
|
||||
return _configuration.LeftJoyconStick;
|
||||
else
|
||||
return _configuration.RightJoyconStick;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public (float, float) GetStick(StickInputId inputId)
|
||||
{
|
||||
if (inputId == StickInputId.Unbound)
|
||||
return (0.0f, 0.0f);
|
||||
|
||||
if (inputId == StickInputId.Left && _joyConType == JoyConType.Right || inputId == StickInputId.Right && _joyConType == JoyConType.Left)
|
||||
{
|
||||
return (0.0f, 0.0f);
|
||||
}
|
||||
|
||||
(short stickX, short stickY) = GetStickXY();
|
||||
|
||||
float resultX = ConvertRawStickValue(stickX);
|
||||
float resultY = -ConvertRawStickValue(stickY);
|
||||
|
||||
if (HasConfiguration)
|
||||
{
|
||||
var joyconStickConfig = GetLogicalJoyStickConfig(inputId);
|
||||
|
||||
if (joyconStickConfig != null)
|
||||
{
|
||||
if (joyconStickConfig.InvertStickX)
|
||||
resultX = -resultX;
|
||||
|
||||
if (joyconStickConfig.InvertStickY)
|
||||
resultY = -resultY;
|
||||
|
||||
if (joyconStickConfig.Rotate90CW)
|
||||
{
|
||||
float temp = resultX;
|
||||
resultX = resultY;
|
||||
resultY = -temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return inputId switch
|
||||
{
|
||||
StickInputId.Left when _joyConType == JoyConType.Left => (resultY, -resultX),
|
||||
StickInputId.Right when _joyConType == JoyConType.Right => (-resultY, resultX),
|
||||
_ => (0.0f, 0.0f)
|
||||
};
|
||||
}
|
||||
|
||||
private (short, short) GetStickXY()
|
||||
{
|
||||
return (
|
||||
SDL_GameControllerGetAxis(_gamepadHandle, SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_LEFTX),
|
||||
SDL_GameControllerGetAxis(_gamepadHandle, SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_LEFTY));
|
||||
}
|
||||
|
||||
public bool IsPressed(GamepadButtonInputId inputId)
|
||||
{
|
||||
if (!_buttonsDriverMapping.TryGetValue(inputId, out var button))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return SDL_GameControllerGetButton(_gamepadHandle, button) == 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
146
src/Ryujinx.Input.SDL2/SDL2JoyConPair.cs
Normal file
146
src/Ryujinx.Input.SDL2/SDL2JoyConPair.cs
Normal file
@@ -0,0 +1,146 @@
|
||||
using Ryujinx.Common.Configuration.Hid;
|
||||
using Ryujinx.Common.Configuration.Hid.Controller;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using static SDL2.SDL;
|
||||
|
||||
namespace Ryujinx.Input.SDL2
|
||||
{
|
||||
internal class SDL2JoyConPair(IGamepad left, IGamepad right) : IGamepad
|
||||
{
|
||||
private StandardControllerInputConfig _configuration;
|
||||
|
||||
private readonly StickInputId[] _stickUserMapping =
|
||||
[
|
||||
StickInputId.Unbound,
|
||||
StickInputId.Left,
|
||||
StickInputId.Right
|
||||
];
|
||||
|
||||
public GamepadFeaturesFlag Features => (left?.Features ?? GamepadFeaturesFlag.None) |
|
||||
(right?.Features ?? GamepadFeaturesFlag.None);
|
||||
|
||||
public const string Id = "JoyConPair";
|
||||
string IGamepad.Id => Id;
|
||||
|
||||
public string Name => "* Nintendo Switch Joy-Con (L/R)";
|
||||
public bool IsConnected => left is { IsConnected: true } && right is { IsConnected: true };
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
left?.Dispose();
|
||||
right?.Dispose();
|
||||
}
|
||||
|
||||
public GamepadStateSnapshot GetMappedStateSnapshot()
|
||||
{
|
||||
return GetStateSnapshot();
|
||||
}
|
||||
|
||||
public Vector3 GetMotionData(MotionInputId inputId)
|
||||
{
|
||||
return inputId switch
|
||||
{
|
||||
MotionInputId.Accelerometer or
|
||||
MotionInputId.Gyroscope => left.GetMotionData(inputId),
|
||||
MotionInputId.SecondAccelerometer => right.GetMotionData(MotionInputId.Accelerometer),
|
||||
MotionInputId.SecondGyroscope => right.GetMotionData(MotionInputId.Gyroscope),
|
||||
_ => Vector3.Zero
|
||||
};
|
||||
}
|
||||
|
||||
public GamepadStateSnapshot GetStateSnapshot()
|
||||
{
|
||||
return IGamepad.GetStateSnapshot(this);
|
||||
}
|
||||
|
||||
public (float, float) GetStick(StickInputId inputId)
|
||||
{
|
||||
return inputId switch
|
||||
{
|
||||
StickInputId.Left => left.GetStick(StickInputId.Left),
|
||||
StickInputId.Right => right.GetStick(StickInputId.Right),
|
||||
_ => (0, 0)
|
||||
};
|
||||
}
|
||||
|
||||
public bool IsPressed(GamepadButtonInputId inputId)
|
||||
{
|
||||
return left.IsPressed(inputId) || right.IsPressed(inputId);
|
||||
}
|
||||
|
||||
public void Rumble(float lowFrequency, float highFrequency, uint durationMs)
|
||||
{
|
||||
if (lowFrequency != 0)
|
||||
{
|
||||
right.Rumble(lowFrequency, lowFrequency, durationMs);
|
||||
}
|
||||
|
||||
if (highFrequency != 0)
|
||||
{
|
||||
left.Rumble(highFrequency, highFrequency, durationMs);
|
||||
}
|
||||
|
||||
if (lowFrequency == 0 && highFrequency == 0)
|
||||
{
|
||||
left.Rumble(0, 0, durationMs);
|
||||
right.Rumble(0, 0, durationMs);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetConfiguration(InputConfig configuration)
|
||||
{
|
||||
left.SetConfiguration(configuration);
|
||||
right.SetConfiguration(configuration);
|
||||
}
|
||||
|
||||
public void SetLed(uint packedRgb)
|
||||
{
|
||||
}
|
||||
|
||||
public void SetTriggerThreshold(float triggerThreshold)
|
||||
{
|
||||
left.SetTriggerThreshold(triggerThreshold);
|
||||
right.SetTriggerThreshold(triggerThreshold);
|
||||
}
|
||||
|
||||
public static bool IsCombinable(List<string> gamepadsIds)
|
||||
{
|
||||
(int leftIndex, int rightIndex) = DetectJoyConPair(gamepadsIds);
|
||||
return leftIndex >= 0 && rightIndex >= 0;
|
||||
}
|
||||
|
||||
private static (int leftIndex, int rightIndex) DetectJoyConPair(List<string> gamepadsIds)
|
||||
{
|
||||
var gamepadNames = gamepadsIds.Where(gamepadId => gamepadId != Id)
|
||||
.Select((_, index) => SDL_GameControllerNameForIndex(index)).ToList();
|
||||
int leftIndex = gamepadNames.IndexOf(SDL2JoyCon.LeftName);
|
||||
int rightIndex = gamepadNames.IndexOf(SDL2JoyCon.RightName);
|
||||
|
||||
return (leftIndex, rightIndex);
|
||||
}
|
||||
|
||||
public static IGamepad GetGamepad(List<string> gamepadsIds)
|
||||
{
|
||||
(int leftIndex, int rightIndex) = DetectJoyConPair(gamepadsIds);
|
||||
if (leftIndex == -1 || rightIndex == -1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
nint leftGamepadHandle = SDL_GameControllerOpen(leftIndex);
|
||||
nint rightGamepadHandle = SDL_GameControllerOpen(rightIndex);
|
||||
|
||||
if (leftGamepadHandle == nint.Zero || rightGamepadHandle == nint.Zero)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
return new SDL2JoyConPair(new SDL2JoyCon(leftGamepadHandle, gamepadsIds[leftIndex]),
|
||||
new SDL2JoyCon(rightGamepadHandle, gamepadsIds[rightIndex]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -269,6 +269,7 @@ namespace Ryujinx.Input.HLE
|
||||
if (motionConfig.MotionBackend != MotionInputBackendType.CemuHook)
|
||||
{
|
||||
_leftMotionInput = new MotionInput();
|
||||
_rightMotionInput = new MotionInput();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -301,7 +302,20 @@ namespace Ryujinx.Input.HLE
|
||||
|
||||
if (controllerConfig.ControllerType == ConfigControllerType.JoyconPair)
|
||||
{
|
||||
_rightMotionInput = _leftMotionInput;
|
||||
if (gamepad.Id== "JoyConPair")
|
||||
{
|
||||
Vector3 rightAccelerometer = gamepad.GetMotionData(MotionInputId.SecondAccelerometer);
|
||||
Vector3 rightGyroscope = gamepad.GetMotionData(MotionInputId.SecondGyroscope);
|
||||
|
||||
rightAccelerometer = new Vector3(rightAccelerometer.X, -rightAccelerometer.Z, rightAccelerometer.Y);
|
||||
rightGyroscope = new Vector3(rightGyroscope.X, -rightGyroscope.Z, rightGyroscope.Y);
|
||||
|
||||
_rightMotionInput.Update(rightAccelerometer, rightGyroscope, (ulong)PerformanceCounter.ElapsedNanoseconds / 1000, controllerConfig.Motion.Sensitivity, (float)controllerConfig.Motion.GyroDeadzone);
|
||||
}
|
||||
else
|
||||
{
|
||||
_rightMotionInput = _leftMotionInput;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -336,6 +350,7 @@ namespace Ryujinx.Input.HLE
|
||||
// Reset states
|
||||
State = default;
|
||||
_leftMotionInput = null;
|
||||
_rightMotionInput = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,5 +21,17 @@ namespace Ryujinx.Input
|
||||
/// </summary>
|
||||
/// <remarks>Values are in degrees</remarks>
|
||||
Gyroscope,
|
||||
|
||||
/// <summary>
|
||||
/// Second accelerometer.
|
||||
/// </summary>
|
||||
/// <remarks>Values are in m/s^2</remarks>
|
||||
SecondAccelerometer,
|
||||
|
||||
/// <summary>
|
||||
/// Second gyroscope.
|
||||
/// </summary>
|
||||
/// <remarks>Values are in degrees</remarks>
|
||||
SecondGyroscope
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,14 +25,17 @@ namespace Ryujinx.SDL2.Common
|
||||
|
||||
public static Action<Action> MainThreadDispatcher { get; set; }
|
||||
|
||||
private const uint SdlInitFlags = SDL_INIT_EVENTS | SDL_INIT_GAMECONTROLLER | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_VIDEO;
|
||||
private const uint SdlInitFlags = SDL_INIT_EVENTS | SDL_INIT_GAMECONTROLLER | SDL_INIT_JOYSTICK |
|
||||
SDL_INIT_AUDIO | SDL_INIT_VIDEO;
|
||||
|
||||
private bool _isRunning;
|
||||
private uint _refereceCount;
|
||||
private Thread _worker;
|
||||
|
||||
private const uint SDL_JOYBATTERYUPDATED = 1543;
|
||||
public event Action<int, int> OnJoyStickConnected;
|
||||
public event Action<int> OnJoystickDisconnected;
|
||||
public event Action<int, SDL_JoystickPowerLevel> OnJoyBatteryUpdated;
|
||||
|
||||
private ConcurrentDictionary<uint, Action<SDL_Event>> _registeredWindowHandlers;
|
||||
|
||||
@@ -78,12 +81,14 @@ namespace Ryujinx.SDL2.Common
|
||||
// First ensure that we only enable joystick events (for connected/disconnected).
|
||||
if (SDL_GameControllerEventState(SDL_IGNORE) != SDL_IGNORE)
|
||||
{
|
||||
Logger.Error?.PrintMsg(LogClass.Application, "Couldn't change the state of game controller events.");
|
||||
Logger.Error?.PrintMsg(LogClass.Application,
|
||||
"Couldn't change the state of game controller events.");
|
||||
}
|
||||
|
||||
if (SDL_JoystickEventState(SDL_ENABLE) < 0)
|
||||
{
|
||||
Logger.Error?.PrintMsg(LogClass.Application, $"Failed to enable joystick event polling: {SDL_GetError()}");
|
||||
Logger.Error?.PrintMsg(LogClass.Application,
|
||||
$"Failed to enable joystick event polling: {SDL_GetError()}");
|
||||
}
|
||||
|
||||
// Disable all joysticks information, we don't need them no need to flood the event queue for that.
|
||||
@@ -143,7 +148,12 @@ namespace Ryujinx.SDL2.Common
|
||||
|
||||
OnJoystickDisconnected?.Invoke(evnt.cbutton.which);
|
||||
}
|
||||
else if (evnt.type is SDL_EventType.SDL_WINDOWEVENT or SDL_EventType.SDL_MOUSEBUTTONDOWN or SDL_EventType.SDL_MOUSEBUTTONUP)
|
||||
else if ((uint)evnt.type == SDL_JOYBATTERYUPDATED)
|
||||
{
|
||||
OnJoyBatteryUpdated?.Invoke(evnt.cbutton.which, (SDL_JoystickPowerLevel)evnt.user.code);
|
||||
}
|
||||
else if (evnt.type is SDL_EventType.SDL_WINDOWEVENT or SDL_EventType.SDL_MOUSEBUTTONDOWN
|
||||
or SDL_EventType.SDL_MOUSEBUTTONUP)
|
||||
{
|
||||
if (_registeredWindowHandlers.TryGetValue(evnt.window.windowID, out Action<SDL_Event> handler))
|
||||
{
|
||||
|
||||
@@ -469,7 +469,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Відкрити теку скріншотів",
|
||||
"zh_CN": "打开截图文件夹",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "開啟螢幕擷取畫面資料夾"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -619,7 +619,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Запускати ігри з прихованим інтерфейсом",
|
||||
"zh_CN": "启动游戏时隐藏 UI",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "開啟遊戲時隱藏 UI"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -1569,7 +1569,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Розроблено: {0}",
|
||||
"zh_CN": "由 {0} 开发",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "由 {0} 開發"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -1869,7 +1869,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Сумісність:",
|
||||
"zh_CN": "兼容性:",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "相容性:"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -1894,7 +1894,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "ID гри:",
|
||||
"zh_CN": "标题 ID:",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "標題 ID:"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -1919,7 +1919,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Розміщені ігри: {0}",
|
||||
"zh_CN": "服务的游戏: {0}",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "LDN 上主持的遊戲數量: {0}"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -1944,7 +1944,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Гравців онлайн: {0}",
|
||||
"zh_CN": "在线玩家: {0}",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "LDN 上在線的玩家數量: {0}"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2294,7 +2294,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Очистити кеш PPTC",
|
||||
"zh_CN": "清理 PPTC 缓存",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "清除 PPTC"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2319,7 +2319,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Видаляє всі файли кешу PPTC для застосунку",
|
||||
"zh_CN": "删除应用程序的所有 PPTC 缓存",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "清除應用程式的 PPTC"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2369,7 +2369,7 @@
|
||||
"tr_TR": "Uygulamanın shader önbelleğini temizler",
|
||||
"uk_UA": "Видаляє кеш шейдерів застосунку (гри)",
|
||||
"zh_CN": "删除游戏的着色器缓存文件,下次启动游戏时重新生成着色器缓存文件",
|
||||
"zh_TW": "刪除應用程式的著色器快取"
|
||||
"zh_TW": "清除應用程式的著色器快取檔案"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2644,7 +2644,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Витягти RomFS з обраного файлу DLC",
|
||||
"zh_CN": "从选定的 DLC 文件中解压 RomFS",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "從已選擇的 DLC 檔案中提取 RomFS"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2763,13 +2763,13 @@
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "Создать пользовательскую конфигурацию",
|
||||
"ru_RU": "Задать индивидуальные параметры",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Створити користувацьку конфігурацію",
|
||||
"zh_CN": "创建自定义设置",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "建立遊戲獨立自訂 (per-game) 設定檔"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2788,13 +2788,13 @@
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "Изменить пользовательскую конфигурацию",
|
||||
"ru_RU": "Изменить индивидуальные параметры",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Редагувати користувацьку конфігурацію",
|
||||
"zh_CN": "编辑自定义设置",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "編輯遊戲獨立自訂 (per-game) 設定檔"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2844,7 +2844,7 @@
|
||||
"tr_TR": "Mevcut oyun için bağımsız bir yapılandırma oluşturur",
|
||||
"uk_UA": "Створюйте незалежну конфігурацію для поточної гри",
|
||||
"zh_CN": "为当前游戏创建独立的配置",
|
||||
"zh_TW": "為當前遊戲創建獨立的配置"
|
||||
"zh_TW": "為已選擇的遊戲建立遊戲獨立自訂 (game-specific) 的設定檔"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2863,13 +2863,13 @@
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "Отредактировать существующую независимую конфигурацию для выбранной игры.",
|
||||
"ru_RU": "Отредактировать существующие независимые параметры для выбранной игры.",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Відредагувати наявну індивідуальну конфігурацію для цієї гри.",
|
||||
"zh_CN": "编辑选定游戏的现存独立配置",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "為已選擇的遊戲編輯遊戲獨立自訂 (game-specific) 的設定檔"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2894,7 +2894,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Iнформація про сумісність",
|
||||
"zh_CN": "显示兼容性项目",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "顯示相容性資訊"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2919,7 +2919,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Показати цю гру в Списку Сумісності. Список сумісності також можна зайти в меню Довідки.",
|
||||
"zh_CN": "在兼容性列表中显示选定的游戏,您通常可以通过帮助菜单访问。",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "在相容性列表中顯示已選擇的遊戲。你也可以透過「說明」選單開啟。"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2944,7 +2944,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Інформація про гру",
|
||||
"zh_CN": "显示游戏信息",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "顯示遊戲資訊"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2969,7 +2969,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Показати статистику та деталі обраної гри.",
|
||||
"zh_CN": "显示当前选定游戏的状态与详细信息。",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "顯示目前已選擇遊戲的狀態及詳細資訊。"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -3519,7 +3519,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Перевірка оновлень:",
|
||||
"zh_CN": "检查更新",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "檢查更新:"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -3544,7 +3544,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Вимкнути",
|
||||
"zh_CN": "关闭",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "關閉"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -3569,7 +3569,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Запитувати щоразу",
|
||||
"zh_CN": "提示",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "提示"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -3594,7 +3594,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Оновлювати в фоні",
|
||||
"zh_CN": "背景",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "背景"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -3619,7 +3619,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "При втраті фокуса емулятором:",
|
||||
"zh_CN": "当模拟器在后台时:",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "當模擬器「失去焦點」(如切換工作)時:"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -3644,7 +3644,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Нічого не робити",
|
||||
"zh_CN": "什么事情也不做",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "沒有動作"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -3669,7 +3669,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Блокувати введення",
|
||||
"zh_CN": "禁用输入",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "停用輸入"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -3694,7 +3694,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Вимкнути звук",
|
||||
"zh_CN": "静音",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "靜音"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -3719,7 +3719,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Блокувати введення та Вимкнути звук",
|
||||
"zh_CN": "阻止输入且静音",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "停用輸入且靜音"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -3744,7 +3744,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Поставити на паузу",
|
||||
"zh_CN": "暂停模拟",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "暫停模擬"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -3819,7 +3819,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Вимкнути введення, якщо вікно неактивне",
|
||||
"zh_CN": "在后台时禁用输入",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "在「失去焦點」時停用輸入"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -3838,7 +3838,7 @@
|
||||
"no_NO": "Vis original UI-stil (krever omstart)",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"ru_RU": "Включить оригинальный интерфейса (требуется перезагрузка)",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
@@ -3863,7 +3863,7 @@
|
||||
"no_NO": "Vis det eldre Avalonia Ryujinx-grensesnittet som minner om Ryujinx 1.1.1403. Dette er aktivert som standard på plattformer som ikke er Windows.\nTittellinjen i klassisk stil er tilbake, og store omarbeidinger av vindusoppsettet er reversert, for eksempel plasseringen av innstillingsnavigasjonen over dette verktøytipset.",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"ru_RU": "Показать старый пользовательский интерфейс Avalonia Ryujinx, напоминающий Ryujinx 1.1.1403. Включено по умолчанию на платформах, отличных от Windows.\nСтрока заголовка в классическом стиле вернётся на место, а основные изменения в оформлении окна будут отменены; например, расположение навигации по настройкам над этой всплывающей подсказкой.",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
@@ -4869,7 +4869,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Синхронізувати з системним годинником",
|
||||
"zh_CN": "与系统时间同步",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "與系統時間同步"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -5038,7 +5038,7 @@
|
||||
"no_NO": "Lyd Inn/Ut",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "Выход/Вход звука",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
@@ -5294,7 +5294,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Ігнорувати Аплет Контролера",
|
||||
"zh_CN": "忽略控制器小程序",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "忽略控制器小程式"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -6144,7 +6144,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Увімкнути журнали інтерфейсу",
|
||||
"zh_CN": "启用 UI 日志",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "啟用 UI 日誌"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -6544,7 +6544,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Скинути налаштування",
|
||||
"zh_CN": "重置设置",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "重設設定"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -6569,7 +6569,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Я хочу скинути налаштування.",
|
||||
"zh_CN": "我要重置我的设置。",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "我想重設我的設定。"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -6588,7 +6588,7 @@
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "Ок",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "Ok",
|
||||
"th_TH": "ตกลง",
|
||||
"tr_TR": "Tamam",
|
||||
@@ -7038,7 +7038,7 @@
|
||||
"no_NO": "",
|
||||
"pl_PL": "Pro Kontroler",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "Pro контроллер",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "โปรคอนโทรลเลอร์",
|
||||
"tr_TR": "Profesyonel Kumanda",
|
||||
@@ -8494,7 +8494,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Вимкнути",
|
||||
"zh_CN": "关闭",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "關閉"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -8519,7 +8519,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Веселка",
|
||||
"zh_CN": "彩虹",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "彩虹"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -8544,7 +8544,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Швидкість зміни кольорів",
|
||||
"zh_CN": "彩虹滚动速度",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "彩虹滾動速度"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -8569,7 +8569,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "颜色",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "顏色"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -13844,7 +13844,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Ви збираєтесь видалити всі дані PPTC з:\n\n{0}\n\nБажаєте продовжити цю операцію?",
|
||||
"zh_CN": "您正要清理 PPTC 数据:\n\n{0}\n\n您确实要继续吗?",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "您將要刪除以下遊戲的 PPTC:\n\n{0}\n\n您確定要繼續嗎?"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -16694,7 +16694,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Діалогове вікно Аплету Контролера не з'явиться, якщо геймпад було відключено під час роботи програми.\n\nЗалиште вимкненим якщо не впевнені.",
|
||||
"zh_CN": "在应用程序运行时如果游戏手柄断开连接则不会显示控制器小程序对话框。\n\n如果不确定,请保持关闭状态。",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "在模擬應用程式時如果遊戲手柄中斷連線則不會顯示控制器小程式。\n\n如果不確定,請保持關閉狀態。"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -17169,7 +17169,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Виводити повідомлення журналу Avalonia (UI) в консоль",
|
||||
"zh_CN": "在控制台显示 Avalonia (UI) 的日志信息",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "在控制台中輸出 Avalonia (UI) 日誌訊息。"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -17369,7 +17369,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Відкрити теку куди зберігаються скріншоти Ryujinx",
|
||||
"zh_CN": "打开 Ryujinx 截图文件夹",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "開啟 Ryujinx 螢幕擷取畫面資料夾"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -18119,7 +18119,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Доступне оновлення!",
|
||||
"zh_CN": "有可用的更新!",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "有可用的更新!"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -19944,7 +19944,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Налаштування LED",
|
||||
"zh_CN": "LED 设置",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "LED 設定"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -21794,7 +21794,7 @@
|
||||
"tr_TR": "Yeniden Doku Sıkıştırılmasını Aktif Et",
|
||||
"uk_UA": "Увімкнути рекомпресію текстури",
|
||||
"zh_CN": "启用纹理压缩",
|
||||
"zh_TW": "開啟材質重新壓縮"
|
||||
"zh_TW": "啟用材質重新壓縮"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -23863,7 +23863,7 @@
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"ru_RU": "Список совместимости — записей: {0}",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
@@ -23938,7 +23938,7 @@
|
||||
"no_NO": "Søk i {0} kompatibilitetsoppføringer...",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"ru_RU": "Поиск среди {0} записей о совместимости...",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
@@ -24144,7 +24144,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Запускається та оптимально працює (без збоїв або графічних багів) на середньостатистичному комп'ютері.",
|
||||
"zh_CN": "启动和游戏时不会出现任何崩溃或任何类型的 GPU bug 且速度足够快可以在一般 PC 上尽情游玩。",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "啟動和遊玩時不會出現任何崩潰或任何類型的 GPU bug 且速度足夠快可以在一般 PC 上盡情遊玩。"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -24169,7 +24169,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Запускається, але в грі на вас чекатимуть одна або декілька наступних проблем: збої, зависання, графічні баги, спотворений звук або ж гра загалом працюватиме надто повільно. Можливо, її все ще можна пройти, але досвід буде не найкращим.",
|
||||
"zh_CN": "可以成功启动并进入游戏但可能会遇到以下一种或多种问题: 崩溃、卡死、GPU bug、令人无法接受的音频,或者只是太慢。仍然可以继续进行游戏,但是可能无法达到预期。",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "能啟動並進入遊戲,但可能會遇到下列狀況:崩潰、卡死、GPU bug、令人無法接受的聲音、或遊戲過慢。遊戲或可繼續進行,但是可能無法達到預期效果。"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -24194,7 +24194,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Запускається та проходить початковий екран, але пограти не вийде.",
|
||||
"zh_CN": "可以启动并通过标题画面但是无法进入到主要的游戏流程。",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "能啟動並通過標題畫面,但是無法進入主要的遊戲畫面。"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -24219,7 +24219,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Запускається, але не відображає навіть початкового екрану.",
|
||||
"zh_CN": "可以启动但是无法通过标题画面。",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "能啟動,但是無法通過標題畫面。"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -24244,7 +24244,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Взагалі не запускається.",
|
||||
"zh_CN": "无法启动或显示无任何动静。",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "無法啟動"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -24263,13 +24263,13 @@
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"ru_RU": "Индивидуальные параметры",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Власна конфігурація",
|
||||
"zh_CN": "自定义配置",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "遊戲獨立自訂 (game-specific) 設定"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -24288,13 +24288,13 @@
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"ru_RU": "(Глобальный)",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "(Глобальні)",
|
||||
"zh_CN": "(全局)",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "(全域)"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -24319,7 +24319,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Оберіть DLC які бажаєте вилучити",
|
||||
"zh_CN": "选择一个要解压的 DLC",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "選擇要提取的 DLC"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -24344,7 +24344,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Зображення картки активності Discord",
|
||||
"zh_CN": "Rich Presence 图像",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "Rich Presence 圖像"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -24369,7 +24369,7 @@
|
||||
"tr_TR": "",
|
||||
"uk_UA": "Динамічна картка активності Discord",
|
||||
"zh_CN": "动态 Rich Presence",
|
||||
"zh_TW": ""
|
||||
"zh_TW": "動態 Rich Presence"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -432,7 +432,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpResponseMessage response = await _httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Head, "https://raw.githubusercontent.com/Ryubing/Ryujinx/refs/heads/master/assets/amiibo/Amiibo.json"));
|
||||
HttpResponseMessage response = await _httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Head, "https://raw.githubusercontent.com/Ryubing/Nfc/refs/heads/main/tags.json"));
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
@@ -451,7 +451,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpResponseMessage response = await _httpClient.GetAsync($"https://raw.githubusercontent.com/Ryubing/Ryujinx/refs/heads/master/assets/amiibo/Amiibo.json");
|
||||
HttpResponseMessage response = await _httpClient.GetAsync("https://raw.githubusercontent.com/Ryubing/Nfc/refs/heads/main/tags.json");
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user