Added (incomplete) motion controls emulation support.

This commit is contained in:
Víctor M. González 2024-11-09 19:32:18 -03:00
parent e096fc7aec
commit df8e0503ac
36 changed files with 188 additions and 72 deletions

View File

@ -21,5 +21,10 @@ namespace Ryujinx.Common.Configuration.Hid.Controller.Motion
/// Enable Motion Controls
/// </summary>
public bool EnableMotion { get; set; }
/// <summary>
/// Enable translating sticks to motion controls.
/// </summary>
public bool SticksToMotion { get; set; }
}
}

View File

@ -1,3 +1,5 @@
using System.Collections.Generic;
namespace Ryujinx.Common.Configuration.Hid
{
public class KeyboardHotkeys
@ -11,5 +13,6 @@ namespace Ryujinx.Common.Configuration.Hid
public Key ResScaleDown { get; set; }
public Key VolumeUp { get; set; }
public Key VolumeDown { get; set; }
public Key ToggleMotionEmulation { get; set; }
}
}

View File

@ -95,7 +95,7 @@ namespace Ryujinx.Input.GTK3
return ((short)(stick.X * short.MaxValue), (short)(stick.Y * short.MaxValue));
}
public GamepadStateSnapshot GetMappedStateSnapshot()
public GamepadStateSnapshot GetMappedStateSnapshot(bool _)
{
KeyboardStateSnapshot rawState = GetKeyboardStateSnapshot();
GamepadStateSnapshot result = default;
@ -131,7 +131,7 @@ namespace Ryujinx.Input.GTK3
return result;
}
public GamepadStateSnapshot GetStateSnapshot()
public GamepadStateSnapshot GetStateSnapshot(bool _)
{
throw new NotSupportedException();
}

View File

@ -36,7 +36,7 @@ namespace Ryujinx.Input.GTK3
return _driver.Scroll;
}
public GamepadStateSnapshot GetMappedStateSnapshot()
public GamepadStateSnapshot GetMappedStateSnapshot(bool _)
{
throw new NotImplementedException();
}
@ -46,7 +46,7 @@ namespace Ryujinx.Input.GTK3
throw new NotImplementedException();
}
public GamepadStateSnapshot GetStateSnapshot()
public GamepadStateSnapshot GetStateSnapshot(bool _)
{
throw new NotImplementedException();
}

View File

@ -37,7 +37,7 @@ namespace Ryujinx.Headless.SDL2
return _driver.Scroll;
}
public GamepadStateSnapshot GetMappedStateSnapshot()
public GamepadStateSnapshot GetMappedStateSnapshot(bool _)
{
throw new NotImplementedException();
}
@ -47,7 +47,7 @@ namespace Ryujinx.Headless.SDL2
throw new NotImplementedException();
}
public GamepadStateSnapshot GetStateSnapshot()
public GamepadStateSnapshot GetStateSnapshot(bool _)
{
throw new NotImplementedException();
}

View File

@ -265,14 +265,14 @@ namespace Ryujinx.Input.SDL2
}
}
public GamepadStateSnapshot GetStateSnapshot()
public GamepadStateSnapshot GetStateSnapshot(bool ignoreSticks)
{
return IGamepad.GetStateSnapshot(this);
return IGamepad.GetStateSnapshot(this, ignoreSticks);
}
public GamepadStateSnapshot GetMappedStateSnapshot()
public GamepadStateSnapshot GetMappedStateSnapshot(bool ignoreSticks)
{
GamepadStateSnapshot rawState = GetStateSnapshot();
GamepadStateSnapshot rawState = GetStateSnapshot(ignoreSticks);
GamepadStateSnapshot result = default;
lock (_userMappingLock)

View File

@ -299,7 +299,7 @@ namespace Ryujinx.Input.SDL2
return ((short)(stick.X * short.MaxValue), (short)(stick.Y * short.MaxValue));
}
public GamepadStateSnapshot GetMappedStateSnapshot()
public GamepadStateSnapshot GetMappedStateSnapshot(bool _)
{
KeyboardStateSnapshot rawState = GetKeyboardStateSnapshot();
GamepadStateSnapshot result = default;
@ -335,7 +335,7 @@ namespace Ryujinx.Input.SDL2
return result;
}
public GamepadStateSnapshot GetStateSnapshot()
public GamepadStateSnapshot GetStateSnapshot(bool _)
{
throw new NotSupportedException();
}

