mirror of
https://github.com/GreemDev/Ryujinx
synced 2025-01-02 09:10:03 +01:00
misc: Forgot about ReactiveObject
Some checks are pending
Canary release job / Create tag (push) Waiting to run
Canary release job / Release for linux-arm64 (push) Waiting to run
Canary release job / Release for linux-x64 (push) Waiting to run
Canary release job / Release for win-x64 (push) Waiting to run
Canary release job / Release MacOS universal (push) Waiting to run
Some checks are pending
Canary release job / Create tag (push) Waiting to run
Canary release job / Release for linux-arm64 (push) Waiting to run
Canary release job / Release for linux-x64 (push) Waiting to run
Canary release job / Release for win-x64 (push) Waiting to run
Canary release job / Release MacOS universal (push) Waiting to run
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
|
||||
{
|
||||
/// <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
|
||||
/// 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>
|
||||
/// <param name="stream">The stream to be written to</param>
|
||||
/// <param name="buffer">The buffer of values to be written</param>
|
||||
|
|
|
@ -8,20 +8,7 @@ namespace Ryujinx.Common
|
|||
{
|
||||
public static class TitleIDs
|
||||
{
|
||||
private static string _currentApplication;
|
||||
|
||||
public static Optional<string> CurrentApplication
|
||||
{
|
||||
get => _currentApplication;
|
||||
set
|
||||
{
|
||||
_currentApplication = value.OrElse(null);
|
||||
|
||||
CurrentApplicationChanged?.Invoke(_currentApplication);
|
||||
}
|
||||
}
|
||||
|
||||
public static event Action<Optional<string>> CurrentApplicationChanged;
|
||||
public static ReactiveObject<Optional<string>> CurrentApplication { get; set; } = new();
|
||||
|
||||
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);
|
||||
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
|
||||
// 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;
|
||||
|
||||
TitleIDs.CurrentApplication = processResult.ProgramIdText;
|
||||
TitleIDs.CurrentApplication.Value = processResult.ProgramIdText;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ namespace Ryujinx.HLE.Loaders.Processes
|
|||
{
|
||||
_latestPid = processResult.ProcessId;
|
||||
|
||||
TitleIDs.CurrentApplication = processResult.ProgramIdText;
|
||||
TitleIDs.CurrentApplication.Value = processResult.ProgramIdText;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ namespace Ryujinx.HLE.Loaders.Processes
|
|||
{
|
||||
_latestPid = processResult.ProcessId;
|
||||
|
||||
TitleIDs.CurrentApplication = processResult.ProgramIdText;
|
||||
TitleIDs.CurrentApplication.Value = processResult.ProgramIdText;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -140,7 +140,7 @@ namespace Ryujinx.HLE.Loaders.Processes
|
|||
{
|
||||
_latestPid = processResult.ProcessId;
|
||||
|
||||
TitleIDs.CurrentApplication = processResult.ProgramIdText;
|
||||
TitleIDs.CurrentApplication.Value = processResult.ProgramIdText;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -193,17 +193,17 @@ namespace Ryujinx.HLE.Loaders.Processes
|
|||
if (nacpData.Value.PresenceGroupId != 0)
|
||||
{
|
||||
programId = nacpData.Value.PresenceGroupId;
|
||||
TitleIDs.CurrentApplication = programId.ToString("X16");
|
||||
TitleIDs.CurrentApplication.Value = programId.ToString("X16");
|
||||
}
|
||||
else if (nacpData.Value.SaveDataOwnerId != 0)
|
||||
{
|
||||
programId = nacpData.Value.SaveDataOwnerId;
|
||||
TitleIDs.CurrentApplication = programId.ToString("X16");
|
||||
TitleIDs.CurrentApplication.Value = programId.ToString("X16");
|
||||
}
|
||||
else if (nacpData.Value.AddOnContentBaseId != 0)
|
||||
{
|
||||
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();
|
||||
Memory.Dispose();
|
||||
|
||||
TitleIDs.CurrentApplication = null;
|
||||
TitleIDs.CurrentApplication.Value = null;
|
||||
Shared = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,13 +45,13 @@ namespace Ryujinx.UI.Common
|
|||
};
|
||||
|
||||
ConfigurationState.Instance.EnableDiscordIntegration.Event += Update;
|
||||
TitleIDs.CurrentApplicationChanged += titleId =>
|
||||
TitleIDs.CurrentApplication.Event += (_, e) =>
|
||||
{
|
||||
if (titleId)
|
||||
if (e.NewValue)
|
||||
SwitchToPlayingState(
|
||||
ApplicationLibrary.LoadAndSaveMetaData(titleId),
|
||||
ApplicationLibrary.LoadAndSaveMetaData(e.NewValue),
|
||||
Switch.Shared.Processes.ActiveApplication
|
||||
);
|
||||
);
|
||||
else
|
||||
SwitchToMainState();
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue