DirectDraw screenshot routine now also outputs file name on error;

Another attempt to make the routine not fire too many times in a row.
This commit is contained in:
OBattler
2016-07-11 03:26:08 +02:00
parent f379524294
commit c377f13cae
2 changed files with 46 additions and 11 deletions

View File

@@ -71,6 +71,8 @@ void SaveBitmap(char *szFilename,HBITMAP hBitmap)
BITMAPINFO bmpInfo;
BITMAPFILEHEADER bmpFileHeader;
char *szMessage;
do{
hdc=GetDC(NULL);
@@ -101,7 +103,8 @@ void SaveBitmap(char *szFilename,HBITMAP hBitmap)
if((fp = fopen(szFilename,"wb"))==NULL)
{
MessageBox( NULL, "Unable to Create Bitmap File", "Error", MB_OK|MB_ICONERROR);
sprintf(szMessage, "Unable to Create Bitmap File %s", szFilename);
MessageBox( NULL, szMessage, "Error", MB_OK|MB_ICONERROR);
break;
}

View File

@@ -43,6 +43,13 @@
#define MAPVK_VK_TO_VSC 0
#endif
static int do_screenshot = 0;
static int do_reset_cad = 0;
static int do_resethard = 0;
#ifndef RELEASE_BUILD
static int do_breakpoint = 0;
#endif
static int save_window_pos = 0;
uint64_t timer_freq;
@@ -747,6 +754,37 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
TranslateMessage(&messages);
DispatchMessage(&messages);
// if ((pcem_key[KEY_LCONTROL] || pcem_key[KEY_RCONTROL]) && pcem_key[KEY_END] && mousecapture)
if (pcem_key[0x58] && pcem_key[0x41] && do_screenshot)
{
take_screenshot();
do_screenshot = 0;
}
if (pcem_key[0x58] && pcem_key[0x44] && do_reset_cad)
{
pause=1;
Sleep(100);
resetpc_cad();
pause=0;
do_reset_cad = 0;
}
if (pcem_key[0x58] && pcem_key[0x43] && do_resethard)
{
pause=1;
Sleep(100);
resetpchard();
pause=0;
do_resethard = 0;
}
#ifndef RELEASE_BUILD
if (pcem_key[0x57] && pcem_key[0x58] && do_breakpoint)
{
pclog("Log breakpoint\n");
do_breakpoint = 0;
}
#endif
}
quited=1;
@@ -1297,29 +1335,23 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
if (pcem_key[0x58] && pcem_key[0x41])
{
take_screenshot();
do_screenshot = 1;
}
if (pcem_key[0x58] && pcem_key[0x44])
{
pause=1;
Sleep(100);
resetpc_cad();
pause=0;
do_reset_cad = 1;
}
if (pcem_key[0x58] && pcem_key[0x43])
{
pause=1;
Sleep(100);
resetpchard();
pause=0;
do_resethard = 1;
}
#ifndef RELEASE_BUILD
if (pcem_key[0x57] && pcem_key[0x58])
{
pclog("Log breakpoint\n");
do_breakpoint = 1;
}
#endif