| version 1.35, 2004/05/21 14:30:32 | 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 59  static const char np2app[] = "np2"; | Line 65  static const char np2app[] = "np2"; | 
 | static const char np2app[] = "np21"; | static const char np2app[] = "np21"; | 
 | #endif | #endif | 
 |  |  | 
| static const char np2resume[] = "sav"; |  | 
|  | // ---- | 
|  |  | 
|  | #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; | 
|  |  | 
|  | 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 170  static void MenuBarInit(void) { | Line 233  static void MenuBarInit(void) { | 
 | DeleteMenu(IDM_FDD4); | DeleteMenu(IDM_FDD4); | 
 | } | } | 
 |  |  | 
 |  | #if defined(SUPPORT_STATSAVE) | 
 |  | if (!np2oscfg.statsave) { | 
 |  | #endif | 
 |  | DeleteMenu(IDM_STATSAVE); | 
 |  | #if defined(SUPPORT_STATSAVE) | 
 |  | } | 
 |  | #endif | 
 |  |  | 
 | DrawMenuBar(); | DrawMenuBar(); | 
 | } | } | 
 |  |  | 
| Line 182  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 561  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 601  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 748  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(np2app), 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 & (~STATFLAG_DISKCHG)) { |  | 
 | ResumeErrorDialogProc(); |  | 
 | ret = IDCANCEL; |  | 
 | } |  | 
 | else if (r & STATFLAG_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 835  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 846  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 880  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 975  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(); |