View File

@ -33,7 +33,7 @@ namespace Ryujinx.Input.Assigner
{
if (_gamepad != null)
{
_currState = _gamepad.GetStateSnapshot();
_currState = _gamepad.GetStateSnapshot(false);
_prevState = _currState;
}
}
@ -43,7 +43,7 @@ namespace Ryujinx.Input.Assigner
if (_gamepad != null)
{
_prevState = _currState;
_currState = _gamepad.GetStateSnapshot();
_currState = _gamepad.GetStateSnapshot(false);
}
CollectButtonStats();

View File

@ -208,6 +208,7 @@ namespace Ryujinx.Input.HLE
private IGamepad _gamepad;
private InputConfig _config;
public StandardControllerInputConfig StandardControllerInputConfig => _config as StandardControllerInputConfig;
public IGamepadDriver GamepadDriver { get; private set; }
public GamepadStateSnapshot State { get; private set; }
@ -273,6 +274,92 @@ namespace Ryujinx.Input.HLE
}
}
private static double Transform(double x)
{
return (Math.Pow(30, Math.Abs(x)) - 1) / 20 * Math.Sign(x);
}
private void EmulateMotion(IGamepad gamepad, StandardControllerInputConfig config)
{
var (lx, ly) = gamepad.GetStick(StickInputId.Left);
var (rx, _) = gamepad.GetStick(StickInputId.Right);
var gyroscope = new Vector3(-ly, lx, -rx) * 100;
var x = Transform(lx);
var y = Transform(ly);
var accelerometer = new Vector3((float)x, (float)y, -1);
_leftMotionInput.Update(accelerometer, gyroscope, (ulong)PerformanceCounter.ElapsedNanoseconds / 1000, config.Motion.Sensitivity, (float)config.Motion.GyroDeadzone);
if (config.ControllerType == ConfigControllerType.JoyconPair)
_rightMotionInput = _leftMotionInput;
}
private void ReadGamepadMotion(StandardControllerInputConfig controllerConfig, IGamepad gamepad)
{
if (gamepad.Features.HasFlag(GamepadFeaturesFlag.Motion))
{
Vector3 accelerometer = gamepad.GetMotionData(MotionInputId.Accelerometer);
Vector3 gyroscope = gamepad.GetMotionData(MotionInputId.Gyroscope);
accelerometer = new Vector3(accelerometer.X, -accelerometer.Z, accelerometer.Y);
gyroscope = new Vector3(gyroscope.X, -gyroscope.Z, gyroscope.Y);
_leftMotionInput.Update(accelerometer, gyroscope,
(ulong)PerformanceCounter.ElapsedNanoseconds / 1000,
controllerConfig.Motion.Sensitivity, (float)controllerConfig.Motion.GyroDeadzone);
if (controllerConfig.ControllerType == ConfigControllerType.JoyconPair)
{
_rightMotionInput = _leftMotionInput;
}
}
}
private void ReadCemuMotion(StandardControllerInputConfig controllerConfig)
{
if (controllerConfig.Motion is CemuHookMotionConfigController cemuControllerConfig)
{
int clientId = (int)controllerConfig.PlayerIndex;
// First of all ensure we are registered
_cemuHookClient.RegisterClient(clientId, cemuControllerConfig.DsuServerHost,
cemuControllerConfig.DsuServerPort);
// Then request and retrieve the data
_cemuHookClient.RequestData(clientId, cemuControllerConfig.Slot);
_cemuHookClient.TryGetData(clientId, cemuControllerConfig.Slot, out _leftMotionInput);
if (controllerConfig.ControllerType == ConfigControllerType.JoyconPair)
{
if (!cemuControllerConfig.MirrorInput)
{
_cemuHookClient.RequestData(clientId, cemuControllerConfig.AltSlot);
_cemuHookClient.TryGetData(clientId, cemuControllerConfig.AltSlot,
out _rightMotionInput);
}
else
{
_rightMotionInput = _leftMotionInput;
}
}
}
}
private void ReadMotion(IGamepad gamepad, StandardControllerInputConfig controllerConfig)
{
switch (controllerConfig.Motion.MotionBackend)
{
case MotionInputBackendType.GamepadDriver:
ReadGamepadMotion(controllerConfig, gamepad);
break;
case MotionInputBackendType.CemuHook:
ReadCemuMotion(controllerConfig);
break;
default:
break;
}
}
public void Update()
{
// _gamepad may be altered by other threads
@ -280,52 +367,14 @@ namespace Ryujinx.Input.HLE
if (gamepad != null && GamepadDriver != null)
{
State = gamepad.GetMappedStateSnapshot();
State = gamepad.GetMappedStateSnapshot(StandardControllerInputConfig?.Motion.SticksToMotion ?? false);
if (_config is StandardControllerInputConfig controllerConfig && controllerConfig.Motion.EnableMotion)
if (_config is StandardControllerInputConfig controllerConfig)
{
if (controllerConfig.Motion.MotionBackend == MotionInputBackendType.GamepadDriver)
{
if (gamepad.Features.HasFlag(GamepadFeaturesFlag.Motion))
{
Vector3 accelerometer = gamepad.GetMotionData(MotionInputId.Accelerometer);
Vector3 gyroscope = gamepad.GetMotionData(MotionInputId.Gyroscope);
accelerometer = new Vector3(accelerometer.X, -accelerometer.Z, accelerometer.Y);
gyroscope = new Vector3(gyroscope.X, -gyroscope.Z, gyroscope.Y);
_leftMotionInput.Update(accelerometer, gyroscope, (ulong)PerformanceCounter.ElapsedNanoseconds / 1000, controllerConfig.Motion.Sensitivity, (float)controllerConfig.Motion.GyroDeadzone);
if (controllerConfig.ControllerType == ConfigControllerType.JoyconPair)
{
_rightMotionInput = _leftMotionInput;
}
}
}
else if (controllerConfig.Motion.MotionBackend == MotionInputBackendType.CemuHook && controllerConfig.Motion is CemuHookMotionConfigController cemuControllerConfig)
{
int clientId = (int)controllerConfig.PlayerIndex;
// First of all ensure we are registered
_cemuHookClient.RegisterClient(clientId, cemuControllerConfig.DsuServerHost, cemuControllerConfig.DsuServerPort);
// Then request and retrieve the data
_cemuHookClient.RequestData(clientId, cemuControllerConfig.Slot);
_cemuHookClient.TryGetData(clientId, cemuControllerConfig.Slot, out _leftMotionInput);
if (controllerConfig.ControllerType == ConfigControllerType.JoyconPair)
{
if (!cemuControllerConfig.MirrorInput)
{
_cemuHookClient.RequestData(clientId, cemuControllerConfig.AltSlot);
_cemuHookClient.TryGetData(clientId, cemuControllerConfig.AltSlot, out _rightMotionInput);
}
else
{
_rightMotionInput = _leftMotionInput;
}
}
}
if (controllerConfig.Motion.SticksToMotion)
EmulateMotion(gamepad, controllerConfig);
else if (controllerConfig.Motion.EnableMotion)
ReadMotion(gamepad, controllerConfig);
}
}
else

View File

@ -50,6 +50,8 @@ namespace Ryujinx.Input.HLE
_gamepadDriver.OnGamepadDisconnected += HandleOnGamepadDisconnected;
}
public IEnumerable<NpadController> Controllers => _controllers;
private void RefreshInputConfigForHLE()
{
lock (_lock)

View File

@ -77,35 +77,39 @@ namespace Ryujinx.Input
/// Get a snaphost of the state of the gamepad that is remapped with the informations from the <see cref="InputConfig"/> set via <see cref="SetConfiguration(InputConfig)"/>.
/// </summary>
/// <returns>A remapped snaphost of the state of the gamepad.</returns>
GamepadStateSnapshot GetMappedStateSnapshot();
GamepadStateSnapshot GetMappedStateSnapshot(bool ignoreSticks);
/// <summary>
/// Get a snaphost of the state of the gamepad.
/// </summary>
/// <returns>A snaphost of the state of the gamepad.</returns>
GamepadStateSnapshot GetStateSnapshot();
GamepadStateSnapshot GetStateSnapshot(bool ignoreSticks);
/// <summary>
/// Get a snaphost of the state of a gamepad.
/// </summary>
/// <param name="gamepad">The gamepad to do a snapshot of</param>
/// <param name="ignoreSticks">Forces the stick states to zero</param>
/// <returns>A snaphost of the state of the gamepad.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static GamepadStateSnapshot GetStateSnapshot(IGamepad gamepad)
static GamepadStateSnapshot GetStateSnapshot(IGamepad gamepad, bool ignoreSticks)
{
// NOTE: Update Array size if JoystickInputId is changed.
Array3<Array2<float>> joysticksState = default;
for (StickInputId inputId = StickInputId.Left; inputId < StickInputId.Count; inputId++)
if (!ignoreSticks)
{
(float state0, float state1) = gamepad.GetStick(inputId);
for (StickInputId inputId = StickInputId.Left; inputId < StickInputId.Count; inputId++)
{
(float state0, float state1) = gamepad.GetStick(inputId);
Array2<float> state = default;
Array2<float> state = default;
state[0] = state0;
state[1] = state1;
state[0] = state0;
state[1] = state1;
joysticksState[(int)inputId] = state;
joysticksState[(int)inputId] = state;
}
}
// NOTE: Update Array size if GamepadInputId is changed.

View File

@ -1200,6 +1200,14 @@ namespace Ryujinx.Ava
_viewModel.Volume = Device.GetVolume();
break;
case KeyboardHotkeyState.ToggleMotionEmulation:
foreach (var controller in NpadManager.Controllers)
{
var motion = controller?.StandardControllerInputConfig?.Motion;
if (motion != null)
motion.SticksToMotion = !motion.SticksToMotion;
}
break;
case KeyboardHotkeyState.None:
(_keyboardInterface as AvaloniaKeyboard).Clear();
break;
@ -1273,6 +1281,10 @@ namespace Ryujinx.Ava
{
state = KeyboardHotkeyState.VolumeDown;
}
else if (_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.ToggleMotionEmulation))
{
state = KeyboardHotkeyState.ToggleMotionEmulation;
}
return state;
}

