--- np2/win9xc/np2.cpp 2004/03/21 11:47:20 1.25 +++ np2/win9xc/np2.cpp 2005/03/20 08:58:20 1.32 @@ -18,7 +18,7 @@ #include "winkbd.h" #include "ini.h" #include "menu.h" -#include "debugwin.h" +#include "subwind.h" #include "dialog.h" #include "cpucore.h" #include "pccore.h" @@ -42,13 +42,13 @@ #endif #if defined(SUPPORT_PC9821) - const char szAppCaption[] = "Neko Project-21"; + const TCHAR szAppCaption[] = _T("Neko Project-21"); #elif defined(CPUCORE_IA32) - const char szAppCaption[] = "Neko Project II (IA-32)"; + const TCHAR szAppCaption[] = _T("Neko Project II (IA-32)"); #else - const char szAppCaption[] = "Neko Project II (C Version)"; + const TCHAR szAppCaption[] = _T("Neko Project II (C Version)"); #endif -static const char szClassName[] = "NP2-MainWindow"; +static const TCHAR szClassName[] = _T("NP2-MainWindow"); HWND hWndMain; HINSTANCE hInst; HINSTANCE hPrev; @@ -59,21 +59,21 @@ static const char szClassName[] = "NP2-M 0, 0, 0, {1, 2, 2, 1}, 0, 0, 0}; - char modulefile[MAX_PATH]; - char fddfolder[MAX_PATH]; - char hddfolder[MAX_PATH]; - char bmpfilefolder[MAX_PATH]; + TCHAR modulefile[MAX_PATH]; + TCHAR fddfolder[MAX_PATH]; + TCHAR hddfolder[MAX_PATH]; + TCHAR bmpfilefolder[MAX_PATH]; static UINT framecnt = 0; static UINT waitcnt = 0; static UINT framemax = 1; static int np2opening = 1; static int np2quitmsg = 0; -static BYTE scrnmode; +static UINT8 scrnmode; -static const char np2help[] = "np2.chm"; -static const char np2flagext[] = "S%02d"; +static const TCHAR np2help[] = _T("np2.chm"); +static const TCHAR np2flagext[] = _T("S%02d"); static void winuienter(void) { @@ -88,10 +88,10 @@ static void winuileave(void) { soundmng_enable(SNDPROC_MAIN); } -static void changescreen(BYTE newmode) { +static void changescreen(UINT8 newmode) { - BYTE change; - BYTE renewal; + UINT8 change; + UINT8 renewal; change = scrnmode ^ newmode; renewal = (change & SCRNMODE_FULLSCREEN); @@ -129,7 +129,7 @@ static void changescreen(BYTE newmode) { #define SUPPORT_RESUME #if defined(SUPPORT_RESUME) || defined(SUPPORT_STATSAVE) -static void getstatfilename(char *path, const char *ext, int size) { +static void getstatfilename(TCHAR *path, const TCHAR *ext, int size) { file_cpyname(path, modulefile, size); file_cutext(path); @@ -137,12 +137,12 @@ static void getstatfilename(char *path, file_catname(path, ext, size); } -static int flagsave(const char *ext) { +static int flagsave(const TCHAR *ext) { int ret; - char path[MAX_PATH]; + TCHAR path[MAX_PATH]; - getstatfilename(path, ext, sizeof(path)); + getstatfilename(path, ext, NELEMENTS(path)); soundmng_stop(); ret = statsave_save(path); if (ret) { @@ -152,32 +152,33 @@ static int flagsave(const char *ext) { return(ret); } -static void flagdelete(const char *ext) { +static void flagdelete(const TCHAR *ext) { - char path[MAX_PATH]; + TCHAR path[MAX_PATH]; - getstatfilename(path, ext, sizeof(path)); + getstatfilename(path, ext, NELEMENTS(path)); file_delete(path); } -static int flagload(const char *ext, const char *title, BOOL force) { +static int flagload(const TCHAR *ext, const TCHAR *title, BOOL force) { int ret; int id; - char path[MAX_PATH]; - char buf[1024]; + TCHAR path[MAX_PATH]; + TCHAR buf[1024]; - getstatfilename(path, ext, sizeof(path)); + getstatfilename(path, ext, NELEMENTS(path)); winuienter(); id = IDYES; - ret = statsave_check(path, buf, sizeof(buf)); + ret = statsave_check(path, buf, NELEMENTS(buf)); if (ret & (~STATFLAG_DISKCHG)) { - MessageBox(hWndMain, "Couldn't restart", title, MB_OK | MB_ICONSTOP); + MessageBox(hWndMain, _T("Couldn't restart"), title, + MB_OK | MB_ICONSTOP); id = IDNO; } else if ((!force) && (ret & STATFLAG_DISKCHG)) { - char buf2[1024 + 256]; - wsprintf(buf2, "Conflict!\n\n%s\nContinue?", buf); + TCHAR buf2[1024 + 256]; + wsprintf(buf2, _T("Conflict!\n\n%s\nContinue?"), buf); id = MessageBox(hWndMain, buf2, title, MB_YESNOCANCEL | MB_ICONQUESTION); } @@ -552,13 +553,20 @@ static void np2cmd(HWND hWnd, UINT16 cmd dialog_writebmp(hWnd); winuileave(); break; - +#if defined(SUPPPORT_S98) case IDM_S98LOGGING: winuienter(); dialog_s98(hWnd); winuileave(); break; - +#endif +#if defined(SUPPORT_WAVEREC) + case IDM_WAVEREC: + winuienter(); + dialog_waverec(hWnd); + winuileave(); + break; +#endif case IDM_CALENDAR: winuienter(); DialogBox(hInst, MAKEINTRESOURCE(IDD_CALENDAR), @@ -657,7 +665,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT GetClientRect(hWnd, &rect); width = rect.right - rect.left; height = rect.bottom - rect.top; - hbmp = LoadBitmap(hinst, "NP2BMP"); + hbmp = LoadBitmap(hinst, _T("NP2BMP")); GetObject(hbmp, sizeof(BITMAP), &bmp); hbrush = (HBRUSH)SelectObject(hdc, GetStockObject(BLACK_BRUSH)); @@ -693,6 +701,12 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT } break; + case WM_SIZE: + if (wParam == SIZE_RESTORED) { + scrnmng_restoresize(); + } + break; + case WM_ENTERMENULOOP: winuienter(); if (scrnmng_isfullscreen()) { @@ -812,7 +826,8 @@ static void framereset(void) { framecnt = 0; sysmng_updatecaption(); - debugwin_process(); + memdbg_process(); + skbdwin_process(); } static void processwait(UINT cnt) { @@ -840,11 +855,13 @@ int WINAPI WinMain(HINSTANCE hInstance, _MEM_INIT(); - GetModuleFileName(NULL, modulefile, sizeof(modulefile)); + GetModuleFileName(NULL, modulefile, NELEMENTS(modulefile)); dosio_init(); file_setcd(modulefile); - np2arg_analize(lpszCmdLine); + np2arg_analize(); initload(); + memdbg_readini(); + skbdwin_readini(); rand_setseed((unsigned)time(NULL)); @@ -871,7 +888,7 @@ int WINAPI WinMain(HINSTANCE hInstance, np2oscfg.KEYBOARD = KEY_KEY106; } } - keystat_reset(); + keystat_initialize(); if (!hPreInst) { wc.style = CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW; @@ -888,7 +905,8 @@ int WINAPI WinMain(HINSTANCE hInstance, return(FALSE); } } - debugwin_initapp(hInstance); + memdbg_initialize(hInstance); + skbdwin_initialize(hInstance); mousemng_initialize(); @@ -946,7 +964,7 @@ int WINAPI WinMain(HINSTANCE hInstance, if (scrnmng_create(scrnmode) != SUCCESS) { scrnmode ^= SCRNMODE_FULLSCREEN; if (scrnmng_create(scrnmode) != SUCCESS) { - MessageBox(hWnd, "Couldn't create DirectDraw Object", + MessageBox(hWnd, _T("Couldn't create DirectDraw Object"), szAppCaption, MB_OK | MB_ICONSTOP); return(FALSE); } @@ -972,8 +990,6 @@ int WINAPI WinMain(HINSTANCE hInstance, pccore_reset(); - debugwin_create(); - np2opening = 0; // ¤ì¤¸¤¦¤à @@ -1007,6 +1023,9 @@ int WINAPI WinMain(HINSTANCE hInstance, } } + memdbg_create(); + skbdwin_create(); + while(1) { if (PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE)) { if (!GetMessage(&msg, NULL, 0, 0)) { @@ -1097,15 +1116,20 @@ int WINAPI WinMain(HINSTANCE hInstance, #endif pccore_term(); - debugwin_destroy(); + memdbg_destroy(); + skbdwin_destroy(); soundmng_deinitialize(); scrnmng_destroy(); if (sys_updates & (SYS_UPDATECFG | SYS_UPDATEOSCFG)) { initsave(); + memdbg_writeini(); + skbdwin_writeini(); } + skbdwin_deinitialize(); + TRACETERM(); _MEM_USED("report.txt"); dosio_term();