From da031ebbdb672e8f2aee77fee615345c38a2d028 Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Mon, 3 Jun 2019 12:21:22 +0200 Subject: [PATCH] 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 c4dd316c01..1786eede35 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 4a035d6f8f..d30008545a 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 689acb51ff..8f580fe89b 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -60,6 +60,7 @@ public: 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 da12d679cf..8cb35e8065 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 c747c627dd..2018751c6e 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 793c14b4f4..ffce33b799 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 e6876bece3..f99e5e8f9a 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 45288b8a4c..d1f29b5ce8 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 2c6ec73d79..ad282605cc 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 1f701e442e..76fb850469 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