From 117e6265b01fe9c1bf90178c0a737c83d680169f Mon Sep 17 00:00:00 2001 From: NovaSquirrel Date: Thu, 8 Oct 2020 01:54:35 -0400 Subject: [PATCH] Update scaling in History Viewer --- InteropDLL/EmuApiWrapper.cpp | 6 ++++++ InteropDLL/HistoryViewerWrapper.cpp | 5 ++++- UI/Forms/frmHistoryViewer.cs | 2 +- UI/Interop/EmuApi.cs | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/InteropDLL/EmuApiWrapper.cpp b/InteropDLL/EmuApiWrapper.cpp index 964ec27..ab742f6 100644 --- a/InteropDLL/EmuApiWrapper.cpp +++ b/InteropDLL/EmuApiWrapper.cpp @@ -132,6 +132,12 @@ extern "C" { GetConsoleById(consoleId)->GetSettings()->SetAudioConfig(config); } + DllExport void __stdcall SetVideoScale(double scale, ConsoleId consoleId) { + VideoConfig config = GetConsoleById(consoleId)->GetSettings()->GetVideoConfig(); + config.VideoScale = scale; + GetConsoleById(consoleId)->GetSettings()->SetVideoConfig(config); + } + DllExport void __stdcall SetFullscreenMode(bool fullscreen, void *windowHandle, uint32_t monitorWidth, uint32_t monitorHeight) { diff --git a/InteropDLL/HistoryViewerWrapper.cpp b/InteropDLL/HistoryViewerWrapper.cpp index 7ac9586..28149a4 100644 --- a/InteropDLL/HistoryViewerWrapper.cpp +++ b/InteropDLL/HistoryViewerWrapper.cpp @@ -4,6 +4,7 @@ #include "../Core/SoundMixer.h" #include "../Core/MovieManager.h" #include "../Core/RewindManager.h" +#include "../Core/EmuSettings.h" #ifdef _WIN32 #include "../Windows/Renderer.h" @@ -41,9 +42,11 @@ extern "C" _historyConsole->Unlock(); //Force some settings + VideoConfig config = _historyConsole->GetSettings()->GetVideoConfig(); + config.VideoScale = 2; + _historyConsole->GetSettings()->SetVideoConfig(config); // TODO // _historyConsole->GetSettings()->SetEmulationSpeed(100); -// _historyConsole->GetSettings()->SetVideoScale(2); // _historyConsole->GetSettings()->ClearFlags(EmulationFlags::InBackground | EmulationFlags::Rewind /*|EmulationFlags::ForceMaxSpeed | EmulationFlags::DebuggerWindowEnabled*/); #ifdef _WIN32 diff --git a/UI/Forms/frmHistoryViewer.cs b/UI/Forms/frmHistoryViewer.cs index a3eb059..9b8fa80 100644 --- a/UI/Forms/frmHistoryViewer.cs +++ b/UI/Forms/frmHistoryViewer.cs @@ -102,7 +102,7 @@ namespace Mesen.GUI.Forms double verticalScale = (double)dimensions.Height / size.Height; double horizontalScale = (double)dimensions.Width / size.Width; double scale = Math.Min(verticalScale, horizontalScale); -// InteropEmu.SetVideoScale(scale, InteropEmu.ConsoleId.HistoryViewer); TODO + EmuApi.SetVideoScale(scale, EmuApi.ConsoleId.HistoryViewer); } private void tmrUpdatePosition_Tick(object sender, EventArgs e) diff --git a/UI/Interop/EmuApi.cs b/UI/Interop/EmuApi.cs index 584a8bb..9ecd129 100644 --- a/UI/Interop/EmuApi.cs +++ b/UI/Interop/EmuApi.cs @@ -37,6 +37,7 @@ namespace Mesen.GUI } [DllImport(DllPath)] public static extern void SetMasterVolume(double volume, ConsoleId consoleId); + [DllImport(DllPath)] public static extern void SetVideoScale(double scale, ConsoleId consoleId); [DllImport(DllPath)] public static extern IntPtr RegisterNotificationCallback(NotificationListener.NotificationCallback callback); [DllImport(DllPath)] public static extern void UnregisterNotificationCallback(IntPtr notificationListener);