Diff for /np2/macos9/np2.cpp between versions 1.26 and 1.39

version 1.26, 2004/01/25 05:41:29 version 1.39, 2005/03/21 02:24:23
Line 20 Line 20
 #include        "pc9861k.h"  #include        "pc9861k.h"
 #include        "mpu98ii.h"  #include        "mpu98ii.h"
 #include        "timing.h"  #include        "timing.h"
   #include        "keystat.h"
 #include        "debugsub.h"  #include        "debugsub.h"
 #include        "bios.h"  #include        "bios.h"
 #include        "scrndraw.h"  #include        "scrndraw.h"
Line 30 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 52  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
   
 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 109  static void MenuBarInit(void) { Line 178  static void MenuBarInit(void) {
         if (hmenu) {          if (hmenu) {
                 AppendResMenu(hmenu, 'DRVR');                  AppendResMenu(hmenu, 'DRVR');
         }          }
 #if 0 // defined(SUPPORT_SCSI)  #if !defined(SUPPORT_SCSI)
         hmenu = GetMenuHandle(IDM_HARDDISK);          hmenu = GetMenuHandle(IDM_HARDDISK);
         if (hmenu) {          if (hmenu) {
                 AppendMenu(hmenu, "\pSCSI #0");                  DeleteMenuItem(hmenu, 7);
                 AppendMenu(hmenu, "\pSCSI #1");                  DeleteMenuItem(hmenu, 6);
                 AppendMenu(hmenu, "\pSCSI #2");                  DeleteMenuItem(hmenu, 5);
                 AppendMenu(hmenu, "\pSCSI #3");                  DeleteMenuItem(hmenu, 4);
                   DeleteMenuItem(hmenu, 3);
         }          }
 #endif  #endif
           if (!np2oscfg.I286SAVE) {
                   hmenu = GetMenuHandle(IDM_OTHER);
                   if (hmenu) {
                           DeleteMenuItem(hmenu, 9);
                   }
           }
         InsertMenu(GetMenu(IDM_SASI1), -1);          InsertMenu(GetMenu(IDM_SASI1), -1);
         InsertMenu(GetMenu(IDM_SASI2), -1);          InsertMenu(GetMenu(IDM_SASI2), -1);
   #if defined(SUPPORT_SCSI)
           InsertMenu(GetMenu(IDM_SCSI0), -1);
           InsertMenu(GetMenu(IDM_SCSI1), -1);
           InsertMenu(GetMenu(IDM_SCSI2), -1);
           InsertMenu(GetMenu(IDM_SCSI3), -1);
   #endif
         InsertMenu(GetMenu(IDM_KEYBOARD), -1);          InsertMenu(GetMenu(IDM_KEYBOARD), -1);
         InsertMenu(GetMenu(IDM_SOUND), -1);          InsertMenu(GetMenu(IDM_SOUND), -1);
         InsertMenu(GetMenu(IDM_MEMORY), -1);          InsertMenu(GetMenu(IDM_MEMORY), -1);
Line 137  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 149  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 193  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(0);                          dialog_changehdd(0x00);
                         break;                          break;
   
                 case IDM_SASI1REMOVE:                  case IDM_SASI1REMOVE:
                         diskdrv_sethdd(0, NULL);                          diskdrv_sethdd(0x00, NULL);
                         break;                          break;
   
                 case IDM_SASI2OPEN:                  case IDM_SASI2OPEN:
                         dialog_changehdd(1);                          dialog_changehdd(0x01);
                         break;                          break;
   
                 case IDM_SASI2REMOVE:                  case IDM_SASI2REMOVE:
                         diskdrv_sethdd(1, NULL);                          diskdrv_sethdd(0x01, NULL);
                           break;
   
                   case IDM_SCSI0OPEN:
                           dialog_changehdd(0x20);
                           break;
   
                   case IDM_SCSI0REMOVE:
                           diskdrv_sethdd(0x20, NULL);
                           break;
   
                   case IDM_SCSI1OPEN:
                           dialog_changehdd(0x21);
                           break;
   
                   case IDM_SCSI1REMOVE:
                           diskdrv_sethdd(0x21, NULL);
                           break;
   
                   case IDM_SCSI2OPEN:
                           dialog_changehdd(0x22);
                           break;
   
                   case IDM_SCSI2REMOVE:
                           diskdrv_sethdd(0x22, NULL);
                           break;
   
                   case IDM_SCSI3OPEN:
                           dialog_changehdd(0x23);
                           break;
   
                   case IDM_SCSI3REMOVE:
                           diskdrv_sethdd(0x23, NULL);
                         break;                          break;
   
                 case IDM_ROLNORMAL:                  case IDM_ROLNORMAL:
Line 276  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 342  static void HandleMenuChoice(long wParam Line 502  static void HandleMenuChoice(long wParam
                         update |= SYS_UPDATEOSCFG;                          update |= SYS_UPDATEOSCFG;
                         break;                          break;
   
                   case IDM_F11USER:
                           menu_setf11key(4);
                           mackbd_resetf11();
                           update |= SYS_UPDATEOSCFG;
                           break;
   
                 case IDM_F12MOUSE:                  case IDM_F12MOUSE:
                         menu_setf12key(0);                          menu_setf12key(0);
                         mackbd_resetf12();                          mackbd_resetf12();
Line 360  static void HandleMenuChoice(long wParam Line 526  static void HandleMenuChoice(long wParam
                         update |= SYS_UPDATEOSCFG;                          update |= SYS_UPDATEOSCFG;
                         break;                          break;
   
                   case IDM_F12USER:
                           menu_setf12key(4);
                           mackbd_resetf12();
                           update |= SYS_UPDATEOSCFG;
                           break;
   
                 case IDM_BEEPOFF:                  case IDM_BEEPOFF:
                         menu_setbeepvol(0);                          menu_setbeepvol(0);
                         beep_setvol(0);                          beep_setvol(0);
Line 464  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;
   
                   case IDM_CALENDAR:
                           CalendarDialogProc();
                           break;
   
                 case IDM_DISPCLOCK:                  case IDM_DISPCLOCK:
                         menu_setdispclk(np2oscfg.DISPCLK ^ 1);                          menu_setdispclk(np2oscfg.DISPCLK ^ 1);
                         update |= SYS_UPDATECFG;                          update |= SYS_UPDATECFG;
Line 500  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 647  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 706  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 727  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 738  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 772  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 867  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();

Removed from v.1.26  
changed lines
  Added in v.1.39


RetroPC.NET-CVS <cvs@retropc.net>