Compare commits

...

7 Commits

Author SHA1 Message Date
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
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
a7b58df3fe Appimage Round 2 (#73) 2024-11-09 19:30:19 -06:00
8c2d6192ba Add Dummy Applet to Replace NotImplementedException (#216)
Currently, in Ryujinx, if an app attempts to open an unimplemented
applet, it crashes. This change adds a dummy applet to send a dummy
response instead of crashing and logs the applet.
2024-11-09 19:28:12 -06:00
2a23000fed Add Canary release badge & links 2024-11-08 19:54:36 -06:00
ab7d0a2e6d nuget: bump Microsoft.IdentityModel.JsonWebTokens from 8.0.1 to 8.1.2 (#13) 2024-11-07 10:47:40 -06:00
bd2681b2f9 Add missing and update translations for zh-tw (#158)
Simply add back some missing translations and update outdated
translations for zh-tw.
2024-11-07 10:46:40 -06:00
16 changed files with 294 additions and 124 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

@ -22,7 +22,7 @@
<PackageVersion Include="LibHac" Version="0.19.0" /> <PackageVersion Include="LibHac" Version="0.19.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" /> <PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" /> <PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.0.1" /> <PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.1.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" /> <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" /> <PackageVersion Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
<PackageVersion Include="MsgPack.Cli" Version="1.0.1" /> <PackageVersion Include="MsgPack.Cli" Version="1.0.1" />

View File

@ -14,6 +14,15 @@
<img src="https://img.shields.io/github/v/release/GreemDev/Ryujinx" <img src="https://img.shields.io/github/v/release/GreemDev/Ryujinx"
alt="Latest Release"> alt="Latest Release">
</a> </a>
<br>
<a href="https://github.com/GreemDev/Ryujinx/actions/workflows/canary.yml">
<img src="https://github.com/GreemDev/Ryujinx/actions/workflows/canary.yml/badge.svg"
alt="">
</a>
<a href="https://github.com/GreemDev/Ryujinx-Canary/releases/latest">
<img src="https://img.shields.io/github/v/release/GreemDev/Ryujinx-Canary?label=canary"
alt="Latest Canary Release">
</a>
</h1> </h1>
<p align="center"> <p align="center">

View File

@ -1,4 +1,6 @@
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Applets.Browser; using Ryujinx.HLE.HOS.Applets.Browser;
using Ryujinx.HLE.HOS.Applets.Dummy;
using Ryujinx.HLE.HOS.Applets.Error; using Ryujinx.HLE.HOS.Applets.Error;
using Ryujinx.HLE.HOS.Services.Am.AppletAE; using Ryujinx.HLE.HOS.Services.Am.AppletAE;
using System; using System;
@ -26,9 +28,13 @@ namespace Ryujinx.HLE.HOS.Applets
return new BrowserApplet(system); return new BrowserApplet(system);
case AppletId.LibAppletOff: case AppletId.LibAppletOff:
return new BrowserApplet(system); return new BrowserApplet(system);
case AppletId.MiiEdit:
Logger.Warning?.Print(LogClass.Application, $"Please use the MiiEdit inside File/Open Applet");
return new DummyApplet(system);
} }
throw new NotImplementedException($"{applet} applet is not implemented."); Logger.Warning?.Print(LogClass.Application, $"Applet {applet} not implemented!");
return new DummyApplet(system);
} }
} }
} }

View File

@ -0,0 +1,43 @@
using Ryujinx.Common.Logging;
using Ryujinx.Common.Memory;
using Ryujinx.HLE.HOS.Applets;
using Ryujinx.HLE.HOS.Services.Am.AppletAE;
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Applets.Dummy
{
internal class DummyApplet : IApplet
{
private readonly Horizon _system;
private AppletSession _normalSession;
public event EventHandler AppletStateChanged;
public DummyApplet(Horizon system)
{
_system = system;
}
public ResultCode Start(AppletSession normalSession, AppletSession interactiveSession)
{
_normalSession = normalSession;
_normalSession.Push(BuildResponse());
AppletStateChanged?.Invoke(this, null);
_system.ReturnFocus();
return ResultCode.Success;
}
private static T ReadStruct<T>(byte[] data) where T : struct
{
return MemoryMarshal.Read<T>(data.AsSpan());
}
private static byte[] BuildResponse()
{
using MemoryStream stream = MemoryStreamManager.Shared.GetStream();
using BinaryWriter writer = new(stream);
writer.Write((ulong)ResultCode.Success);
return stream.ToArray();
}
public ResultCode GetResult()
{
return ResultCode.Success;
}
}
}

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

