Fix problems added by Pause (#2645)
* Disable Pause/Resume menu instead of trying to hide them * Fix Resume menu being active before renderer starts * Fix emulator not being able to close properly
This commit is contained in:
parent
d327e809c9
commit
fe9d5a1981
5 changed files with 42 additions and 15 deletions
|
@ -395,6 +395,14 @@ namespace Ryujinx.Audio.Renderer.Server
|
||||||
Logger.Info?.Print(LogClass.AudioRenderer, $"Stopped renderer id {_sessionId}");
|
Logger.Info?.Print(LogClass.AudioRenderer, $"Stopped renderer id {_sessionId}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Disable()
|
||||||
|
{
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
|
_isActive = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ResultCode Update(Memory<byte> output, Memory<byte> performanceOutput, ReadOnlyMemory<byte> input)
|
public ResultCode Update(Memory<byte> output, Memory<byte> performanceOutput, ReadOnlyMemory<byte> input)
|
||||||
{
|
{
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
|
|
|
@ -219,7 +219,21 @@ namespace Ryujinx.Audio.Renderer.Server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void StopSendingCommands()
|
public void StopSendingCommands()
|
||||||
{
|
{
|
||||||
_isRunning = false;
|
lock (_sessionLock)
|
||||||
|
{
|
||||||
|
foreach (AudioRenderSystem renderer in _sessions)
|
||||||
|
{
|
||||||
|
renderer?.Disable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lock (_audioProcessorLock)
|
||||||
|
{
|
||||||
|
if (_isRunning)
|
||||||
|
{
|
||||||
|
StopLocked();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -234,7 +248,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
||||||
{
|
{
|
||||||
lock (_sessionLock)
|
lock (_sessionLock)
|
||||||
{
|
{
|
||||||
foreach(AudioRenderSystem renderer in _sessions)
|
foreach (AudioRenderSystem renderer in _sessions)
|
||||||
{
|
{
|
||||||
renderer?.SendCommands();
|
renderer?.SendCommands();
|
||||||
}
|
}
|
||||||
|
|
|
@ -386,11 +386,15 @@ namespace Ryujinx.HLE.HOS
|
||||||
_isDisposed = true;
|
_isDisposed = true;
|
||||||
|
|
||||||
// "Soft" stops AudioRenderer and AudioManager to avoid some sound between resume and stop.
|
// "Soft" stops AudioRenderer and AudioManager to avoid some sound between resume and stop.
|
||||||
AudioRendererManager.StopSendingCommands();
|
if (IsPaused)
|
||||||
|
{
|
||||||
AudioManager.StopUpdates();
|
AudioManager.StopUpdates();
|
||||||
|
|
||||||
TogglePauseEmulation(false);
|
TogglePauseEmulation(false);
|
||||||
|
|
||||||
|
AudioRendererManager.StopSendingCommands();
|
||||||
|
}
|
||||||
|
|
||||||
KProcess terminationProcess = new KProcess(KernelContext);
|
KProcess terminationProcess = new KProcess(KernelContext);
|
||||||
KThread terminationThread = new KThread(KernelContext);
|
KThread terminationThread = new KThread(KernelContext);
|
||||||
|
|
||||||
|
|
|
@ -214,6 +214,7 @@ namespace Ryujinx.Ui
|
||||||
|
|
||||||
_actionMenu.Sensitive = false;
|
_actionMenu.Sensitive = false;
|
||||||
_pauseEmulation.Sensitive = false;
|
_pauseEmulation.Sensitive = false;
|
||||||
|
_resumeEmulation.Sensitive = false;
|
||||||
|
|
||||||
if (ConfigurationState.Instance.Ui.GuiColumns.FavColumn) _favToggle.Active = true;
|
if (ConfigurationState.Instance.Ui.GuiColumns.FavColumn) _favToggle.Active = true;
|
||||||
if (ConfigurationState.Instance.Ui.GuiColumns.IconColumn) _iconToggle.Active = true;
|
if (ConfigurationState.Instance.Ui.GuiColumns.IconColumn) _iconToggle.Active = true;
|
||||||
|
@ -1289,36 +1290,36 @@ namespace Ryujinx.Ui
|
||||||
UpdateGameMetadata(_emulationContext.Application.TitleIdText);
|
UpdateGameMetadata(_emulationContext.Application.TitleIdText);
|
||||||
}
|
}
|
||||||
|
|
||||||
_pauseEmulation.Visible = true;
|
|
||||||
_pauseEmulation.Sensitive = false;
|
_pauseEmulation.Sensitive = false;
|
||||||
_resumeEmulation.Visible = false;
|
_resumeEmulation.Sensitive = false;
|
||||||
RendererWidget?.Exit();
|
RendererWidget?.Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PauseEmulation_Pressed(object sender, EventArgs args)
|
private void PauseEmulation_Pressed(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
_pauseEmulation.Visible = false;
|
_pauseEmulation.Sensitive = false;
|
||||||
_resumeEmulation.Visible = true;
|
_resumeEmulation.Sensitive = true;
|
||||||
_emulationContext.System.TogglePauseEmulation(true);
|
_emulationContext.System.TogglePauseEmulation(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ResumeEmulation_Pressed(object sender, EventArgs args)
|
private void ResumeEmulation_Pressed(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
_pauseEmulation.Visible = true;
|
_pauseEmulation.Sensitive = true;
|
||||||
_resumeEmulation.Visible = false;
|
_resumeEmulation.Sensitive = false;
|
||||||
_emulationContext.System.TogglePauseEmulation(false);
|
_emulationContext.System.TogglePauseEmulation(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ActivatePauseMenu()
|
public void ActivatePauseMenu()
|
||||||
{
|
{
|
||||||
_pauseEmulation.Sensitive = true;
|
_pauseEmulation.Sensitive = true;
|
||||||
|
_resumeEmulation.Sensitive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TogglePause()
|
public void TogglePause()
|
||||||
{
|
{
|
||||||
_pauseEmulation.Visible ^= true;
|
_pauseEmulation.Sensitive ^= true;
|
||||||
_resumeEmulation.Visible ^= true;
|
_resumeEmulation.Sensitive ^= true;
|
||||||
_emulationContext.System.TogglePauseEmulation(_resumeEmulation.Visible);
|
_emulationContext.System.TogglePauseEmulation(_resumeEmulation.Sensitive);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Installer_File_Pressed(object o, EventArgs args)
|
private void Installer_File_Pressed(object o, EventArgs args)
|
||||||
|
|
|
@ -305,7 +305,7 @@
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkMenuItem" id="_resumeEmulation">
|
<object class="GtkMenuItem" id="_resumeEmulation">
|
||||||
<property name="visible">False</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="tooltip_text" translatable="yes">Resume emulation</property>
|
<property name="tooltip_text" translatable="yes">Resume emulation</property>
|
||||||
<property name="label" translatable="yes">Resume Emulation</property>
|
<property name="label" translatable="yes">Resume Emulation</property>
|
||||||
|
|
Loading…
Reference in a new issue