mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Added support for dumping avi files (thanks baby.lueshi). Use Microsoft Video 1 codec for starters. Make sure to check the dump rendered frames box in the video plugin settings, or it won't work.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2781 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -92,7 +92,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions=""..\..\core\common\win32\release\common.lib""
|
||||
AdditionalDependencies="dsound.lib odbc32.lib odbccp32.lib comctl32.lib d3d9.lib d3dx9.lib winmm.lib cg.lib cgD3D9.lib"
|
||||
AdditionalDependencies="dsound.lib odbc32.lib odbccp32.lib comctl32.lib d3d9.lib d3dx9.lib winmm.lib cg.lib cgD3D9.lib vfw32.lib"
|
||||
OutputFile="..\..\..\Binary\Win32\Plugins\Plugin_VideoDX9.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
@ -200,7 +200,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="cg.lib cgD3D9.lib dsound.lib odbc32.lib odbccp32.lib comctl32.lib d3d9.lib d3dx9.lib winmm.lib"
|
||||
AdditionalDependencies="cg.lib cgD3D9.lib dsound.lib odbc32.lib odbccp32.lib comctl32.lib d3d9.lib d3dx9.lib winmm.lib vfw32.lib"
|
||||
OutputFile="..\..\..\Binary\x64\Plugins\Plugin_VideoDX9.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
@ -299,7 +299,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions=""..\..\core\common\win32\debug\common.lib""
|
||||
AdditionalDependencies="dsound.lib odbc32.lib odbccp32.lib comctl32.lib d3d9.lib d3dx9.lib winmm.lib cg.lib cgD3D9.lib"
|
||||
AdditionalDependencies="dsound.lib odbc32.lib odbccp32.lib comctl32.lib d3d9.lib d3dx9.lib winmm.lib cg.lib cgD3D9.lib vfw32.lib"
|
||||
OutputFile="..\..\..\Binary\Win32/Plugins\Plugin_VideoDX9D.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
@ -397,7 +397,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="cg.lib cgD3D9.lib dsound.lib odbc32.lib odbccp32.lib comctl32.lib d3d9.lib d3dx9.lib winmm.lib"
|
||||
AdditionalDependencies="cg.lib cgD3D9.lib dsound.lib odbc32.lib odbccp32.lib comctl32.lib d3d9.lib d3dx9.lib winmm.lib vfw32.lib"
|
||||
OutputFile="..\..\..\Binary\x64\Plugins\Plugin_VideoDX9D.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
@ -505,7 +505,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="dsound.lib odbc32.lib odbccp32.lib comctl32.lib d3d9.lib d3dx9.lib winmm.lib cg.lib cgD3D9.lib"
|
||||
AdditionalDependencies="dsound.lib odbc32.lib odbccp32.lib comctl32.lib d3d9.lib d3dx9.lib winmm.lib cg.lib cgD3D9.lib vfw32.lib"
|
||||
OutputFile="..\..\..\Binary\Win32\Plugins\Plugin_VideoDX9DF.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
@ -614,7 +614,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="cg.lib cgD3D9.lib dsound.lib odbc32.lib odbccp32.lib comctl32.lib d3d9.lib d3dx9.lib winmm.lib"
|
||||
AdditionalDependencies="cg.lib cgD3D9.lib dsound.lib odbc32.lib odbccp32.lib comctl32.lib d3d9.lib d3dx9.lib winmm.lib vfw32.lib"
|
||||
OutputFile="..\..\..\Binary\x64\Plugins\Plugin_VideoDX9DF.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
|
@ -41,6 +41,7 @@ void Config::Load()
|
||||
iniFile.Get("Settings", "OverlayProjection", &bOverlayProjStats, false);
|
||||
iniFile.Get("Settings", "Postprocess", &iPostprocessEffect, 0);
|
||||
iniFile.Get("Settings", "DumpTextures", &bDumpTextures, 0);
|
||||
iniFile.Get("Settings", "DumpFrames", &bDumpFrames, 0);
|
||||
iniFile.Get("Settings", "ShowShaderErrors", &bShowShaderErrors, 0);
|
||||
iniFile.Get("Settings", "Multisample", &iMultisampleMode, 0);
|
||||
iniFile.Get("Settings", "TexDumpPath", &texDumpPath, 0);
|
||||
@ -68,6 +69,7 @@ void Config::Save()
|
||||
iniFile.Set("Settings", "OverlayProjection", bOverlayProjStats);
|
||||
iniFile.Set("Settings", "Postprocess", iPostprocessEffect);
|
||||
iniFile.Set("Settings", "DumpTextures", bDumpTextures);
|
||||
iniFile.Set("Settings", "DumpFrames", bDumpFrames);
|
||||
iniFile.Set("Settings", "ShowShaderErrors", bShowShaderErrors);
|
||||
iniFile.Set("Settings", "Multisample", iMultisampleMode);
|
||||
iniFile.Set("Settings", "TexDumpPath", texDumpPath);
|
||||
|
@ -39,6 +39,7 @@ struct Config
|
||||
bool bOverlayStats;
|
||||
bool bOverlayProjStats;
|
||||
bool bDumpTextures;
|
||||
bool bDumpFrames;
|
||||
bool bOldCard;
|
||||
bool bShowShaderErrors;
|
||||
//enhancements
|
||||
|
@ -123,6 +123,7 @@ struct TabAdvanced : public W32Util::Tab
|
||||
Button_SetCheck(GetDlgItem(hDlg,IDC_OVERLAYPROJSTATS), g_Config.bOverlayProjStats);
|
||||
Button_SetCheck(GetDlgItem(hDlg,IDC_WIREFRAME), g_Config.bWireFrame);
|
||||
Button_SetCheck(GetDlgItem(hDlg,IDC_TEXDUMP), g_Config.bDumpTextures);
|
||||
Button_SetCheck(GetDlgItem(hDlg,IDC_DUMPFRAMES), g_Config.bDumpFrames);
|
||||
Button_SetCheck(GetDlgItem(hDlg,IDC_SHOWSHADERERRORS), g_Config.bShowShaderErrors);
|
||||
|
||||
Button_SetCheck(GetDlgItem(hDlg,IDC_TEXFMT_OVERLAY), g_Config.bTexFmtOverlayEnable);
|
||||
@ -160,6 +161,7 @@ struct TabAdvanced : public W32Util::Tab
|
||||
g_Config.bOverlayProjStats = Button_GetCheck(GetDlgItem(hDlg,IDC_OVERLAYPROJSTATS)) ? true : false;
|
||||
g_Config.bWireFrame = Button_GetCheck(GetDlgItem(hDlg,IDC_WIREFRAME)) ? true : false;
|
||||
g_Config.bDumpTextures = Button_GetCheck(GetDlgItem(hDlg,IDC_TEXDUMP)) ? true : false;
|
||||
g_Config.bDumpFrames = Button_GetCheck(GetDlgItem(hDlg,IDC_DUMPFRAMES)) ? true : false;
|
||||
g_Config.bShowShaderErrors = Button_GetCheck(GetDlgItem(hDlg,IDC_SHOWSHADERERRORS)) ? true : false;
|
||||
char temp[MAX_PATH];
|
||||
GetWindowText(GetDlgItem(hDlg,IDC_TEXDUMPPATH), temp, MAX_PATH);
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "TextureCache.h"
|
||||
#include "Utils.h"
|
||||
#include "EmuWindow.h"
|
||||
#include "AVIDump.h"
|
||||
|
||||
#include <Cg/cg.h>
|
||||
#include <Cg/cgD3D9.h>
|
||||
@ -52,6 +53,9 @@ float Renderer::m_height;
|
||||
float Renderer::xScale;
|
||||
float Renderer::yScale;
|
||||
|
||||
int Renderer::m_recordWidth;
|
||||
int Renderer::m_recordHeight;
|
||||
|
||||
std::vector<LPDIRECT3DBASETEXTURE9> Renderer::m_Textures;
|
||||
|
||||
DWORD Renderer::m_RenderStates[MaxRenderStates+46];
|
||||
@ -59,6 +63,9 @@ DWORD Renderer::m_TextureStageStates[MaxTextureStages][MaxTextureTypes];
|
||||
DWORD Renderer::m_SamplerStates[MaxSamplerSize][MaxSamplerTypes];
|
||||
DWORD Renderer::m_FVF;
|
||||
|
||||
bool Renderer::m_LastFrameDumped;
|
||||
bool Renderer::m_AVIDumping;
|
||||
|
||||
#define NUMWNDRES 6
|
||||
extern int g_Res[NUMWNDRES][2];
|
||||
|
||||
@ -106,6 +113,9 @@ void Renderer::Init(SVideoInitialize &_VideoInitialize)
|
||||
xScale = width / (float)EFB_WIDTH;
|
||||
yScale = height / (float)EFB_HEIGHT;
|
||||
|
||||
m_LastFrameDumped = false;
|
||||
m_AVIDumping = false;
|
||||
|
||||
// We're not using much fixed function. Let's just set the matrices to identity.
|
||||
D3DXMATRIX mtx;
|
||||
D3DXMatrixIdentity(&mtx);
|
||||
@ -126,6 +136,10 @@ void Renderer::Shutdown()
|
||||
D3D::font.Shutdown();
|
||||
D3D::EndFrame();
|
||||
D3D::Close();
|
||||
|
||||
if(m_AVIDumping) {
|
||||
AVIDump::Stop();
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::Initialize()
|
||||
@ -194,6 +208,19 @@ void dumpMatrix(D3DXMATRIX &mtx)
|
||||
}
|
||||
}
|
||||
|
||||
void formatBufferDump(char *in, char *out, int w, int h, int p)
|
||||
{
|
||||
for(int i = 0; i < h; i++) {
|
||||
char *line = in + (h - i - 1) * p;
|
||||
|
||||
for (int j = 0; j < w; j++) {
|
||||
memcpy(out, line, 3);
|
||||
out += 3;
|
||||
line += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::SwapBuffers()
|
||||
{
|
||||
// Center window again.
|
||||
@ -208,6 +235,53 @@ void Renderer::SwapBuffers()
|
||||
::MoveWindow(EmuWindow::GetWnd(), 0, 0, width, height, FALSE);
|
||||
}
|
||||
|
||||
// Frame dumping routine
|
||||
if (g_Config.bDumpFrames) {
|
||||
D3DDISPLAYMODE DisplayMode;
|
||||
if (SUCCEEDED(D3D::dev->GetDisplayMode(0, &DisplayMode))) {
|
||||
LPDIRECT3DSURFACE9 surf;
|
||||
if (SUCCEEDED(D3D::dev->CreateOffscreenPlainSurface(DisplayMode.Width, DisplayMode.Height, D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &surf, NULL))) {
|
||||
if (!m_LastFrameDumped) {
|
||||
RECT windowRect;
|
||||
GetWindowRect(EmuWindow::GetWnd(), &windowRect);
|
||||
m_recordWidth = windowRect.right - windowRect.left;
|
||||
m_recordHeight = windowRect.bottom - windowRect.top;
|
||||
m_AVIDumping = AVIDump::Start(EmuWindow::GetParentWnd(), m_recordWidth, m_recordHeight);
|
||||
if (!m_AVIDumping) {
|
||||
PanicAlert("Error dumping frames to AVI.");
|
||||
} else {
|
||||
char msg [255];
|
||||
sprintf(msg, "Dumping Frames to \"%s/framedump0.avi\" (%dx%d RGB24)", FULL_FRAMES_DIR, m_recordWidth, m_recordHeight);
|
||||
AddMessage(msg, 2000);
|
||||
}
|
||||
}
|
||||
if (m_AVIDumping) {
|
||||
if (SUCCEEDED(D3D::dev->GetFrontBufferData(0, surf))) {
|
||||
RECT windowRect;
|
||||
GetWindowRect(EmuWindow::GetWnd(), &windowRect);
|
||||
D3DLOCKED_RECT rect;
|
||||
if (SUCCEEDED(surf->LockRect(&rect, &windowRect, D3DLOCK_NO_DIRTY_UPDATE | D3DLOCK_NOSYSLOCK | D3DLOCK_READONLY))) {
|
||||
char *data = (char *) malloc(3 * m_recordWidth * m_recordHeight);
|
||||
formatBufferDump((char *) rect.pBits, data, m_recordWidth, m_recordHeight, rect.Pitch);
|
||||
AVIDump::AddFrame(data);
|
||||
free(data);
|
||||
surf->UnlockRect();
|
||||
}
|
||||
}
|
||||
}
|
||||
m_LastFrameDumped = true;
|
||||
surf->Release();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(m_LastFrameDumped && m_AVIDumping) {
|
||||
AVIDump::Stop();
|
||||
m_AVIDumping = false;
|
||||
}
|
||||
|
||||
m_LastFrameDumped = false;
|
||||
}
|
||||
|
||||
//Finish up the current frame, print some stats
|
||||
Postprocess::FinalizeFrame();
|
||||
if (g_Config.bOverlayStats)
|
||||
|
@ -38,6 +38,10 @@ class Renderer
|
||||
static float m_height;
|
||||
static float xScale;
|
||||
static float yScale;
|
||||
static bool m_LastFrameDumped;
|
||||
static bool m_AVIDumping;
|
||||
static int m_recordWidth;
|
||||
static int m_recordHeight;
|
||||
const static int MaxTextureStages = 9;
|
||||
const static int MaxRenderStates = 210;
|
||||
const static DWORD MaxTextureTypes = 33;
|
||||
|
@ -57,6 +57,7 @@
|
||||
#define IDC_TEXFMT_CENTER 1034
|
||||
#define IDC_TEXFMT_OVERLAY 1035
|
||||
#define IDC_OVERLAYPROJSTATS 1036
|
||||
#define IDC_DUMPFRAMES 1037
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
|
@ -50,7 +50,7 @@ BEGIN
|
||||
CONTROL "",IDC_REGISTERSELECT,"SysTabControl32",TCS_BUTTONS,80,52,145,13
|
||||
END
|
||||
|
||||
IDD_ADVANCED DIALOGEX 0, 0, 206, 175
|
||||
IDD_ADVANCED DIALOGEX 0, 0, 206, 195
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
||||
BEGIN
|
||||
@ -60,13 +60,14 @@ BEGIN
|
||||
CONTROL "Overlay &Projection Statistics",IDC_OVERLAYPROJSTATS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,42,118,9
|
||||
CONTROL "Show s&hader compilation errors",IDC_SHOWSHADERERRORS,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,53,127,9
|
||||
GROUPBOX "&Data dumping",IDC_STATIC,7,91,192,44
|
||||
GROUPBOX "&Data dumping",IDC_STATIC,7,91,192,58
|
||||
CONTROL "Dump &textures to:",IDC_TEXDUMP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,104,70,9
|
||||
EDITTEXT IDC_TEXDUMPPATH,25,116,148,12,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "...",IDC_BROWSETEXDUMPPATH,176,116,14,13
|
||||
GROUPBOX "Texture Format Overlay",IDC_STATIC,7,138,192,30
|
||||
CONTROL "Enable Overlay",IDC_TEXFMT_OVERLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,150,74,10
|
||||
CONTROL "Centered",IDC_TEXFMT_CENTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,150,82,10
|
||||
CONTROL "Dump Frames to User/Dump/Frames",IDC_DUMPFRAMES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,132,138,9
|
||||
GROUPBOX "Texture Format Overlay",IDC_STATIC,7,156,192,30
|
||||
CONTROL "Enable Overlay",IDC_TEXFMT_OVERLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,168,74,10
|
||||
CONTROL "Centered",IDC_TEXFMT_CENTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,168,82,10
|
||||
END
|
||||
|
||||
IDD_ENHANCEMENTS DIALOGEX 0, 0, 207, 175
|
||||
|
Reference in New Issue
Block a user