Diff for /np2/macos9/np2.cpp between versions 1.2 and 1.10

version 1.2, 2003/10/23 10:57:49 version 1.10, 2003/11/06 01:58:36
Line 3 Line 3
 #include        "strres.h"  #include        "strres.h"
 #include        "np2.h"  #include        "np2.h"
 #include        "dosio.h"  #include        "dosio.h"
   #include        "commng.h"
 #include        "scrnmng.h"  #include        "scrnmng.h"
 #include        "soundmng.h"  #include        "soundmng.h"
 #include        "sysmng.h"  #include        "sysmng.h"
Line 10 Line 11
 #include        "mackbd.h"  #include        "mackbd.h"
 #include        "ini.h"  #include        "ini.h"
 #include        "menu.h"  #include        "menu.h"
   #include        "np2open.h"
 #include        "dialog.h"  #include        "dialog.h"
 #include        "memory.h"  #include        "memory.h"
 #include        "pccore.h"  #include        "pccore.h"
Line 34 Line 36
 #define USE_RESUME  #define USE_RESUME
   
   
 #if defined(NP2GCC)                  NP2OSCFG        np2oscfg = {0, 2, 0, 0,  0, 0};
                 NP2OSCFG        np2oscfg = {0, 2, 0, 0, 0, 0};  
 #else  
                 NP2OSCFG        np2oscfg = {0, 2, 0, 0, 0};  
 #endif  
   
                 WindowPtr       hWndMain;                  WindowPtr       hWndMain;
                 BOOL            np2running;                  BOOL            np2running;
