hle/ui: Basic multi programs support (#1560)
* hos/gui: Add a check of NCA program index in titleid This add a check to `ApplicationLoader` for the last 2 digits of the game TitleId who seems to be the NCA program index. We currently return the last index, instead of the lower one. Same check is added to ApplicationLibrary in the UI. I've cleaned up both file too. * hle: implement partial relaunch logic TODO: make the emulator auto relauch. * Handle auto relaunch * hle: Unify update usage system * hle: Implement support of multi programs in update system * Add some documentation * Address rip's comment Co-authored-by: Ac_K <Acoustik666@gmail.com>
This commit is contained in:
parent
90ab28d1c6
commit
33f8284bc0
13 changed files with 435 additions and 270 deletions
|
@ -11,6 +11,7 @@ using Ryujinx.Graphics.GAL;
|
|||
using Ryujinx.Graphics.OpenGL;
|
||||
using Ryujinx.HLE.FileSystem;
|
||||
using Ryujinx.HLE.FileSystem.Content;
|
||||
using Ryujinx.HLE.HOS;
|
||||
using Ryujinx.Ui.Diagnostic;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
@ -27,6 +28,7 @@ namespace Ryujinx.Ui
|
|||
{
|
||||
private static VirtualFileSystem _virtualFileSystem;
|
||||
private static ContentManager _contentManager;
|
||||
private static UserChannelPersistence _userChannelPersistence;
|
||||
|
||||
private static WindowsMultimediaTimerResolution _windowsMultimediaTimerResolution;
|
||||
private static HLE.Switch _emulationContext;
|
||||
|
@ -34,12 +36,15 @@ namespace Ryujinx.Ui
|
|||
private static GlRenderer _glWidget;
|
||||
private static GtkHostUiHandler _uiHandler;
|
||||
|
||||
public static GlRenderer GlWidget => _glWidget;
|
||||
|
||||
private static AutoResetEvent _deviceExitStatus = new AutoResetEvent(false);
|
||||
|
||||
private static ListStore _tableStore;
|
||||
|
||||
private static bool _updatingGameTable;
|
||||
private static bool _gameLoaded;
|
||||
private static string _gamePath;
|
||||
private static bool _ending;
|
||||
|
||||
#pragma warning disable CS0169, CS0649, IDE0044
|
||||
|
@ -110,6 +115,7 @@ namespace Ryujinx.Ui
|
|||
}
|
||||
|
||||
_virtualFileSystem = VirtualFileSystem.CreateInstance();
|
||||
_userChannelPersistence = new UserChannelPersistence();
|
||||
_contentManager = new ContentManager(_virtualFileSystem);
|
||||
|
||||
if (migrationNeeded)
|
||||
|
@ -181,6 +187,7 @@ namespace Ryujinx.Ui
|
|||
_statusBar.Hide();
|
||||
|
||||
_uiHandler = new GtkHostUiHandler(this);
|
||||
_gamePath = null;
|
||||
}
|
||||
|
||||
private void MainWindow_WindowStateEvent(object o, WindowStateEventArgs args)
|
||||
|
@ -278,7 +285,7 @@ namespace Ryujinx.Ui
|
|||
{
|
||||
_virtualFileSystem.Reload();
|
||||
|
||||
HLE.Switch instance = new HLE.Switch(_virtualFileSystem, _contentManager, InitializeRenderer(), InitializeAudioEngine())
|
||||
HLE.Switch instance = new HLE.Switch(_virtualFileSystem, _contentManager, _userChannelPersistence, InitializeRenderer(), InitializeAudioEngine())
|
||||
{
|
||||
UiHandler = _uiHandler
|
||||
};
|
||||
|
@ -485,6 +492,7 @@ namespace Ryujinx.Ui
|
|||
}
|
||||
|
||||
_emulationContext = device;
|
||||
_gamePath = path;
|
||||
|
||||
_deviceExitStatus.Reset();
|
||||
|
||||
|
@ -589,6 +597,7 @@ namespace Ryujinx.Ui
|
|||
UpdateGameTable();
|
||||
|
||||
Task.Run(RefreshFirmwareLabel);
|
||||
Task.Run(HandleRelaunch);
|
||||
|
||||
_stopEmulation.Sensitive = false;
|
||||
_firmwareInstallFile.Sensitive = true;
|
||||
|
@ -962,6 +971,21 @@ namespace Ryujinx.Ui
|
|||
}));
|
||||
}
|
||||
|
||||
private void HandleRelaunch()
|
||||
{
|
||||
// If the previous index isn't -1, that mean we are relaunching.
|
||||
if (_userChannelPersistence.PreviousIndex != -1)
|
||||
{
|
||||
LoadApplication(_gamePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise, clear state.
|
||||
_userChannelPersistence = new UserChannelPersistence();
|
||||
_gamePath = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleInstallerDialog(FileChooserDialog fileChooser)
|
||||
{
|
||||
if (fileChooser.Run() == (int)ResponseType.Accept)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue