|
|
| version 1.29, 2004/02/18 06:19:01 | version 1.39, 2005/03/21 02:24:23 |
|---|---|
| Line 31 | Line 31 |
| #include "fddfile.h" | #include "fddfile.h" |
| #define USE_RESUME | NP2OSCFG np2oscfg = {100, 100, |
| 0, 0, 0, 0, | |
| 0, 0, | |
| NP2OSCFG np2oscfg = {100, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0}; | #if defined(SUPPORT_RESUME) |
| 0, | |
| #endif | |
| #if defined(SUPPORT_STATSAVE) | |
| 0, | |
| #endif | |
| 0, 0}; | |
| WindowPtr hWndMain; | WindowPtr hWndMain; |
| BOOL np2running; | BOOL np2running; |
| Line 53 static BYTE scrnmode; | Line 59 static BYTE scrnmode; |
| #endif | #endif |
| static char target[MAX_PATH] = DEFAULTPATH; | static char target[MAX_PATH] = DEFAULTPATH; |
| #if !defined(SUPPORT_PC9821) | |
| static const char np2app[] = "np2"; | |
| #else | |
| static const char np2app[] = "np21"; | |
| #endif | |
| // ---- | |
| #if defined(SUPPORT_RESUME) | |
| static const char np2resumeext[] = ".sav"; | |
| #endif | |
| #if defined(SUPPORT_STATSAVE) | |
| static const char np2flagext[] = ".sv%u"; | |
| #endif | |
| #if defined(SUPPORT_RESUME) || defined(SUPPORT_STATSAVE) | |
| static void getstatfilename(char *path, const char *ext, UINT size) { | |
| file_cpyname(path, file_getcd(np2app), size); | |
| file_catname(path, ext, size); | |
| } | |
| static void flagsave(const char *ext) { | |
| char path[MAX_PATH]; | |
| getstatfilename(path, ext, sizeof(path)); | |
| statsave_save(path); | |
| } | |
| static void flagdelete(const char *ext) { | |
| char path[MAX_PATH]; | |
| getstatfilename(path, ext, sizeof(path)); | |
| file_delete(path); | |
| } | |
| static int flagload(const char *ext, BOOL force) { | |
| char path[MAX_PATH]; | |
| char buf[1024]; | |
| int r; | |
| int ret; | |
| static const char np2resume[] = "sav"; | getstatfilename(path, ext, sizeof(path)); |
| r = statsave_check(path, buf, sizeof(buf)); | |
| if (r & (~STATFLAG_DISKCHG)) { | |
| ResumeErrorDialogProc(); | |
| ret = IDCANCEL; | |
| } | |
| else if ((!force) && (r & STATFLAG_DISKCHG)) { | |
| ret = ResumeWarningDialogProc(buf); | |
| } | |
| else { | |
| ret = IDOK; | |
| } | |
| if (ret == IDOK) { | |
| statsave_load(path); | |
| } | |
| return(ret); | |
| } | |
| #endif | |
| // ---- おまじない | // ---- おまじない |
| Line 151 static void MenuBarInit(void) { | Line 219 static void MenuBarInit(void) { |
| EnableItem(GetMenuHandle(IDM_DEVICE), LoWord(IDM_MOUSE)); | EnableItem(GetMenuHandle(IDM_DEVICE), LoWord(IDM_MOUSE)); |
| EnableItem(GetMenuHandle(IDM_KEYBOARD), LoWord(IDM_F12MOUSE)); | EnableItem(GetMenuHandle(IDM_KEYBOARD), LoWord(IDM_F12MOUSE)); |
| #endif | #endif |
| if (!(np2cfg.fddequip & 1)) { | |
| DeleteMenu(IDM_FDD1); | |
| } | |
| if (!(np2cfg.fddequip & 2)) { | |
| DeleteMenu(IDM_FDD2); | |
| } | |
| if (!(np2cfg.fddequip & 4)) { | |
| DeleteMenu(IDM_FDD3); | |
| } | |
| if (!(np2cfg.fddequip & 8)) { | |
| DeleteMenu(IDM_FDD4); | |
| } | |
| #if defined(SUPPORT_STATSAVE) | |
| if (!np2oscfg.statsave) { | |
| #endif | |
| DeleteMenu(IDM_STATSAVE); | |
| #if defined(SUPPORT_STATSAVE) | |
| } | |
| #endif | |
| DrawMenuBar(); | DrawMenuBar(); |
| } | } |
| Line 163 static void HandleMenuChoice(long wParam | Line 253 static void HandleMenuChoice(long wParam |
| UINT update; | UINT update; |
| Str255 applname; | Str255 applname; |
| #if defined(SUPPORT_STATSAVE) | |
| UINT num; | |
| char ext[16]; | |
| #endif | |
| update = 0; | update = 0; |
| switch(wParam) { | switch(wParam) { |
| Line 207 static void HandleMenuChoice(long wParam | Line 301 static void HandleMenuChoice(long wParam |
| diskdrv_setfdd(1, NULL, 0); | diskdrv_setfdd(1, NULL, 0); |
| break; | break; |
| case IDM_FDD3OPEN: | |
| dialog_changefdd(2); | |
| break; | |
| case IDM_FDD3EJECT: | |
| diskdrv_setfdd(2, NULL, 0); | |
| break; | |
| case IDM_FDD4OPEN: | |
| dialog_changefdd(3); | |
| break; | |
| case IDM_FDD4EJECT: | |
| diskdrv_setfdd(3, NULL, 0); | |
| break; | |
| case IDM_SASI1OPEN: | case IDM_SASI1OPEN: |
| dialog_changehdd(0x00); | dialog_changehdd(0x00); |
| break; | break; |
| Line 322 static void HandleMenuChoice(long wParam | Line 432 static void HandleMenuChoice(long wParam |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; |
| break; | break; |
| case IDM_MIDIOPT: | |
| MPU98DialogProc(); | |
| break; | |
| case IDM_MIDIPANIC: | case IDM_MIDIPANIC: |
| rs232c_midipanic(); | rs232c_midipanic(); |
| mpu98ii_midipanic(); | mpu98ii_midipanic(); |
| Line 522 static void HandleMenuChoice(long wParam | Line 636 static void HandleMenuChoice(long wParam |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; |
| break; | break; |
| case IDM_MEM116: | |
| menu_setextmem(11); | |
| update |= SYS_UPDATECFG; | |
| break; | |
| case IDM_MEM136: | |
| menu_setextmem(13); | |
| update |= SYS_UPDATECFG; | |
| break; | |
| case IDM_BMPSAVE: | case IDM_BMPSAVE: |
| dialog_writebmp(); | dialog_writebmp(); |
| break; | break; |
| Line 562 static void HandleMenuChoice(long wParam | Line 686 static void HandleMenuChoice(long wParam |
| (void)OpenDeskAcc(applname); | (void)OpenDeskAcc(applname); |
| #endif | #endif |
| } | } |
| #if defined(SUPPORT_STATSAVE) | |
| else if (HiWord(wParam) == IDM_STATSAVE) { | |
| num = LoWord(wParam); | |
| if ((num >= 1) && (num < (1 + 10))) { | |
| SPRINTF(ext, np2flagext, num - 1); | |
| flagsave(ext); | |
| } | |
| else if ((num >= 12) && (num < (12 + 10))) { | |
| SPRINTF(ext, np2flagext, num - 12); | |
| flagload(ext, TRUE); | |
| } | |
| } | |
| #endif | |
| break; | break; |
| } | } |
| sysmng_update(update); | sysmng_update(update); |
| Line 709 static void processwait(UINT waitcnt) { | Line 846 static void processwait(UINT waitcnt) { |
| } | } |
| } | } |
| static void getstatfilename(char *path, const char *ext, int size) { | |
| file_cpyname(path, file_getcd("np2"), size); | |
| file_catname(path, str_dot, size); | |
| file_catname(path, ext, size); | |
| } | |
| static void flagsave(const char *ext) { | |
| char path[MAX_PATH]; | |
| getstatfilename(path, ext, sizeof(path)); | |
| statsave_save(path); | |
| } | |
| static void flagdelete(const char *ext) { | |
| char path[MAX_PATH]; | |
| getstatfilename(path, ext, sizeof(path)); | |
| file_delete(path); | |
| } | |
| static int flagload(const char *ext) { | |
| int ret; | |
| char path[MAX_PATH]; | |
| char buf[1024]; | |
| int r; | |
| ret = IDOK; | |
| getstatfilename(path, ext, sizeof(path)); | |
| r = statsave_check(path, buf, sizeof(buf)); | |
| if (r & (~NP2FLAG_DISKCHG)) { | |
| ResumeErrorDialogProc(); | |
| ret = IDCANCEL; | |
| } | |
| else if (r & NP2FLAG_DISKCHG) { | |
| ret = ResumeWarningDialogProc(buf); | |
| } | |
| if (ret == IDOK) { | |
| statsave_load(path); | |
| } | |
| return(ret); | |
| } | |
| int main(int argc, char *argv[]) { | int main(int argc, char *argv[]) { |
| Rect wRect; | Rect wRect; |
| Line 768 int main(int argc, char *argv[]) { | Line 859 int main(int argc, char *argv[]) { |
| InitToolBox(); | InitToolBox(); |
| macossub_init(); | macossub_init(); |
| MenuBarInit(); | |
| initload(); | initload(); |
| MenuBarInit(); | |
| TRACEINIT(); | TRACEINIT(); |
| keystat_initialize(); | |
| SetRect(&wRect, np2oscfg.posx, np2oscfg.posy, 100, 100); | SetRect(&wRect, np2oscfg.posx, np2oscfg.posy, 100, 100); |
| #if !defined(SUPPORT_PC9821) | |
| hWndMain = NewWindow(0, &wRect, "\pNeko Project II", FALSE, | hWndMain = NewWindow(0, &wRect, "\pNeko Project II", FALSE, |
| noGrowDocProc, (WindowPtr)-1, TRUE, 0); | noGrowDocProc, (WindowPtr)-1, TRUE, 0); |
| #else | |
| hWndMain = NewWindow(0, &wRect, "\pNeko Project 21", FALSE, | |
| noGrowDocProc, (WindowPtr)-1, TRUE, 0); | |
| #endif | |
| if (!hWndMain) { | if (!hWndMain) { |
| TRACETERM(); | TRACETERM(); |
| macossub_term(); | macossub_term(); |
| Line 789 int main(int argc, char *argv[]) { | Line 887 int main(int argc, char *argv[]) { |
| menu_setrotate(0); | menu_setrotate(0); |
| menu_setdispmode(np2cfg.DISPSYNC); | menu_setdispmode(np2cfg.DISPSYNC); |
| menu_setraster(np2cfg.RASTER); | |
| menu_setwaitflg(np2oscfg.NOWAIT); | menu_setwaitflg(np2oscfg.NOWAIT); |
| menu_setframe(np2oscfg.DRAW_SKIP); | menu_setframe(np2oscfg.DRAW_SKIP); |
| menu_setkey(0); | menu_setkey(0); |
| menu_setxshift(0); | menu_setxshift(0); |
| menu_setf11key(np2oscfg.F11KEY); | menu_setf11key(np2oscfg.F11KEY); |
| Line 800 int main(int argc, char *argv[]) { | Line 900 int main(int argc, char *argv[]) { |
| menu_setjastsnd(np2oscfg.jastsnd); | menu_setjastsnd(np2oscfg.jastsnd); |
| menu_setmotorflg(np2cfg.MOTOR); | menu_setmotorflg(np2cfg.MOTOR); |
| menu_setextmem(np2cfg.EXTMEM); | menu_setextmem(np2cfg.EXTMEM); |
| menu_setdispclk(np2oscfg.DISPCLK); | menu_setdispclk(np2oscfg.DISPCLK); |
| menu_setbtnrapid(np2cfg.BTN_RAPID); | menu_setbtnrapid(np2cfg.BTN_RAPID); |
| menu_setbtnmode(np2cfg.BTN_MODE); | menu_setbtnmode(np2cfg.BTN_MODE); |
| Line 834 int main(int argc, char *argv[]) { | Line 935 int main(int argc, char *argv[]) { |
| // scrndraw_redraw(); | // scrndraw_redraw(); |
| pccore_reset(); | pccore_reset(); |
| #if defined(SUPPORT_RESUME) | |
| if (np2oscfg.resume) { | if (np2oscfg.resume) { |
| flagload(np2resume); | flagload(np2resumeext, FALSE); |
| } | } |
| #endif | |
| SetEventMask(everyEvent); | SetEventMask(everyEvent); |
| Line 929 int main(int argc, char *argv[]) { | Line 1032 int main(int argc, char *argv[]) { |
| pccore_cfgupdate(); | pccore_cfgupdate(); |
| #if defined(SUPPORT_RESUME) | |
| if (np2oscfg.resume) { | if (np2oscfg.resume) { |
| flagsave(np2resume); | flagsave(np2resumeext); |
| } | } |
| else { | else { |
| flagdelete(np2resume); | flagdelete(np2resumeext); |
| } | } |
| #endif | |
| pccore_term(); | pccore_term(); |
| S98_trash(); | S98_trash(); |