|
|
| version 1.4, 2003/12/01 21:15:13 | version 1.18, 2004/06/20 04:32:18 |
|---|---|
| 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" |
| #if defined(SUPPORT_SOFTKBD) | |
| #include "softkbd.h" | #include "softkbd.h" |
| #endif | |
| static const TCHAR szAppCaption[] = STRLITERAL("Neko Project II"); | static const TCHAR szAppCaption[] = STRLITERAL("Neko Project II"); |
| 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) | #if defined(WIN32_PLATFORM_PSPC) |
| 0, 0, | 0, 0, |
| #endif | #endif |
| }; | 0}; |
| HWND hWndMain; | HWND hWndMain; |
| HINSTANCE hInst; | HINSTANCE hInst; |
| HINSTANCE hPrev; | HINSTANCE hPrev; |
| char modulefile[MAX_PATH]; | OEMCHAR modulefile[MAX_PATH]; |
| GXKeyList gx_keylist; | GXKeyList gx_keylist; |
| enum { | enum { |
| Line 106 static int flagload(const char *ext, con | Line 107 static int flagload(const char *ext, con |
| getstatfilename(path, ext, sizeof(path)); | getstatfilename(path, ext, sizeof(path)); |
| id = DID_YES; | id = DID_YES; |
| ret = statsave_check(path, buf, sizeof(buf)); | ret = statsave_check(path, buf, sizeof(buf)); |
| if (ret & (~NP2FLAG_DISKCHG)) { | if (ret & (~STATFLAG_DISKCHG)) { |
| menumbox("Couldn't restart", title, MBOX_OK | MBOX_ICONSTOP); | menumbox("Couldn't restart", title, MBOX_OK | MBOX_ICONSTOP); |
| id = DID_NO; | id = DID_NO; |
| } | } |
| else if ((!force) && (ret & NP2FLAG_DISKCHG)) { | else if ((!force) && (ret & STATFLAG_DISKCHG)) { |
| SPRINTF(buf2, "Conflict!\n\n%s\nContinue?", buf); | SPRINTF(buf2, "Conflict!\n\n%s\nContinue?", buf); |
| id = menumbox(buf2, title, MBOX_YESNOCAN | MBOX_ICONQUESTION); | id = menumbox(buf2, title, MBOX_YESNOCAN | MBOX_ICONQUESTION); |
| } | } |
| Line 199 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 200 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| } | } |
| else { | else { |
| #if defined(SUPPORT_SOFTKBD) | #if defined(SUPPORT_SOFTKBD) |
| softkbd_down(LOWORD(lParam), HIWORD(lParam)); | softkbd_down(LOWORD(lParam), HIWORD(lParam) - 200); |
| #endif | #endif |
| } | } |
| } | } |
| Line 227 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 228 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 250 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 267 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| if (sysrunning) { | if (sysrunning) { |
| if (LOWORD(wParam) != WA_INACTIVE) { | if (LOWORD(wParam) != WA_INACTIVE) { |
| GXResume(); | GXResume(); |
| #if defined(WIN32_PLATFORM_PSPC) | #if defined(GX_DLL) |
| scrnmng_enable(TRUE); | scrnmng_enable(TRUE); |
| #endif | #endif |
| scrndraw_redraw(); | scrndraw_redraw(); |
| Line 260 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 277 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| else { | else { |
| sysrunning &= ~SYSRUNNING_FORE; | sysrunning &= ~SYSRUNNING_FORE; |
| soundmng_disable(SNDPROC_MAIN); | soundmng_disable(SNDPROC_MAIN); |
| #if defined(WIN32_PLATFORM_PSPC) | #if defined(GX_DLL) |
| scrnmng_enable(FALSE); | scrnmng_enable(FALSE); |
| #endif | #endif |
| GXSuspend(); | GXSuspend(); |
| Line 289 static void processwait(UINT cnt) { | Line 306 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 | |
| } | } |
| // ---- | // ---- |
| #if !defined(UNICODE) | #if defined(UNICODE) && defined(OSLANG_SJIS) |
| #define GetModuleFileName_A(a, b, c) GetModuleFileName(a, b, c) | static DWORD _GetModuleFileName(HMODULE hModule, |
| #else | OEMCHAR *lpFileName, DWORD nSize) { |
| static DWORD GetModuleFileName_A(HMODULE hModule, | |
| LPSTR lpFileName, DWORD nSize) { | |
| TCHAR *FileNameW; | UINT16 ucs2[MAX_PATH]; |
| DWORD len; | |
| if (nSize) { | GetModuleFileName(hModule, ucs2, NELEMENTS(ucs2)); |
| FileNameW = (TCHAR *)_MALLOC(nSize * sizeof(TCHAR), "ModuleFile"); | nSize = WideCharToMultiByte(CP_ACP, 0, ucs2, -1, |
| if (FileNameW) { | |
| len = GetModuleFileName(hModule, FileNameW, nSize); | |
| nSize = WideCharToMultiByte(CP_ACP, 0, FileNameW, -1, | |
| lpFileName, nSize, NULL, NULL); | lpFileName, nSize, NULL, NULL); |
| if (nSize) { | if (nSize) { |
| nSize--; | nSize--; |
| } | } |
| _MFREE(FileNameW); | return(nSize); |
| } | } |
| else { | #elif defined(OSLANG_UTF8) |
| nSize = 0; | static DWORD _GetModuleFileName(HMODULE hModule, |
| } | OEMCHAR *lpFileName, DWORD nSize) { |
| UINT16 ucs2[MAX_PATH]; | |
| GetModuleFileName(hModule, ucs2, NELEMENTS(ucs2)); | |
| nSize = ucscnv_ucs2toutf8(lpFileName, nSize, ucs2, (UINT)-1); | |
| if (nSize) { | |
| nSize--; | |
| } | } |
| return(nSize); | return(nSize); |
| } | } |
| #else | |
| #define _GetModuleFileName(a, b, c) GetModuleFileName(a, b, c) | |
| #endif | #endif |
| int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst, | |
| LPTSTR lpszCmdLine, int nCmdShow) { | |
| #if defined(_WIN32_WCE) | |
| int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst, | |
| LPWSTR lpszCmdLine, int nCmdShow) | |
| #elif defined(UNICODE) | |
| int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPreInst, | |
| LPSTR lpszCmdLine, int nCmdShow) | |
| #else | |
| int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst, | |
| LPSTR lpszCmdLine, int nCmdShow) | |
| #endif | |
| { | |
| HWND hWnd; | HWND hWnd; |
| WNDCLASS np2; | WNDCLASS np2; |
| int id; | int id; |
| Line 345 int WINAPI WinMain(HINSTANCE hInstance, | Line 376 int WINAPI WinMain(HINSTANCE hInstance, |
| return(0); | return(0); |
| } | } |
| GetModuleFileName_A(NULL, modulefile, sizeof(modulefile)); | _GetModuleFileName(NULL, modulefile, sizeof(modulefile)); |
| dosio_init(); | dosio_init(); |
| file_setcd(modulefile); | file_setcd(modulefile); |
| initload(); | initload(); |
| Line 357 int WINAPI WinMain(HINSTANCE hInstance, | Line 388 int WINAPI WinMain(HINSTANCE hInstance, |
| TRACEINIT(); | TRACEINIT(); |
| inputmng_init(); | inputmng_init(); |
| keystat_reset(); | keystat_initialize(); |
| // if (!hPreInst) { | // if (!hPreInst) { |
| np2.style = CS_HREDRAW | CS_VREDRAW; | np2.style = CS_HREDRAW | CS_VREDRAW; |
| Line 375 int WINAPI WinMain(HINSTANCE hInstance, | Line 406 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); |