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