|
|
| version 1.16, 2004/02/13 20:31:55 | version 1.31, 2005/02/07 14:46:15 |
|---|---|
| Line 18 | Line 18 |
| #include "winkbd.h" | #include "winkbd.h" |
| #include "ini.h" | #include "ini.h" |
| #include "menu.h" | #include "menu.h" |
| #include "subwind.h" | |
| #include "dialog.h" | #include "dialog.h" |
| #include "cpucore.h" | #include "cpucore.h" |
| #include "pccore.h" | #include "pccore.h" |
| Line 32 | Line 33 |
| #include "diskdrv.h" | #include "diskdrv.h" |
| #include "fddfile.h" | #include "fddfile.h" |
| #include "timing.h" | #include "timing.h" |
| #include "keystat.h" | |
| #include "debugsub.h" | #include "debugsub.h" |
| Line 39 | Line 41 |
| #define OPENING_WAIT 1500 | #define OPENING_WAIT 1500 |
| #endif | #endif |
| #if defined(CPUCORE_IA32) | #if defined(SUPPORT_PC9821) |
| const char szAppCaption[] = "Neko Project-21"; | |
| #elif defined(CPUCORE_IA32) | |
| const char szAppCaption[] = "Neko Project II (IA-32)"; | const char szAppCaption[] = "Neko Project II (IA-32)"; |
| #else | #else |
| const char szAppCaption[] = "Neko Project II (C Version)"; | const char szAppCaption[] = "Neko Project II (C Version)"; |
| Line 53 static const char szClassName[] = "NP2-M | Line 57 static const char szClassName[] = "NP2-M |
| CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, | CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, |
| KEY_UNKNOWN, 0, | KEY_UNKNOWN, 0, |
| 0, 0, 0, {1, 2, 2, 1}, | 0, 0, 0, {1, 2, 2, 1}, |
| 0, 0}; | 0, 0, 0}; |
| char modulefile[MAX_PATH]; | char modulefile[MAX_PATH]; |
| char fddfolder[MAX_PATH]; | char fddfolder[MAX_PATH]; |
| Line 65 static UINT waitcnt = 0; | Line 69 static UINT waitcnt = 0; |
| static UINT framemax = 1; | static UINT framemax = 1; |
| static int np2opening = 1; | static int np2opening = 1; |
| static int np2quitmsg = 0; | static int np2quitmsg = 0; |
| static BYTE scrnmode; | static UINT8 scrnmode; |
| static const char np2help[] = "np2.chm"; | static const char np2help[] = "np2.chm"; |
| Line 84 static void winuileave(void) { | Line 88 static void winuileave(void) { |
| soundmng_enable(SNDPROC_MAIN); | soundmng_enable(SNDPROC_MAIN); |
| } | } |
| static void changescreen(BYTE newmode) { | static void changescreen(UINT8 newmode) { |
| BYTE change; | UINT8 change; |
| BYTE renewal; | UINT8 renewal; |
| change = scrnmode ^ newmode; | change = scrnmode ^ newmode; |
| renewal = (change & SCRNMODE_FULLSCREEN); | renewal = (change & SCRNMODE_FULLSCREEN); |
| Line 120 static void changescreen(BYTE newmode) { | Line 124 static void changescreen(BYTE newmode) { |
| } | } |
| // ---- resume and statsave | |
| #define SUPPORT_RESUME | |
| #if defined(SUPPORT_RESUME) || defined(SUPPORT_STATSAVE) | |
| static void getstatfilename(char *path, const char *ext, int size) { | |
| file_cpyname(path, modulefile, size); | |
| file_cutext(path); | |
| file_catname(path, str_dot, size); | |
| file_catname(path, ext, size); | |
| } | |
| static int flagsave(const char *ext) { | |
| int ret; | |
| char path[MAX_PATH]; | |
| getstatfilename(path, ext, sizeof(path)); | |
| soundmng_stop(); | |
| ret = statsave_save(path); | |
| if (ret) { | |
| file_delete(path); | |
| } | |
| soundmng_play(); | |
| return(ret); | |
| } | |
| static void flagdelete(const char *ext) { | |
| char path[MAX_PATH]; | |
| getstatfilename(path, ext, sizeof(path)); | |
| file_delete(path); | |
| } | |
| static int flagload(const char *ext, const char *title, BOOL force) { | |
| int ret; | |
| int id; | |
| char path[MAX_PATH]; | |
| char buf[1024]; | |
| getstatfilename(path, ext, sizeof(path)); | |
| winuienter(); | |
| id = IDYES; | |
| ret = statsave_check(path, buf, sizeof(buf)); | |
| if (ret & (~STATFLAG_DISKCHG)) { | |
| MessageBox(hWndMain, "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); | |
| id = MessageBox(hWndMain, buf2, title, | |
| MB_YESNOCANCEL | MB_ICONQUESTION); | |
| } | |
| if (id == IDYES) { | |
| statsave_load(path); | |
| } | |
| sysmng_workclockreset(); | |
| sysmng_updatecaption(); | |
| winuileave(); | |
| return(id); | |
| } | |
| #endif | |
| // ---- proc | // ---- proc |
| static void np2cmd(HWND hWnd, UINT16 cmd) { | static void np2cmd(HWND hWnd, UINT16 cmd) { |
| Line 440 static void np2cmd(HWND hWnd, UINT16 cmd | Line 512 static void np2cmd(HWND hWnd, UINT16 cmd |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; |
| break; | break; |
| case IDM_MEM116: | |
| xmenu_setextmem(11); | |
| update |= SYS_UPDATECFG; | |
| break; | |
| case IDM_MEM136: | |
| xmenu_setextmem(13); | |
| update |= SYS_UPDATECFG; | |
| break; | |
| case IDM_MOUSE: | case IDM_MOUSE: |
| mousemng_toggle(MOUSEPROC_SYSTEM); | mousemng_toggle(MOUSEPROC_SYSTEM); |
| xmenu_setmouse(np2oscfg.MOUSE_SW ^ 1); | xmenu_setmouse(np2oscfg.MOUSE_SW ^ 1); |
| Line 470 static void np2cmd(HWND hWnd, UINT16 cmd | Line 552 static void np2cmd(HWND hWnd, UINT16 cmd |
| dialog_writebmp(hWnd); | dialog_writebmp(hWnd); |
| winuileave(); | winuileave(); |
| break; | break; |
| #if defined(SUPPPORT_S98) | |
| case IDM_S98LOGGING: | case IDM_S98LOGGING: |
| winuienter(); | winuienter(); |
| dialog_s98(hWnd); | dialog_s98(hWnd); |
| winuileave(); | winuileave(); |
| break; | break; |
| #endif | |
| #if defined(SUPPORT_WAVEREC) | |
| case IDM_WAVEREC: | |
| winuienter(); | |
| dialog_waverec(hWnd); | |
| winuileave(); | |
| break; | |
| #endif | |
| case IDM_CALENDAR: | case IDM_CALENDAR: |
| winuienter(); | winuienter(); |
| DialogBox(hInst, MAKEINTRESOURCE(IDD_CALENDAR), | DialogBox(hInst, MAKEINTRESOURCE(IDD_CALENDAR), |
| Line 611 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 700 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| } | } |
| break; | break; |
| case WM_SIZE: | |
| if (wParam == SIZE_RESTORED) { | |
| scrnmng_restoresize(); | |
| } | |
| break; | |
| case WM_ENTERMENULOOP: | case WM_ENTERMENULOOP: |
| winuienter(); | winuienter(); |
| if (scrnmng_isfullscreen()) { | if (scrnmng_isfullscreen()) { |
| Line 730 static void framereset(void) { | Line 825 static void framereset(void) { |
| framecnt = 0; | framecnt = 0; |
| sysmng_updatecaption(); | sysmng_updatecaption(); |
| memdbg_process(); | |
| skbdwin_process(); | |
| } | } |
| static void processwait(UINT cnt) { | static void processwait(UINT cnt) { |
| Line 762 int WINAPI WinMain(HINSTANCE hInstance, | Line 859 int WINAPI WinMain(HINSTANCE hInstance, |
| file_setcd(modulefile); | file_setcd(modulefile); |
| np2arg_analize(lpszCmdLine); | np2arg_analize(lpszCmdLine); |
| initload(); | initload(); |
| memdbg_readini(); | |
| skbdwin_readini(); | |
| rand_setseed((unsigned)time(NULL)); | rand_setseed((unsigned)time(NULL)); |
| Line 788 int WINAPI WinMain(HINSTANCE hInstance, | Line 887 int WINAPI WinMain(HINSTANCE hInstance, |
| np2oscfg.KEYBOARD = KEY_KEY106; | np2oscfg.KEYBOARD = KEY_KEY106; |
| } | } |
| } | } |
| keystat_reset(); | keystat_initialize(); |
| if (!hPreInst) { | if (!hPreInst) { |
| wc.style = CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW; | wc.style = CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW; |
| Line 805 int WINAPI WinMain(HINSTANCE hInstance, | Line 904 int WINAPI WinMain(HINSTANCE hInstance, |
| return(FALSE); | return(FALSE); |
| } | } |
| } | } |
| memdbg_initialize(hInstance); | |
| skbdwin_initialize(hInstance); | |
| mousemng_initialize(); | mousemng_initialize(); |
| Line 890 int WINAPI WinMain(HINSTANCE hInstance, | Line 991 int WINAPI WinMain(HINSTANCE hInstance, |
| np2opening = 0; | np2opening = 0; |
| // れじうむ | |
| #if defined(SUPPORT_RESUME) | |
| if (np2oscfg.resume) { | |
| int id; | |
| id = flagload(str_sav, str_resume, FALSE); | |
| if (id == IDYES) { | |
| for (i=0; i<4; i++) np2arg.disk[i] = NULL; | |
| } | |
| else if (id == IDCANCEL) { | |
| DestroyWindow(hWnd); | |
| mousemng_disable(MOUSEPROC_WINUI); | |
| S98_trash(); | |
| pccore_term(); | |
| soundmng_deinitialize(); | |
| scrnmng_destroy(); | |
| TRACETERM(); | |
| dosio_term(); | |
| return(0); | |
| } | |
| } | |
| #endif | |
| // リセットしてから… コマンドラインのディスク挿入。 // ver0.29 | // リセットしてから… コマンドラインのディスク挿入。 // ver0.29 |
| for (i=0; i<4; i++) { | for (i=0; i<4; i++) { |
| if (np2arg.disk[i]) { | if (np2arg.disk[i]) { |
| Line 898 int WINAPI WinMain(HINSTANCE hInstance, | Line 1022 int WINAPI WinMain(HINSTANCE hInstance, |
| } | } |
| } | } |
| memdbg_create(); | |
| skbdwin_create(); | |
| while(1) { | while(1) { |
| if (PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE)) { | if (PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE)) { |
| if (!GetMessage(&msg, NULL, 0, 0)) { | if (!GetMessage(&msg, NULL, 0, 0)) { |
| Line 978 int WINAPI WinMain(HINSTANCE hInstance, | Line 1105 int WINAPI WinMain(HINSTANCE hInstance, |
| mousemng_disable(MOUSEPROC_WINUI); | mousemng_disable(MOUSEPROC_WINUI); |
| S98_trash(); | S98_trash(); |
| #if defined(SUPPORT_RESUME) | |
| if (np2oscfg.resume) { | |
| flagsave(str_sav); | |
| } | |
| else { | |
| flagdelete(str_sav); | |
| } | |
| #endif | |
| pccore_term(); | pccore_term(); |
| memdbg_destroy(); | |
| skbdwin_destroy(); | |
| soundmng_deinitialize(); | soundmng_deinitialize(); |
| scrnmng_destroy(); | scrnmng_destroy(); |
| if (sys_updates & (SYS_UPDATECFG | SYS_UPDATEOSCFG)) { | if (sys_updates & (SYS_UPDATECFG | SYS_UPDATEOSCFG)) { |
| initsave(); | initsave(); |
| memdbg_writeini(); | |
| skbdwin_writeini(); | |
| } | } |
| skbdwin_deinitialize(); | |
| TRACETERM(); | TRACETERM(); |
| _MEM_USED("report.txt"); | _MEM_USED("report.txt"); |
| dosio_term(); | dosio_term(); |