Compare commits

...

5 Commits

Author SHA1 Message Date
Evan Husted
9c82d98ec4 headless: Add Ignore Controller Applet as a configurable option 2024-11-10 15:48:07 -06:00
Evan Husted
4aae82bad1 misc: Small cleanups 2024-11-10 15:34:24 -06:00
Vladimir Sokolov
299be822c4 UI: fix: when switching players, it would show old config (#122)
When switching between players' gamepads while saving settings, then
returning to the previous player, the settings show the default settings
instead of the actual settings applied
2024-11-09 23:24:17 -06:00
Jacobwasbeast
b17e4f79fb Adds the ability to read a amiibo's nickname from the VirtualAmiiboFile (#217)
This feature adds a way to change the Amiibo's nickname inside Smash and
other places where it's used, so it’s not always "Ryujinx." However, I
did not add a GUI or create the Cabinet applet that would allow users to
change this. So you will have to go to system/amiibo and find your
amiibo id to change it.
2024-11-09 21:18:50 -06:00
Piplup
a7b58df3fe Appimage Round 2 (#73) 2024-11-09 19:30:19 -06:00
19 changed files with 239 additions and 120 deletions

View File

@@ -74,36 +74,36 @@ jobs:
chmod +x ./publish_sdl2_headless/Ryujinx.Headless.SDL2 ./publish_sdl2_headless/Ryujinx.sh chmod +x ./publish_sdl2_headless/Ryujinx.Headless.SDL2 ./publish_sdl2_headless/Ryujinx.sh
if: github.event_name == 'pull_request' && matrix.platform.os == 'ubuntu-latest' if: github.event_name == 'pull_request' && matrix.platform.os == 'ubuntu-latest'
#- name: Build AppImage - name: Build AppImage
# if: github.event_name == 'pull_request' && matrix.platform.os == 'ubuntu-latest' if: github.event_name == 'pull_request' && matrix.platform.os == 'ubuntu-latest'
# run: | run: |
# PLATFORM_NAME="${{ matrix.platform.name }}" PLATFORM_NAME="${{ matrix.platform.name }}"
# sudo apt install -y zsync desktop-file-utils appstream sudo apt install -y zsync desktop-file-utils appstream
# mkdir -p tools mkdir -p tools
# export PATH="$PATH:$(readlink -f tools)" export PATH="$PATH:$(readlink -f tools)"
# # Setup appimagetool # Setup appimagetool
# wget -q -O tools/appimagetool "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage" wget -q -O tools/appimagetool "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage"
# chmod +x tools/appimagetool chmod +x tools/appimagetool
# chmod +x distribution/linux/appimage/build-appimage.sh chmod +x distribution/linux/appimage/build-appimage.sh
# Explicitly set $ARCH for appimagetool ($ARCH_NAME is for the file name) # Explicitly set $ARCH for appimagetool ($ARCH_NAME is for the file name)
# if [ "$PLATFORM_NAME" = "linux-x64" ]; then if [ "$PLATFORM_NAME" = "linux-x64" ]; then
# ARCH_NAME=x64 ARCH_NAME=x64
# export ARCH=x86_64 export ARCH=x86_64
# elif [ "$PLATFORM_NAME" = "linux-arm64" ]; then elif [ "$PLATFORM_NAME" = "linux-arm64" ]; then
# ARCH_NAME=arm64 ARCH_NAME=arm64
# export ARCH=aarch64 export ARCH=aarch64
# else else
# echo "Unexpected PLATFORM_NAME "$PLATFORM_NAME"" echo "Unexpected PLATFORM_NAME "$PLATFORM_NAME""
# exit 1 exit 1
# fi fi
# export UFLAG="gh-releases-zsync|${{ github.repository_owner }}|${{ github.event.repository.name }}|latest|*-$ARCH_NAME.AppImage.zsync" export UFLAG="gh-releases-zsync|${{ github.repository_owner }}|${{ github.event.repository.name }}|latest|*-$ARCH_NAME.AppImage.zsync"
# BUILDDIR=publish OUTDIR=publish_appimage distribution/linux/appimage/build-appimage.sh BUILDDIR=publish OUTDIR=publish_appimage distribution/linux/appimage/build-appimage.sh
# shell: bash shell: bash
- name: Upload Ryujinx artifact - name: Upload Ryujinx artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@@ -112,12 +112,12 @@ jobs:
path: publish path: publish
if: github.event_name == 'pull_request' && matrix.platform.os != 'macos-13' if: github.event_name == 'pull_request' && matrix.platform.os != 'macos-13'
#- name: Upload Ryujinx (AppImage) artifact - name: Upload Ryujinx (AppImage) artifact
# uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
# if: github.event_name == 'pull_request' && matrix.platform.os == 'ubuntu-latest' if: github.event_name == 'pull_request' && matrix.platform.os == 'ubuntu-latest'
# with: with:
# name: ryujinx-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-${{ matrix.platform.zip_os_name }}-AppImage name: ryujinx-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-${{ matrix.platform.zip_os_name }}-AppImage
# path: publish_appimage path: publish_appimage
- name: Upload Ryujinx.Headless.SDL2 artifact - name: Upload Ryujinx.Headless.SDL2 artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4

View File

@@ -101,83 +101,79 @@ jobs:
- name: Publish - name: Publish
run: | run: |
dotnet publish -c Release -r "${{ matrix.platform.name }}" -o ./publish_ava/publish -p:Version="${{ steps.version_info.outputs.build_version }}" -p:SourceRevisionId="${{ steps.version_info.outputs.git_short_hash }}" -p:DebugType=embedded src/Ryujinx --self-contained -p:IncludeNativeLibrariesForSelfExtract=true dotnet publish -c Release -r "${{ matrix.platform.name }}" -o ./publish -p:Version="${{ steps.version_info.outputs.build_version }}" -p:SourceRevisionId="${{ steps.version_info.outputs.git_short_hash }}" -p:DebugType=embedded src/Ryujinx --self-contained -p:IncludeNativeLibrariesForSelfExtract=true
dotnet publish -c Release -r "${{ matrix.platform.name }}" -o ./publish_sdl2_headless/publish -p:Version="${{ steps.version_info.outputs.build_version }}" -p:SourceRevisionId="${{ steps.version_info.outputs.git_short_hash }}" -p:DebugType=embedded src/Ryujinx.Headless.SDL2 --self-contained -p:IncludeNativeLibrariesForSelfExtract=true dotnet publish -c Release -r "${{ matrix.platform.name }}" -o ./publish_sdl2_headless -p:Version="${{ steps.version_info.outputs.build_version }}" -p:SourceRevisionId="${{ steps.version_info.outputs.git_short_hash }}" -p:DebugType=embedded src/Ryujinx.Headless.SDL2 --self-contained -p:IncludeNativeLibrariesForSelfExtract=true
- name: Packing Windows builds - name: Packing Windows builds
if: matrix.platform.os == 'windows-latest' if: matrix.platform.os == 'windows-latest'
run: | run: |
pushd publish_ava pushd publish
rm publish/libarmeilleure-jitsupport.dylib rm libarmeilleure-jitsupport.dylib
7z a ../release_output/ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.zip publish 7z a ../release_output/ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.zip ../publish
popd popd
pushd publish_sdl2_headless pushd publish_sdl2_headless
rm publish/libarmeilleure-jitsupport.dylib rm libarmeilleure-jitsupport.dylib
7z a ../release_output/sdl2-ryujinx-headless-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.zip publish 7z a ../release_output/sdl2-ryujinx-headless-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.zip ../publish
popd
shell: bash
- name: Build AppImage (Linux)
if: matrix.platform.os == 'ubuntu-latest'
run: |
BUILD_VERSION="${{ steps.version_info.outputs.build_version }}"
PLATFORM_NAME="${{ matrix.platform.name }}"
sudo apt install -y zsync desktop-file-utils appstream
mkdir -p tools
export PATH="$PATH:$(readlink -f tools)"
# Setup appimagetool
wget -q -O tools/appimagetool "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage"
chmod +x tools/appimagetool
chmod +x distribution/linux/appimage/build-appimage.sh
# Explicitly set $ARCH for appimagetool ($ARCH_NAME is for the file name)
if [ "$PLATFORM_NAME" = "linux-x64" ]; then
ARCH_NAME=x64
export ARCH=x86_64
elif [ "$PLATFORM_NAME" = "linux-arm64" ]; then
ARCH_NAME=arm64
export ARCH=aarch64
else
echo "Unexpected PLATFORM_NAME "$PLATFORM_NAME""
exit 1
fi
export UFLAG="gh-releases-zsync|${{ github.repository_owner }}|${{ github.event.repository.name }}|latest|*-$ARCH_NAME.AppImage.zsync"
BUILDDIR=publish OUTDIR=publish_appimage distribution/linux/appimage/build-appimage.sh
pushd publish_appimage
mv Ryujinx.AppImage ../release_output/ryujinx-$BUILD_VERSION-$ARCH_NAME.AppImage
mv Ryujinx.AppImage.zsync ../release_output/ryujinx-$BUILD_VERSION-$ARCH_NAME.AppImage.zsync
popd popd
shell: bash shell: bash
- name: Packing Linux builds - name: Packing Linux builds
if: matrix.platform.os == 'ubuntu-latest' if: matrix.platform.os == 'ubuntu-latest'
run: | run: |
pushd publish_ava pushd publish
rm publish/libarmeilleure-jitsupport.dylib chmod +x Ryujinx.sh Ryujinx
chmod +x publish/Ryujinx.sh publish/Ryujinx tar -czvf ../release_output/ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz ../publish
tar -czvf ../release_output/ryujinx-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz publish
popd popd
pushd publish_sdl2_headless pushd publish_sdl2_headless
rm publish/libarmeilleure-jitsupport.dylib chmod +x Ryujinx.sh Ryujinx.Headless.SDL2
chmod +x publish/Ryujinx.sh publish/Ryujinx.Headless.SDL2 tar -czvf ../release_output/sdl2-ryujinx-headless-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz ../publish
tar -czvf ../release_output/sdl2-ryujinx-headless-${{ steps.version_info.outputs.build_version }}-${{ matrix.platform.zip_os_name }}.tar.gz publish
popd popd
shell: bash shell: bash
#- name: Build AppImage (Linux)
# if: matrix.platform.os == 'ubuntu-latest'
# run: |
# BUILD_VERSION="${{ steps.version_info.outputs.build_version }}"
# PLATFORM_NAME="${{ matrix.platform.name }}"
# sudo apt install -y zsync desktop-file-utils appstream
# mkdir -p tools
# export PATH="$PATH:$(readlink -f tools)"
# Setup appimagetool
# wget -q -O tools/appimagetool "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage"
# chmod +x tools/appimagetool
# chmod +x distribution/linux/appimage/build-appimage.sh
# Explicitly set $ARCH for appimagetool ($ARCH_NAME is for the file name)
# if [ "$PLATFORM_NAME" = "linux-x64" ]; then
# ARCH_NAME=x64
# export ARCH=x86_64
# elif [ "$PLATFORM_NAME" = "linux-arm64" ]; then
# ARCH_NAME=arm64
# export ARCH=aarch64
# else
# echo "Unexpected PLATFORM_NAME "$PLATFORM_NAME""
# exit 1
# fi
# export UFLAG="gh-releases-zsync|${{ github.repository_owner }}|${{ github.event.repository.name }}|latest|*-$ARCH_NAME.AppImage.zsync"
# BUILDDIR=publish_ava OUTDIR=publish_ava_appimage distribution/linux/appimage/build-appimage.sh
# Add to release output
# pushd publish_ava_appimage
# mv Ryujinx.AppImage ../release_output/ryujinx-$BUILD_VERSION-$ARCH_NAME.AppImage
# mv Ryujinx.AppImage.zsync ../release_output/ryujinx-$BUILD_VERSION-$ARCH_NAME.AppImage.zsync
# popd
# shell: bash
- name: Pushing new release - name: Pushing new release
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1
with: with:
name: ${{ steps.version_info.outputs.build_version }} name: ${{ steps.version_info.outputs.build_version }}
artifacts: "release_output/*.tar.gz,release_output/*.zip" artifacts: "release_output/*.tar.gz,release_output/*.zip/*AppImage*"
#artifacts: "release_output/*.tar.gz,release_output/*.zip/*AppImage*"
tag: ${{ steps.version_info.outputs.build_version }} tag: ${{ steps.version_info.outputs.build_version }}
body: "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ steps.version_info.outputs.prev_build_version }}...${{ steps.version_info.outputs.build_version }}" body: "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ steps.version_info.outputs.prev_build_version }}...${{ steps.version_info.outputs.build_version }}"
omitBodyDuringUpdate: true omitBodyDuringUpdate: true
@@ -233,7 +229,7 @@ jobs:
- name: Publish macOS Ryujinx - name: Publish macOS Ryujinx
run: | run: |
./distribution/macos/create_macos_build_ava.sh . publish_tmp_ava publish_ava ./distribution/macos/entitlements.xml "${{ steps.version_info.outputs.build_version }}" "${{ steps.version_info.outputs.git_short_hash }}" Release ./distribution/macos/create_macos_build_ava.sh . publish_tmp_ava publish ./distribution/macos/entitlements.xml "${{ steps.version_info.outputs.build_version }}" "${{ steps.version_info.outputs.git_short_hash }}" Release
- name: Publish macOS Ryujinx.Headless.SDL2 - name: Publish macOS Ryujinx.Headless.SDL2
run: | run: |
@@ -243,7 +239,7 @@ jobs:
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1
with: with:
name: ${{ steps.version_info.outputs.build_version }} name: ${{ steps.version_info.outputs.build_version }}
artifacts: "publish_ava/*.tar.gz, publish_headless/*.tar.gz" artifacts: "publish/*.tar.gz, publish_headless/*.tar.gz"
tag: ${{ steps.version_info.outputs.build_version }} tag: ${{ steps.version_info.outputs.build_version }}
body: "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ steps.version_info.outputs.prev_build_version }}...${{ steps.version_info.outputs.build_version }}" body: "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ steps.version_info.outputs.prev_build_version }}...${{ steps.version_info.outputs.build_version }}"
omitBodyDuringUpdate: true omitBodyDuringUpdate: true

View File

@@ -13,6 +13,7 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Linq;
using System.Runtime; using System.Runtime;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@@ -848,18 +849,15 @@ namespace ARMeilleure.Translation.PTC
} }
} }
List<Thread> threads = new();
for (int i = 0; i < degreeOfParallelism; i++) List<Thread> threads = Enumerable.Range(0, degreeOfParallelism)
{ .Select(idx =>
Thread thread = new(TranslateFuncs) new Thread(TranslateFuncs)
{ {
IsBackground = true, IsBackground = true,
Name = "Ptc.TranslateThread." + i Name = "Ptc.TranslateThread." + idx
};
threads.Add(thread);
} }
).ToList();
Stopwatch sw = Stopwatch.StartNew(); Stopwatch sw = Stopwatch.StartNew();

