Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
470a8031a4 | ||
|
5440d4ad5c | ||
|
dde208b480 | ||
|
4c3d2d5d75 | ||
|
fab11ba3f1 | ||
|
332891b5ff | ||
|
7df4fcada7 | ||
|
d6698680be |
@@ -590,6 +590,7 @@
|
|||||||
"DlcWindowTitle": "Manage Downloadable Content for {0} ({1})",
|
"DlcWindowTitle": "Manage Downloadable Content for {0} ({1})",
|
||||||
"UpdateWindowTitle": "Title Update Manager",
|
"UpdateWindowTitle": "Title Update Manager",
|
||||||
"CheatWindowHeading": "Cheats Available for {0} [{1}]",
|
"CheatWindowHeading": "Cheats Available for {0} [{1}]",
|
||||||
|
"BuildId": "BuildId:",
|
||||||
"DlcWindowHeading": "{0} Downloadable Content(s)",
|
"DlcWindowHeading": "{0} Downloadable Content(s)",
|
||||||
"UserProfilesEditProfile": "Edit Selected",
|
"UserProfilesEditProfile": "Edit Selected",
|
||||||
"Cancel": "Cancel",
|
"Cancel": "Cancel",
|
||||||
@@ -644,5 +645,6 @@
|
|||||||
"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 features",
|
||||||
"NetworkInterfaceDefault": "Default"
|
"NetworkInterfaceDefault": "Default",
|
||||||
|
"PackagingShaders": "Packaging Shaders"
|
||||||
}
|
}
|
||||||
|
@@ -233,9 +233,14 @@ namespace Ryujinx.Ava.Common
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IFileSystem ncaFileSystem = patchNca != null
|
bool sectionExistsInPatch = false;
|
||||||
? mainNca.OpenFileSystemWithPatch(patchNca, index, IntegrityCheckLevel.ErrorOnInvalid)
|
if (patchNca != null)
|
||||||
: mainNca.OpenFileSystem(index, IntegrityCheckLevel.ErrorOnInvalid);
|
{
|
||||||
|
sectionExistsInPatch = patchNca.CanOpenSection(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
IFileSystem ncaFileSystem = sectionExistsInPatch ? mainNca.OpenFileSystemWithPatch(patchNca, index, IntegrityCheckLevel.ErrorOnInvalid)
|
||||||
|
: mainNca.OpenFileSystem(index, IntegrityCheckLevel.ErrorOnInvalid);
|
||||||
|
|
||||||
FileSystemClient fsClient = _horizonClient.Fs;
|
FileSystemClient fsClient = _horizonClient.Fs;
|
||||||
|
|
||||||
|
@@ -65,7 +65,7 @@
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="{locale:Locale GameListContextMenuExtractData}">
|
<MenuItem Header="{locale:Locale GameListContextMenuExtractData}">
|
||||||
<MenuItem
|
<MenuItem
|
||||||
Click="ExtractApplicationLogo_Click"
|
Click="ExtractApplicationExeFs_Click"
|
||||||
Header="{locale:Locale GameListContextMenuExtractDataExeFS}"
|
Header="{locale:Locale GameListContextMenuExtractDataExeFS}"
|
||||||
ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataExeFSToolTip}" />
|
ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataExeFSToolTip}" />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
Header="{locale:Locale GameListContextMenuExtractDataRomFS}"
|
Header="{locale:Locale GameListContextMenuExtractDataRomFS}"
|
||||||
ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataRomFSToolTip}" />
|
ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataRomFSToolTip}" />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
Click="ExtractApplicationExeFs_Click"
|
Click="ExtractApplicationLogo_Click"
|
||||||
Header="{locale:Locale GameListContextMenuExtractDataLogo}"
|
Header="{locale:Locale GameListContextMenuExtractDataLogo}"
|
||||||
ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataLogoToolTip}" />
|
ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataLogoToolTip}" />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
@@ -10,6 +10,7 @@ using Ryujinx.Ava.UI.Helpers;
|
|||||||
using Ryujinx.Ava.UI.ViewModels;
|
using Ryujinx.Ava.UI.ViewModels;
|
||||||
using Ryujinx.Ava.UI.Windows;
|
using Ryujinx.Ava.UI.Windows;
|
||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
|
using Ryujinx.Ui.App.Common;
|
||||||
using Ryujinx.HLE.HOS;
|
using Ryujinx.HLE.HOS;
|
||||||
using Ryujinx.Ui.Common.Helper;
|
using Ryujinx.Ui.Common.Helper;
|
||||||
using System;
|
using System;
|
||||||
@@ -118,7 +119,11 @@ namespace Ryujinx.Ava.UI.Controls
|
|||||||
|
|
||||||
if (viewModel?.SelectedApplication != null)
|
if (viewModel?.SelectedApplication != null)
|
||||||
{
|
{
|
||||||
await new CheatWindow(viewModel.VirtualFileSystem, viewModel.SelectedApplication.TitleId, viewModel.SelectedApplication.TitleName).ShowDialog(viewModel.TopLevel as Window);
|
await new CheatWindow(
|
||||||
|
viewModel.VirtualFileSystem,
|
||||||
|
viewModel.SelectedApplication.TitleId,
|
||||||
|
viewModel.SelectedApplication.TitleName,
|
||||||
|
viewModel.SelectedApplication.Path).ShowDialog(viewModel.TopLevel as Window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,13 +294,13 @@ namespace Ryujinx.Ava.UI.Controls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void ExtractApplicationLogo_Click(object sender, RoutedEventArgs args)
|
public async void ExtractApplicationExeFs_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)
|
||||||
{
|
{
|
||||||
await ApplicationHelper.ExtractSection(NcaSectionType.Logo, viewModel.SelectedApplication.Path, viewModel.SelectedApplication.TitleName);
|
await ApplicationHelper.ExtractSection(NcaSectionType.Code, viewModel.SelectedApplication.Path, viewModel.SelectedApplication.TitleName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,13 +314,13 @@ namespace Ryujinx.Ava.UI.Controls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void ExtractApplicationExeFs_Click(object sender, RoutedEventArgs args)
|
public async void ExtractApplicationLogo_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)
|
||||||
{
|
{
|
||||||
await ApplicationHelper.ExtractSection(NcaSectionType.Code, viewModel.SelectedApplication.Path, viewModel.SelectedApplication.TitleName);
|
await ApplicationHelper.ExtractSection(NcaSectionType.Logo, viewModel.SelectedApplication.Path, viewModel.SelectedApplication.TitleName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1099,6 +1099,10 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
LoadHeading = LocaleManager.Instance[LocaleKeys.CompilingShaders];
|
LoadHeading = LocaleManager.Instance[LocaleKeys.CompilingShaders];
|
||||||
IsLoadingIndeterminate = false;
|
IsLoadingIndeterminate = false;
|
||||||
break;
|
break;
|
||||||
|
case ShaderCacheLoadingState.Packaging:
|
||||||
|
LoadHeading = LocaleManager.Instance[LocaleKeys.PackagingShaders];
|
||||||
|
IsLoadingIndeterminate = false;
|
||||||
|
break;
|
||||||
case ShaderCacheLoadingState.Loaded:
|
case ShaderCacheLoadingState.Loaded:
|
||||||
LoadHeading = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.LoadingHeading, TitleName);
|
LoadHeading = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.LoadingHeading, TitleName);
|
||||||
IsLoadingIndeterminate = true;
|
IsLoadingIndeterminate = true;
|
||||||
|
@@ -11,6 +11,7 @@ using Ryujinx.Common;
|
|||||||
using Ryujinx.Common.Utilities;
|
using Ryujinx.Common.Utilities;
|
||||||
using Ryujinx.HLE.HOS;
|
using Ryujinx.HLE.HOS;
|
||||||
using Ryujinx.Modules;
|
using Ryujinx.Modules;
|
||||||
|
using Ryujinx.Ui.App.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;
|
||||||
@@ -176,7 +177,11 @@ namespace Ryujinx.Ava.UI.Views.Main
|
|||||||
|
|
||||||
string name = ViewModel.AppHost.Device.Processes.ActiveApplication.ApplicationControlProperties.Title[(int)ViewModel.AppHost.Device.System.State.DesiredTitleLanguage].NameString.ToString();
|
string name = ViewModel.AppHost.Device.Processes.ActiveApplication.ApplicationControlProperties.Title[(int)ViewModel.AppHost.Device.System.State.DesiredTitleLanguage].NameString.ToString();
|
||||||
|
|
||||||
await new CheatWindow(Window.VirtualFileSystem, ViewModel.AppHost.Device.Processes.ActiveApplication.ProgramIdText, name).ShowDialog(Window);
|
await new CheatWindow(
|
||||||
|
Window.VirtualFileSystem,
|
||||||
|
ViewModel.AppHost.Device.Processes.ActiveApplication.ProgramIdText,
|
||||||
|
name,
|
||||||
|
Window.ViewModel.SelectedApplication.Path).ShowDialog(Window);
|
||||||
|
|
||||||
ViewModel.AppHost.Device.EnableCheats();
|
ViewModel.AppHost.Device.EnableCheats();
|
||||||
}
|
}
|
||||||
|
@@ -21,23 +21,52 @@
|
|||||||
</Window.Styles>
|
</Window.Styles>
|
||||||
<Grid Name="CheatGrid" Margin="15">
|
<Grid Name="CheatGrid" Margin="15">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
|
Grid.Column="0"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
MaxWidth="500"
|
MaxWidth="500"
|
||||||
Margin="20,15,20,20"
|
Margin="20,15,20,5"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
LineHeight="18"
|
LineHeight="18"
|
||||||
Text="{Binding Heading}"
|
Text="{Binding Heading}"
|
||||||
TextAlignment="Center"
|
TextAlignment="Center"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
<Border
|
<TextBlock
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
|
Grid.Column="0"
|
||||||
|
MaxWidth="500"
|
||||||
|
Margin="140,15,20,5"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
LineHeight="30"
|
||||||
|
Text="{locale:Locale BuildId}"
|
||||||
|
TextAlignment="Center"
|
||||||
|
TextWrapping="Wrap" />
|
||||||
|
<TextBox
|
||||||
|
Grid.Row="2"
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="0,5,110,5"
|
||||||
|
MinWidth="160"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Text="{Binding BuildId}"
|
||||||
|
IsReadOnly="True" />
|
||||||
|
<Border
|
||||||
|
Grid.Row="3"
|
||||||
|
Grid.Column="0"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
Margin="5"
|
Margin="5"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
@@ -81,7 +110,9 @@
|
|||||||
</TreeView>
|
</TreeView>
|
||||||
</Border>
|
</Border>
|
||||||
<DockPanel
|
<DockPanel
|
||||||
Grid.Row="3"
|
Grid.Row="4"
|
||||||
|
Grid.Column="0"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
Margin="0"
|
Margin="0"
|
||||||
HorizontalAlignment="Stretch">
|
HorizontalAlignment="Stretch">
|
||||||
<DockPanel Margin="0" HorizontalAlignment="Right">
|
<DockPanel Margin="0" HorizontalAlignment="Right">
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
using Avalonia.Collections;
|
using Avalonia;
|
||||||
|
using Avalonia.Collections;
|
||||||
using Ryujinx.Ava.Common.Locale;
|
using Ryujinx.Ava.Common.Locale;
|
||||||
using Ryujinx.Ava.UI.Models;
|
using Ryujinx.Ava.UI.Models;
|
||||||
using Ryujinx.HLE.FileSystem;
|
using Ryujinx.HLE.FileSystem;
|
||||||
using Ryujinx.HLE.HOS;
|
using Ryujinx.HLE.HOS;
|
||||||
|
using Ryujinx.Ui.App.Common;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -17,6 +19,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
private AvaloniaList<CheatsList> LoadedCheats { get; }
|
private AvaloniaList<CheatsList> LoadedCheats { get; }
|
||||||
|
|
||||||
public string Heading { get; }
|
public string Heading { get; }
|
||||||
|
public string BuildId { get; }
|
||||||
|
|
||||||
public CheatWindow()
|
public CheatWindow()
|
||||||
{
|
{
|
||||||
@@ -27,12 +30,13 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.CheatWindowTitle];
|
Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.CheatWindowTitle];
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheatWindow(VirtualFileSystem virtualFileSystem, string titleId, string titleName)
|
public CheatWindow(VirtualFileSystem virtualFileSystem, string titleId, string titleName, string titlePath)
|
||||||
{
|
{
|
||||||
LoadedCheats = new AvaloniaList<CheatsList>();
|
LoadedCheats = new AvaloniaList<CheatsList>();
|
||||||
|
|
||||||
Heading = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.CheatWindowHeading, titleName, titleId.ToUpper());
|
Heading = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.CheatWindowHeading, titleName, titleId.ToUpper());
|
||||||
|
BuildId = ApplicationData.GetApplicationBuildId(virtualFileSystem, titlePath);
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
string modsBasePath = ModLoader.GetModsBasePath();
|
string modsBasePath = ModLoader.GetModsBasePath();
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
using ARMeilleure.Memory;
|
using ARMeilleure.Memory;
|
||||||
using Ryujinx.Cpu.Tracking;
|
|
||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
using Ryujinx.Memory.Range;
|
using Ryujinx.Memory.Range;
|
||||||
using Ryujinx.Memory.Tracking;
|
using Ryujinx.Memory.Tracking;
|
||||||
@@ -822,21 +821,21 @@ namespace Ryujinx.Cpu.AppleHv
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public CpuRegionHandle BeginTracking(ulong address, ulong size, int id)
|
public RegionHandle BeginTracking(ulong address, ulong size, int id)
|
||||||
{
|
{
|
||||||
return new CpuRegionHandle(Tracking.BeginTracking(address, size, id));
|
return Tracking.BeginTracking(address, size, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public CpuMultiRegionHandle BeginGranularTracking(ulong address, ulong size, IEnumerable<IRegionHandle> handles, ulong granularity, int id)
|
public MultiRegionHandle BeginGranularTracking(ulong address, ulong size, IEnumerable<IRegionHandle> handles, ulong granularity, int id)
|
||||||
{
|
{
|
||||||
return new CpuMultiRegionHandle(Tracking.BeginGranularTracking(address, size, handles, granularity, id));
|
return Tracking.BeginGranularTracking(address, size, handles, granularity, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public CpuSmartMultiRegionHandle BeginSmartGranularTracking(ulong address, ulong size, ulong granularity, int id)
|
public SmartMultiRegionHandle BeginSmartGranularTracking(ulong address, ulong size, ulong granularity, int id)
|
||||||
{
|
{
|
||||||
return new CpuSmartMultiRegionHandle(Tracking.BeginSmartGranularTracking(address, size, granularity, id));
|
return Tracking.BeginSmartGranularTracking(address, size, granularity, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
using Ryujinx.Cpu.Tracking;
|
using Ryujinx.Memory;
|
||||||
using Ryujinx.Memory;
|
|
||||||
using Ryujinx.Memory.Tracking;
|
using Ryujinx.Memory.Tracking;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -30,7 +29,7 @@ namespace Ryujinx.Cpu
|
|||||||
/// <param name="size">Size of the region</param>
|
/// <param name="size">Size of the region</param>
|
||||||
/// <param name="id">Handle ID</param>
|
/// <param name="id">Handle ID</param>
|
||||||
/// <returns>The memory tracking handle</returns>
|
/// <returns>The memory tracking handle</returns>
|
||||||
CpuRegionHandle BeginTracking(ulong address, ulong size, int id);
|
RegionHandle BeginTracking(ulong address, ulong size, int id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Obtains a memory tracking handle for the given virtual region, with a specified granularity. This should be disposed when finished with.
|
/// Obtains a memory tracking handle for the given virtual region, with a specified granularity. This should be disposed when finished with.
|
||||||
@@ -41,7 +40,7 @@ namespace Ryujinx.Cpu
|
|||||||
/// <param name="granularity">Desired granularity of write tracking</param>
|
/// <param name="granularity">Desired granularity of write tracking</param>
|
||||||
/// <param name="id">Handle ID</param>
|
/// <param name="id">Handle ID</param>
|
||||||
/// <returns>The memory tracking handle</returns>
|
/// <returns>The memory tracking handle</returns>
|
||||||
CpuMultiRegionHandle BeginGranularTracking(ulong address, ulong size, IEnumerable<IRegionHandle> handles, ulong granularity, int id);
|
MultiRegionHandle BeginGranularTracking(ulong address, ulong size, IEnumerable<IRegionHandle> handles, ulong granularity, int id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Obtains a smart memory tracking handle for the given virtual region, with a specified granularity. This should be disposed when finished with.
|
/// Obtains a smart memory tracking handle for the given virtual region, with a specified granularity. This should be disposed when finished with.
|
||||||
@@ -51,6 +50,6 @@ namespace Ryujinx.Cpu
|
|||||||
/// <param name="granularity">Desired granularity of write tracking</param>
|
/// <param name="granularity">Desired granularity of write tracking</param>
|
||||||
/// <param name="id">Handle ID</param>
|
/// <param name="id">Handle ID</param>
|
||||||
/// <returns>The memory tracking handle</returns>
|
/// <returns>The memory tracking handle</returns>
|
||||||
CpuSmartMultiRegionHandle BeginSmartGranularTracking(ulong address, ulong size, ulong granularity, int id);
|
SmartMultiRegionHandle BeginSmartGranularTracking(ulong address, ulong size, ulong granularity, int id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
using ARMeilleure.Memory;
|
using ARMeilleure.Memory;
|
||||||
using Ryujinx.Cpu.Tracking;
|
|
||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
using Ryujinx.Memory.Range;
|
using Ryujinx.Memory.Range;
|
||||||
using Ryujinx.Memory.Tracking;
|
using Ryujinx.Memory.Tracking;
|
||||||
@@ -629,21 +628,21 @@ namespace Ryujinx.Cpu.Jit
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public CpuRegionHandle BeginTracking(ulong address, ulong size, int id)
|
public RegionHandle BeginTracking(ulong address, ulong size, int id)
|
||||||
{
|
{
|
||||||
return new CpuRegionHandle(Tracking.BeginTracking(address, size, id));
|
return Tracking.BeginTracking(address, size, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public CpuMultiRegionHandle BeginGranularTracking(ulong address, ulong size, IEnumerable<IRegionHandle> handles, ulong granularity, int id)
|
public MultiRegionHandle BeginGranularTracking(ulong address, ulong size, IEnumerable<IRegionHandle> handles, ulong granularity, int id)
|
||||||
{
|
{
|
||||||
return new CpuMultiRegionHandle(Tracking.BeginGranularTracking(address, size, handles, granularity, id));
|
return Tracking.BeginGranularTracking(address, size, handles, granularity, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public CpuSmartMultiRegionHandle BeginSmartGranularTracking(ulong address, ulong size, ulong granularity, int id)
|
public SmartMultiRegionHandle BeginSmartGranularTracking(ulong address, ulong size, ulong granularity, int id)
|
||||||
{
|
{
|
||||||
return new CpuSmartMultiRegionHandle(Tracking.BeginSmartGranularTracking(address, size, granularity, id));
|
return Tracking.BeginSmartGranularTracking(address, size, granularity, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
using ARMeilleure.Memory;
|
using ARMeilleure.Memory;
|
||||||
using Ryujinx.Cpu.Tracking;
|
|
||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
using Ryujinx.Memory.Range;
|
using Ryujinx.Memory.Range;
|
||||||
using Ryujinx.Memory.Tracking;
|
using Ryujinx.Memory.Tracking;
|
||||||
@@ -706,21 +705,21 @@ namespace Ryujinx.Cpu.Jit
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public CpuRegionHandle BeginTracking(ulong address, ulong size, int id)
|
public RegionHandle BeginTracking(ulong address, ulong size, int id)
|
||||||
{
|
{
|
||||||
return new CpuRegionHandle(Tracking.BeginTracking(address, size, id));
|
return Tracking.BeginTracking(address, size, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public CpuMultiRegionHandle BeginGranularTracking(ulong address, ulong size, IEnumerable<IRegionHandle> handles, ulong granularity, int id)
|
public MultiRegionHandle BeginGranularTracking(ulong address, ulong size, IEnumerable<IRegionHandle> handles, ulong granularity, int id)
|
||||||
{
|
{
|
||||||
return new CpuMultiRegionHandle(Tracking.BeginGranularTracking(address, size, handles, granularity, id));
|
return Tracking.BeginGranularTracking(address, size, handles, granularity, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public CpuSmartMultiRegionHandle BeginSmartGranularTracking(ulong address, ulong size, ulong granularity, int id)
|
public SmartMultiRegionHandle BeginSmartGranularTracking(ulong address, ulong size, ulong granularity, int id)
|
||||||
{
|
{
|
||||||
return new CpuSmartMultiRegionHandle(Tracking.BeginSmartGranularTracking(address, size, granularity, id));
|
return Tracking.BeginSmartGranularTracking(address, size, granularity, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@@ -1,28 +0,0 @@
|
|||||||
using Ryujinx.Memory.Tracking;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Ryujinx.Cpu.Tracking
|
|
||||||
{
|
|
||||||
public class CpuMultiRegionHandle : IMultiRegionHandle
|
|
||||||
{
|
|
||||||
private readonly MultiRegionHandle _impl;
|
|
||||||
|
|
||||||
public bool Dirty => _impl.Dirty;
|
|
||||||
|
|
||||||
internal CpuMultiRegionHandle(MultiRegionHandle impl)
|
|
||||||
{
|
|
||||||
_impl = impl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose() => _impl.Dispose();
|
|
||||||
public void ForceDirty(ulong address, ulong size) => _impl.ForceDirty(address, size);
|
|
||||||
public IEnumerable<IRegionHandle> GetHandles() => _impl.GetHandles();
|
|
||||||
public void QueryModified(Action<ulong, ulong> modifiedAction) => _impl.QueryModified(modifiedAction);
|
|
||||||
public void QueryModified(ulong address, ulong size, Action<ulong, ulong> modifiedAction) => _impl.QueryModified(address, size, modifiedAction);
|
|
||||||
public void QueryModified(ulong address, ulong size, Action<ulong, ulong> modifiedAction, int sequenceNumber) => _impl.QueryModified(address, size, modifiedAction, sequenceNumber);
|
|
||||||
public void RegisterAction(ulong address, ulong size, RegionSignal action) => _impl.RegisterAction(address, size, action);
|
|
||||||
public void RegisterPreciseAction(ulong address, ulong size, PreciseRegionSignal action) => _impl.RegisterPreciseAction(address, size, action);
|
|
||||||
public void SignalWrite() => _impl.SignalWrite();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,37 +0,0 @@
|
|||||||
using Ryujinx.Memory.Tracking;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Ryujinx.Cpu.Tracking
|
|
||||||
{
|
|
||||||
public class CpuRegionHandle : IRegionHandle
|
|
||||||
{
|
|
||||||
private readonly RegionHandle _impl;
|
|
||||||
|
|
||||||
public bool Dirty => _impl.Dirty;
|
|
||||||
public bool Unmapped => _impl.Unmapped;
|
|
||||||
public ulong Address => _impl.Address;
|
|
||||||
public ulong Size => _impl.Size;
|
|
||||||
public ulong EndAddress => _impl.EndAddress;
|
|
||||||
|
|
||||||
internal CpuRegionHandle(RegionHandle impl)
|
|
||||||
{
|
|
||||||
_impl = impl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose() => _impl.Dispose();
|
|
||||||
public bool DirtyOrVolatile() => _impl.DirtyOrVolatile();
|
|
||||||
public void ForceDirty() => _impl.ForceDirty();
|
|
||||||
public IRegionHandle GetHandle() => _impl;
|
|
||||||
public void RegisterAction(RegionSignal action) => _impl.RegisterAction(action);
|
|
||||||
public void RegisterPreciseAction(PreciseRegionSignal action) => _impl.RegisterPreciseAction(action);
|
|
||||||
public void RegisterDirtyEvent(Action action) => _impl.RegisterDirtyEvent(action);
|
|
||||||
public void Reprotect(bool asDirty = false) => _impl.Reprotect(asDirty);
|
|
||||||
|
|
||||||
public bool OverlapsWith(ulong address, ulong size) => _impl.OverlapsWith(address, size);
|
|
||||||
|
|
||||||
public bool RangeEquals(CpuRegionHandle other)
|
|
||||||
{
|
|
||||||
return _impl.RealAddress == other._impl.RealAddress && _impl.RealSize == other._impl.RealSize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,26 +0,0 @@
|
|||||||
using Ryujinx.Memory.Tracking;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Ryujinx.Cpu.Tracking
|
|
||||||
{
|
|
||||||
public class CpuSmartMultiRegionHandle : IMultiRegionHandle
|
|
||||||
{
|
|
||||||
private readonly SmartMultiRegionHandle _impl;
|
|
||||||
|
|
||||||
public bool Dirty => _impl.Dirty;
|
|
||||||
|
|
||||||
internal CpuSmartMultiRegionHandle(SmartMultiRegionHandle impl)
|
|
||||||
{
|
|
||||||
_impl = impl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose() => _impl.Dispose();
|
|
||||||
public void ForceDirty(ulong address, ulong size) => _impl.ForceDirty(address, size);
|
|
||||||
public void RegisterAction(RegionSignal action) => _impl.RegisterAction(action);
|
|
||||||
public void RegisterPreciseAction(PreciseRegionSignal action) => _impl.RegisterPreciseAction(action);
|
|
||||||
public void QueryModified(Action<ulong, ulong> modifiedAction) => _impl.QueryModified(modifiedAction);
|
|
||||||
public void QueryModified(ulong address, ulong size, Action<ulong, ulong> modifiedAction) => _impl.QueryModified(address, size, modifiedAction);
|
|
||||||
public void QueryModified(ulong address, ulong size, Action<ulong, ulong> modifiedAction, int sequenceNumber) => _impl.QueryModified(address, size, modifiedAction, sequenceNumber);
|
|
||||||
public void SignalWrite() => _impl.SignalWrite();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,5 +1,5 @@
|
|||||||
using Ryujinx.Cpu.Tracking;
|
|
||||||
using Ryujinx.Graphics.Gpu.Memory;
|
using Ryujinx.Graphics.Gpu.Memory;
|
||||||
|
using Ryujinx.Memory.Tracking;
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ulong Size { get; }
|
public ulong Size { get; }
|
||||||
|
|
||||||
private readonly CpuMultiRegionHandle _memoryTracking;
|
private readonly MultiRegionHandle _memoryTracking;
|
||||||
private readonly Action<ulong, ulong> _modifiedDelegate;
|
private readonly Action<ulong, ulong> _modifiedDelegate;
|
||||||
|
|
||||||
private int _modifiedSequenceOffset;
|
private int _modifiedSequenceOffset;
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
using Ryujinx.Common.Memory;
|
using Ryujinx.Common.Memory;
|
||||||
using Ryujinx.Cpu.Tracking;
|
|
||||||
using Ryujinx.Graphics.GAL;
|
using Ryujinx.Graphics.GAL;
|
||||||
using Ryujinx.Graphics.Gpu.Memory;
|
using Ryujinx.Graphics.Gpu.Memory;
|
||||||
using Ryujinx.Graphics.Texture;
|
using Ryujinx.Graphics.Texture;
|
||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
using Ryujinx.Memory.Range;
|
using Ryujinx.Memory.Range;
|
||||||
|
using Ryujinx.Memory.Tracking;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
@@ -255,7 +255,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
{
|
{
|
||||||
TextureGroupHandle group = _handles[baseHandle + i];
|
TextureGroupHandle group = _handles[baseHandle + i];
|
||||||
|
|
||||||
foreach (CpuRegionHandle handle in group.Handles)
|
foreach (RegionHandle handle in group.Handles)
|
||||||
{
|
{
|
||||||
if (handle.Dirty)
|
if (handle.Dirty)
|
||||||
{
|
{
|
||||||
@@ -296,7 +296,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
bool handleDirty = false;
|
bool handleDirty = false;
|
||||||
bool handleUnmapped = false;
|
bool handleUnmapped = false;
|
||||||
|
|
||||||
foreach (CpuRegionHandle handle in group.Handles)
|
foreach (RegionHandle handle in group.Handles)
|
||||||
{
|
{
|
||||||
if (handle.Dirty)
|
if (handle.Dirty)
|
||||||
{
|
{
|
||||||
@@ -703,7 +703,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
/// <param name="group">The group to register an action for</param>
|
/// <param name="group">The group to register an action for</param>
|
||||||
public void RegisterAction(TextureGroupHandle group)
|
public void RegisterAction(TextureGroupHandle group)
|
||||||
{
|
{
|
||||||
foreach (CpuRegionHandle handle in group.Handles)
|
foreach (RegionHandle handle in group.Handles)
|
||||||
{
|
{
|
||||||
handle.RegisterAction((address, size) => FlushAction(group, address, size));
|
handle.RegisterAction((address, size) => FlushAction(group, address, size));
|
||||||
}
|
}
|
||||||
@@ -985,7 +985,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
/// <param name="address">The start address of the tracked region</param>
|
/// <param name="address">The start address of the tracked region</param>
|
||||||
/// <param name="size">The size of the tracked region</param>
|
/// <param name="size">The size of the tracked region</param>
|
||||||
/// <returns>A CpuRegionHandle covering the given range</returns>
|
/// <returns>A CpuRegionHandle covering the given range</returns>
|
||||||
private CpuRegionHandle GenerateHandle(ulong address, ulong size)
|
private RegionHandle GenerateHandle(ulong address, ulong size)
|
||||||
{
|
{
|
||||||
return _physicalMemory.BeginTracking(address, size, ResourceKind.Texture);
|
return _physicalMemory.BeginTracking(address, size, ResourceKind.Texture);
|
||||||
}
|
}
|
||||||
@@ -1005,7 +1005,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
int endOffset = _allOffsets[viewEnd] + _sliceSizes[lastLevel];
|
int endOffset = _allOffsets[viewEnd] + _sliceSizes[lastLevel];
|
||||||
int size = endOffset - offset;
|
int size = endOffset - offset;
|
||||||
|
|
||||||
var result = new List<CpuRegionHandle>();
|
var result = new List<RegionHandle>();
|
||||||
|
|
||||||
for (int i = 0; i < TextureRange.Count; i++)
|
for (int i = 0; i < TextureRange.Count; i++)
|
||||||
{
|
{
|
||||||
@@ -1050,7 +1050,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
views,
|
views,
|
||||||
result.ToArray());
|
result.ToArray());
|
||||||
|
|
||||||
foreach (CpuRegionHandle handle in result)
|
foreach (RegionHandle handle in result)
|
||||||
{
|
{
|
||||||
handle.RegisterDirtyEvent(() => DirtyAction(groupHandle));
|
handle.RegisterDirtyEvent(() => DirtyAction(groupHandle));
|
||||||
}
|
}
|
||||||
@@ -1248,7 +1248,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (CpuRegionHandle handle in groupHandle.Handles)
|
foreach (RegionHandle handle in groupHandle.Handles)
|
||||||
{
|
{
|
||||||
bool hasMatch = false;
|
bool hasMatch = false;
|
||||||
|
|
||||||
@@ -1270,7 +1270,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (CpuRegionHandle handle in groupHandle.Handles)
|
foreach (RegionHandle handle in groupHandle.Handles)
|
||||||
{
|
{
|
||||||
handle.Reprotect();
|
handle.Reprotect();
|
||||||
}
|
}
|
||||||
@@ -1303,7 +1303,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
if (!(_hasMipViews || _hasLayerViews))
|
if (!(_hasMipViews || _hasLayerViews))
|
||||||
{
|
{
|
||||||
// Single dirty region.
|
// Single dirty region.
|
||||||
var cpuRegionHandles = new CpuRegionHandle[TextureRange.Count];
|
var cpuRegionHandles = new RegionHandle[TextureRange.Count];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for (int i = 0; i < TextureRange.Count; i++)
|
for (int i = 0; i < TextureRange.Count; i++)
|
||||||
@@ -1322,7 +1322,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
|
|
||||||
var groupHandle = new TextureGroupHandle(this, 0, Storage.Size, _views, 0, 0, 0, _allOffsets.Length, cpuRegionHandles);
|
var groupHandle = new TextureGroupHandle(this, 0, Storage.Size, _views, 0, 0, 0, _allOffsets.Length, cpuRegionHandles);
|
||||||
|
|
||||||
foreach (CpuRegionHandle handle in cpuRegionHandles)
|
foreach (RegionHandle handle in cpuRegionHandles)
|
||||||
{
|
{
|
||||||
handle.RegisterDirtyEvent(() => DirtyAction(groupHandle));
|
handle.RegisterDirtyEvent(() => DirtyAction(groupHandle));
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
using Ryujinx.Cpu.Tracking;
|
using Ryujinx.Graphics.Gpu.Synchronization;
|
||||||
using Ryujinx.Graphics.Gpu.Synchronization;
|
using Ryujinx.Memory.Tracking;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -85,7 +85,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The CPU memory tracking handles that cover this handle.
|
/// The CPU memory tracking handles that cover this handle.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public CpuRegionHandle[] Handles { get; }
|
public RegionHandle[] Handles { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// True if a texture overlapping this handle has been modified. Is set false when the flush action is called.
|
/// True if a texture overlapping this handle has been modified. Is set false when the flush action is called.
|
||||||
@@ -127,7 +127,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
int firstLevel,
|
int firstLevel,
|
||||||
int baseSlice,
|
int baseSlice,
|
||||||
int sliceCount,
|
int sliceCount,
|
||||||
CpuRegionHandle[] handles)
|
RegionHandle[] handles)
|
||||||
{
|
{
|
||||||
_group = group;
|
_group = group;
|
||||||
_firstLayer = firstLayer;
|
_firstLayer = firstLayer;
|
||||||
@@ -642,7 +642,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
foreach (CpuRegionHandle handle in Handles)
|
foreach (RegionHandle handle in Handles)
|
||||||
{
|
{
|
||||||
handle.Dispose();
|
handle.Dispose();
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
using Ryujinx.Cpu.Tracking;
|
|
||||||
using Ryujinx.Graphics.GAL;
|
using Ryujinx.Graphics.GAL;
|
||||||
using Ryujinx.Graphics.Gpu.Synchronization;
|
using Ryujinx.Graphics.Gpu.Synchronization;
|
||||||
using Ryujinx.Memory.Range;
|
using Ryujinx.Memory.Range;
|
||||||
@@ -54,8 +53,8 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
private BufferModifiedRangeList _modifiedRanges = null;
|
private BufferModifiedRangeList _modifiedRanges = null;
|
||||||
|
|
||||||
private readonly CpuMultiRegionHandle _memoryTrackingGranular;
|
private readonly MultiRegionHandle _memoryTrackingGranular;
|
||||||
private readonly CpuRegionHandle _memoryTracking;
|
private readonly RegionHandle _memoryTracking;
|
||||||
|
|
||||||
private readonly RegionSignal _externalFlushDelegate;
|
private readonly RegionSignal _externalFlushDelegate;
|
||||||
private readonly Action<ulong, ulong> _loadDelegate;
|
private readonly Action<ulong, ulong> _loadDelegate;
|
||||||
@@ -102,7 +101,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return Enumerable.Repeat(buffer._memoryTracking.GetHandle(), 1);
|
return Enumerable.Repeat(buffer._memoryTracking, 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
using Ryujinx.Cpu.Tracking;
|
using Ryujinx.Memory.Tracking;
|
||||||
using Ryujinx.Memory.Tracking;
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.Graphics.Gpu.Memory
|
namespace Ryujinx.Graphics.Gpu.Memory
|
||||||
@@ -9,7 +8,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
class GpuRegionHandle : IRegionHandle
|
class GpuRegionHandle : IRegionHandle
|
||||||
{
|
{
|
||||||
private readonly CpuRegionHandle[] _cpuRegionHandles;
|
private readonly RegionHandle[] _cpuRegionHandles;
|
||||||
|
|
||||||
public bool Dirty
|
public bool Dirty
|
||||||
{
|
{
|
||||||
@@ -35,7 +34,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||||||
/// Create a new GpuRegionHandle, made up of mulitple CpuRegionHandles.
|
/// Create a new GpuRegionHandle, made up of mulitple CpuRegionHandles.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cpuRegionHandles">The CpuRegionHandles that make up this handle</param>
|
/// <param name="cpuRegionHandles">The CpuRegionHandles that make up this handle</param>
|
||||||
public GpuRegionHandle(CpuRegionHandle[] cpuRegionHandles)
|
public GpuRegionHandle(RegionHandle[] cpuRegionHandles)
|
||||||
{
|
{
|
||||||
_cpuRegionHandles = cpuRegionHandles;
|
_cpuRegionHandles = cpuRegionHandles;
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
using Ryujinx.Cpu;
|
using Ryujinx.Cpu;
|
||||||
using Ryujinx.Cpu.Tracking;
|
|
||||||
using Ryujinx.Graphics.Gpu.Image;
|
using Ryujinx.Graphics.Gpu.Image;
|
||||||
using Ryujinx.Graphics.Gpu.Shader;
|
using Ryujinx.Graphics.Gpu.Shader;
|
||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
@@ -348,7 +347,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||||||
/// <param name="size">Size of the region</param>
|
/// <param name="size">Size of the region</param>
|
||||||
/// <param name="kind">Kind of the resource being tracked</param>
|
/// <param name="kind">Kind of the resource being tracked</param>
|
||||||
/// <returns>The memory tracking handle</returns>
|
/// <returns>The memory tracking handle</returns>
|
||||||
public CpuRegionHandle BeginTracking(ulong address, ulong size, ResourceKind kind)
|
public RegionHandle BeginTracking(ulong address, ulong size, ResourceKind kind)
|
||||||
{
|
{
|
||||||
return _cpuMemory.BeginTracking(address, size, (int)kind);
|
return _cpuMemory.BeginTracking(address, size, (int)kind);
|
||||||
}
|
}
|
||||||
@@ -361,7 +360,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||||||
/// <returns>The memory tracking handle</returns>
|
/// <returns>The memory tracking handle</returns>
|
||||||
public GpuRegionHandle BeginTracking(MultiRange range, ResourceKind kind)
|
public GpuRegionHandle BeginTracking(MultiRange range, ResourceKind kind)
|
||||||
{
|
{
|
||||||
var cpuRegionHandles = new CpuRegionHandle[range.Count];
|
var cpuRegionHandles = new RegionHandle[range.Count];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for (int i = 0; i < range.Count; i++)
|
for (int i = 0; i < range.Count; i++)
|
||||||
@@ -390,7 +389,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||||||
/// <param name="handles">Handles to inherit state from or reuse</param>
|
/// <param name="handles">Handles to inherit state from or reuse</param>
|
||||||
/// <param name="granularity">Desired granularity of write tracking</param>
|
/// <param name="granularity">Desired granularity of write tracking</param>
|
||||||
/// <returns>The memory tracking handle</returns>
|
/// <returns>The memory tracking handle</returns>
|
||||||
public CpuMultiRegionHandle BeginGranularTracking(ulong address, ulong size, ResourceKind kind, IEnumerable<IRegionHandle> handles = null, ulong granularity = 4096)
|
public MultiRegionHandle BeginGranularTracking(ulong address, ulong size, ResourceKind kind, IEnumerable<IRegionHandle> handles = null, ulong granularity = 4096)
|
||||||
{
|
{
|
||||||
return _cpuMemory.BeginGranularTracking(address, size, handles, granularity, (int)kind);
|
return _cpuMemory.BeginGranularTracking(address, size, handles, granularity, (int)kind);
|
||||||
}
|
}
|
||||||
@@ -403,7 +402,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||||||
/// <param name="kind">Kind of the resource being tracked</param>
|
/// <param name="kind">Kind of the resource being tracked</param>
|
||||||
/// <param name="granularity">Desired granularity of write tracking</param>
|
/// <param name="granularity">Desired granularity of write tracking</param>
|
||||||
/// <returns>The memory tracking handle</returns>
|
/// <returns>The memory tracking handle</returns>
|
||||||
public CpuSmartMultiRegionHandle BeginSmartGranularTracking(ulong address, ulong size, ResourceKind kind, ulong granularity = 4096)
|
public SmartMultiRegionHandle BeginSmartGranularTracking(ulong address, ulong size, ResourceKind kind, ulong granularity = 4096)
|
||||||
{
|
{
|
||||||
return _cpuMemory.BeginSmartGranularTracking(address, size, granularity, (int)kind);
|
return _cpuMemory.BeginSmartGranularTracking(address, size, granularity, (int)kind);
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
|||||||
private const ushort FileFormatVersionMajor = 1;
|
private const ushort FileFormatVersionMajor = 1;
|
||||||
private const ushort FileFormatVersionMinor = 2;
|
private const ushort FileFormatVersionMinor = 2;
|
||||||
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
|
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
|
||||||
private const uint CodeGenVersion = 2237;
|
private const uint CodeGenVersion = 4821;
|
||||||
|
|
||||||
private const string SharedTocFileName = "shared.toc";
|
private const string SharedTocFileName = "shared.toc";
|
||||||
private const string SharedDataFileName = "shared.data";
|
private const string SharedDataFileName = "shared.data";
|
||||||
|
@@ -299,10 +299,13 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
|||||||
|
|
||||||
if (_programList.Count != 0)
|
if (_programList.Count != 0)
|
||||||
{
|
{
|
||||||
|
_stateChangeCallback(ShaderCacheState.Packaging, 0, _programList.Count);
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.Gpu, $"Rebuilding {_programList.Count} shaders...");
|
Logger.Info?.Print(LogClass.Gpu, $"Rebuilding {_programList.Count} shaders...");
|
||||||
|
|
||||||
using var streams = _hostStorage.GetOutputStreams(_context);
|
using var streams = _hostStorage.GetOutputStreams(_context);
|
||||||
|
|
||||||
|
int packagedShaders = 0;
|
||||||
foreach (var kv in _programList)
|
foreach (var kv in _programList)
|
||||||
{
|
{
|
||||||
if (!Active)
|
if (!Active)
|
||||||
@@ -311,7 +314,10 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
|||||||
}
|
}
|
||||||
|
|
||||||
(CachedShaderProgram program, byte[] binaryCode) = kv.Value;
|
(CachedShaderProgram program, byte[] binaryCode) = kv.Value;
|
||||||
|
|
||||||
_hostStorage.AddShader(_context, program, binaryCode, streams);
|
_hostStorage.AddShader(_context, program, binaryCode, streams);
|
||||||
|
|
||||||
|
_stateChangeCallback(ShaderCacheState.Packaging, ++packagedShaders, _programList.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.Gpu, $"Rebuilt {_programList.Count} shaders successfully.");
|
Logger.Info?.Print(LogClass.Gpu, $"Rebuilt {_programList.Count} shaders successfully.");
|
||||||
|
@@ -7,6 +7,8 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||||||
Start,
|
Start,
|
||||||
/// <summary>Shader cache is loading</summary>
|
/// <summary>Shader cache is loading</summary>
|
||||||
Loading,
|
Loading,
|
||||||
|
/// <summary>Shader cache is written to disk</summary>
|
||||||
|
Packaging,
|
||||||
/// <summary>Shader cache finished loading</summary>
|
/// <summary>Shader cache finished loading</summary>
|
||||||
Loaded
|
Loaded
|
||||||
}
|
}
|
||||||
|
@@ -161,12 +161,12 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
|||||||
Operand addrLow,
|
Operand addrLow,
|
||||||
bool isStg16Or8)
|
bool isStg16Or8)
|
||||||
{
|
{
|
||||||
int baseAddressCbOffset = GetStorageCbOffset(config.Stage, storageIndex);
|
(int sbCbSlot, int sbCbOffset) = config.GetSbCbInfo(storageIndex);
|
||||||
|
|
||||||
bool storageAligned = !(config.GpuAccessor.QueryHasUnalignedStorageBuffer() || config.GpuAccessor.QueryHostStorageBufferOffsetAlignment() > Constants.StorageAlignment);
|
bool storageAligned = !(config.GpuAccessor.QueryHasUnalignedStorageBuffer() || config.GpuAccessor.QueryHostStorageBufferOffsetAlignment() > Constants.StorageAlignment);
|
||||||
|
|
||||||
(Operand byteOffset, int constantOffset) = storageAligned ?
|
(Operand byteOffset, int constantOffset) = storageAligned ?
|
||||||
GetStorageOffset(block, Utils.FindLastOperation(addrLow, block), baseAddressCbOffset) :
|
GetStorageOffset(block, Utils.FindLastOperation(addrLow, block), sbCbSlot, sbCbOffset) :
|
||||||
(null, 0);
|
(null, 0);
|
||||||
|
|
||||||
if (byteOffset != null)
|
if (byteOffset != null)
|
||||||
@@ -176,8 +176,6 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
|||||||
|
|
||||||
if (byteOffset == null)
|
if (byteOffset == null)
|
||||||
{
|
{
|
||||||
(int sbCbSlot, int sbCbOffset) = config.GetSbCbInfo(storageIndex);
|
|
||||||
|
|
||||||
Operand baseAddrLow = Cbuf(sbCbSlot, sbCbOffset);
|
Operand baseAddrLow = Cbuf(sbCbSlot, sbCbOffset);
|
||||||
Operand baseAddrTrunc = Local();
|
Operand baseAddrTrunc = Local();
|
||||||
|
|
||||||
@@ -217,9 +215,9 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
|||||||
return wordOffset;
|
return wordOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsCb0Offset(Operand operand, int offset)
|
private static bool IsCbOffset(Operand operand, int slot, int offset)
|
||||||
{
|
{
|
||||||
return operand.Type == OperandType.ConstantBuffer && operand.GetCbufSlot() == 0 && operand.GetCbufOffset() == offset;
|
return operand.Type == OperandType.ConstantBuffer && operand.GetCbufSlot() == slot && operand.GetCbufOffset() == offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ReplaceAddressAlignment(LinkedList<INode> list, Operand address, Operand byteOffset, int constantOffset)
|
private static void ReplaceAddressAlignment(LinkedList<INode> list, Operand address, Operand byteOffset, int constantOffset)
|
||||||
@@ -263,9 +261,9 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static (Operand, int) GetStorageOffset(BasicBlock block, Operand address, int baseAddressCbOffset)
|
private static (Operand, int) GetStorageOffset(BasicBlock block, Operand address, int cbSlot, int baseAddressCbOffset)
|
||||||
{
|
{
|
||||||
if (IsCb0Offset(address, baseAddressCbOffset))
|
if (IsCbOffset(address, cbSlot, baseAddressCbOffset))
|
||||||
{
|
{
|
||||||
// Direct offset: zero.
|
// Direct offset: zero.
|
||||||
return (Const(0), 0);
|
return (Const(0), 0);
|
||||||
@@ -275,7 +273,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
|||||||
|
|
||||||
address = Utils.FindLastOperation(address, block);
|
address = Utils.FindLastOperation(address, block);
|
||||||
|
|
||||||
if (IsCb0Offset(address, baseAddressCbOffset))
|
if (IsCbOffset(address, cbSlot, baseAddressCbOffset))
|
||||||
{
|
{
|
||||||
// Only constant offset
|
// Only constant offset
|
||||||
return (Const(0), constantOffset);
|
return (Const(0), constantOffset);
|
||||||
@@ -289,11 +287,11 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
|||||||
Operand src1 = offsetAdd.GetSource(0);
|
Operand src1 = offsetAdd.GetSource(0);
|
||||||
Operand src2 = Utils.FindLastOperation(offsetAdd.GetSource(1), block);
|
Operand src2 = Utils.FindLastOperation(offsetAdd.GetSource(1), block);
|
||||||
|
|
||||||
if (IsCb0Offset(src2, baseAddressCbOffset))
|
if (IsCbOffset(src2, cbSlot, baseAddressCbOffset))
|
||||||
{
|
{
|
||||||
return (src1, constantOffset);
|
return (src1, constantOffset);
|
||||||
}
|
}
|
||||||
else if (IsCb0Offset(src1, baseAddressCbOffset))
|
else if (IsCbOffset(src1, cbSlot, baseAddressCbOffset))
|
||||||
{
|
{
|
||||||
return (src2, constantOffset);
|
return (src2, constantOffset);
|
||||||
}
|
}
|
||||||
|
@@ -200,9 +200,10 @@ namespace Ryujinx.HLE.HOS
|
|||||||
|
|
||||||
LibHacHorizonManager = device.Configuration.LibHacHorizonManager;
|
LibHacHorizonManager = device.Configuration.LibHacHorizonManager;
|
||||||
|
|
||||||
|
// We hardcode a clock source id to avoid it changing between each start.
|
||||||
// TODO: use set:sys (and get external clock source id from settings)
|
// TODO: use set:sys (and get external clock source id from settings)
|
||||||
// TODO: use "time!standard_steady_clock_rtc_update_interval_minutes" and implement a worker thread to be accurate.
|
// TODO: use "time!standard_steady_clock_rtc_update_interval_minutes" and implement a worker thread to be accurate.
|
||||||
UInt128 clockSourceId = UInt128Utils.CreateRandom();
|
UInt128 clockSourceId = new UInt128(0x36a0328702ce8bc1, 0x1608eaba02333284);
|
||||||
IRtcManager.GetExternalRtcValue(out ulong rtcValue);
|
IRtcManager.GetExternalRtcValue(out ulong rtcValue);
|
||||||
|
|
||||||
// We assume the rtc is system time.
|
// We assume the rtc is system time.
|
||||||
@@ -222,22 +223,22 @@ namespace Ryujinx.HLE.HOS
|
|||||||
internalOffset = internalOffset.AddSeconds(-3600L);
|
internalOffset = internalOffset.AddSeconds(-3600L);
|
||||||
}
|
}
|
||||||
|
|
||||||
internalOffset = new TimeSpanType(-internalOffset.NanoSeconds);
|
systemTime = new TimeSpanType(systemTime.NanoSeconds + internalOffset.NanoSeconds);
|
||||||
|
|
||||||
// First init the standard steady clock
|
// First init the standard steady clock
|
||||||
TimeServiceManager.Instance.SetupStandardSteadyClock(TickSource, clockSourceId, systemTime, internalOffset, TimeSpanType.Zero, false);
|
TimeServiceManager.Instance.SetupStandardSteadyClock(TickSource, clockSourceId, TimeSpanType.Zero, TimeSpanType.Zero, TimeSpanType.Zero, false);
|
||||||
TimeServiceManager.Instance.SetupStandardLocalSystemClock(TickSource, new SystemClockContext(), systemTime.ToSeconds());
|
TimeServiceManager.Instance.SetupStandardLocalSystemClock(TickSource, new SystemClockContext(), systemTime.ToSeconds());
|
||||||
|
TimeServiceManager.Instance.StandardLocalSystemClock.GetClockContext(TickSource, out SystemClockContext localSytemClockContext);
|
||||||
|
|
||||||
if (NxSettings.Settings.TryGetValue("time!standard_network_clock_sufficient_accuracy_minutes", out object standardNetworkClockSufficientAccuracyMinutes))
|
if (NxSettings.Settings.TryGetValue("time!standard_network_clock_sufficient_accuracy_minutes", out object standardNetworkClockSufficientAccuracyMinutes))
|
||||||
{
|
{
|
||||||
TimeSpanType standardNetworkClockSufficientAccuracy = new TimeSpanType((int)standardNetworkClockSufficientAccuracyMinutes * 60000000000);
|
TimeSpanType standardNetworkClockSufficientAccuracy = new TimeSpanType((int)standardNetworkClockSufficientAccuracyMinutes * 60000000000);
|
||||||
|
|
||||||
// The network system clock needs a valid system clock, as such we setup this system clock using the local system clock.
|
// The network system clock needs a valid system clock, as such we setup this system clock using the local system clock.
|
||||||
TimeServiceManager.Instance.StandardLocalSystemClock.GetClockContext(TickSource, out SystemClockContext localSytemClockContext);
|
|
||||||
TimeServiceManager.Instance.SetupStandardNetworkSystemClock(localSytemClockContext, standardNetworkClockSufficientAccuracy);
|
TimeServiceManager.Instance.SetupStandardNetworkSystemClock(localSytemClockContext, standardNetworkClockSufficientAccuracy);
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeServiceManager.Instance.SetupStandardUserSystemClock(TickSource, false, SteadyClockTimePoint.GetRandom());
|
TimeServiceManager.Instance.SetupStandardUserSystemClock(TickSource, true, localSytemClockContext.SteadyTimePoint);
|
||||||
|
|
||||||
// FIXME: TimeZone should be init here but it's actually done in ContentManager
|
// FIXME: TimeZone should be init here but it's actually done in ContentManager
|
||||||
|
|
||||||
|
@@ -92,6 +92,15 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService
|
|||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[CommandCmif(23)]
|
||||||
|
// GetAppletCommonFunctions() -> object<nn::am::service::IAppletCommonFunctions>
|
||||||
|
public ResultCode GetAppletCommonFunctions(ServiceCtx context)
|
||||||
|
{
|
||||||
|
MakeObject(context, new IAppletCommonFunctions());
|
||||||
|
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
|
|
||||||
[CommandCmif(1000)]
|
[CommandCmif(1000)]
|
||||||
// GetDebugFunctions() -> object<nn::am::service::IDebugFunctions>
|
// GetDebugFunctions() -> object<nn::am::service::IDebugFunctions>
|
||||||
public ResultCode GetDebugFunctions(ServiceCtx context)
|
public ResultCode GetDebugFunctions(ServiceCtx context)
|
||||||
|
@@ -9,8 +9,10 @@ using System;
|
|||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
|
||||||
{
|
{
|
||||||
class ICommonStateGetter : IpcService
|
class ICommonStateGetter : DisposableIpcService
|
||||||
{
|
{
|
||||||
|
private readonly ServiceCtx _context;
|
||||||
|
|
||||||
private Apm.ManagerServer _apmManagerServer;
|
private Apm.ManagerServer _apmManagerServer;
|
||||||
private Apm.SystemManagerServer _apmSystemManagerServer;
|
private Apm.SystemManagerServer _apmSystemManagerServer;
|
||||||
private Lbl.LblControllerServer _lblControllerServer;
|
private Lbl.LblControllerServer _lblControllerServer;
|
||||||
@@ -23,11 +25,18 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
private int _messageEventHandle;
|
private int _messageEventHandle;
|
||||||
private int _displayResolutionChangedEventHandle;
|
private int _displayResolutionChangedEventHandle;
|
||||||
|
|
||||||
|
private KEvent _acquiredSleepLockEvent;
|
||||||
|
private int _acquiredSleepLockEventHandle;
|
||||||
|
|
||||||
public ICommonStateGetter(ServiceCtx context)
|
public ICommonStateGetter(ServiceCtx context)
|
||||||
{
|
{
|
||||||
|
_context = context;
|
||||||
|
|
||||||
_apmManagerServer = new Apm.ManagerServer(context);
|
_apmManagerServer = new Apm.ManagerServer(context);
|
||||||
_apmSystemManagerServer = new Apm.SystemManagerServer(context);
|
_apmSystemManagerServer = new Apm.SystemManagerServer(context);
|
||||||
_lblControllerServer = new Lbl.LblControllerServer(context);
|
_lblControllerServer = new Lbl.LblControllerServer(context);
|
||||||
|
|
||||||
|
_acquiredSleepLockEvent = new KEvent(context.Device.System.KernelContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandCmif(0)]
|
[CommandCmif(0)]
|
||||||
@@ -117,6 +126,34 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[CommandCmif(10)]
|
||||||
|
// RequestToAcquireSleepLock()
|
||||||
|
public ResultCode RequestToAcquireSleepLock(ServiceCtx context)
|
||||||
|
{
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceAm);
|
||||||
|
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CommandCmif(13)]
|
||||||
|
// GetAcquiredSleepLockEvent() -> handle<copy>
|
||||||
|
public ResultCode GetAcquiredSleepLockEvent(ServiceCtx context)
|
||||||
|
{
|
||||||
|
if (_acquiredSleepLockEventHandle == 0)
|
||||||
|
{
|
||||||
|
if (context.Process.HandleTable.GenerateHandle(_acquiredSleepLockEvent.ReadableEvent, out _acquiredSleepLockEventHandle) != Result.Success)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Out of handles!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_acquiredSleepLockEventHandle);
|
||||||
|
|
||||||
|
Logger.Stub?.PrintStub(LogClass.ServiceAm);
|
||||||
|
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
|
|
||||||
[CommandCmif(50)] // 3.0.0+
|
[CommandCmif(50)] // 3.0.0+
|
||||||
// IsVrModeEnabled() -> b8
|
// IsVrModeEnabled() -> b8
|
||||||
public ResultCode IsVrModeEnabled(ServiceCtx context)
|
public ResultCode IsVrModeEnabled(ServiceCtx context)
|
||||||
@@ -281,5 +318,17 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
if (isDisposing)
|
||||||
|
{
|
||||||
|
if (_acquiredSleepLockEventHandle != 0)
|
||||||
|
{
|
||||||
|
_context.Process.HandleTable.CloseHandle(_acquiredSleepLockEventHandle);
|
||||||
|
_acquiredSleepLockEventHandle = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -0,0 +1,13 @@
|
|||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Time.Clock.Types
|
||||||
|
{
|
||||||
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
|
struct ContinuousAdjustmentTimePoint
|
||||||
|
{
|
||||||
|
public ulong ClockOffset;
|
||||||
|
public long Multiplier;
|
||||||
|
public long DivisorLog2;
|
||||||
|
public SystemClockContext Context;
|
||||||
|
}
|
||||||
|
}
|
@@ -1,8 +1,8 @@
|
|||||||
using Ryujinx.Cpu;
|
using Ryujinx.Cpu;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Memory;
|
using Ryujinx.HLE.HOS.Kernel.Memory;
|
||||||
using Ryujinx.HLE.HOS.Services.Time.Clock;
|
using Ryujinx.HLE.HOS.Services.Time.Clock;
|
||||||
|
using Ryujinx.HLE.HOS.Services.Time.Clock.Types;
|
||||||
using Ryujinx.HLE.HOS.Services.Time.Types;
|
using Ryujinx.HLE.HOS.Services.Time.Types;
|
||||||
using Ryujinx.HLE.Utilities;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@@ -16,10 +16,11 @@ namespace Ryujinx.HLE.HOS.Services.Time
|
|||||||
private SharedMemoryStorage _timeSharedMemoryStorage;
|
private SharedMemoryStorage _timeSharedMemoryStorage;
|
||||||
private int _timeSharedMemorySize;
|
private int _timeSharedMemorySize;
|
||||||
|
|
||||||
private const uint SteadyClockContextOffset = 0x00;
|
private const uint SteadyClockContextOffset = 0x00;
|
||||||
private const uint LocalSystemClockContextOffset = 0x38;
|
private const uint LocalSystemClockContextOffset = 0x38;
|
||||||
private const uint NetworkSystemClockContextOffset = 0x80;
|
private const uint NetworkSystemClockContextOffset = 0x80;
|
||||||
private const uint AutomaticCorrectionEnabledOffset = 0xC8;
|
private const uint AutomaticCorrectionEnabledOffset = 0xC8;
|
||||||
|
private const uint ContinuousAdjustmentTimePointOffset = 0xD0;
|
||||||
|
|
||||||
public void Initialize(Switch device, KSharedMemory sharedMemory, SharedMemoryStorage timeSharedMemoryStorage, int timeSharedMemorySize)
|
public void Initialize(Switch device, KSharedMemory sharedMemory, SharedMemoryStorage timeSharedMemoryStorage, int timeSharedMemorySize)
|
||||||
{
|
{
|
||||||
@@ -39,15 +40,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
|
|||||||
|
|
||||||
public void SetupStandardSteadyClock(ITickSource tickSource, UInt128 clockSourceId, TimeSpanType currentTimePoint)
|
public void SetupStandardSteadyClock(ITickSource tickSource, UInt128 clockSourceId, TimeSpanType currentTimePoint)
|
||||||
{
|
{
|
||||||
TimeSpanType ticksTimeSpan = TimeSpanType.FromTicks(tickSource.Counter, tickSource.Frequency);
|
UpdateSteadyClock(tickSource, clockSourceId, currentTimePoint);
|
||||||
|
|
||||||
SteadyClockContext context = new SteadyClockContext
|
|
||||||
{
|
|
||||||
InternalOffset = (ulong)(currentTimePoint.NanoSeconds - ticksTimeSpan.NanoSeconds),
|
|
||||||
ClockSourceId = clockSourceId
|
|
||||||
};
|
|
||||||
|
|
||||||
WriteObjectToSharedMemory(SteadyClockContextOffset, 4, context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAutomaticCorrectionEnabled(bool isAutomaticCorrectionEnabled)
|
public void SetAutomaticCorrectionEnabled(bool isAutomaticCorrectionEnabled)
|
||||||
@@ -58,10 +51,38 @@ namespace Ryujinx.HLE.HOS.Services.Time
|
|||||||
|
|
||||||
public void SetSteadyClockRawTimePoint(ITickSource tickSource, TimeSpanType currentTimePoint)
|
public void SetSteadyClockRawTimePoint(ITickSource tickSource, TimeSpanType currentTimePoint)
|
||||||
{
|
{
|
||||||
SteadyClockContext context = ReadObjectFromSharedMemory<SteadyClockContext>(SteadyClockContextOffset, 4);
|
SteadyClockContext context = ReadObjectFromSharedMemory<SteadyClockContext>(SteadyClockContextOffset, 4);
|
||||||
TimeSpanType ticksTimeSpan = TimeSpanType.FromTicks(tickSource.Counter, tickSource.Frequency);
|
|
||||||
|
|
||||||
context.InternalOffset = (ulong)(currentTimePoint.NanoSeconds - ticksTimeSpan.NanoSeconds);
|
UpdateSteadyClock(tickSource, context.ClockSourceId, currentTimePoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateSteadyClock(ITickSource tickSource, UInt128 clockSourceId, TimeSpanType currentTimePoint)
|
||||||
|
{
|
||||||
|
TimeSpanType ticksTimeSpan = TimeSpanType.FromTicks(tickSource.Counter, tickSource.Frequency);
|
||||||
|
|
||||||
|
ContinuousAdjustmentTimePoint adjustmentTimePoint = new ContinuousAdjustmentTimePoint
|
||||||
|
{
|
||||||
|
ClockOffset = (ulong)ticksTimeSpan.NanoSeconds,
|
||||||
|
Multiplier = 1,
|
||||||
|
DivisorLog2 = 0,
|
||||||
|
Context = new SystemClockContext
|
||||||
|
{
|
||||||
|
Offset = 0,
|
||||||
|
SteadyTimePoint = new SteadyClockTimePoint
|
||||||
|
{
|
||||||
|
ClockSourceId = clockSourceId,
|
||||||
|
TimePoint = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
WriteObjectToSharedMemory(ContinuousAdjustmentTimePointOffset, 4, adjustmentTimePoint);
|
||||||
|
|
||||||
|
SteadyClockContext context = new SteadyClockContext
|
||||||
|
{
|
||||||
|
InternalOffset = (ulong)(currentTimePoint.NanoSeconds - ticksTimeSpan.NanoSeconds),
|
||||||
|
ClockSourceId = clockSourceId
|
||||||
|
};
|
||||||
|
|
||||||
WriteObjectToSharedMemory(SteadyClockContextOffset, 4, context);
|
WriteObjectToSharedMemory(SteadyClockContextOffset, 4, context);
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,7 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace Ryujinx.HLE.Loaders.Processes
|
namespace Ryujinx.HLE.Loaders.Processes
|
||||||
{
|
{
|
||||||
public struct ProcessResult
|
public class ProcessResult
|
||||||
{
|
{
|
||||||
public static ProcessResult Failed => new(null, new ApplicationControlProperty(), false, false, null, 0, 0, 0, TitleLanguage.AmericanEnglish);
|
public static ProcessResult Failed => new(null, new ApplicationControlProperty(), false, false, null, 0, 0, 0, TitleLanguage.AmericanEnglish);
|
||||||
|
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection.Metadata;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace Ryujinx.Memory.Tracking
|
namespace Ryujinx.Memory.Tracking
|
||||||
@@ -443,6 +444,16 @@ namespace Ryujinx.Memory.Tracking
|
|||||||
return Address < address + size && address < EndAddress;
|
return Address < address + size && address < EndAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines if this handle's memory range matches another exactly.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="other">The other handle</param>
|
||||||
|
/// <returns>True on a match, false otherwise</returns>
|
||||||
|
public bool RangeEquals(RegionHandle other)
|
||||||
|
{
|
||||||
|
return RealAddress == other.RealAddress && RealSize == other.RealSize;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Dispose the handle. Within the tracking lock, this removes references from virtual regions.
|
/// Dispose the handle. Within the tracking lock, this removes references from virtual regions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -1,5 +1,16 @@
|
|||||||
using LibHac.Common;
|
using LibHac.Common;
|
||||||
using LibHac.Ns;
|
using LibHac.Ns;
|
||||||
|
using LibHac.Fs;
|
||||||
|
using LibHac.Fs.Fsa;
|
||||||
|
using LibHac.FsSystem;
|
||||||
|
using LibHac.Loader;
|
||||||
|
using LibHac.Tools.Fs;
|
||||||
|
using LibHac.Tools.FsSystem;
|
||||||
|
using LibHac.Tools.FsSystem.NcaUtils;
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
|
using Ryujinx.HLE.FileSystem;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace Ryujinx.Ui.App.Common
|
namespace Ryujinx.Ui.App.Common
|
||||||
{
|
{
|
||||||
@@ -19,5 +30,122 @@ namespace Ryujinx.Ui.App.Common
|
|||||||
public double FileSizeBytes { get; set; }
|
public double FileSizeBytes { get; set; }
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
public BlitStruct<ApplicationControlProperty> ControlHolder { get; set; }
|
public BlitStruct<ApplicationControlProperty> ControlHolder { get; set; }
|
||||||
|
|
||||||
|
public static string GetApplicationBuildId(VirtualFileSystem virtualFileSystem, string titleFilePath)
|
||||||
|
{
|
||||||
|
using FileStream file = new(titleFilePath, FileMode.Open, FileAccess.Read);
|
||||||
|
|
||||||
|
Nca mainNca = null;
|
||||||
|
Nca patchNca = null;
|
||||||
|
|
||||||
|
if (!System.IO.Path.Exists(titleFilePath))
|
||||||
|
{
|
||||||
|
Logger.Error?.Print(LogClass.Application, $"File does not exists. {titleFilePath}");
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
string extension = System.IO.Path.GetExtension(titleFilePath).ToLower();
|
||||||
|
|
||||||
|
if (extension is ".nsp" or ".xci")
|
||||||
|
{
|
||||||
|
PartitionFileSystem pfs;
|
||||||
|
|
||||||
|
if (extension == ".xci")
|
||||||
|
{
|
||||||
|
Xci xci = new(virtualFileSystem.KeySet, file.AsStorage());
|
||||||
|
|
||||||
|
pfs = xci.OpenPartition(XciPartitionType.Secure);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pfs = new PartitionFileSystem(file.AsStorage());
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (DirectoryEntryEx fileEntry in pfs.EnumerateEntries("/", "*.nca"))
|
||||||
|
{
|
||||||
|
using var ncaFile = new UniqueRef<IFile>();
|
||||||
|
|
||||||
|
pfs.OpenFile(ref ncaFile.Ref, fileEntry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||||
|
|
||||||
|
Nca nca = new(virtualFileSystem.KeySet, ncaFile.Get.AsStorage());
|
||||||
|
|
||||||
|
if (nca.Header.ContentType != NcaContentType.Program)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int dataIndex = Nca.GetSectionIndexFromType(NcaSectionType.Data, NcaContentType.Program);
|
||||||
|
|
||||||
|
if (nca.Header.GetFsHeader(dataIndex).IsPatchSection())
|
||||||
|
{
|
||||||
|
patchNca = nca;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainNca = nca;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (extension == ".nca")
|
||||||
|
{
|
||||||
|
mainNca = new Nca(virtualFileSystem.KeySet, file.AsStorage());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mainNca == null)
|
||||||
|
{
|
||||||
|
Logger.Error?.Print(LogClass.Application, "Extraction failure. The main NCA was not present in the selected file");
|
||||||
|
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
(Nca updatePatchNca, _) = ApplicationLibrary.GetGameUpdateData(virtualFileSystem, mainNca.Header.TitleId.ToString("x16"), 0, out _);
|
||||||
|
|
||||||
|
if (updatePatchNca != null)
|
||||||
|
{
|
||||||
|
patchNca = updatePatchNca;
|
||||||
|
}
|
||||||
|
|
||||||
|
IFileSystem codeFs = null;
|
||||||
|
|
||||||
|
if (patchNca == null)
|
||||||
|
{
|
||||||
|
if (mainNca.CanOpenSection(NcaSectionType.Code))
|
||||||
|
{
|
||||||
|
codeFs = mainNca.OpenFileSystem(NcaSectionType.Code, IntegrityCheckLevel.ErrorOnInvalid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (patchNca.CanOpenSection(NcaSectionType.Code))
|
||||||
|
{
|
||||||
|
codeFs = mainNca.OpenFileSystemWithPatch(patchNca, NcaSectionType.Code, IntegrityCheckLevel.ErrorOnInvalid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (codeFs == null)
|
||||||
|
{
|
||||||
|
Logger.Error?.Print(LogClass.Loader, "No ExeFS found in NCA");
|
||||||
|
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
const string mainExeFs = "main";
|
||||||
|
|
||||||
|
if (!codeFs.FileExists($"/{mainExeFs}"))
|
||||||
|
{
|
||||||
|
Logger.Error?.Print(LogClass.Loader, "No main binary ExeFS found in ExeFS");
|
||||||
|
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
using var nsoFile = new UniqueRef<IFile>();
|
||||||
|
|
||||||
|
codeFs.OpenFile(ref nsoFile.Ref, $"/{mainExeFs}".ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||||
|
|
||||||
|
NsoReader reader = new NsoReader();
|
||||||
|
reader.Initialize(nsoFile.Release().AsStorage().AsFile(OpenMode.Read)).ThrowIfFailure();
|
||||||
|
|
||||||
|
return BitConverter.ToString(reader.Header.ModuleId.ItemsRo.ToArray()).Replace("-", "").ToUpper()[..16];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1626,9 +1626,12 @@ namespace Ryujinx.Ui
|
|||||||
|
|
||||||
private void ManageCheats_Pressed(object sender, EventArgs args)
|
private void ManageCheats_Pressed(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
var window = new CheatWindow(_virtualFileSystem,
|
var window = new CheatWindow(
|
||||||
_emulationContext.Processes.ActiveApplication.ProgramId,
|
_virtualFileSystem,
|
||||||
_emulationContext.Processes.ActiveApplication.ApplicationControlProperties.Title[(int)_emulationContext.System.State.DesiredTitleLanguage].NameString.ToString());
|
_emulationContext.Processes.ActiveApplication.ProgramId,
|
||||||
|
_emulationContext.Processes.ActiveApplication.ApplicationControlProperties
|
||||||
|
.Title[(int)_emulationContext.System.State.DesiredTitleLanguage].NameString.ToString(),
|
||||||
|
_currentEmulatedGamePath);
|
||||||
|
|
||||||
window.Destroyed += CheatWindow_Destroyed;
|
window.Destroyed += CheatWindow_Destroyed;
|
||||||
window.Show();
|
window.Show();
|
||||||
|
@@ -270,8 +270,14 @@ namespace Ryujinx.Ui.Widgets
|
|||||||
|
|
||||||
int index = Nca.GetSectionIndexFromType(ncaSectionType, mainNca.Header.ContentType);
|
int index = Nca.GetSectionIndexFromType(ncaSectionType, mainNca.Header.ContentType);
|
||||||
|
|
||||||
IFileSystem ncaFileSystem = patchNca != null ? mainNca.OpenFileSystemWithPatch(patchNca, index, IntegrityCheckLevel.ErrorOnInvalid)
|
bool sectionExistsInPatch = false;
|
||||||
: mainNca.OpenFileSystem(index, IntegrityCheckLevel.ErrorOnInvalid);
|
if (patchNca != null)
|
||||||
|
{
|
||||||
|
sectionExistsInPatch = patchNca.CanOpenSection(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
IFileSystem ncaFileSystem = sectionExistsInPatch ? mainNca.OpenFileSystemWithPatch(patchNca, index, IntegrityCheckLevel.ErrorOnInvalid)
|
||||||
|
: mainNca.OpenFileSystem(index, IntegrityCheckLevel.ErrorOnInvalid);
|
||||||
|
|
||||||
FileSystemClient fsClient = _horizonClient.Fs;
|
FileSystemClient fsClient = _horizonClient.Fs;
|
||||||
|
|
||||||
@@ -455,7 +461,7 @@ namespace Ryujinx.Ui.Widgets
|
|||||||
|
|
||||||
private void ManageCheats_Clicked(object sender, EventArgs args)
|
private void ManageCheats_Clicked(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
new CheatWindow(_virtualFileSystem, _titleId, _titleName).Show();
|
new CheatWindow(_virtualFileSystem, _titleId, _titleName, _titleFilePath).Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OpenTitleModDir_Clicked(object sender, EventArgs args)
|
private void OpenTitleModDir_Clicked(object sender, EventArgs args)
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
using Gtk;
|
using Gtk;
|
||||||
using Ryujinx.HLE.FileSystem;
|
using Ryujinx.HLE.FileSystem;
|
||||||
using Ryujinx.HLE.HOS;
|
using Ryujinx.HLE.HOS;
|
||||||
|
using Ryujinx.Ui.App.Common;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -17,16 +18,18 @@ namespace Ryujinx.Ui.Windows
|
|||||||
|
|
||||||
#pragma warning disable CS0649, IDE0044
|
#pragma warning disable CS0649, IDE0044
|
||||||
[GUI] Label _baseTitleInfoLabel;
|
[GUI] Label _baseTitleInfoLabel;
|
||||||
|
[GUI] TextView _buildIdTextView;
|
||||||
[GUI] TreeView _cheatTreeView;
|
[GUI] TreeView _cheatTreeView;
|
||||||
[GUI] Button _saveButton;
|
[GUI] Button _saveButton;
|
||||||
#pragma warning restore CS0649, IDE0044
|
#pragma warning restore CS0649, IDE0044
|
||||||
|
|
||||||
public CheatWindow(VirtualFileSystem virtualFileSystem, ulong titleId, string titleName) : this(new Builder("Ryujinx.Ui.Windows.CheatWindow.glade"), virtualFileSystem, titleId, titleName) { }
|
public CheatWindow(VirtualFileSystem virtualFileSystem, ulong titleId, string titleName, string titlePath) : this(new Builder("Ryujinx.Ui.Windows.CheatWindow.glade"), virtualFileSystem, titleId, titleName, titlePath) { }
|
||||||
|
|
||||||
private CheatWindow(Builder builder, VirtualFileSystem virtualFileSystem, ulong titleId, string titleName) : base(builder.GetRawOwnedObject("_cheatWindow"))
|
private CheatWindow(Builder builder, VirtualFileSystem virtualFileSystem, ulong titleId, string titleName, string titlePath) : base(builder.GetRawOwnedObject("_cheatWindow"))
|
||||||
{
|
{
|
||||||
builder.Autoconnect(this);
|
builder.Autoconnect(this);
|
||||||
_baseTitleInfoLabel.Text = $"Cheats Available for {titleName} [{titleId:X16}]";
|
_baseTitleInfoLabel.Text = $"Cheats Available for {titleName} [{titleId:X16}]";
|
||||||
|
_buildIdTextView.Buffer.Text = $"BuildId: {ApplicationData.GetApplicationBuildId(virtualFileSystem, titlePath)}";
|
||||||
|
|
||||||
string modsBasePath = ModLoader.GetModsBasePath();
|
string modsBasePath = ModLoader.GetModsBasePath();
|
||||||
string titleModsPath = ModLoader.GetTitleDir(modsBasePath, titleId.ToString("X16"));
|
string titleModsPath = ModLoader.GetTitleDir(modsBasePath, titleId.ToString("X16"));
|
||||||
|
@@ -31,6 +31,21 @@
|
|||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTextView" id="_buildIdTextView">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="margin_top">10</property>
|
||||||
|
<property name="halign">center</property>
|
||||||
|
<property name="margin_bottom">10</property>
|
||||||
|
<property name="editable">False</property>
|
||||||
|
<property name="cursor_visible">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkScrolledWindow">
|
<object class="GtkScrolledWindow">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@@ -57,7 +72,7 @@
|
|||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">1</property>
|
<property name="position">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
Reference in New Issue
Block a user