| version 1.2, 2003/12/01 03:38:52 | version 1.12, 2004/02/18 03:24:48 | 
| Line 29 | Line 29 | 
 | #include        "fddfile.h" | #include        "fddfile.h" | 
 | #include        "font.h" | #include        "font.h" | 
 | #include        "timing.h" | #include        "timing.h" | 
| #include        "statsave.h" | #include        "keystat.h" | 
 | #include        "vramhdl.h" | #include        "vramhdl.h" | 
 | #include        "menubase.h" | #include        "menubase.h" | 
 | #include        "sysmenu.h" | #include        "sysmenu.h" | 
| Line 42  static const TCHAR szAppCaption[] = STRL | Line 42  static const TCHAR szAppCaption[] = STRL | 
 | static const TCHAR szClassName[] = STRLITERAL("NP2-MainWindow"); | static const TCHAR szClassName[] = STRLITERAL("NP2-MainWindow"); | 
 |  |  | 
 |  |  | 
| NP2OSCFG        np2oscfg = {0, 2, 0, 0}; | NP2OSCFG        np2oscfg = {0, 0, 0, 0, | 
|  | #if !defined(GX_DLL) | 
|  | CW_USEDEFAULT, CW_USEDEFAULT, | 
|  | #endif | 
|  | #if defined(WIN32_PLATFORM_PSPC) | 
|  | 0, 0, | 
|  | #endif | 
|  | 0}; | 
 | HWND            hWndMain; | HWND            hWndMain; | 
 | HINSTANCE       hInst; | HINSTANCE       hInst; | 
 | HINSTANCE       hPrev; | HINSTANCE       hPrev; | 
 | char            modulefile[MAX_PATH]; | char            modulefile[MAX_PATH]; | 
 |  | GXKeyList       gx_keylist; | 
 |  |  | 
| static  BOOL            sysrunning; | enum { | 
|  | SYSRUNNING_MAIN         = 1, | 
|  | SYSRUNNING_FORE         = 2 | 
|  | }; | 
|  |  | 
|  | static  UINT            sysrunning; | 
 | static  UINT            framecnt; | static  UINT            framecnt; | 
 | static  UINT            waitcnt; | static  UINT            waitcnt; | 
 | static  UINT            framemax = 1; | static  UINT            framemax = 1; | 
| Line 200  LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 213  LRESULT CALLBACK WndProc(HWND hWnd, UINT | 
 |  |  | 
 | #if defined(SUPPORT_SOFTKBD) | #if defined(SUPPORT_SOFTKBD) | 
 | softkbd_up(); | softkbd_up(); | 
 | TRACEOUT(("%d %d", LOWORD(lParam), HIWORD(lParam))); |  | 
 | if (menuvram) { | if (menuvram) { | 
 | menubase_moving(LOWORD(lParam), HIWORD(lParam), 2); | menubase_moving(LOWORD(lParam), HIWORD(lParam), 2); | 
 | } | } | 
| Line 218  LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 230  LRESULT CALLBACK WndProc(HWND hWnd, UINT | 
 | } | } | 
 | break; | break; | 
 |  |  | 
 |  | #if !defined(GX_DLL) | 
 |  | case WM_MOVE: | 
 |  | #if !defined(_WIN32_WCE) | 
 |  | if (!(GetWindowLong(hWnd, GWL_STYLE) & | 
 |  | (WS_MAXIMIZE | WS_MINIMIZE))) | 
 |  | #endif | 
 |  | { | 
 |  | RECT rc; | 
 |  | GetWindowRect(hWnd, &rc); | 
 |  | np2oscfg.winx = rc.left; | 
 |  | np2oscfg.winy = rc.top; | 
 |  | sysmng_update(SYS_UPDATEOSCFG); | 
 |  | } | 
 |  | break; | 
 |  | #endif | 
 |  |  | 
 | #if !defined(_WIN32_WCE) | #if !defined(_WIN32_WCE) | 
 | case WM_ENTERSIZEMOVE: | case WM_ENTERSIZEMOVE: | 
 | soundmng_stop(); | soundmng_stop(); | 
| Line 241  LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 269  LRESULT CALLBACK WndProc(HWND hWnd, UINT | 
 | if (sysrunning) { | if (sysrunning) { | 
 | if (LOWORD(wParam) != WA_INACTIVE) { | if (LOWORD(wParam) != WA_INACTIVE) { | 
 | GXResume(); | GXResume(); | 
 |  | #if defined(GX_DLL) | 
 | scrnmng_enable(TRUE); | scrnmng_enable(TRUE); | 
 |  | #endif | 
 | scrndraw_redraw(); | scrndraw_redraw(); | 
 | soundmng_enable(SNDPROC_MAIN); | soundmng_enable(SNDPROC_MAIN); | 
 |  | sysrunning |= SYSRUNNING_FORE; | 
 | } | } | 
 | else { | else { | 
 |  | sysrunning &= ~SYSRUNNING_FORE; | 
 | soundmng_disable(SNDPROC_MAIN); | soundmng_disable(SNDPROC_MAIN); | 
 |  | #if defined(GX_DLL) | 
 | scrnmng_enable(FALSE); | scrnmng_enable(FALSE); | 
 |  | #endif | 
 | GXSuspend(); | GXSuspend(); | 
 | } | } | 
 | } | } | 
| Line 274  static void processwait(UINT cnt) { | Line 308  static void processwait(UINT cnt) { | 
 | timing_setcount(0); | timing_setcount(0); | 
 | framereset(cnt); | framereset(cnt); | 
 | } | } | 
 |  | #if !defined(_WIN32_WCE) | 
 | else { | else { | 
 | Sleep(1); | Sleep(1); | 
 | } | } | 
 |  | #endif | 
 | } | } | 
 |  |  | 
 |  |  | 