@ -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

@ -10,10 +10,10 @@
"SettingsTabSystemUseHypervisor": "使用 Hypervisor", "SettingsTabSystemUseHypervisor": "使用 Hypervisor",
"MenuBarFile": "檔案(_F)", "MenuBarFile": "檔案(_F)",
"MenuBarFileOpenFromFile": "從檔案載入應用程式(_L)", "MenuBarFileOpenFromFile": "從檔案載入應用程式(_L)",
"MenuBarFileOpenFromFileError": "No applications found in selected file.", "MenuBarFileOpenFromFileError": "未能從已選擇的檔案中找到應用程式。",
"MenuBarFileOpenUnpacked": "載入未封裝的遊戲(_U)", "MenuBarFileOpenUnpacked": "載入未封裝的遊戲(_U)",
"MenuBarFileLoadDlcFromFolder": "Load DLC From Folder", "MenuBarFileLoadDlcFromFolder": "從資料夾中載入 DLC",
"MenuBarFileLoadTitleUpdatesFromFolder": "Load Title Updates From Folder", "MenuBarFileLoadTitleUpdatesFromFolder": "從資料夾中載入遊戲更新",
"MenuBarFileOpenEmuFolder": "開啟 Ryujinx 資料夾", "MenuBarFileOpenEmuFolder": "開啟 Ryujinx 資料夾",
"MenuBarFileOpenLogsFolder": "開啟日誌資料夾", "MenuBarFileOpenLogsFolder": "開啟日誌資料夾",
"MenuBarFileExit": "結束(_E)", "MenuBarFileExit": "結束(_E)",
@ -100,14 +100,14 @@
"SettingsTabGeneralCheckUpdatesOnLaunch": "啟動時檢查更新", "SettingsTabGeneralCheckUpdatesOnLaunch": "啟動時檢查更新",
"SettingsTabGeneralShowConfirmExitDialog": "顯示「確認結束」對話方塊", "SettingsTabGeneralShowConfirmExitDialog": "顯示「確認結束」對話方塊",
"SettingsTabGeneralRememberWindowState": "記住視窗大小/位置", "SettingsTabGeneralRememberWindowState": "記住視窗大小/位置",
"SettingsTabGeneralShowTitleBar": "Show Title Bar (Requires restart)", "SettingsTabGeneralShowTitleBar": "顯示「標題列」 (需要重新開啟Ryujinx)",
"SettingsTabGeneralHideCursor": "隱藏滑鼠游標:", "SettingsTabGeneralHideCursor": "隱藏滑鼠游標:",
"SettingsTabGeneralHideCursorNever": "從不", "SettingsTabGeneralHideCursorNever": "從不",
"SettingsTabGeneralHideCursorOnIdle": "閒置時", "SettingsTabGeneralHideCursorOnIdle": "閒置時",
"SettingsTabGeneralHideCursorAlways": "總是", "SettingsTabGeneralHideCursorAlways": "總是",
"SettingsTabGeneralGameDirectories": "遊戲資料夾", "SettingsTabGeneralGameDirectories": "遊戲資料夾",
"SettingsTabGeneralAutoloadDirectories": "Autoload DLC/Updates Directories", "SettingsTabGeneralAutoloadDirectories": "自動載入 DLC/遊戲更新資料夾",
"SettingsTabGeneralAutoloadNote": "DLC and Updates which refer to missing files will be unloaded automatically", "SettingsTabGeneralAutoloadNote": "遺失的 DLC 及遊戲更新檔案將會在自動載入中移除",
"SettingsTabGeneralAdd": "新增", "SettingsTabGeneralAdd": "新增",
"SettingsTabGeneralRemove": "刪除", "SettingsTabGeneralRemove": "刪除",
"SettingsTabSystem": "系統", "SettingsTabSystem": "系統",
@ -142,7 +142,7 @@
"SettingsTabSystemSystemTime": "系統時鐘:", "SettingsTabSystemSystemTime": "系統時鐘:",
"SettingsTabSystemEnableVsync": "垂直同步", "SettingsTabSystemEnableVsync": "垂直同步",
"SettingsTabSystemEnablePptc": "PPTC (剖析式持久轉譯快取, Profiled Persistent Translation Cache)", "SettingsTabSystemEnablePptc": "PPTC (剖析式持久轉譯快取, Profiled Persistent Translation Cache)",
"SettingsTabSystemEnableLowPowerPptc": "Low-power PPTC", "SettingsTabSystemEnableLowPowerPptc": "低功耗 PPTC",
"SettingsTabSystemEnableFsIntegrityChecks": "檔案系統完整性檢查", "SettingsTabSystemEnableFsIntegrityChecks": "檔案系統完整性檢查",
"SettingsTabSystemAudioBackend": "音效後端:", "SettingsTabSystemAudioBackend": "音效後端:",
"SettingsTabSystemAudioBackendDummy": "虛設 (Dummy)", "SettingsTabSystemAudioBackendDummy": "虛設 (Dummy)",
@ -416,7 +416,7 @@
"GameListContextMenuToggleFavorite": "加入/移除為我的最愛", "GameListContextMenuToggleFavorite": "加入/移除為我的最愛",
"GameListContextMenuToggleFavoriteToolTip": "切換遊戲的我的最愛狀態", "GameListContextMenuToggleFavoriteToolTip": "切換遊戲的我的最愛狀態",
"SettingsTabGeneralTheme": "佈景主題:", "SettingsTabGeneralTheme": "佈景主題:",
"SettingsTabGeneralThemeAuto": "Auto", "SettingsTabGeneralThemeAuto": "自動",
"SettingsTabGeneralThemeDark": "深色", "SettingsTabGeneralThemeDark": "深色",
"SettingsTabGeneralThemeLight": "淺色", "SettingsTabGeneralThemeLight": "淺色",
"ControllerSettingsConfigureGeneral": "配置", "ControllerSettingsConfigureGeneral": "配置",
@ -567,9 +567,9 @@
"AddGameDirBoxTooltip": "輸入要新增到清單中的遊戲資料夾", "AddGameDirBoxTooltip": "輸入要新增到清單中的遊戲資料夾",
"AddGameDirTooltip": "新增遊戲資料夾到清單中", "AddGameDirTooltip": "新增遊戲資料夾到清單中",
"RemoveGameDirTooltip": "移除選取的遊戲資料夾", "RemoveGameDirTooltip": "移除選取的遊戲資料夾",
"AddAutoloadDirBoxTooltip": "Enter an autoload directory to add to the list", "AddAutoloadDirBoxTooltip": "輸入要新增到清單中的「自動載入 DLC/遊戲更新資料夾」",
"AddAutoloadDirTooltip": "Add an autoload directory to the list", "AddAutoloadDirTooltip": "新增「自動載入 DLC/遊戲更新資料夾」到清單中",
"RemoveAutoloadDirTooltip": "Remove selected autoload directory", "RemoveAutoloadDirTooltip": "移除選取的「自動載入 DLC/遊戲更新資料夾」",
"CustomThemeCheckTooltip": "為圖形使用者介面使用自訂 Avalonia 佈景主題,變更模擬器功能表的外觀", "CustomThemeCheckTooltip": "為圖形使用者介面使用自訂 Avalonia 佈景主題,變更模擬器功能表的外觀",
"CustomThemePathTooltip": "自訂 GUI 佈景主題的路徑", "CustomThemePathTooltip": "自訂 GUI 佈景主題的路徑",
"CustomThemeBrowseTooltip": "瀏覽自訂 GUI 佈景主題", "CustomThemeBrowseTooltip": "瀏覽自訂 GUI 佈景主題",
@ -582,7 +582,7 @@
"TimeTooltip": "變更系統時鐘", "TimeTooltip": "變更系統時鐘",
"VSyncToggleTooltip": "模擬遊戲機的垂直同步。對大多數遊戲來說,它本質上是一個幀率限制器;停用它可能會導致遊戲以更高的速度執行,或使載入畫面耗時更長或卡住。\n\n可以在遊戲中使用快速鍵進行切換 (預設為 F1)。如果您打算停用,我們建議您這樣做。\n\n如果不確定請保持開啟狀態。", "VSyncToggleTooltip": "模擬遊戲機的垂直同步。對大多數遊戲來說,它本質上是一個幀率限制器;停用它可能會導致遊戲以更高的速度執行,或使載入畫面耗時更長或卡住。\n\n可以在遊戲中使用快速鍵進行切換 (預設為 F1)。如果您打算停用,我們建議您這樣做。\n\n如果不確定請保持開啟狀態。",
"PptcToggleTooltip": "儲存已轉譯的 JIT 函數,這樣每次載入遊戲時就無需再轉譯這些函數。\n\n減少遊戲首次啟動後的卡頓現象並大大加快啟動時間。\n\n如果不確定請保持開啟狀態。", "PptcToggleTooltip": "儲存已轉譯的 JIT 函數,這樣每次載入遊戲時就無需再轉譯這些函數。\n\n減少遊戲首次啟動後的卡頓現象並大大加快啟動時間。\n\n如果不確定請保持開啟狀態。",
"LowPowerPptcToggleTooltip": "Load the PPTC using a third of the amount of cores.", "LowPowerPptcToggleTooltip": "使用 CPU 核心數量的三分之一載入 PPTC。",
"FsIntegrityToggleTooltip": "在啟動遊戲時檢查損壞的檔案,如果檢測到損壞的檔案,則在日誌中顯示雜湊值錯誤。\n\n對效能沒有影響旨在幫助排除故障。\n\n如果不確定請保持開啟狀態。", "FsIntegrityToggleTooltip": "在啟動遊戲時檢查損壞的檔案,如果檢測到損壞的檔案,則在日誌中顯示雜湊值錯誤。\n\n對效能沒有影響旨在幫助排除故障。\n\n如果不確定請保持開啟狀態。",
"AudioBackendTooltip": "變更用於繪製音訊的後端。\n\nSDL2 是首選,而 OpenAL 和 SoundIO 則作為備用。虛設 (Dummy) 將沒有聲音。\n\n如果不確定請設定為 SDL2。", "AudioBackendTooltip": "變更用於繪製音訊的後端。\n\nSDL2 是首選,而 OpenAL 和 SoundIO 則作為備用。虛設 (Dummy) 將沒有聲音。\n\n如果不確定請設定為 SDL2。",
"MemoryManagerTooltip": "變更客體記憶體的映射和存取方式。這會極大地影響模擬 CPU 效能。\n\n如果不確定請設定為主體略過檢查模式。", "MemoryManagerTooltip": "變更客體記憶體的映射和存取方式。這會極大地影響模擬 CPU 效能。\n\n如果不確定請設定為主體略過檢查模式。",
@ -590,7 +590,7 @@
"MemoryManagerHostTooltip": "直接映射主體位址空間中的記憶體。更快的 JIT 編譯和執行速度。", "MemoryManagerHostTooltip": "直接映射主體位址空間中的記憶體。更快的 JIT 編譯和執行速度。",
"MemoryManagerUnsafeTooltip": "直接映射記憶體,但在存取前不封鎖客體位址空間內的位址。速度更快,但相對不安全。訪客應用程式可以從 Ryujinx 中的任何地方存取記憶體,因此只能使用該模式執行您信任的程式。", "MemoryManagerUnsafeTooltip": "直接映射記憶體,但在存取前不封鎖客體位址空間內的位址。速度更快,但相對不安全。訪客應用程式可以從 Ryujinx 中的任何地方存取記憶體,因此只能使用該模式執行您信任的程式。",
"UseHypervisorTooltip": "使用 Hypervisor 取代 JIT。使用時可大幅提高效能但在目前狀態下可能不穩定。", "UseHypervisorTooltip": "使用 Hypervisor 取代 JIT。使用時可大幅提高效能但在目前狀態下可能不穩定。",
"DRamTooltip": "利用另一種 MemoryMode 配置來模仿 Switch 開發模式。\n\n這僅對高解析度紋理套件或 4K 解析度模組有用。不會提高效能。\n\n如果不確定保持關閉狀態。", "DRamTooltip": "利用另一種 MemoryMode 配置來模仿 Switch 開發模式。\n\n這僅對高解析度紋理套件或 4K 解析度模組有用。不會提高效能。\n\n如果不確定設定為 4GiB。",
"IgnoreMissingServicesTooltip": "忽略未實現的 Horizon OS 服務。這可能有助於在啟動某些遊戲時避免崩潰。\n\n如果不確定請保持關閉狀態。", "IgnoreMissingServicesTooltip": "忽略未實現的 Horizon OS 服務。這可能有助於在啟動某些遊戲時避免崩潰。\n\n如果不確定請保持關閉狀態。",
"IgnoreAppletTooltip": "如果遊戲手把在遊戲過程中斷開連接,則外部對話方塊「控制器小程式」將不會出現。不會提示關閉對話方塊或設定新控制器。一旦先前斷開的控制器重新連接,遊戲將自動恢復。", "IgnoreAppletTooltip": "如果遊戲手把在遊戲過程中斷開連接,則外部對話方塊「控制器小程式」將不會出現。不會提示關閉對話方塊或設定新控制器。一旦先前斷開的控制器重新連接,遊戲將自動恢復。",
"GraphicsBackendThreadingTooltip": "在第二個執行緒上執行圖形後端指令。\n\n在本身不支援多執行緒的 GPU 驅動程式上,可加快著色器編譯、減少卡頓並提高效能。在支援多執行緒的驅動程式上效能略有提升。\n\n如果不確定請設定為自動。", "GraphicsBackendThreadingTooltip": "在第二個執行緒上執行圖形後端指令。\n\n在本身不支援多執行緒的 GPU 驅動程式上,可加快著色器編譯、減少卡頓並提高效能。在支援多執行緒的驅動程式上效能略有提升。\n\n如果不確定請設定為自動。",
@ -615,8 +615,8 @@
"DebugLogTooltip": "在控制台中輸出偵錯日誌訊息。\n\n只有在人員特別指示的情況下才能使用因為這會導致日誌難以閱讀並降低模擬器效能。", "DebugLogTooltip": "在控制台中輸出偵錯日誌訊息。\n\n只有在人員特別指示的情況下才能使用因為這會導致日誌難以閱讀並降低模擬器效能。",
"LoadApplicationFileTooltip": "開啟檔案總管,選擇與 Switch 相容的檔案來載入", "LoadApplicationFileTooltip": "開啟檔案總管,選擇與 Switch 相容的檔案來載入",
"LoadApplicationFolderTooltip": "開啟檔案總管,選擇與 Switch 相容且未封裝的應用程式來載入", "LoadApplicationFolderTooltip": "開啟檔案總管,選擇與 Switch 相容且未封裝的應用程式來載入",
"LoadDlcFromFolderTooltip": "Open a file explorer to choose one or more folders to bulk load DLC from", "LoadDlcFromFolderTooltip": "開啟檔案總管,選擇一個或多個資料夾來大量載入 DLC",
"LoadTitleUpdatesFromFolderTooltip": "Open a file explorer to choose one or more folders to bulk load title updates from", "LoadTitleUpdatesFromFolderTooltip": "開啟檔案總管,選擇一個或多個資料夾來大量載入遊戲更新",
"OpenRyujinxFolderTooltip": "開啟 Ryujinx 檔案系統資料夾", "OpenRyujinxFolderTooltip": "開啟 Ryujinx 檔案系統資料夾",
"OpenRyujinxLogsTooltip": "開啟日誌被寫入的資料夾", "OpenRyujinxLogsTooltip": "開啟日誌被寫入的資料夾",
"ExitTooltip": "結束 Ryujinx", "ExitTooltip": "結束 Ryujinx",
@ -668,8 +668,8 @@
"OpenSetupGuideMessage": "開啟設定指南", "OpenSetupGuideMessage": "開啟設定指南",
"NoUpdate": "沒有更新", "NoUpdate": "沒有更新",
"TitleUpdateVersionLabel": "版本 {0}", "TitleUpdateVersionLabel": "版本 {0}",
"TitleBundledUpdateVersionLabel": "Bundled: Version {0}", "TitleBundledUpdateVersionLabel": "附帶: 版本 {0}",
"TitleBundledDlcLabel": "Bundled:", "TitleBundledDlcLabel": "附帶:",
"RyujinxInfo": "Ryujinx - 資訊", "RyujinxInfo": "Ryujinx - 資訊",
"RyujinxConfirm": "Ryujinx - 確認", "RyujinxConfirm": "Ryujinx - 確認",
"FileDialogAllTypes": "全部類型", "FileDialogAllTypes": "全部類型",
@ -727,17 +727,17 @@
"DlcWindowTitle": "管理 {0} 的可下載內容 ({1})", "DlcWindowTitle": "管理 {0} 的可下載內容 ({1})",
"ModWindowTitle": "管理 {0} 的模組 ({1})", "ModWindowTitle": "管理 {0} 的模組 ({1})",
"UpdateWindowTitle": "遊戲更新管理員", "UpdateWindowTitle": "遊戲更新管理員",
"UpdateWindowUpdateAddedMessage": "{0} new update(s) added", "UpdateWindowUpdateAddedMessage": "已加入 {0} 個遊戲更新",
"UpdateWindowBundledContentNotice": "Bundled updates cannot be removed, only disabled.", "UpdateWindowBundledContentNotice": "附帶的遊戲更新只能被停用而無法被刪除。",
"CheatWindowHeading": "可用於 {0} [{1}] 的密技", "CheatWindowHeading": "可用於 {0} [{1}] 的密技",
"BuildId": "組建識別碼:", "BuildId": "組建識別碼:",
"DlcWindowBundledContentNotice": "Bundled DLC cannot be removed, only disabled.", "DlcWindowBundledContentNotice": "附帶的 DLC 只能被停用而無法被刪除。",
"DlcWindowHeading": "{0} 個可下載內容", "DlcWindowHeading": "{0} 個可下載內容",
"DlcWindowDlcAddedMessage": "{0} new downloadable content(s) added", "DlcWindowDlcAddedMessage": "已加入 {0} 個 DLC",
"AutoloadDlcAddedMessage": "{0} new downloadable content(s) added", "AutoloadDlcAddedMessage": "已加入 {0} 個 DLC",
"AutoloadDlcRemovedMessage": "{0} missing downloadable content(s) removed", "AutoloadDlcRemovedMessage": "已刪除 {0} 個遺失的 DLC",
"AutoloadUpdateAddedMessage": "{0} new update(s) added", "AutoloadUpdateAddedMessage": "已加入 {0} 個遊戲更新",
"AutoloadUpdateRemovedMessage": "{0} missing update(s) removed", "AutoloadUpdateRemovedMessage": "已刪除 {0} 個遺失的遊戲更新",
"ModWindowHeading": "{0} 模組", "ModWindowHeading": "{0} 模組",
"UserProfilesEditProfile": "編輯所選", "UserProfilesEditProfile": "編輯所選",
"Cancel": "取消", "Cancel": "取消",

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();