Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix avi dump via render buffer instead,
with an option to use output buffer since recording with
post process effects will often be desirable.
  • Loading branch information
LunaMoo committed Jun 4, 2019
1 parent 57bd3c6 commit da031eb
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 7 deletions.
14 changes: 11 additions & 3 deletions Core/AVIDump.cpp
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions Core/Config.cpp
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
Expand Up @@ -60,6 +60,7 @@ struct Config {
bool bScreenshotsAsPNG;
bool bUseFFV1;
bool bDumpFrames;
bool bDumpVideoOutput;
bool bDumpAudio;
bool bSaveLoadResetsAVdumping;
bool bEnableLogging;
Expand Down
2 changes: 1 addition & 1 deletion UI/EmuScreen.cpp
Expand Up @@ -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);
}
}
Expand Down
1 change: 1 addition & 0 deletions UI/GameSettingsScreen.cpp
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
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() && !g_Config.bDumpFrames) {
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
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() && !g_Config.bDumpFrames) {
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
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() && !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);
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
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
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 da031eb

Please sign in to comment.