View File

@ -734,6 +734,7 @@
"RyujinxUpdaterMessage": "هل تريد تحديث ريوجينكس إلى أحدث إصدار؟",
"SettingsTabHotkeysVolumeUpHotkey": "زيادة مستوى الصوت:",
"SettingsTabHotkeysVolumeDownHotkey": "خفض مستوى الصوت:",
"SettingsTabHotkeysToggleMotionEmulationHotkey": "Toggle Motion Emulation:",
"SettingsEnableMacroHLE": "تمكين Maro HLE",
"SettingsEnableMacroHLETooltip": "محاكاة عالية المستوى لكود مايكرو وحدة معالجة الرسوميات.\n\nيعمل على تحسين الأداء، ولكنه قد يسبب خللا رسوميا في بعض الألعاب.\n\nاتركه مفعلا إذا لم تكن متأكدا.",
"SettingsEnableColorSpacePassthrough": "عبور مساحة اللون",

View File

@ -734,6 +734,7 @@
"RyujinxUpdaterMessage": "Möchtest du Ryujinx auf die neueste Version aktualisieren?",
"SettingsTabHotkeysVolumeUpHotkey": "Lautstärke erhöhen:",
"SettingsTabHotkeysVolumeDownHotkey": "Lautstärke verringern:",
"SettingsTabHotkeysToggleMotionEmulationHotkey": "Toggle Motion Emulation:",
"SettingsEnableMacroHLE": "HLE Makros aktivieren",
"SettingsEnableMacroHLETooltip": "High-Level-Emulation von GPU-Makrocode.\n\nVerbessert die Leistung, kann aber in einigen Spielen zu Grafikfehlern führen.\n\nBei Unsicherheit AKTIVIEREN.",
"SettingsEnableColorSpacePassthrough": "Farbraum Passthrough",

