mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2025-01-09 14:41:59 +00:00
misc: Forgot about ReactiveObject
This commit is contained in:
parent
f463ea1c5d
commit
cbd851d00e
6 changed files with 16 additions and 29 deletions
|
@ -8,10 +8,10 @@ namespace Ryujinx.Common
|
||||||
public static class StreamExtensions
|
public static class StreamExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes a <see cref="ReadOnlySpan{int}" /> to this stream.
|
/// Writes an int span to this stream.
|
||||||
///
|
///
|
||||||
/// This default implementation converts each buffer value to a stack-allocated
|
/// This default implementation converts each buffer value to a stack-allocated
|
||||||
/// byte array, then writes it to the Stream using <cref="System.Stream.Write(byte[])" />.
|
/// byte array, then writes it to the Stream using <see cref="Stream.Write(ReadOnlySpan{byte})" />.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="stream">The stream to be written to</param>
|
/// <param name="stream">The stream to be written to</param>
|
||||||
/// <param name="buffer">The buffer of values to be written</param>
|
/// <param name="buffer">The buffer of values to be written</param>
|
||||||
|
|
|
@ -8,20 +8,7 @@ namespace Ryujinx.Common
|
||||||
{
|
{
|
||||||
public static class TitleIDs
|
public static class TitleIDs
|
||||||
{
|
{
|
||||||
private static string _currentApplication;
|
public static ReactiveObject<Optional<string>> CurrentApplication { get; set; } = new();
|
||||||
|
|
||||||
public static Optional<string> CurrentApplication
|
|
||||||
{
|
|
||||||
get => _currentApplication;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_currentApplication = value.OrElse(null);
|
|
||||||
|
|
||||||
CurrentApplicationChanged?.Invoke(_currentApplication);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static event Action<Optional<string>> CurrentApplicationChanged;
|
|
||||||
|
|
||||||
public static GraphicsBackend SelectGraphicsBackend(string titleId, GraphicsBackend currentBackend)
|
public static GraphicsBackend SelectGraphicsBackend(string titleId, GraphicsBackend currentBackend)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
|
||||||
using var region = context.Memory.GetWritableRegion(bufferAddress, (int)bufferLen, true);
|
using var region = context.Memory.GetWritableRegion(bufferAddress, (int)bufferLen, true);
|
||||||
Result result = _baseStorage.Get.Read((long)offset, new OutBuffer(region.Memory.Span), (long)size);
|
Result result = _baseStorage.Get.Read((long)offset, new OutBuffer(region.Memory.Span), (long)size);
|
||||||
|
|
||||||
if (context.Device.DirtyHacks.HasFlag(DirtyHacks.Xc2MenuSoftlockFix) && TitleIDs.CurrentApplication == Xc2TitleId)
|
if (context.Device.DirtyHacks.HasFlag(DirtyHacks.Xc2MenuSoftlockFix) && TitleIDs.CurrentApplication.Value == Xc2TitleId)
|
||||||
{
|
{
|
||||||
// Add a load-bearing sleep to avoid XC2 softlock
|
// Add a load-bearing sleep to avoid XC2 softlock
|
||||||
// https://web.archive.org/web/20240728045136/https://github.com/Ryujinx/Ryujinx/issues/2357
|
// https://web.archive.org/web/20240728045136/https://github.com/Ryujinx/Ryujinx/issues/2357
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace Ryujinx.HLE.Loaders.Processes
|
||||||
{
|
{
|
||||||
_latestPid = processResult.ProcessId;
|
_latestPid = processResult.ProcessId;
|
||||||
|
|
||||||
TitleIDs.CurrentApplication = processResult.ProgramIdText;
|
TitleIDs.CurrentApplication.Value = processResult.ProgramIdText;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ namespace Ryujinx.HLE.Loaders.Processes
|
||||||
{
|
{
|
||||||
_latestPid = processResult.ProcessId;
|
_latestPid = processResult.ProcessId;
|
||||||
|
|
||||||
TitleIDs.CurrentApplication = processResult.ProgramIdText;
|
TitleIDs.CurrentApplication.Value = processResult.ProgramIdText;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ namespace Ryujinx.HLE.Loaders.Processes
|
||||||
{
|
{
|
||||||
_latestPid = processResult.ProcessId;
|
_latestPid = processResult.ProcessId;
|
||||||
|
|
||||||
TitleIDs.CurrentApplication = processResult.ProgramIdText;
|
TitleIDs.CurrentApplication.Value = processResult.ProgramIdText;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -140,7 +140,7 @@ namespace Ryujinx.HLE.Loaders.Processes
|
||||||
{
|
{
|
||||||
_latestPid = processResult.ProcessId;
|
_latestPid = processResult.ProcessId;
|
||||||
|
|
||||||
TitleIDs.CurrentApplication = processResult.ProgramIdText;
|
TitleIDs.CurrentApplication.Value = processResult.ProgramIdText;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -193,17 +193,17 @@ namespace Ryujinx.HLE.Loaders.Processes
|
||||||
if (nacpData.Value.PresenceGroupId != 0)
|
if (nacpData.Value.PresenceGroupId != 0)
|
||||||
{
|
{
|
||||||
programId = nacpData.Value.PresenceGroupId;
|
programId = nacpData.Value.PresenceGroupId;
|
||||||
TitleIDs.CurrentApplication = programId.ToString("X16");
|
TitleIDs.CurrentApplication.Value = programId.ToString("X16");
|
||||||
}
|
}
|
||||||
else if (nacpData.Value.SaveDataOwnerId != 0)
|
else if (nacpData.Value.SaveDataOwnerId != 0)
|
||||||
{
|
{
|
||||||
programId = nacpData.Value.SaveDataOwnerId;
|
programId = nacpData.Value.SaveDataOwnerId;
|
||||||
TitleIDs.CurrentApplication = programId.ToString("X16");
|
TitleIDs.CurrentApplication.Value = programId.ToString("X16");
|
||||||
}
|
}
|
||||||
else if (nacpData.Value.AddOnContentBaseId != 0)
|
else if (nacpData.Value.AddOnContentBaseId != 0)
|
||||||
{
|
{
|
||||||
programId = nacpData.Value.AddOnContentBaseId - 0x1000;
|
programId = nacpData.Value.AddOnContentBaseId - 0x1000;
|
||||||
TitleIDs.CurrentApplication = programId.ToString("X16");
|
TitleIDs.CurrentApplication.Value = programId.ToString("X16");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ namespace Ryujinx.HLE
|
||||||
FileSystem.Dispose();
|
FileSystem.Dispose();
|
||||||
Memory.Dispose();
|
Memory.Dispose();
|
||||||
|
|
||||||
TitleIDs.CurrentApplication = null;
|
TitleIDs.CurrentApplication.Value = null;
|
||||||
Shared = null;
|
Shared = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,11 +45,11 @@ namespace Ryujinx.UI.Common
|
||||||
};
|
};
|
||||||
|
|
||||||
ConfigurationState.Instance.EnableDiscordIntegration.Event += Update;
|
ConfigurationState.Instance.EnableDiscordIntegration.Event += Update;
|
||||||
TitleIDs.CurrentApplicationChanged += titleId =>
|
TitleIDs.CurrentApplication.Event += (_, e) =>
|
||||||
{
|
{
|
||||||
if (titleId)
|
if (e.NewValue)
|
||||||
SwitchToPlayingState(
|
SwitchToPlayingState(
|
||||||
ApplicationLibrary.LoadAndSaveMetaData(titleId),
|
ApplicationLibrary.LoadAndSaveMetaData(e.NewValue),
|
||||||
Switch.Shared.Processes.ActiveApplication
|
Switch.Shared.Processes.ActiveApplication
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue