--- np2/win9x/np2.cpp 2004/02/03 08:24:40 1.37 +++ np2/win9x/np2.cpp 2004/02/21 17:52:04 1.42 @@ -28,7 +28,7 @@ #include "juliet.h" #include "np2class.h" #include "dialog.h" -#include "memory.h" +#include "cpucore.h" #include "pccore.h" #include "iocore.h" #include "pc9861k.h" @@ -41,6 +41,7 @@ #include "diskdrv.h" #include "fddfile.h" #include "timing.h" +#include "keystat.h" #include "debugsub.h" #include "keydisp.h" #include "kdispwin.h" @@ -229,6 +230,10 @@ void np2active_renewal(void) { / } } + +// ---- resume and statsave + +#if defined(SUPPORT_RESUME) || defined(SUPPORT_STATSAVE) static void getstatfilename(char *path, const char *ext, int size) { file_cpyname(path, modulefile, size); @@ -271,11 +276,11 @@ static int flagload(const char *ext, con winuienter(); id = IDYES; ret = statsave_check(path, buf, sizeof(buf)); - if (ret & (~NP2FLAG_DISKCHG)) { + if (ret & (~STATFLAG_DISKCHG)) { MessageBox(hWndMain, "Couldn't restart", title, MB_OK | MB_ICONSTOP); id = IDNO; } - else if ((!force) && (ret & NP2FLAG_DISKCHG)) { + else if ((!force) && (ret & STATFLAG_DISKCHG)) { char buf2[1024 + 256]; wsprintf(buf2, "Conflict!\n\n%s\nContinue?", buf); id = MessageBox(hWndMain, buf2, title, @@ -291,6 +296,7 @@ static int flagload(const char *ext, con winuileave(); return(id); } +#endif // ---- proc @@ -593,6 +599,18 @@ static void np2cmd(HWND hWnd, UINT16 cmd update |= SYS_UPDATEOSCFG; break; + case IDM_USERKEY1: + xmenu_setf12copy(5); + winkbd_resetf12(); + update |= SYS_UPDATEOSCFG; + break; + + case IDM_USERKEY2: + xmenu_setf12copy(6); + winkbd_resetf12(); + update |= SYS_UPDATEOSCFG; + break; + case IDM_BEEPOFF: xmenu_setbeepvol(0); beep_setvol(0); @@ -807,18 +825,20 @@ static void np2cmd(HWND hWnd, UINT16 cmd break; default: +#if defined(SUPPORT_STATSAVE) if ((cmd >= IDM_FLAGSAVE) && - (cmd < (IDM_FLAGSAVE + STATSAVEMAX))) { + (cmd < (IDM_FLAGSAVE + SUPPORT_STATSAVE))) { char ext[4]; - wsprintf(ext, np2flagext, cmd - IDM_FLAGSAVE); + SPRINTF(ext, np2flagext, cmd - IDM_FLAGSAVE); flagsave(ext); } - if ((cmd >= IDM_FLAGLOAD) && - (cmd < (IDM_FLAGLOAD + STATSAVEMAX))) { + else if ((cmd >= IDM_FLAGLOAD) && + (cmd < (IDM_FLAGLOAD + SUPPORT_STATSAVE))) { char ext[4]; - wsprintf(ext, np2flagext, cmd - IDM_FLAGLOAD); + SPRINTF(ext, np2flagext, cmd - IDM_FLAGLOAD); flagload(ext, "Status Load", TRUE); } +#endif break; } sysmng_update(update); @@ -997,14 +1017,13 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT break; case WM_MOVE: - if (!scrnmng_isfullscreen()) { - if (!(GetWindowLong(hWnd, GWL_STYLE) & - (WS_MAXIMIZE | WS_MINIMIZE))) { - GetWindowRect(hWnd, &rc); - np2oscfg.winx = rc.left; - np2oscfg.winy = rc.top; - sysmng_update(SYS_UPDATEOSCFG); - } + if ((!scrnmng_isfullscreen()) && + (!(GetWindowLong(hWnd, GWL_STYLE) & + (WS_MAXIMIZE | WS_MINIMIZE)))) { + GetWindowRect(hWnd, &rc); + np2oscfg.winx = rc.left; + np2oscfg.winy = rc.top; + sysmng_update(SYS_UPDATEOSCFG); } break; @@ -1330,7 +1349,7 @@ int WINAPI WinMain(HINSTANCE hInstance, np2oscfg.KEYBOARD = KEY_KEY106; } } - keystat_reset(); + keystat_initialize(); np2class_initialize(hInstance); if (!hPreInst) { @@ -1352,22 +1371,14 @@ int WINAPI WinMain(HINSTANCE hInstance, kdispwin_initialize(hPreInst); viewer_init(hPreInst); -#if 1 - hWndMain = CreateWindowEx(0, - szClassName, np2oscfg.titles, + mousemng_initialize(); + + hWnd = CreateWindowEx(0, szClassName, np2oscfg.titles, WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX, np2oscfg.winx, np2oscfg.winy, 640, 400, NULL, NULL, hInstance, NULL); -#else // テスト - hWndMain = CreateWindowEx(0, - szClassName, np2oscfg.titles, - WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | - WS_MINIMIZEBOX, - np2oscfg.winx, np2oscfg.winy, 640, 400, - NULL, NULL, hInstance, NULL); -#endif - hWnd = hWndMain; + hWndMain = hWnd; scrnmng_initialize(); xmenu_setroltate(0); @@ -1392,7 +1403,6 @@ int WINAPI WinMain(HINSTANCE hInstance, xmenu_setbtnrapid(np2cfg.BTN_RAPID); xmenu_setmsrapid(np2cfg.MOUSERAPID); xmenu_setsstp(np2oscfg.sstp); - xmenu_seti286save(np2oscfg.I286SAVE); ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); @@ -1446,17 +1456,14 @@ int WINAPI WinMain(HINSTANCE hInstance, juliet_initialize(); } - mousemng_initialize(); if (np2oscfg.MOUSE_SW) { // ver0.30 mousemng_enable(MOUSEPROC_SYSTEM); } -// mousemng_enable(MOUSEPROC_WINUI); -// mousemng_enable(MOUSEPROC_BG); commng_initialize(); sysmng_initialize(); - joy_init(); + joymng_initialize(); pccore_init(); S98_init(); @@ -1473,6 +1480,7 @@ int WINAPI WinMain(HINSTANCE hInstance, np2opening = 0; // れじうむ +#if defined(SUPPORT_RESUME) if (np2oscfg.resume) { int id; @@ -1494,6 +1502,7 @@ int WINAPI WinMain(HINSTANCE hInstance, return(0); } } +#endif // リセットしてから… コマンドラインのディスク挿入。 // ver0.29 for (i=0; i<4; i++) { @@ -1527,8 +1536,8 @@ int WINAPI WinMain(HINSTANCE hInstance, } else { if (np2oscfg.NOWAIT) { - joy_flash(); - mousemng_callback(); + joymng_sync(); + mousemng_sync(); pccore_exec(framecnt == 0); dclock_callback(); if (np2oscfg.DRAW_SKIP) { // nowait frame skip @@ -1546,8 +1555,8 @@ int WINAPI WinMain(HINSTANCE hInstance, } else if (np2oscfg.DRAW_SKIP) { // frame skip if (framecnt < np2oscfg.DRAW_SKIP) { - joy_flash(); - mousemng_callback(); + joymng_sync(); + mousemng_sync(); pccore_exec(framecnt == 0); dclock_callback(); framecnt++; @@ -1559,8 +1568,8 @@ int WINAPI WinMain(HINSTANCE hInstance, else { // auto skip if (!waitcnt) { UINT cnt; - joy_flash(); - mousemng_callback(); + joymng_sync(); + mousemng_sync(); pccore_exec(framecnt == 0); dclock_callback(); framecnt++; @@ -1608,12 +1617,14 @@ int WINAPI WinMain(HINSTANCE hInstance, mousemng_disable(MOUSEPROC_WINUI); S98_trash(); +#if defined(SUPPORT_RESUME) if (np2oscfg.resume) { flagsave(str_sav); } else { flagdelete(str_sav); } +#endif juliet_YMF288Reset(); pccore_term();