View File

@ -734,6 +734,7 @@
"RyujinxUpdaterMessage": "Θέλετε να ενημερώσετε το Ryujinx στην πιο πρόσφατη έκδοση:",
"SettingsTabHotkeysVolumeUpHotkey": "Αύξηση Έντασης:",
"SettingsTabHotkeysVolumeDownHotkey": "Μείωση Έντασης:",
"SettingsTabHotkeysToggleMotionEmulationHotkey": "Toggle Motion Emulation:",
"SettingsEnableMacroHLE": "Ενεργοποίηση του Macro HLE",
"SettingsEnableMacroHLETooltip": "Προσομοίωση του κώδικα GPU Macro .\n\nΒελτιώνει την απόδοση, αλλά μπορεί να προκαλέσει γραφικά προβλήματα σε μερικά παιχνίδια.\n\nΑφήστε ΕΝΕΡΓΟ αν δεν είστε σίγουροι.",
"SettingsEnableColorSpacePassthrough": "Διέλευση Χρωματικού Χώρου",

View File

@ -753,6 +753,7 @@
"RyujinxUpdaterMessage": "Do you want to update Ryujinx to the latest version?",
"SettingsTabHotkeysVolumeUpHotkey": "Increase Volume:",
"SettingsTabHotkeysVolumeDownHotkey": "Decrease Volume:",
"SettingsTabHotkeysToggleMotionEmulationHotkey": "Toggle Motion Emulation:",
"SettingsEnableMacroHLE": "Enable Macro HLE",
"SettingsEnableMacroHLETooltip": "High-level emulation of GPU Macro code.\n\nImproves performance, but may cause graphical glitches in some games.\n\nLeave ON if unsure.",
"SettingsEnableColorSpacePassthrough": "Color Space Passthrough",

