|
|
| version 1.1, 2003/10/16 17:59:18 | version 1.9, 2003/11/15 07:10:03 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #include <time.h> | #include <time.h> |
| #include <winnls32.h> | #include <winnls32.h> |
| #include "resource.h" | |
| #include "strres.h" | #include "strres.h" |
| #include "parts.h" | |
| #include "resource.h" | |
| #include "np2.h" | #include "np2.h" |
| #include "np2arg.h" | #include "np2arg.h" |
| #include "dosio.h" | #include "dosio.h" |
| Line 51 static const char szClassName[] = "NP2-M | Line 52 static const char szClassName[] = "NP2-M |
| NP2OSCFG np2oscfg = { | NP2OSCFG np2oscfg = { |
| CW_USEDEFAULT, CW_USEDEFAULT, 1, 1, 0, 2, | CW_USEDEFAULT, CW_USEDEFAULT, 0, 2, |
| KEY_UNKNOWN, 0, | KEY_UNKNOWN, 0, |
| 0, 0, 0, {1, 2, 2, 1}, | 0, 0, 0, {1, 2, 2, 1}, |
| 0}; | 0}; |
| Line 299 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 300 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| case IDM_KEY: | case IDM_KEY: |
| xmenu_setkey(0); | xmenu_setkey(0); |
| update |= SYS_UPDATECFG; | |
| break; | break; |
| case IDM_JOY1: | case IDM_JOY1: |
| xmenu_setkey(1); | xmenu_setkey(1); |
| update |= SYS_UPDATECFG; | |
| break; | break; |
| case IDM_JOY2: | case IDM_JOY2: |
| xmenu_setkey(2); | xmenu_setkey(2); |
| update |= SYS_UPDATECFG; | |
| break; | break; |
| case IDM_XSHIFT: | case IDM_XSHIFT: |
| xmenu_setxshift(np2cfg.XSHIFT ^ 1); | xmenu_setxshift(np2cfg.XSHIFT ^ 1); |
| keystat_forcerelease(0x70); | keystat_forcerelease(0x70); |
| update |= SYS_UPDATECFG; | |
| break; | break; |
| case IDM_XCTRL: | case IDM_XCTRL: |
| xmenu_setxshift(np2cfg.XSHIFT ^ 2); | xmenu_setxshift(np2cfg.XSHIFT ^ 2); |
| keystat_forcerelease(0x74); | keystat_forcerelease(0x74); |
| update |= SYS_UPDATECFG; | |
| break; | break; |
| case IDM_XGRPH: | case IDM_XGRPH: |
| xmenu_setxshift(np2cfg.XSHIFT ^ 4); | xmenu_setxshift(np2cfg.XSHIFT ^ 4); |
| keystat_forcerelease(0x73); | keystat_forcerelease(0x73); |
| update |= SYS_UPDATECFG; | |
| break; | break; |
| case IDM_F12MOUSE: | case IDM_F12MOUSE: |
| xmenu_setf12copy(0); | xmenu_setf12copy(0); |
| keystat_resetcopyhelp(); | keystat_resetcopyhelp(); |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATEOSCFG; |
| break; | break; |
| case IDM_F12COPY: | case IDM_F12COPY: |
| xmenu_setf12copy(1); | xmenu_setf12copy(1); |
| keystat_resetcopyhelp(); | keystat_resetcopyhelp(); |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATEOSCFG; |
| break; | break; |
| case IDM_F12STOP: | case IDM_F12STOP: |
| xmenu_setf12copy(2); | xmenu_setf12copy(2); |
| keystat_resetcopyhelp(); | keystat_resetcopyhelp(); |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATEOSCFG; |
| break; | break; |
| case IDM_BEEPOFF: | case IDM_BEEPOFF: |
| Line 565 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 572 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| HBITMAP hbmp; | HBITMAP hbmp; |
| BITMAP bmp; | BITMAP bmp; |
| HINSTANCE hinst; | HINSTANCE hinst; |
| int sx = 640 + np2oscfg.paddingx; | int sx = 640; |
| int sy = 400 + np2oscfg.paddingy; | int sy = 400; |
| hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE); | hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE); |
| #if 1 | #if 1 |
| Line 724 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 731 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| return(0L); | return(0L); |
| } | } |
| static void framereset(void) { | |
| framecnt = 0; | |
| sysmng_updatecaption(); | |
| } | |
| static void processwait(UINT waitcnt) { | static void processwait(UINT waitcnt) { |
| if (timing_getcount() >= waitcnt) { | if (timing_getcount() >= waitcnt) { |
| timing_setcount(0); | timing_setcount(0); |
| framecnt = 0; | framereset(); |
| } | } |
| else { | else { |
| Sleep(1); | Sleep(1); |
| Line 754 int WINAPI WinMain(HINSTANCE hInstance, | Line 766 int WINAPI WinMain(HINSTANCE hInstance, |
| np2arg_analize(lpszCmdLine); // タイミング修正 // ver0.29 | np2arg_analize(lpszCmdLine); // タイミング修正 // ver0.29 |
| initload(); | initload(); |
| srand((unsigned)time(NULL)); | rand_setseed((unsigned)time(NULL)); |
| // np2arg_analize(lpszCmdLine); | |
| if ((hwndorg = FindWindow(szClassName, NULL)) != NULL) { | if ((hwndorg = FindWindow(szClassName, NULL)) != NULL) { |
| ShowWindow(hwndorg, SW_RESTORE); | ShowWindow(hwndorg, SW_RESTORE); |
| Line 930 int WINAPI WinMain(HINSTANCE hInstance, | Line 940 int WINAPI WinMain(HINSTANCE hInstance, |
| } | } |
| else { // auto skip | else { // auto skip |
| if (!waitcnt) { | if (!waitcnt) { |
| UINT cnt; | |
| joy_flash(); | joy_flash(); |
| mouse_callback(); | mouse_callback(); |
| pccore_exec(framecnt == 0); | pccore_exec(framecnt == 0); |
| framecnt++; | framecnt++; |
| if (timing_getcount() < framecnt) { | cnt = timing_getcount(); |
| if (framecnt > cnt) { | |
| waitcnt = framecnt; | waitcnt = framecnt; |
| if (framemax > 1) { | if (framemax > 1) { |
| framemax--; | framemax--; |
| } | } |
| } | } |
| else if (framecnt >= framemax) { | else if (framecnt >= framemax) { |
| waitcnt = framecnt; | |
| if (framemax < 12) { | if (framemax < 12) { |
| framemax++; | framemax++; |
| } | } |
| if (cnt >= 12) { | |
| timing_reset(); | |
| } | |
| else { | |
| timing_setcount(cnt - framecnt); | |
| } | |
| framereset(); | |
| } | } |
| } | } |
| else { | else { |