View File

@@ -30,10 +30,10 @@ namespace Ryujinx.Common.Logging.Targets
string ILogTarget.Name { get => _target.Name; } string ILogTarget.Name { get => _target.Name; }
public AsyncLogTargetWrapper(ILogTarget target) public AsyncLogTargetWrapper(ILogTarget target)
: this(target, -1, AsyncLogTargetOverflowAction.Block) : this(target, -1)
{ } { }
public AsyncLogTargetWrapper(ILogTarget target, int queueLimit, AsyncLogTargetOverflowAction overflowAction) public AsyncLogTargetWrapper(ILogTarget target, int queueLimit = -1, AsyncLogTargetOverflowAction overflowAction = AsyncLogTargetOverflowAction.Block)
{ {
_target = target; _target = target;
_messageQueue = new BlockingCollection<LogEventArgs>(queueLimit); _messageQueue = new BlockingCollection<LogEventArgs>(queueLimit);

View File

@@ -8,6 +8,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp.NfpManager
public uint FileVersion { get; set; } public uint FileVersion { get; set; }
public byte[] TagUuid { get; set; } public byte[] TagUuid { get; set; }
public string AmiiboId { get; set; } public string AmiiboId { get; set; }
public string NickName { get; set; }
public DateTime FirstWriteDate { get; set; } public DateTime FirstWriteDate { get; set; }
public DateTime LastWriteDate { get; set; } public DateTime LastWriteDate { get; set; }
public ushort WriteCounter { get; set; } public ushort WriteCounter { get; set; }

View File

@@ -64,16 +64,17 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
}; };
} }
public static RegisterInfo GetRegisterInfo(ITickSource tickSource, string amiiboId, string nickname) public static RegisterInfo GetRegisterInfo(ITickSource tickSource, string amiiboId, string userName)
{ {
VirtualAmiiboFile amiiboFile = LoadAmiiboFile(amiiboId); VirtualAmiiboFile amiiboFile = LoadAmiiboFile(amiiboId);
string nickname = amiiboFile.NickName ?? "Ryujinx";
UtilityImpl utilityImpl = new(tickSource); UtilityImpl utilityImpl = new(tickSource);
CharInfo charInfo = new(); CharInfo charInfo = new();
charInfo.SetFromStoreData(StoreData.BuildDefault(utilityImpl, 0)); charInfo.SetFromStoreData(StoreData.BuildDefault(utilityImpl, 0));
charInfo.Nickname = Nickname.FromString(nickname); // This is the player's name
charInfo.Nickname = Nickname.FromString(userName);
RegisterInfo registerInfo = new() RegisterInfo registerInfo = new()
{ {
@@ -85,7 +86,9 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
Reserved1 = new Array64<byte>(), Reserved1 = new Array64<byte>(),
Reserved2 = new Array58<byte>(), Reserved2 = new Array58<byte>(),
}; };
"Ryujinx"u8.CopyTo(registerInfo.Nickname.AsSpan()); // This is the amiibo's name
byte[] nicknameBytes = System.Text.Encoding.UTF8.GetBytes(nickname);
nicknameBytes.CopyTo(registerInfo.Nickname.AsSpan());
return registerInfo; return registerInfo;
} }