View File

@ -734,6 +734,7 @@
"RyujinxUpdaterMessage": "¿Quieres actualizar Ryujinx a la última versión?",
"SettingsTabHotkeysVolumeUpHotkey": "Aumentar volumen:",
"SettingsTabHotkeysVolumeDownHotkey": "Disminuir volumen:",
"SettingsTabHotkeysToggleMotionEmulationHotkey": "Activar emulación de movimiento:",
"SettingsEnableMacroHLE": "Activar Macros HLE",
"SettingsEnableMacroHLETooltip": "Emulación alto-nivel del código de Macros de GPU\n\nIncrementa el rendimiento, pero puede causar errores gráficos en algunos juegos.\n\nDeja esta opción activada si no estás seguro.",
"SettingsEnableColorSpacePassthrough": "Paso de espacio de color",

View File

@ -734,6 +734,7 @@
"RyujinxUpdaterMessage": "Voulez-vous mettre à jour Ryujinx vers la dernière version ?",
"SettingsTabHotkeysVolumeUpHotkey": "Augmenter le volume :",
"SettingsTabHotkeysVolumeDownHotkey": "Diminuer le volume :",
"SettingsTabHotkeysToggleMotionEmulationHotkey": "Toggle Motion Emulation:",
"SettingsEnableMacroHLE": "Activer les macros HLE",
"SettingsEnableMacroHLETooltip": "Émulation de haut niveau du code de Macro GPU.\n\nAméliore les performances, mais peut causer des artefacts graphiques dans certains jeux.\n\nLaissez ACTIVER si vous n'êtes pas sûr.",
"SettingsEnableColorSpacePassthrough": "Traversée de l'espace colorimétrique",

View File

@ -734,6 +734,7 @@
"RyujinxUpdaterMessage": "האם ברצונך לעדכן את ריוג'ינקס לגרסא האחרונה?",
"SettingsTabHotkeysVolumeUpHotkey": "הגבר את עוצמת הקול:",
"SettingsTabHotkeysVolumeDownHotkey": "הנמך את עוצמת הקול:",
"SettingsTabHotkeysToggleMotionEmulationHotkey": "Toggle Motion Emulation:",
"SettingsEnableMacroHLE": "Enable Macro HLE",
"SettingsEnableMacroHLETooltip": "אמולצייה ברמה גבוהה של כרטיס גראפי עם קוד מקרו.\n\nמשפר את ביצועי היישום אך עלול לגרום לגליצ'ים חזותיים במשחקים מסויימים.\n\nמוטב להשאיר דלוק אם אינך בטוח.",
"SettingsEnableColorSpacePassthrough": "שקיפות מרחב צבע",

View File

