--- np2/win9x/np2.cpp 2003/10/25 16:01:21 1.10 +++ np2/win9x/np2.cpp 2003/10/26 11:51:46 1.12 @@ -5,8 +5,10 @@ #endif #include "resource.h" #include "strres.h" +#include "parts.h" #include "np2.h" #include "np2arg.h" +#include "cputype.h" #include "dosio.h" #include "extromio.h" #include "commng.h" @@ -55,6 +57,7 @@ static char szClassName[] = "NP2-MainWi HWND hWndMain; HINSTANCE hInst; HINSTANCE hPrev; + int mmxflag; NP2OSCFG np2oscfg = { "Neko Project II", "NP2", @@ -66,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}; // ver0.34 + 0, 1, 0, 9801, 0, 0, 0, 0, 0}; // ver0.38 char fddfolder[MAX_PATH]; char hddfolder[MAX_PATH]; @@ -831,34 +834,31 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT case WM_PAINT: hdc = BeginPaint(hWnd, &ps); if (np2opening) { - - HDC hmdc; + HINSTANCE hinst; + RECT rect; + int width; + int height; HBITMAP hbmp; BITMAP bmp; - HINSTANCE hinst; - int sx = 640 + np2oscfg.paddingx; - int sy = 400 + np2oscfg.paddingy; - + HDC hmdc; + HBRUSH hbrush; hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE); -#if 1 + GetClientRect(hWnd, &rect); + width = rect.right - rect.left; + height = rect.bottom - rect.top; hbmp = LoadBitmap(hinst, "NP2BMP"); GetObject(hbmp, sizeof(BITMAP), &bmp); + hbrush = (HBRUSH)SelectObject(hdc, + GetStockObject(BLACK_BRUSH)); + PatBlt(hdc, 0, 0, width, height, PATCOPY); + SelectObject(hdc, hbrush); hmdc = CreateCompatibleDC(hdc); SelectObject(hmdc, hbmp); - BitBlt(hdc, (sx - 252) / 2, (sy - 28) / 2, + BitBlt(hdc, (width - bmp.bmWidth) / 2, + (height - bmp.bmHeight) / 2, bmp.bmWidth, bmp.bmHeight, hmdc, 0, 0, SRCCOPY); DeleteDC(hmdc); DeleteObject(hbmp); -#else - hbmp = LoadBitmap(hinst, "NP2EXT"); - GetObject(hbmp, sizeof(BITMAP), &bmp); - hmdc = CreateCompatibleDC(hdc); - SelectObject(hmdc, hbmp); - BitBlt(hdc, (sx - 160) / 2, (sy - 140) / 2, - bmp.bmWidth, bmp.bmHeight, hmdc, 0, 0, SRCCOPY); - DeleteDC(hmdc); - DeleteObject(hbmp); -#endif } else { // scrnmng_update(); @@ -912,6 +912,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT case WM_KEYDOWN: if (wParam == VK_F11) { + scrnmng_enablemenubar(); return(DefWindowProc(hWnd, WM_SYSKEYDOWN, VK_F10, lParam)); } if ((wParam == VK_F12) && (!np2oscfg.F12COPY)) { @@ -923,6 +924,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT winkeydown106(wParam, lParam); } break; + case WM_KEYUP: if (wParam == VK_F11) { return(DefWindowProc(hWnd, WM_SYSKEYUP, VK_F10, lParam)); @@ -950,10 +952,19 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT winkeyup106(wParam, lParam); break; + case WM_MOUSEMOVE: + if (scrnmng_isfullscreen()) { + POINT p; + if (GetCursorPos(&p)) { + scrnmng_fullscrnmenu(p.y); + } + } + break; + case WM_LBUTTONDOWN: if (!mouse_btn(MOUSE_LEFTDOWN)) { if (scrnmng_isfullscreen()) { - POINT p; + POINT p; if ((GetCursorPos(&p)) && (p.y >= 466)) { np2oscfg.clk_x++; sysmng_update(SYS_UPDATEOSCFG); @@ -963,6 +974,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT return(DefWindowProc(hWnd, msg, wParam, lParam)); } break; + case WM_LBUTTONUP: if (!mouse_btn(MOUSE_LEFTUP)) { return(DefWindowProc(hWnd, msg, wParam, lParam)); @@ -1117,7 +1129,7 @@ int WINAPI WinMain(HINSTANCE hInstance, np2arg_analize(lpszCmdLine); initload(); - srand((unsigned)time(NULL)); + rand_setseed((unsigned)time(NULL)); CopyMemory(szClassName, np2oscfg.winid, 3); @@ -1131,6 +1143,8 @@ int WINAPI WinMain(HINSTANCE hInstance, hInst = hInstance; hPrev = hPreInst; + mmxflag = (havemmx())?0:MMXFLAG_NOTSUPPORT; + mmxflag += (np2oscfg.disablemmx)?MMXFLAG_DISABLE:0; TRACEINIT(); if (np2oscfg.KEYBOARD >= KEY_TYPEMAX) { // ver0.28 @@ -1155,7 +1169,7 @@ int WINAPI WinMain(HINSTANCE hInstance, np2.hInstance = hInstance; np2.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1)); np2.hCursor = LoadCursor(NULL, IDC_ARROW); - np2.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); + np2.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH); np2.lpszMenuName = MAKEINTRESOURCE(IDM_MAIN); np2.lpszClassName = szClassName; if (!RegisterClass(&np2)) {