|
|
| version 1.3, 2004/08/12 11:03:08 | version 1.6, 2004/08/17 13:04:11 |
|---|---|
| Line 17 | Line 17 |
| #include "iocore.h" | #include "iocore.h" |
| #include "timing.h" | #include "timing.h" |
| #include "keystat.h" | #include "keystat.h" |
| #if defined(SUPPORT_RESUME) || defined(SUPPORT_STATSAVE) | |
| #include "statsave.h" | |
| #endif | |
| #include "debugsub.h" | #include "debugsub.h" |
| #include "scrndraw.h" | #include "scrndraw.h" |
| #include "makescrn.h" | #include "makescrn.h" |
| Line 28 | Line 31 |
| // #define USE_RESUME | // #define USE_RESUME |
| XMILOSCFG xmiloscfg = {100, 100, 0, 0, 0, 0, 0, 0}; | XMILOSCFG xmiloscfg = { 100, 100, |
| 0, 0, 0, | |
| 0, 0, | |
| #if defined(SUPPORT_RESUME) | |
| 0, | |
| #endif | |
| #if defined(SUPPORT_STATSAVE) | |
| 1, | |
| #endif | |
| 0}; | |
| WindowPtr hWndMain; | WindowPtr hWndMain; |
| BRESULT xmilrunning; | BRESULT xmilrunning; |
| Line 44 static REG8 scrnmode; | Line 56 static REG8 scrnmode; |
| #endif | #endif |
| static char target[MAX_PATH] = DEFAULTPATH; | static char target[MAX_PATH] = DEFAULTPATH; |
| #if !defined(SUPPORT_PC9821) | |
| static const char np2app[] = "np2"; | static const char xmilapp[] = "xmil"; |
| #else | |
| static const char np2app[] = "np21"; | |
| // ---- stat save... | |
| #if defined(SUPPORT_RESUME) | |
| static const char xmilresumeext[] = ".sav"; | |
| #endif | #endif |
| #if defined(SUPPORT_STATSAVE) | |
| static const char xmilflagext[] = ".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(xmilapp), size); | |
| file_catname(path, ext, size); | |
| } | |
| static void flagsave(const char *ext) { | |
| char path[MAX_PATH]; | |
| getstatfilename(path, ext, NELEMENTS(path)); | |
| statsave_save(path); | |
| } | |
| static void flagdelete(const char *ext) { | |
| char path[MAX_PATH]; | |
| getstatfilename(path, ext, NELEMENTS(path)); | |
| file_delete(path); | |
| } | |
| static int flagload(const char *ext, BRESULT force) { | |
| char path[MAX_PATH]; | |
| char buf[1024]; | |
| int r; | |
| int ret; | |
| static const char np2resume[] = "sav"; | getstatfilename(path, ext, NELEMENTS(path)); |
| r = statsave_check(path, buf, NELEMENTS(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 114 static void MenuBarInit(void) { | Line 180 static void MenuBarInit(void) { |
| } | } |
| } | } |
| #if !defined(SUPPORT_TURBOZ) | |
| hmenu = GetMenuHandle(IDM_IPLROM); | |
| if (hmenu) { | |
| DeleteMenuItem(hmenu, 3); | |
| } | |
| #endif | |
| #if TARGET_API_MAC_CARBON | #if TARGET_API_MAC_CARBON |
| hmenu = GetMenuHandle(IDM_FDD1); | hmenu = GetMenuHandle(IDM_FDD1); |
| SetItemCmd(hmenu, LoWord(IDM_FDD1OPEN), 'D'); | SetItemCmd(hmenu, LoWord(IDM_FDD1OPEN), 'D'); |
| Line 124 static void MenuBarInit(void) { | Line 197 static void MenuBarInit(void) { |
| EnableItem(GetMenuHandle(IDM_DEVICE), LoWord(IDM_MOUSE)); | EnableItem(GetMenuHandle(IDM_DEVICE), LoWord(IDM_MOUSE)); |
| #endif | #endif |
| DeleteMenu(IDM_FDD2); | if (!(xmilcfg.fddequip & (1 << 3))) { |
| DeleteMenu(IDM_FDD3); | DeleteMenu(IDM_FDD3); |
| } | |
| if (!(xmilcfg.fddequip & (1 << 2))) { | |
| DeleteMenu(IDM_FDD2); | |
| } | |
| if (!(xmilcfg.fddequip & (1 << 1))) { | |
| DeleteMenu(IDM_FDD1); | |
| } | |
| if (!(xmilcfg.fddequip & (1 << 0))) { | |
| DeleteMenu(IDM_FDD0); | |
| } | |
| #if defined(SUPPORT_STATSAVE) | |
| if (!xmiloscfg.statsave) { | |
| #endif | |
| DeleteMenu(IDM_STATSAVE); | |
| #if defined(SUPPORT_STATSAVE) | |
| } | |
| #endif | |
| DrawMenuBar(); | DrawMenuBar(); |
| } | } |
| Line 134 static void HandleMenuChoice(long wParam | Line 225 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 193 static void HandleMenuChoice(long wParam | Line 288 static void HandleMenuChoice(long wParam |
| diskdrv_setfdd(3, NULL, 0); | diskdrv_setfdd(3, NULL, 0); |
| break; | break; |
| case IDM_TURBOZ: | case IDM_X1ROM: |
| menu_setiplrom(3); | menu_setiplrom(1); |
| update = SYS_UPDATECFG; | update = SYS_UPDATECFG; |
| break; | break; |
| Line 203 static void HandleMenuChoice(long wParam | Line 298 static void HandleMenuChoice(long wParam |
| update = SYS_UPDATECFG; | update = SYS_UPDATECFG; |
| break; | break; |
| case IDM_X1ROM: | #if defined(SUPPORT_TURBOZ) |
| menu_setiplrom(1); | case IDM_TURBOZ: |
| menu_setiplrom(3); | |
| update = SYS_UPDATECFG; | update = SYS_UPDATECFG; |
| break; | break; |
| #endif | |
| case IDM_BOOT2D: | case IDM_BOOT2D: |
| menu_setbootmedia(0); | menu_setbootmedia(0); |
| Line 229 static void HandleMenuChoice(long wParam | Line 326 static void HandleMenuChoice(long wParam |
| break; | break; |
| case IDM_WIDTH80: | case IDM_WIDTH80: |
| crtc.s.TXT_XL = 80; | crtc_forcesetwidth(80); |
| // crtc.s.GRP_XL = 640; | |
| vrambank_patch(); | |
| scrnallflash = 1; | |
| break; | break; |
| case IDM_WIDTH40: | case IDM_WIDTH40: |
| crtc.s.TXT_XL = 40; | crtc_forcesetwidth(40); |
| // crtc.s.GRP_XL = 320; | |
| vrambank_patch(); | |
| scrnallflash = 1; | |
| break; | break; |
| case IDM_DISPSYNC: | case IDM_DISPSYNC: |
| Line 319 static void HandleMenuChoice(long wParam | Line 410 static void HandleMenuChoice(long wParam |
| update = SYS_UPDATECFG; | update = SYS_UPDATECFG; |
| break; | break; |
| // case IDM_BMPSAVE: | case IDM_BMPSAVE: |
| // dialog_writebmp(); | dialog_writebmp(); |
| // break; | break; |
| case IDM_DISPCLOCK: | case IDM_DISPCLOCK: |
| menu_setdispclk(xmiloscfg.DISPCLK ^ 1); | menu_setdispclk(xmiloscfg.DISPCLK ^ 1); |
| Line 355 static void HandleMenuChoice(long wParam | Line 446 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))) { | |
| OEMSPRINTF(ext, xmilflagext, num - 1); | |
| flagsave(ext); | |
| } | |
| else if ((num >= 12) && (num < (12 + 10))) { | |
| OEMSPRINTF(ext, xmilflagext, num - 12); | |
| flagload(ext, TRUE); | |
| } | |
| } | |
| #endif | |
| break; | break; |
| } | } |
| sysmng_update(update); | sysmng_update(update); |
| Line 482 static void eventproc(EventRecord *event | Line 586 static void eventproc(EventRecord *event |
| } | } |
| #if 0 | |
| // ---- | |
| 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); | |
| } | |
| #endif | |
| // ---- | // ---- |
| static UINT framecnt = 0; | static UINT framecnt = 0; |
| Line 644 int main(int argc, char *argv[]) { | Line 697 int main(int argc, char *argv[]) { |
| pccore_initialize(); | pccore_initialize(); |
| pccore_reset(); | pccore_reset(); |
| #if 0 | #if defined(SUPPORT_RESUME) |
| if (np2oscfg.resume) { | if (xmiloscfg.resume) { |
| flagload(np2resume); | flagload(xmilresumeext, FALSE); |
| } | } |
| #endif | #endif |
| Line 731 int main(int argc, char *argv[]) { | Line 784 int main(int argc, char *argv[]) { |
| xmilrunning = FALSE; | xmilrunning = FALSE; |
| #if 0 | #if defined(SUPPORT_RESUME) |
| if (np2oscfg.resume) { | if (xmiloscfg.resume) { |
| flagsave(np2resume); | flagsave(xmilresumeext); |
| } | } |
| else { | else { |
| flagdelete(np2resume); | flagdelete(xmilresumeext); |
| } | } |
| #endif | #endif |