@ -734,6 +734,7 @@
"RyujinxUpdaterMessage": "Vuoi aggiornare Ryujinx all'ultima versione?",
"SettingsTabHotkeysVolumeUpHotkey": "Alza il volume:",
"SettingsTabHotkeysVolumeDownHotkey": "Abbassa il volume:",
"SettingsTabHotkeysToggleMotionEmulationHotkey": "Toggle Motion Emulation:",
"SettingsEnableMacroHLE": "Attiva HLE macro",
"SettingsEnableMacroHLETooltip": "Emulazione di alto livello del codice macro della GPU.\n\nMigliora le prestazioni, ma può causare anomalie grafiche in alcuni giochi.\n\nNel dubbio, lascia l'opzione attiva.",
"SettingsEnableColorSpacePassthrough": "Passthrough dello spazio dei colori",

View File

@ -734,6 +734,7 @@
"RyujinxUpdaterMessage": "Ryujinx を最新版にアップデートしますか?",
"SettingsTabHotkeysVolumeUpHotkey": "音量を上げる:",
"SettingsTabHotkeysVolumeDownHotkey": "音量を下げる:",
"SettingsTabHotkeysToggleMotionEmulationHotkey": "Toggle Motion Emulation:",
"SettingsEnableMacroHLE": "マクロの高レベルエミュレーション (HLE) を有効にする",
"SettingsEnableMacroHLETooltip": "GPU マクロコードの高レベルエミュレーションです.\n\nパフォーマンスを向上させますが, 一部のゲームでグラフィックに不具合が発生する可能性があります.\n\nよくわからない場合はオンのままにしてください.",
"SettingsEnableColorSpacePassthrough": "色空間をパススルー",

View File

@ -734,6 +734,7 @@
"RyujinxUpdaterMessage": "Ryujinx를 최신 버전으로 업데이트하겠습니까?",
"SettingsTabHotkeysVolumeUpHotkey": "음량 증가 :",
"SettingsTabHotkeysVolumeDownHotkey": "음량 감소 :",
"SettingsTabHotkeysToggleMotionEmulationHotkey": "Toggle Motion Emulation:",
"SettingsEnableMacroHLE": "매크로 HLE 활성화",
"SettingsEnableMacroHLETooltip": "GPU 매크로 코드의 높은 수준 에뮬레이션입니다.\n\n성능이 향상되지만 일부 게임에서 그래픽 결함이 발생할 수 있습니다.\n\n확실하지 않으면 켜 두세요.",
"SettingsEnableColorSpacePassthrough": "색 공간 통과",

View File

@ -734,6 +734,7 @@
"RyujinxUpdaterMessage": "Czy chcesz zaktualizować Ryujinx do najnowszej wersji?",
"SettingsTabHotkeysVolumeUpHotkey": "Zwiększ Głośność:",
"SettingsTabHotkeysVolumeDownHotkey": "Zmniejsz Głośność:",
"SettingsTabHotkeysToggleMotionEmulationHotkey": "Toggle Motion Emulation:",
"SettingsEnableMacroHLE": "Włącz Macro HLE",
"SettingsEnableMacroHLETooltip": "Wysokopoziomowa emulacja kodu GPU Macro.\n\nPoprawia wydajność, ale może powodować błędy graficzne w niektórych grach.\n\nW razie wątpliwości pozostaw WŁĄCZONE.",
"SettingsEnableColorSpacePassthrough": "Przekazywanie przestrzeni kolorów",

View File

@ -734,6 +734,7 @@
"RyujinxUpdaterMessage": "Você quer atualizar o Ryujinx para a última versão?",
"SettingsTabHotkeysVolumeUpHotkey": "Aumentar volume:",
"SettingsTabHotkeysVolumeDownHotkey": "Diminuir volume:",
"SettingsTabHotkeysToggleMotionEmulationHotkey": "Toggle Motion Emulation:",
"SettingsEnableMacroHLE": "Habilitar emulação de alto nível para Macros",
"SettingsEnableMacroHLETooltip": "Habilita emulação de alto nível de códigos Macro da GPU.\n\nMelhora a performance, mas pode causar problemas gráficos em alguns jogos.\n\nEm caso de dúvida, deixe ATIVADO.",
"SettingsEnableColorSpacePassthrough": "Passagem de Espaço Cor",

View File

