diff --git a/ryzom/client/src/client_cfg.cpp b/ryzom/client/src/client_cfg.cpp index 8a68b1140..c2ff6d927 100644 --- a/ryzom/client/src/client_cfg.cpp +++ b/ryzom/client/src/client_cfg.cpp @@ -412,6 +412,7 @@ CClientConfig::CClientConfig() CameraRecorderPrefix = "cam_rec"; CameraRecorderBlend = true; + ScreenShotDirectory = "screenshots"; ScreenShotWidth = 0; ScreenShotHeight = 0; ScreenShotFullDetail = true; @@ -1139,6 +1140,7 @@ void CClientConfig::setValues() READ_BOOL_FV(CameraRecorderBlend) // Screenshot + READ_STRING_FV(ScreenShotDirectory) READ_INT_FV(ScreenShotWidth) READ_INT_FV(ScreenShotHeight) READ_BOOL_FV(ScreenShotFullDetail) diff --git a/ryzom/client/src/client_cfg.h b/ryzom/client/src/client_cfg.h index 60be270fa..45a4cd6da 100644 --- a/ryzom/client/src/client_cfg.h +++ b/ryzom/client/src/client_cfg.h @@ -304,6 +304,7 @@ struct CClientConfig bool CameraRecorderBlend; /// Screen shot + string ScreenShotDirectory; uint ScreenShotWidth; // If 0 : normal screen shot, else custom screen shot without interface uint ScreenShotHeight; bool ScreenShotFullDetail; // If set to true, then load balancing will be disabled for the duration of the screenshot diff --git a/ryzom/client/src/interface_v3/action_handler_misc.cpp b/ryzom/client/src/interface_v3/action_handler_misc.cpp index 91e00807d..4c4b9e814 100644 --- a/ryzom/client/src/interface_v3/action_handler_misc.cpp +++ b/ryzom/client/src/interface_v3/action_handler_misc.cpp @@ -62,9 +62,6 @@ extern NLMISC::CLog g_log; //////////// //static CCDBNodeLeaf *MenuColorWidgetValue = NULL; // db entry for the color menu widget (Red) - -static const string ScreenshotsDirectory("screenshots/"); // don't forget the final / - void preRenderNewSky (); // *************************************************************************** @@ -602,11 +599,6 @@ void displayScreenShotSavedInfo(const string &filename) pIM->displaySystemInfo(msg); } -void initScreenshot() -{ - if (!CFile::isExists(ScreenshotsDirectory)) CFile::createDirectory(ScreenshotsDirectory); -} - bool screenshotZBuffer(const std::string &filename) { std::string::size_type pos = filename.find("."); @@ -672,6 +664,11 @@ bool screenshotZBuffer(const std::string &filename) static std::string findNewScreenShotFileName(std::string filename) { + // make screenshot directory if it does not exist + if (!CFile::isExists(ClientCfg.ScreenShotDirectory)) + CFile::createDirectory(ClientCfg.ScreenShotDirectory); + + filename = CPath::standardizePath(ClientCfg.ScreenShotDirectory) + filename; static char cstime[25]; time_t dtime; time(&dtime); @@ -698,7 +695,7 @@ void screenShotTGA() CBitmap btm; getBuffer (btm); - string filename = findNewScreenShotFileName(ScreenshotsDirectory+"screenshot.tga"); + string filename = findNewScreenShotFileName("screenshot.tga"); COFile fs(filename); if (!btm.writeTGA(fs, 24, false)) @@ -720,7 +717,7 @@ void screenShotPNG() CBitmap btm; getBuffer (btm); - string filename = findNewScreenShotFileName(ScreenshotsDirectory+"screenshot.png"); + string filename = findNewScreenShotFileName("screenshot.png"); COFile fs(filename); if (!btm.writePNG(fs, 24)) @@ -742,7 +739,7 @@ void screenShotJPG() CBitmap btm; getBuffer (btm); - string filename = findNewScreenShotFileName(ScreenshotsDirectory+"screenshot.jpg"); + string filename = findNewScreenShotFileName("screenshot.jpg"); COFile fs(filename); if (!btm.writeJPG(fs)) diff --git a/ryzom/client/src/interface_v3/action_handler_misc.h b/ryzom/client/src/interface_v3/action_handler_misc.h index 61fbbc552..2c5ba5ece 100644 --- a/ryzom/client/src/interface_v3/action_handler_misc.h +++ b/ryzom/client/src/interface_v3/action_handler_misc.h @@ -181,7 +181,6 @@ public: /** Capture current content of framebuffer and save the result. If a custom size is asked in ClientCfg, then the scene is rendered again * instead (possibly multiple time) */ -void initScreenshot(); void screenShotTGA(); void screenShotPNG(); void screenShotJPG(); diff --git a/ryzom/client/src/main_loop.cpp b/ryzom/client/src/main_loop.cpp index 492d54623..56452ba4a 100644 --- a/ryzom/client/src/main_loop.cpp +++ b/ryzom/client/src/main_loop.cpp @@ -1000,9 +1000,6 @@ bool mainLoop() // initialize the structure for the ping. Ping.init(); - // initialize screenshots directory - initScreenshot(); - // Call a function for a demo to init. if (ClientCfg.Local)