win32: add shift+ptrscrn to capture 256x384 to clipboard with no extra info

This commit is contained in:
zeromus 2010-04-22 21:10:12 +00:00
parent 6e4af3f8b0
commit 4069c5a517
1 changed files with 47 additions and 30 deletions

View File

@ -1942,7 +1942,7 @@ static BOOL LoadROM(const char * filename, const char * logicalName)
void OpenRecentROM(int listNum) void OpenRecentROM(int listNum)
{ {
if (listNum > MAX_RECENT_ROMS) return; //Just in case if (listNum > MAX_RECENT_ROMS) return; //Just in case
if (listNum >= RecentRoms.size()) return; if (listNum >= (int)RecentRoms.size()) return;
char filename[MAX_PATH]; char filename[MAX_PATH];
strcpy(filename, RecentRoms[listNum].c_str()); strcpy(filename, RecentRoms[listNum].c_str());
//LOG("Attempting to load %s\n",filename); //LOG("Attempting to load %s\n",filename);
@ -3416,7 +3416,7 @@ void FrameAdvance(bool state)
// Put screenshot in clipboard // Put screenshot in clipboard
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void ScreenshotToClipboard() void ScreenshotToClipboard(bool extraInfo)
{ {
const char* nameandver = EMU_DESMUME_NAME_AND_VERSION(); const char* nameandver = EMU_DESMUME_NAME_AND_VERSION();
bool twolinever = strlen(nameandver) > 32; bool twolinever = strlen(nameandver) > 32;
@ -3424,13 +3424,20 @@ void ScreenshotToClipboard()
HFONT hFont = CreateFont(14, 8, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, DEFAULT_CHARSET, HFONT hFont = CreateFont(14, 8, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH, "Lucida Console"); OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH, "Lucida Console");
int exHeight = 0;
if(extraInfo)
{
exHeight = (14 * (twolinever ? 6:5));
}
HDC hScreenDC = GetDC(NULL); HDC hScreenDC = GetDC(NULL);
HDC hMemDC = CreateCompatibleDC(hScreenDC); HDC hMemDC = CreateCompatibleDC(hScreenDC);
HBITMAP hMemBitmap = CreateCompatibleBitmap(hScreenDC, 256, 384 + (14 * (twolinever ? 6:5))); HBITMAP hMemBitmap = CreateCompatibleBitmap(hScreenDC, 256, 384 + exHeight);
HBITMAP hOldBitmap = (HBITMAP)SelectObject(hMemDC, hMemBitmap); HBITMAP hOldBitmap = (HBITMAP)SelectObject(hMemDC, hMemBitmap);
HFONT hOldFont = (HFONT)SelectObject(hMemDC, hFont); HFONT hOldFont = (HFONT)SelectObject(hMemDC, hFont);
RECT rc; SetRect(&rc, 0, 0, 256, 384 + (14 * (twolinever ? 6:5)));
RECT rc; SetRect(&rc, 0, 0, 256, 384 + exHeight);
BITMAPV4HEADER bmi; BITMAPV4HEADER bmi;
memset(&bmi, 0, sizeof(bmi)); memset(&bmi, 0, sizeof(bmi));
@ -3447,6 +3454,8 @@ void ScreenshotToClipboard()
FillRect(hMemDC, &rc, (HBRUSH)GetStockObject(WHITE_BRUSH)); FillRect(hMemDC, &rc, (HBRUSH)GetStockObject(WHITE_BRUSH));
SetDIBitsToDevice(hMemDC, 0, 0, 256, 384, 0, 0, 0, 384, &GPU_screen[0], (BITMAPINFO*)&bmi, DIB_RGB_COLORS); SetDIBitsToDevice(hMemDC, 0, 0, 256, 384, 0, 0, 0, 384, &GPU_screen[0], (BITMAPINFO*)&bmi, DIB_RGB_COLORS);
if(extraInfo)
{
SetBkColor(hMemDC, RGB(255, 255, 255)); SetBkColor(hMemDC, RGB(255, 255, 255));
SetTextColor(hMemDC, RGB(64, 64, 130)); SetTextColor(hMemDC, RGB(64, 64, 130));
@ -3475,6 +3484,7 @@ void ScreenshotToClipboard()
sprintf(str, "3D Render: %s", core3DList[cur3DCore]->name); sprintf(str, "3D Render: %s", core3DList[cur3DCore]->name);
TextOut(hMemDC, 8, 384 + 14 * (twolinever ? 5:4), str, strlen(str)); TextOut(hMemDC, 8, 384 + 14 * (twolinever ? 5:4), str, strlen(str));
}
OpenClipboard(NULL); OpenClipboard(NULL);
EmptyClipboard(); EmptyClipboard();
@ -4078,7 +4088,14 @@ DOKEYDOWN:
if (wParam == VK_SNAPSHOT) { if (wParam == VK_SNAPSHOT) {
if(GetKeyState(VK_CONTROL)&0x8000) if(GetKeyState(VK_CONTROL)&0x8000)
{ {
ScreenshotToClipboard(); //include extra info
ScreenshotToClipboard(true);
return 0;
}
else if(GetKeyState(VK_SHIFT)&0x8000)
{
//exclude extra info
ScreenshotToClipboard(false);
return 0; return 0;
} }
} }