@ -734,6 +734,7 @@
"RyujinxUpdaterMessage": "Обновить Ryujinx до последней версии?",
"SettingsTabHotkeysVolumeUpHotkey": "Увеличить громкость:",
"SettingsTabHotkeysVolumeDownHotkey": "Уменьшить громкость:",
"SettingsTabHotkeysToggleMotionEmulationHotkey": "Toggle Motion Emulation:",
"SettingsEnableMacroHLE": "Использовать макрос высокоуровневой эмуляции видеоадаптера",
"SettingsEnableMacroHLETooltip": "Высокоуровневая эмуляции макрокода видеоадаптера.\n\nПовышает производительность, но может вызывать графические артефакты в некоторых играх.\n\nРекомендуется оставить включенным.",
"SettingsEnableColorSpacePassthrough": "Пропускать цветовое пространство",

View File

@ -734,6 +734,7 @@
"RyujinxUpdaterMessage": "คุณต้องการอัพเดต รียูจินซ์ เป็นเวอร์ชั่นล่าสุดหรือไม่?",
"SettingsTabHotkeysVolumeUpHotkey": "เพิ่มระดับเสียง:",
"SettingsTabHotkeysVolumeDownHotkey": "ลดระดับเสียง:",
"SettingsTabHotkeysToggleMotionEmulationHotkey": "Toggle Motion Emulation:",
"SettingsEnableMacroHLE": "เปิดใช้งาน มาโคร HLE",
"SettingsEnableMacroHLETooltip": "การจำลองระดับสูงของโค้ดมาโคร GPU\n\nปรับปรุงประสิทธิภาพ แต่อาจทำให้เกิดข้อผิดพลาดด้านกราฟิกในบางเกม\n\nปล่อยไว้หากคุณไม่แน่ใจ",
"SettingsEnableColorSpacePassthrough": "ทะลุผ่านพื้นที่สี",

View File

@ -734,6 +734,7 @@
"RyujinxUpdaterMessage": "Ryujinx'i en son sürüme güncellemek ister misiniz?",
"SettingsTabHotkeysVolumeUpHotkey": "Sesi Arttır:",
"SettingsTabHotkeysVolumeDownHotkey": "Sesi Azalt:",
"SettingsTabHotkeysToggleMotionEmulationHotkey": "Toggle Motion Emulation:",
"SettingsEnableMacroHLE": "Macro HLE'yi Aktifleştir",
"SettingsEnableMacroHLETooltip": "GPU Macro kodunun yüksek seviye emülasyonu.\n\nPerformansı arttırır, ama bazı oyunlarda grafik hatalarına yol açabilir.\n\nEmin değilseniz AÇIK bırakın.",
"SettingsEnableColorSpacePassthrough": "Renk Alanı Geçişi",

View File

@ -734,6 +734,7 @@
"RyujinxUpdaterMessage": "Бажаєте оновити Ryujinx до останньої версії?",
"SettingsTabHotkeysVolumeUpHotkey": "Збільшити гучність:",
"SettingsTabHotkeysVolumeDownHotkey": "Зменшити гучність:",
"SettingsTabHotkeysToggleMotionEmulationHotkey": "Toggle Motion Emulation:",
"SettingsEnableMacroHLE": "Увімкнути макрос HLE",
"SettingsEnableMacroHLETooltip": "Високорівнева емуляція коду макросу GPU.\n\nПокращує продуктивність, але може викликати графічні збої в деяких іграх.\n\nЗалиште увімкненим, якщо не впевнені.",
"SettingsEnableColorSpacePassthrough": "Наскрізний колірний простір",

View File

@ -734,6 +734,7 @@
"RyujinxUpdaterMessage": "是否更新 Ryujinx 到最新的版本?",
"SettingsTabHotkeysVolumeUpHotkey": "音量加:",
"SettingsTabHotkeysVolumeDownHotkey": "音量减:",
"SettingsTabHotkeysToggleMotionEmulationHotkey": "Toggle Motion Emulation:",
"SettingsEnableMacroHLE": "启用 HLE 宏加速",
"SettingsEnableMacroHLETooltip": "GPU 宏指令的高级模拟。\n\n提高性能表现但一些游戏可能会出现图形错误。\n\n如果不确定请保持开启状态。",
"SettingsEnableColorSpacePassthrough": "色彩空间直通",

View File

