--- np2/win9x/np2.cpp 2004/01/24 18:20:06 1.36 +++ np2/win9x/np2.cpp 2004/04/16 06:14:57 1.51 @@ -25,12 +25,10 @@ #include "sstpmsg.h" #include "dclock.h" #include "toolwin.h" -#ifdef USE_ROMEO #include "juliet.h" -#endif #include "np2class.h" #include "dialog.h" -#include "memory.h" +#include "cpucore.h" #include "pccore.h" #include "iocore.h" #include "pc9861k.h" @@ -43,9 +41,9 @@ #include "diskdrv.h" #include "fddfile.h" #include "timing.h" +#include "keystat.h" #include "debugsub.h" -#include "keydisp.h" -#include "kdispwin.h" +#include "subwind.h" #include "viewer.h" @@ -71,7 +69,7 @@ static char szClassName[] = "NP2-MainWi {0, 0, 0x3e, 19200, "", "", "", ""}, // ver0.34 {0, 0, 0x3e, 19200, "", "", "", ""}, // ver0.34 0xffffff, 0xffbf6a, 0, 0, - 0, 1, 0, 9801, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // ver0.73 + 0, 1, 0, 9801, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; char fddfolder[MAX_PATH]; char hddfolder[MAX_PATH]; @@ -108,13 +106,17 @@ static void winuileave(void) { WINLOCEX np2_winlocexallwin(HWND base) { - HWND list[3]; UINT i; + UINT cnt; + HWND list[5]; - list[0] = hWndMain; - list[1] = toolwin_gethwnd(); - list[2] = kdispwin_gethwnd(); - for (i=0; i<3; i++) { + cnt = 0; + list[cnt++] = hWndMain; + list[cnt++] = toolwin_gethwnd(); + list[cnt++] = kdispwin_gethwnd(); + list[cnt++] = skbdwin_gethwnd(); + list[cnt++] = mdbgwin_gethwnd(); + for (i=0; i= 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); @@ -859,6 +927,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT update |= SYS_UPDATEOSCFG; break; +#if defined(SUPPORT_KEYDISP) case IDM_KEYDISP: sysmenu_setkeydisp(np2oscfg.keydisp ^ 1); if (np2oscfg.keydisp) { @@ -868,7 +937,17 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT kdispwin_destroy(); } break; - +#endif +#if defined(SUPPORT_SOFTKBD) + case IDM_SOFTKBD: + skbdwin_create(); + break; +#endif +#if defined(CPUCORE_IA32) && defined(SUPPORT_MEMDBG32) + case IDM_MEMDBG32: + mdbgwin_create(); + break; +#endif case IDM_SCREENCENTER: if ((!scrnmng_isfullscreen()) && (!(GetWindowLong(hWnd, GWL_STYLE) & @@ -931,6 +1010,14 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT if (subwin) { ShowWindow(subwin, SW_SHOWNOACTIVATE); } + subwin = skbdwin_gethwnd(); + if (subwin) { + ShowWindow(subwin, SW_SHOWNOACTIVATE); + } + subwin = mdbgwin_gethwnd(); + if (subwin) { + ShowWindow(subwin, SW_SHOWNOACTIVATE); + } return(DefWindowProc(hWnd, msg, wParam, lParam)); default: @@ -998,14 +1085,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; @@ -1207,6 +1293,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT break; case NP2CMD_RESET: + juliet_YMF288Reset(); pccore_cfgupdate(); pccore_reset(); break; @@ -1258,6 +1345,8 @@ static void framereset(UINT cnt) { framecnt = 0; scrnmng_dispclock(); kdispwin_draw((BYTE)cnt); + skbdwin_process(); + mdbgwin_process(); toolwin_draw((BYTE)cnt); viewer_allreload(FALSE); if (np2oscfg.DISPCLK & 3) { @@ -1299,6 +1388,8 @@ int WINAPI WinMain(HINSTANCE hInstance, initload(); toolwin_readini(); kdispwin_readini(); + skbdwin_readini(); + mdbgwin_readini(); rand_setseed((unsigned)time(NULL)); @@ -1330,7 +1421,9 @@ int WINAPI WinMain(HINSTANCE hInstance, np2oscfg.KEYBOARD = KEY_KEY106; } } - keystat_reset(); + winkbd_roll(np2oscfg.KEYBOARD != KEY_PC98); + winkbd_setf12(np2oscfg.F12COPY); + keystat_initialize(); np2class_initialize(hInstance); if (!hPreInst) { @@ -1350,24 +1443,18 @@ int WINAPI WinMain(HINSTANCE hInstance, } toolwin_initapp(hInstance); kdispwin_initialize(hPreInst); + skbdwin_initialize(hPreInst); + mdbgwin_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 +1479,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); @@ -1442,22 +1528,18 @@ int WINAPI WinMain(HINSTANCE hInstance, soundmng_pcmvolume(SOUND_PCMSEEK1, np2cfg.MOTORVOL); } -#ifdef USE_ROMEO - juliet_load(); - juliet_prepare(); -#endif + if (np2oscfg.useromeo) { + 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(); @@ -1474,6 +1556,7 @@ int WINAPI WinMain(HINSTANCE hInstance, np2opening = 0; // れじうむ +#if defined(SUPPORT_RESUME) if (np2oscfg.resume) { int id; @@ -1495,6 +1578,7 @@ int WINAPI WinMain(HINSTANCE hInstance, return(0); } } +#endif // リセットしてから… コマンドラインのディスク挿入。 // ver0.29 for (i=0; i<4; i++) { @@ -1528,8 +1612,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 @@ -1547,8 +1631,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++; @@ -1560,8 +1644,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++; @@ -1603,29 +1687,29 @@ int WINAPI WinMain(HINSTANCE hInstance, } toolwin_destroy(); kdispwin_destroy(); + skbdwin_destroy(); + mdbgwin_destroy(); pccore_cfgupdate(); mousemng_disable(MOUSEPROC_WINUI); S98_trash(); +#if defined(SUPPORT_RESUME) if (np2oscfg.resume) { flagsave(str_sav); } else { flagdelete(str_sav); } +#endif -#ifdef USE_ROMEO juliet_YMF288Reset(); -#endif pccore_term(); sstp_destruct(); -#ifdef USE_ROMEO - juliet_unload(); -#endif + juliet_deinitialize(); soundmng_deinitialize(); scrnmng_destroy(); @@ -1634,7 +1718,10 @@ int WINAPI WinMain(HINSTANCE hInstance, initsave(); toolwin_writeini(); kdispwin_writeini(); + skbdwin_writeini(); + mdbgwin_writeini(); } + skbdwin_deinitialize(); TRACETERM(); _MEM_USED("report.txt");