mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-01-11 20:10:30 +00:00
user-defined capture start/stop keybind (Ctrl + Shift + C)
This commit is contained in:
parent
ac02cdb1d3
commit
da41b493b0
3 changed files with 35 additions and 4 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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" />
|
||||
|
|
|
|||
Loading…
Reference in a new issue