Line 143  static void HandleMenuChoice(long wParam Line 141  static void HandleMenuChoice(long wParam
                         pccore_reset();                          pccore_reset();
                         break;                          break;
   
 #if 0                  case IDM_CONFIGURE:
                           ConfigDialogProc();
                           break;
   
                 case IDM_NEWDISK:                  case IDM_NEWDISK:
                         newdisk();                          dialog_newdisk();
                         break;                          break;
 #endif  
   
                 case IDM_FONT:                  case IDM_FONT:
                         dialog_font();                          dialog_font();
Line 246  static void HandleMenuChoice(long wParam Line 246  static void HandleMenuChoice(long wParam
                         update |= SYS_UPDATECFG;                          update |= SYS_UPDATECFG;
                         break;                          break;
   
                   case IDM_SCREENOPT:
                           dialog_scropt();
                           break;
   
 #if defined(NP2GCC)  #if defined(NP2GCC)
         case IDM_MOUSE:          case IDM_MOUSE:
             mouse_running(MOUSE_XOR);              mouse_running(MOUSE_XOR);
Line 254  static void HandleMenuChoice(long wParam Line 258  static void HandleMenuChoice(long wParam
                         break;                          break;
 #endif  #endif
   
                   case IDM_MIDIPANIC:
                           rs232c_midipanic();
                           mpu98ii_midipanic();
                           pc9861k_midipanic();
                           break;
   
                 case IDM_KEY:                  case IDM_KEY:
                         menu_setkey(0);                          menu_setkey(0);
                         keystat_resetjoykey();                          keystat_resetjoykey();
Line 449  static void HandleUpdateEvent(EventRecor Line 459  static void HandleUpdateEvent(EventRecor
   
         hWnd = (WindowPtr)pevent->message;          hWnd = (WindowPtr)pevent->message;
         BeginUpdate(hWnd);          BeginUpdate(hWnd);
         scrndraw_redraw();          if (np2running) {
                   scrndraw_redraw();
           }
           else {
                   np2open();
           }
         EndUpdate(hWnd);          EndUpdate(hWnd);
 }  }
   
Line 460  static void HandleMouseDown(EventRecord  Line 475  static void HandleMouseDown(EventRecord 
   
         switch(FindWindow(pevent->where, &hWnd)) {          switch(FindWindow(pevent->where, &hWnd)) {
                 case inMenuBar:                  case inMenuBar:
                         HandleMenuChoice(MenuSelect(pevent->where));                          if (np2running) {
                                   soundmng_stop();
                                   HandleMenuChoice(MenuSelect(pevent->where));
                                   soundmng_play();
                           }
                         break;                          break;
   
                 case inDrag:                  case inDrag:
Line 510  static void eventproc(EventRecord *event Line 529  static void eventproc(EventRecord *event
   
                 case keyDown:                  case keyDown:
                 case autoKey:                  case autoKey:
                         mackbd_f12down(((event->message) & keyCodeMask) >> 8);                          if (np2running) {
                         if (event->modifiers & cmdKey) {                                  mackbd_f12down(((event->message) & keyCodeMask) >> 8);
                                 HandleMenuChoice(MenuKey(event->message & charCodeMask));                                  if (event->modifiers & cmdKey) {
                                           soundmng_stop();
                                           HandleMenuChoice(MenuKey(event->message & charCodeMask));
                                           soundmng_play();
                                   }
                         }                          }
                         break;                          break;
   
Line 536  static void eventproc(EventRecord *event Line 559  static void eventproc(EventRecord *event
   
 // ----  // ----
   
   static void framereset(void) {
   
           framecnt = 0;
           if (np2oscfg.DISPCLK & 3) {
                   if (sysmng_workclockrenewal()) {
                           sysmng_updatecaption(3);
                   }
           }
   }
   
 static void processwait(UINT waitcnt) {  static void processwait(UINT waitcnt) {
   
         if (timing_getcount() >= waitcnt) {          if (timing_getcount() >= waitcnt) {
                 timing_setcount(0);                  timing_setcount(0);
                 framecnt = 0;                  framereset();
                 if (np2oscfg.DISPCLK & 3) {  
                         if (sysmng_workclockrenewal()) {  
                                 sysmng_updatecaption(3);  
                         }  
                 }  
         }          }
 }  }
   
Line 564  static void flagsave(const char *ext) { Line 592  static void flagsave(const char *ext) {
         statsave_save(path);          statsave_save(path);
 }  }
   
 static void flagload(const char *ext) {  static void flagdelete(const char *ext) {
   
         char    path[MAX_PATH];          char    path[MAX_PATH];
         char    buf[1024];  
           getstatfilename(path, ext, sizeof(path));
           file_delete(path);
   }
   
   static int flagload(const char *ext) {
   
         int             ret;          int             ret;
           char    path[MAX_PATH];
           char    buf[1024];
           int             r;
   
           ret = IDOK;
         getstatfilename(path, ext, sizeof(path));          getstatfilename(path, ext, sizeof(path));
         ret = statsave_check(path, buf, sizeof(buf));          r = statsave_check(path, buf, sizeof(buf));
         if (ret == NP2FLAG_SUCCESS) {          if (r & (~NP2FLAG_DISKCHG)) {
                   ResumeErrorDialogProc();
                   ret = IDCANCEL;
           }
           else if (r & NP2FLAG_DISKCHG) {
                   ret = ResumeWarningDialogProc(buf);
           }
           if (ret == IDOK) {
                 statsave_load(path);                  statsave_load(path);
         }          }
           return(ret);
 }  }
   
 int main(int argc, char *argv[]) {  int main(int argc, char *argv[]) {
   
         Rect            wRect;          Rect            wRect;
         EventRecord     event;          EventRecord     event;
           UINT            t;
   
         dosio_init();          dosio_init();
         file_setcd(target);          file_setcd(target);
Line 630  int main(int argc, char *argv[]) { Line 677  int main(int argc, char *argv[]) {
                 return(0);                  return(0);
         }          }
   
           np2open();
           t = GETTICK();
           while((GETTICK() - t) < 100) {
                   if (WaitNextEvent(everyEvent, &event, 0, 0)) {
                           eventproc(&event);
                   }
           }
   
           commng_initialize();
         sysmng_initialize();          sysmng_initialize();
         mackbd_initialize();          mackbd_initialize();
         pccore_init();          pccore_init();
Line 640  int main(int argc, char *argv[]) { Line 696  int main(int argc, char *argv[]) {
                 mouse_running(MOUSE_ON);                  mouse_running(MOUSE_ON);
         }          }
 #endif  #endif
         scrndraw_redraw();  //      scrndraw_redraw();
         pccore_reset();          pccore_reset();
   
 #if defined(USE_RESUME)          if (np2oscfg.resume) {
         flagload(np2resume);                  flagload(np2resume);
 #endif          }
   
         SetEventMask(everyEvent);          SetEventMask(everyEvent);
   
Line 696  int main(int argc, char *argv[]) { Line 752  int main(int argc, char *argv[]) {
                                         mackbd_callback();                                          mackbd_callback();
                                         pccore_exec(framecnt == 0);                                          pccore_exec(framecnt == 0);
                                         framecnt++;                                          framecnt++;
                                         // ¥Æ¥¹¥È  
                                         cnt = timing_getcount();                                          cnt = timing_getcount();
                                         if (framecnt > cnt) {                                          if (framecnt > cnt) {
                                                 waitcnt = framecnt;                                                  waitcnt = framecnt;
Line 709  int main(int argc, char *argv[]) { Line 764  int main(int argc, char *argv[]) {
                                                         framemax++;                                                          framemax++;
                                                 }                                                  }
                                                 if (cnt >= 12) {                                                  if (cnt >= 12) {
                                                         timing_init();                                                          timing_reset();
                                                 }                                                  }
                                                 else {                                                  else {
                                                         timing_setcount(cnt - framecnt);                                                          timing_setcount(cnt - framecnt);
                                                 }                                                  }
                                                 framecnt = 0;                                                  framereset();
                                         }                                          }
                                 }                                  }
                                 else {                                  else {
Line 728  int main(int argc, char *argv[]) { Line 783  int main(int argc, char *argv[]) {
   
         pccore_cfgupdate();          pccore_cfgupdate();
   
 #if defined(USE_RESUME)          if (np2oscfg.resume) {
         flagsave(np2resume);                  flagsave(np2resume);
 #endif          }
           else {
                   flagdelete(np2resume);
           }
   
         pccore_term();          pccore_term();
         S98_trash();          S98_trash();

Removed from v.1.2  
changed lines
  Added in v.1.10


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