From 738b38a10915a37e3710f1b9a67f4991a32f2a4c Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Mon, 27 May 2019 22:43:20 +0200 Subject: [PATCH 1/4] Fix avi dump feature by using output buffer. --- Core/AVIDump.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/AVIDump.cpp b/Core/AVIDump.cpp index 37c6cd620a1e..c4dd316c01fc 100644 --- a/Core/AVIDump.cpp +++ b/Core/AVIDump.cpp @@ -169,7 +169,7 @@ static void PreparePacket(AVPacket* pkt) { void AVIDump::AddFrame() { - gpuDebug->GetCurrentFramebuffer(buf, GPU_DBG_FRAMEBUF_DISPLAY); + gpuDebug->GetOutputFramebuffer(buf); u32 w = buf.GetStride(); u32 h = buf.GetHeight(); CheckResolution(w, h); From 57bd3c63f47367a4f0b126ab8f618fa4654fe288 Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Mon, 27 May 2019 23:32:25 +0200 Subject: [PATCH 2/4] Block savestates OSM when video frames are dumped. Also make the dump messages shorter, especially dump start since it will be recorded. --- UI/EmuScreen.cpp | 8 ++++---- UI/NativeApp.cpp | 2 +- UI/PauseScreen.cpp | 2 +- Windows/MainWindowMenu.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index e6be9b4956f7..da12d679cfae 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -107,7 +107,7 @@ static void __EmuScreenVblank() if (g_Config.bDumpFrames && !startDumping) { avi.Start(PSP_CoreParameter().renderWidth, PSP_CoreParameter().renderHeight); - osm.Show(sy->T("AVI Dump started."), 3.0f); + osm.Show(sy->T("AVI Dump started."), 0.5f); startDumping = true; } if (g_Config.bDumpFrames && startDumping) @@ -117,7 +117,7 @@ static void __EmuScreenVblank() else if (!g_Config.bDumpFrames && startDumping) { avi.Stop(); - osm.Show(sy->T("AVI Dump stopped."), 3.0f); + osm.Show(sy->T("AVI Dump stopped."), 1.0f); startDumping = false; } #endif @@ -347,7 +347,7 @@ EmuScreen::~EmuScreen() { if (g_Config.bDumpFrames && startDumping) { avi.Stop(); - osm.Show("AVI Dump stopped.", 3.0f); + osm.Show("AVI Dump stopped.", 1.0f); startDumping = false; } #endif @@ -371,7 +371,7 @@ void EmuScreen::dialogFinished(const Screen *dialog, DialogResult result) { } static void AfterSaveStateAction(SaveState::Status status, const std::string &message, void *) { - if (!message.empty()) { + if (!message.empty() && !g_Config.bDumpFrames) { osm.Show(message, status == SaveState::Status::SUCCESS ? 2.0 : 5.0); } } diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index dbe387552c16..793c14b4f44f 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -676,7 +676,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch if (!boot_filename.empty() && stateToLoad != NULL) { SaveState::Load(stateToLoad, [](SaveState::Status status, const std::string &message, void *) { - if (!message.empty()) { + if (!message.empty() && !g_Config.bDumpFrames) { osm.Show(message, status == SaveState::Status::SUCCESS ? 2.0 : 5.0); } }); diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index aea7ac2ccc5c..e6876bece38a 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -271,7 +271,7 @@ void SaveSlotView::Draw(UIContext &dc) { } static void AfterSaveStateAction(SaveState::Status status, const std::string &message, void *) { - if (!message.empty()) { + if (!message.empty() && !g_Config.bDumpFrames) { osm.Show(message, status == SaveState::Status::SUCCESS ? 2.0 : 5.0); } } diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index 66ab52cfab36..45288b8a4ca7 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -447,7 +447,7 @@ namespace MainWindow { } static void SaveStateActionFinished(SaveState::Status status, const std::string &message, void *userdata) { - if (!message.empty()) { + if (!message.empty() && !g_Config.bDumpFrames) { osm.Show(message, status == SaveState::Status::SUCCESS ? 2.0 : 5.0); } PostMessage(MainWindow::GetHWND(), WM_USER_SAVESTATE_FINISH, 0, 0); From da031ebbdb672e8f2aee77fee615345c38a2d028 Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Mon, 3 Jun 2019 12:21:22 +0200 Subject: [PATCH 3/4] Fix avi dump via render buffer instead, with an option to use output buffer since recording with post process effects will often be desirable. --- Core/AVIDump.cpp | 14 +++++++++++--- Core/Config.cpp | 1 + Core/Config.h | 1 + UI/EmuScreen.cpp | 2 +- UI/GameSettingsScreen.cpp | 1 + UI/NativeApp.cpp | 2 +- UI/PauseScreen.cpp | 2 +- Windows/MainWindowMenu.cpp | 8 +++++++- Windows/ppsspp.rc | 1 + Windows/resource.h | 1 + 10 files changed, 26 insertions(+), 7 deletions(-) diff --git a/Core/AVIDump.cpp b/Core/AVIDump.cpp index c4dd316c01fc..1786eede3508 100644 --- a/Core/AVIDump.cpp +++ b/Core/AVIDump.cpp @@ -169,9 +169,17 @@ static void PreparePacket(AVPacket* pkt) { void AVIDump::AddFrame() { - gpuDebug->GetOutputFramebuffer(buf); - u32 w = buf.GetStride(); - u32 h = buf.GetHeight(); + u32 w = 0; + u32 h = 0; + if (g_Config.bDumpVideoOutput) { + gpuDebug->GetOutputFramebuffer(buf); + w = buf.GetStride(); + h = buf.GetHeight(); + } else { + gpuDebug->GetCurrentFramebuffer(buf, GPU_DBG_FRAMEBUF_RENDER); + w = PSP_CoreParameter().renderWidth; + h = PSP_CoreParameter().renderHeight; + } CheckResolution(w, h); u8 *flipbuffer = nullptr; const u8 *buffer = ConvertBufferToScreenshot(buf, false, flipbuffer, w, h); diff --git a/Core/Config.cpp b/Core/Config.cpp index 4a035d6f8f82..d30008545aaf 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -407,6 +407,7 @@ static ConfigSetting generalSettings[] = { ConfigSetting("ScreenshotsAsPNG", &g_Config.bScreenshotsAsPNG, false, true, true), ConfigSetting("UseFFV1", &g_Config.bUseFFV1, false), ConfigSetting("DumpFrames", &g_Config.bDumpFrames, false), + ConfigSetting("DumpVideoOutput", &g_Config.bDumpVideoOutput, false), ConfigSetting("DumpAudio", &g_Config.bDumpAudio, false), ConfigSetting("SaveLoadResetsAVdumping", &g_Config.bSaveLoadResetsAVdumping, false), ConfigSetting("StateSlot", &g_Config.iCurrentStateSlot, 0, true, true), diff --git a/Core/Config.h b/Core/Config.h index 689acb51ff22..8f580fe89b41 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -60,6 +60,7 @@ struct Config { bool bScreenshotsAsPNG; bool bUseFFV1; bool bDumpFrames; + bool bDumpVideoOutput; bool bDumpAudio; bool bSaveLoadResetsAVdumping; bool bEnableLogging; diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index da12d679cfae..8cb35e806567 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -371,7 +371,7 @@ void EmuScreen::dialogFinished(const Screen *dialog, DialogResult result) { } static void AfterSaveStateAction(SaveState::Status status, const std::string &message, void *) { - if (!message.empty() && !g_Config.bDumpFrames) { + if (!message.empty() && (!g_Config.bDumpFrames || !g_Config.bDumpVideoOutput)) { osm.Show(message, status == SaveState::Status::SUCCESS ? 2.0 : 5.0); } } diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index c747c627dd75..2018751c6eee 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -813,6 +813,7 @@ void GameSettingsScreen::CreateViews() { #if defined(_WIN32) || (defined(USING_QT_UI) && !defined(MOBILE_DEVICE)) systemSettings->Add(new CheckBox(&g_Config.bDumpFrames, sy->T("Record Display"))); systemSettings->Add(new CheckBox(&g_Config.bUseFFV1, sy->T("Use Lossless Video Codec (FFV1)"))); + systemSettings->Add(new CheckBox(&g_Config.bDumpVideoOutput, sy->T("Use output buffer(with overlay) for recording"))); systemSettings->Add(new CheckBox(&g_Config.bDumpAudio, sy->T("Record Audio"))); systemSettings->Add(new CheckBox(&g_Config.bSaveLoadResetsAVdumping, sy->T("Reset Recording on Save/Load State"))); #endif diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 793c14b4f44f..ffce33b79900 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -676,7 +676,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch if (!boot_filename.empty() && stateToLoad != NULL) { SaveState::Load(stateToLoad, [](SaveState::Status status, const std::string &message, void *) { - if (!message.empty() && !g_Config.bDumpFrames) { + if (!message.empty() && (!g_Config.bDumpFrames || !g_Config.bDumpVideoOutput)) { osm.Show(message, status == SaveState::Status::SUCCESS ? 2.0 : 5.0); } }); diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index e6876bece38a..f99e5e8f9ab0 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -271,7 +271,7 @@ void SaveSlotView::Draw(UIContext &dc) { } static void AfterSaveStateAction(SaveState::Status status, const std::string &message, void *) { - if (!message.empty() && !g_Config.bDumpFrames) { + if (!message.empty() && (!g_Config.bDumpFrames || !g_Config.bDumpVideoOutput)) { osm.Show(message, status == SaveState::Status::SUCCESS ? 2.0 : 5.0); } } diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index 45288b8a4ca7..d1f29b5ce83c 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -280,6 +280,7 @@ namespace MainWindow { // Movie menu TranslateMenuItem(menu, ID_FILE_DUMPFRAMES); TranslateMenuItem(menu, ID_FILE_USEFFV1); + TranslateMenuItem(menu, ID_FILE_DUMP_VIDEO_OUTPUT); TranslateMenuItem(menu, ID_FILE_DUMPAUDIO); // Skip display multipliers x1-x10 @@ -447,7 +448,7 @@ namespace MainWindow { } static void SaveStateActionFinished(SaveState::Status status, const std::string &message, void *userdata) { - if (!message.empty() && !g_Config.bDumpFrames) { + if (!message.empty() && (!g_Config.bDumpFrames || !g_Config.bDumpVideoOutput)) { osm.Show(message, status == SaveState::Status::SUCCESS ? 2.0 : 5.0); } PostMessage(MainWindow::GetHWND(), WM_USER_SAVESTATE_FINISH, 0, 0); @@ -1034,6 +1035,10 @@ namespace MainWindow { g_Config.bUseFFV1 = !g_Config.bUseFFV1; break; + case ID_FILE_DUMP_VIDEO_OUTPUT: + g_Config.bDumpVideoOutput = !g_Config.bDumpVideoOutput; + break; + case ID_FILE_DUMPAUDIO: g_Config.bDumpAudio = !g_Config.bDumpAudio; break; @@ -1083,6 +1088,7 @@ namespace MainWindow { CHECKITEM(ID_OPTIONS_IGNOREWINKEY, g_Config.bIgnoreWindowsKey); CHECKITEM(ID_FILE_DUMPFRAMES, g_Config.bDumpFrames); CHECKITEM(ID_FILE_USEFFV1, g_Config.bUseFFV1); + CHECKITEM(ID_FILE_DUMP_VIDEO_OUTPUT, g_Config.bDumpVideoOutput); CHECKITEM(ID_FILE_DUMPAUDIO, g_Config.bDumpAudio); static const int displayrotationitems[] = { diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index 2c6ec73d79e6..ad282605cceb 100644 --- a/Windows/ppsspp.rc +++ b/Windows/ppsspp.rc @@ -490,6 +490,7 @@ BEGIN BEGIN MENUITEM "Record Display", ID_FILE_DUMPFRAMES MENUITEM "Use Lossless Video Codec (FFV1)", ID_FILE_USEFFV1 + MENUITEM "Use output buffer for video", ID_FILE_DUMP_VIDEO_OUTPUT MENUITEM "", 0, MFT_SEPARATOR MENUITEM "Record Audio", ID_FILE_DUMPAUDIO END diff --git a/Windows/resource.h b/Windows/resource.h index 1f701e442eea..76fb85046962 100644 --- a/Windows/resource.h +++ b/Windows/resource.h @@ -369,6 +369,7 @@ #define IDC_GEDBG_STEPCOUNT_INC 40201 #define IDC_GEDBG_STEPCOUNT_JUMP 40202 #define IDC_GEDBG_STEPCOUNT_COMBO 40203 +#define ID_FILE_DUMP_VIDEO_OUTPUT 40204 // Dummy option to let the buffered rendering hotkey cycle through all the options. #define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500 From 723027161262233322b5f22f66803d47d3b391a7 Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Tue, 4 Jun 2019 10:30:47 +0200 Subject: [PATCH 4/4] Add space to new setting name --- UI/GameSettingsScreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 2018751c6eee..ae5916b2e633 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -813,7 +813,7 @@ void GameSettingsScreen::CreateViews() { #if defined(_WIN32) || (defined(USING_QT_UI) && !defined(MOBILE_DEVICE)) systemSettings->Add(new CheckBox(&g_Config.bDumpFrames, sy->T("Record Display"))); systemSettings->Add(new CheckBox(&g_Config.bUseFFV1, sy->T("Use Lossless Video Codec (FFV1)"))); - systemSettings->Add(new CheckBox(&g_Config.bDumpVideoOutput, sy->T("Use output buffer(with overlay) for recording"))); + systemSettings->Add(new CheckBox(&g_Config.bDumpVideoOutput, sy->T("Use output buffer (with overlay) for recording"))); systemSettings->Add(new CheckBox(&g_Config.bDumpAudio, sy->T("Record Audio"))); systemSettings->Add(new CheckBox(&g_Config.bSaveLoadResetsAVdumping, sy->T("Reset Recording on Save/Load State"))); #endif