--- np2/wince/w32/Attic/np2.cpp 2003/10/21 14:57:41 1.1 +++ np2/wince/w32/Attic/np2.cpp 2003/10/25 16:01:21 1.4 @@ -29,8 +29,8 @@ #include "debugsub.h" -static const char szAppCaption[] = STRLITERAL("Neko Project II"); -static const char szClassName[] = STRLITERAL("NP2-MainWindow"); +static const TCHAR szAppCaption[] = STRLITERAL("Neko Project II"); +static const TCHAR szClassName[] = STRLITERAL("NP2-MainWindow"); NP2OSCFG np2oscfg = {0, 2}; @@ -97,19 +97,11 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT PostQuitMessage(0); break; - case WM_NP2CMD: - switch(LOWORD(lParam)) { - case NP2CMD_EXIT: - case NP2CMD_EXIT2: - PostQuitMessage(0); - break; - - case NP2CMD_RESET: - pccore_cfgupdate(); - pccore_reset(); - break; - } +#if defined(WAVEMNG_CBMAIN) + case MM_WOM_DONE: + soundmng_cb(MM_WOM_DONE, (HWAVEOUT)wParam, (WAVEHDR *)lParam); break; +#endif default: return(DefWindowProc(hWnd, msg, wParam, lParam)); @@ -131,11 +123,18 @@ static void processwait(UINT waitcnt) { int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst, - LPSTR lpszCmdLine, int nCmdShow) { + LPTSTR lpszCmdLine, int nCmdShow) { WNDCLASS np2; MSG msg; HWND hwndorg; + hwndorg = FindWindow(szClassName, NULL); + if (hwndorg != NULL) { + ShowWindow(hwndorg, SW_RESTORE); + SetForegroundWindow(hwndorg); + return(FALSE); + } + GetModuleFileName(NULL, modulefile, sizeof(modulefile)); dosio_init(); file_setcd(modulefile); @@ -143,13 +142,6 @@ int WINAPI WinMain(HINSTANCE hInstance, srand((unsigned)time(NULL)); - if ((hwndorg = FindWindow(szClassName, NULL)) != NULL) { - ShowWindow(hwndorg, SW_RESTORE); - SetForegroundWindow(hwndorg); - dosio_term(); - return(FALSE); - } - hInst = hInstance; hPrev = hPreInst; TRACEINIT(); @@ -235,19 +227,27 @@ int WINAPI WinMain(HINSTANCE hInstance, } else { // auto skip if (!waitcnt) { + UINT cnt; pccore_exec(framecnt == 0); framecnt++; - if (timing_getcount() < framecnt) { + cnt = timing_getcount(); + if (framecnt > cnt) { waitcnt = framecnt; if (framemax > 1) { framemax--; } } else if (framecnt >= framemax) { - waitcnt = framecnt; if (framemax < 12) { framemax++; } + if (cnt >= 12) { + timing_reset(); + } + else { + timing_setcount(cnt - framecnt); + } + processwait(0); } } else {