View File

@@ -117,8 +117,9 @@ namespace Ryujinx.Headless.SDL2.OpenGL
GraphicsDebugLevel glLogLevel, GraphicsDebugLevel glLogLevel,
AspectRatio aspectRatio, AspectRatio aspectRatio,
bool enableMouse, bool enableMouse,
HideCursorMode hideCursorMode) HideCursorMode hideCursorMode,
: base(inputManager, glLogLevel, aspectRatio, enableMouse, hideCursorMode) bool ignoreControllerApplet)
: base(inputManager, glLogLevel, aspectRatio, enableMouse, hideCursorMode, ignoreControllerApplet)
{ {
_glLogLevel = glLogLevel; _glLogLevel = glLogLevel;
} }

View File

@@ -226,6 +226,9 @@ namespace Ryujinx.Headless.SDL2
[Option("ignore-missing-services", Required = false, Default = false, HelpText = "Enable ignoring missing services.")] [Option("ignore-missing-services", Required = false, Default = false, HelpText = "Enable ignoring missing services.")]
public bool IgnoreMissingServices { get; set; } public bool IgnoreMissingServices { get; set; }
[Option("ignore-controller-applet", Required = false, Default = false, HelpText = "Enable ignoring the controller applet when your game loses connection to your controller.")]
public bool IgnoreControllerApplet { get; set; }
// Values // Values
[Value(0, MetaName = "input", HelpText = "Input to load.", Required = true)] [Value(0, MetaName = "input", HelpText = "Input to load.", Required = true)]

