Advertisement
Guest User

Untitled

a guest
Mar 19th, 2009
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.66 KB | None | 0 0
  1. Index: Source/Core/Common/Src/CommonPaths.h
  2. ===================================================================
  3. --- Source/Core/Common/Src/CommonPaths.h (revision 2684)
  4. +++ Source/Core/Common/Src/CommonPaths.h (working copy)
  5. @@ -69,6 +69,7 @@
  6. #define SCREENSHOTS_DIR "ScreenShots"
  7. #define DUMP_DIR "Dump"
  8. #define DUMP_TEXTURES_DIR "Textures"
  9. +#define DUMP_FRAMES_DIR "Frames"
  10. #define LOGS_DIR "Logs"
  11. #define MAIL_LOGS_DIR "Mail"
  12.  
  13. @@ -122,7 +123,8 @@
  14. #define FULL_CONFIG_DIR FULL_USERDATA_DIR CONFIG_DIR DIR_SEP
  15. #define FULL_CACHE_DIR FULL_USERDATA_DIR CACHE_DIR DIR_SEP
  16. #define FULL_STATESAVES_DIR FULL_USERDATA_DIR STATESAVES_DIR DIR_SEP
  17. -#define FULL_SCREENSHOTS_DIR FULL_USERDATA_DIR SCREENSHOTS_DIR DIR_SEP
  18. +#define FULL_SCREENSHOTS_DIR FULL_USERDATA_DIR SCREENSHOTS_DIR DIR_SEP
  19. +#define FULL_FRAMES_DIR FULL_USERDATA_DIR DUMP_DIR DIR_SEP DUMP_FRAMES_DIR
  20. #define FULL_DUMP_DIR FULL_USERDATA_DIR DUMP_DIR DIR_SEP
  21. #define FULL_DUMP_TEXTURES_DIR FULL_USERDATA_DIR DUMP_DIR DIR_SEP DUMP_TEXTURES_DIR
  22. #define FULL_LOGS_DIR FULL_USERDATA_DIR LOGS_DIR DIR_SEP
  23. Index: Source/Core/Core/Src/CoreRerecording.cpp
  24. ===================================================================
  25. --- Source/Core/Core/Src/CoreRerecording.cpp (revision 2684)
  26. +++ Source/Core/Core/Src/CoreRerecording.cpp (working copy)
  27. @@ -31,7 +31,6 @@
  28.  
  29. #include "Timer.h"
  30. #include "Common.h"
  31. -#include "ConsoleWindow.h"
  32.  
  33. #include "Console.h"
  34. #include "Core.h"
  35. Index: Source/Plugins/Plugin_VideoOGL/Src/Config.cpp
  36. ===================================================================
  37. --- Source/Plugins/Plugin_VideoOGL/Src/Config.cpp (revision 2684)
  38. +++ Source/Plugins/Plugin_VideoOGL/Src/Config.cpp (working copy)
  39. @@ -60,6 +60,7 @@
  40. iniFile.Get("Settings", "DLOptimize", &iCompileDLsLevel, 0);
  41. iniFile.Get("Settings", "DumpTextures", &bDumpTextures, 0);
  42. iniFile.Get("Settings", "DumpEFBTarget", &bDumpEFBTarget, 0);
  43. + iniFile.Get("Settings", "DumpFrames", &bDumpFrames, 0);
  44. iniFile.Get("Settings", "ShowShaderErrors", &bShowShaderErrors, 0);
  45. iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0);
  46. iniFile.Get("Settings", "DstAlphaPass", &bDstAlphaPass, false);
  47. @@ -105,6 +106,7 @@
  48. iniFile.Set("Settings", "Show", iCompileDLsLevel);
  49. iniFile.Set("Settings", "DumpTextures", bDumpTextures);
  50. iniFile.Set("Settings", "DumpEFBTarget", bDumpEFBTarget);
  51. + iniFile.Set("Settings", "DumpFrames", bDumpFrames);
  52. iniFile.Set("Settings", "ShowEFBCopyRegions", bShowEFBCopyRegions);
  53. iniFile.Set("Settings", "ShowShaderErrors", bShowShaderErrors);
  54. iniFile.Set("Settings", "MSAA", iMultisampleMode);
  55. Index: Source/Plugins/Plugin_VideoOGL/Src/Config.h
  56. ===================================================================
  57. --- Source/Plugins/Plugin_VideoOGL/Src/Config.h (revision 2684)
  58. +++ Source/Plugins/Plugin_VideoOGL/Src/Config.h (working copy)
  59. @@ -83,6 +83,7 @@
  60. // Utility
  61. bool bDumpTextures;
  62. bool bDumpEFBTarget;
  63. + bool bDumpFrames;
  64.  
  65. // Hacks
  66. bool bEFBCopyDisable;
  67. Index: Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp
  68. ===================================================================
  69. --- Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp (revision 2684)
  70. +++ Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp (working copy)
  71. @@ -54,6 +54,7 @@
  72. EVT_CHECKBOX(ID_TEXFMTCENTER, ConfigDialog::AdvancedSettingsChanged)
  73. EVT_CHECKBOX(ID_DUMPTEXTURES, ConfigDialog::AdvancedSettingsChanged)
  74. EVT_CHECKBOX(ID_DUMPEFBTARGET, ConfigDialog::AdvancedSettingsChanged)
  75. + EVT_CHECKBOX(ID_DUMPFRAMES, ConfigDialog::AdvancedSettingsChanged)
  76. EVT_CHECKBOX(ID_DISABLELIGHTING, ConfigDialog::AdvancedSettingsChanged)
  77. EVT_CHECKBOX(ID_DISABLETEXTURING, ConfigDialog::AdvancedSettingsChanged)
  78. EVT_CHECKBOX(ID_EFBCOPYDISABLEHOTKEY, ConfigDialog::AdvancedSettingsChanged)
  79. @@ -334,6 +335,13 @@
  80. m_DumpTextures->SetValue(g_Config.bDumpTextures);
  81. m_DumpEFBTarget = new wxCheckBox(m_PageAdvanced, ID_DUMPEFBTARGET, wxT("Dump EFB Target"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
  82. m_DumpEFBTarget->SetValue(g_Config.bDumpEFBTarget);
  83. + m_DumpFrames = new wxCheckBox(m_PageAdvanced, ID_DUMPFRAMES, wxT("Dump Rendered Frames"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
  84. + m_DumpFrames->SetToolTip(wxT(
  85. + "!!WARNING!! This option dumps raw bitmaps of each frame, and will fill up"
  86. + " your hard drive very quickly. Only turn this on if you have at least"
  87. + " several gigabytes of space available if you plan to play with it on for"
  88. + " more than a couple minutes."));
  89. + m_DumpFrames->SetValue(g_Config.bDumpFrames);
  90.  
  91. // Hacks controls
  92. m_SafeTextureCache = new wxCheckBox(m_PageAdvanced, ID_SAFETEXTURECACHE, wxT("Use Safe texture cache"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
  93. @@ -394,6 +402,7 @@
  94. sUtilities = new wxBoxSizer(wxHORIZONTAL);
  95. sUtilities->Add(m_DumpTextures, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
  96. sUtilities->Add(m_DumpEFBTarget, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
  97. + sUtilities->Add(m_DumpFrames, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
  98. sbUtilities->Add(sUtilities, 1, wxEXPAND);
  99.  
  100. // Sizers
  101. @@ -525,6 +534,9 @@
  102. case ID_DUMPEFBTARGET:
  103. g_Config.bDumpEFBTarget = m_DumpEFBTarget->IsChecked();
  104. break;
  105. + case ID_DUMPFRAMES:
  106. + g_Config.bDumpFrames = m_DumpFrames->IsChecked();
  107. + break;
  108. case ID_TEXTUREPATH:
  109. break;
  110. case ID_CHECKBOX_DISABLECOPYEFB:
  111. Index: Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h
  112. ===================================================================
  113. --- Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h (revision 2684)
  114. +++ Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h (working copy)
  115. @@ -106,6 +106,7 @@
  116. wxCheckBox *m_DstAlphaPass;
  117. wxCheckBox *m_DumpTextures;
  118. wxCheckBox *m_DumpEFBTarget;
  119. + wxCheckBox *m_DumpFrames;
  120. wxStaticBox * m_StaticBox_EFB;
  121. wxCheckBox *m_CheckBox_DisableCopyEFB;
  122. wxRadioButton *m_Radio_CopyEFBToRAM, *m_Radio_CopyEFBToGL;
  123. @@ -161,6 +162,7 @@
  124.  
  125. ID_DUMPTEXTURES,
  126. ID_DUMPEFBTARGET,
  127. + ID_DUMPFRAMES,
  128. ID_TEXTUREPATH,
  129.  
  130. ID_CHECKBOX_DISABLECOPYEFB,
  131. Index: Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
  132. ===================================================================
  133. --- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp (revision 2684)
  134. +++ Source/Plugins/Plugin_VideoOGL/Src/Render.cpp (working copy)
  135. @@ -19,6 +19,7 @@
  136.  
  137. #include <vector>
  138. #include <cmath>
  139. +#include <stdio.h>
  140.  
  141. #include "GLUtil.h"
  142.  
  143. @@ -71,6 +72,9 @@
  144.  
  145. static bool s_bFullscreen = false;
  146.  
  147. +static bool s_bLastFrameDumped = false;
  148. +FILE* f_pFrameDump;
  149. +
  150. static int nZBufferRender = 0; // if > 0, then use zbuffer render, and count down.
  151.  
  152. // 1 for no MSAA. Use s_MSAASamples > 1 to check for MSAA.
  153. @@ -1094,7 +1098,44 @@
  154. s_bScreenshot = false;
  155. s_criticalScreenshot.Leave();
  156. }
  157. +
  158. + // Frame dumps are handled a little differently
  159. + if (g_Config.bDumpFrames) {
  160. + s_criticalScreenshot.Enter();
  161. + char movie_file_name[255];
  162. + int w = OpenGL_GetBackbufferWidth();
  163. + int h = OpenGL_GetBackbufferHeight();
  164. + u8 *data = (u8 *) malloc(3 * w * h);
  165. + glPixelStorei(GL_PACK_ALIGNMENT, 1);
  166. + glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, data);
  167. + if (glGetError() == GL_NO_ERROR) {
  168. + if (!s_bLastFrameDumped) {
  169. + sprintf(movie_file_name, "%s/framedump.raw", FULL_FRAMES_DIR);
  170. + f_pFrameDump = fopen(movie_file_name, "wb");
  171. + if (f_pFrameDump == NULL) {
  172. + PanicAlert("Error opening framedump.raw for writing.");
  173. + } else {
  174. + char msg [255];
  175. + sprintf(msg, "Dumping Frames to \"%s\" (%dx%d RGB24)", movie_file_name, w, h);
  176. + OSD::AddMessage(msg, 2000);
  177. + }
  178. + }
  179. + if (f_pFrameDump != NULL) {
  180. + fwrite(data, w * 3, h, f_pFrameDump);
  181. + fflush(f_pFrameDump);
  182. + }
  183. + s_bLastFrameDumped = true;
  184. + }
  185. + free(data);
  186. + s_criticalScreenshot.Leave();
  187. + } else {
  188. + if(s_bLastFrameDumped && f_pFrameDump != NULL) {
  189. + fclose(f_pFrameDump);
  190. + }
  191.  
  192. + s_bLastFrameDumped = false;
  193. + }
  194. +
  195. // Place messages on the picture, then copy it to the screen
  196. SwapBuffers();
  197. s_bNativeResolution = g_Config.bNativeResolution;
  198. @@ -1329,6 +1370,20 @@
  199. glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, data);
  200. if (glGetError() != GL_NO_ERROR)
  201. return false;
  202. + FlipImageData(data, w, h);
  203. +#if defined(HAVE_WX) && HAVE_WX
  204. + wxImage a(w, h, data);
  205. + a.SaveFile(wxString::FromAscii(filename), wxBITMAP_TYPE_BMP);
  206. + bool result = true;
  207. +#else
  208. + bool result = SaveTGA(filename, w, h, data);
  209. + free(data);
  210. +#endif
  211. + return result;
  212. +}
  213. +
  214. +void Renderer::FlipImageData(u8 *data, int w, int h)
  215. +{
  216. // Flip image upside down. Damn OpenGL.
  217. for (int y = 0; y < h / 2; y++)
  218. {
  219. @@ -1339,16 +1394,6 @@
  220. std::swap(data[(y * w + x) * 3 + 2], data[((h - 1 - y) * w + x) * 3 + 2]);
  221. }
  222. }
  223. -
  224. -#if defined(HAVE_WX) && HAVE_WX
  225. - wxImage a(w, h, data);
  226. - a.SaveFile(wxString::FromAscii(filename), wxBITMAP_TYPE_BMP);
  227. - bool result = true;
  228. -#else
  229. - bool result = SaveTGA(filename, w, h, data);
  230. - free(data);
  231. -#endif
  232. - return result;
  233. }
  234.  
  235. //////////////////////////////////////////////////////////////////////////////////////
  236. Index: Source/Plugins/Plugin_VideoOGL/Src/Render.h
  237. ===================================================================
  238. --- Source/Plugins/Plugin_VideoOGL/Src/Render.h (revision 2684)
  239. +++ Source/Plugins/Plugin_VideoOGL/Src/Render.h (working copy)
  240. @@ -100,6 +100,7 @@
  241. static void RenderText(const char* pstr, int left, int top, u32 color);
  242. static void DrawDebugText();
  243. static void SetScreenshot(const char *filename);
  244. + static void FlipImageData(u8 *data, int w, int h);
  245. static bool SaveRenderTarget(const char *filename, int w, int h);
  246.  
  247. // Finish up the current frame, print some stats
  248.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement