Compare commits
49 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
815819767c | ||
|
623604c391 | ||
|
617c5700ca | ||
|
7b62f7475e | ||
|
841dd56f4c | ||
|
a16d582a10 | ||
|
9ef0be477b | ||
|
c14ce4d2a5 | ||
|
171b46ef49 | ||
|
56fe2ff535 | ||
|
b1f8f868f6 | ||
|
d773d5152e | ||
|
33ba170315 | ||
|
638be5f296 | ||
|
49b37550ca | ||
|
a42f0bbb87 | ||
|
b4bb22ba06 | ||
|
6fdf774845 | ||
|
76b53e018a | ||
|
28dd7d80af | ||
|
1e06b28b22 | ||
|
e768a54f17 | ||
|
4e2bb13080 | ||
|
ac4f2c1e70 | ||
|
e40470bbe1 | ||
|
f460ecc182 | ||
|
086564c3c8 | ||
|
b6ac45d36d | ||
|
7afae8c699 | ||
|
7835968214 | ||
|
0aceb534cb | ||
|
a0af6e4d07 | ||
|
f61b7818c3 | ||
|
a2a97e1b11 | ||
|
8b2625b0be | ||
|
651e24fed9 | ||
|
41b104d0fb | ||
|
bc44b85b0b | ||
|
01c2b8097c | ||
|
4bd2ca3f0d | ||
|
e63157cc33 | ||
|
7f2fb049f5 | ||
|
4744bde0e5 | ||
|
4a835bb2b9 | ||
|
ddc9ae2a83 | ||
|
d6d3cdd573 | ||
|
53bd4c9f60 | ||
|
eca8808649 | ||
|
f6c3f1cdfd |
@@ -3,27 +3,28 @@
|
|||||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageVersion Include="Avalonia" Version="11.0.3" />
|
<PackageVersion Include="Avalonia" Version="11.0.5" />
|
||||||
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="11.0.3" />
|
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="11.0.5" />
|
||||||
<PackageVersion Include="Avalonia.Desktop" Version="11.0.3" />
|
<PackageVersion Include="Avalonia.Desktop" Version="11.0.5" />
|
||||||
<PackageVersion Include="Avalonia.Diagnostics" Version="11.0.3" />
|
<PackageVersion Include="Avalonia.Diagnostics" Version="11.0.5" />
|
||||||
<PackageVersion Include="Avalonia.Markup.Xaml.Loader" Version="11.0.3" />
|
<PackageVersion Include="Avalonia.Markup.Xaml.Loader" Version="11.0.5" />
|
||||||
<PackageVersion Include="Avalonia.Svg" Version="11.0.0" />
|
<PackageVersion Include="Avalonia.Svg" Version="11.0.0.3" />
|
||||||
<PackageVersion Include="Avalonia.Svg.Skia" Version="11.0.0" />
|
<PackageVersion Include="Avalonia.Svg.Skia" Version="11.0.0.3" />
|
||||||
<PackageVersion Include="CommandLineParser" Version="2.9.1" />
|
<PackageVersion Include="CommandLineParser" Version="2.9.1" />
|
||||||
<PackageVersion Include="Concentus" Version="1.1.7" />
|
<PackageVersion Include="Concentus" Version="1.1.7" />
|
||||||
<PackageVersion Include="DiscordRichPresence" Version="1.2.1.24" />
|
<PackageVersion Include="DiscordRichPresence" Version="1.2.1.24" />
|
||||||
<PackageVersion Include="DynamicData" Version="7.14.2" />
|
<PackageVersion Include="DynamicData" Version="7.14.2" />
|
||||||
<PackageVersion Include="FluentAvaloniaUI" Version="2.0.1" />
|
<PackageVersion Include="FluentAvaloniaUI" Version="2.0.4" />
|
||||||
<PackageVersion Include="GtkSharp.Dependencies" Version="1.1.1" />
|
<PackageVersion Include="GtkSharp.Dependencies" Version="1.1.1" />
|
||||||
<PackageVersion Include="GtkSharp.Dependencies.osx" Version="0.0.5" />
|
<PackageVersion Include="GtkSharp.Dependencies.osx" Version="0.0.5" />
|
||||||
<PackageVersion Include="jp2masa.Avalonia.Flexbox" Version="0.3.0-beta.4" />
|
<PackageVersion Include="jp2masa.Avalonia.Flexbox" Version="0.3.0-beta.4" />
|
||||||
<PackageVersion Include="LibHac" Version="0.18.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.6.0" />
|
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" />
|
||||||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
|
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
|
||||||
<PackageVersion Include="Microsoft.IO.RecyclableMemoryStream" Version="2.3.2" />
|
<PackageVersion Include="Microsoft.IO.RecyclableMemoryStream" Version="2.3.2" />
|
||||||
<PackageVersion Include="MsgPack.Cli" Version="1.0.1" />
|
<PackageVersion Include="MsgPack.Cli" Version="1.0.1" />
|
||||||
|
<PackageVersion Include="NetCoreServer" Version="7.0.0" />
|
||||||
<PackageVersion Include="NUnit" Version="3.13.3" />
|
<PackageVersion Include="NUnit" Version="3.13.3" />
|
||||||
<PackageVersion Include="NUnit3TestAdapter" Version="4.1.0" />
|
<PackageVersion Include="NUnit3TestAdapter" Version="4.1.0" />
|
||||||
<PackageVersion Include="OpenTK.Core" Version="4.7.7" />
|
<PackageVersion Include="OpenTK.Core" Version="4.7.7" />
|
||||||
@@ -35,6 +36,7 @@
|
|||||||
<PackageVersion Include="Ryujinx.Graphics.Vulkan.Dependencies.MoltenVK" Version="1.2.0" />
|
<PackageVersion Include="Ryujinx.Graphics.Vulkan.Dependencies.MoltenVK" Version="1.2.0" />
|
||||||
<PackageVersion Include="Ryujinx.GtkSharp" Version="3.24.24.59-ryujinx" />
|
<PackageVersion Include="Ryujinx.GtkSharp" Version="3.24.24.59-ryujinx" />
|
||||||
<PackageVersion Include="Ryujinx.SDL2-CS" Version="2.28.1-build28" />
|
<PackageVersion Include="Ryujinx.SDL2-CS" Version="2.28.1-build28" />
|
||||||
|
<PackageVersion Include="securifybv.ShellLink" Version="0.1.0" />
|
||||||
<PackageVersion Include="shaderc.net" Version="0.1.0" />
|
<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.Vulkan" Version="2.16.0" />
|
<PackageVersion Include="Silk.NET.Vulkan" Version="2.16.0" />
|
||||||
@@ -44,7 +46,7 @@
|
|||||||
<PackageVersion Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta11" />
|
<PackageVersion Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta11" />
|
||||||
<PackageVersion Include="SPB" Version="0.0.4-build28" />
|
<PackageVersion Include="SPB" Version="0.0.4-build28" />
|
||||||
<PackageVersion Include="System.Drawing.Common" Version="7.0.0" />
|
<PackageVersion Include="System.Drawing.Common" Version="7.0.0" />
|
||||||
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="6.31.0" />
|
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="7.0.0" />
|
||||||
<PackageVersion Include="System.IO.Hashing" Version="7.0.0" />
|
<PackageVersion Include="System.IO.Hashing" Version="7.0.0" />
|
||||||
<PackageVersion Include="System.Management" Version="7.0.2" />
|
<PackageVersion Include="System.Management" Version="7.0.2" />
|
||||||
<PackageVersion Include="UnicornEngine.Unicorn" Version="2.0.2-rc1-fb78016" />
|
<PackageVersion Include="UnicornEngine.Unicorn" Version="2.0.2-rc1-fb78016" />
|
||||||
|
@@ -141,3 +141,5 @@ See [LICENSE.txt](LICENSE.txt) and [THIRDPARTY.md](distribution/legal/THIRDPARTY
|
|||||||
|
|
||||||
- [LibHac](https://github.com/Thealexbarney/LibHac) is used for our file-system.
|
- [LibHac](https://github.com/Thealexbarney/LibHac) is used for our file-system.
|
||||||
- [AmiiboAPI](https://www.amiiboapi.com) is used in our Amiibo emulation.
|
- [AmiiboAPI](https://www.amiiboapi.com) is used in our Amiibo emulation.
|
||||||
|
- [ldn_mitm](https://github.com/spacemeowx2/ldn_mitm) is used for one of our available multiplayer modes.
|
||||||
|
- [ShellLink](https://github.com/securifybv/ShellLink) is used for Windows shortcut generation.
|
||||||
|
@@ -682,3 +682,32 @@
|
|||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
# ShellLink (MIT)
|
||||||
|
<details>
|
||||||
|
<summary>See License</summary>
|
||||||
|
|
||||||
|
```
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2017 Yorick Koster, Securify B.V.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
@@ -3,8 +3,8 @@ Version=1.0
|
|||||||
Name=Ryujinx
|
Name=Ryujinx
|
||||||
Type=Application
|
Type=Application
|
||||||
Icon=Ryujinx
|
Icon=Ryujinx
|
||||||
Exec=env DOTNET_EnableAlternateStackCheck=1 Ryujinx %f
|
Exec=Ryujinx.sh %f
|
||||||
Comment=A Nintendo Switch Emulator
|
Comment=Plays Nintendo Switch applications
|
||||||
GenericName=Nintendo Switch Emulator
|
GenericName=Nintendo Switch Emulator
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Categories=Game;Emulator;
|
Categories=Game;Emulator;
|
||||||
|
13
distribution/linux/shortcut-template.desktop
Normal file
13
distribution/linux/shortcut-template.desktop
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Version=1.0
|
||||||
|
Name={0}
|
||||||
|
Type=Application
|
||||||
|
Icon={1}
|
||||||
|
Exec={2} %f
|
||||||
|
Comment=Nintendo Switch application
|
||||||
|
GenericName=Nintendo Switch Emulator
|
||||||
|
Terminal=false
|
||||||
|
Categories=Game;Emulator;
|
||||||
|
Keywords=Switch;Nintendo;Emulator;
|
||||||
|
StartupWMClass=Ryujinx
|
||||||
|
PrefersNonDefaultGPU=true
|
35
distribution/macos/shortcut-template.plist
Normal file
35
distribution/macos/shortcut-template.plist
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>English</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>{0}</string>
|
||||||
|
<key>CFBundleGetInfoString</key>
|
||||||
|
<string>{1}</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>{2}</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<true/>
|
||||||
|
<key>CSResourcesFileMapped</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>Copyright © 2018 - 2023 Ryujinx Team and Contributors.</string>
|
||||||
|
<key>LSApplicationCategoryType</key>
|
||||||
|
<string>public.app-category.games</string>
|
||||||
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
<string>11.0</string>
|
||||||
|
<key>UIPrerenderedIcon</key>
|
||||||
|
<true/>
|
||||||
|
<key>LSEnvironment</key>
|
||||||
|
<dict>
|
||||||
|
<key>DOTNET_DefaultStackSize</key>
|
||||||
|
<string>200000</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
@@ -38,7 +38,9 @@ namespace ARMeilleure.Decoders
|
|||||||
{
|
{
|
||||||
block = new Block(blkAddress);
|
block = new Block(blkAddress);
|
||||||
|
|
||||||
if ((dMode != DecoderMode.MultipleBlocks && visited.Count >= 1) || opsCount > instructionLimit || !memory.IsMapped(blkAddress))
|
if ((dMode != DecoderMode.MultipleBlocks && visited.Count >= 1) ||
|
||||||
|
opsCount > instructionLimit ||
|
||||||
|
(visited.Count > 0 && !memory.IsMapped(blkAddress)))
|
||||||
{
|
{
|
||||||
block.Exit = true;
|
block.Exit = true;
|
||||||
block.EndAddress = blkAddress;
|
block.EndAddress = blkAddress;
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace ARMeilleure.Diagnostics
|
namespace ARMeilleure.Diagnostics
|
||||||
{
|
{
|
||||||
@@ -33,7 +34,6 @@ namespace ARMeilleure.Diagnostics
|
|||||||
|
|
||||||
public static string Get(ulong address)
|
public static string Get(ulong address)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (_symbols.TryGetValue(address, out string result))
|
if (_symbols.TryGetValue(address, out string result))
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
@@ -48,13 +48,15 @@ namespace ARMeilleure.Diagnostics
|
|||||||
ulong diff = address - symbol.Start;
|
ulong diff = address - symbol.Start;
|
||||||
ulong rem = diff % symbol.ElementSize;
|
ulong rem = diff % symbol.ElementSize;
|
||||||
|
|
||||||
result = symbol.Name + "_" + diff / symbol.ElementSize;
|
StringBuilder resultBuilder = new();
|
||||||
|
resultBuilder.Append($"{symbol.Name}_{diff / symbol.ElementSize}");
|
||||||
|
|
||||||
if (rem != 0)
|
if (rem != 0)
|
||||||
{
|
{
|
||||||
result += "+" + rem;
|
resultBuilder.Append($"+{rem}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result = resultBuilder.ToString();
|
||||||
_symbols.TryAdd(address, result);
|
_symbols.TryAdd(address, result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -189,7 +189,7 @@ namespace ARMeilleure.Translation
|
|||||||
{
|
{
|
||||||
if (start.CompareTo(node.End) < 0)
|
if (start.CompareTo(node.End) < 0)
|
||||||
{
|
{
|
||||||
if (overlaps.Length >= overlapCount)
|
if (overlaps.Length <= overlapCount)
|
||||||
{
|
{
|
||||||
Array.Resize(ref overlaps, overlapCount + ArrayGrowthSize);
|
Array.Resize(ref overlaps, overlapCount + ArrayGrowthSize);
|
||||||
}
|
}
|
||||||
|
@@ -7,14 +7,14 @@ namespace ARMeilleure.Translation
|
|||||||
internal class TranslatorCache<T>
|
internal class TranslatorCache<T>
|
||||||
{
|
{
|
||||||
private readonly IntervalTree<ulong, T> _tree;
|
private readonly IntervalTree<ulong, T> _tree;
|
||||||
private readonly ReaderWriterLock _treeLock;
|
private readonly ReaderWriterLockSlim _treeLock;
|
||||||
|
|
||||||
public int Count => _tree.Count;
|
public int Count => _tree.Count;
|
||||||
|
|
||||||
public TranslatorCache()
|
public TranslatorCache()
|
||||||
{
|
{
|
||||||
_tree = new IntervalTree<ulong, T>();
|
_tree = new IntervalTree<ulong, T>();
|
||||||
_treeLock = new ReaderWriterLock();
|
_treeLock = new ReaderWriterLockSlim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryAdd(ulong address, ulong size, T value)
|
public bool TryAdd(ulong address, ulong size, T value)
|
||||||
@@ -24,70 +24,70 @@ namespace ARMeilleure.Translation
|
|||||||
|
|
||||||
public bool AddOrUpdate(ulong address, ulong size, T value, Func<ulong, T, T> updateFactoryCallback)
|
public bool AddOrUpdate(ulong address, ulong size, T value, Func<ulong, T, T> updateFactoryCallback)
|
||||||
{
|
{
|
||||||
_treeLock.AcquireWriterLock(Timeout.Infinite);
|
_treeLock.EnterWriteLock();
|
||||||
bool result = _tree.AddOrUpdate(address, address + size, value, updateFactoryCallback);
|
bool result = _tree.AddOrUpdate(address, address + size, value, updateFactoryCallback);
|
||||||
_treeLock.ReleaseWriterLock();
|
_treeLock.ExitWriteLock();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T GetOrAdd(ulong address, ulong size, T value)
|
public T GetOrAdd(ulong address, ulong size, T value)
|
||||||
{
|
{
|
||||||
_treeLock.AcquireWriterLock(Timeout.Infinite);
|
_treeLock.EnterWriteLock();
|
||||||
value = _tree.GetOrAdd(address, address + size, value);
|
value = _tree.GetOrAdd(address, address + size, value);
|
||||||
_treeLock.ReleaseWriterLock();
|
_treeLock.ExitWriteLock();
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Remove(ulong address)
|
public bool Remove(ulong address)
|
||||||
{
|
{
|
||||||
_treeLock.AcquireWriterLock(Timeout.Infinite);
|
_treeLock.EnterWriteLock();
|
||||||
bool removed = _tree.Remove(address) != 0;
|
bool removed = _tree.Remove(address) != 0;
|
||||||
_treeLock.ReleaseWriterLock();
|
_treeLock.ExitWriteLock();
|
||||||
|
|
||||||
return removed;
|
return removed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
_treeLock.AcquireWriterLock(Timeout.Infinite);
|
_treeLock.EnterWriteLock();
|
||||||
_tree.Clear();
|
_tree.Clear();
|
||||||
_treeLock.ReleaseWriterLock();
|
_treeLock.ExitWriteLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ContainsKey(ulong address)
|
public bool ContainsKey(ulong address)
|
||||||
{
|
{
|
||||||
_treeLock.AcquireReaderLock(Timeout.Infinite);
|
_treeLock.EnterReadLock();
|
||||||
bool result = _tree.ContainsKey(address);
|
bool result = _tree.ContainsKey(address);
|
||||||
_treeLock.ReleaseReaderLock();
|
_treeLock.ExitReadLock();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGetValue(ulong address, out T value)
|
public bool TryGetValue(ulong address, out T value)
|
||||||
{
|
{
|
||||||
_treeLock.AcquireReaderLock(Timeout.Infinite);
|
_treeLock.EnterReadLock();
|
||||||
bool result = _tree.TryGet(address, out value);
|
bool result = _tree.TryGet(address, out value);
|
||||||
_treeLock.ReleaseReaderLock();
|
_treeLock.ExitReadLock();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetOverlaps(ulong address, ulong size, ref ulong[] overlaps)
|
public int GetOverlaps(ulong address, ulong size, ref ulong[] overlaps)
|
||||||
{
|
{
|
||||||
_treeLock.AcquireReaderLock(Timeout.Infinite);
|
_treeLock.EnterReadLock();
|
||||||
int count = _tree.Get(address, address + size, ref overlaps);
|
int count = _tree.Get(address, address + size, ref overlaps);
|
||||||
_treeLock.ReleaseReaderLock();
|
_treeLock.ExitReadLock();
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<T> AsList()
|
public List<T> AsList()
|
||||||
{
|
{
|
||||||
_treeLock.AcquireReaderLock(Timeout.Infinite);
|
_treeLock.EnterReadLock();
|
||||||
List<T> list = _tree.AsList();
|
List<T> list = _tree.AsList();
|
||||||
_treeLock.ReleaseReaderLock();
|
_treeLock.ExitReadLock();
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@@ -31,9 +31,18 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
|
|
||||||
public bool IsEffectEnabled { get; }
|
public bool IsEffectEnabled { get; }
|
||||||
|
|
||||||
public AuxiliaryBufferCommand(uint bufferOffset, byte inputBufferOffset, byte outputBufferOffset,
|
public AuxiliaryBufferCommand(
|
||||||
ref AuxiliaryBufferAddresses sendBufferInfo, bool isEnabled, uint countMax,
|
uint bufferOffset,
|
||||||
CpuAddress outputBuffer, CpuAddress inputBuffer, uint updateCount, uint writeOffset, int nodeId)
|
byte inputBufferOffset,
|
||||||
|
byte outputBufferOffset,
|
||||||
|
ref AuxiliaryBufferAddresses sendBufferInfo,
|
||||||
|
bool isEnabled,
|
||||||
|
uint countMax,
|
||||||
|
CpuAddress outputBuffer,
|
||||||
|
CpuAddress inputBuffer,
|
||||||
|
uint updateCount,
|
||||||
|
uint writeOffset,
|
||||||
|
int nodeId)
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
NodeId = nodeId;
|
NodeId = nodeId;
|
||||||
|
@@ -21,7 +21,14 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
|
|
||||||
private BiquadFilterParameter _parameter;
|
private BiquadFilterParameter _parameter;
|
||||||
|
|
||||||
public BiquadFilterCommand(int baseIndex, ref BiquadFilterParameter filter, Memory<BiquadFilterState> biquadFilterStateMemory, int inputBufferOffset, int outputBufferOffset, bool needInitialization, int nodeId)
|
public BiquadFilterCommand(
|
||||||
|
int baseIndex,
|
||||||
|
ref BiquadFilterParameter filter,
|
||||||
|
Memory<BiquadFilterState> biquadFilterStateMemory,
|
||||||
|
int inputBufferOffset,
|
||||||
|
int outputBufferOffset,
|
||||||
|
bool needInitialization,
|
||||||
|
int nodeId)
|
||||||
{
|
{
|
||||||
_parameter = filter;
|
_parameter = filter;
|
||||||
BiquadFilterState = biquadFilterStateMemory;
|
BiquadFilterState = biquadFilterStateMemory;
|
||||||
|
@@ -77,7 +77,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe void ClearBuffer(int index)
|
public unsafe void ClearBuffer(int index)
|
||||||
{
|
{
|
||||||
Unsafe.InitBlock((void*)GetBufferPointer(index), 0, SampleCount);
|
Unsafe.InitBlock((void*)GetBufferPointer(index), 0, SampleCount * sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
@@ -89,7 +89,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public unsafe void CopyBuffer(int outputBufferIndex, int inputBufferIndex)
|
public unsafe void CopyBuffer(int outputBufferIndex, int inputBufferIndex)
|
||||||
{
|
{
|
||||||
Unsafe.CopyBlock((void*)GetBufferPointer(outputBufferIndex), (void*)GetBufferPointer(inputBufferIndex), SampleCount);
|
Unsafe.CopyBlock((void*)GetBufferPointer(outputBufferIndex), (void*)GetBufferPointer(inputBufferIndex), SampleCount * sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
@@ -94,18 +94,18 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
|
|
||||||
float newMean = inputMovingAverage.Update(FloatingPointHelper.MeanSquare(channelInput), _parameter.InputGain);
|
float newMean = inputMovingAverage.Update(FloatingPointHelper.MeanSquare(channelInput), _parameter.InputGain);
|
||||||
float y = FloatingPointHelper.Log10(newMean) * 10.0f;
|
float y = FloatingPointHelper.Log10(newMean) * 10.0f;
|
||||||
float z = 0.0f;
|
float z = 1.0f;
|
||||||
|
|
||||||
bool unknown10OutOfRange = false;
|
bool unknown10OutOfRange = y >= state.Unknown10;
|
||||||
|
|
||||||
if (newMean < 1.0e-10f)
|
if (newMean < 1.0e-10f)
|
||||||
{
|
{
|
||||||
z = 1.0f;
|
y = -100.0f;
|
||||||
|
|
||||||
unknown10OutOfRange = state.Unknown10 < -100.0f;
|
unknown10OutOfRange = state.Unknown10 <= -100.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y >= state.Unknown10 || unknown10OutOfRange)
|
if (unknown10OutOfRange)
|
||||||
{
|
{
|
||||||
float tmpGain;
|
float tmpGain;
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
tmpGain = (y - state.Unknown10) * ((y - state.Unknown10) * -state.CompressorGainReduction);
|
tmpGain = (y - state.Unknown10) * ((y - state.Unknown10) * -state.CompressorGainReduction);
|
||||||
}
|
}
|
||||||
|
|
||||||
z = FloatingPointHelper.DecibelToLinearExtended(tmpGain);
|
z = FloatingPointHelper.DecibelToLinear(tmpGain);
|
||||||
}
|
}
|
||||||
|
|
||||||
float unknown4New = z;
|
float unknown4New = z;
|
||||||
|
@@ -28,7 +28,14 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
|
|
||||||
private LimiterParameter _parameter;
|
private LimiterParameter _parameter;
|
||||||
|
|
||||||
public LimiterCommandVersion2(uint bufferOffset, LimiterParameter parameter, Memory<LimiterState> state, Memory<EffectResultState> resultState, bool isEnabled, ulong workBuffer, int nodeId)
|
public LimiterCommandVersion2(
|
||||||
|
uint bufferOffset,
|
||||||
|
LimiterParameter parameter,
|
||||||
|
Memory<LimiterState> state,
|
||||||
|
Memory<EffectResultState> resultState,
|
||||||
|
bool isEnabled,
|
||||||
|
ulong workBuffer,
|
||||||
|
int nodeId)
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
NodeId = nodeId;
|
NodeId = nodeId;
|
||||||
|
@@ -79,7 +79,8 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
private void ProcessReverbMono(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
|
private void ProcessReverbMono(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
|
||||||
{
|
{
|
||||||
ProcessReverbGeneric(ref state,
|
ProcessReverbGeneric(
|
||||||
|
ref state,
|
||||||
outputBuffers,
|
outputBuffers,
|
||||||
inputBuffers,
|
inputBuffers,
|
||||||
sampleCount,
|
sampleCount,
|
||||||
@@ -92,7 +93,8 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
private void ProcessReverbStereo(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
|
private void ProcessReverbStereo(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
|
||||||
{
|
{
|
||||||
ProcessReverbGeneric(ref state,
|
ProcessReverbGeneric(
|
||||||
|
ref state,
|
||||||
outputBuffers,
|
outputBuffers,
|
||||||
inputBuffers,
|
inputBuffers,
|
||||||
sampleCount,
|
sampleCount,
|
||||||
@@ -105,7 +107,8 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
private void ProcessReverbQuadraphonic(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
|
private void ProcessReverbQuadraphonic(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
|
||||||
{
|
{
|
||||||
ProcessReverbGeneric(ref state,
|
ProcessReverbGeneric(
|
||||||
|
ref state,
|
||||||
outputBuffers,
|
outputBuffers,
|
||||||
inputBuffers,
|
inputBuffers,
|
||||||
sampleCount,
|
sampleCount,
|
||||||
@@ -118,7 +121,8 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
private void ProcessReverbSurround(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
|
private void ProcessReverbSurround(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
|
||||||
{
|
{
|
||||||
ProcessReverbGeneric(ref state,
|
ProcessReverbGeneric(
|
||||||
|
ref state,
|
||||||
outputBuffers,
|
outputBuffers,
|
||||||
inputBuffers,
|
inputBuffers,
|
||||||
sampleCount,
|
sampleCount,
|
||||||
|
@@ -52,7 +52,7 @@ namespace Ryujinx.Audio.Renderer.Dsp
|
|||||||
{
|
{
|
||||||
// NOTE: Nintendo uses an approximation of log10, we don't.
|
// NOTE: Nintendo uses an approximation of log10, we don't.
|
||||||
// As such, we support the same ranges as Nintendo to avoid unexpected behaviours.
|
// As such, we support the same ranges as Nintendo to avoid unexpected behaviours.
|
||||||
return MathF.Pow(10, MathF.Max(x, 1.0e-10f));
|
return MathF.Log10(MathF.Max(x, 1.0e-10f));
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
@@ -62,7 +62,8 @@ namespace Ryujinx.Audio.Renderer.Dsp
|
|||||||
|
|
||||||
foreach (float input in inputs)
|
foreach (float input in inputs)
|
||||||
{
|
{
|
||||||
res += (input * input);
|
float normInput = input * (1f / 32768f);
|
||||||
|
res += normInput * normInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
res /= inputs.Length;
|
res /= inputs.Length;
|
||||||
@@ -81,19 +82,6 @@ namespace Ryujinx.Audio.Renderer.Dsp
|
|||||||
return MathF.Pow(10.0f, db / 20.0f);
|
return MathF.Pow(10.0f, db / 20.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Map decibel to linear in [0, 2] range.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="db">The decibel value to convert</param>
|
|
||||||
/// <returns>Converted linear value in [0, 2] range</returns>
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static float DecibelToLinearExtended(float db)
|
|
||||||
{
|
|
||||||
float tmp = MathF.Log2(DecibelToLinear(db));
|
|
||||||
|
|
||||||
return MathF.Truncate(tmp) + MathF.Pow(2.0f, tmp - MathF.Truncate(tmp));
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static float DegreesToRadians(float degrees)
|
public static float DegreesToRadians(float degrees)
|
||||||
{
|
{
|
||||||
|
@@ -3,7 +3,7 @@ using Ryujinx.Audio.Renderer.Parameter.Effect;
|
|||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp.State
|
namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||||
{
|
{
|
||||||
public class CompressorState
|
public struct CompressorState
|
||||||
{
|
{
|
||||||
public ExponentialMovingAverage InputMovingAverage;
|
public ExponentialMovingAverage InputMovingAverage;
|
||||||
public float Unknown4;
|
public float Unknown4;
|
||||||
@@ -45,7 +45,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
|||||||
CompressorGainReduction = (1.0f - ratio) / Constants.ChannelCountMax;
|
CompressorGainReduction = (1.0f - ratio) / Constants.ChannelCountMax;
|
||||||
Unknown10 = threshold - 1.5f;
|
Unknown10 = threshold - 1.5f;
|
||||||
Unknown14 = threshold + 1.5f;
|
Unknown14 = threshold + 1.5f;
|
||||||
OutputGain = FloatingPointHelper.DecibelToLinearExtended(parameter.OutputGain + makeupGain);
|
OutputGain = FloatingPointHelper.DecibelToLinear(parameter.OutputGain + makeupGain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@ using System.Runtime.CompilerServices;
|
|||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp.State
|
namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||||
{
|
{
|
||||||
public class DelayState
|
public struct DelayState
|
||||||
{
|
{
|
||||||
public DelayLine[] DelayLines { get; }
|
public DelayLine[] DelayLines { get; }
|
||||||
public float[] LowPassZ { get; set; }
|
public float[] LowPassZ { get; set; }
|
||||||
@@ -53,7 +53,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
|||||||
LowPassBaseGain = 1.0f - LowPassFeedbackGain;
|
LowPassBaseGain = 1.0f - LowPassFeedbackGain;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateLowPassFilter(ref float tempRawRef, uint channelCount)
|
public readonly void UpdateLowPassFilter(ref float tempRawRef, uint channelCount)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < channelCount; i++)
|
for (int i = 0; i < channelCount; i++)
|
||||||
{
|
{
|
||||||
|
@@ -4,7 +4,7 @@ using System;
|
|||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp.State
|
namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||||
{
|
{
|
||||||
public class LimiterState
|
public struct LimiterState
|
||||||
{
|
{
|
||||||
public ExponentialMovingAverage[] DetectorAverage;
|
public ExponentialMovingAverage[] DetectorAverage;
|
||||||
public ExponentialMovingAverage[] CompressionGainAverage;
|
public ExponentialMovingAverage[] CompressionGainAverage;
|
||||||
|
@@ -4,7 +4,7 @@ using System;
|
|||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp.State
|
namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||||
{
|
{
|
||||||
public class Reverb3dState
|
public struct Reverb3dState
|
||||||
{
|
{
|
||||||
private readonly float[] _fdnDelayMinTimes = new float[4] { 5.0f, 6.0f, 13.0f, 14.0f };
|
private readonly float[] _fdnDelayMinTimes = new float[4] { 5.0f, 6.0f, 13.0f, 14.0f };
|
||||||
private readonly float[] _fdnDelayMaxTimes = new float[4] { 45.704f, 82.782f, 149.94f, 271.58f };
|
private readonly float[] _fdnDelayMaxTimes = new float[4] { 45.704f, 82.782f, 149.94f, 271.58f };
|
||||||
|
@@ -5,7 +5,7 @@ using System;
|
|||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp.State
|
namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||||
{
|
{
|
||||||
public class ReverbState
|
public struct ReverbState
|
||||||
{
|
{
|
||||||
private static readonly float[] _fdnDelayTimes = new float[20]
|
private static readonly float[] _fdnDelayTimes = new float[20]
|
||||||
{
|
{
|
||||||
|
@@ -104,7 +104,7 @@ namespace Ryujinx.Ava
|
|||||||
{
|
{
|
||||||
"Light" => ThemeVariant.Light,
|
"Light" => ThemeVariant.Light,
|
||||||
"Dark" => ThemeVariant.Dark,
|
"Dark" => ThemeVariant.Dark,
|
||||||
_ => ThemeVariant.Default
|
_ => ThemeVariant.Default,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (enableCustomTheme)
|
if (enableCustomTheme)
|
||||||
|
@@ -3,7 +3,6 @@ using Avalonia;
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Controls.ApplicationLifetimes;
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Rendering;
|
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
using LibHac.Tools.FsSystem;
|
using LibHac.Tools.FsSystem;
|
||||||
using Ryujinx.Audio.Backends.Dummy;
|
using Ryujinx.Audio.Backends.Dummy;
|
||||||
@@ -21,6 +20,7 @@ using Ryujinx.Ava.UI.ViewModels;
|
|||||||
using Ryujinx.Ava.UI.Windows;
|
using Ryujinx.Ava.UI.Windows;
|
||||||
using Ryujinx.Common;
|
using Ryujinx.Common;
|
||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
|
using Ryujinx.Common.Configuration.Multiplayer;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Common.SystemInterop;
|
using Ryujinx.Common.SystemInterop;
|
||||||
using Ryujinx.Graphics.GAL;
|
using Ryujinx.Graphics.GAL;
|
||||||
@@ -190,7 +190,9 @@ namespace Ryujinx.Ava
|
|||||||
ConfigurationState.Instance.Graphics.ScalingFilterLevel.Event += UpdateScalingFilterLevel;
|
ConfigurationState.Instance.Graphics.ScalingFilterLevel.Event += UpdateScalingFilterLevel;
|
||||||
ConfigurationState.Instance.Graphics.EnableColorSpacePassthrough.Event += UpdateColorSpacePassthrough;
|
ConfigurationState.Instance.Graphics.EnableColorSpacePassthrough.Event += UpdateColorSpacePassthrough;
|
||||||
|
|
||||||
|
ConfigurationState.Instance.System.EnableInternetAccess.Event += UpdateEnableInternetAccessState;
|
||||||
ConfigurationState.Instance.Multiplayer.LanInterfaceId.Event += UpdateLanInterfaceIdState;
|
ConfigurationState.Instance.Multiplayer.LanInterfaceId.Event += UpdateLanInterfaceIdState;
|
||||||
|
ConfigurationState.Instance.Multiplayer.Mode.Event += UpdateMultiplayerModeState;
|
||||||
|
|
||||||
_gpuCancellationTokenSource = new CancellationTokenSource();
|
_gpuCancellationTokenSource = new CancellationTokenSource();
|
||||||
_gpuDoneEvent = new ManualResetEvent(false);
|
_gpuDoneEvent = new ManualResetEvent(false);
|
||||||
@@ -407,11 +409,21 @@ namespace Ryujinx.Ava
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateEnableInternetAccessState(object sender, ReactiveEventArgs<bool> e)
|
||||||
|
{
|
||||||
|
Device.Configuration.EnableInternetAccess = e.NewValue;
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateLanInterfaceIdState(object sender, ReactiveEventArgs<string> e)
|
private void UpdateLanInterfaceIdState(object sender, ReactiveEventArgs<string> e)
|
||||||
{
|
{
|
||||||
Device.Configuration.MultiplayerLanInterfaceId = e.NewValue;
|
Device.Configuration.MultiplayerLanInterfaceId = e.NewValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateMultiplayerModeState(object sender, ReactiveEventArgs<MultiplayerMode> e)
|
||||||
|
{
|
||||||
|
Device.Configuration.MultiplayerMode = e.NewValue;
|
||||||
|
}
|
||||||
|
|
||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
_isActive = false;
|
_isActive = false;
|
||||||
@@ -704,7 +716,7 @@ namespace Ryujinx.Ava
|
|||||||
|
|
||||||
ApplicationLibrary.LoadAndSaveMetaData(Device.Processes.ActiveApplication.ProgramIdText, appMetadata =>
|
ApplicationLibrary.LoadAndSaveMetaData(Device.Processes.ActiveApplication.ProgramIdText, appMetadata =>
|
||||||
{
|
{
|
||||||
appMetadata.LastPlayed = DateTime.UtcNow;
|
appMetadata.UpdatePreGame();
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -782,7 +794,8 @@ namespace Ryujinx.Ava
|
|||||||
ConfigurationState.Instance.Graphics.AspectRatio,
|
ConfigurationState.Instance.Graphics.AspectRatio,
|
||||||
ConfigurationState.Instance.System.AudioVolume,
|
ConfigurationState.Instance.System.AudioVolume,
|
||||||
ConfigurationState.Instance.System.UseHypervisor,
|
ConfigurationState.Instance.System.UseHypervisor,
|
||||||
ConfigurationState.Instance.Multiplayer.LanInterfaceId.Value);
|
ConfigurationState.Instance.Multiplayer.LanInterfaceId.Value,
|
||||||
|
ConfigurationState.Instance.Multiplayer.Mode);
|
||||||
|
|
||||||
Device = new Switch(configuration);
|
Device = new Switch(configuration);
|
||||||
}
|
}
|
||||||
|
@@ -72,6 +72,8 @@
|
|||||||
"GameListContextMenuExtractDataRomFSToolTip": "Extract the RomFS section from Application's current config (including updates)",
|
"GameListContextMenuExtractDataRomFSToolTip": "Extract the RomFS section from Application's current config (including updates)",
|
||||||
"GameListContextMenuExtractDataLogo": "Logo",
|
"GameListContextMenuExtractDataLogo": "Logo",
|
||||||
"GameListContextMenuExtractDataLogoToolTip": "Extract the Logo section from Application's current config (including updates)",
|
"GameListContextMenuExtractDataLogoToolTip": "Extract the Logo section from Application's current config (including updates)",
|
||||||
|
"GameListContextMenuCreateShortcut": "Create Application Shortcut",
|
||||||
|
"GameListContextMenuCreateShortcutToolTip": "Create a Desktop Shortcut that launches the selected Application",
|
||||||
"StatusBarGamesLoaded": "{0}/{1} Games Loaded",
|
"StatusBarGamesLoaded": "{0}/{1} Games Loaded",
|
||||||
"StatusBarSystemVersion": "System Version: {0}",
|
"StatusBarSystemVersion": "System Version: {0}",
|
||||||
"LinuxVmMaxMapCountDialogTitle": "Low limit for memory mappings detected",
|
"LinuxVmMaxMapCountDialogTitle": "Low limit for memory mappings detected",
|
||||||
@@ -648,9 +650,12 @@
|
|||||||
"UserEditorTitle": "Edit User",
|
"UserEditorTitle": "Edit User",
|
||||||
"UserEditorTitleCreate": "Create User",
|
"UserEditorTitleCreate": "Create User",
|
||||||
"SettingsTabNetworkInterface": "Network Interface:",
|
"SettingsTabNetworkInterface": "Network Interface:",
|
||||||
"NetworkInterfaceTooltip": "The network interface used for LAN features",
|
"NetworkInterfaceTooltip": "The network interface used for LAN/LDN features",
|
||||||
"NetworkInterfaceDefault": "Default",
|
"NetworkInterfaceDefault": "Default",
|
||||||
"PackagingShaders": "Packaging Shaders",
|
"PackagingShaders": "Packaging Shaders",
|
||||||
"AboutChangelogButton": "View Changelog on GitHub",
|
"AboutChangelogButton": "View Changelog on GitHub",
|
||||||
"AboutChangelogButtonTooltipMessage": "Click to open the changelog for this version in your default browser."
|
"AboutChangelogButtonTooltipMessage": "Click to open the changelog for this version in your default browser.",
|
||||||
|
"SettingsTabNetworkMultiplayer": "Multiplayer",
|
||||||
|
"MultiplayerMode": "Mode:",
|
||||||
|
"MultiplayerModeTooltip": "Change multiplayer mode"
|
||||||
}
|
}
|
@@ -15,7 +15,6 @@ using LibHac.Tools.FsSystem.NcaUtils;
|
|||||||
using Ryujinx.Ava.Common.Locale;
|
using Ryujinx.Ava.Common.Locale;
|
||||||
using Ryujinx.Ava.UI.Controls;
|
using Ryujinx.Ava.UI.Controls;
|
||||||
using Ryujinx.Ava.UI.Helpers;
|
using Ryujinx.Ava.UI.Helpers;
|
||||||
using Ryujinx.Ava.UI.Windows;
|
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.HLE.FileSystem;
|
using Ryujinx.HLE.FileSystem;
|
||||||
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
||||||
@@ -36,11 +35,9 @@ namespace Ryujinx.Ava.Common
|
|||||||
private static HorizonClient _horizonClient;
|
private static HorizonClient _horizonClient;
|
||||||
private static AccountManager _accountManager;
|
private static AccountManager _accountManager;
|
||||||
private static VirtualFileSystem _virtualFileSystem;
|
private static VirtualFileSystem _virtualFileSystem;
|
||||||
private static StyleableWindow _owner;
|
|
||||||
|
|
||||||
public static void Initialize(VirtualFileSystem virtualFileSystem, AccountManager accountManager, HorizonClient horizonClient, StyleableWindow owner)
|
public static void Initialize(VirtualFileSystem virtualFileSystem, AccountManager accountManager, HorizonClient horizonClient)
|
||||||
{
|
{
|
||||||
_owner = owner;
|
|
||||||
_virtualFileSystem = virtualFileSystem;
|
_virtualFileSystem = virtualFileSystem;
|
||||||
_horizonClient = horizonClient;
|
_horizonClient = horizonClient;
|
||||||
_accountManager = accountManager;
|
_accountManager = accountManager;
|
||||||
@@ -148,7 +145,7 @@ namespace Ryujinx.Ava.Common
|
|||||||
var result = await storageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
var result = await storageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
||||||
{
|
{
|
||||||
Title = LocaleManager.Instance[LocaleKeys.FolderDialogExtractTitle],
|
Title = LocaleManager.Instance[LocaleKeys.FolderDialogExtractTitle],
|
||||||
AllowMultiple = false
|
AllowMultiple = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.Count == 0)
|
if (result.Count == 0)
|
||||||
@@ -176,7 +173,7 @@ namespace Ryujinx.Ava.Common
|
|||||||
string extension = Path.GetExtension(titleFilePath).ToLower();
|
string extension = Path.GetExtension(titleFilePath).ToLower();
|
||||||
if (extension == ".nsp" || extension == ".pfs0" || extension == ".xci")
|
if (extension == ".nsp" || extension == ".pfs0" || extension == ".xci")
|
||||||
{
|
{
|
||||||
PartitionFileSystem pfs;
|
IFileSystem pfs;
|
||||||
|
|
||||||
if (extension == ".xci")
|
if (extension == ".xci")
|
||||||
{
|
{
|
||||||
@@ -184,7 +181,9 @@ namespace Ryujinx.Ava.Common
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pfs = new PartitionFileSystem(file.AsStorage());
|
var pfsTemp = new PartitionFileSystem();
|
||||||
|
pfsTemp.Initialize(file.AsStorage()).ThrowIfFailure();
|
||||||
|
pfs = pfsTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (DirectoryEntryEx fileEntry in pfs.EnumerateEntries("/", "*.nca"))
|
foreach (DirectoryEntryEx fileEntry in pfs.EnumerateEntries("/", "*.nca"))
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
|
||||||
using Ryujinx.Ava.Common.Locale;
|
using Ryujinx.Ava.Common.Locale;
|
||||||
using Ryujinx.Input;
|
using Ryujinx.Input;
|
||||||
using System;
|
using System;
|
||||||
|
@@ -82,12 +82,9 @@ namespace Ryujinx.Modules
|
|||||||
{
|
{
|
||||||
Logger.Error?.Print(LogClass.Application, "Failed to convert the current Ryujinx version!");
|
Logger.Error?.Print(LogClass.Application, "Failed to convert the current Ryujinx version!");
|
||||||
|
|
||||||
Dispatcher.UIThread.Post(async () =>
|
|
||||||
{
|
|
||||||
await ContentDialogHelper.CreateWarningDialog(
|
await ContentDialogHelper.CreateWarningDialog(
|
||||||
LocaleManager.Instance[LocaleKeys.DialogUpdaterConvertFailedMessage],
|
LocaleManager.Instance[LocaleKeys.DialogUpdaterConvertFailedMessage],
|
||||||
LocaleManager.Instance[LocaleKeys.DialogUpdaterCancelUpdateMessage]);
|
LocaleManager.Instance[LocaleKeys.DialogUpdaterCancelUpdateMessage]);
|
||||||
});
|
|
||||||
|
|
||||||
_running = false;
|
_running = false;
|
||||||
|
|
||||||
@@ -114,10 +111,9 @@ namespace Ryujinx.Modules
|
|||||||
{
|
{
|
||||||
if (showVersionUpToDate)
|
if (showVersionUpToDate)
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(async () =>
|
await ContentDialogHelper.CreateUpdaterInfoDialog(
|
||||||
{
|
LocaleManager.Instance[LocaleKeys.DialogUpdaterAlreadyOnLatestVersionMessage],
|
||||||
await ContentDialogHelper.CreateUpdaterInfoDialog(LocaleManager.Instance[LocaleKeys.DialogUpdaterAlreadyOnLatestVersionMessage], "");
|
"");
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_running = false;
|
_running = false;
|
||||||
@@ -134,10 +130,9 @@ namespace Ryujinx.Modules
|
|||||||
{
|
{
|
||||||
if (showVersionUpToDate)
|
if (showVersionUpToDate)
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(async () =>
|
await ContentDialogHelper.CreateUpdaterInfoDialog(
|
||||||
{
|
LocaleManager.Instance[LocaleKeys.DialogUpdaterAlreadyOnLatestVersionMessage],
|
||||||
await ContentDialogHelper.CreateUpdaterInfoDialog(LocaleManager.Instance[LocaleKeys.DialogUpdaterAlreadyOnLatestVersionMessage], "");
|
"");
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_running = false;
|
_running = false;
|
||||||
@@ -149,10 +144,8 @@ namespace Ryujinx.Modules
|
|||||||
{
|
{
|
||||||
Logger.Error?.Print(LogClass.Application, exception.Message);
|
Logger.Error?.Print(LogClass.Application, exception.Message);
|
||||||
|
|
||||||
Dispatcher.UIThread.Post(async () =>
|
await ContentDialogHelper.CreateErrorDialog(
|
||||||
{
|
LocaleManager.Instance[LocaleKeys.DialogUpdaterFailedToGetVersionMessage]);
|
||||||
await ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance[LocaleKeys.DialogUpdaterFailedToGetVersionMessage]);
|
|
||||||
});
|
|
||||||
|
|
||||||
_running = false;
|
_running = false;
|
||||||
|
|
||||||
@@ -167,12 +160,9 @@ namespace Ryujinx.Modules
|
|||||||
{
|
{
|
||||||
Logger.Error?.Print(LogClass.Application, "Failed to convert the received Ryujinx version from Github!");
|
Logger.Error?.Print(LogClass.Application, "Failed to convert the received Ryujinx version from Github!");
|
||||||
|
|
||||||
Dispatcher.UIThread.Post(async () =>
|
|
||||||
{
|
|
||||||
await ContentDialogHelper.CreateWarningDialog(
|
await ContentDialogHelper.CreateWarningDialog(
|
||||||
LocaleManager.Instance[LocaleKeys.DialogUpdaterConvertFailedGithubMessage],
|
LocaleManager.Instance[LocaleKeys.DialogUpdaterConvertFailedGithubMessage],
|
||||||
LocaleManager.Instance[LocaleKeys.DialogUpdaterCancelUpdateMessage]);
|
LocaleManager.Instance[LocaleKeys.DialogUpdaterCancelUpdateMessage]);
|
||||||
});
|
|
||||||
|
|
||||||
_running = false;
|
_running = false;
|
||||||
|
|
||||||
@@ -183,10 +173,9 @@ namespace Ryujinx.Modules
|
|||||||
{
|
{
|
||||||
if (showVersionUpToDate)
|
if (showVersionUpToDate)
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(async () =>
|
await ContentDialogHelper.CreateUpdaterInfoDialog(
|
||||||
{
|
LocaleManager.Instance[LocaleKeys.DialogUpdaterAlreadyOnLatestVersionMessage],
|
||||||
await ContentDialogHelper.CreateUpdaterInfoDialog(LocaleManager.Instance[LocaleKeys.DialogUpdaterAlreadyOnLatestVersionMessage], "");
|
"");
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_running = false;
|
_running = false;
|
||||||
@@ -212,7 +201,7 @@ namespace Ryujinx.Modules
|
|||||||
_buildSize = -1;
|
_buildSize = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dispatcher.UIThread.Post(async () =>
|
await Dispatcher.UIThread.InvokeAsync(async () =>
|
||||||
{
|
{
|
||||||
// Show a message asking the user if they want to update
|
// Show a message asking the user if they want to update
|
||||||
var shouldUpdate = await ContentDialogHelper.CreateChoiceDialog(
|
var shouldUpdate = await ContentDialogHelper.CreateChoiceDialog(
|
||||||
@@ -222,7 +211,7 @@ namespace Ryujinx.Modules
|
|||||||
|
|
||||||
if (shouldUpdate)
|
if (shouldUpdate)
|
||||||
{
|
{
|
||||||
UpdateRyujinx(mainWindow, _buildUrl);
|
await UpdateRyujinx(mainWindow, _buildUrl);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -241,7 +230,7 @@ namespace Ryujinx.Modules
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async void UpdateRyujinx(Window parent, string downloadUrl)
|
private static async Task UpdateRyujinx(Window parent, string downloadUrl)
|
||||||
{
|
{
|
||||||
_updateSuccessful = false;
|
_updateSuccessful = false;
|
||||||
|
|
||||||
@@ -579,14 +568,12 @@ namespace Ryujinx.Modules
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async void InstallUpdate(TaskDialog taskDialog, string updateFile)
|
private static void InstallUpdate(TaskDialog taskDialog, string updateFile)
|
||||||
{
|
{
|
||||||
// Extract Update
|
// Extract Update
|
||||||
taskDialog.SubHeader = LocaleManager.Instance[LocaleKeys.UpdaterExtracting];
|
taskDialog.SubHeader = LocaleManager.Instance[LocaleKeys.UpdaterExtracting];
|
||||||
taskDialog.SetProgressBarState(0, TaskDialogProgressState.Normal);
|
taskDialog.SetProgressBarState(0, TaskDialogProgressState.Normal);
|
||||||
|
|
||||||
await Task.Run(() =>
|
|
||||||
{
|
|
||||||
if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS())
|
if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS())
|
||||||
{
|
{
|
||||||
ExtractTarGzipFile(taskDialog, updateFile, _updateDir);
|
ExtractTarGzipFile(taskDialog, updateFile, _updateDir);
|
||||||
@@ -599,7 +586,6 @@ namespace Ryujinx.Modules
|
|||||||
{
|
{
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
// Delete downloaded zip
|
// Delete downloaded zip
|
||||||
File.Delete(updateFile);
|
File.Delete(updateFile);
|
||||||
@@ -613,8 +599,6 @@ namespace Ryujinx.Modules
|
|||||||
if (!OperatingSystem.IsMacOS())
|
if (!OperatingSystem.IsMacOS())
|
||||||
{
|
{
|
||||||
// Replace old files
|
// Replace old files
|
||||||
await Task.Run(() =>
|
|
||||||
{
|
|
||||||
double count = 0;
|
double count = 0;
|
||||||
foreach (string file in allFiles)
|
foreach (string file in allFiles)
|
||||||
{
|
{
|
||||||
@@ -623,7 +607,7 @@ namespace Ryujinx.Modules
|
|||||||
{
|
{
|
||||||
File.Move(file, file + ".ryuold");
|
File.Move(file, file + ".ryuold");
|
||||||
|
|
||||||
Dispatcher.UIThread.Post(() =>
|
Dispatcher.UIThread.InvokeAsync(() =>
|
||||||
{
|
{
|
||||||
taskDialog.SetProgressBarState(GetPercentage(count, allFiles.Count), TaskDialogProgressState.Normal);
|
taskDialog.SetProgressBarState(GetPercentage(count, allFiles.Count), TaskDialogProgressState.Normal);
|
||||||
});
|
});
|
||||||
@@ -634,14 +618,13 @@ namespace Ryujinx.Modules
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Dispatcher.UIThread.Post(() =>
|
Dispatcher.UIThread.InvokeAsync(() =>
|
||||||
{
|
{
|
||||||
taskDialog.SubHeader = LocaleManager.Instance[LocaleKeys.UpdaterAddingFiles];
|
taskDialog.SubHeader = LocaleManager.Instance[LocaleKeys.UpdaterAddingFiles];
|
||||||
taskDialog.SetProgressBarState(0, TaskDialogProgressState.Normal);
|
taskDialog.SetProgressBarState(0, TaskDialogProgressState.Normal);
|
||||||
});
|
});
|
||||||
|
|
||||||
MoveAllFilesOver(_updatePublishDir, _homeDir, taskDialog);
|
MoveAllFilesOver(_updatePublishDir, _homeDir, taskDialog);
|
||||||
});
|
|
||||||
|
|
||||||
Directory.Delete(_updateDir, true);
|
Directory.Delete(_updateDir, true);
|
||||||
}
|
}
|
||||||
@@ -658,12 +641,11 @@ namespace Ryujinx.Modules
|
|||||||
{
|
{
|
||||||
if (showWarnings)
|
if (showWarnings)
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(async () =>
|
Dispatcher.UIThread.InvokeAsync(() =>
|
||||||
{
|
ContentDialogHelper.CreateWarningDialog(
|
||||||
await ContentDialogHelper.CreateWarningDialog(
|
|
||||||
LocaleManager.Instance[LocaleKeys.DialogUpdaterArchNotSupportedMessage],
|
LocaleManager.Instance[LocaleKeys.DialogUpdaterArchNotSupportedMessage],
|
||||||
LocaleManager.Instance[LocaleKeys.DialogUpdaterArchNotSupportedSubMessage]);
|
LocaleManager.Instance[LocaleKeys.DialogUpdaterArchNotSupportedSubMessage])
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -673,12 +655,11 @@ namespace Ryujinx.Modules
|
|||||||
{
|
{
|
||||||
if (showWarnings)
|
if (showWarnings)
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(async () =>
|
Dispatcher.UIThread.InvokeAsync(() =>
|
||||||
{
|
ContentDialogHelper.CreateWarningDialog(
|
||||||
await ContentDialogHelper.CreateWarningDialog(
|
|
||||||
LocaleManager.Instance[LocaleKeys.DialogUpdaterNoInternetMessage],
|
LocaleManager.Instance[LocaleKeys.DialogUpdaterNoInternetMessage],
|
||||||
LocaleManager.Instance[LocaleKeys.DialogUpdaterNoInternetSubMessage]);
|
LocaleManager.Instance[LocaleKeys.DialogUpdaterNoInternetSubMessage])
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -688,12 +669,11 @@ namespace Ryujinx.Modules
|
|||||||
{
|
{
|
||||||
if (showWarnings)
|
if (showWarnings)
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(async () =>
|
Dispatcher.UIThread.InvokeAsync(() =>
|
||||||
{
|
ContentDialogHelper.CreateWarningDialog(
|
||||||
await ContentDialogHelper.CreateWarningDialog(
|
|
||||||
LocaleManager.Instance[LocaleKeys.DialogUpdaterDirtyBuildMessage],
|
LocaleManager.Instance[LocaleKeys.DialogUpdaterDirtyBuildMessage],
|
||||||
LocaleManager.Instance[LocaleKeys.DialogUpdaterDirtyBuildSubMessage]);
|
LocaleManager.Instance[LocaleKeys.DialogUpdaterDirtyBuildSubMessage])
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -705,21 +685,19 @@ namespace Ryujinx.Modules
|
|||||||
{
|
{
|
||||||
if (ReleaseInformation.IsFlatHubBuild())
|
if (ReleaseInformation.IsFlatHubBuild())
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(async () =>
|
Dispatcher.UIThread.InvokeAsync(() =>
|
||||||
{
|
ContentDialogHelper.CreateWarningDialog(
|
||||||
await ContentDialogHelper.CreateWarningDialog(
|
|
||||||
LocaleManager.Instance[LocaleKeys.UpdaterDisabledWarningTitle],
|
LocaleManager.Instance[LocaleKeys.UpdaterDisabledWarningTitle],
|
||||||
LocaleManager.Instance[LocaleKeys.DialogUpdaterFlatpakNotSupportedMessage]);
|
LocaleManager.Instance[LocaleKeys.DialogUpdaterFlatpakNotSupportedMessage])
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(async () =>
|
Dispatcher.UIThread.InvokeAsync(() =>
|
||||||
{
|
ContentDialogHelper.CreateWarningDialog(
|
||||||
await ContentDialogHelper.CreateWarningDialog(
|
|
||||||
LocaleManager.Instance[LocaleKeys.UpdaterDisabledWarningTitle],
|
LocaleManager.Instance[LocaleKeys.UpdaterDisabledWarningTitle],
|
||||||
LocaleManager.Instance[LocaleKeys.DialogUpdaterDirtyBuildSubMessage]);
|
LocaleManager.Instance[LocaleKeys.DialogUpdaterDirtyBuildSubMessage])
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,13 +6,13 @@ using Ryujinx.Common;
|
|||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
using Ryujinx.Common.GraphicsDriver;
|
using Ryujinx.Common.GraphicsDriver;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Common.SystemInfo;
|
|
||||||
using Ryujinx.Common.SystemInterop;
|
using Ryujinx.Common.SystemInterop;
|
||||||
using Ryujinx.Modules;
|
using Ryujinx.Modules;
|
||||||
using Ryujinx.SDL2.Common;
|
using Ryujinx.SDL2.Common;
|
||||||
using Ryujinx.Ui.Common;
|
using Ryujinx.Ui.Common;
|
||||||
using Ryujinx.Ui.Common.Configuration;
|
using Ryujinx.Ui.Common.Configuration;
|
||||||
using Ryujinx.Ui.Common.Helper;
|
using Ryujinx.Ui.Common.Helper;
|
||||||
|
using Ryujinx.Ui.Common.SystemInfo;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
@@ -106,7 +106,7 @@ namespace Ryujinx.Ava.UI.Applet
|
|||||||
bool error = false;
|
bool error = false;
|
||||||
string inputText = args.InitialText ?? "";
|
string inputText = args.InitialText ?? "";
|
||||||
|
|
||||||
Dispatcher.UIThread.Post(async () =>
|
Dispatcher.UIThread.InvokeAsync(async () =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -149,7 +149,7 @@ namespace Ryujinx.Ava.UI.Applet
|
|||||||
|
|
||||||
bool showDetails = false;
|
bool showDetails = false;
|
||||||
|
|
||||||
Dispatcher.UIThread.Post(async () =>
|
Dispatcher.UIThread.InvokeAsync(async () =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@@ -82,4 +82,9 @@
|
|||||||
Header="{locale:Locale GameListContextMenuExtractDataLogo}"
|
Header="{locale:Locale GameListContextMenuExtractDataLogo}"
|
||||||
ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataLogoToolTip}" />
|
ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataLogoToolTip}" />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem
|
||||||
|
Click="CreateApplicationShortcut_Click"
|
||||||
|
Header="{locale:Locale GameListContextMenuCreateShortcut}"
|
||||||
|
IsEnabled="{Binding CreateShortcutEnabled}"
|
||||||
|
ToolTip.Tip="{locale:Locale GameListContextMenuCreateShortcutToolTip}" />
|
||||||
</MenuFlyout>
|
</MenuFlyout>
|
@@ -54,7 +54,7 @@ namespace Ryujinx.Ava.UI.Controls
|
|||||||
{
|
{
|
||||||
if (sender is MenuItem { DataContext: MainWindowViewModel viewModel })
|
if (sender is MenuItem { DataContext: MainWindowViewModel viewModel })
|
||||||
{
|
{
|
||||||
OpenSaveDirectory(viewModel, SaveDataType.Account, userId: new UserId((ulong)viewModel.AccountManager.LastOpenedUser.UserId.High, (ulong)viewModel.AccountManager.LastOpenedUser.UserId.Low));
|
OpenSaveDirectory(viewModel, SaveDataType.Account, new UserId((ulong)viewModel.AccountManager.LastOpenedUser.UserId.High, (ulong)viewModel.AccountManager.LastOpenedUser.UserId.Low));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,14 +62,14 @@ namespace Ryujinx.Ava.UI.Controls
|
|||||||
{
|
{
|
||||||
var viewModel = (sender as MenuItem)?.DataContext as MainWindowViewModel;
|
var viewModel = (sender as MenuItem)?.DataContext as MainWindowViewModel;
|
||||||
|
|
||||||
OpenSaveDirectory(viewModel, SaveDataType.Device, userId: default);
|
OpenSaveDirectory(viewModel, SaveDataType.Device, default);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenBcatSaveDirectory_Click(object sender, RoutedEventArgs args)
|
public void OpenBcatSaveDirectory_Click(object sender, RoutedEventArgs args)
|
||||||
{
|
{
|
||||||
var viewModel = (sender as MenuItem)?.DataContext as MainWindowViewModel;
|
var viewModel = (sender as MenuItem)?.DataContext as MainWindowViewModel;
|
||||||
|
|
||||||
OpenSaveDirectory(viewModel, SaveDataType.Bcat, userId: default);
|
OpenSaveDirectory(viewModel, SaveDataType.Bcat, default);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OpenSaveDirectory(MainWindowViewModel viewModel, SaveDataType saveDataType, UserId userId)
|
private static void OpenSaveDirectory(MainWindowViewModel viewModel, SaveDataType saveDataType, UserId userId)
|
||||||
@@ -158,7 +158,8 @@ namespace Ryujinx.Ava.UI.Controls
|
|||||||
|
|
||||||
if (viewModel?.SelectedApplication != null)
|
if (viewModel?.SelectedApplication != null)
|
||||||
{
|
{
|
||||||
UserResult result = await ContentDialogHelper.CreateConfirmationDialog(LocaleManager.Instance[LocaleKeys.DialogWarning],
|
UserResult result = await ContentDialogHelper.CreateConfirmationDialog(
|
||||||
|
LocaleManager.Instance[LocaleKeys.DialogWarning],
|
||||||
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogPPTCDeletionMessage, viewModel.SelectedApplication.TitleName),
|
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogPPTCDeletionMessage, viewModel.SelectedApplication.TitleName),
|
||||||
LocaleManager.Instance[LocaleKeys.InputDialogYes],
|
LocaleManager.Instance[LocaleKeys.InputDialogYes],
|
||||||
LocaleManager.Instance[LocaleKeys.InputDialogNo],
|
LocaleManager.Instance[LocaleKeys.InputDialogNo],
|
||||||
@@ -205,7 +206,8 @@ namespace Ryujinx.Ava.UI.Controls
|
|||||||
|
|
||||||
if (viewModel?.SelectedApplication != null)
|
if (viewModel?.SelectedApplication != null)
|
||||||
{
|
{
|
||||||
UserResult result = await ContentDialogHelper.CreateConfirmationDialog(LocaleManager.Instance[LocaleKeys.DialogWarning],
|
UserResult result = await ContentDialogHelper.CreateConfirmationDialog(
|
||||||
|
LocaleManager.Instance[LocaleKeys.DialogWarning],
|
||||||
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogShaderDeletionMessage, viewModel.SelectedApplication.TitleName),
|
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogShaderDeletionMessage, viewModel.SelectedApplication.TitleName),
|
||||||
LocaleManager.Instance[LocaleKeys.InputDialogYes],
|
LocaleManager.Instance[LocaleKeys.InputDialogYes],
|
||||||
LocaleManager.Instance[LocaleKeys.InputDialogNo],
|
LocaleManager.Instance[LocaleKeys.InputDialogNo],
|
||||||
@@ -335,13 +337,24 @@ namespace Ryujinx.Ava.UI.Controls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RunApplication_Click(object sender, RoutedEventArgs args)
|
public void CreateApplicationShortcut_Click(object sender, RoutedEventArgs args)
|
||||||
{
|
{
|
||||||
var viewModel = (sender as MenuItem)?.DataContext as MainWindowViewModel;
|
var viewModel = (sender as MenuItem)?.DataContext as MainWindowViewModel;
|
||||||
|
|
||||||
if (viewModel?.SelectedApplication != null)
|
if (viewModel?.SelectedApplication != null)
|
||||||
{
|
{
|
||||||
viewModel.LoadApplication(viewModel.SelectedApplication.Path);
|
ApplicationData selectedApplication = viewModel.SelectedApplication;
|
||||||
|
ShortcutHelper.CreateAppShortcut(selectedApplication.Path, selectedApplication.TitleName, selectedApplication.TitleId, selectedApplication.Icon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void RunApplication_Click(object sender, RoutedEventArgs args)
|
||||||
|
{
|
||||||
|
var viewModel = (sender as MenuItem)?.DataContext as MainWindowViewModel;
|
||||||
|
|
||||||
|
if (viewModel?.SelectedApplication != null)
|
||||||
|
{
|
||||||
|
await viewModel.LoadApplication(viewModel.SelectedApplication.Path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -126,17 +126,17 @@
|
|||||||
Spacing="5">
|
Spacing="5">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
Text="{Binding TimePlayed}"
|
Text="{Binding TimePlayedString}"
|
||||||
TextAlignment="Right"
|
TextAlignment="Right"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
Text="{Binding LastPlayed, Converter={helpers:NullableDateTimeConverter}}"
|
Text="{Binding LastPlayedString, Converter={helpers:LocalizedNeverConverter}}"
|
||||||
TextAlignment="Right"
|
TextAlignment="Right"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
Text="{Binding FileSize}"
|
Text="{Binding FileSizeString}"
|
||||||
TextAlignment="Right"
|
TextAlignment="Right"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
31
src/Ryujinx.Ava/UI/Controls/SliderScroll.axaml.cs
Normal file
31
src/Ryujinx.Ava/UI/Controls/SliderScroll.axaml.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Input;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Ryujinx.Ava.UI.Controls
|
||||||
|
{
|
||||||
|
public class SliderScroll : Slider
|
||||||
|
{
|
||||||
|
protected override Type StyleKeyOverride => typeof(Slider);
|
||||||
|
|
||||||
|
protected override void OnPointerWheelChanged(PointerWheelEventArgs e)
|
||||||
|
{
|
||||||
|
var newValue = Value + e.Delta.Y * TickFrequency;
|
||||||
|
|
||||||
|
if (newValue < Minimum)
|
||||||
|
{
|
||||||
|
Value = Minimum;
|
||||||
|
}
|
||||||
|
else if (newValue > Maximum)
|
||||||
|
{
|
||||||
|
Value = Maximum;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Value = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
43
src/Ryujinx.Ava/UI/Helpers/LocalizedNeverConverter.cs
Normal file
43
src/Ryujinx.Ava/UI/Helpers/LocalizedNeverConverter.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
using Avalonia.Data.Converters;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
using Ryujinx.Ava.Common.Locale;
|
||||||
|
using Ryujinx.Ui.Common.Helper;
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace Ryujinx.Ava.UI.Helpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This <see cref="IValueConverter"/> makes sure that the string "Never" that's returned by <see cref="ValueFormatUtils.FormatDateTime"/> is properly localized in the Avalonia UI.
|
||||||
|
/// After the Avalonia UI has been made the default and the GTK UI is removed, <see cref="ValueFormatUtils"/> should be updated to directly return a localized string.
|
||||||
|
/// </summary>
|
||||||
|
internal class LocalizedNeverConverter : MarkupExtension, IValueConverter
|
||||||
|
{
|
||||||
|
private static readonly LocalizedNeverConverter _instance = new();
|
||||||
|
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is not string valStr)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (valStr == "Never")
|
||||||
|
{
|
||||||
|
return LocaleManager.Instance[LocaleKeys.Never];
|
||||||
|
}
|
||||||
|
|
||||||
|
return valStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||||
|
{
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,38 +0,0 @@
|
|||||||
using Avalonia.Data.Converters;
|
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
using Ryujinx.Ava.Common.Locale;
|
|
||||||
using System;
|
|
||||||
using System.Globalization;
|
|
||||||
|
|
||||||
namespace Ryujinx.Ava.UI.Helpers
|
|
||||||
{
|
|
||||||
internal class NullableDateTimeConverter : MarkupExtension, IValueConverter
|
|
||||||
{
|
|
||||||
private static readonly NullableDateTimeConverter _instance = new();
|
|
||||||
|
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
||||||
{
|
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return LocaleManager.Instance[LocaleKeys.Never];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value is DateTime dateTime)
|
|
||||||
{
|
|
||||||
return dateTime.ToLocalTime().ToString(culture);
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
|
||||||
{
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -13,20 +13,19 @@ namespace Ryujinx.Ava.UI.Models.Generic
|
|||||||
|
|
||||||
public int Compare(ApplicationData x, ApplicationData y)
|
public int Compare(ApplicationData x, ApplicationData y)
|
||||||
{
|
{
|
||||||
var aValue = x.LastPlayed;
|
DateTime aValue = DateTime.UnixEpoch, bValue = DateTime.UnixEpoch;
|
||||||
var bValue = y.LastPlayed;
|
|
||||||
|
|
||||||
if (!aValue.HasValue)
|
if (x?.LastPlayed != null)
|
||||||
{
|
{
|
||||||
aValue = DateTime.UnixEpoch;
|
aValue = x.LastPlayed.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bValue.HasValue)
|
if (y?.LastPlayed != null)
|
||||||
{
|
{
|
||||||
bValue = DateTime.UnixEpoch;
|
bValue = y.LastPlayed.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (IsAscending ? 1 : -1) * DateTime.Compare(bValue.Value, aValue.Value);
|
return (IsAscending ? 1 : -1) * DateTime.Compare(aValue, bValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
31
src/Ryujinx.Ava/UI/Models/Generic/TimePlayedSortComparer.cs
Normal file
31
src/Ryujinx.Ava/UI/Models/Generic/TimePlayedSortComparer.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using Ryujinx.Ui.App.Common;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Ryujinx.Ava.UI.Models.Generic
|
||||||
|
{
|
||||||
|
internal class TimePlayedSortComparer : IComparer<ApplicationData>
|
||||||
|
{
|
||||||
|
public TimePlayedSortComparer() { }
|
||||||
|
public TimePlayedSortComparer(bool isAscending) { IsAscending = isAscending; }
|
||||||
|
|
||||||
|
public bool IsAscending { get; }
|
||||||
|
|
||||||
|
public int Compare(ApplicationData x, ApplicationData y)
|
||||||
|
{
|
||||||
|
TimeSpan aValue = TimeSpan.Zero, bValue = TimeSpan.Zero;
|
||||||
|
|
||||||
|
if (x?.TimePlayed != null)
|
||||||
|
{
|
||||||
|
aValue = x.TimePlayed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y?.TimePlayed != null)
|
||||||
|
{
|
||||||
|
bValue = y.TimePlayed;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (IsAscending ? 1 : -1) * TimeSpan.Compare(aValue, bValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -4,7 +4,7 @@ using Ryujinx.Ava.UI.ViewModels;
|
|||||||
using Ryujinx.Ava.UI.Windows;
|
using Ryujinx.Ava.UI.Windows;
|
||||||
using Ryujinx.HLE.FileSystem;
|
using Ryujinx.HLE.FileSystem;
|
||||||
using Ryujinx.Ui.App.Common;
|
using Ryujinx.Ui.App.Common;
|
||||||
using System;
|
using Ryujinx.Ui.Common.Helper;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -38,26 +38,7 @@ namespace Ryujinx.Ava.UI.Models
|
|||||||
|
|
||||||
public bool SizeAvailable { get; set; }
|
public bool SizeAvailable { get; set; }
|
||||||
|
|
||||||
public string SizeString => GetSizeString();
|
public string SizeString => ValueFormatUtils.FormatFileSize(Size);
|
||||||
|
|
||||||
private string GetSizeString()
|
|
||||||
{
|
|
||||||
const int Scale = 1024;
|
|
||||||
string[] orders = { "GiB", "MiB", "KiB" };
|
|
||||||
long max = (long)Math.Pow(Scale, orders.Length);
|
|
||||||
|
|
||||||
foreach (string order in orders)
|
|
||||||
{
|
|
||||||
if (Size > max)
|
|
||||||
{
|
|
||||||
return $"{decimal.Divide(Size, max):##.##} {order}";
|
|
||||||
}
|
|
||||||
|
|
||||||
max /= Scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
return "0 KiB";
|
|
||||||
}
|
|
||||||
|
|
||||||
public SaveModel(SaveDataInfo info)
|
public SaveModel(SaveDataInfo info)
|
||||||
{
|
{
|
||||||
|
@@ -327,7 +327,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
|
|
||||||
string imageUrl = _amiiboList.Find(amiibo => amiibo.Equals(selected)).Image;
|
string imageUrl = _amiiboList.Find(amiibo => amiibo.Equals(selected)).Image;
|
||||||
|
|
||||||
string usageString = "";
|
StringBuilder usageStringBuilder = new();
|
||||||
|
|
||||||
for (int i = 0; i < _amiiboList.Count; i++)
|
for (int i = 0; i < _amiiboList.Count; i++)
|
||||||
{
|
{
|
||||||
@@ -341,20 +341,19 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
{
|
{
|
||||||
foreach (AmiiboApiUsage usageItem in item.AmiiboUsage)
|
foreach (AmiiboApiUsage usageItem in item.AmiiboUsage)
|
||||||
{
|
{
|
||||||
usageString += Environment.NewLine +
|
usageStringBuilder.Append($"{Environment.NewLine}- {usageItem.Usage.Replace("/", Environment.NewLine + "-")}");
|
||||||
$"- {usageItem.Usage.Replace("/", Environment.NewLine + "-")}";
|
|
||||||
|
|
||||||
writable = usageItem.Write;
|
writable = usageItem.Write;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usageString.Length == 0)
|
if (usageStringBuilder.Length == 0)
|
||||||
{
|
{
|
||||||
usageString = LocaleManager.Instance[LocaleKeys.Unknown] + ".";
|
usageStringBuilder.Append($"{LocaleManager.Instance[LocaleKeys.Unknown]}.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Usage = $"{LocaleManager.Instance[LocaleKeys.Usage]} {(writable ? $" ({LocaleManager.Instance[LocaleKeys.Writable]})" : "")} : {usageString}";
|
Usage = $"{LocaleManager.Instance[LocaleKeys.Usage]} {(writable ? $" ({LocaleManager.Instance[LocaleKeys.Writable]})" : "")} : {usageStringBuilder}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -126,7 +126,8 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
{
|
{
|
||||||
using FileStream containerFile = File.OpenRead(downloadableContentContainer.ContainerPath);
|
using FileStream containerFile = File.OpenRead(downloadableContentContainer.ContainerPath);
|
||||||
|
|
||||||
PartitionFileSystem partitionFileSystem = new(containerFile.AsStorage());
|
PartitionFileSystem partitionFileSystem = new();
|
||||||
|
partitionFileSystem.Initialize(containerFile.AsStorage()).ThrowIfFailure();
|
||||||
|
|
||||||
_virtualFileSystem.ImportTickets(partitionFileSystem);
|
_virtualFileSystem.ImportTickets(partitionFileSystem);
|
||||||
|
|
||||||
@@ -212,9 +213,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
{
|
{
|
||||||
Patterns = new[] { "*.nsp" },
|
Patterns = new[] { "*.nsp" },
|
||||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.nsp" },
|
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.nsp" },
|
||||||
MimeTypes = new[] { "application/x-nx-nsp" }
|
MimeTypes = new[] { "application/x-nx-nsp" },
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (var file in result)
|
foreach (var file in result)
|
||||||
@@ -232,7 +233,8 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
|
|
||||||
using FileStream containerFile = File.OpenRead(path);
|
using FileStream containerFile = File.OpenRead(path);
|
||||||
|
|
||||||
PartitionFileSystem partitionFileSystem = new(containerFile.AsStorage());
|
PartitionFileSystem partitionFileSystem = new();
|
||||||
|
partitionFileSystem.Initialize(containerFile.AsStorage()).ThrowIfFailure();
|
||||||
bool containsDownloadableContent = false;
|
bool containsDownloadableContent = false;
|
||||||
|
|
||||||
_virtualFileSystem.ImportTickets(partitionFileSystem);
|
_virtualFileSystem.ImportTickets(partitionFileSystem);
|
||||||
|
@@ -26,6 +26,7 @@ using Ryujinx.HLE.FileSystem;
|
|||||||
using Ryujinx.HLE.HOS;
|
using Ryujinx.HLE.HOS;
|
||||||
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
||||||
using Ryujinx.HLE.Ui;
|
using Ryujinx.HLE.Ui;
|
||||||
|
using Ryujinx.Input.HLE;
|
||||||
using Ryujinx.Modules;
|
using Ryujinx.Modules;
|
||||||
using Ryujinx.Ui.App.Common;
|
using Ryujinx.Ui.App.Common;
|
||||||
using Ryujinx.Ui.Common;
|
using Ryujinx.Ui.Common;
|
||||||
@@ -39,7 +40,6 @@ using System.IO;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Image = SixLabors.ImageSharp.Image;
|
using Image = SixLabors.ImageSharp.Image;
|
||||||
using InputManager = Ryujinx.Input.HLE.InputManager;
|
|
||||||
using Key = Ryujinx.Input.Key;
|
using Key = Ryujinx.Input.Key;
|
||||||
using MissingKeyException = LibHac.Common.Keys.MissingKeyException;
|
using MissingKeyException = LibHac.Common.Keys.MissingKeyException;
|
||||||
using ShaderCacheLoadingState = Ryujinx.Graphics.Gpu.Shader.ShaderCacheState;
|
using ShaderCacheLoadingState = Ryujinx.Graphics.Gpu.Shader.ShaderCacheState;
|
||||||
@@ -356,6 +356,8 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
|
|
||||||
public bool OpenBcatSaveDirectoryEnabled => !SelectedApplication.ControlHolder.ByteSpan.IsZeros() && SelectedApplication.ControlHolder.Value.BcatDeliveryCacheStorageSize > 0;
|
public bool OpenBcatSaveDirectoryEnabled => !SelectedApplication.ControlHolder.ByteSpan.IsZeros() && SelectedApplication.ControlHolder.Value.BcatDeliveryCacheStorageSize > 0;
|
||||||
|
|
||||||
|
public bool CreateShortcutEnabled => !ReleaseInformation.IsFlatHubBuild();
|
||||||
|
|
||||||
public string LoadHeading
|
public string LoadHeading
|
||||||
{
|
{
|
||||||
get => _loadHeading;
|
get => _loadHeading;
|
||||||
@@ -928,21 +930,20 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
return SortMode switch
|
return SortMode switch
|
||||||
{
|
{
|
||||||
#pragma warning disable IDE0055 // Disable formatting
|
#pragma warning disable IDE0055 // Disable formatting
|
||||||
ApplicationSort.LastPlayed => new LastPlayedSortComparer(IsAscending),
|
|
||||||
ApplicationSort.FileSize => IsAscending ? SortExpressionComparer<ApplicationData>.Ascending(app => app.FileSizeBytes)
|
|
||||||
: SortExpressionComparer<ApplicationData>.Descending(app => app.FileSizeBytes),
|
|
||||||
ApplicationSort.TotalTimePlayed => IsAscending ? SortExpressionComparer<ApplicationData>.Ascending(app => app.TimePlayedNum)
|
|
||||||
: SortExpressionComparer<ApplicationData>.Descending(app => app.TimePlayedNum),
|
|
||||||
ApplicationSort.Title => IsAscending ? SortExpressionComparer<ApplicationData>.Ascending(app => app.TitleName)
|
ApplicationSort.Title => IsAscending ? SortExpressionComparer<ApplicationData>.Ascending(app => app.TitleName)
|
||||||
: SortExpressionComparer<ApplicationData>.Descending(app => app.TitleName),
|
: SortExpressionComparer<ApplicationData>.Descending(app => app.TitleName),
|
||||||
ApplicationSort.Favorite => !IsAscending ? SortExpressionComparer<ApplicationData>.Ascending(app => app.Favorite)
|
|
||||||
: SortExpressionComparer<ApplicationData>.Descending(app => app.Favorite),
|
|
||||||
ApplicationSort.Developer => IsAscending ? SortExpressionComparer<ApplicationData>.Ascending(app => app.Developer)
|
ApplicationSort.Developer => IsAscending ? SortExpressionComparer<ApplicationData>.Ascending(app => app.Developer)
|
||||||
: SortExpressionComparer<ApplicationData>.Descending(app => app.Developer),
|
: SortExpressionComparer<ApplicationData>.Descending(app => app.Developer),
|
||||||
|
ApplicationSort.LastPlayed => new LastPlayedSortComparer(IsAscending),
|
||||||
|
ApplicationSort.TotalTimePlayed => new TimePlayedSortComparer(IsAscending),
|
||||||
ApplicationSort.FileType => IsAscending ? SortExpressionComparer<ApplicationData>.Ascending(app => app.FileExtension)
|
ApplicationSort.FileType => IsAscending ? SortExpressionComparer<ApplicationData>.Ascending(app => app.FileExtension)
|
||||||
: SortExpressionComparer<ApplicationData>.Descending(app => app.FileExtension),
|
: SortExpressionComparer<ApplicationData>.Descending(app => app.FileExtension),
|
||||||
|
ApplicationSort.FileSize => IsAscending ? SortExpressionComparer<ApplicationData>.Ascending(app => app.FileSize)
|
||||||
|
: SortExpressionComparer<ApplicationData>.Descending(app => app.FileSize),
|
||||||
ApplicationSort.Path => IsAscending ? SortExpressionComparer<ApplicationData>.Ascending(app => app.Path)
|
ApplicationSort.Path => IsAscending ? SortExpressionComparer<ApplicationData>.Ascending(app => app.Path)
|
||||||
: SortExpressionComparer<ApplicationData>.Descending(app => app.Path),
|
: SortExpressionComparer<ApplicationData>.Descending(app => app.Path),
|
||||||
|
ApplicationSort.Favorite => !IsAscending ? SortExpressionComparer<ApplicationData>.Ascending(app => app.Favorite)
|
||||||
|
: SortExpressionComparer<ApplicationData>.Descending(app => app.Favorite),
|
||||||
_ => null,
|
_ => null,
|
||||||
#pragma warning restore IDE0055
|
#pragma warning restore IDE0055
|
||||||
};
|
};
|
||||||
@@ -1068,9 +1069,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
{
|
{
|
||||||
Logger.Error?.Print(LogClass.Application, ex.ToString());
|
Logger.Error?.Print(LogClass.Application, ex.ToString());
|
||||||
|
|
||||||
static async void Action() => await UserErrorDialog.ShowUserErrorDialog(UserError.NoKeys);
|
await UserErrorDialog.ShowUserErrorDialog(UserError.NoKeys);
|
||||||
|
|
||||||
Dispatcher.UIThread.Post(Action);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -1163,16 +1162,13 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
AppHost?.DisposeContext();
|
AppHost?.DisposeContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleRelaunch()
|
private async Task HandleRelaunch()
|
||||||
{
|
{
|
||||||
if (UserChannelPersistence.PreviousIndex != -1 && UserChannelPersistence.ShouldRestart)
|
if (UserChannelPersistence.PreviousIndex != -1 && UserChannelPersistence.ShouldRestart)
|
||||||
{
|
{
|
||||||
UserChannelPersistence.ShouldRestart = false;
|
UserChannelPersistence.ShouldRestart = false;
|
||||||
|
|
||||||
Dispatcher.UIThread.Post(() =>
|
await LoadApplication(_currentEmulatedGamePath);
|
||||||
{
|
|
||||||
LoadApplication(_currentEmulatedGamePath);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1191,7 +1187,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
Application.Current.Styles.TryGetResource(args.VSyncEnabled
|
Application.Current.Styles.TryGetResource(args.VSyncEnabled
|
||||||
? "VsyncEnabled"
|
? "VsyncEnabled"
|
||||||
: "VsyncDisabled",
|
: "VsyncDisabled",
|
||||||
Avalonia.Application.Current.ActualThemeVariant,
|
Application.Current.ActualThemeVariant,
|
||||||
out object color);
|
out object color);
|
||||||
|
|
||||||
if (color is not null)
|
if (color is not null)
|
||||||
@@ -1283,7 +1279,12 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
Glyph = Glyph.Grid;
|
Glyph = Glyph.Grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void InstallFirmwareFromFile()
|
public void SetAspectRatio(AspectRatio aspectRatio)
|
||||||
|
{
|
||||||
|
ConfigurationState.Instance.Graphics.AspectRatio.Value = aspectRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task InstallFirmwareFromFile()
|
||||||
{
|
{
|
||||||
var result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
|
var result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
|
||||||
{
|
{
|
||||||
@@ -1294,21 +1295,21 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
{
|
{
|
||||||
Patterns = new[] { "*.xci", "*.zip" },
|
Patterns = new[] { "*.xci", "*.zip" },
|
||||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.xci", "public.zip-archive" },
|
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.xci", "public.zip-archive" },
|
||||||
MimeTypes = new[] { "application/x-nx-xci", "application/zip" }
|
MimeTypes = new[] { "application/x-nx-xci", "application/zip" },
|
||||||
},
|
},
|
||||||
new("XCI")
|
new("XCI")
|
||||||
{
|
{
|
||||||
Patterns = new[] { "*.xci" },
|
Patterns = new[] { "*.xci" },
|
||||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.xci" },
|
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.xci" },
|
||||||
MimeTypes = new[] { "application/x-nx-xci" }
|
MimeTypes = new[] { "application/x-nx-xci" },
|
||||||
},
|
},
|
||||||
new("ZIP")
|
new("ZIP")
|
||||||
{
|
{
|
||||||
Patterns = new[] { "*.zip" },
|
Patterns = new[] { "*.zip" },
|
||||||
AppleUniformTypeIdentifiers = new[] { "public.zip-archive" },
|
AppleUniformTypeIdentifiers = new[] { "public.zip-archive" },
|
||||||
MimeTypes = new[] { "application/zip" }
|
MimeTypes = new[] { "application/zip" },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.Count > 0)
|
if (result.Count > 0)
|
||||||
@@ -1317,11 +1318,11 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void InstallFirmwareFromFolder()
|
public async Task InstallFirmwareFromFolder()
|
||||||
{
|
{
|
||||||
var result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
var result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
||||||
{
|
{
|
||||||
AllowMultiple = false
|
AllowMultiple = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.Count > 0)
|
if (result.Count > 0)
|
||||||
@@ -1352,7 +1353,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void ExitCurrentState()
|
public async Task ExitCurrentState()
|
||||||
{
|
{
|
||||||
if (WindowState == WindowState.FullScreen)
|
if (WindowState == WindowState.FullScreen)
|
||||||
{
|
{
|
||||||
@@ -1377,7 +1378,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void ManageProfiles()
|
public async Task ManageProfiles()
|
||||||
{
|
{
|
||||||
await NavigationDialogHost.Show(AccountManager, ContentManager, VirtualFileSystem, LibHacHorizonManager.RyujinxClient);
|
await NavigationDialogHost.Show(AccountManager, ContentManager, VirtualFileSystem, LibHacHorizonManager.RyujinxClient);
|
||||||
}
|
}
|
||||||
@@ -1387,7 +1388,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
AppHost.Device.System.SimulateWakeUpMessage();
|
AppHost.Device.System.SimulateWakeUpMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void OpenFile()
|
public async Task OpenFile()
|
||||||
{
|
{
|
||||||
var result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
|
var result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
|
||||||
{
|
{
|
||||||
@@ -1404,7 +1405,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
"com.ryujinx.xci",
|
"com.ryujinx.xci",
|
||||||
"com.ryujinx.nca",
|
"com.ryujinx.nca",
|
||||||
"com.ryujinx.nro",
|
"com.ryujinx.nro",
|
||||||
"com.ryujinx.nso"
|
"com.ryujinx.nso",
|
||||||
},
|
},
|
||||||
MimeTypes = new[]
|
MimeTypes = new[]
|
||||||
{
|
{
|
||||||
@@ -1412,63 +1413,63 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
"application/x-nx-xci",
|
"application/x-nx-xci",
|
||||||
"application/x-nx-nca",
|
"application/x-nx-nca",
|
||||||
"application/x-nx-nro",
|
"application/x-nx-nro",
|
||||||
"application/x-nx-nso"
|
"application/x-nx-nso",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
new("NSP")
|
new("NSP")
|
||||||
{
|
{
|
||||||
Patterns = new[] { "*.nsp" },
|
Patterns = new[] { "*.nsp" },
|
||||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.nsp" },
|
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.nsp" },
|
||||||
MimeTypes = new[] { "application/x-nx-nsp" }
|
MimeTypes = new[] { "application/x-nx-nsp" },
|
||||||
},
|
},
|
||||||
new("XCI")
|
new("XCI")
|
||||||
{
|
{
|
||||||
Patterns = new[] { "*.xci" },
|
Patterns = new[] { "*.xci" },
|
||||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.xci" },
|
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.xci" },
|
||||||
MimeTypes = new[] { "application/x-nx-xci" }
|
MimeTypes = new[] { "application/x-nx-xci" },
|
||||||
},
|
},
|
||||||
new("NCA")
|
new("NCA")
|
||||||
{
|
{
|
||||||
Patterns = new[] { "*.nca" },
|
Patterns = new[] { "*.nca" },
|
||||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.nca" },
|
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.nca" },
|
||||||
MimeTypes = new[] { "application/x-nx-nca" }
|
MimeTypes = new[] { "application/x-nx-nca" },
|
||||||
},
|
},
|
||||||
new("NRO")
|
new("NRO")
|
||||||
{
|
{
|
||||||
Patterns = new[] { "*.nro" },
|
Patterns = new[] { "*.nro" },
|
||||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.nro" },
|
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.nro" },
|
||||||
MimeTypes = new[] { "application/x-nx-nro" }
|
MimeTypes = new[] { "application/x-nx-nro" },
|
||||||
},
|
},
|
||||||
new("NSO")
|
new("NSO")
|
||||||
{
|
{
|
||||||
Patterns = new[] { "*.nso" },
|
Patterns = new[] { "*.nso" },
|
||||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.nso" },
|
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.nso" },
|
||||||
MimeTypes = new[] { "application/x-nx-nso" }
|
MimeTypes = new[] { "application/x-nx-nso" },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.Count > 0)
|
if (result.Count > 0)
|
||||||
{
|
{
|
||||||
LoadApplication(result[0].Path.LocalPath);
|
await LoadApplication(result[0].Path.LocalPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void OpenFolder()
|
public async Task OpenFolder()
|
||||||
{
|
{
|
||||||
var result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
var result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
||||||
{
|
{
|
||||||
Title = LocaleManager.Instance[LocaleKeys.OpenFolderDialogTitle],
|
Title = LocaleManager.Instance[LocaleKeys.OpenFolderDialogTitle],
|
||||||
AllowMultiple = false
|
AllowMultiple = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.Count > 0)
|
if (result.Count > 0)
|
||||||
{
|
{
|
||||||
LoadApplication(result[0].Path.LocalPath);
|
await LoadApplication(result[0].Path.LocalPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void LoadApplication(string path, bool startFullscreen = false, string titleName = "")
|
public async Task LoadApplication(string path, bool startFullscreen = false, string titleName = "")
|
||||||
{
|
{
|
||||||
if (AppHost != null)
|
if (AppHost != null)
|
||||||
{
|
{
|
||||||
@@ -1488,7 +1489,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
|
|
||||||
Logger.RestartTime();
|
Logger.RestartTime();
|
||||||
|
|
||||||
SelectedIcon ??= ApplicationLibrary.GetApplicationIcon(path);
|
SelectedIcon ??= ApplicationLibrary.GetApplicationIcon(path, ConfigurationState.Instance.System.Language);
|
||||||
|
|
||||||
PrepareLoadScreen();
|
PrepareLoadScreen();
|
||||||
|
|
||||||
@@ -1505,8 +1506,6 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
this,
|
this,
|
||||||
TopLevel);
|
TopLevel);
|
||||||
|
|
||||||
async void Action()
|
|
||||||
{
|
|
||||||
if (!await AppHost.LoadGuestApplication())
|
if (!await AppHost.LoadGuestApplication())
|
||||||
{
|
{
|
||||||
AppHost.DisposeContext();
|
AppHost.DisposeContext();
|
||||||
@@ -1533,9 +1532,6 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
gameThread.Start();
|
gameThread.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
Dispatcher.UIThread.Post(Action);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SwitchToRenderer(bool startFullscreen)
|
public void SwitchToRenderer(bool startFullscreen)
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(() =>
|
Dispatcher.UIThread.Post(() =>
|
||||||
@@ -1552,13 +1548,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
{
|
{
|
||||||
ApplicationLibrary.LoadAndSaveMetaData(titleId, appMetadata =>
|
ApplicationLibrary.LoadAndSaveMetaData(titleId, appMetadata =>
|
||||||
{
|
{
|
||||||
if (appMetadata.LastPlayed.HasValue)
|
appMetadata.UpdatePostGame();
|
||||||
{
|
|
||||||
double sessionTimePlayed = DateTime.UtcNow.Subtract(appMetadata.LastPlayed.Value).TotalSeconds;
|
|
||||||
appMetadata.TimePlayed += Math.Round(sessionTimePlayed, MidpointRounding.AwayFromZero);
|
|
||||||
}
|
|
||||||
|
|
||||||
appMetadata.LastPlayed = DateTime.UtcNow;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1596,7 +1586,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
|
|
||||||
IsGameRunning = false;
|
IsGameRunning = false;
|
||||||
|
|
||||||
Dispatcher.UIThread.InvokeAsync(() =>
|
Dispatcher.UIThread.InvokeAsync(async () =>
|
||||||
{
|
{
|
||||||
ShowMenuAndStatusBar = true;
|
ShowMenuAndStatusBar = true;
|
||||||
ShowContent = true;
|
ShowContent = true;
|
||||||
@@ -1609,7 +1599,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
|
|
||||||
AppHost = null;
|
AppHost = null;
|
||||||
|
|
||||||
HandleRelaunch();
|
await HandleRelaunch();
|
||||||
});
|
});
|
||||||
|
|
||||||
RendererHostControl.WindowCreated -= RendererHost_Created;
|
RendererHostControl.WindowCreated -= RendererHost_Created;
|
||||||
@@ -1701,7 +1691,6 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -10,6 +10,7 @@ using Ryujinx.Ava.UI.Helpers;
|
|||||||
using Ryujinx.Ava.UI.Windows;
|
using Ryujinx.Ava.UI.Windows;
|
||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
using Ryujinx.Common.Configuration.Hid;
|
using Ryujinx.Common.Configuration.Hid;
|
||||||
|
using Ryujinx.Common.Configuration.Multiplayer;
|
||||||
using Ryujinx.Common.GraphicsDriver;
|
using Ryujinx.Common.GraphicsDriver;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Graphics.Vulkan;
|
using Ryujinx.Graphics.Vulkan;
|
||||||
@@ -54,6 +55,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
public event Action CloseWindow;
|
public event Action CloseWindow;
|
||||||
public event Action SaveSettingsEvent;
|
public event Action SaveSettingsEvent;
|
||||||
private int _networkInterfaceIndex;
|
private int _networkInterfaceIndex;
|
||||||
|
private int _multiplayerModeIndex;
|
||||||
|
|
||||||
public int ResolutionScale
|
public int ResolutionScale
|
||||||
{
|
{
|
||||||
@@ -76,14 +78,13 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
|
|
||||||
if (_graphicsBackendMultithreadingIndex != (int)ConfigurationState.Instance.Graphics.BackendThreading.Value)
|
if (_graphicsBackendMultithreadingIndex != (int)ConfigurationState.Instance.Graphics.BackendThreading.Value)
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(async () =>
|
Dispatcher.UIThread.InvokeAsync(() =>
|
||||||
{
|
ContentDialogHelper.CreateInfoDialog(LocaleManager.Instance[LocaleKeys.DialogSettingsBackendThreadingWarningMessage],
|
||||||
await ContentDialogHelper.CreateInfoDialog(LocaleManager.Instance[LocaleKeys.DialogSettingsBackendThreadingWarningMessage],
|
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
LocaleManager.Instance[LocaleKeys.InputDialogOk],
|
LocaleManager.Instance[LocaleKeys.InputDialogOk],
|
||||||
LocaleManager.Instance[LocaleKeys.DialogSettingsBackendThreadingWarningTitle]);
|
LocaleManager.Instance[LocaleKeys.DialogSettingsBackendThreadingWarningTitle])
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
OnPropertyChanged();
|
OnPropertyChanged();
|
||||||
@@ -146,6 +147,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
public bool EnableTextureRecompression { get; set; }
|
public bool EnableTextureRecompression { get; set; }
|
||||||
public bool EnableMacroHLE { get; set; }
|
public bool EnableMacroHLE { get; set; }
|
||||||
public bool EnableColorSpacePassthrough { get; set; }
|
public bool EnableColorSpacePassthrough { get; set; }
|
||||||
|
public bool ColorSpacePassthroughAvailable => IsMacOS;
|
||||||
public bool EnableFileLog { get; set; }
|
public bool EnableFileLog { get; set; }
|
||||||
public bool EnableStub { get; set; }
|
public bool EnableStub { get; set; }
|
||||||
public bool EnableInfo { get; set; }
|
public bool EnableInfo { get; set; }
|
||||||
@@ -251,6 +253,11 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
get => new(_networkInterfaces.Keys);
|
get => new(_networkInterfaces.Keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AvaloniaList<string> MultiplayerModes
|
||||||
|
{
|
||||||
|
get => new(Enum.GetNames<MultiplayerMode>());
|
||||||
|
}
|
||||||
|
|
||||||
public KeyboardHotkeys KeyboardHotkeys
|
public KeyboardHotkeys KeyboardHotkeys
|
||||||
{
|
{
|
||||||
get => _keyboardHotkeys;
|
get => _keyboardHotkeys;
|
||||||
@@ -272,6 +279,16 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int MultiplayerModeIndex
|
||||||
|
{
|
||||||
|
get => _multiplayerModeIndex;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_multiplayerModeIndex = value;
|
||||||
|
ConfigurationState.Instance.Multiplayer.Mode.Value = (MultiplayerMode)_multiplayerModeIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public SettingsViewModel(VirtualFileSystem virtualFileSystem, ContentManager contentManager) : this()
|
public SettingsViewModel(VirtualFileSystem virtualFileSystem, ContentManager contentManager) : this()
|
||||||
{
|
{
|
||||||
_virtualFileSystem = virtualFileSystem;
|
_virtualFileSystem = virtualFileSystem;
|
||||||
@@ -478,6 +495,8 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
EnableFsAccessLog = config.Logger.EnableFsAccessLog;
|
EnableFsAccessLog = config.Logger.EnableFsAccessLog;
|
||||||
FsGlobalAccessLogMode = config.System.FsGlobalAccessLogMode;
|
FsGlobalAccessLogMode = config.System.FsGlobalAccessLogMode;
|
||||||
OpenglDebugLevel = (int)config.Logger.GraphicsDebugLevel.Value;
|
OpenglDebugLevel = (int)config.Logger.GraphicsDebugLevel.Value;
|
||||||
|
|
||||||
|
MultiplayerModeIndex = (int)config.Multiplayer.Mode.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveSettings()
|
public void SaveSettings()
|
||||||
@@ -579,6 +598,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
config.Logger.GraphicsDebugLevel.Value = (GraphicsDebugLevel)OpenglDebugLevel;
|
config.Logger.GraphicsDebugLevel.Value = (GraphicsDebugLevel)OpenglDebugLevel;
|
||||||
|
|
||||||
config.Multiplayer.LanInterfaceId.Value = _networkInterfaces[NetworkInterfaceList[NetworkInterfaceIndex]];
|
config.Multiplayer.LanInterfaceId.Value = _networkInterfaces[NetworkInterfaceList[NetworkInterfaceIndex]];
|
||||||
|
config.Multiplayer.Mode.Value = (MultiplayerMode)MultiplayerModeIndex;
|
||||||
|
|
||||||
config.ToFileFormat().SaveConfig(Program.ConfigurationPath);
|
config.ToFileFormat().SaveConfig(Program.ConfigurationPath);
|
||||||
|
|
||||||
|
@@ -22,6 +22,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Path = System.IO.Path;
|
using Path = System.IO.Path;
|
||||||
using SpanHelpers = LibHac.Common.SpanHelpers;
|
using SpanHelpers = LibHac.Common.SpanHelpers;
|
||||||
|
|
||||||
@@ -169,7 +170,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
(Nca patchNca, Nca controlNca) = ApplicationLibrary.GetGameUpdateDataFromPartition(VirtualFileSystem, new PartitionFileSystem(file.AsStorage()), TitleId.ToString("x16"), 0);
|
var pfs = new PartitionFileSystem();
|
||||||
|
pfs.Initialize(file.AsStorage()).ThrowIfFailure();
|
||||||
|
(Nca patchNca, Nca controlNca) = ApplicationLibrary.GetGameUpdateDataFromPartition(VirtualFileSystem, pfs, TitleId.ToString("x16"), 0);
|
||||||
|
|
||||||
if (controlNca != null && patchNca != null)
|
if (controlNca != null && patchNca != null)
|
||||||
{
|
{
|
||||||
@@ -184,18 +187,12 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(async () =>
|
Dispatcher.UIThread.InvokeAsync(() => ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance[LocaleKeys.DialogUpdateAddUpdateErrorMessage]));
|
||||||
{
|
|
||||||
await ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance[LocaleKeys.DialogUpdateAddUpdateErrorMessage]);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(async () =>
|
Dispatcher.UIThread.InvokeAsync(() => ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogLoadNcaErrorMessage, ex.Message, path)));
|
||||||
{
|
|
||||||
await ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogLoadNcaErrorMessage, ex.Message, path));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,7 +204,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
SortUpdates();
|
SortUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void Add()
|
public async Task Add()
|
||||||
{
|
{
|
||||||
var result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
|
var result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
|
||||||
{
|
{
|
||||||
@@ -218,9 +215,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
{
|
{
|
||||||
Patterns = new[] { "*.nsp" },
|
Patterns = new[] { "*.nsp" },
|
||||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.nsp" },
|
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.nsp" },
|
||||||
MimeTypes = new[] { "application/x-nx-nsp" }
|
MimeTypes = new[] { "application/x-nx-nsp" },
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (var file in result)
|
foreach (var file in result)
|
||||||
|
@@ -5,6 +5,7 @@
|
|||||||
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls"
|
||||||
xmlns:models="clr-namespace:Ryujinx.Ava.UI.Models"
|
xmlns:models="clr-namespace:Ryujinx.Ava.UI.Models"
|
||||||
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
|
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
|
||||||
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
|
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
|
||||||
@@ -460,7 +461,7 @@
|
|||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Orientation="Horizontal">
|
Orientation="Horizontal">
|
||||||
<Slider
|
<controls:SliderScroll
|
||||||
Width="130"
|
Width="130"
|
||||||
Maximum="1"
|
Maximum="1"
|
||||||
TickFrequency="0.01"
|
TickFrequency="0.01"
|
||||||
@@ -480,7 +481,7 @@
|
|||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Orientation="Horizontal">
|
Orientation="Horizontal">
|
||||||
<Slider
|
<controls:SliderScroll
|
||||||
Width="130"
|
Width="130"
|
||||||
Maximum="2"
|
Maximum="2"
|
||||||
TickFrequency="0.01"
|
TickFrequency="0.01"
|
||||||
@@ -604,7 +605,7 @@
|
|||||||
<StackPanel
|
<StackPanel
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Orientation="Horizontal">
|
Orientation="Horizontal">
|
||||||
<Slider
|
<controls:SliderScroll
|
||||||
Width="130"
|
Width="130"
|
||||||
Maximum="1"
|
Maximum="1"
|
||||||
TickFrequency="0.01"
|
TickFrequency="0.01"
|
||||||
@@ -1083,7 +1084,7 @@
|
|||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Orientation="Horizontal">
|
Orientation="Horizontal">
|
||||||
<Slider
|
<controls:SliderScroll
|
||||||
Width="130"
|
Width="130"
|
||||||
Maximum="1"
|
Maximum="1"
|
||||||
TickFrequency="0.01"
|
TickFrequency="0.01"
|
||||||
@@ -1105,7 +1106,7 @@
|
|||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Orientation="Horizontal">
|
Orientation="Horizontal">
|
||||||
<Slider
|
<controls:SliderScroll
|
||||||
Width="130"
|
Width="130"
|
||||||
Maximum="2"
|
Maximum="2"
|
||||||
TickFrequency="0.01"
|
TickFrequency="0.01"
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls"
|
||||||
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||||
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
||||||
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
|
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
|
||||||
@@ -23,11 +24,11 @@
|
|||||||
Margin="0"
|
Margin="0"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Text="{locale:Locale ControllerSettingsMotionGyroSensitivity}" />
|
Text="{locale:Locale ControllerSettingsMotionGyroSensitivity}" />
|
||||||
<Slider
|
<controls:SliderScroll
|
||||||
Margin="0,-5,0,-5"
|
Margin="0,-5,0,-5"
|
||||||
Width="150"
|
Width="150"
|
||||||
MaxWidth="150"
|
MaxWidth="150"
|
||||||
TickFrequency="0.01"
|
TickFrequency="1"
|
||||||
IsSnapToTickEnabled="True"
|
IsSnapToTickEnabled="True"
|
||||||
SmallChange="0.01"
|
SmallChange="0.01"
|
||||||
Maximum="100"
|
Maximum="100"
|
||||||
@@ -45,11 +46,11 @@
|
|||||||
Margin="0"
|
Margin="0"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Text="{locale:Locale ControllerSettingsMotionGyroDeadzone}" />
|
Text="{locale:Locale ControllerSettingsMotionGyroDeadzone}" />
|
||||||
<Slider
|
<controls:SliderScroll
|
||||||
Margin="0,-5,0,-5"
|
Margin="0,-5,0,-5"
|
||||||
Width="150"
|
Width="150"
|
||||||
MaxWidth="150"
|
MaxWidth="150"
|
||||||
TickFrequency="0.01"
|
TickFrequency="1"
|
||||||
IsSnapToTickEnabled="True"
|
IsSnapToTickEnabled="True"
|
||||||
SmallChange="0.01"
|
SmallChange="0.01"
|
||||||
Maximum="100"
|
Maximum="100"
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
<UserControl
|
<UserControl
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
||||||
@@ -21,7 +22,7 @@
|
|||||||
TextWrapping="WrapWithOverflow"
|
TextWrapping="WrapWithOverflow"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Text="{locale:Locale ControllerSettingsRumbleStrongMultiplier}" />
|
Text="{locale:Locale ControllerSettingsRumbleStrongMultiplier}" />
|
||||||
<Slider
|
<controls:SliderScroll
|
||||||
Margin="0,-5,0,-5"
|
Margin="0,-5,0,-5"
|
||||||
Width="200"
|
Width="200"
|
||||||
TickFrequency="0.01"
|
TickFrequency="0.01"
|
||||||
@@ -41,7 +42,7 @@
|
|||||||
TextWrapping="WrapWithOverflow"
|
TextWrapping="WrapWithOverflow"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Text="{locale:Locale ControllerSettingsRumbleWeakMultiplier}" />
|
Text="{locale:Locale ControllerSettingsRumbleWeakMultiplier}" />
|
||||||
<Slider
|
<controls:SliderScroll
|
||||||
Margin="0,-5,0,-5"
|
Margin="0,-5,0,-5"
|
||||||
Width="200"
|
Width="200"
|
||||||
MaxWidth="200"
|
MaxWidth="200"
|
||||||
|
@@ -17,7 +17,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Ryujinx.Ava.UI.Views.Main
|
namespace Ryujinx.Ava.UI.Views.Main
|
||||||
{
|
{
|
||||||
@@ -107,20 +106,14 @@ namespace Ryujinx.Ava.UI.Views.Main
|
|||||||
await Window.ViewModel.AppHost?.ShowExitPrompt();
|
await Window.ViewModel.AppHost?.ShowExitPrompt();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void PauseEmulation_Click(object sender, RoutedEventArgs e)
|
private void PauseEmulation_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
|
||||||
await Task.Run(() =>
|
|
||||||
{
|
{
|
||||||
Window.ViewModel.AppHost?.Pause();
|
Window.ViewModel.AppHost?.Pause();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void ResumeEmulation_Click(object sender, RoutedEventArgs e)
|
private void ResumeEmulation_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
|
||||||
await Task.Run(() =>
|
|
||||||
{
|
{
|
||||||
Window.ViewModel.AppHost?.Resume();
|
Window.ViewModel.AppHost?.Resume();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void OpenSettings(object sender, RoutedEventArgs e)
|
public async void OpenSettings(object sender, RoutedEventArgs e)
|
||||||
@@ -132,13 +125,13 @@ namespace Ryujinx.Ava.UI.Views.Main
|
|||||||
ViewModel.LoadConfigurableHotKeys();
|
ViewModel.LoadConfigurableHotKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenMiiApplet(object sender, RoutedEventArgs e)
|
public async void OpenMiiApplet(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
string contentPath = ViewModel.ContentManager.GetInstalledContentPath(0x0100000000001009, StorageId.BuiltInSystem, NcaContentType.Program);
|
string contentPath = ViewModel.ContentManager.GetInstalledContentPath(0x0100000000001009, StorageId.BuiltInSystem, NcaContentType.Program);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(contentPath))
|
if (!string.IsNullOrEmpty(contentPath))
|
||||||
{
|
{
|
||||||
ViewModel.LoadApplication(contentPath, false, "Mii Applet");
|
await ViewModel.LoadApplication(contentPath, false, "Mii Applet");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,8 +189,7 @@ namespace Ryujinx.Ava.UI.Views.Main
|
|||||||
{
|
{
|
||||||
if (FileAssociationHelper.Install())
|
if (FileAssociationHelper.Install())
|
||||||
{
|
{
|
||||||
await ContentDialogHelper.CreateInfoDialog(LocaleManager.Instance[LocaleKeys.DialogInstallFileTypesSuccessMessage],
|
await ContentDialogHelper.CreateInfoDialog(LocaleManager.Instance[LocaleKeys.DialogInstallFileTypesSuccessMessage], string.Empty, LocaleManager.Instance[LocaleKeys.InputDialogOk], string.Empty, string.Empty);
|
||||||
string.Empty, LocaleManager.Instance[LocaleKeys.InputDialogOk], string.Empty, string.Empty);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -209,8 +201,7 @@ namespace Ryujinx.Ava.UI.Views.Main
|
|||||||
{
|
{
|
||||||
if (FileAssociationHelper.Uninstall())
|
if (FileAssociationHelper.Uninstall())
|
||||||
{
|
{
|
||||||
await ContentDialogHelper.CreateInfoDialog(LocaleManager.Instance[LocaleKeys.DialogUninstallFileTypesSuccessMessage],
|
await ContentDialogHelper.CreateInfoDialog(LocaleManager.Instance[LocaleKeys.DialogUninstallFileTypesSuccessMessage], string.Empty, LocaleManager.Instance[LocaleKeys.InputDialogOk], string.Empty, string.Empty);
|
||||||
string.Empty, LocaleManager.Instance[LocaleKeys.InputDialogOk], string.Empty, string.Empty);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -3,9 +3,11 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls"
|
||||||
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
||||||
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||||
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
|
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
|
||||||
|
xmlns:config="clr-namespace:Ryujinx.Common.Configuration;assembly=Ryujinx.Common"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="Ryujinx.Ava.UI.Views.Main.MainStatusBarView"
|
x:Class="Ryujinx.Ava.UI.Views.Main.MainStatusBarView"
|
||||||
x:DataType="viewModels:MainWindowViewModel">
|
x:DataType="viewModels:MainWindowViewModel">
|
||||||
@@ -112,15 +114,52 @@
|
|||||||
Background="Gray"
|
Background="Gray"
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
IsVisible="{Binding !ShowLoadProgress}" />
|
IsVisible="{Binding !ShowLoadProgress}" />
|
||||||
<TextBlock
|
<SplitButton
|
||||||
Name="AspectRatioStatus"
|
Name="AspectRatioStatus"
|
||||||
Margin="5,0,5,0"
|
Padding="5,0,5,0"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
Background="Transparent"
|
||||||
|
BorderThickness="0"
|
||||||
|
CornerRadius="0"
|
||||||
IsVisible="{Binding !ShowLoadProgress}"
|
IsVisible="{Binding !ShowLoadProgress}"
|
||||||
PointerReleased="AspectRatioStatus_PointerReleased"
|
Content="{Binding AspectRatioStatusText}"
|
||||||
Text="{Binding AspectRatioStatusText}"
|
Click="AspectRatioStatus_OnClick"
|
||||||
TextAlignment="Left" />
|
ToolTip.Tip="{locale:Locale AspectRatioTooltip}">
|
||||||
|
<SplitButton.Styles>
|
||||||
|
<Style Selector="Border#SeparatorBorder">
|
||||||
|
<Setter Property="Opacity" Value="0" />
|
||||||
|
</Style>
|
||||||
|
</SplitButton.Styles>
|
||||||
|
<SplitButton.Flyout>
|
||||||
|
<MenuFlyout Placement="Bottom" ShowMode="TransientWithDismissOnPointerMoveAway">
|
||||||
|
<MenuItem
|
||||||
|
Header="{locale:Locale SettingsTabGraphicsAspectRatio4x3}"
|
||||||
|
Command="{Binding SetAspectRatio}"
|
||||||
|
CommandParameter="{x:Static config:AspectRatio.Fixed4x3}"/>
|
||||||
|
<MenuItem
|
||||||
|
Header="{locale:Locale SettingsTabGraphicsAspectRatio16x9}"
|
||||||
|
Command="{Binding SetAspectRatio}"
|
||||||
|
CommandParameter="{x:Static config:AspectRatio.Fixed16x9}"/>
|
||||||
|
<MenuItem
|
||||||
|
Header="{locale:Locale SettingsTabGraphicsAspectRatio16x10}"
|
||||||
|
Command="{Binding SetAspectRatio}"
|
||||||
|
CommandParameter="{x:Static config:AspectRatio.Fixed16x10}"/>
|
||||||
|
<MenuItem
|
||||||
|
Header="{locale:Locale SettingsTabGraphicsAspectRatio21x9}"
|
||||||
|
Command="{Binding SetAspectRatio}"
|
||||||
|
CommandParameter="{x:Static config:AspectRatio.Fixed21x9}"/>
|
||||||
|
<MenuItem
|
||||||
|
Header="{locale:Locale SettingsTabGraphicsAspectRatio32x9}"
|
||||||
|
Command="{Binding SetAspectRatio}"
|
||||||
|
CommandParameter="{x:Static config:AspectRatio.Fixed32x9}"/>
|
||||||
|
<MenuItem
|
||||||
|
Header="{locale:Locale SettingsTabGraphicsAspectRatioStretch}"
|
||||||
|
Command="{Binding SetAspectRatio}"
|
||||||
|
CommandParameter="{x:Static config:AspectRatio.Stretched}"/>
|
||||||
|
</MenuFlyout>
|
||||||
|
</SplitButton.Flyout>
|
||||||
|
</SplitButton>
|
||||||
<Border
|
<Border
|
||||||
Width="2"
|
Width="2"
|
||||||
Height="12"
|
Height="12"
|
||||||
@@ -138,6 +177,7 @@
|
|||||||
Content="{Binding VolumeStatusText}"
|
Content="{Binding VolumeStatusText}"
|
||||||
IsChecked="{Binding VolumeMuted}"
|
IsChecked="{Binding VolumeMuted}"
|
||||||
IsVisible="{Binding !ShowLoadProgress}"
|
IsVisible="{Binding !ShowLoadProgress}"
|
||||||
|
PointerWheelChanged="VolumeStatus_OnPointerWheelChanged"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
CornerRadius="0">
|
CornerRadius="0">
|
||||||
@@ -154,7 +194,7 @@
|
|||||||
<ToggleSplitButton.Flyout>
|
<ToggleSplitButton.Flyout>
|
||||||
<Flyout Placement="Bottom" ShowMode="TransientWithDismissOnPointerMoveAway">
|
<Flyout Placement="Bottom" ShowMode="TransientWithDismissOnPointerMoveAway">
|
||||||
<Grid Margin="0">
|
<Grid Margin="0">
|
||||||
<Slider
|
<controls:SliderScroll
|
||||||
MaxHeight="40"
|
MaxHeight="40"
|
||||||
Width="150"
|
Width="150"
|
||||||
Margin="0"
|
Margin="0"
|
||||||
|
@@ -43,10 +43,9 @@ namespace Ryujinx.Ava.UI.Views.Main
|
|||||||
ConfigurationState.Instance.System.EnableDockedMode.Value = !ConfigurationState.Instance.System.EnableDockedMode.Value;
|
ConfigurationState.Instance.System.EnableDockedMode.Value = !ConfigurationState.Instance.System.EnableDockedMode.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AspectRatioStatus_PointerReleased(object sender, PointerReleasedEventArgs e)
|
private void AspectRatioStatus_OnClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
AspectRatio aspectRatio = ConfigurationState.Instance.Graphics.AspectRatio.Value;
|
AspectRatio aspectRatio = ConfigurationState.Instance.Graphics.AspectRatio.Value;
|
||||||
|
|
||||||
ConfigurationState.Instance.Graphics.AspectRatio.Value = (int)aspectRatio + 1 > Enum.GetNames(typeof(AspectRatio)).Length - 1 ? AspectRatio.Fixed4x3 : aspectRatio + 1;
|
ConfigurationState.Instance.Graphics.AspectRatio.Value = (int)aspectRatio + 1 > Enum.GetNames(typeof(AspectRatio)).Length - 1 ? AspectRatio.Fixed4x3 : aspectRatio + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,5 +53,20 @@ namespace Ryujinx.Ava.UI.Views.Main
|
|||||||
{
|
{
|
||||||
Window.LoadApplications();
|
Window.LoadApplications();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void VolumeStatus_OnPointerWheelChanged(object sender, PointerWheelEventArgs e)
|
||||||
|
{
|
||||||
|
// Change the volume by 5% at a time
|
||||||
|
float newValue = Window.ViewModel.Volume + (float)e.Delta.Y * 0.05f;
|
||||||
|
|
||||||
|
Window.ViewModel.Volume = newValue switch
|
||||||
|
{
|
||||||
|
< 0 => 0,
|
||||||
|
> 1 => 1,
|
||||||
|
_ => newValue,
|
||||||
|
};
|
||||||
|
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls"
|
||||||
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||||
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
|
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
|
||||||
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
||||||
@@ -50,7 +51,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Text="{locale:Locale IconSize}"
|
Text="{locale:Locale IconSize}"
|
||||||
ToolTip.Tip="{locale:Locale IconSizeTooltip}" />
|
ToolTip.Tip="{locale:Locale IconSizeTooltip}" />
|
||||||
<Slider
|
<controls:SliderScroll
|
||||||
Width="150"
|
Width="150"
|
||||||
Height="35"
|
Height="35"
|
||||||
Margin="5,-10,5,0"
|
Margin="5,-10,5,0"
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls"
|
||||||
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||||
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
||||||
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
|
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
|
||||||
@@ -63,13 +64,13 @@
|
|||||||
Maximum="100" />
|
Maximum="100" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Margin="10,0,0,0" Orientation="Horizontal">
|
<StackPanel Margin="10,0,0,0" Orientation="Horizontal">
|
||||||
<Slider Value="{Binding Volume}"
|
<controls:SliderScroll Value="{Binding Volume}"
|
||||||
Margin="250,0,0,0"
|
Margin="250,0,0,0"
|
||||||
ToolTip.Tip="{locale:Locale AudioVolumeTooltip}"
|
ToolTip.Tip="{locale:Locale AudioVolumeTooltip}"
|
||||||
Minimum="0"
|
Minimum="0"
|
||||||
Maximum="100"
|
Maximum="100"
|
||||||
SmallChange="5"
|
SmallChange="1"
|
||||||
TickFrequency="5"
|
TickFrequency="1"
|
||||||
IsSnapToTickEnabled="True"
|
IsSnapToTickEnabled="True"
|
||||||
LargeChange="10"
|
LargeChange="10"
|
||||||
Width="350" />
|
Width="350" />
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls"
|
||||||
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||||
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
||||||
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
|
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
|
||||||
@@ -73,6 +74,7 @@
|
|||||||
<TextBlock Text="{locale:Locale SettingsEnableMacroHLE}" />
|
<TextBlock Text="{locale:Locale SettingsEnableMacroHLE}" />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
<CheckBox IsChecked="{Binding EnableColorSpacePassthrough}"
|
<CheckBox IsChecked="{Binding EnableColorSpacePassthrough}"
|
||||||
|
IsVisible="{Binding ColorSpacePassthroughAvailable}"
|
||||||
ToolTip.Tip="{locale:Locale SettingsEnableColorSpacePassthroughTooltip}">
|
ToolTip.Tip="{locale:Locale SettingsEnableColorSpacePassthroughTooltip}">
|
||||||
<TextBlock Text="{locale:Locale SettingsEnableColorSpacePassthrough}" />
|
<TextBlock Text="{locale:Locale SettingsEnableColorSpacePassthrough}" />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
@@ -172,7 +174,7 @@
|
|||||||
<TextBlock Text="FSR" />
|
<TextBlock Text="FSR" />
|
||||||
</ComboBoxItem>
|
</ComboBoxItem>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<Slider Value="{Binding ScalingFilterLevel}"
|
<controls:SliderScroll Value="{Binding ScalingFilterLevel}"
|
||||||
ToolTip.Tip="{locale:Locale GraphicsScalingFilterLevelTooltip}"
|
ToolTip.Tip="{locale:Locale GraphicsScalingFilterLevelTooltip}"
|
||||||
MinWidth="150"
|
MinWidth="150"
|
||||||
Margin="10,-3,0,0"
|
Margin="10,-3,0,0"
|
||||||
|
@@ -23,6 +23,19 @@
|
|||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
Orientation="Vertical"
|
Orientation="Vertical"
|
||||||
Spacing="10">
|
Spacing="10">
|
||||||
|
<TextBlock Classes="h1" Text="{locale:Locale SettingsTabNetworkMultiplayer}" />
|
||||||
|
<StackPanel Margin="10,0,0,0" Orientation="Horizontal">
|
||||||
|
<TextBlock VerticalAlignment="Center"
|
||||||
|
Text="{locale:Locale MultiplayerMode}"
|
||||||
|
ToolTip.Tip="{locale:Locale MultiplayerModeTooltip}"
|
||||||
|
Width="200" />
|
||||||
|
<ComboBox SelectedIndex="{Binding MultiplayerModeIndex}"
|
||||||
|
ToolTip.Tip="{locale:Locale MultiplayerModeTooltip}"
|
||||||
|
HorizontalContentAlignment="Left"
|
||||||
|
ItemsSource="{Binding MultiplayerModes}"
|
||||||
|
Width="250" />
|
||||||
|
</StackPanel>
|
||||||
|
<Separator Height="1" />
|
||||||
<TextBlock Classes="h1" Text="{locale:Locale SettingsTabNetworkConnection}" />
|
<TextBlock Classes="h1" Text="{locale:Locale SettingsTabNetworkConnection}" />
|
||||||
<CheckBox Margin="10,0,0,0" IsChecked="{Binding EnableInternetAccess}">
|
<CheckBox Margin="10,0,0,0" IsChecked="{Binding EnableInternetAccess}">
|
||||||
<TextBlock Text="{locale:Locale SettingsTabSystemEnableInternetAccess}"
|
<TextBlock Text="{locale:Locale SettingsTabSystemEnableInternetAccess}"
|
||||||
|
@@ -34,7 +34,7 @@ namespace Ryujinx.Ava.UI.Views.Settings
|
|||||||
{
|
{
|
||||||
var result = await window.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
var result = await window.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
||||||
{
|
{
|
||||||
AllowMultiple = false
|
AllowMultiple = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.Count > 0)
|
if (result.Count > 0)
|
||||||
@@ -75,9 +75,9 @@ namespace Ryujinx.Ava.UI.Views.Settings
|
|||||||
{
|
{
|
||||||
Patterns = new[] { "*.xaml" },
|
Patterns = new[] { "*.xaml" },
|
||||||
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.xaml" },
|
AppleUniformTypeIdentifiers = new[] { "com.ryujinx.xaml" },
|
||||||
MimeTypes = new[] { "application/xaml+xml" }
|
MimeTypes = new[] { "application/xaml+xml" },
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.Count > 0)
|
if (result.Count > 0)
|
||||||
|
@@ -75,9 +75,9 @@ namespace Ryujinx.Ava.UI.Views.User
|
|||||||
{
|
{
|
||||||
Patterns = new[] { "*.jpg", "*.jpeg", "*.png", "*.bmp" },
|
Patterns = new[] { "*.jpg", "*.jpeg", "*.png", "*.bmp" },
|
||||||
AppleUniformTypeIdentifiers = new[] { "public.jpeg", "public.png", "com.microsoft.bmp" },
|
AppleUniformTypeIdentifiers = new[] { "public.jpeg", "public.png", "com.microsoft.bmp" },
|
||||||
MimeTypes = new[] { "image/jpeg", "image/png", "image/bmp" }
|
MimeTypes = new[] { "image/jpeg", "image/png", "image/bmp" },
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.Count > 0)
|
if (result.Count > 0)
|
||||||
|
@@ -15,6 +15,7 @@ using Ryujinx.Graphics.Gpu;
|
|||||||
using Ryujinx.HLE.FileSystem;
|
using Ryujinx.HLE.FileSystem;
|
||||||
using Ryujinx.HLE.HOS;
|
using Ryujinx.HLE.HOS;
|
||||||
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
||||||
|
using Ryujinx.Input.HLE;
|
||||||
using Ryujinx.Input.SDL2;
|
using Ryujinx.Input.SDL2;
|
||||||
using Ryujinx.Modules;
|
using Ryujinx.Modules;
|
||||||
using Ryujinx.Ui.App.Common;
|
using Ryujinx.Ui.App.Common;
|
||||||
@@ -24,8 +25,8 @@ using Ryujinx.Ui.Common.Helper;
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.Versioning;
|
using System.Runtime.Versioning;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using InputManager = Ryujinx.Input.HLE.InputManager;
|
|
||||||
|
|
||||||
namespace Ryujinx.Ava.UI.Windows
|
namespace Ryujinx.Ava.UI.Windows
|
||||||
{
|
{
|
||||||
@@ -79,35 +80,11 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
|
|
||||||
if (Program.PreviewerDetached)
|
if (Program.PreviewerDetached)
|
||||||
{
|
{
|
||||||
Initialize();
|
|
||||||
|
|
||||||
InputManager = new InputManager(new AvaloniaKeyboardDriver(this), new SDL2GamepadDriver());
|
InputManager = new InputManager(new AvaloniaKeyboardDriver(this), new SDL2GamepadDriver());
|
||||||
|
|
||||||
ViewModel.Initialize(
|
|
||||||
ContentManager,
|
|
||||||
StorageProvider,
|
|
||||||
ApplicationLibrary,
|
|
||||||
VirtualFileSystem,
|
|
||||||
AccountManager,
|
|
||||||
InputManager,
|
|
||||||
_userChannelPersistence,
|
|
||||||
LibHacHorizonManager,
|
|
||||||
UiHandler,
|
|
||||||
ShowLoading,
|
|
||||||
SwitchToGameControl,
|
|
||||||
SetMainContent,
|
|
||||||
this);
|
|
||||||
|
|
||||||
ViewModel.RefreshFirmwareStatus();
|
|
||||||
|
|
||||||
LoadGameList();
|
|
||||||
|
|
||||||
this.GetObservable(IsActiveProperty).Subscribe(IsActiveChanged);
|
this.GetObservable(IsActiveProperty).Subscribe(IsActiveChanged);
|
||||||
this.ScalingChanged += OnScalingChanged;
|
this.ScalingChanged += OnScalingChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplicationLibrary.ApplicationCountUpdated += ApplicationLibrary_ApplicationCountUpdated;
|
|
||||||
ApplicationLibrary.ApplicationAdded += ApplicationLibrary_ApplicationAdded;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||||
@@ -122,36 +99,17 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
ViewModel.IsActive = obj;
|
ViewModel.IsActive = obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadGameList()
|
|
||||||
{
|
|
||||||
if (_isLoading)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_isLoading = true;
|
|
||||||
|
|
||||||
LoadApplications();
|
|
||||||
|
|
||||||
_isLoading = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnScalingChanged(object sender, EventArgs e)
|
private void OnScalingChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Program.DesktopScaleFactor = this.RenderScaling;
|
Program.DesktopScaleFactor = this.RenderScaling;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddApplication(ApplicationData applicationData)
|
|
||||||
{
|
|
||||||
Dispatcher.UIThread.InvokeAsync(() =>
|
|
||||||
{
|
|
||||||
ViewModel.Applications.Add(applicationData);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ApplicationLibrary_ApplicationAdded(object sender, ApplicationAddedEventArgs e)
|
private void ApplicationLibrary_ApplicationAdded(object sender, ApplicationAddedEventArgs e)
|
||||||
{
|
{
|
||||||
AddApplication(e.AppData);
|
Dispatcher.UIThread.Post(() =>
|
||||||
|
{
|
||||||
|
ViewModel.Applications.Add(e.AppData);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ApplicationLibrary_ApplicationCountUpdated(object sender, ApplicationCountUpdatedEventArgs e)
|
private void ApplicationLibrary_ApplicationCountUpdated(object sender, ApplicationCountUpdatedEventArgs e)
|
||||||
@@ -183,7 +141,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
|
|
||||||
string path = new FileInfo(args.Application.Path).FullName;
|
string path = new FileInfo(args.Application.Path).FullName;
|
||||||
|
|
||||||
ViewModel.LoadApplication(path);
|
ViewModel.LoadApplication(path).Wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
@@ -202,13 +160,10 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
ViewModel.ShowContent = true;
|
ViewModel.ShowContent = true;
|
||||||
ViewModel.IsLoadingIndeterminate = false;
|
ViewModel.IsLoadingIndeterminate = false;
|
||||||
|
|
||||||
Dispatcher.UIThread.InvokeAsync(() =>
|
|
||||||
{
|
|
||||||
if (startFullscreen && ViewModel.WindowState != WindowState.FullScreen)
|
if (startFullscreen && ViewModel.WindowState != WindowState.FullScreen)
|
||||||
{
|
{
|
||||||
ViewModel.ToggleFullscreen();
|
ViewModel.ToggleFullscreen();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowLoading(bool startFullscreen = false)
|
public void ShowLoading(bool startFullscreen = false)
|
||||||
@@ -217,13 +172,10 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
ViewModel.ShowLoadProgress = true;
|
ViewModel.ShowLoadProgress = true;
|
||||||
ViewModel.IsLoadingIndeterminate = true;
|
ViewModel.IsLoadingIndeterminate = true;
|
||||||
|
|
||||||
Dispatcher.UIThread.InvokeAsync(() =>
|
|
||||||
{
|
|
||||||
if (startFullscreen && ViewModel.WindowState != WindowState.FullScreen)
|
if (startFullscreen && ViewModel.WindowState != WindowState.FullScreen)
|
||||||
{
|
{
|
||||||
ViewModel.ToggleFullscreen();
|
ViewModel.ToggleFullscreen();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Initialize()
|
private void Initialize()
|
||||||
@@ -251,11 +203,11 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
|
|
||||||
VirtualFileSystem.ReloadKeySet();
|
VirtualFileSystem.ReloadKeySet();
|
||||||
|
|
||||||
ApplicationHelper.Initialize(VirtualFileSystem, AccountManager, LibHacHorizonManager.RyujinxClient, this);
|
ApplicationHelper.Initialize(VirtualFileSystem, AccountManager, LibHacHorizonManager.RyujinxClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
[SupportedOSPlatform("linux")]
|
[SupportedOSPlatform("linux")]
|
||||||
private static async void ShowVmMaxMapCountWarning()
|
private static async Task ShowVmMaxMapCountWarning()
|
||||||
{
|
{
|
||||||
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.LinuxVmMaxMapCountWarningTextSecondary,
|
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.LinuxVmMaxMapCountWarningTextSecondary,
|
||||||
LinuxHelper.VmMaxMapCount, LinuxHelper.RecommendedVmMaxMapCount);
|
LinuxHelper.VmMaxMapCount, LinuxHelper.RecommendedVmMaxMapCount);
|
||||||
@@ -267,7 +219,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
}
|
}
|
||||||
|
|
||||||
[SupportedOSPlatform("linux")]
|
[SupportedOSPlatform("linux")]
|
||||||
private static async void ShowVmMaxMapCountDialog()
|
private static async Task ShowVmMaxMapCountDialog()
|
||||||
{
|
{
|
||||||
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.LinuxVmMaxMapCountDialogTextPrimary,
|
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.LinuxVmMaxMapCountDialogTextPrimary,
|
||||||
LinuxHelper.RecommendedVmMaxMapCount);
|
LinuxHelper.RecommendedVmMaxMapCount);
|
||||||
@@ -313,33 +265,46 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
|
|
||||||
private void CheckLaunchState()
|
private void CheckLaunchState()
|
||||||
{
|
{
|
||||||
if (ShowKeyErrorOnLoad)
|
|
||||||
{
|
|
||||||
ShowKeyErrorOnLoad = false;
|
|
||||||
|
|
||||||
Dispatcher.UIThread.Post(async () => await
|
|
||||||
UserErrorDialog.ShowUserErrorDialog(UserError.NoKeys));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (OperatingSystem.IsLinux() && LinuxHelper.VmMaxMapCount < LinuxHelper.RecommendedVmMaxMapCount)
|
if (OperatingSystem.IsLinux() && LinuxHelper.VmMaxMapCount < LinuxHelper.RecommendedVmMaxMapCount)
|
||||||
{
|
{
|
||||||
Logger.Warning?.Print(LogClass.Application, $"The value of vm.max_map_count is lower than {LinuxHelper.RecommendedVmMaxMapCount}. ({LinuxHelper.VmMaxMapCount})");
|
Logger.Warning?.Print(LogClass.Application, $"The value of vm.max_map_count is lower than {LinuxHelper.RecommendedVmMaxMapCount}. ({LinuxHelper.VmMaxMapCount})");
|
||||||
|
|
||||||
if (LinuxHelper.PkExecPath is not null)
|
if (LinuxHelper.PkExecPath is not null)
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(ShowVmMaxMapCountDialog);
|
Dispatcher.UIThread.Post(async () =>
|
||||||
|
{
|
||||||
|
if (OperatingSystem.IsLinux())
|
||||||
|
{
|
||||||
|
await ShowVmMaxMapCountDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(ShowVmMaxMapCountWarning);
|
Dispatcher.UIThread.Post(async () =>
|
||||||
|
{
|
||||||
|
if (OperatingSystem.IsLinux())
|
||||||
|
{
|
||||||
|
await ShowVmMaxMapCountWarning();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ShowKeyErrorOnLoad)
|
||||||
|
{
|
||||||
if (_deferLoad)
|
if (_deferLoad)
|
||||||
{
|
{
|
||||||
_deferLoad = false;
|
_deferLoad = false;
|
||||||
|
|
||||||
ViewModel.LoadApplication(_launchPath, _startFullscreen);
|
ViewModel.LoadApplication(_launchPath, _startFullscreen).Wait();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShowKeyErrorOnLoad = false;
|
||||||
|
|
||||||
|
Dispatcher.UIThread.Post(async () => await UserErrorDialog.ShowUserErrorDialog(UserError.NoKeys));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConfigurationState.Instance.CheckUpdatesOnStart.Value && Updater.CanUpdate(false))
|
if (ConfigurationState.Instance.CheckUpdatesOnStart.Value && Updater.CanUpdate(false))
|
||||||
@@ -372,7 +337,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
ViewModel.WindowHeight = ConfigurationState.Instance.Ui.WindowStartup.WindowSizeHeight * Program.WindowScaleFactor;
|
ViewModel.WindowHeight = ConfigurationState.Instance.Ui.WindowStartup.WindowSizeHeight * Program.WindowScaleFactor;
|
||||||
ViewModel.WindowWidth = ConfigurationState.Instance.Ui.WindowStartup.WindowSizeWidth * Program.WindowScaleFactor;
|
ViewModel.WindowWidth = ConfigurationState.Instance.Ui.WindowStartup.WindowSizeWidth * Program.WindowScaleFactor;
|
||||||
|
|
||||||
ViewModel.WindowState = ConfigurationState.Instance.Ui.WindowStartup.WindowMaximized.Value is true ? WindowState.Maximized : WindowState.Normal;
|
ViewModel.WindowState = ConfigurationState.Instance.Ui.WindowStartup.WindowMaximized.Value ? WindowState.Maximized : WindowState.Normal;
|
||||||
|
|
||||||
if (CheckScreenBounds(savedPoint))
|
if (CheckScreenBounds(savedPoint))
|
||||||
{
|
{
|
||||||
@@ -415,6 +380,30 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
{
|
{
|
||||||
base.OnOpened(e);
|
base.OnOpened(e);
|
||||||
|
|
||||||
|
Initialize();
|
||||||
|
|
||||||
|
ViewModel.Initialize(
|
||||||
|
ContentManager,
|
||||||
|
StorageProvider,
|
||||||
|
ApplicationLibrary,
|
||||||
|
VirtualFileSystem,
|
||||||
|
AccountManager,
|
||||||
|
InputManager,
|
||||||
|
_userChannelPersistence,
|
||||||
|
LibHacHorizonManager,
|
||||||
|
UiHandler,
|
||||||
|
ShowLoading,
|
||||||
|
SwitchToGameControl,
|
||||||
|
SetMainContent,
|
||||||
|
this);
|
||||||
|
|
||||||
|
ApplicationLibrary.ApplicationCountUpdated += ApplicationLibrary_ApplicationCountUpdated;
|
||||||
|
ApplicationLibrary.ApplicationAdded += ApplicationLibrary_ApplicationAdded;
|
||||||
|
|
||||||
|
ViewModel.RefreshFirmwareStatus();
|
||||||
|
|
||||||
|
LoadApplications();
|
||||||
|
|
||||||
CheckLaunchState();
|
CheckLaunchState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -514,9 +503,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void LoadApplications()
|
public void LoadApplications()
|
||||||
{
|
|
||||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
|
||||||
{
|
{
|
||||||
ViewModel.Applications.Clear();
|
ViewModel.Applications.Clear();
|
||||||
|
|
||||||
@@ -525,7 +512,6 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
ViewModel.StatusBarProgressValue = 0;
|
ViewModel.StatusBarProgressValue = 0;
|
||||||
|
|
||||||
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.StatusBarGamesLoaded, 0, 0);
|
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.StatusBarGamesLoaded, 0, 0);
|
||||||
});
|
|
||||||
|
|
||||||
ReloadGameList();
|
ReloadGameList();
|
||||||
}
|
}
|
||||||
@@ -558,9 +544,17 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
|
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
|
|
||||||
ApplicationLibrary.LoadApplications(ConfigurationState.Instance.Ui.GameDirs.Value, ConfigurationState.Instance.System.Language);
|
Thread applicationLibraryThread = new(() =>
|
||||||
|
{
|
||||||
|
ApplicationLibrary.LoadApplications(ConfigurationState.Instance.Ui.GameDirs, ConfigurationState.Instance.System.Language);
|
||||||
|
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
|
})
|
||||||
|
{
|
||||||
|
Name = "GUI.ApplicationLibraryThread",
|
||||||
|
IsBackground = true,
|
||||||
|
};
|
||||||
|
applicationLibraryThread.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,7 +3,6 @@ using Avalonia.Controls.Primitives;
|
|||||||
using Avalonia.Media.Imaging;
|
using Avalonia.Media.Imaging;
|
||||||
using Avalonia.Platform;
|
using Avalonia.Platform;
|
||||||
using Ryujinx.Ui.Common.Configuration;
|
using Ryujinx.Ui.Common.Configuration;
|
||||||
using System;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
@@ -25,11 +24,6 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
IconImage = new Bitmap(stream);
|
IconImage = new Bitmap(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnOpened(EventArgs e)
|
|
||||||
{
|
|
||||||
base.OnOpened(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnApplyTemplate(e);
|
base.OnApplyTemplate(e);
|
||||||
|
@@ -192,7 +192,7 @@ namespace Ryujinx.Common.Collections
|
|||||||
{
|
{
|
||||||
if (start.CompareTo(overlap.End) < 0)
|
if (start.CompareTo(overlap.End) < 0)
|
||||||
{
|
{
|
||||||
if (overlaps.Length >= overlapCount)
|
if (overlaps.Length <= overlapCount)
|
||||||
{
|
{
|
||||||
Array.Resize(ref overlaps, overlapCount + ArrayGrowthSize);
|
Array.Resize(ref overlaps, overlapCount + ArrayGrowthSize);
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Ryujinx.Common.Configuration.Multiplayer
|
||||||
|
{
|
||||||
|
public enum MultiplayerMode
|
||||||
|
{
|
||||||
|
Disabled,
|
||||||
|
LdnMitm,
|
||||||
|
}
|
||||||
|
}
|
@@ -756,6 +756,18 @@ namespace Ryujinx.Common.Memory
|
|||||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public struct Array96<T> : IArray<T> where T : unmanaged
|
||||||
|
{
|
||||||
|
T _e0;
|
||||||
|
Array64<T> _other;
|
||||||
|
Array31<T> _other2;
|
||||||
|
public readonly int Length => 96;
|
||||||
|
public ref T this[int index] => ref AsSpan()[index];
|
||||||
|
|
||||||
|
[Pure]
|
||||||
|
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||||
|
}
|
||||||
|
|
||||||
public struct Array127<T> : IArray<T> where T : unmanaged
|
public struct Array127<T> : IArray<T> where T : unmanaged
|
||||||
{
|
{
|
||||||
T _e0;
|
T _e0;
|
||||||
@@ -791,5 +803,34 @@ namespace Ryujinx.Common.Memory
|
|||||||
[Pure]
|
[Pure]
|
||||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public struct Array140<T> : IArray<T> where T : unmanaged
|
||||||
|
{
|
||||||
|
T _e0;
|
||||||
|
Array64<T> _other;
|
||||||
|
Array64<T> _other2;
|
||||||
|
Array11<T> _other3;
|
||||||
|
public readonly int Length => 140;
|
||||||
|
public ref T this[int index] => ref AsSpan()[index];
|
||||||
|
|
||||||
|
[Pure]
|
||||||
|
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct Array384<T> : IArray<T> where T : unmanaged
|
||||||
|
{
|
||||||
|
T _e0;
|
||||||
|
Array64<T> _other;
|
||||||
|
Array64<T> _other2;
|
||||||
|
Array64<T> _other3;
|
||||||
|
Array64<T> _other4;
|
||||||
|
Array64<T> _other5;
|
||||||
|
Array63<T> _other6;
|
||||||
|
public readonly int Length => 384;
|
||||||
|
public ref T this[int index] => ref AsSpan()[index];
|
||||||
|
|
||||||
|
[Pure]
|
||||||
|
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#pragma warning restore CS0169, IDE0051
|
#pragma warning restore CS0169, IDE0051
|
||||||
|
@@ -5,7 +5,7 @@ namespace Ryujinx.Common
|
|||||||
{
|
{
|
||||||
public class ReactiveObject<T>
|
public class ReactiveObject<T>
|
||||||
{
|
{
|
||||||
private readonly ReaderWriterLock _readerWriterLock = new();
|
private readonly ReaderWriterLockSlim _readerWriterLock = new();
|
||||||
private bool _isInitialized;
|
private bool _isInitialized;
|
||||||
private T _value;
|
private T _value;
|
||||||
|
|
||||||
@@ -15,15 +15,15 @@ namespace Ryujinx.Common
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
_readerWriterLock.AcquireReaderLock(Timeout.Infinite);
|
_readerWriterLock.EnterReadLock();
|
||||||
T value = _value;
|
T value = _value;
|
||||||
_readerWriterLock.ReleaseReaderLock();
|
_readerWriterLock.ExitReadLock();
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_readerWriterLock.AcquireWriterLock(Timeout.Infinite);
|
_readerWriterLock.EnterWriteLock();
|
||||||
|
|
||||||
T oldValue = _value;
|
T oldValue = _value;
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ namespace Ryujinx.Common
|
|||||||
_isInitialized = true;
|
_isInitialized = true;
|
||||||
_value = value;
|
_value = value;
|
||||||
|
|
||||||
_readerWriterLock.ReleaseWriterLock();
|
_readerWriterLock.ExitWriteLock();
|
||||||
|
|
||||||
if (!oldIsInitialized || oldValue == null || !oldValue.Equals(_value))
|
if (!oldIsInitialized || oldValue == null || !oldValue.Equals(_value))
|
||||||
{
|
{
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
using System.Net.NetworkInformation;
|
using System.Buffers.Binary;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.NetworkInformation;
|
||||||
|
|
||||||
namespace Ryujinx.Common.Utilities
|
namespace Ryujinx.Common.Utilities
|
||||||
{
|
{
|
||||||
@@ -62,5 +64,20 @@ namespace Ryujinx.Common.Utilities
|
|||||||
|
|
||||||
return (targetProperties, targetAddressInfo);
|
return (targetProperties, targetAddressInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static uint ConvertIpv4Address(IPAddress ipAddress)
|
||||||
|
{
|
||||||
|
return BinaryPrimitives.ReadUInt32BigEndian(ipAddress.GetAddressBytes());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static uint ConvertIpv4Address(string ipAddress)
|
||||||
|
{
|
||||||
|
return ConvertIpv4Address(IPAddress.Parse(ipAddress));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IPAddress ConvertUint(uint ipAddress)
|
||||||
|
{
|
||||||
|
return new IPAddress(new byte[] { (byte)((ipAddress >> 24) & 0xFF), (byte)((ipAddress >> 16) & 0xFF), (byte)((ipAddress >> 8) & 0xFF), (byte)(ipAddress & 0xFF) });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,11 @@
|
|||||||
using Ryujinx.Cpu.AppleHv.Arm;
|
using Ryujinx.Cpu.AppleHv.Arm;
|
||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
namespace Ryujinx.Cpu.AppleHv
|
namespace Ryujinx.Cpu.AppleHv
|
||||||
{
|
{
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
class HvAddressSpace : IDisposable
|
class HvAddressSpace : IDisposable
|
||||||
{
|
{
|
||||||
private const ulong KernelRegionBase = unchecked((ulong)-(1L << 39));
|
private const ulong KernelRegionBase = unchecked((ulong)-(1L << 39));
|
||||||
|
@@ -2,10 +2,12 @@ using Ryujinx.Cpu.AppleHv.Arm;
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace Ryujinx.Cpu.AppleHv
|
namespace Ryujinx.Cpu.AppleHv
|
||||||
{
|
{
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
class HvAddressSpaceRange : IDisposable
|
class HvAddressSpaceRange : IDisposable
|
||||||
{
|
{
|
||||||
private const ulong AllocationGranule = 1UL << 14;
|
private const ulong AllocationGranule = 1UL << 14;
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
namespace Ryujinx.Cpu.AppleHv
|
namespace Ryujinx.Cpu.AppleHv
|
||||||
{
|
{
|
||||||
@@ -12,10 +13,18 @@ namespace Ryujinx.Cpu.AppleHv
|
|||||||
#pragma warning restore CS0649
|
#pragma warning restore CS0649
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum HvExitReason : uint
|
||||||
|
{
|
||||||
|
Canceled,
|
||||||
|
Exception,
|
||||||
|
VTimerActivated,
|
||||||
|
Unknown,
|
||||||
|
}
|
||||||
|
|
||||||
struct HvVcpuExit
|
struct HvVcpuExit
|
||||||
{
|
{
|
||||||
#pragma warning disable CS0649 // Field is never assigned to
|
#pragma warning disable CS0649 // Field is never assigned to
|
||||||
public uint Reason;
|
public HvExitReason Reason;
|
||||||
public HvVcpuExitException Exception;
|
public HvVcpuExitException Exception;
|
||||||
#pragma warning restore CS0649
|
#pragma warning restore CS0649
|
||||||
}
|
}
|
||||||
@@ -255,6 +264,7 @@ namespace Ryujinx.Cpu.AppleHv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
static partial class HvApi
|
static partial class HvApi
|
||||||
{
|
{
|
||||||
public const string LibraryName = "/System/Library/Frameworks/Hypervisor.framework/Hypervisor";
|
public const string LibraryName = "/System/Library/Frameworks/Hypervisor.framework/Hypervisor";
|
||||||
|
62
src/Ryujinx.Cpu/AppleHv/HvCodePatcher.cs
Normal file
62
src/Ryujinx.Cpu/AppleHv/HvCodePatcher.cs
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Runtime.Intrinsics;
|
||||||
|
|
||||||
|
namespace Ryujinx.Cpu.AppleHv
|
||||||
|
{
|
||||||
|
static class HvCodePatcher
|
||||||
|
{
|
||||||
|
private const uint XMask = 0x3f808000u;
|
||||||
|
private const uint XValue = 0x8000000u;
|
||||||
|
|
||||||
|
private const uint ZrIndex = 31u;
|
||||||
|
|
||||||
|
public static void RewriteUnorderedExclusiveInstructions(Span<byte> code)
|
||||||
|
{
|
||||||
|
Span<uint> codeUint = MemoryMarshal.Cast<byte, uint>(code);
|
||||||
|
Span<Vector128<uint>> codeVector = MemoryMarshal.Cast<byte, Vector128<uint>>(code);
|
||||||
|
|
||||||
|
Vector128<uint> mask = Vector128.Create(XMask);
|
||||||
|
Vector128<uint> value = Vector128.Create(XValue);
|
||||||
|
|
||||||
|
for (int index = 0; index < codeVector.Length; index++)
|
||||||
|
{
|
||||||
|
Vector128<uint> v = codeVector[index];
|
||||||
|
|
||||||
|
if (Vector128.EqualsAny(Vector128.BitwiseAnd(v, mask), value))
|
||||||
|
{
|
||||||
|
int baseIndex = index * 4;
|
||||||
|
|
||||||
|
for (int instIndex = baseIndex; instIndex < baseIndex + 4; instIndex++)
|
||||||
|
{
|
||||||
|
ref uint inst = ref codeUint[instIndex];
|
||||||
|
|
||||||
|
if ((inst & XMask) != XValue)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isPair = (inst & (1u << 21)) != 0;
|
||||||
|
bool isLoad = (inst & (1u << 22)) != 0;
|
||||||
|
|
||||||
|
uint rt2 = (inst >> 10) & 0x1fu;
|
||||||
|
uint rs = (inst >> 16) & 0x1fu;
|
||||||
|
|
||||||
|
if (isLoad && rs != ZrIndex)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isPair && rt2 != ZrIndex)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the ordered flag.
|
||||||
|
inst |= 1u << 15;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,7 +1,9 @@
|
|||||||
using ARMeilleure.Memory;
|
using ARMeilleure.Memory;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
namespace Ryujinx.Cpu.AppleHv
|
namespace Ryujinx.Cpu.AppleHv
|
||||||
{
|
{
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
class HvCpuContext : ICpuContext
|
class HvCpuContext : ICpuContext
|
||||||
{
|
{
|
||||||
private readonly ITickSource _tickSource;
|
private readonly ITickSource _tickSource;
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
using ARMeilleure.Memory;
|
using ARMeilleure.Memory;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
namespace Ryujinx.Cpu.AppleHv
|
namespace Ryujinx.Cpu.AppleHv
|
||||||
{
|
{
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
public class HvEngine : ICpuEngine
|
public class HvEngine : ICpuEngine
|
||||||
{
|
{
|
||||||
private readonly ITickSource _tickSource;
|
private readonly ITickSource _tickSource;
|
||||||
|
@@ -2,9 +2,12 @@ using ARMeilleure.State;
|
|||||||
using Ryujinx.Cpu.AppleHv.Arm;
|
using Ryujinx.Cpu.AppleHv.Arm;
|
||||||
using Ryujinx.Memory.Tracking;
|
using Ryujinx.Memory.Tracking;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace Ryujinx.Cpu.AppleHv
|
namespace Ryujinx.Cpu.AppleHv
|
||||||
{
|
{
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
class HvExecutionContext : IExecutionContext
|
class HvExecutionContext : IExecutionContext
|
||||||
{
|
{
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@@ -67,6 +70,8 @@ namespace Ryujinx.Cpu.AppleHv
|
|||||||
|
|
||||||
private readonly ExceptionCallbacks _exceptionCallbacks;
|
private readonly ExceptionCallbacks _exceptionCallbacks;
|
||||||
|
|
||||||
|
private int _interruptRequested;
|
||||||
|
|
||||||
public HvExecutionContext(ICounter counter, ExceptionCallbacks exceptionCallbacks)
|
public HvExecutionContext(ICounter counter, ExceptionCallbacks exceptionCallbacks)
|
||||||
{
|
{
|
||||||
_counter = counter;
|
_counter = counter;
|
||||||
@@ -111,7 +116,15 @@ namespace Ryujinx.Cpu.AppleHv
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public void RequestInterrupt()
|
public void RequestInterrupt()
|
||||||
{
|
{
|
||||||
_impl.RequestInterrupt();
|
if (Interlocked.Exchange(ref _interruptRequested, 1) == 0 && _impl is HvExecutionContextVcpu impl)
|
||||||
|
{
|
||||||
|
impl.RequestInterrupt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool GetAndClearInterruptRequested()
|
||||||
|
{
|
||||||
|
return Interlocked.Exchange(ref _interruptRequested, 0) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@@ -131,9 +144,9 @@ namespace Ryujinx.Cpu.AppleHv
|
|||||||
{
|
{
|
||||||
HvApi.hv_vcpu_run(vcpu.Handle).ThrowOnError();
|
HvApi.hv_vcpu_run(vcpu.Handle).ThrowOnError();
|
||||||
|
|
||||||
uint reason = vcpu.ExitInfo->Reason;
|
HvExitReason reason = vcpu.ExitInfo->Reason;
|
||||||
|
|
||||||
if (reason == 1)
|
if (reason == HvExitReason.Exception)
|
||||||
{
|
{
|
||||||
uint hvEsr = (uint)vcpu.ExitInfo->Exception.Syndrome;
|
uint hvEsr = (uint)vcpu.ExitInfo->Exception.Syndrome;
|
||||||
ExceptionClass hvEc = (ExceptionClass)(hvEsr >> 26);
|
ExceptionClass hvEc = (ExceptionClass)(hvEsr >> 26);
|
||||||
@@ -146,14 +159,22 @@ namespace Ryujinx.Cpu.AppleHv
|
|||||||
address = SynchronousException(memoryManager, ref vcpu);
|
address = SynchronousException(memoryManager, ref vcpu);
|
||||||
HvApi.hv_vcpu_set_reg(vcpu.Handle, HvReg.PC, address).ThrowOnError();
|
HvApi.hv_vcpu_set_reg(vcpu.Handle, HvReg.PC, address).ThrowOnError();
|
||||||
}
|
}
|
||||||
else if (reason == 0)
|
else if (reason == HvExitReason.Canceled || reason == HvExitReason.VTimerActivated)
|
||||||
{
|
{
|
||||||
if (_impl.GetAndClearInterruptRequested())
|
if (GetAndClearInterruptRequested())
|
||||||
{
|
{
|
||||||
ReturnToPool(vcpu);
|
ReturnToPool(vcpu);
|
||||||
InterruptHandler();
|
InterruptHandler();
|
||||||
vcpu = RentFromPool(memoryManager.AddressSpace, vcpu);
|
vcpu = RentFromPool(memoryManager.AddressSpace, vcpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (reason == HvExitReason.VTimerActivated)
|
||||||
|
{
|
||||||
|
vcpu.EnableAndUpdateVTimer();
|
||||||
|
|
||||||
|
// Unmask VTimer interrupts.
|
||||||
|
HvApi.hv_vcpu_set_vtimer_mask(vcpu.Handle, false).ThrowOnError();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -46,14 +46,5 @@ namespace Ryujinx.Cpu.AppleHv
|
|||||||
{
|
{
|
||||||
_v[index] = value;
|
_v[index] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RequestInterrupt()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool GetAndClearInterruptRequested()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,10 +2,11 @@ using ARMeilleure.State;
|
|||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
namespace Ryujinx.Cpu.AppleHv
|
namespace Ryujinx.Cpu.AppleHv
|
||||||
{
|
{
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
class HvExecutionContextVcpu : IHvExecutionContext
|
class HvExecutionContextVcpu : IHvExecutionContext
|
||||||
{
|
{
|
||||||
private static readonly MemoryBlock _setSimdFpRegFuncMem;
|
private static readonly MemoryBlock _setSimdFpRegFuncMem;
|
||||||
@@ -135,7 +136,6 @@ namespace Ryujinx.Cpu.AppleHv
|
|||||||
}
|
}
|
||||||
|
|
||||||
private readonly ulong _vcpu;
|
private readonly ulong _vcpu;
|
||||||
private int _interruptRequested;
|
|
||||||
|
|
||||||
public HvExecutionContextVcpu(ulong vcpu)
|
public HvExecutionContextVcpu(ulong vcpu)
|
||||||
{
|
{
|
||||||
@@ -180,17 +180,9 @@ namespace Ryujinx.Cpu.AppleHv
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void RequestInterrupt()
|
public void RequestInterrupt()
|
||||||
{
|
|
||||||
if (Interlocked.Exchange(ref _interruptRequested, 1) == 0)
|
|
||||||
{
|
{
|
||||||
ulong vcpu = _vcpu;
|
ulong vcpu = _vcpu;
|
||||||
HvApi.hv_vcpus_exit(ref vcpu, 1);
|
HvApi.hv_vcpus_exit(ref vcpu, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool GetAndClearInterruptRequested()
|
|
||||||
{
|
|
||||||
return Interlocked.Exchange(ref _interruptRequested, 0) != 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
namespace Ryujinx.Cpu.AppleHv
|
namespace Ryujinx.Cpu.AppleHv
|
||||||
{
|
{
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
readonly struct HvMemoryBlockAllocation : IDisposable
|
readonly struct HvMemoryBlockAllocation : IDisposable
|
||||||
{
|
{
|
||||||
private readonly HvMemoryBlockAllocator _owner;
|
private readonly HvMemoryBlockAllocator _owner;
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
namespace Ryujinx.Cpu.AppleHv
|
namespace Ryujinx.Cpu.AppleHv
|
||||||
{
|
{
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
class HvMemoryBlockAllocator : PrivateMemoryAllocatorImpl<HvMemoryBlockAllocator.Block>
|
class HvMemoryBlockAllocator : PrivateMemoryAllocatorImpl<HvMemoryBlockAllocator.Block>
|
||||||
{
|
{
|
||||||
public class Block : PrivateMemoryAllocator.Block
|
public class Block : PrivateMemoryAllocator.Block
|
||||||
|
@@ -7,6 +7,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace Ryujinx.Cpu.AppleHv
|
namespace Ryujinx.Cpu.AppleHv
|
||||||
@@ -14,6 +15,7 @@ namespace Ryujinx.Cpu.AppleHv
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a CPU memory manager which maps guest virtual memory directly onto the Hypervisor page table.
|
/// Represents a CPU memory manager which maps guest virtual memory directly onto the Hypervisor page table.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
public class HvMemoryManager : MemoryManagerBase, IMemoryManager, IVirtualMemoryManagerTracked, IWritableBlock
|
public class HvMemoryManager : MemoryManagerBase, IMemoryManager, IVirtualMemoryManagerTracked, IWritableBlock
|
||||||
{
|
{
|
||||||
public const int PageBits = 12;
|
public const int PageBits = 12;
|
||||||
@@ -126,21 +128,6 @@ namespace Ryujinx.Cpu.AppleHv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable IDE0051 // Remove unused private member
|
|
||||||
/// <summary>
|
|
||||||
/// Ensures the combination of virtual address and size is part of the addressable space and fully mapped.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="va">Virtual address of the range</param>
|
|
||||||
/// <param name="size">Size of the range in bytes</param>
|
|
||||||
private void AssertMapped(ulong va, ulong size)
|
|
||||||
{
|
|
||||||
if (!ValidateAddressAndSize(va, size) || !IsRangeMappedImpl(va, size))
|
|
||||||
{
|
|
||||||
throw new InvalidMemoryRegionException($"Not mapped: va=0x{va:X16}, size=0x{size:X16}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#pragma warning restore IDE0051
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public void Map(ulong va, ulong pa, ulong size, MemoryMapFlags flags)
|
public void Map(ulong va, ulong pa, ulong size, MemoryMapFlags flags)
|
||||||
{
|
{
|
||||||
@@ -734,6 +721,24 @@ namespace Ryujinx.Cpu.AppleHv
|
|||||||
return (int)(vaSpan / PageSize);
|
return (int)(vaSpan / PageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public void Reprotect(ulong va, ulong size, MemoryPermission protection)
|
||||||
|
{
|
||||||
|
if (protection.HasFlag(MemoryPermission.Execute))
|
||||||
|
{
|
||||||
|
// Some applications use unordered exclusive memory access instructions
|
||||||
|
// where it is not valid to do so, leading to memory re-ordering that
|
||||||
|
// makes the code behave incorrectly on some CPUs.
|
||||||
|
// To work around this, we force all such accesses to be ordered.
|
||||||
|
|
||||||
|
using WritableRegion writableRegion = GetWritableRegion(va, (int)size);
|
||||||
|
|
||||||
|
HvCodePatcher.RewriteUnorderedExclusiveInstructions(writableRegion.Memory.Span);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public void TrackingReprotect(ulong va, ulong size, MemoryPermission protection)
|
public void TrackingReprotect(ulong va, ulong size, MemoryPermission protection)
|
||||||
{
|
{
|
||||||
|
@@ -1,7 +1,15 @@
|
|||||||
|
using System.Diagnostics;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
namespace Ryujinx.Cpu.AppleHv
|
namespace Ryujinx.Cpu.AppleHv
|
||||||
{
|
{
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
unsafe class HvVcpu
|
unsafe class HvVcpu
|
||||||
{
|
{
|
||||||
|
private const ulong InterruptIntervalNs = 16 * 1000000; // 16 ms
|
||||||
|
|
||||||
|
private static ulong _interruptTimeDeltaTicks = 0;
|
||||||
|
|
||||||
public readonly ulong Handle;
|
public readonly ulong Handle;
|
||||||
public readonly HvVcpuExit* ExitInfo;
|
public readonly HvVcpuExit* ExitInfo;
|
||||||
public readonly IHvExecutionContext ShadowContext;
|
public readonly IHvExecutionContext ShadowContext;
|
||||||
@@ -21,5 +29,28 @@ namespace Ryujinx.Cpu.AppleHv
|
|||||||
NativeContext = nativeContext;
|
NativeContext = nativeContext;
|
||||||
IsEphemeral = isEphemeral;
|
IsEphemeral = isEphemeral;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void EnableAndUpdateVTimer()
|
||||||
|
{
|
||||||
|
// We need to ensure interrupts will be serviced,
|
||||||
|
// and for that we set up the VTime to trigger an interrupt at fixed intervals.
|
||||||
|
|
||||||
|
ulong deltaTicks = _interruptTimeDeltaTicks;
|
||||||
|
|
||||||
|
if (deltaTicks == 0)
|
||||||
|
{
|
||||||
|
// Calculate our time delta in ticks based on the current clock frequency.
|
||||||
|
|
||||||
|
int result = TimeApi.mach_timebase_info(out var timeBaseInfo);
|
||||||
|
|
||||||
|
Debug.Assert(result == 0);
|
||||||
|
|
||||||
|
deltaTicks = ((InterruptIntervalNs * timeBaseInfo.Denom) + (timeBaseInfo.Numer - 1)) / timeBaseInfo.Numer;
|
||||||
|
_interruptTimeDeltaTicks = deltaTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
HvApi.hv_vcpu_set_sys_reg(Handle, HvSysReg.CNTV_CTL_EL0, 1).ThrowOnError();
|
||||||
|
HvApi.hv_vcpu_set_sys_reg(Handle, HvSysReg.CNTV_CVAL_EL0, TimeApi.mach_absolute_time() + deltaTicks).ThrowOnError();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace Ryujinx.Cpu.AppleHv
|
namespace Ryujinx.Cpu.AppleHv
|
||||||
{
|
{
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
class HvVcpuPool
|
class HvVcpuPool
|
||||||
{
|
{
|
||||||
// Since there's a limit on the number of VCPUs we can create,
|
// Since there's a limit on the number of VCPUs we can create,
|
||||||
@@ -81,6 +83,8 @@ namespace Ryujinx.Cpu.AppleHv
|
|||||||
|
|
||||||
HvVcpu vcpu = new(vcpuHandle, exitInfo, shadowContext, nativeContext, isEphemeral);
|
HvVcpu vcpu = new(vcpuHandle, exitInfo, shadowContext, nativeContext, isEphemeral);
|
||||||
|
|
||||||
|
vcpu.EnableAndUpdateVTimer();
|
||||||
|
|
||||||
return vcpu;
|
return vcpu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
namespace Ryujinx.Cpu.AppleHv
|
namespace Ryujinx.Cpu.AppleHv
|
||||||
{
|
{
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
static class HvVm
|
static class HvVm
|
||||||
{
|
{
|
||||||
// This alignment allows us to use larger blocks on the page table.
|
// This alignment allows us to use larger blocks on the page table.
|
||||||
|
@@ -2,7 +2,7 @@ using ARMeilleure.State;
|
|||||||
|
|
||||||
namespace Ryujinx.Cpu.AppleHv
|
namespace Ryujinx.Cpu.AppleHv
|
||||||
{
|
{
|
||||||
public interface IHvExecutionContext
|
interface IHvExecutionContext
|
||||||
{
|
{
|
||||||
ulong Pc { get; set; }
|
ulong Pc { get; set; }
|
||||||
ulong ElrEl1 { get; set; }
|
ulong ElrEl1 { get; set; }
|
||||||
@@ -39,8 +39,5 @@ namespace Ryujinx.Cpu.AppleHv
|
|||||||
SetV(i, context.GetV(i));
|
SetV(i, context.GetV(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RequestInterrupt();
|
|
||||||
bool GetAndClearInterruptRequested();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
21
src/Ryujinx.Cpu/AppleHv/TimeApi.cs
Normal file
21
src/Ryujinx.Cpu/AppleHv/TimeApi.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
|
namespace Ryujinx.Cpu.AppleHv
|
||||||
|
{
|
||||||
|
struct MachTimebaseInfo
|
||||||
|
{
|
||||||
|
public uint Numer;
|
||||||
|
public uint Denom;
|
||||||
|
}
|
||||||
|
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
static partial class TimeApi
|
||||||
|
{
|
||||||
|
[LibraryImport("libc", SetLastError = true)]
|
||||||
|
public static partial ulong mach_absolute_time();
|
||||||
|
|
||||||
|
[LibraryImport("libc", SetLastError = true)]
|
||||||
|
public static partial int mach_timebase_info(out MachTimebaseInfo info);
|
||||||
|
}
|
||||||
|
}
|
@@ -575,24 +575,17 @@ namespace Ryujinx.Cpu.Jit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable IDE0051 // Remove unused private member
|
|
||||||
private ulong GetPhysicalAddress(ulong va)
|
|
||||||
{
|
|
||||||
// We return -1L if the virtual address is invalid or unmapped.
|
|
||||||
if (!ValidateAddress(va) || !IsMapped(va))
|
|
||||||
{
|
|
||||||
return ulong.MaxValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
return GetPhysicalAddressInternal(va);
|
|
||||||
}
|
|
||||||
#pragma warning restore IDE0051
|
|
||||||
|
|
||||||
private ulong GetPhysicalAddressInternal(ulong va)
|
private ulong GetPhysicalAddressInternal(ulong va)
|
||||||
{
|
{
|
||||||
return PteToPa(_pageTable.Read<ulong>((va / PageSize) * PteSize) & ~(0xffffUL << 48)) + (va & PageMask);
|
return PteToPa(_pageTable.Read<ulong>((va / PageSize) * PteSize) & ~(0xffffUL << 48)) + (va & PageMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public void Reprotect(ulong va, ulong size, MemoryPermission protection)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public void TrackingReprotect(ulong va, ulong size, MemoryPermission protection)
|
public void TrackingReprotect(ulong va, ulong size, MemoryPermission protection)
|
||||||
{
|
{
|
||||||
@@ -698,9 +691,5 @@ namespace Ryujinx.Cpu.Jit
|
|||||||
/// Disposes of resources used by the memory manager.
|
/// Disposes of resources used by the memory manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void Destroy() => _pageTable.Dispose();
|
protected override void Destroy() => _pageTable.Dispose();
|
||||||
|
|
||||||
#pragma warning disable IDE0051 // Remove unused private member
|
|
||||||
private static void ThrowInvalidMemoryRegionException(string message) => throw new InvalidMemoryRegionException(message);
|
|
||||||
#pragma warning restore IDE0051
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -615,6 +615,12 @@ namespace Ryujinx.Cpu.Jit
|
|||||||
return (int)(vaSpan / PageSize);
|
return (int)(vaSpan / PageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public void Reprotect(ulong va, ulong size, MemoryPermission protection)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public void TrackingReprotect(ulong va, ulong size, MemoryPermission protection)
|
public void TrackingReprotect(ulong va, ulong size, MemoryPermission protection)
|
||||||
{
|
{
|
||||||
|
@@ -38,6 +38,7 @@ namespace Ryujinx.Graphics.GAL
|
|||||||
public readonly bool SupportsShaderBallot;
|
public readonly bool SupportsShaderBallot;
|
||||||
public readonly bool SupportsShaderBarrierDivergence;
|
public readonly bool SupportsShaderBarrierDivergence;
|
||||||
public readonly bool SupportsShaderFloat64;
|
public readonly bool SupportsShaderFloat64;
|
||||||
|
public readonly bool SupportsTextureGatherOffsets;
|
||||||
public readonly bool SupportsTextureShadowLod;
|
public readonly bool SupportsTextureShadowLod;
|
||||||
public readonly bool SupportsVertexStoreAndAtomics;
|
public readonly bool SupportsVertexStoreAndAtomics;
|
||||||
public readonly bool SupportsViewportIndexVertexTessellation;
|
public readonly bool SupportsViewportIndexVertexTessellation;
|
||||||
@@ -92,6 +93,7 @@ namespace Ryujinx.Graphics.GAL
|
|||||||
bool supportsShaderBallot,
|
bool supportsShaderBallot,
|
||||||
bool supportsShaderBarrierDivergence,
|
bool supportsShaderBarrierDivergence,
|
||||||
bool supportsShaderFloat64,
|
bool supportsShaderFloat64,
|
||||||
|
bool supportsTextureGatherOffsets,
|
||||||
bool supportsTextureShadowLod,
|
bool supportsTextureShadowLod,
|
||||||
bool supportsVertexStoreAndAtomics,
|
bool supportsVertexStoreAndAtomics,
|
||||||
bool supportsViewportIndexVertexTessellation,
|
bool supportsViewportIndexVertexTessellation,
|
||||||
@@ -142,6 +144,7 @@ namespace Ryujinx.Graphics.GAL
|
|||||||
SupportsShaderBallot = supportsShaderBallot;
|
SupportsShaderBallot = supportsShaderBallot;
|
||||||
SupportsShaderBarrierDivergence = supportsShaderBarrierDivergence;
|
SupportsShaderBarrierDivergence = supportsShaderBarrierDivergence;
|
||||||
SupportsShaderFloat64 = supportsShaderFloat64;
|
SupportsShaderFloat64 = supportsShaderFloat64;
|
||||||
|
SupportsTextureGatherOffsets = supportsTextureGatherOffsets;
|
||||||
SupportsTextureShadowLod = supportsTextureShadowLod;
|
SupportsTextureShadowLod = supportsTextureShadowLod;
|
||||||
SupportsVertexStoreAndAtomics = supportsVertexStoreAndAtomics;
|
SupportsVertexStoreAndAtomics = supportsVertexStoreAndAtomics;
|
||||||
SupportsViewportIndexVertexTessellation = supportsViewportIndexVertexTessellation;
|
SupportsViewportIndexVertexTessellation = supportsViewportIndexVertexTessellation;
|
||||||
|
@@ -335,6 +335,45 @@ namespace Ryujinx.Graphics.GAL
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if the texture format is a depth or depth-stencil format.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="format">Texture format</param>
|
||||||
|
/// <returns>True if the format is a depth or depth-stencil format, false otherwise</returns>
|
||||||
|
public static bool HasDepth(this Format format)
|
||||||
|
{
|
||||||
|
switch (format)
|
||||||
|
{
|
||||||
|
case Format.D16Unorm:
|
||||||
|
case Format.D24UnormS8Uint:
|
||||||
|
case Format.S8UintD24Unorm:
|
||||||
|
case Format.D32Float:
|
||||||
|
case Format.D32FloatS8Uint:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if the texture format is a stencil or depth-stencil format.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="format">Texture format</param>
|
||||||
|
/// <returns>True if the format is a stencil or depth-stencil format, false otherwise</returns>
|
||||||
|
public static bool HasStencil(this Format format)
|
||||||
|
{
|
||||||
|
switch (format)
|
||||||
|
{
|
||||||
|
case Format.D24UnormS8Uint:
|
||||||
|
case Format.S8UintD24Unorm:
|
||||||
|
case Format.D32FloatS8Uint:
|
||||||
|
case Format.S8Uint:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if the texture format is valid to use as image format.
|
/// Checks if the texture format is valid to use as image format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -32,6 +32,11 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ref TState State => ref _state.State;
|
public ref TState State => ref _state.State;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Current shadow state.
|
||||||
|
/// </summary>
|
||||||
|
public ref TState ShadowState => ref _shadowState.State;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new instance of the device state, with shadow state.
|
/// Creates a new instance of the device state, with shadow state.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -1,7 +1,10 @@
|
|||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
|
using Ryujinx.Common.Memory;
|
||||||
using Ryujinx.Graphics.Device;
|
using Ryujinx.Graphics.Device;
|
||||||
using Ryujinx.Graphics.GAL;
|
using Ryujinx.Graphics.GAL;
|
||||||
using Ryujinx.Graphics.Gpu.Engine.GPFifo;
|
using Ryujinx.Graphics.Gpu.Engine.GPFifo;
|
||||||
|
using Ryujinx.Graphics.Gpu.Engine.Threed;
|
||||||
|
using Ryujinx.Graphics.Gpu.Engine.Types;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
@@ -15,9 +18,18 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
|||||||
private const int ColorLayerCountOffset = 0x818;
|
private const int ColorLayerCountOffset = 0x818;
|
||||||
private const int ColorStructSize = 0x40;
|
private const int ColorStructSize = 0x40;
|
||||||
private const int ZetaLayerCountOffset = 0x1230;
|
private const int ZetaLayerCountOffset = 0x1230;
|
||||||
|
private const int UniformBufferBindVertexOffset = 0x2410;
|
||||||
|
private const int FirstVertexOffset = 0x1434;
|
||||||
|
|
||||||
private const int IndirectIndexedDataEntrySize = 0x14;
|
private const int IndirectIndexedDataEntrySize = 0x14;
|
||||||
|
|
||||||
|
private const int LogicOpOffset = 0x19c4;
|
||||||
|
private const int ShaderIdScratchOffset = 0x3470;
|
||||||
|
private const int ShaderAddressScratchOffset = 0x3488;
|
||||||
|
private const int UpdateConstantBufferAddressesBase = 0x34a8;
|
||||||
|
private const int UpdateConstantBufferSizesBase = 0x34bc;
|
||||||
|
private const int UpdateConstantBufferAddressCbu = 0x3460;
|
||||||
|
|
||||||
private readonly GPFifoProcessor _processor;
|
private readonly GPFifoProcessor _processor;
|
||||||
private readonly MacroHLEFunctionName _functionName;
|
private readonly MacroHLEFunctionName _functionName;
|
||||||
|
|
||||||
@@ -49,6 +61,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
|||||||
{
|
{
|
||||||
switch (_functionName)
|
switch (_functionName)
|
||||||
{
|
{
|
||||||
|
case MacroHLEFunctionName.BindShaderProgram:
|
||||||
|
BindShaderProgram(state, arg0);
|
||||||
|
break;
|
||||||
case MacroHLEFunctionName.ClearColor:
|
case MacroHLEFunctionName.ClearColor:
|
||||||
ClearColor(state, arg0);
|
ClearColor(state, arg0);
|
||||||
break;
|
break;
|
||||||
@@ -58,6 +73,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
|||||||
case MacroHLEFunctionName.DrawArraysInstanced:
|
case MacroHLEFunctionName.DrawArraysInstanced:
|
||||||
DrawArraysInstanced(state, arg0);
|
DrawArraysInstanced(state, arg0);
|
||||||
break;
|
break;
|
||||||
|
case MacroHLEFunctionName.DrawElements:
|
||||||
|
DrawElements(state, arg0);
|
||||||
|
break;
|
||||||
case MacroHLEFunctionName.DrawElementsInstanced:
|
case MacroHLEFunctionName.DrawElementsInstanced:
|
||||||
DrawElementsInstanced(state, arg0);
|
DrawElementsInstanced(state, arg0);
|
||||||
break;
|
break;
|
||||||
@@ -67,6 +85,21 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
|||||||
case MacroHLEFunctionName.MultiDrawElementsIndirectCount:
|
case MacroHLEFunctionName.MultiDrawElementsIndirectCount:
|
||||||
MultiDrawElementsIndirectCount(state, arg0);
|
MultiDrawElementsIndirectCount(state, arg0);
|
||||||
break;
|
break;
|
||||||
|
case MacroHLEFunctionName.UpdateBlendState:
|
||||||
|
UpdateBlendState(state, arg0);
|
||||||
|
break;
|
||||||
|
case MacroHLEFunctionName.UpdateColorMasks:
|
||||||
|
UpdateColorMasks(state, arg0);
|
||||||
|
break;
|
||||||
|
case MacroHLEFunctionName.UpdateUniformBufferState:
|
||||||
|
UpdateUniformBufferState(state, arg0);
|
||||||
|
break;
|
||||||
|
case MacroHLEFunctionName.UpdateUniformBufferStateCbu:
|
||||||
|
UpdateUniformBufferStateCbu(state, arg0);
|
||||||
|
break;
|
||||||
|
case MacroHLEFunctionName.UpdateUniformBufferStateCbuV2:
|
||||||
|
UpdateUniformBufferStateCbuV2(state, arg0);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new NotImplementedException(_functionName.ToString());
|
throw new NotImplementedException(_functionName.ToString());
|
||||||
}
|
}
|
||||||
@@ -75,6 +108,149 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
|||||||
Fifo.Clear();
|
Fifo.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Binds a shader program with the index in arg0.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="state">GPU state at the time of the call</param>
|
||||||
|
/// <param name="arg0">First argument of the call</param>
|
||||||
|
private void BindShaderProgram(IDeviceState state, int arg0)
|
||||||
|
{
|
||||||
|
int scratchOffset = ShaderIdScratchOffset + arg0 * 4;
|
||||||
|
|
||||||
|
int lastId = state.Read(scratchOffset);
|
||||||
|
int id = FetchParam().Word;
|
||||||
|
int offset = FetchParam().Word;
|
||||||
|
|
||||||
|
if (lastId == id)
|
||||||
|
{
|
||||||
|
FetchParam();
|
||||||
|
FetchParam();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_processor.ThreedClass.SetShaderOffset(arg0, (uint)offset);
|
||||||
|
|
||||||
|
// Removes overflow on the method address into the increment portion.
|
||||||
|
// Present in the original macro.
|
||||||
|
int addrMask = unchecked((int)0xfffc0fff) << 2;
|
||||||
|
|
||||||
|
state.Write(scratchOffset & addrMask, id);
|
||||||
|
state.Write((ShaderAddressScratchOffset + arg0 * 4) & addrMask, offset);
|
||||||
|
|
||||||
|
int stage = FetchParam().Word;
|
||||||
|
uint cbAddress = (uint)FetchParam().Word;
|
||||||
|
|
||||||
|
_processor.ThreedClass.UpdateUniformBufferState(65536, cbAddress >> 24, cbAddress << 8);
|
||||||
|
|
||||||
|
int stageOffset = (stage & 0x7f) << 3;
|
||||||
|
|
||||||
|
state.Write((UniformBufferBindVertexOffset + stageOffset * 4) & addrMask, 17);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates uniform buffer state for update or bind.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="state">GPU state at the time of the call</param>
|
||||||
|
/// <param name="arg0">First argument of the call</param>
|
||||||
|
private void UpdateUniformBufferState(IDeviceState state, int arg0)
|
||||||
|
{
|
||||||
|
uint address = (uint)state.Read(UpdateConstantBufferAddressesBase + arg0 * 4);
|
||||||
|
int size = state.Read(UpdateConstantBufferSizesBase + arg0 * 4);
|
||||||
|
|
||||||
|
_processor.ThreedClass.UpdateUniformBufferState(size, address >> 24, address << 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates uniform buffer state for update.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="state">GPU state at the time of the call</param>
|
||||||
|
/// <param name="arg0">First argument of the call</param>
|
||||||
|
private void UpdateUniformBufferStateCbu(IDeviceState state, int arg0)
|
||||||
|
{
|
||||||
|
uint address = (uint)state.Read(UpdateConstantBufferAddressCbu);
|
||||||
|
|
||||||
|
UniformBufferState ubState = new()
|
||||||
|
{
|
||||||
|
Address = new()
|
||||||
|
{
|
||||||
|
High = address >> 24,
|
||||||
|
Low = address << 8
|
||||||
|
},
|
||||||
|
Size = 24320,
|
||||||
|
Offset = arg0 << 2
|
||||||
|
};
|
||||||
|
|
||||||
|
_processor.ThreedClass.UpdateUniformBufferState(ubState);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates uniform buffer state for update.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="state">GPU state at the time of the call</param>
|
||||||
|
/// <param name="arg0">First argument of the call</param>
|
||||||
|
private void UpdateUniformBufferStateCbuV2(IDeviceState state, int arg0)
|
||||||
|
{
|
||||||
|
uint address = (uint)state.Read(UpdateConstantBufferAddressCbu);
|
||||||
|
|
||||||
|
UniformBufferState ubState = new()
|
||||||
|
{
|
||||||
|
Address = new()
|
||||||
|
{
|
||||||
|
High = address >> 24,
|
||||||
|
Low = address << 8
|
||||||
|
},
|
||||||
|
Size = 28672,
|
||||||
|
Offset = arg0 << 2
|
||||||
|
};
|
||||||
|
|
||||||
|
_processor.ThreedClass.UpdateUniformBufferState(ubState);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates blend enable using the given argument.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="state">GPU state at the time of the call</param>
|
||||||
|
/// <param name="arg0">First argument of the call</param>
|
||||||
|
private void UpdateBlendState(IDeviceState state, int arg0)
|
||||||
|
{
|
||||||
|
state.Write(LogicOpOffset, 0);
|
||||||
|
|
||||||
|
Array8<Boolean32> enable = new();
|
||||||
|
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
enable[i] = new Boolean32((uint)(arg0 >> (i + 8)) & 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
_processor.ThreedClass.UpdateBlendEnable(ref enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates color masks using the given argument and three pushed arguments.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="state">GPU state at the time of the call</param>
|
||||||
|
/// <param name="arg0">First argument of the call</param>
|
||||||
|
private void UpdateColorMasks(IDeviceState state, int arg0)
|
||||||
|
{
|
||||||
|
Array8<RtColorMask> masks = new();
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
masks[index++] = new RtColorMask((uint)arg0 & 0x1fff);
|
||||||
|
masks[index++] = new RtColorMask(((uint)arg0 >> 16) & 0x1fff);
|
||||||
|
|
||||||
|
if (i != 3)
|
||||||
|
{
|
||||||
|
arg0 = FetchParam().Word;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_processor.ThreedClass.UpdateColorMasks(ref masks);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clears one bound color target.
|
/// Clears one bound color target.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -129,6 +305,36 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
|||||||
indexed: false);
|
indexed: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Performs a indexed draw.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="state">GPU state at the time of the call</param>
|
||||||
|
/// <param name="arg0">First argument of the call</param>
|
||||||
|
private void DrawElements(IDeviceState state, int arg0)
|
||||||
|
{
|
||||||
|
var topology = (PrimitiveTopology)arg0;
|
||||||
|
|
||||||
|
var indexAddressHigh = FetchParam();
|
||||||
|
var indexAddressLow = FetchParam();
|
||||||
|
var indexType = FetchParam();
|
||||||
|
var firstIndex = 0;
|
||||||
|
var indexCount = FetchParam();
|
||||||
|
|
||||||
|
_processor.ThreedClass.UpdateIndexBuffer(
|
||||||
|
(uint)indexAddressHigh.Word,
|
||||||
|
(uint)indexAddressLow.Word,
|
||||||
|
(IndexType)indexType.Word);
|
||||||
|
|
||||||
|
_processor.ThreedClass.Draw(
|
||||||
|
topology,
|
||||||
|
indexCount.Word,
|
||||||
|
1,
|
||||||
|
firstIndex,
|
||||||
|
state.Read(FirstVertexOffset),
|
||||||
|
0,
|
||||||
|
indexed: true);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs a indexed draw.
|
/// Performs a indexed draw.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -6,11 +6,19 @@
|
|||||||
enum MacroHLEFunctionName
|
enum MacroHLEFunctionName
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
|
BindShaderProgram,
|
||||||
ClearColor,
|
ClearColor,
|
||||||
ClearDepthStencil,
|
ClearDepthStencil,
|
||||||
DrawArraysInstanced,
|
DrawArraysInstanced,
|
||||||
|
DrawElements,
|
||||||
DrawElementsInstanced,
|
DrawElementsInstanced,
|
||||||
DrawElementsIndirect,
|
DrawElementsIndirect,
|
||||||
MultiDrawElementsIndirectCount,
|
MultiDrawElementsIndirectCount,
|
||||||
|
|
||||||
|
UpdateBlendState,
|
||||||
|
UpdateColorMasks,
|
||||||
|
UpdateUniformBufferState,
|
||||||
|
UpdateUniformBufferStateCbu,
|
||||||
|
UpdateUniformBufferStateCbuV2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -46,12 +46,19 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
|||||||
|
|
||||||
private static readonly TableEntry[] _table = new TableEntry[]
|
private static readonly TableEntry[] _table = new TableEntry[]
|
||||||
{
|
{
|
||||||
|
new(MacroHLEFunctionName.BindShaderProgram, new Hash128(0x5d5efb912369f60b, 0x69131ed5019f08ef), 0x68),
|
||||||
new(MacroHLEFunctionName.ClearColor, new Hash128(0xA9FB28D1DC43645A, 0xB177E5D2EAE67FB0), 0x28),
|
new(MacroHLEFunctionName.ClearColor, new Hash128(0xA9FB28D1DC43645A, 0xB177E5D2EAE67FB0), 0x28),
|
||||||
new(MacroHLEFunctionName.ClearDepthStencil, new Hash128(0x1B96CB77D4879F4F, 0x8557032FE0C965FB), 0x24),
|
new(MacroHLEFunctionName.ClearDepthStencil, new Hash128(0x1B96CB77D4879F4F, 0x8557032FE0C965FB), 0x24),
|
||||||
new(MacroHLEFunctionName.DrawArraysInstanced, new Hash128(0x197FB416269DBC26, 0x34288C01DDA82202), 0x48),
|
new(MacroHLEFunctionName.DrawArraysInstanced, new Hash128(0x197FB416269DBC26, 0x34288C01DDA82202), 0x48),
|
||||||
|
new(MacroHLEFunctionName.DrawElements, new Hash128(0x3D7F32AE6C2702A7, 0x9353C9F41C1A244D), 0x20),
|
||||||
new(MacroHLEFunctionName.DrawElementsInstanced, new Hash128(0x1A501FD3D54EC8E0, 0x6CF570CF79DA74D6), 0x5c),
|
new(MacroHLEFunctionName.DrawElementsInstanced, new Hash128(0x1A501FD3D54EC8E0, 0x6CF570CF79DA74D6), 0x5c),
|
||||||
new(MacroHLEFunctionName.DrawElementsIndirect, new Hash128(0x86A3E8E903AF8F45, 0xD35BBA07C23860A4), 0x7c),
|
new(MacroHLEFunctionName.DrawElementsIndirect, new Hash128(0x86A3E8E903AF8F45, 0xD35BBA07C23860A4), 0x7c),
|
||||||
new(MacroHLEFunctionName.MultiDrawElementsIndirectCount, new Hash128(0x890AF57ED3FB1C37, 0x35D0C95C61F5386F), 0x19C),
|
new(MacroHLEFunctionName.MultiDrawElementsIndirectCount, new Hash128(0x890AF57ED3FB1C37, 0x35D0C95C61F5386F), 0x19C),
|
||||||
|
new(MacroHLEFunctionName.UpdateBlendState, new Hash128(0x40F6D4E7B08D7640, 0x82167BEEAECB959F), 0x28),
|
||||||
|
new(MacroHLEFunctionName.UpdateColorMasks, new Hash128(0x9EE32420B8441DFD, 0x6E7724759A57333E), 0x24),
|
||||||
|
new(MacroHLEFunctionName.UpdateUniformBufferState, new Hash128(0x8EE66706049CB0B0, 0x51C1CF906EC86F7C), 0x20),
|
||||||
|
new(MacroHLEFunctionName.UpdateUniformBufferStateCbu, new Hash128(0xA4592676A3E581A0, 0xA39E77FE19FE04AC), 0x18),
|
||||||
|
new(MacroHLEFunctionName.UpdateUniformBufferStateCbuV2, new Hash128(0x392FA750489983D4, 0x35BACE455155D2C3), 0x18)
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -62,18 +69,14 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
|||||||
/// <returns>True if the host supports the HLE macro, false otherwise</returns>
|
/// <returns>True if the host supports the HLE macro, false otherwise</returns>
|
||||||
private static bool IsMacroHLESupported(Capabilities caps, MacroHLEFunctionName name)
|
private static bool IsMacroHLESupported(Capabilities caps, MacroHLEFunctionName name)
|
||||||
{
|
{
|
||||||
if (name == MacroHLEFunctionName.ClearColor ||
|
if (name == MacroHLEFunctionName.MultiDrawElementsIndirectCount)
|
||||||
name == MacroHLEFunctionName.ClearDepthStencil ||
|
|
||||||
name == MacroHLEFunctionName.DrawArraysInstanced ||
|
|
||||||
name == MacroHLEFunctionName.DrawElementsInstanced ||
|
|
||||||
name == MacroHLEFunctionName.DrawElementsIndirect)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (name == MacroHLEFunctionName.MultiDrawElementsIndirectCount)
|
|
||||||
{
|
{
|
||||||
return caps.SupportsIndirectParameters;
|
return caps.SupportsIndirectParameters;
|
||||||
}
|
}
|
||||||
|
else if (name != MacroHLEFunctionName.None)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -10,4 +10,22 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
|||||||
MethodPassthrough = 2,
|
MethodPassthrough = 2,
|
||||||
MethodReplay = 3,
|
MethodReplay = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static class SetMmeShadowRamControlModeExtensions
|
||||||
|
{
|
||||||
|
public static bool IsTrack(this SetMmeShadowRamControlMode mode)
|
||||||
|
{
|
||||||
|
return mode == SetMmeShadowRamControlMode.MethodTrack || mode == SetMmeShadowRamControlMode.MethodTrackWithFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsPassthrough(this SetMmeShadowRamControlMode mode)
|
||||||
|
{
|
||||||
|
return mode == SetMmeShadowRamControlMode.MethodPassthrough;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsReplay(this SetMmeShadowRamControlMode mode)
|
||||||
|
{
|
||||||
|
return mode == SetMmeShadowRamControlMode.MethodReplay;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
using Ryujinx.Graphics.GAL;
|
using Ryujinx.Graphics.GAL;
|
||||||
using Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw;
|
using Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw;
|
||||||
using Ryujinx.Graphics.Gpu.Engine.Types;
|
using Ryujinx.Graphics.Gpu.Engine.Types;
|
||||||
|
using Ryujinx.Graphics.Gpu.Image;
|
||||||
using Ryujinx.Graphics.Gpu.Memory;
|
using Ryujinx.Graphics.Gpu.Memory;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
@@ -806,25 +807,69 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||||||
updateFlags |= RenderTargetUpdateFlags.Layered;
|
updateFlags |= RenderTargetUpdateFlags.Layered;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clearDepth || clearStencil)
|
bool clearDS = clearDepth || clearStencil;
|
||||||
|
|
||||||
|
if (clearDS)
|
||||||
{
|
{
|
||||||
updateFlags |= RenderTargetUpdateFlags.UpdateDepthStencil;
|
updateFlags |= RenderTargetUpdateFlags.UpdateDepthStencil;
|
||||||
}
|
}
|
||||||
|
|
||||||
engine.UpdateRenderTargetState(updateFlags, singleUse: componentMask != 0 ? index : -1);
|
|
||||||
|
|
||||||
// If there is a mismatch on the host clip region and the one explicitly defined by the guest
|
// If there is a mismatch on the host clip region and the one explicitly defined by the guest
|
||||||
// on the screen scissor state, then we need to force only one texture to be bound to avoid
|
// on the screen scissor state, then we need to force only one texture to be bound to avoid
|
||||||
// host clipping.
|
// host clipping.
|
||||||
var screenScissorState = _state.State.ScreenScissorState;
|
var screenScissorState = _state.State.ScreenScissorState;
|
||||||
|
|
||||||
|
bool clearAffectedByStencilMask = (_state.State.ClearFlags & 1) != 0;
|
||||||
|
bool clearAffectedByScissor = (_state.State.ClearFlags & 0x100) != 0;
|
||||||
|
|
||||||
|
if (clearDS || componentMask == 15)
|
||||||
|
{
|
||||||
|
// A full clear if scissor is disabled, or it matches the screen scissor state.
|
||||||
|
|
||||||
|
bool fullClear = screenScissorState.X == 0 && screenScissorState.Y == 0;
|
||||||
|
|
||||||
|
if (fullClear && clearAffectedByScissor && _state.State.ScissorState[0].Enable)
|
||||||
|
{
|
||||||
|
ref var scissorState = ref _state.State.ScissorState[0];
|
||||||
|
|
||||||
|
fullClear = scissorState.X1 == screenScissorState.X &&
|
||||||
|
scissorState.Y1 == screenScissorState.Y &&
|
||||||
|
scissorState.X2 >= screenScissorState.X + screenScissorState.Width &&
|
||||||
|
scissorState.Y2 >= screenScissorState.Y + screenScissorState.Height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fullClear && clearDS)
|
||||||
|
{
|
||||||
|
// Must clear all aspects of the depth-stencil format.
|
||||||
|
|
||||||
|
FormatInfo dsFormat = _state.State.RtDepthStencilState.Format.Convert();
|
||||||
|
|
||||||
|
bool hasDepth = dsFormat.Format.HasDepth();
|
||||||
|
bool hasStencil = dsFormat.Format.HasStencil();
|
||||||
|
|
||||||
|
if (hasStencil && (!clearStencil || (clearAffectedByStencilMask && _state.State.StencilTestState.FrontMask != 0xff)))
|
||||||
|
{
|
||||||
|
fullClear = false;
|
||||||
|
}
|
||||||
|
else if (hasDepth && !clearDepth)
|
||||||
|
{
|
||||||
|
fullClear = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fullClear)
|
||||||
|
{
|
||||||
|
updateFlags |= RenderTargetUpdateFlags.DiscardClip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
engine.UpdateRenderTargetState(updateFlags, singleUse: componentMask != 0 ? index : -1);
|
||||||
|
|
||||||
// Must happen after UpdateRenderTargetState to have up-to-date clip region values.
|
// Must happen after UpdateRenderTargetState to have up-to-date clip region values.
|
||||||
bool clipMismatch = (screenScissorState.X | screenScissorState.Y) != 0 ||
|
bool clipMismatch = (screenScissorState.X | screenScissorState.Y) != 0 ||
|
||||||
screenScissorState.Width != _channel.TextureManager.ClipRegionWidth ||
|
screenScissorState.Width != _channel.TextureManager.ClipRegionWidth ||
|
||||||
screenScissorState.Height != _channel.TextureManager.ClipRegionHeight;
|
screenScissorState.Height != _channel.TextureManager.ClipRegionHeight;
|
||||||
|
|
||||||
bool clearAffectedByStencilMask = (_state.State.ClearFlags & 1) != 0;
|
|
||||||
bool clearAffectedByScissor = (_state.State.ClearFlags & 0x100) != 0;
|
|
||||||
bool needsCustomScissor = !clearAffectedByScissor || clipMismatch;
|
bool needsCustomScissor = !clearAffectedByScissor || clipMismatch;
|
||||||
|
|
||||||
// Scissor and rasterizer discard also affect clears.
|
// Scissor and rasterizer discard also affect clears.
|
||||||
|
@@ -33,6 +33,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
UpdateDepthStencil = 1 << 3,
|
UpdateDepthStencil = 1 << 3,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that the data in the clip region can be discarded for the next use.
|
||||||
|
/// </summary>
|
||||||
|
DiscardClip = 1 << 4,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default update flags for draw.
|
/// Default update flags for draw.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -17,9 +17,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||||||
class StateUpdater
|
class StateUpdater
|
||||||
{
|
{
|
||||||
public const int ShaderStateIndex = 26;
|
public const int ShaderStateIndex = 26;
|
||||||
|
public const int RtColorMaskIndex = 14;
|
||||||
public const int RasterizerStateIndex = 15;
|
public const int RasterizerStateIndex = 15;
|
||||||
public const int ScissorStateIndex = 16;
|
public const int ScissorStateIndex = 16;
|
||||||
public const int VertexBufferStateIndex = 0;
|
public const int VertexBufferStateIndex = 0;
|
||||||
|
public const int BlendStateIndex = 2;
|
||||||
public const int IndexBufferStateIndex = 23;
|
public const int IndexBufferStateIndex = 23;
|
||||||
public const int PrimitiveRestartStateIndex = 12;
|
public const int PrimitiveRestartStateIndex = 12;
|
||||||
public const int RenderTargetStateIndex = 27;
|
public const int RenderTargetStateIndex = 27;
|
||||||
@@ -447,6 +449,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||||||
bool useControl = updateFlags.HasFlag(RenderTargetUpdateFlags.UseControl);
|
bool useControl = updateFlags.HasFlag(RenderTargetUpdateFlags.UseControl);
|
||||||
bool layered = updateFlags.HasFlag(RenderTargetUpdateFlags.Layered);
|
bool layered = updateFlags.HasFlag(RenderTargetUpdateFlags.Layered);
|
||||||
bool singleColor = updateFlags.HasFlag(RenderTargetUpdateFlags.SingleColor);
|
bool singleColor = updateFlags.HasFlag(RenderTargetUpdateFlags.SingleColor);
|
||||||
|
bool discard = updateFlags.HasFlag(RenderTargetUpdateFlags.DiscardClip);
|
||||||
|
|
||||||
int count = useControl ? rtControl.UnpackCount() : Constants.TotalRenderTargets;
|
int count = useControl ? rtControl.UnpackCount() : Constants.TotalRenderTargets;
|
||||||
|
|
||||||
@@ -486,6 +489,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||||||
memoryManager,
|
memoryManager,
|
||||||
colorState,
|
colorState,
|
||||||
_vtgWritesRtLayer || layered,
|
_vtgWritesRtLayer || layered,
|
||||||
|
discard,
|
||||||
samplesInX,
|
samplesInX,
|
||||||
samplesInY,
|
samplesInY,
|
||||||
sizeHint);
|
sizeHint);
|
||||||
@@ -525,6 +529,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||||||
dsState,
|
dsState,
|
||||||
dsSize,
|
dsSize,
|
||||||
_vtgWritesRtLayer || layered,
|
_vtgWritesRtLayer || layered,
|
||||||
|
discard,
|
||||||
samplesInX,
|
samplesInX,
|
||||||
samplesInY,
|
samplesInY,
|
||||||
sizeHint);
|
sizeHint);
|
||||||
|
@@ -1,12 +1,15 @@
|
|||||||
using Ryujinx.Graphics.Device;
|
using Ryujinx.Common.Memory;
|
||||||
|
using Ryujinx.Graphics.Device;
|
||||||
using Ryujinx.Graphics.GAL;
|
using Ryujinx.Graphics.GAL;
|
||||||
using Ryujinx.Graphics.Gpu.Engine.GPFifo;
|
using Ryujinx.Graphics.Gpu.Engine.GPFifo;
|
||||||
using Ryujinx.Graphics.Gpu.Engine.InlineToMemory;
|
using Ryujinx.Graphics.Gpu.Engine.InlineToMemory;
|
||||||
using Ryujinx.Graphics.Gpu.Engine.Threed.Blender;
|
using Ryujinx.Graphics.Gpu.Engine.Threed.Blender;
|
||||||
|
using Ryujinx.Graphics.Gpu.Engine.Types;
|
||||||
using Ryujinx.Graphics.Gpu.Synchronization;
|
using Ryujinx.Graphics.Gpu.Synchronization;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.Intrinsics;
|
||||||
|
|
||||||
namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||||
{
|
{
|
||||||
@@ -26,6 +29,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||||||
private readonly ConstantBufferUpdater _cbUpdater;
|
private readonly ConstantBufferUpdater _cbUpdater;
|
||||||
private readonly StateUpdater _stateUpdater;
|
private readonly StateUpdater _stateUpdater;
|
||||||
|
|
||||||
|
private SetMmeShadowRamControlMode ShadowMode => _state.State.SetMmeShadowRamControlMode;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new instance of the 3D engine class.
|
/// Creates a new instance of the 3D engine class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -228,6 +233,206 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||||||
_cbUpdater.Update(data);
|
_cbUpdater.Update(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test if two 32 byte structs are equal.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">Type of the 32-byte struct</typeparam>
|
||||||
|
/// <param name="lhs">First struct</param>
|
||||||
|
/// <param name="rhs">Second struct</param>
|
||||||
|
/// <returns>True if equal, false otherwise</returns>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
private static bool UnsafeEquals32Byte<T>(ref T lhs, ref T rhs) where T : unmanaged
|
||||||
|
{
|
||||||
|
if (Vector256.IsHardwareAccelerated)
|
||||||
|
{
|
||||||
|
return Vector256.EqualsAll(
|
||||||
|
Unsafe.As<T, Vector256<uint>>(ref lhs),
|
||||||
|
Unsafe.As<T, Vector256<uint>>(ref rhs)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ref var lhsVec = ref Unsafe.As<T, Vector128<uint>>(ref lhs);
|
||||||
|
ref var rhsVec = ref Unsafe.As<T, Vector128<uint>>(ref rhs);
|
||||||
|
|
||||||
|
return Vector128.EqualsAll(lhsVec, rhsVec) &&
|
||||||
|
Vector128.EqualsAll(Unsafe.Add(ref lhsVec, 1), Unsafe.Add(ref rhsVec, 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates blend enable. Respects current shadow mode.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="masks">Blend enable</param>
|
||||||
|
public void UpdateBlendEnable(ref Array8<Boolean32> enable)
|
||||||
|
{
|
||||||
|
var shadow = ShadowMode;
|
||||||
|
ref var state = ref _state.State.BlendEnable;
|
||||||
|
|
||||||
|
if (shadow.IsReplay())
|
||||||
|
{
|
||||||
|
enable = _state.ShadowState.BlendEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!UnsafeEquals32Byte(ref enable, ref state))
|
||||||
|
{
|
||||||
|
state = enable;
|
||||||
|
|
||||||
|
_stateUpdater.ForceDirty(StateUpdater.BlendStateIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shadow.IsTrack())
|
||||||
|
{
|
||||||
|
_state.ShadowState.BlendEnable = enable;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates color masks. Respects current shadow mode.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="masks">Color masks</param>
|
||||||
|
public void UpdateColorMasks(ref Array8<RtColorMask> masks)
|
||||||
|
{
|
||||||
|
var shadow = ShadowMode;
|
||||||
|
ref var state = ref _state.State.RtColorMask;
|
||||||
|
|
||||||
|
if (shadow.IsReplay())
|
||||||
|
{
|
||||||
|
masks = _state.ShadowState.RtColorMask;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!UnsafeEquals32Byte(ref masks, ref state))
|
||||||
|
{
|
||||||
|
state = masks;
|
||||||
|
|
||||||
|
_stateUpdater.ForceDirty(StateUpdater.RtColorMaskIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shadow.IsTrack())
|
||||||
|
{
|
||||||
|
_state.ShadowState.RtColorMask = masks;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates index buffer state for an indexed draw. Respects current shadow mode.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="addrHigh">High part of the address</param>
|
||||||
|
/// <param name="addrLow">Low part of the address</param>
|
||||||
|
/// <param name="type">Type of the binding</param>
|
||||||
|
public void UpdateIndexBuffer(uint addrHigh, uint addrLow, IndexType type)
|
||||||
|
{
|
||||||
|
var shadow = ShadowMode;
|
||||||
|
ref var state = ref _state.State.IndexBufferState;
|
||||||
|
|
||||||
|
if (shadow.IsReplay())
|
||||||
|
{
|
||||||
|
ref var shadowState = ref _state.ShadowState.IndexBufferState;
|
||||||
|
addrHigh = shadowState.Address.High;
|
||||||
|
addrLow = shadowState.Address.Low;
|
||||||
|
type = shadowState.Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.Address.High != addrHigh || state.Address.Low != addrLow || state.Type != type)
|
||||||
|
{
|
||||||
|
state.Address.High = addrHigh;
|
||||||
|
state.Address.Low = addrLow;
|
||||||
|
state.Type = type;
|
||||||
|
|
||||||
|
_stateUpdater.ForceDirty(StateUpdater.IndexBufferStateIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shadow.IsTrack())
|
||||||
|
{
|
||||||
|
ref var shadowState = ref _state.ShadowState.IndexBufferState;
|
||||||
|
shadowState.Address.High = addrHigh;
|
||||||
|
shadowState.Address.Low = addrLow;
|
||||||
|
shadowState.Type = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates uniform buffer state for update or bind. Respects current shadow mode.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="size">Size of the binding</param>
|
||||||
|
/// <param name="addrHigh">High part of the addrsss</param>
|
||||||
|
/// <param name="addrLow">Low part of the address</param>
|
||||||
|
public void UpdateUniformBufferState(int size, uint addrHigh, uint addrLow)
|
||||||
|
{
|
||||||
|
var shadow = ShadowMode;
|
||||||
|
ref var state = ref _state.State.UniformBufferState;
|
||||||
|
|
||||||
|
if (shadow.IsReplay())
|
||||||
|
{
|
||||||
|
ref var shadowState = ref _state.ShadowState.UniformBufferState;
|
||||||
|
size = shadowState.Size;
|
||||||
|
addrHigh = shadowState.Address.High;
|
||||||
|
addrLow = shadowState.Address.Low;
|
||||||
|
}
|
||||||
|
|
||||||
|
state.Size = size;
|
||||||
|
state.Address.High = addrHigh;
|
||||||
|
state.Address.Low = addrLow;
|
||||||
|
|
||||||
|
if (shadow.IsTrack())
|
||||||
|
{
|
||||||
|
ref var shadowState = ref _state.ShadowState.UniformBufferState;
|
||||||
|
shadowState.Size = size;
|
||||||
|
shadowState.Address.High = addrHigh;
|
||||||
|
shadowState.Address.Low = addrLow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a shader offset. Respects current shadow mode.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">Index of the shader to update</param>
|
||||||
|
/// <param name="offset">Offset to update with</param>
|
||||||
|
public void SetShaderOffset(int index, uint offset)
|
||||||
|
{
|
||||||
|
var shadow = ShadowMode;
|
||||||
|
ref var shaderState = ref _state.State.ShaderState[index];
|
||||||
|
|
||||||
|
if (shadow.IsReplay())
|
||||||
|
{
|
||||||
|
offset = _state.ShadowState.ShaderState[index].Offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shaderState.Offset != offset)
|
||||||
|
{
|
||||||
|
shaderState.Offset = offset;
|
||||||
|
|
||||||
|
_stateUpdater.ForceDirty(StateUpdater.ShaderStateIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shadow.IsTrack())
|
||||||
|
{
|
||||||
|
_state.ShadowState.ShaderState[index].Offset = offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates uniform buffer state for update. Respects current shadow mode.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ubState">Uniform buffer state</param>
|
||||||
|
public void UpdateUniformBufferState(UniformBufferState ubState)
|
||||||
|
{
|
||||||
|
var shadow = ShadowMode;
|
||||||
|
ref var state = ref _state.State.UniformBufferState;
|
||||||
|
|
||||||
|
if (shadow.IsReplay())
|
||||||
|
{
|
||||||
|
ubState = _state.ShadowState.UniformBufferState;
|
||||||
|
}
|
||||||
|
|
||||||
|
state = ubState;
|
||||||
|
|
||||||
|
if (shadow.IsTrack())
|
||||||
|
{
|
||||||
|
_state.ShadowState.UniformBufferState = ubState;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Launches the Inline-to-Memory DMA copy operation.
|
/// Launches the Inline-to-Memory DMA copy operation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -590,9 +590,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
struct RtColorMask
|
struct RtColorMask
|
||||||
{
|
{
|
||||||
#pragma warning disable CS0649 // Field is never assigned to
|
|
||||||
public uint Packed;
|
public uint Packed;
|
||||||
#pragma warning restore CS0649
|
|
||||||
|
public RtColorMask(uint packed)
|
||||||
|
{
|
||||||
|
Packed = packed;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unpacks red channel enable.
|
/// Unpacks red channel enable.
|
||||||
|
@@ -5,9 +5,12 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
readonly struct Boolean32
|
readonly struct Boolean32
|
||||||
{
|
{
|
||||||
#pragma warning disable CS0649 // Field is never assigned to
|
|
||||||
private readonly uint _value;
|
private readonly uint _value;
|
||||||
#pragma warning restore CS0649
|
|
||||||
|
public Boolean32(uint value)
|
||||||
|
{
|
||||||
|
_value = value;
|
||||||
|
}
|
||||||
|
|
||||||
public static implicit operator bool(Boolean32 value)
|
public static implicit operator bool(Boolean32 value)
|
||||||
{
|
{
|
||||||
|
@@ -101,6 +101,11 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AlwaysFlushOnOverlap { get; private set; }
|
public bool AlwaysFlushOnOverlap { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that the texture was fully unmapped since the modified flag was set, and flushes should be ignored until it is modified again.
|
||||||
|
/// </summary>
|
||||||
|
public bool FlushStale { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Increments when the host texture is swapped, or when the texture is removed from all pools.
|
/// Increments when the host texture is swapped, or when the texture is removed from all pools.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -149,6 +154,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HadPoolOwner { get; private set; }
|
public bool HadPoolOwner { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
/// Physical memory ranges where the texture data is located.
|
/// Physical memory ranges where the texture data is located.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MultiRange Range { get; private set; }
|
public MultiRange Range { get; private set; }
|
||||||
@@ -570,6 +576,18 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
return Group.CheckDirty(this, consume);
|
return Group.CheckDirty(this, consume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Discards all data for this texture.
|
||||||
|
/// This clears all dirty flags, modified flags, and pending copies from other textures.
|
||||||
|
/// It should be used if the texture data will be fully overwritten by the next use.
|
||||||
|
/// </summary>
|
||||||
|
public void DiscardData()
|
||||||
|
{
|
||||||
|
Group.DiscardData(this);
|
||||||
|
|
||||||
|
_dirty = false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Synchronizes guest and host memory.
|
/// Synchronizes guest and host memory.
|
||||||
/// This will overwrite the texture data with the texture data on the guest memory, if a CPU
|
/// This will overwrite the texture data with the texture data on the guest memory, if a CPU
|
||||||
@@ -1399,6 +1417,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void SignalModified()
|
public void SignalModified()
|
||||||
{
|
{
|
||||||
|
FlushStale = false;
|
||||||
_scaledSetScore = Math.Max(0, _scaledSetScore - 1);
|
_scaledSetScore = Math.Max(0, _scaledSetScore - 1);
|
||||||
|
|
||||||
if (_modifiedStale || Group.HasCopyDependencies)
|
if (_modifiedStale || Group.HasCopyDependencies)
|
||||||
@@ -1419,6 +1438,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
{
|
{
|
||||||
if (bound)
|
if (bound)
|
||||||
{
|
{
|
||||||
|
FlushStale = false;
|
||||||
_scaledSetScore = Math.Max(0, _scaledSetScore - 1);
|
_scaledSetScore = Math.Max(0, _scaledSetScore - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1683,12 +1703,17 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
/// <param name="unmapRange">The range of memory being unmapped</param>
|
/// <param name="unmapRange">The range of memory being unmapped</param>
|
||||||
public void Unmapped(MultiRange unmapRange)
|
public void Unmapped(MultiRange unmapRange)
|
||||||
{
|
{
|
||||||
|
if (unmapRange.Contains(Range))
|
||||||
|
{
|
||||||
|
// If this is a full unmap, prevent flushes until the texture is mapped again.
|
||||||
|
FlushStale = true;
|
||||||
|
}
|
||||||
|
|
||||||
ChangedMapping = true;
|
ChangedMapping = true;
|
||||||
|
|
||||||
if (Group.Storage == this)
|
if (Group.Storage == this)
|
||||||
{
|
{
|
||||||
Group.Unmapped();
|
Group.Unmapped();
|
||||||
|
|
||||||
Group.ClearModified(unmapRange);
|
Group.ClearModified(unmapRange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -107,8 +107,6 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
// Any texture that has been unmapped at any point or is partially unmapped
|
// Any texture that has been unmapped at any point or is partially unmapped
|
||||||
// should update their pool references after the remap completes.
|
// should update their pool references after the remap completes.
|
||||||
|
|
||||||
MultiRange unmapped = ((MemoryManager)sender).GetPhysicalRegions(e.Address, e.Size);
|
|
||||||
|
|
||||||
foreach (var texture in _partiallyMappedTextures)
|
foreach (var texture in _partiallyMappedTextures)
|
||||||
{
|
{
|
||||||
texture.UpdatePoolMappings();
|
texture.UpdatePoolMappings();
|
||||||
@@ -311,7 +309,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
flags |= TextureSearchFlags.NoCreate;
|
flags |= TextureSearchFlags.NoCreate;
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture texture = FindOrCreateTexture(memoryManager, flags, info, 0);
|
Texture texture = FindOrCreateTexture(memoryManager, flags, info, 0, sizeHint: sizeHint);
|
||||||
|
|
||||||
texture?.SynchronizeMemory();
|
texture?.SynchronizeMemory();
|
||||||
|
|
||||||
@@ -324,6 +322,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
/// <param name="memoryManager">GPU memory manager where the texture is mapped</param>
|
/// <param name="memoryManager">GPU memory manager where the texture is mapped</param>
|
||||||
/// <param name="colorState">Color buffer texture to find or create</param>
|
/// <param name="colorState">Color buffer texture to find or create</param>
|
||||||
/// <param name="layered">Indicates if the texture might be accessed with a non-zero layer index</param>
|
/// <param name="layered">Indicates if the texture might be accessed with a non-zero layer index</param>
|
||||||
|
/// <param name="discard">Indicates that the sizeHint region's data will be overwritten</param>
|
||||||
/// <param name="samplesInX">Number of samples in the X direction, for MSAA</param>
|
/// <param name="samplesInX">Number of samples in the X direction, for MSAA</param>
|
||||||
/// <param name="samplesInY">Number of samples in the Y direction, for MSAA</param>
|
/// <param name="samplesInY">Number of samples in the Y direction, for MSAA</param>
|
||||||
/// <param name="sizeHint">A hint indicating the minimum used size for the texture</param>
|
/// <param name="sizeHint">A hint indicating the minimum used size for the texture</param>
|
||||||
@@ -332,6 +331,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
MemoryManager memoryManager,
|
MemoryManager memoryManager,
|
||||||
RtColorState colorState,
|
RtColorState colorState,
|
||||||
bool layered,
|
bool layered,
|
||||||
|
bool discard,
|
||||||
int samplesInX,
|
int samplesInX,
|
||||||
int samplesInY,
|
int samplesInY,
|
||||||
Size sizeHint)
|
Size sizeHint)
|
||||||
@@ -398,7 +398,14 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
|
|
||||||
int layerSize = !isLinear ? colorState.LayerSize * 4 : 0;
|
int layerSize = !isLinear ? colorState.LayerSize * 4 : 0;
|
||||||
|
|
||||||
Texture texture = FindOrCreateTexture(memoryManager, TextureSearchFlags.WithUpscale, info, layerSize);
|
var flags = TextureSearchFlags.WithUpscale;
|
||||||
|
|
||||||
|
if (discard)
|
||||||
|
{
|
||||||
|
flags |= TextureSearchFlags.DiscardData;
|
||||||
|
}
|
||||||
|
|
||||||
|
Texture texture = FindOrCreateTexture(memoryManager, flags, info, layerSize, sizeHint: sizeHint);
|
||||||
|
|
||||||
texture?.SynchronizeMemory();
|
texture?.SynchronizeMemory();
|
||||||
|
|
||||||
@@ -412,6 +419,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
/// <param name="dsState">Depth-stencil buffer texture to find or create</param>
|
/// <param name="dsState">Depth-stencil buffer texture to find or create</param>
|
||||||
/// <param name="size">Size of the depth-stencil texture</param>
|
/// <param name="size">Size of the depth-stencil texture</param>
|
||||||
/// <param name="layered">Indicates if the texture might be accessed with a non-zero layer index</param>
|
/// <param name="layered">Indicates if the texture might be accessed with a non-zero layer index</param>
|
||||||
|
/// <param name="discard">Indicates that the sizeHint region's data will be overwritten</param>
|
||||||
/// <param name="samplesInX">Number of samples in the X direction, for MSAA</param>
|
/// <param name="samplesInX">Number of samples in the X direction, for MSAA</param>
|
||||||
/// <param name="samplesInY">Number of samples in the Y direction, for MSAA</param>
|
/// <param name="samplesInY">Number of samples in the Y direction, for MSAA</param>
|
||||||
/// <param name="sizeHint">A hint indicating the minimum used size for the texture</param>
|
/// <param name="sizeHint">A hint indicating the minimum used size for the texture</param>
|
||||||
@@ -421,6 +429,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
RtDepthStencilState dsState,
|
RtDepthStencilState dsState,
|
||||||
Size3D size,
|
Size3D size,
|
||||||
bool layered,
|
bool layered,
|
||||||
|
bool discard,
|
||||||
int samplesInX,
|
int samplesInX,
|
||||||
int samplesInY,
|
int samplesInY,
|
||||||
Size sizeHint)
|
Size sizeHint)
|
||||||
@@ -465,7 +474,14 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
target,
|
target,
|
||||||
formatInfo);
|
formatInfo);
|
||||||
|
|
||||||
Texture texture = FindOrCreateTexture(memoryManager, TextureSearchFlags.WithUpscale, info, dsState.LayerSize * 4);
|
var flags = TextureSearchFlags.WithUpscale;
|
||||||
|
|
||||||
|
if (discard)
|
||||||
|
{
|
||||||
|
flags |= TextureSearchFlags.DiscardData;
|
||||||
|
}
|
||||||
|
|
||||||
|
Texture texture = FindOrCreateTexture(memoryManager, flags, info, dsState.LayerSize * 4, sizeHint: sizeHint);
|
||||||
|
|
||||||
texture?.SynchronizeMemory();
|
texture?.SynchronizeMemory();
|
||||||
|
|
||||||
@@ -500,6 +516,37 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
return Math.Clamp(widthAligned - alignment + 1, minimumWidth, widthAligned);
|
return Math.Clamp(widthAligned - alignment + 1, minimumWidth, widthAligned);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines if texture data should be fully discarded
|
||||||
|
/// based on the size hint region and whether it is set to be discarded.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="discard">Whether the size hint region should be discarded</param>
|
||||||
|
/// <param name="texture">The texture being discarded</param>
|
||||||
|
/// <param name="sizeHint">A hint indicating the minimum used size for the texture</param>
|
||||||
|
/// <returns>True if the data should be discarded, false otherwise</returns>
|
||||||
|
private static bool ShouldDiscard(bool discard, Texture texture, Size? sizeHint)
|
||||||
|
{
|
||||||
|
return discard &&
|
||||||
|
texture.Info.DepthOrLayers == 1 &&
|
||||||
|
sizeHint != null &&
|
||||||
|
texture.Width <= sizeHint.Value.Width &&
|
||||||
|
texture.Height <= sizeHint.Value.Height;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Discards texture data if requested and possible.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="discard">Whether the size hint region should be discarded</param>
|
||||||
|
/// <param name="texture">The texture being discarded</param>
|
||||||
|
/// <param name="sizeHint">A hint indicating the minimum used size for the texture</param>
|
||||||
|
private static void DiscardIfNeeded(bool discard, Texture texture, Size? sizeHint)
|
||||||
|
{
|
||||||
|
if (ShouldDiscard(discard, texture, sizeHint))
|
||||||
|
{
|
||||||
|
texture.DiscardData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tries to find an existing texture, or create a new one if not found.
|
/// Tries to find an existing texture, or create a new one if not found.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -507,6 +554,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
/// <param name="flags">The texture search flags, defines texture comparison rules</param>
|
/// <param name="flags">The texture search flags, defines texture comparison rules</param>
|
||||||
/// <param name="info">Texture information of the texture to be found or created</param>
|
/// <param name="info">Texture information of the texture to be found or created</param>
|
||||||
/// <param name="layerSize">Size in bytes of a single texture layer</param>
|
/// <param name="layerSize">Size in bytes of a single texture layer</param>
|
||||||
|
/// <param name="sizeHint">A hint indicating the minimum used size for the texture</param>
|
||||||
/// <param name="range">Optional ranges of physical memory where the texture data is located</param>
|
/// <param name="range">Optional ranges of physical memory where the texture data is located</param>
|
||||||
/// <returns>The texture</returns>
|
/// <returns>The texture</returns>
|
||||||
public Texture FindOrCreateTexture(
|
public Texture FindOrCreateTexture(
|
||||||
@@ -514,9 +562,11 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
TextureSearchFlags flags,
|
TextureSearchFlags flags,
|
||||||
TextureInfo info,
|
TextureInfo info,
|
||||||
int layerSize = 0,
|
int layerSize = 0,
|
||||||
|
Size? sizeHint = null,
|
||||||
MultiRange? range = null)
|
MultiRange? range = null)
|
||||||
{
|
{
|
||||||
bool isSamplerTexture = (flags & TextureSearchFlags.ForSampler) != 0;
|
bool isSamplerTexture = (flags & TextureSearchFlags.ForSampler) != 0;
|
||||||
|
bool discard = (flags & TextureSearchFlags.DiscardData) != 0;
|
||||||
|
|
||||||
TextureScaleMode scaleMode = IsUpscaleCompatible(info, (flags & TextureSearchFlags.WithUpscale) != 0);
|
TextureScaleMode scaleMode = IsUpscaleCompatible(info, (flags & TextureSearchFlags.WithUpscale) != 0);
|
||||||
|
|
||||||
@@ -612,6 +662,8 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
|
|
||||||
if (texture != null)
|
if (texture != null)
|
||||||
{
|
{
|
||||||
|
DiscardIfNeeded(discard, texture, sizeHint);
|
||||||
|
|
||||||
texture.SynchronizeMemory();
|
texture.SynchronizeMemory();
|
||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
@@ -642,12 +694,15 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find view compatible matches.
|
// Find view compatible matches.
|
||||||
int overlapsCount;
|
int overlapsCount = 0;
|
||||||
|
|
||||||
|
if (info.Target != Target.TextureBuffer)
|
||||||
|
{
|
||||||
lock (_textures)
|
lock (_textures)
|
||||||
{
|
{
|
||||||
overlapsCount = _textures.FindOverlaps(range.Value, ref _textureOverlaps);
|
overlapsCount = _textures.FindOverlaps(range.Value, ref _textureOverlaps);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_overlapInfo.Length != _textureOverlaps.Length)
|
if (_overlapInfo.Length != _textureOverlaps.Length)
|
||||||
{
|
{
|
||||||
@@ -678,9 +733,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
{
|
{
|
||||||
if (overlap.IsView)
|
if (overlap.IsView)
|
||||||
{
|
{
|
||||||
overlapCompatibility = overlapCompatibility == TextureViewCompatibility.FormatAlias ?
|
overlapCompatibility = TextureViewCompatibility.CopyOnly;
|
||||||
TextureViewCompatibility.Incompatible :
|
|
||||||
TextureViewCompatibility.CopyOnly;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -758,7 +811,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
Texture overlap = _textureOverlaps[index];
|
Texture overlap = _textureOverlaps[index];
|
||||||
OverlapInfo oInfo = _overlapInfo[index];
|
OverlapInfo oInfo = _overlapInfo[index];
|
||||||
|
|
||||||
if (oInfo.Compatibility <= TextureViewCompatibility.LayoutIncompatible || oInfo.Compatibility == TextureViewCompatibility.FormatAlias)
|
if (oInfo.Compatibility <= TextureViewCompatibility.LayoutIncompatible)
|
||||||
{
|
{
|
||||||
if (!overlap.IsView && texture.DataOverlaps(overlap, oInfo.Compatibility))
|
if (!overlap.IsView && texture.DataOverlaps(overlap, oInfo.Compatibility))
|
||||||
{
|
{
|
||||||
@@ -907,7 +960,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
|
|
||||||
// We need to synchronize before copying the old view data to the texture,
|
// We need to synchronize before copying the old view data to the texture,
|
||||||
// otherwise the copied data would be overwritten by a future synchronization.
|
// otherwise the copied data would be overwritten by a future synchronization.
|
||||||
texture.InitializeData(false, setData);
|
texture.InitializeData(false, setData && !ShouldDiscard(discard, texture, sizeHint));
|
||||||
|
|
||||||
texture.Group.InitializeOverlaps();
|
texture.Group.InitializeOverlaps();
|
||||||
|
|
||||||
|
@@ -226,7 +226,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
{
|
{
|
||||||
// D32F and R32F texture have the same representation internally,
|
// D32F and R32F texture have the same representation internally,
|
||||||
// however the R32F format is used to sample from depth textures.
|
// however the R32F format is used to sample from depth textures.
|
||||||
if (lhs.FormatInfo.Format == Format.D32Float && rhs.FormatInfo.Format == Format.R32Float && (forSampler || depthAlias))
|
if (IsValidDepthAsColorAlias(lhs.FormatInfo.Format, rhs.FormatInfo.Format) && (forSampler || depthAlias))
|
||||||
{
|
{
|
||||||
return TextureMatchQuality.FormatAlias;
|
return TextureMatchQuality.FormatAlias;
|
||||||
}
|
}
|
||||||
@@ -239,13 +239,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
{
|
{
|
||||||
return TextureMatchQuality.FormatAlias;
|
return TextureMatchQuality.FormatAlias;
|
||||||
}
|
}
|
||||||
|
else if ((lhs.FormatInfo.Format == Format.D24UnormS8Uint ||
|
||||||
if (lhs.FormatInfo.Format == Format.D16Unorm && rhs.FormatInfo.Format == Format.R16Unorm)
|
|
||||||
{
|
|
||||||
return TextureMatchQuality.FormatAlias;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((lhs.FormatInfo.Format == Format.D24UnormS8Uint ||
|
|
||||||
lhs.FormatInfo.Format == Format.S8UintD24Unorm) && rhs.FormatInfo.Format == Format.B8G8R8A8Unorm)
|
lhs.FormatInfo.Format == Format.S8UintD24Unorm) && rhs.FormatInfo.Format == Format.B8G8R8A8Unorm)
|
||||||
{
|
{
|
||||||
return TextureMatchQuality.FormatAlias;
|
return TextureMatchQuality.FormatAlias;
|
||||||
@@ -374,6 +368,13 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
|
|
||||||
return stride == rhs.Stride ? TextureViewCompatibility.CopyOnly : TextureViewCompatibility.LayoutIncompatible;
|
return stride == rhs.Stride ? TextureViewCompatibility.CopyOnly : TextureViewCompatibility.LayoutIncompatible;
|
||||||
}
|
}
|
||||||
|
else if (lhs.Target.IsMultisample() != rhs.Target.IsMultisample() && alignedWidthMatches && lhsAlignedSize.Height == rhsAlignedSize.Height)
|
||||||
|
{
|
||||||
|
// Copy between multisample and non-multisample textures with mismatching size is allowed,
|
||||||
|
// as long aligned size matches.
|
||||||
|
|
||||||
|
return TextureViewCompatibility.CopyOnly;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return TextureViewCompatibility.LayoutIncompatible;
|
return TextureViewCompatibility.LayoutIncompatible;
|
||||||
@@ -625,12 +626,27 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
|
|
||||||
if (lhsFormat.Format.IsDepthOrStencil() || rhsFormat.Format.IsDepthOrStencil())
|
if (lhsFormat.Format.IsDepthOrStencil() || rhsFormat.Format.IsDepthOrStencil())
|
||||||
{
|
{
|
||||||
return FormatMatches(lhs, rhs, flags.HasFlag(TextureSearchFlags.ForSampler), flags.HasFlag(TextureSearchFlags.DepthAlias)) switch
|
bool forSampler = flags.HasFlag(TextureSearchFlags.ForSampler);
|
||||||
|
bool depthAlias = flags.HasFlag(TextureSearchFlags.DepthAlias);
|
||||||
|
|
||||||
|
TextureMatchQuality matchQuality = FormatMatches(lhs, rhs, forSampler, depthAlias);
|
||||||
|
|
||||||
|
if (matchQuality == TextureMatchQuality.Perfect)
|
||||||
{
|
{
|
||||||
TextureMatchQuality.Perfect => TextureViewCompatibility.Full,
|
return TextureViewCompatibility.Full;
|
||||||
TextureMatchQuality.FormatAlias => TextureViewCompatibility.FormatAlias,
|
}
|
||||||
_ => TextureViewCompatibility.Incompatible,
|
else if (matchQuality == TextureMatchQuality.FormatAlias)
|
||||||
};
|
{
|
||||||
|
return TextureViewCompatibility.FormatAlias;
|
||||||
|
}
|
||||||
|
else if (IsValidColorAsDepthAlias(lhsFormat.Format, rhsFormat.Format) || IsValidDepthAsColorAlias(lhsFormat.Format, rhsFormat.Format))
|
||||||
|
{
|
||||||
|
return TextureViewCompatibility.CopyOnly;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return TextureViewCompatibility.Incompatible;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsFormatHostIncompatible(lhs, caps) || IsFormatHostIncompatible(rhs, caps))
|
if (IsFormatHostIncompatible(lhs, caps) || IsFormatHostIncompatible(rhs, caps))
|
||||||
@@ -659,6 +675,30 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
return TextureViewCompatibility.Incompatible;
|
return TextureViewCompatibility.Incompatible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if it's valid to alias a color format as a depth format.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="lhsFormat">Source format to be checked</param>
|
||||||
|
/// <param name="rhsFormat">Target format to be checked</param>
|
||||||
|
/// <returns>True if it's valid to alias the formats</returns>
|
||||||
|
private static bool IsValidColorAsDepthAlias(Format lhsFormat, Format rhsFormat)
|
||||||
|
{
|
||||||
|
return (lhsFormat == Format.R32Float && rhsFormat == Format.D32Float) ||
|
||||||
|
(lhsFormat == Format.R16Unorm && rhsFormat == Format.D16Unorm);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if it's valid to alias a depth format as a color format.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="lhsFormat">Source format to be checked</param>
|
||||||
|
/// <param name="rhsFormat">Target format to be checked</param>
|
||||||
|
/// <returns>True if it's valid to alias the formats</returns>
|
||||||
|
private static bool IsValidDepthAsColorAlias(Format lhsFormat, Format rhsFormat)
|
||||||
|
{
|
||||||
|
return (lhsFormat == Format.D32Float && rhsFormat == Format.R32Float) ||
|
||||||
|
(lhsFormat == Format.D16Unorm && rhsFormat == Format.R16Unorm);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if aliasing of two formats that would normally be considered incompatible be allowed,
|
/// Checks if aliasing of two formats that would normally be considered incompatible be allowed,
|
||||||
/// using copy dependencies.
|
/// using copy dependencies.
|
||||||
|
@@ -79,6 +79,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
private int[] _allOffsets;
|
private int[] _allOffsets;
|
||||||
private int[] _sliceSizes;
|
private int[] _sliceSizes;
|
||||||
private readonly bool _is3D;
|
private readonly bool _is3D;
|
||||||
|
private readonly bool _isBuffer;
|
||||||
private bool _hasMipViews;
|
private bool _hasMipViews;
|
||||||
private bool _hasLayerViews;
|
private bool _hasLayerViews;
|
||||||
private readonly int _layers;
|
private readonly int _layers;
|
||||||
@@ -118,6 +119,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
_physicalMemory = physicalMemory;
|
_physicalMemory = physicalMemory;
|
||||||
|
|
||||||
_is3D = storage.Info.Target == Target.Texture3D;
|
_is3D = storage.Info.Target == Target.Texture3D;
|
||||||
|
_isBuffer = storage.Info.Target == Target.TextureBuffer;
|
||||||
_layers = storage.Info.GetSlices();
|
_layers = storage.Info.GetSlices();
|
||||||
_levels = storage.Info.Levels;
|
_levels = storage.Info.Levels;
|
||||||
|
|
||||||
@@ -278,6 +280,24 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
return dirty;
|
return dirty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Discards all data for a given texture.
|
||||||
|
/// This clears all dirty flags, modified flags, and pending copies from other textures.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="texture">The texture being discarded</param>
|
||||||
|
public void DiscardData(Texture texture)
|
||||||
|
{
|
||||||
|
EvaluateRelevantHandles(texture, (baseHandle, regionCount, split) =>
|
||||||
|
{
|
||||||
|
for (int i = 0; i < regionCount; i++)
|
||||||
|
{
|
||||||
|
TextureGroupHandle group = _handles[baseHandle + i];
|
||||||
|
|
||||||
|
group.DiscardData();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Synchronize memory for a given texture.
|
/// Synchronize memory for a given texture.
|
||||||
/// If overlapping tracking handles are dirty, fully or partially synchronize the texture data.
|
/// If overlapping tracking handles are dirty, fully or partially synchronize the texture data.
|
||||||
@@ -776,7 +796,11 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
int targetLayerHandles = _hasLayerViews ? slices : 1;
|
int targetLayerHandles = _hasLayerViews ? slices : 1;
|
||||||
int targetLevelHandles = _hasMipViews ? levels : 1;
|
int targetLevelHandles = _hasMipViews ? levels : 1;
|
||||||
|
|
||||||
if (_is3D)
|
if (_isBuffer)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (_is3D)
|
||||||
{
|
{
|
||||||
// Future mip levels come after all layers of the last mip level. Each mipmap has less layers (depth) than the last.
|
// Future mip levels come after all layers of the last mip level. Each mipmap has less layers (depth) than the last.
|
||||||
|
|
||||||
@@ -1309,7 +1333,11 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
{
|
{
|
||||||
TextureGroupHandle[] handles;
|
TextureGroupHandle[] handles;
|
||||||
|
|
||||||
if (!(_hasMipViews || _hasLayerViews))
|
if (_isBuffer)
|
||||||
|
{
|
||||||
|
handles = Array.Empty<TextureGroupHandle>();
|
||||||
|
}
|
||||||
|
else if (!(_hasMipViews || _hasLayerViews))
|
||||||
{
|
{
|
||||||
// Single dirty region.
|
// Single dirty region.
|
||||||
var cpuRegionHandles = new RegionHandle[TextureRange.Count];
|
var cpuRegionHandles = new RegionHandle[TextureRange.Count];
|
||||||
@@ -1631,6 +1659,14 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If size is zero, we have nothing to flush.
|
||||||
|
// If the flush is stale, we should ignore it because the texture was unmapped since the modified
|
||||||
|
// flag was set, and flushing it is not safe anymore as the GPU might no longer own the memory.
|
||||||
|
if (size == 0 || Storage.FlushStale)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// There is a small gap here where the action is removed but _actionRegistered is still 1.
|
// There is a small gap here where the action is removed but _actionRegistered is still 1.
|
||||||
// In this case it will skip registering the action, but here we are already handling it,
|
// In this case it will skip registering the action, but here we are already handling it,
|
||||||
// so there shouldn't be any issue as it's the same handler for all actions.
|
// so there shouldn't be any issue as it's the same handler for all actions.
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
using Ryujinx.Memory.Tracking;
|
using Ryujinx.Memory.Tracking;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace Ryujinx.Graphics.Gpu.Image
|
namespace Ryujinx.Graphics.Gpu.Image
|
||||||
@@ -155,6 +154,24 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Discards all data for this handle.
|
||||||
|
/// This clears all dirty flags, modified flags, and pending copies from other handles.
|
||||||
|
/// </summary>
|
||||||
|
public void DiscardData()
|
||||||
|
{
|
||||||
|
Modified = false;
|
||||||
|
DeferredCopy = null;
|
||||||
|
|
||||||
|
foreach (RegionHandle handle in Handles)
|
||||||
|
{
|
||||||
|
if (handle.Dirty)
|
||||||
|
{
|
||||||
|
handle.Reprotect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calculate a list of which views overlap this handle.
|
/// Calculate a list of which views overlap this handle.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user