1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-24 17:49:52 +01:00

configurable screenshot hotkey

This commit is contained in:
FunkyFr3sh 2017-11-12 15:11:22 +01:00
parent 3d7f370438
commit fbdfe63231
3 changed files with 8 additions and 2 deletions

BIN
ddraw.dll

Binary file not shown.

9
main.c
View File

@ -388,9 +388,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
} }
#ifdef HAVE_LIBPNG #ifdef HAVE_LIBPNG
if(wParam == VK_CONTROL || wParam == 0x53 /* S */) if(wParam == VK_CONTROL || wParam == ddraw->screenshotKey)
{ {
if(GetAsyncKeyState(VK_CONTROL) & 0x8000 && GetAsyncKeyState(0x53) & 0x8000) if(GetAsyncKeyState(VK_CONTROL) & 0x8000 && GetAsyncKeyState(ddraw->screenshotKey) & 0x8000)
{ {
screenshot(ddraw->primary); screenshot(ddraw->primary);
return 0; return 0;
@ -701,6 +701,8 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
"; Windows position, -1 = center to screen\n" "; Windows position, -1 = center to screen\n"
"posX=-1\n" "posX=-1\n"
"posY=-1\n" "posY=-1\n"
"; Screenshot Hotkey, default = CTRL + G\n"
"screenshotKey=G\n"
, fh); , fh);
fclose(fh); fclose(fh);
} }
@ -735,6 +737,9 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
This->boxing = TRUE; This->boxing = TRUE;
} }
GetPrivateProfileStringA("ddraw", "screenshotKey", "G", tmp, sizeof(tmp), This->ini_path);
ddraw->screenshotKey = tmp[0];
This->render.maxfps = GetPrivateProfileIntA("ddraw", "max_fps", 120, This->ini_path); This->render.maxfps = GetPrivateProfileIntA("ddraw", "max_fps", 120, This->ini_path);
This->render.width = GetPrivateProfileIntA("ddraw", "width", 0, This->ini_path); This->render.width = GetPrivateProfileIntA("ddraw", "width", 0, This->ini_path);
This->render.height = GetPrivateProfileIntA("ddraw", "height", 0, This->ini_path); This->render.height = GetPrivateProfileIntA("ddraw", "height", 0, This->ini_path);

1
main.h
View File

@ -86,6 +86,7 @@ typedef struct IDirectDrawImpl
int posX; int posX;
int posY; int posY;
char ini_path[MAX_PATH]; char ini_path[MAX_PATH];
char screenshotKey;
} IDirectDrawImpl; } IDirectDrawImpl;