| Line 360  int WINAPI WinMain(HINSTANCE hInstance, | Line 396  int WINAPI WinMain(HINSTANCE hInstance, | 
 | } | } | 
 | //      } | //      } | 
 |  |  | 
| #if !defined(WIN32_PLATFORM_PSPC) | #if !defined(GX_DLL) | 
 | hWnd = CreateWindow(szClassName, szAppCaption, | hWnd = CreateWindow(szClassName, szAppCaption, | 
 | WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | | WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | | 
 | WS_MINIMIZEBOX, | WS_MINIMIZEBOX, | 
| 0, 0, FULLSCREEN_WIDTH, FULLSCREEN_HEIGHT, | np2oscfg.winx, np2oscfg.winy, | 
|  | FULLSCREEN_WIDTH, FULLSCREEN_HEIGHT, | 
 | NULL, NULL, hInstance, NULL); | NULL, NULL, hInstance, NULL); | 
 | #else | #else | 
 | hWnd = CreateWindow(szClassName, szAppCaption, | hWnd = CreateWindow(szClassName, szAppCaption, | 
 | WS_VISIBLE, | WS_VISIBLE, | 
| 0, 0, | 0, 0, | 
 | GetSystemMetrics(SM_CXSCREEN), | GetSystemMetrics(SM_CXSCREEN), | 
 | GetSystemMetrics(SM_CYSCREEN), | GetSystemMetrics(SM_CYSCREEN), | 
 | NULL, NULL, hInstance, NULL); | NULL, NULL, hInstance, NULL); | 
| Line 400  int WINAPI WinMain(HINSTANCE hInstance, | Line 437  int WINAPI WinMain(HINSTANCE hInstance, | 
 | DestroyWindow(hWnd); | DestroyWindow(hWnd); | 
 | goto np2main_err3; | goto np2main_err3; | 
 | } | } | 
 |  | gx_keylist = GXGetDefaultKeys(GX_NORMALKEYS); | 
 |  | scrnmng_keybinds(); | 
 |  | #if defined(WIN32_PLATFORM_PSPC) | 
 |  | winkbd_bindinit(); | 
 |  | #endif | 
 |  |  | 
 | soundmng_initialize(); | soundmng_initialize(); | 
 | commng_initialize(); | commng_initialize(); | 
| Line 411  int WINAPI WinMain(HINSTANCE hInstance, | Line 453  int WINAPI WinMain(HINSTANCE hInstance, | 
 | pccore_reset(); | pccore_reset(); | 
 | scrndraw_redraw(); | scrndraw_redraw(); | 
 |  |  | 
| sysrunning = TRUE; | #if defined(WIN32_PLATFORM_PSPC) | 
|  | winkbd_bindcur(np2oscfg.bindcur); | 
|  | winkbd_bindbtn(np2oscfg.bindbtn); | 
|  | #endif | 
|  |  | 
|  | sysrunning |= SYSRUNNING_MAIN | SYSRUNNING_FORE; | 
 |  |  | 
 | if (np2oscfg.resume) { | if (np2oscfg.resume) { | 
 | id = flagload(str_sav, str_resume, FALSE); | id = flagload(str_sav, str_resume, FALSE); | 
| Line 437  int WINAPI WinMain(HINSTANCE hInstance, | Line 484  int WINAPI WinMain(HINSTANCE hInstance, | 
 | #endif | #endif | 
 | DispatchMessage(&msg); | DispatchMessage(&msg); | 
 | } | } | 
| else { | else if (sysrunning & SYSRUNNING_FORE) { | 
 | if (np2oscfg.NOWAIT) { | if (np2oscfg.NOWAIT) { | 
 | pccore_exec(framecnt == 0); | pccore_exec(framecnt == 0); | 
 | if (np2oscfg.DRAW_SKIP) {                       // nowait frame skip | if (np2oscfg.DRAW_SKIP) {                       // nowait frame skip | 
| Line 493  int WINAPI WinMain(HINSTANCE hInstance, | Line 540  int WINAPI WinMain(HINSTANCE hInstance, | 
 | } | } | 
 | } | } | 
 | } | } | 
 |  | else { | 
 |  | Sleep(100); | 
 |  | } | 
 | } | } | 
 |  |  | 
 | soundmng_disable(SNDPROC_MAIN); | soundmng_disable(SNDPROC_MAIN); |