diff --git a/Core/HistoryViewer.cpp b/Core/HistoryViewer.cpp index 570c3de..075ed33 100644 --- a/Core/HistoryViewer.cpp +++ b/Core/HistoryViewer.cpp @@ -117,13 +117,15 @@ bool HistoryViewer::SaveMovie(string movieFile, uint32_t startPosition, uint32_t return result; } +// Copies a given state to the main window's state void HistoryViewer::ResumeGameplay(shared_ptr console, uint32_t resumePosition) { console->Lock(); if (_console->GetRomInfo().RomFile.GetSha1Hash() != console->GetRomInfo().RomFile.GetSha1Hash()) { //Load game on the main window if they aren't the same console->LoadRom(console->GetRomInfo().RomFile, console->GetRomInfo().PatchFile); - // TODO? + // Mesen does console->Initialize(_console->GetRomPath(), _console->GetPatchFile()); + // but that's probably equivalent } if (resumePosition < _history.size()) { _history[resumePosition].LoadState(console); diff --git a/InteropDLL/EmuApiWrapper.cpp b/InteropDLL/EmuApiWrapper.cpp index 003dbe7..964ec27 100644 --- a/InteropDLL/EmuApiWrapper.cpp +++ b/InteropDLL/EmuApiWrapper.cpp @@ -126,6 +126,13 @@ extern "C" { } } + DllExport void __stdcall SetMasterVolume(double volume, ConsoleId consoleId) { + AudioConfig config = GetConsoleById(consoleId)->GetSettings()->GetAudioConfig(); + config.MasterVolume = volume; + GetConsoleById(consoleId)->GetSettings()->SetAudioConfig(config); + } + + DllExport void __stdcall SetFullscreenMode(bool fullscreen, void *windowHandle, uint32_t monitorWidth, uint32_t monitorHeight) { if(_renderer) { diff --git a/InteropDLL/HistoryViewerWrapper.cpp b/InteropDLL/HistoryViewerWrapper.cpp index 073309d..7ac9586 100644 --- a/InteropDLL/HistoryViewerWrapper.cpp +++ b/InteropDLL/HistoryViewerWrapper.cpp @@ -48,7 +48,7 @@ extern "C" #ifdef _WIN32 _historyRenderer.reset(new Renderer(_historyConsole, (HWND)viewerHandle, false)); -// _historySoundManager.reset(new SoundManager(_historyConsole, (HWND)windowHandle)); + _historySoundManager.reset(new SoundManager(_historyConsole, (HWND)windowHandle)); #else _historyRenderer.reset(new SdlRenderer(_historyConsole, viewerHandle, false)); _historySoundManager.reset(new SdlSoundManager(_historyConsole)); @@ -57,8 +57,8 @@ extern "C" DllExport void __stdcall HistoryViewerRelease() { - _historyConsole->Stop(true); // TODO: Check on this - _historyConsole->Release(); // had True, "For ShutDown" + _historyConsole->Stop(true); + _historyConsole->Release(); // Mesen had True, "For ShutDown" _historyRenderer.reset(); _historySoundManager.reset(); _historyConsole.reset(); diff --git a/UI/Forms/frmHistoryViewer.cs b/UI/Forms/frmHistoryViewer.cs index 30cf687..a3eb059 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); +// InteropEmu.SetVideoScale(scale, InteropEmu.ConsoleId.HistoryViewer); TODO } private void tmrUpdatePosition_Tick(object sender, EventArgs e) @@ -236,7 +236,7 @@ namespace Mesen.GUI.Forms private void trkVolume_ValueChanged(object sender, EventArgs e) { -// InteropEmu.SetMasterVolume(trkVolume.Value / 10d, 0, EmuApi.ConsoleId.HistoryViewer); + EmuApi.SetMasterVolume(trkVolume.Value, EmuApi.ConsoleId.HistoryViewer); } private void mnuScale1x_Click(object sender, EventArgs e) diff --git a/UI/Interop/EmuApi.cs b/UI/Interop/EmuApi.cs index 2b50f9c..584a8bb 100644 --- a/UI/Interop/EmuApi.cs +++ b/UI/Interop/EmuApi.cs @@ -36,6 +36,8 @@ namespace Mesen.GUI return new Version((int)major, (int)minor, (int)revision); } + [DllImport(DllPath)] public static extern void SetMasterVolume(double volume, ConsoleId consoleId); + [DllImport(DllPath)] public static extern IntPtr RegisterNotificationCallback(NotificationListener.NotificationCallback callback); [DllImport(DllPath)] public static extern void UnregisterNotificationCallback(IntPtr notificationListener); diff --git a/UI/Interop/HistoryViewerApi.cs b/UI/Interop/HistoryViewerApi.cs index a39ceb3..b3db251 100644 --- a/UI/Interop/HistoryViewerApi.cs +++ b/UI/Interop/HistoryViewerApi.cs @@ -26,7 +26,7 @@ namespace Mesen.GUI public static UInt32[] HistoryViewerGetSegments() { - UInt32[] segmentBuffer = new UInt32[HistoryViewerApi.HistoryViewerGetHistoryLength() / 30]; + UInt32[] segmentBuffer = new UInt32[HistoryViewerApi.HistoryViewerGetHistoryLength() / 60]; UInt32 bufferSize = (UInt32)segmentBuffer.Length; GCHandle hSegmentBuffer = GCHandle.Alloc(segmentBuffer, GCHandleType.Pinned);