浏览代码

设置截图图片路径,统一放到temp目录下。

Jeff 3 年之前
父节点
当前提交
63c6e12ee2
共有 2 个文件被更改,包括 11 次插入4 次删除
  1. 10 4
      GameAssist/GameAssist/Assist.cpp
  2. 1 0
      GameAssist/GameAssist/Assist.h

+ 10 - 4
GameAssist/GameAssist/Assist.cpp

@@ -2,6 +2,7 @@
 #include "Assist.h"
 
 #include <D3D9.h>
+#include<direct.h>
 //#include <D3dx9tex.h>
 //#pragma comment(lib, "D3dx9.lib")
 
@@ -569,6 +570,7 @@ namespace GameGlobal
 	std::string g_strAppdir;
 	std::string g_strGameDir;
 	TCHAR g_szGameApp[MAX_PATH];
+	TCHAR g_szTempDir[MAX_PATH] = {0};
 	int nGameWndType;
 	int nAttackCount = 0;
 
@@ -584,7 +586,6 @@ namespace GameGlobal
 		_tcscat_s(g_szCurModuleDir, MAX_PATH, szDrive);
 		_tcscat_s(g_szCurModuleDir, MAX_PATH, szDir);
 
-		g_strAppdir = g_szCurModuleDir;
 		_stprintf_s(g_szAssistConfig, _T("%s%s"), g_szCurModuleDir, _T("Assist.ini"));
 
 		TCHAR szValue[MAX_PATH] = { 0 };
@@ -592,6 +593,11 @@ namespace GameGlobal
 		g_strGameDir = szValue;
 		GetPrivateProfileString(_T("Assist"), _T("GameApp"), _T(""), g_szGameApp, MAX_PATH, g_szAssistConfig);
 
+		g_strAppdir = g_szCurModuleDir;
+		_stprintf_s(g_szTempDir, _T("%s%s\\"), g_szCurModuleDir, _T("temp"));
+		if (!PathFileExists(g_szTempDir))
+			_mkdir(g_szTempDir);
+
 		// ¶ÁÈ¡´°¿ÚÀàÐÍ;
 		_stprintf_s(szValue, _T("%s%s"), g_szGameApp, _T("save\\config.ini"));
 		int ScreenWidth = GetPrivateProfileInt(_T("SysCfg"), _T("ScreenWidth"), 640, szValue);
@@ -610,9 +616,9 @@ namespace GameGlobal
 	{
 		TCHAR szName[MAX_PATH] = { 0 };
 		if ( lpName == NULL || lpName[0] == '\0')
-			_stprintf_s(szName, _T("%s%p.bmp"), GameGlobal::g_szCurModuleDir, hWnd);
+			_stprintf_s(szName, _T("%s%p.bmp"), GameGlobal::g_szTempDir, hWnd);
 		else
-		_stprintf_s(szName, _T("%s%p-%s.bmp"), GameGlobal::g_szCurModuleDir, hWnd, lpName);
+		_stprintf_s(szName, _T("%s%p-%s.bmp"), GameGlobal::g_szTempDir, hWnd, lpName);
 
 		return std::string(szName);
 	}
@@ -623,7 +629,7 @@ namespace ImgAssist
 	std::string CaptureGameWnd(HWND hWnd)
 	{
 		TCHAR szName[MAX_PATH] = {0};
-		_stprintf_s(szName, _T("%s%p.bmp"), GameGlobal::g_szCurModuleDir, hWnd);
+		_stprintf_s(szName, _T("%s%p.bmp"), GameGlobal::g_szTempDir, hWnd);
 		CaptureGameWnd(hWnd, szName);
 
 		return std::string(szName);

+ 1 - 0
GameAssist/GameAssist/Assist.h

@@ -24,6 +24,7 @@ namespace GameGlobal {
 	extern std::string g_strAppdir;
 	extern std::string g_strGameDir;
 	extern TCHAR g_szGameApp[MAX_PATH];
+	extern TCHAR g_szTempDir[MAX_PATH];
 	extern int nGameWndType;
 	extern int nAttackCount;