View File

@@ -444,8 +444,7 @@ namespace Ryujinx.Headless.SDL2
{ {
Logger.AddTarget(new AsyncLogTargetWrapper( Logger.AddTarget(new AsyncLogTargetWrapper(
new FileLogTarget("file", logFile), new FileLogTarget("file", logFile),
1000, 1000
AsyncLogTargetOverflowAction.Block
)); ));
} }
else else
@@ -506,8 +505,8 @@ namespace Ryujinx.Headless.SDL2
private static WindowBase CreateWindow(Options options) private static WindowBase CreateWindow(Options options)
{ {
return options.GraphicsBackend == GraphicsBackend.Vulkan return options.GraphicsBackend == GraphicsBackend.Vulkan
? new VulkanWindow(_inputManager, options.LoggingGraphicsDebugLevel, options.AspectRatio, options.EnableMouse, options.HideCursorMode) ? new VulkanWindow(_inputManager, options.LoggingGraphicsDebugLevel, options.AspectRatio, options.EnableMouse, options.HideCursorMode, options.IgnoreControllerApplet)
: new OpenGLWindow(_inputManager, options.LoggingGraphicsDebugLevel, options.AspectRatio, options.EnableMouse, options.HideCursorMode); : new OpenGLWindow(_inputManager, options.LoggingGraphicsDebugLevel, options.AspectRatio, options.EnableMouse, options.HideCursorMode, options.IgnoreControllerApplet);
} }
private static IRenderer CreateRenderer(Options options, WindowBase window) private static IRenderer CreateRenderer(Options options, WindowBase window)

