Skip to content

Commit

Permalink
Merge pull request #12069 from LunaMoo/aviDumpFix
Browse files Browse the repository at this point in the history
Fix avi dump feature by using render buffer with option to use output buffer.
  • Loading branch information
hrydgard committed Jun 4, 2019
2 parents 9450c13 + 7230271 commit 3769e8b
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 10 deletions.
14 changes: 11 additions & 3 deletions Core/AVIDump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,17 @@ static void PreparePacket(AVPacket* pkt) {

void AVIDump::AddFrame()
{
gpuDebug->GetCurrentFramebuffer(buf, GPU_DBG_FRAMEBUF_DISPLAY);
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);
Expand Down
1 change: 1 addition & 0 deletions Core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions Core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct Config {
bool bScreenshotsAsPNG;
bool bUseFFV1;
bool bDumpFrames;
bool bDumpVideoOutput;
bool bDumpAudio;
bool bSaveLoadResetsAVdumping;
bool bEnableLogging;
Expand Down
8 changes: 4 additions & 4 deletions UI/EmuScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 || !g_Config.bDumpVideoOutput)) {
osm.Show(message, status == SaveState::Status::SUCCESS ? 2.0 : 5.0);
}
}
Expand Down
1 change: 1 addition & 0 deletions UI/GameSettingsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion UI/NativeApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 || !g_Config.bDumpVideoOutput)) {
osm.Show(message, status == SaveState::Status::SUCCESS ? 2.0 : 5.0);
}
});
Expand Down
2 changes: 1 addition & 1 deletion UI/PauseScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 || !g_Config.bDumpVideoOutput)) {
osm.Show(message, status == SaveState::Status::SUCCESS ? 2.0 : 5.0);
}
}
Expand Down
8 changes: 7 additions & 1 deletion Windows/MainWindowMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -447,7 +448,7 @@ namespace MainWindow {
}

static void SaveStateActionFinished(SaveState::Status status, const std::string &message, void *userdata) {
if (!message.empty()) {
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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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[] = {
Expand Down
1 change: 1 addition & 0 deletions Windows/ppsspp.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Windows/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3769e8b

Please sign in to comment.