Changed the screenshot and CTRL+ALT+DEL combinations to be handled by Win32 Accelerators and added menu item to take screenshot.
This commit is contained in:
11
src/pc.rc
11
src/pc.rc
@@ -1,4 +1,5 @@
|
||||
#include <windows.h>
|
||||
#include "acc.h"
|
||||
#include "resources.h"
|
||||
|
||||
#ifndef UPDOWN_CLASS
|
||||
@@ -10,7 +11,7 @@ BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
MENUITEM "&Hard Reset", IDM_FILE_HRESET
|
||||
MENUITEM "&Ctrl+Alt+Del", IDM_FILE_RESET_CAD
|
||||
MENUITEM "&Ctrl+Alt+Del\tCtrl+F12",IDM_FILE_RESET_CAD
|
||||
MENUITEM "E&xit", IDM_FILE_EXIT
|
||||
END
|
||||
POPUP "&Disc"
|
||||
@@ -46,6 +47,8 @@ BEGIN
|
||||
MENUITEM "&Square pixels", IDM_VID_FS_SQ
|
||||
MENUITEM "&Integer scale", IDM_VID_FS_INT
|
||||
END
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Take s&creenshot\tCtrl+F11", IDM_VID_SCREENSHOT
|
||||
END
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Load configuration...", IDM_CONFIG_LOAD
|
||||
@@ -57,6 +60,12 @@ BEGIN
|
||||
END
|
||||
END
|
||||
|
||||
MainAccel ACCELERATORS
|
||||
BEGIN
|
||||
VK_F11, IDM_VID_SCREENSHOT, CONTROL, VIRTKEY
|
||||
VK_F12, IDM_FILE_RESET_CAD, CONTROL, VIRTKEY
|
||||
END
|
||||
|
||||
ConfigureDlg DIALOGEX 0, 0, 248+40, 248+60
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Configure PCem"
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#define IDM_VID_FS_43 40072
|
||||
#define IDM_VID_FS_SQ 40073
|
||||
#define IDM_VID_FS_INT 40074
|
||||
#define IDM_VID_SCREENSHOT 40075
|
||||
#define IDM_CDROM_ISO 40100
|
||||
#define IDM_CDROM_EMPTY 40200
|
||||
#define IDM_CDROM_REAL 40200
|
||||
|
112
src/win.c
112
src/win.c
@@ -43,13 +43,6 @@
|
||||
#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;
|
||||
|
||||
@@ -513,6 +506,8 @@ static void process_command_line()
|
||||
argv[argc] = NULL;
|
||||
}
|
||||
|
||||
HANDLE hinstAcc;
|
||||
|
||||
int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpszArgument,
|
||||
@@ -522,8 +517,9 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||
HWND hwnd; /* This is the handle for our window */
|
||||
MSG messages; /* Here messages to the application are saved */
|
||||
WNDCLASSEX wincl; /* Data structure for the windowclass */
|
||||
int c, d;
|
||||
int c, d, bRet;
|
||||
LARGE_INTEGER qpc_freq;
|
||||
HACCEL haccel; /* Handle to accelerator table */
|
||||
|
||||
process_command_line();
|
||||
|
||||
@@ -577,6 +573,11 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||
/* Make the window visible on the screen */
|
||||
ShowWindow (hwnd, nFunsterStil);
|
||||
|
||||
/* Load the accelerator table */
|
||||
haccel = LoadAccelerators(hinstAcc, "MainAccel");
|
||||
if (haccel == NULL)
|
||||
fatal("haccel is null\n");
|
||||
|
||||
// win_set_window(hwnd);
|
||||
|
||||
memset(rawinputkey, 0, sizeof(rawinputkey));
|
||||
@@ -748,43 +749,35 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||
}
|
||||
}*/
|
||||
|
||||
while (GetMessage(&messages,NULL,0,0) && !quited)
|
||||
while (((bRet = GetMessage(&messages,NULL,0,0)) != 0) && !quited)
|
||||
{
|
||||
if (bRet == -1)
|
||||
{
|
||||
fatal("bRet is -1\n");
|
||||
}
|
||||
|
||||
if (messages.message==WM_QUIT) quited=1;
|
||||
TranslateMessage(&messages);
|
||||
DispatchMessage(&messages);
|
||||
if (!TranslateAccelerator(hwnd, haccel, &messages))
|
||||
{
|
||||
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[0x42] && mousecapture)
|
||||
{
|
||||
ClipCursor(&oldclip);
|
||||
ShowCursor(TRUE);
|
||||
mousecapture=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[0x1D] || pcem_key[0x9D]) &&
|
||||
(pcem_key[0x38] || pcem_key[0xB8]) &&
|
||||
(pcem_key[0x51] || pcem_key[0xD1]) &&
|
||||
video_fullscreen)
|
||||
{
|
||||
leave_fullscreen();
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -1079,6 +1072,10 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||
saveconfig();
|
||||
break;
|
||||
|
||||
case IDM_VID_SCREENSHOT:
|
||||
take_screenshot();
|
||||
break;
|
||||
|
||||
case IDM_CONFIG_LOAD:
|
||||
pause = 1;
|
||||
if (!getfile(hwnd, "Configuration (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0", ""))
|
||||
@@ -1325,43 +1322,6 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||
free(raw);
|
||||
|
||||
}
|
||||
|
||||
if (pcem_key[0x58] && pcem_key[0x42] && mousecapture)
|
||||
{
|
||||
ClipCursor(&oldclip);
|
||||
ShowCursor(TRUE);
|
||||
mousecapture=0;
|
||||
}
|
||||
|
||||
if (pcem_key[0x58] && pcem_key[0x41])
|
||||
{
|
||||
do_screenshot = 1;
|
||||
}
|
||||
|
||||
if (pcem_key[0x58] && pcem_key[0x44])
|
||||
{
|
||||
do_reset_cad = 1;
|
||||
}
|
||||
|
||||
if (pcem_key[0x58] && pcem_key[0x43])
|
||||
{
|
||||
do_resethard = 1;
|
||||
}
|
||||
|
||||
#ifndef RELEASE_BUILD
|
||||
if (pcem_key[0x57] && pcem_key[0x58])
|
||||
{
|
||||
do_breakpoint = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((pcem_key[0x1D] || pcem_key[0x9D]) &&
|
||||
(pcem_key[0x38] || pcem_key[0xB8]) &&
|
||||
(pcem_key[0x51] || pcem_key[0xD1]) &&
|
||||
video_fullscreen)
|
||||
{
|
||||
leave_fullscreen();
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_SETFOCUS:
|
||||
|
Reference in New Issue
Block a user