user-defined capture start/stop keybind (Ctrl + Shift + C)

This commit is contained in:
GreemDev 2025-12-28 16:25:36 -06:00
parent ac02cdb1d3
commit da41b493b0
3 changed files with 35 additions and 4 deletions

View file

@ -51,21 +51,43 @@ namespace Ryujinx.Ava.UI.Renderer
protected virtual void OnWindowDestroyed() { }
public void StartRenderDocCapture(Switch device)
public bool ToggleRenderDocCapture(Switch device)
{
if (!RenderDoc.IsAvailable) return;
if (!RenderDoc.IsAvailable) return false;
if (RenderDoc.IsFrameCapturing) return;
if (RenderDoc.IsFrameCapturing)
{
if (EndRenderDocCapture())
{
Logger.Info?.Print(LogClass.Application, "Ended RenderDoc capture.");
return true;
}
}
else if (StartRenderDocCapture(device))
{
Logger.Info?.Print(LogClass.Application, "Starting RenderDoc capture.");
return true;
}
return false;
}
public bool StartRenderDocCapture(Switch device)
{
if (!RenderDoc.IsAvailable) return false;
if (RenderDoc.IsFrameCapturing) return false;
RenderDoc.StartFrameCapture(nint.Zero, WindowHandle);
RenderDoc.SetCaptureTitle(TitleHelper.TruncatedApplicationTitle(device.Processes.ActiveApplication, Program.Version));
Logger.Info?.Print(LogClass.Application, "Starting RenderDoc capture.");
return true;
}
public bool EndRenderDocCapture()
{
if (!RenderDoc.IsAvailable) return false;
if (!RenderDoc.IsFrameCapturing) return false;
return RenderDoc.IsFrameCapturing && RenderDoc.EndFrameCapture(nint.Zero, WindowHandle);
}

View file

@ -1880,6 +1880,11 @@ namespace Ryujinx.Ava.UI.ViewModels
);
}
public void ToggleCapture()
{
AppHost.RendererHost.EmbeddedWindow.ToggleRenderDocCapture(AppHost.Device);
}
public void ToggleFullscreen()
{
if (Environment.TickCount64 - LastFullscreenToggle < HotKeyPressDelayMs)
@ -2500,7 +2505,10 @@ namespace Ryujinx.Ava.UI.ViewModels
viewModel =>
{
if (!RenderDoc.IsFrameCapturing)
{
viewModel.AppHost.RendererHost.EmbeddedWindow.StartRenderDocCapture(viewModel.AppHost.Device);
Logger.Info?.Print(LogClass.Application, "Starting RenderDoc capture.");
}
viewModel.RenderDocIsCapturing = true;
});

View file

@ -42,6 +42,7 @@
<KeyBinding Gesture="Ctrl+A" Command="{Binding OpenAmiiboWindow}" />
<KeyBinding Gesture="Ctrl+B" Command="{Binding OpenBinFile}" />
<KeyBinding Gesture="Ctrl+Shift+R" Command="{Binding ReloadRenderDocApi}" />
<KeyBinding Gesture="Ctrl+Shift+C" Command="{Binding ToggleCapture}" />
</Window.KeyBindings>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" RowDefinitions="*">
<helpers:OffscreenTextBox IsEnabled="False" Opacity="0" Name="HiddenTextBox" IsHitTestVisible="False" IsTabStop="False" />