@ -734,6 +734,7 @@
"RyujinxUpdaterMessage": "您想將 Ryujinx 升級到最新版本嗎?",
"SettingsTabHotkeysVolumeUpHotkey": "提高音量:",
"SettingsTabHotkeysVolumeDownHotkey": "降低音量:",
"SettingsTabHotkeysToggleMotionEmulationHotkey": "Toggle Motion Emulation:",
"SettingsEnableMacroHLE": "啟用 Macro HLE",
"SettingsEnableMacroHLETooltip": "GPU 巨集程式碼的進階模擬。\n\n可提高效能但在某些遊戲中可能會導致圖形閃爍。\n\n如果不確定請保持開啟狀態。",
"SettingsEnableColorSpacePassthrough": "色彩空間直通",

View File

@ -12,5 +12,6 @@ namespace Ryujinx.Ava.Common
ResScaleDown,
VolumeUp,
VolumeDown,
ToggleMotionEmulation,
}
}

View File

@ -49,7 +49,7 @@ namespace Ryujinx.Ava.Input
return IKeyboard.GetStateSnapshot(this);
}
public GamepadStateSnapshot GetMappedStateSnapshot()
public GamepadStateSnapshot GetMappedStateSnapshot(bool _)
{
KeyboardStateSnapshot rawState = GetKeyboardStateSnapshot();
GamepadStateSnapshot result = default;
@ -85,7 +85,7 @@ namespace Ryujinx.Ava.Input
return result;
}
public GamepadStateSnapshot GetStateSnapshot()
public GamepadStateSnapshot GetStateSnapshot(bool _)
{
throw new NotSupportedException();
}

View File

@ -34,7 +34,7 @@ namespace Ryujinx.Ava.Input
return _driver.Scroll;
}
public GamepadStateSnapshot GetMappedStateSnapshot()
public GamepadStateSnapshot GetMappedStateSnapshot(bool _)
{
throw new NotImplementedException();
}
@ -44,7 +44,7 @@ namespace Ryujinx.Ava.Input
throw new NotImplementedException();
}
public GamepadStateSnapshot GetStateSnapshot()
public GamepadStateSnapshot GetStateSnapshot(bool _)
{
throw new NotImplementedException();
}

View File

@ -104,6 +104,17 @@ namespace Ryujinx.Ava.UI.Models.Input
}
}
private Key _toggleMotionEmulation;
public Key ToggleMotionEmulation
{
get => _toggleMotionEmulation;
set
{
_toggleMotionEmulation = value;
OnPropertyChanged();
}
}
public HotkeyConfig(KeyboardHotkeys config)
{
if (config != null)
@ -117,6 +128,7 @@ namespace Ryujinx.Ava.UI.Models.Input
ResScaleDown = config.ResScaleDown;
VolumeUp = config.VolumeUp;
VolumeDown = config.VolumeDown;
ToggleMotionEmulation = config.ToggleMotionEmulation;
}
}
@ -133,6 +145,7 @@ namespace Ryujinx.Ava.UI.Models.Input
ResScaleDown = ResScaleDown,
VolumeUp = VolumeUp,
VolumeDown = VolumeDown,
ToggleMotionEmulation = ToggleMotionEmulation,
};
return config;

View File

@ -1,4 +1,4 @@
<UserControl
<UserControl
x:Class="Ryujinx.Ava.UI.Views.Settings.SettingsHotkeysView"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@ -103,6 +103,12 @@
<TextBlock Text="{Binding KeyboardHotkey.VolumeDown, Converter={StaticResource Key}}" />
</ToggleButton>
</StackPanel>
<StackPanel>
<TextBlock Text="{locale:Locale SettingsTabHotkeysToggleMotionEmulationHotkey}" />
<ToggleButton Name="ToggleMotionEmulation">
<TextBlock Text="{Binding KeyboardHotkey.ToggleMotionEmulation, Converter={StaticResource Key}}" />
</ToggleButton>
</StackPanel>
</StackPanel>
</Border>
</ScrollViewer>

View File

@ -109,6 +109,9 @@ namespace Ryujinx.Ava.UI.Views.Settings
case "VolumeDown":
viewModel.KeyboardHotkey.VolumeDown = buttonValue.AsHidType<Key>();
break;
case "ToggleMotionEmulation":
viewModel.KeyboardHotkey.ToggleMotionEmulation = buttonValue.AsHidType<Key>();
break;
}
}
};