diff --git a/src/Ryujinx.Common/Extensions/StreamExtensions.cs b/src/Ryujinx.Common/Extensions/StreamExtensions.cs
index 4b02781c9..59ff44edc 100644
--- a/src/Ryujinx.Common/Extensions/StreamExtensions.cs
+++ b/src/Ryujinx.Common/Extensions/StreamExtensions.cs
@@ -8,10 +8,10 @@ namespace Ryujinx.Common
public static class StreamExtensions
{
///
- /// Writes a 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 .
+ /// byte array, then writes it to the Stream using .
///
/// The stream to be written to
/// The buffer of values to be written
diff --git a/src/Ryujinx.Common/TitleIDs.cs b/src/Ryujinx.Common/TitleIDs.cs
index 82a08b24e..31d895051 100644
--- a/src/Ryujinx.Common/TitleIDs.cs
+++ b/src/Ryujinx.Common/TitleIDs.cs
@@ -8,20 +8,7 @@ namespace Ryujinx.Common
{
public static class TitleIDs
{
- private static string _currentApplication;
-
- public static Optional CurrentApplication
- {
- get => _currentApplication;
- set
- {
- _currentApplication = value.OrElse(null);
-
- CurrentApplicationChanged?.Invoke(_currentApplication);
- }
- }
-
- public static event Action> CurrentApplicationChanged;
+ public static ReactiveObject> CurrentApplication { get; set; } = new();
public static GraphicsBackend SelectGraphicsBackend(string titleId, GraphicsBackend currentBackend)
{
diff --git a/src/Ryujinx.HLE/HOS/Services/Fs/FileSystemProxy/IStorage.cs b/src/Ryujinx.HLE/HOS/Services/Fs/FileSystemProxy/IStorage.cs
index 6b542c16a..07ab8b386 100644
--- a/src/Ryujinx.HLE/HOS/Services/Fs/FileSystemProxy/IStorage.cs
+++ b/src/Ryujinx.HLE/HOS/Services/Fs/FileSystemProxy/IStorage.cs
@@ -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
diff --git a/src/Ryujinx.HLE/Loaders/Processes/ProcessLoader.cs b/src/Ryujinx.HLE/Loaders/Processes/ProcessLoader.cs
index 1b90f2707..ebbeb1398 100644
--- a/src/Ryujinx.HLE/Loaders/Processes/ProcessLoader.cs
+++ b/src/Ryujinx.HLE/Loaders/Processes/ProcessLoader.cs
@@ -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");
}
}
diff --git a/src/Ryujinx.HLE/Switch.cs b/src/Ryujinx.HLE/Switch.cs
index f73776eda..c630c71c7 100644
--- a/src/Ryujinx.HLE/Switch.cs
+++ b/src/Ryujinx.HLE/Switch.cs
@@ -151,7 +151,7 @@ namespace Ryujinx.HLE
FileSystem.Dispose();
Memory.Dispose();
- TitleIDs.CurrentApplication = null;
+ TitleIDs.CurrentApplication.Value = null;
Shared = null;
}
}
diff --git a/src/Ryujinx.UI.Common/DiscordIntegrationModule.cs b/src/Ryujinx.UI.Common/DiscordIntegrationModule.cs
index de778a648..efeeb2586 100644
--- a/src/Ryujinx.UI.Common/DiscordIntegrationModule.cs
+++ b/src/Ryujinx.UI.Common/DiscordIntegrationModule.cs
@@ -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();
};