View File

@@ -17,8 +17,9 @@ namespace Ryujinx.Headless.SDL2.Vulkan
GraphicsDebugLevel glLogLevel, GraphicsDebugLevel glLogLevel,
AspectRatio aspectRatio, AspectRatio aspectRatio,
bool enableMouse, bool enableMouse,
HideCursorMode hideCursorMode) HideCursorMode hideCursorMode,
: base(inputManager, glLogLevel, aspectRatio, enableMouse, hideCursorMode) bool ignoreControllerApplet)
: base(inputManager, glLogLevel, aspectRatio, enableMouse, hideCursorMode, ignoreControllerApplet)
{ {
_glLogLevel = glLogLevel; _glLogLevel = glLogLevel;
} }

View File

@@ -86,13 +86,15 @@ namespace Ryujinx.Headless.SDL2
private readonly AspectRatio _aspectRatio; private readonly AspectRatio _aspectRatio;
private readonly bool _enableMouse; private readonly bool _enableMouse;
private readonly bool _ignoreControllerApplet;
public WindowBase( public WindowBase(
InputManager inputManager, InputManager inputManager,
GraphicsDebugLevel glLogLevel, GraphicsDebugLevel glLogLevel,
AspectRatio aspectRatio, AspectRatio aspectRatio,
bool enableMouse, bool enableMouse,
HideCursorMode hideCursorMode) HideCursorMode hideCursorMode,
bool ignoreControllerApplet)
{ {
MouseDriver = new SDL2MouseDriver(hideCursorMode); MouseDriver = new SDL2MouseDriver(hideCursorMode);
_inputManager = inputManager; _inputManager = inputManager;
@@ -108,6 +110,7 @@ namespace Ryujinx.Headless.SDL2
_gpuDoneEvent = new ManualResetEvent(false); _gpuDoneEvent = new ManualResetEvent(false);
_aspectRatio = aspectRatio; _aspectRatio = aspectRatio;
_enableMouse = enableMouse; _enableMouse = enableMouse;
_ignoreControllerApplet = ignoreControllerApplet;
HostUITheme = new HeadlessHostUiTheme(); HostUITheme = new HeadlessHostUiTheme();
SDL2Driver.Instance.Initialize(); SDL2Driver.Instance.Initialize();
@@ -484,6 +487,8 @@ namespace Ryujinx.Headless.SDL2
public bool DisplayMessageDialog(ControllerAppletUIArgs args) public bool DisplayMessageDialog(ControllerAppletUIArgs args)
{ {
if (_ignoreControllerApplet) return false;
string playerCount = args.PlayerCountMin == args.PlayerCountMax ? $"exactly {args.PlayerCountMin}" : $"{args.PlayerCountMin}-{args.PlayerCountMax}"; string playerCount = args.PlayerCountMin == args.PlayerCountMax ? $"exactly {args.PlayerCountMin}" : $"{args.PlayerCountMin}-{args.PlayerCountMax}";
string message = $"Application requests {playerCount} {"player".ToQuantity(args.PlayerCountMin + args.PlayerCountMax, ShowQuantityAs.None)} with:\n\n" string message = $"Application requests {playerCount} {"player".ToQuantity(args.PlayerCountMin + args.PlayerCountMax, ShowQuantityAs.None)} with:\n\n"

View File

@@ -413,6 +413,7 @@
"AvatarSetBackgroundColor": "Set Background Color", "AvatarSetBackgroundColor": "Set Background Color",
"AvatarClose": "Close", "AvatarClose": "Close",
"ControllerSettingsLoadProfileToolTip": "Load Profile", "ControllerSettingsLoadProfileToolTip": "Load Profile",
"ControllerSettingsViewProfileToolTip": "View Profile",
"ControllerSettingsAddProfileToolTip": "Add Profile", "ControllerSettingsAddProfileToolTip": "Add Profile",
"ControllerSettingsRemoveProfileToolTip": "Remove Profile", "ControllerSettingsRemoveProfileToolTip": "Remove Profile",
"ControllerSettingsSaveProfileToolTip": "Save Profile", "ControllerSettingsSaveProfileToolTip": "Save Profile",

View File

@@ -30,6 +30,7 @@ namespace Ryujinx.Ava
{ {
internal partial class Program internal partial class Program
{ {
//
public static double WindowScaleFactor { get; set; } public static double WindowScaleFactor { get; set; }
public static double DesktopScaleFactor { get; set; } = 1.0; public static double DesktopScaleFactor { get; set; } = 1.0;
public static string Version { get; private set; } public static string Version { get; private set; }

View File

@@ -226,6 +226,24 @@ namespace Ryujinx.Ava.UI.Helpers
(int)Symbol.Help, (int)Symbol.Help,
primaryButtonResult); primaryButtonResult);
internal static async Task<UserResult> CreateConfirmationDialogExtended(
string primaryText,
string secondaryText,
string acceptButtonText,
string noacceptButtonText,
string cancelButtonText,
string title,
UserResult primaryButtonResult = UserResult.Yes)
=> await ShowTextDialog(
string.IsNullOrWhiteSpace(title) ? LocaleManager.Instance[LocaleKeys.DialogConfirmationTitle] : title,
primaryText,
secondaryText,
acceptButtonText,
noacceptButtonText,
cancelButtonText,
(int)Symbol.Help,
primaryButtonResult);
internal static async Task<UserResult> CreateLocalizedConfirmationDialog(string primaryText, string secondaryText) internal static async Task<UserResult> CreateLocalizedConfirmationDialog(string primaryText, string secondaryText)
=> await CreateConfirmationDialog( => await CreateConfirmationDialog(
primaryText, primaryText,

View File

@@ -44,6 +44,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
private readonly MainWindow _mainWindow; private readonly MainWindow _mainWindow;
private PlayerIndex _playerId; private PlayerIndex _playerId;
private PlayerIndex _playerIdChoose;
private int _controller; private int _controller;
private string _controllerImage; private string _controllerImage;
private int _device; private int _device;
@@ -83,6 +84,12 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
} }
} }
public PlayerIndex PlayerIdChoose
{
get => _playerIdChoose;
set { }
}
public PlayerIndex PlayerId public PlayerIndex PlayerId
{ {
get => _playerId; get => _playerId;
@@ -90,6 +97,8 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
{ {
if (IsModified) if (IsModified)
{ {
_playerIdChoose = value;
return; return;
} }
@@ -99,7 +108,9 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
if (!Enum.IsDefined(typeof(PlayerIndex), _playerId)) if (!Enum.IsDefined(typeof(PlayerIndex), _playerId))
{ {
_playerId = PlayerIndex.Player1; _playerId = PlayerIndex.Player1;
} }
_isLoaded = false;
LoadConfiguration(); LoadConfiguration();
LoadDevice(); LoadDevice();

View File

@@ -4,11 +4,14 @@ using Avalonia.Controls.Primitives;
using Avalonia.Input; using Avalonia.Input;
using Avalonia.Interactivity; using Avalonia.Interactivity;
using Avalonia.LogicalTree; using Avalonia.LogicalTree;
using DiscordRPC;
using Ryujinx.Ava.UI.Helpers; using Ryujinx.Ava.UI.Helpers;
using Ryujinx.Ava.UI.ViewModels.Input; using Ryujinx.Ava.UI.ViewModels.Input;
using Ryujinx.Common.Configuration.Hid.Controller; using Ryujinx.Common.Configuration.Hid.Controller;
using Ryujinx.Common.Logging;
using Ryujinx.Input; using Ryujinx.Input;
using Ryujinx.Input.Assigner; using Ryujinx.Input.Assigner;
using System;
using StickInputId = Ryujinx.Common.Configuration.Hid.Controller.StickInputId; using StickInputId = Ryujinx.Common.Configuration.Hid.Controller.StickInputId;
namespace Ryujinx.Ava.UI.Views.Input namespace Ryujinx.Ava.UI.Views.Input
@@ -27,6 +30,16 @@ namespace Ryujinx.Ava.UI.Views.Input
{ {
button.IsCheckedChanged += Button_IsCheckedChanged; button.IsCheckedChanged += Button_IsCheckedChanged;
} }
if (visual is CheckBox check)
{
check.IsCheckedChanged += CheckBox_IsCheckedChanged;
}
if (visual is Slider slider)
{
slider.PropertyChanged += Slider_IsCheckedChanged;
}
} }
} }
@@ -40,9 +53,51 @@ namespace Ryujinx.Ava.UI.Views.Input
} }
} }
private float _changeSlider = -1.0f;
private void Slider_IsCheckedChanged(object sender, AvaloniaPropertyChangedEventArgs e)
{
if (sender is Slider check)
{
if ((bool)check.IsPointerOver && _changeSlider == -1.0f)
{
_changeSlider = (float)check.Value;
}
else if (!(bool)check.IsPointerOver)
{
_changeSlider = -1.0f;
}
if (_changeSlider != -1.0f && _changeSlider != (float)check.Value)
{
var viewModel = (DataContext as ControllerInputViewModel);
viewModel.ParentModel.IsModified = true;
_changeSlider = (float)check.Value;
}
}
}
private void CheckBox_IsCheckedChanged(object sender, RoutedEventArgs e)
{
if (sender is CheckBox check)
{
if ((bool)check.IsPointerOver)
{
var viewModel = (DataContext as ControllerInputViewModel);
viewModel.ParentModel.IsModified = true;
_currentAssigner?.Cancel();
_currentAssigner = null;
}
}
}
private void Button_IsCheckedChanged(object sender, RoutedEventArgs e) private void Button_IsCheckedChanged(object sender, RoutedEventArgs e)
{ {
if (sender is ToggleButton button) if (sender is ToggleButton button )
{ {
if ((bool)button.IsChecked) if ((bool)button.IsChecked)
{ {
@@ -149,7 +204,7 @@ namespace Ryujinx.Ava.UI.Views.Input
} }
else else
{ {
if (_currentAssigner != null) if (_currentAssigner != null )
{ {
_currentAssigner.Cancel(); _currentAssigner.Cancel();
_currentAssigner = null; _currentAssigner = null;

View File

@@ -108,7 +108,7 @@
ToolTip.Tip="{ext:Locale ControllerSettingsLoadProfileToolTip}" ToolTip.Tip="{ext:Locale ControllerSettingsLoadProfileToolTip}"
Command="{Binding LoadProfile}"> Command="{Binding LoadProfile}">
<ui:SymbolIcon <ui:SymbolIcon
Symbol="Upload" Symbol="View"
FontSize="15" FontSize="15"
Height="20" /> Height="20" />
</Button> </Button>

View File

@@ -25,17 +25,27 @@ namespace Ryujinx.Ava.UI.Views.Input
private async void PlayerIndexBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) private async void PlayerIndexBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
if (PlayerIndexBox != null)
{
if (PlayerIndexBox.SelectedIndex != (int)ViewModel.PlayerId)
{
PlayerIndexBox.SelectedIndex = (int)ViewModel.PlayerId;
}
}
if (ViewModel.IsModified && !_dialogOpen) if (ViewModel.IsModified && !_dialogOpen)
{ {
_dialogOpen = true; _dialogOpen = true;
var result = await ContentDialogHelper.CreateConfirmationDialog( var result = await ContentDialogHelper.CreateConfirmationDialogExtended(
LocaleManager.Instance[LocaleKeys.DialogControllerSettingsModifiedConfirmMessage], LocaleManager.Instance[LocaleKeys.DialogControllerSettingsModifiedConfirmMessage],
LocaleManager.Instance[LocaleKeys.DialogControllerSettingsModifiedConfirmSubMessage], LocaleManager.Instance[LocaleKeys.DialogControllerSettingsModifiedConfirmSubMessage],
LocaleManager.Instance[LocaleKeys.InputDialogYes], LocaleManager.Instance[LocaleKeys.InputDialogYes],
LocaleManager.Instance[LocaleKeys.InputDialogNo], LocaleManager.Instance[LocaleKeys.InputDialogNo],
LocaleManager.Instance[LocaleKeys.Cancel],
LocaleManager.Instance[LocaleKeys.RyujinxConfirm]); LocaleManager.Instance[LocaleKeys.RyujinxConfirm]);
if (result == UserResult.Yes) if (result == UserResult.Yes)
{ {
ViewModel.Save(); ViewModel.Save();
@@ -43,16 +53,32 @@ namespace Ryujinx.Ava.UI.Views.Input
_dialogOpen = false; _dialogOpen = false;
if (result == UserResult.Cancel)
{
return;
}
ViewModel.IsModified = false; ViewModel.IsModified = false;
if (result != UserResult.Cancel)
{
ViewModel.PlayerId = ViewModel.PlayerIdChoose;
}
if (result == UserResult.Cancel)
{
if (e.AddedItems.Count > 0) if (e.AddedItems.Count > 0)
{ {
ViewModel.IsModified = true;
var player = (PlayerModel)e.AddedItems[0]; var player = (PlayerModel)e.AddedItems[0];
ViewModel.PlayerId = player.Id; ViewModel.PlayerId = player.Id;
} }
} }
} }
}
public void Dispose() public void Dispose()
{ {
ViewModel.Dispose(); ViewModel.Dispose();