mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-06-02 18:39:14 +00:00
Compare commits
7 Commits
Canary-1.3
...
Canary-1.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b88fee78f | ||
|
|
04574103cf | ||
|
|
153d632ee2 | ||
|
|
824643e143 | ||
|
|
7be1708146 | ||
|
|
279c4cf3b4 | ||
|
|
fa72b5a298 |
@@ -68,7 +68,7 @@ jobs:
|
|||||||
sed -r --in-place 's/\%\%RYUJINX_BUILD_GIT_HASH\%\%/${{ steps.version_info.outputs.git_short_hash }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
|
sed -r --in-place 's/\%\%RYUJINX_BUILD_GIT_HASH\%\%/${{ steps.version_info.outputs.git_short_hash }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
|
||||||
sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_NAME\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_NAME }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
|
sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_NAME\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_NAME }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
|
||||||
sed -r --in-place 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/Config\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs
|
sed -r --in-place 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/Config\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs
|
||||||
sed -r --in-place '/^Name=Ryujinx$/s/Name=Ryujinx/Name=Ryujinx-Canary/' distribution/linux/Ryujinx.desktop
|
sed -r --in-place '/^Name=Ryujinx$/s/Name=Ryujinx/Name=Ryujinx-Canary/' distribution/linux/app.ryujinx.Ryujinx.desktop
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Create output dir
|
- name: Create output dir
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageVersion Include="Avalonia" Version="11.3.15" />
|
<PackageVersion Include="Avalonia" Version="11.3.17" />
|
||||||
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="11.3.13" />
|
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="11.3.13" />
|
||||||
<PackageVersion Include="Avalonia.Desktop" Version="11.3.15" />
|
<PackageVersion Include="Avalonia.Desktop" Version="11.3.17" />
|
||||||
<PackageVersion Include="Avalonia.Diagnostics" Version="11.3.15" />
|
<PackageVersion Include="Avalonia.Diagnostics" Version="11.3.17" />
|
||||||
<PackageVersion Include="Avalonia.Markup.Xaml.Loader" Version="11.3.15" />
|
<PackageVersion Include="Avalonia.Markup.Xaml.Loader" Version="11.3.17" />
|
||||||
<PackageVersion Include="SharpCompress" Version="0.48.1" />
|
<PackageVersion Include="SharpCompress" Version="0.48.1" />
|
||||||
<PackageVersion Include="Svg.Controls.Avalonia" Version="11.3.9.5" />
|
<PackageVersion Include="Svg.Controls.Avalonia" Version="11.3.9.5" />
|
||||||
<PackageVersion Include="Svg.Controls.Skia.Avalonia" Version="11.3.9.5" />
|
<PackageVersion Include="Svg.Controls.Skia.Avalonia" Version="11.3.9.5" />
|
||||||
@@ -52,8 +52,8 @@
|
|||||||
<PackageVersion Include="Gommon" Version="2.8.1.2" />
|
<PackageVersion Include="Gommon" Version="2.8.1.2" />
|
||||||
<PackageVersion Include="securifybv.ShellLink" Version="0.1.0" />
|
<PackageVersion Include="securifybv.ShellLink" Version="0.1.0" />
|
||||||
<PackageVersion Include="Sep" Version="0.14.1" />
|
<PackageVersion Include="Sep" Version="0.14.1" />
|
||||||
<PackageVersion Include="shaderc.net" Version="0.1.0" />
|
|
||||||
<PackageVersion Include="SharpZipLib" Version="1.4.2" />
|
<PackageVersion Include="SharpZipLib" Version="1.4.2" />
|
||||||
|
<PackageVersion Include="Silk.NET.Shaderc" Version="2.23.0" />
|
||||||
<PackageVersion Include="Silk.NET.Vulkan" Version="2.23.0" />
|
<PackageVersion Include="Silk.NET.Vulkan" Version="2.23.0" />
|
||||||
<PackageVersion Include="Silk.NET.Vulkan.Extensions.EXT" Version="2.23.0" />
|
<PackageVersion Include="Silk.NET.Vulkan.Extensions.EXT" Version="2.23.0" />
|
||||||
<PackageVersion Include="Silk.NET.Vulkan.Extensions.KHR" Version="2.23.0" />
|
<PackageVersion Include="Silk.NET.Vulkan.Extensions.KHR" Version="2.23.0" />
|
||||||
|
|||||||
@@ -1,23 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
SCRIPT_DIR=$(dirname "$(realpath "$0")")
|
SCRIPT_DIR=$(dirname "$(realpath "$0")")
|
||||||
|
|
||||||
if [ -f "$SCRIPT_DIR/Ryujinx.Headless.SDL3" ]; then
|
|
||||||
RYUJINX_BIN="Ryujinx.Headless.SDL3"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$SCRIPT_DIR/Ryujinx" ]; then
|
|
||||||
RYUJINX_BIN="Ryujinx"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$RYUJINX_BIN" ]; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
COMMAND="env LANG=C.UTF-8 DOTNET_EnableAlternateStackCheck=1"
|
COMMAND="env LANG=C.UTF-8 DOTNET_EnableAlternateStackCheck=1"
|
||||||
|
|
||||||
if command -v gamemoderun > /dev/null 2>&1; then
|
if command -v gamemoderun > /dev/null 2>&1; then
|
||||||
COMMAND="$COMMAND gamemoderun"
|
COMMAND="$COMMAND gamemoderun"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec $COMMAND "$SCRIPT_DIR/$RYUJINX_BIN" "$@"
|
exec $COMMAND "$SCRIPT_DIR/Ryujinx" "$@"
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Version=1.0
|
Version=1.5
|
||||||
Name=Ryujinx
|
Name=Ryujinx
|
||||||
Type=Application
|
Type=Application
|
||||||
Icon=Ryujinx
|
Icon=app.ryujinx.Ryujinx
|
||||||
Exec=Ryujinx.sh %f
|
Exec=Ryujinx.sh %f
|
||||||
Comment=A Nintendo Switch Emulator
|
|
||||||
GenericName=Nintendo Switch Emulator
|
GenericName=Nintendo Switch Emulator
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Categories=Game;Emulator;
|
Categories=Game;Emulator;
|
||||||
MimeType=application/x-nx-nca;application/x-nx-nro;application/x-nx-nso;application/x-nx-nsp;application/x-nx-xci;
|
MimeType=application/x-nx-nca;application/x-nx-nro;application/x-nx-nso;application/x-nx-nsp;application/x-nx-xci;
|
||||||
Keywords=Switch;Nintendo;Emulator;
|
|
||||||
StartupWMClass=Ryujinx
|
StartupWMClass=Ryujinx
|
||||||
PrefersNonDefaultGPU=true
|
PrefersNonDefaultGPU=true
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
CURRENTDIR="$(readlink -f "$(dirname "$0")")"
|
|
||||||
exec "$CURRENTDIR"/usr/bin/Ryujinx.sh "$@"
|
|
||||||
25
distribution/linux/appimage/app.ryujinx.Ryujinx.appdata.xml
Normal file
25
distribution/linux/appimage/app.ryujinx.Ryujinx.appdata.xml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<component type="desktop-application">
|
||||||
|
<id>app.ryujinx.Ryujinx</id>
|
||||||
|
<metadata_license>MIT</metadata_license>
|
||||||
|
<project_license>MIT</project_license>
|
||||||
|
<name>Ryujinx</name>
|
||||||
|
<summary>Nintendo Switch 1 emulator written in C#</summary>
|
||||||
|
<description>
|
||||||
|
<p>Ryujinx is an open-source Nintendo Switch emulator, originally created by gdkchan, written in C#.</p>
|
||||||
|
</description>
|
||||||
|
<launchable type="desktop-id">app.ryujinx.Ryujinx.desktop</launchable>
|
||||||
|
<url type="homepage">https://ryujinx.app/</url>
|
||||||
|
<developer id="app.ryujinx">
|
||||||
|
<name>Ryubing</name>
|
||||||
|
</developer>
|
||||||
|
<screenshots>
|
||||||
|
<screenshot type="default">
|
||||||
|
<image>https://git.ryujinx.app/projects/Ryubing/raw/branch/master/docs/shell.png</image>
|
||||||
|
</screenshot>
|
||||||
|
</screenshots>
|
||||||
|
<provides>
|
||||||
|
<id>app.ryujinx.Ryujinx.desktop</id>
|
||||||
|
</provides>
|
||||||
|
<content_rating type="oars-1.1" />
|
||||||
|
</component>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/usr/bin/env sh
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
ROOTDIR="$(readlink -f "$(dirname "$0")")"/../../../
|
ROOTDIR="$(readlink -f "$(dirname "$0")")"/../../../
|
||||||
@@ -7,20 +7,33 @@ cd "$ROOTDIR"
|
|||||||
BUILDDIR=${BUILDDIR:-publish}
|
BUILDDIR=${BUILDDIR:-publish}
|
||||||
OUTDIR=${OUTDIR:-publish_appimage}
|
OUTDIR=${OUTDIR:-publish_appimage}
|
||||||
|
|
||||||
|
# AppStream
|
||||||
|
|
||||||
rm -rf AppDir
|
rm -rf AppDir
|
||||||
mkdir -p AppDir/usr/bin
|
mkdir -p AppDir/usr/lib AppDir/usr/bin
|
||||||
|
mkdir -p AppDir/usr/share/metainfo AppDir/usr/share/applications
|
||||||
|
mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps/
|
||||||
|
|
||||||
cp distribution/linux/Ryujinx.desktop AppDir/Ryujinx.desktop
|
cp -r "$BUILDDIR"/* AppDir/usr/lib/
|
||||||
cp distribution/linux/appimage/AppRun AppDir/AppRun
|
|
||||||
cp distribution/misc/Logo.svg AppDir/Ryujinx.svg
|
|
||||||
|
|
||||||
|
cp distribution/linux/appimage/app.ryujinx.Ryujinx.appdata.xml AppDir/usr/share/metainfo/app.ryujinx.Ryujinx.appdata.xml
|
||||||
|
cp distribution/linux/app.ryujinx.Ryujinx.desktop AppDir/usr/share/applications/app.ryujinx.Ryujinx.desktop
|
||||||
|
cp distribution/misc/Logo.png AppDir/usr/share/icons/hicolor/256x256/apps/app.ryujinx.Ryujinx.png
|
||||||
|
ln -s ../lib/Ryujinx AppDir/usr/bin/Ryujinx
|
||||||
|
|
||||||
cp -r "$BUILDDIR"/* AppDir/usr/bin/
|
# AppImage Root
|
||||||
|
|
||||||
|
ln -s ./usr/share/applications/app.ryujinx.Ryujinx.desktop AppDir/app.ryujinx.Ryujinx.desktop
|
||||||
|
ln -s ./usr/share/icons/hicolor/256x256/apps/app.ryujinx.Ryujinx.png AppDir/.DirIcon
|
||||||
|
ln -s ./usr/share/icons/hicolor/256x256/apps/app.ryujinx.Ryujinx.png AppDir/app.ryujinx.Ryujinx.png
|
||||||
|
ln -s ./usr/lib/Ryujinx.sh AppDir/AppRun
|
||||||
|
|
||||||
# Ensure necessary bins are set as executable
|
# Ensure necessary bins are set as executable
|
||||||
chmod +x AppDir/AppRun AppDir/usr/bin/Ryujinx*
|
chmod +x AppDir/AppRun AppDir/usr/bin/Ryujinx*
|
||||||
|
|
||||||
mkdir -p "$OUTDIR"
|
mkdir -p "$OUTDIR"
|
||||||
|
|
||||||
|
# The "-n" flag removes the appstream checks during build, in case the main website is down.
|
||||||
|
# Run "appstreamcli validate --explain AppDir/usr/share/metainfo/app.ryujinx.Ryujinx.appdata.xml" to check manually
|
||||||
appimagetool --appimage-extract-and-run -n --comp zstd --mksquashfs-opt -Xcompression-level --mksquashfs-opt 21 \
|
appimagetool --appimage-extract-and-run -n --comp zstd --mksquashfs-opt -Xcompression-level --mksquashfs-opt 21 \
|
||||||
AppDir "$OUTDIR"/Ryujinx.AppImage
|
AppDir "$OUTDIR"/Ryujinx.AppImage
|
||||||
|
|||||||
BIN
distribution/misc/Logo.png
Normal file
BIN
distribution/misc/Logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 1.2 MiB |
@@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="OpenTK.Windowing.GraphicsLibraryFramework" />
|
<PackageReference Include="OpenTK.Windowing.GraphicsLibraryFramework" />
|
||||||
<PackageReference Include="shaderc.net" />
|
<PackageReference Include="Silk.NET.Shaderc" ExcludeAssets="native" />
|
||||||
<PackageReference Include="Silk.NET.Vulkan" />
|
<PackageReference Include="Silk.NET.Vulkan" />
|
||||||
<PackageReference Include="Silk.NET.Vulkan.Extensions.EXT" />
|
<PackageReference Include="Silk.NET.Vulkan.Extensions.EXT" />
|
||||||
<PackageReference Include="Silk.NET.Vulkan.Extensions.KHR" />
|
<PackageReference Include="Silk.NET.Vulkan.Extensions.KHR" />
|
||||||
|
|||||||
@@ -1,22 +1,17 @@
|
|||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Graphics.GAL;
|
using Ryujinx.Graphics.GAL;
|
||||||
using Ryujinx.Graphics.Shader;
|
using Ryujinx.Graphics.Shader;
|
||||||
using shaderc;
|
using Silk.NET.Shaderc;
|
||||||
using Silk.NET.Vulkan;
|
using Silk.NET.Vulkan;
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Result = shaderc.Result;
|
|
||||||
|
|
||||||
namespace Ryujinx.Graphics.Vulkan
|
namespace Ryujinx.Graphics.Vulkan
|
||||||
{
|
{
|
||||||
class Shader : IDisposable
|
class Shader : IDisposable
|
||||||
{
|
{
|
||||||
// The shaderc.net dependency's Options constructor and dispose are not thread safe.
|
|
||||||
// Take this lock when using them.
|
|
||||||
private static readonly Lock _shaderOptionsLock = new();
|
|
||||||
|
|
||||||
private static readonly nint _ptrMainEntryPointName = Marshal.StringToHGlobalAnsi("main");
|
private static readonly nint _ptrMainEntryPointName = Marshal.StringToHGlobalAnsi("main");
|
||||||
|
|
||||||
private readonly Vk _api;
|
private readonly Vk _api;
|
||||||
@@ -75,38 +70,33 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
|
|
||||||
private unsafe static byte[] GlslToSpirv(string glsl, ShaderStage stage)
|
private unsafe static byte[] GlslToSpirv(string glsl, ShaderStage stage)
|
||||||
{
|
{
|
||||||
Options options;
|
Shaderc api = Shaderc.GetApi();
|
||||||
|
Compiler* compiler = api.CompilerInitialize();
|
||||||
|
CompileOptions* options = api.CompileOptionsInitialize();
|
||||||
|
|
||||||
lock (_shaderOptionsLock)
|
api.CompileOptionsSetSourceLanguage(options, SourceLanguage.Glsl);
|
||||||
|
api.CompileOptionsSetTargetSpirv(options, SpirvVersion.Shaderc15);
|
||||||
|
api.CompileOptionsSetTargetEnv(options, TargetEnv.Vulkan, Vk.Version12);
|
||||||
|
|
||||||
|
CompilationResult* scr = api.CompileIntoSpv(compiler, glsl, (nuint)glsl.Length, GetShaderCShaderStage(stage), "Ryu", "main", options);
|
||||||
|
|
||||||
|
CompilationStatus status = api.ResultGetCompilationStatus(scr);
|
||||||
|
|
||||||
|
if (status != CompilationStatus.Success)
|
||||||
{
|
{
|
||||||
options = new Options(false)
|
Logger.Error?.Print(LogClass.Gpu, $"Shader compilation error: {status} {api.ResultGetErrorMessageS(scr)}");
|
||||||
{
|
|
||||||
SourceLanguage = SourceLanguage.Glsl,
|
|
||||||
TargetSpirVVersion = new SpirVVersion(1, 5),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
options.SetTargetEnvironment(TargetEnvironment.Vulkan, EnvironmentVersion.Vulkan_1_2);
|
|
||||||
Compiler compiler = new(options);
|
|
||||||
Result scr = compiler.Compile(glsl, "Ryu", GetShaderCShaderStage(stage));
|
|
||||||
|
|
||||||
lock (_shaderOptionsLock)
|
|
||||||
{
|
|
||||||
options.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scr.Status != Status.Success)
|
|
||||||
{
|
|
||||||
Logger.Error?.Print(LogClass.Gpu, $"Shader compilation error: {scr.Status} {scr.ErrorMessage}");
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Span<byte> spirvBytes = new((void*)scr.CodePointer, (int)scr.CodeLength);
|
Span<byte> spirvBytes = new(api.ResultGetBytes(scr), (int)api.ResultGetLength(scr));
|
||||||
|
|
||||||
byte[] code = new byte[(scr.CodeLength + 3) & ~3];
|
byte[] code = new byte[(spirvBytes.Length + 3) & ~3];
|
||||||
|
|
||||||
spirvBytes.CopyTo(code.AsSpan()[..(int)scr.CodeLength]);
|
spirvBytes.CopyTo(code.AsSpan()[..spirvBytes.Length]);
|
||||||
|
|
||||||
|
api.CompilerRelease(compiler);
|
||||||
|
api.CompileOptionsRelease(options);
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,9 +155,7 @@ namespace Ryujinx.Input.SDL3
|
|||||||
result |= GamepadFeaturesFlag.Led;
|
result |= GamepadFeaturesFlag.Led;
|
||||||
}
|
}
|
||||||
SDL_UnlockProperties(propID);
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -331,18 +331,28 @@ namespace Ryujinx.Input.SDL3
|
|||||||
|
|
||||||
public IEnumerable<IGamepad> GetGamepads()
|
public IEnumerable<IGamepad> GetGamepads()
|
||||||
{
|
{
|
||||||
string[] ids;
|
lock (_gamepadsIds)
|
||||||
lock (_lock)
|
|
||||||
{
|
{
|
||||||
ids = _gamepadsIds.Values
|
foreach (var gamepad in _gamepadsIds)
|
||||||
.Concat(_joyConsIds.Values)
|
{
|
||||||
.Concat(_linkedJoyConsIds.Values)
|
yield return GetGamepad(gamepad.Value);
|
||||||
.ToArray();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (string id in ids)
|
lock (_joyConsIds)
|
||||||
{
|
{
|
||||||
yield return GetGamepad(id);
|
foreach (var gamepad in _joyConsIds)
|
||||||
|
{
|
||||||
|
yield return GetGamepad(gamepad.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lock (_linkedJoyConsIds)
|
||||||
|
{
|
||||||
|
foreach (var gamepad in _linkedJoyConsIds)
|
||||||
|
{
|
||||||
|
yield return GetGamepad(gamepad.Value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -561,24 +561,25 @@ namespace Ryujinx.Input.HLE
|
|||||||
!controllerConfig.Rumble.EnableRumble)
|
!controllerConfig.Rumble.EnableRumble)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VibrationValue leftVibrationValue = dualVibrationValue.Item1;
|
VibrationValue leftVibrationValue = dualVibrationValue.Item1;
|
||||||
VibrationValue rightVibrationValue = dualVibrationValue.Item2;
|
VibrationValue rightVibrationValue = dualVibrationValue.Item2;
|
||||||
|
|
||||||
leftVibrationValue.AmplitudeLow *= controllerConfig.Rumble.WeakRumble;
|
leftVibrationValue.AmplitudeLow *= controllerConfig.Rumble.WeakRumble;
|
||||||
leftVibrationValue.AmplitudeHigh *= controllerConfig.Rumble.StrongRumble;
|
leftVibrationValue.AmplitudeHigh *= controllerConfig.Rumble.StrongRumble;
|
||||||
rightVibrationValue.AmplitudeLow *= controllerConfig.Rumble.WeakRumble;
|
rightVibrationValue.AmplitudeLow *= controllerConfig.Rumble.WeakRumble;
|
||||||
rightVibrationValue.AmplitudeHigh *= controllerConfig.Rumble.StrongRumble;
|
rightVibrationValue.AmplitudeHigh *= controllerConfig.Rumble.StrongRumble;
|
||||||
|
|
||||||
if (!controllerConfig.Rumble.UseHDRumble || _gamepad?.HDRumble(leftVibrationValue, rightVibrationValue) == false)
|
if (!controllerConfig.Rumble.UseHDRumble || _gamepad?.HDRumble(leftVibrationValue, rightVibrationValue) == false)
|
||||||
{
|
{
|
||||||
float low = Math.Min(1f, (float)((rightVibrationValue.AmplitudeLow * 0.85 + rightVibrationValue.AmplitudeHigh * 0.15)));
|
float low = Math.Min(1f, (float)((rightVibrationValue.AmplitudeLow * 0.85 + rightVibrationValue.AmplitudeHigh * 0.15)));
|
||||||
float high = Math.Min(1f, (float)((leftVibrationValue.AmplitudeLow * 0.15 + leftVibrationValue.AmplitudeHigh * 0.85)));
|
float high = Math.Min(1f, (float)((leftVibrationValue.AmplitudeLow * 0.15 + leftVibrationValue.AmplitudeHigh * 0.85)));
|
||||||
_gamepad?.Rumble(low, high, 0xFFFFFFFF);
|
_gamepad?.Rumble(low, high, 0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Debug?.Print(LogClass.Hid, $"Effect for {controllerConfig.PlayerIndex} " +
|
Logger.Debug?.Print(LogClass.Hid, $"Effect for {controllerConfig.PlayerIndex} " +
|
||||||
// Value=value/multiplier * multiplier (result)
|
// Value=value/multiplier * multiplier (result)
|
||||||
$"L.low.amp={leftVibrationValue.AmplitudeLow / controllerConfig.Rumble.WeakRumble} * {controllerConfig.Rumble.WeakRumble} ({leftVibrationValue.AmplitudeLow}), " +
|
$"L.low.amp={leftVibrationValue.AmplitudeLow / controllerConfig.Rumble.WeakRumble} * {controllerConfig.Rumble.WeakRumble} ({leftVibrationValue.AmplitudeLow}), " +
|
||||||
$"L.high.amp={leftVibrationValue.AmplitudeHigh / controllerConfig.Rumble.WeakRumble} * {controllerConfig.Rumble.WeakRumble} ({leftVibrationValue.AmplitudeHigh}), " +
|
$"L.high.amp={leftVibrationValue.AmplitudeHigh / controllerConfig.Rumble.WeakRumble} * {controllerConfig.Rumble.WeakRumble} ({leftVibrationValue.AmplitudeHigh}), " +
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using Key = Ryujinx.Input.Key;
|
using Key = Ryujinx.Input.Key;
|
||||||
|
using HidKey = Ryujinx.Common.Configuration.Hid.Key;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.UI.Helpers
|
namespace Ryujinx.Ava.UI.Helpers
|
||||||
{
|
{
|
||||||
@@ -55,6 +56,9 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||||||
Key key => KeyboardLayoutLocaleHelper.TryGetSemanticLabel(key, out string localizedKeyLabel)
|
Key key => KeyboardLayoutLocaleHelper.TryGetSemanticLabel(key, out string localizedKeyLabel)
|
||||||
? localizedKeyLabel
|
? localizedKeyLabel
|
||||||
: key.ToString(),
|
: key.ToString(),
|
||||||
|
HidKey key => KeyboardLayoutLocaleHelper.TryGetSemanticLabel((Key)(int)key, out string localizedHidKeyLabel)
|
||||||
|
? localizedHidKeyLabel
|
||||||
|
: key.ToString(),
|
||||||
PhysicalKey physicalKey => PhysicalKeyLabelHelper.GetDisplayString(physicalKey),
|
PhysicalKey physicalKey => PhysicalKeyLabelHelper.GetDisplayString(physicalKey),
|
||||||
GamepadInputId gamepadInputId => GetLocalizedMappedValue(gamepadInputId, _gamepadInputIdMap),
|
GamepadInputId gamepadInputId => GetLocalizedMappedValue(gamepadInputId, _gamepadInputIdMap),
|
||||||
StickInputId stickInputId => GetLocalizedMappedValue(stickInputId, _stickInputIdMap),
|
StickInputId stickInputId => GetLocalizedMappedValue(stickInputId, _stickInputIdMap),
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Avalonia.Svg.Skia;
|
|||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using Ryujinx.Ava.UI.Models.Input;
|
using Ryujinx.Ava.UI.Models.Input;
|
||||||
using Ryujinx.Ava.UI.Views.Input;
|
using Ryujinx.Ava.UI.Views.Input;
|
||||||
|
using Ryujinx.Common.Helper;
|
||||||
using Ryujinx.Common.Utilities;
|
using Ryujinx.Common.Utilities;
|
||||||
using Ryujinx.UI.Views.Input;
|
using Ryujinx.UI.Views.Input;
|
||||||
|
|
||||||
@@ -59,32 +60,46 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||||||
public partial SvgImage Image { get; set; }
|
public partial SvgImage Image { get; set; }
|
||||||
public InputViewModel ParentModel { get; }
|
public InputViewModel ParentModel { get; }
|
||||||
|
|
||||||
|
private readonly RefEvent<System.Drawing.Color>.Handler _rainbowLedHandler;
|
||||||
|
|
||||||
public ControllerInputViewModel(InputViewModel model, GamepadInputConfig config, StickVisualizer visualizer)
|
public ControllerInputViewModel(InputViewModel model, GamepadInputConfig config, StickVisualizer visualizer)
|
||||||
{
|
{
|
||||||
ParentModel = model;
|
ParentModel = model;
|
||||||
Visualizer = visualizer;
|
Visualizer = visualizer;
|
||||||
|
_rainbowLedHandler = SetRainbowLed;
|
||||||
|
|
||||||
model.NotifyChangesEvent += OnParentModelChanged;
|
model.NotifyChangesEvent += OnParentModelChanged;
|
||||||
OnParentModelChanged();
|
OnParentModelChanged();
|
||||||
config.PropertyChanged += (_, args) =>
|
config.PropertyChanged += OnConfigPropertyChanged;
|
||||||
{
|
|
||||||
if (args.PropertyName is nameof(Config.UseRainbowLed))
|
|
||||||
{
|
|
||||||
if (Config is { UseRainbowLed: true, TurnOffLed: false, EnableLedChanging: true })
|
|
||||||
Rainbow.Updated += (ref color) => ParentModel.SelectedGamepad.SetLed((uint)color.ToArgb());
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Rainbow.Reset();
|
|
||||||
|
|
||||||
if (Config.TurnOffLed)
|
|
||||||
ParentModel.SelectedGamepad.ClearLed();
|
|
||||||
else
|
|
||||||
ParentModel.SelectedGamepad.SetLed(Config.LedColor.ToUInt32());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Config = config;
|
Config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnConfigPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs args)
|
||||||
|
{
|
||||||
|
if (args.PropertyName is nameof(Config.UseRainbowLed))
|
||||||
|
{
|
||||||
|
if (Config is { UseRainbowLed: true, TurnOffLed: false, EnableLedChanging: true })
|
||||||
|
{
|
||||||
|
Rainbow.Updated -= _rainbowLedHandler;
|
||||||
|
Rainbow.Updated += _rainbowLedHandler;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Rainbow.Reset();
|
||||||
|
|
||||||
|
if (Config.TurnOffLed)
|
||||||
|
ParentModel.SelectedGamepad.ClearLed();
|
||||||
|
else
|
||||||
|
ParentModel.SelectedGamepad.SetLed(Config.LedColor.ToUInt32());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetRainbowLed(ref System.Drawing.Color color)
|
||||||
|
{
|
||||||
|
ParentModel.SelectedGamepad.SetLed((uint)color.ToArgb());
|
||||||
|
}
|
||||||
|
|
||||||
public async void ShowMotionConfig()
|
public async void ShowMotionConfig()
|
||||||
{
|
{
|
||||||
await MotionInputView.Show(this);
|
await MotionInputView.Show(this);
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ using Ryujinx.Input.SDL3;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Drawing;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
@@ -81,10 +80,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||||||
|
|
||||||
field = value;
|
field = value;
|
||||||
|
|
||||||
if ((field?.Features & GamepadFeaturesFlag.Led) != 0 &&
|
|
||||||
ConfigViewModel is ControllerInputViewModel { Config.UseRainbowLed: true })
|
|
||||||
Rainbow.Updated += (ref Color color) => field.SetLed((uint)color.ToArgb());
|
|
||||||
|
|
||||||
OnPropertiesChanged(nameof(HasLed), nameof(CanClearLed));
|
OnPropertiesChanged(nameof(HasLed), nameof(CanClearLed));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user