Diff for /np2/macosx/np2.cpp between versions 1.11 and 1.14

version 1.11, 2003/10/22 19:57:39 version 1.14, 2003/10/23 21:00:24
Line 26 Line 26
 #include        "diskdrv.h"  #include        "diskdrv.h"
 #include        "fddfile.h"  #include        "fddfile.h"
 #include        "statsave.h"  #include        "statsave.h"
   
 #if defined(NP2GCC)  
 #include        "mousemng.h"  #include        "mousemng.h"
 #endif  
 #include        "configure.h"  #include        "configure.h"
   #include        "screenopt.h"
   
   
 #define USE_RESUME  #define USE_RESUME
   
   
 #if defined(NP2GCC)                  NP2OSCFG        np2oscfg = {0, 2, 0, 0, 0, 0, 1, 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 261  static void HandleMenuChoice(long wParam Line 256  static void HandleMenuChoice(long wParam
                         break;                          break;
   
 #if defined(NP2GCC)  #if defined(NP2GCC)
                   case IDM_SCREENOPT:
                           initScreenOpt();
                           break;
   
         case IDM_MOUSE:          case IDM_MOUSE:
             mouse_running(MOUSE_XOR);              mouse_running(MOUSE_XOR);
             menu_setmouse(np2oscfg.MOUSE_SW ^ 1);              menu_setmouse(np2oscfg.MOUSE_SW ^ 1);
Line 453  static void HandleMenuChoice(long wParam Line 452  static void HandleMenuChoice(long wParam
         HiliteMenu(0);          HiliteMenu(0);
 }  }
   
   #if 0
 static void HandleUpdateEvent(EventRecord *pevent) {  static void HandleUpdateEvent(EventRecord *pevent) {
   
         WindowPtr       hWnd;          WindowPtr       hWnd;
Line 462  static void HandleUpdateEvent(EventRecor Line 462  static void HandleUpdateEvent(EventRecor
         scrndraw_redraw();          scrndraw_redraw();
         EndUpdate(hWnd);          EndUpdate(hWnd);
 }  }
   #endif
   
 static void HandleMouseDown(EventRecord *pevent) {  static void HandleMouseDown(EventRecord *pevent) {
   
Line 660  int main(int argc, char *argv[]) { Line 661  int main(int argc, char *argv[]) {
         pccore_reset();          pccore_reset();
   
 #if defined(USE_RESUME)  #if defined(USE_RESUME)
         flagload(np2resume);      if (np2oscfg.resume) {
           flagload(np2resume);
       }
 #endif  #endif
   
 #if 0  #if 0
Line 728  int main(int argc, char *argv[]) { Line 731  int main(int argc, char *argv[]) {
 #endif  #endif
                                         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 741  int main(int argc, char *argv[]) { Line 743  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);
Line 761  int main(int argc, char *argv[]) { Line 763  int main(int argc, char *argv[]) {
         pccore_cfgupdate();          pccore_cfgupdate();
   
 #if defined(USE_RESUME)  #if defined(USE_RESUME)
         flagsave(np2resume);      if (np2oscfg.resume) {
           flagsave(np2resume);
       }
 #endif  #endif
   
         pccore_term();          pccore_term();
Line 773  int main(int argc, char *argv[]) { Line 777  int main(int argc, char *argv[]) {
   
         scrnmng_destroy();          scrnmng_destroy();
   
         if (sys_updates & (SYS_UPDATECFG | SYS_UPDATEOSCFG)) {          if (sys_updates & (SYS_UPDATECFG | SYS_UPDATEOSCFG)) {
                 initsave();                  initsave();
         }          }
         TRACETERM();          TRACETERM();
Line 788  int main(int argc, char *argv[]) { Line 792  int main(int argc, char *argv[]) {
 }  }
   
 //以下、ごっそりIIxからマージ  //以下、ごっそりIIxからマージ
 static pascal OSStatus MyAppEventHandler (EventHandlerCallRef myHandlerChain, EventRef event, void* userData)  static pascal OSStatus np2appevent (EventHandlerCallRef myHandlerChain, EventRef event, void* userData)
 {  {
     UInt32          whatHappened;      UInt32          whatHappened;
     OSStatus        result = eventNotHandledErr;      OSStatus        result = eventNotHandledErr;
Line 804  static pascal OSStatus MyAppEventHandler Line 808  static pascal OSStatus MyAppEventHandler
     if (IsDialogEvent(&eve)) return result;      if (IsDialogEvent(&eve)) return result;
   
     UInt32 modif;      UInt32 modif;
     EventMouseButton    buttonKind;  
     GetEventParameter (event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modif);      GetEventParameter (event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modif);
   
   #if defined(NP2GCC)
       EventMouseButton buttonKind;
     GetEventParameter (event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(EventMouseButton), NULL, &buttonKind);      GetEventParameter (event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(EventMouseButton), NULL, &buttonKind);
     BYTE ret;  
           BYTE ret;
   #endif
                   
     switch (eventClass)      switch (eventClass)
         {          {
Line 816  static pascal OSStatus MyAppEventHandler Line 824  static pascal OSStatus MyAppEventHandler
                         AEProcessAppleEvent(&eve);                          AEProcessAppleEvent(&eve);
                     }                      }
                     break;                      break;
   
                 case kEventClassMouse:                   case kEventClassMouse: 
   #if defined(NP2GCC)
                     switch (whatHappened)                      switch (whatHappened)
                         {                          {
                         case kEventMouseMoved:                          case kEventMouseMoved:
Line 858  static pascal OSStatus MyAppEventHandler Line 868  static pascal OSStatus MyAppEventHandler
                                     break;                                          break;    
                                 }                                                      }                    
                         }                          }
   #else
                                                   if (whatHappened == kEventMouseDown) {
                                                           HandleMouseDown(&eve);
                                                   }
   #endif
                         break;                          break;
             default:              default:
                     break;                       break; 
         }          }
   
           (void)myHandlerChain;
           (void)userData;
     return result;       return result; 
 }  }
   
 static pascal OSStatus MyWindowEventHandler(EventHandlerCallRef myHandler,  EventRef event, void* userData)  static pascal OSStatus np2windowevent(EventHandlerCallRef myHandler,  EventRef event, void* userData)
 {  {
     WindowRef   window;      WindowRef   window;
     UInt32              whatHappened;      UInt32              whatHappened;
Line 934  static pascal OSStatus MyWindowEventHand Line 952  static pascal OSStatus MyWindowEventHand
                 break;                                  break;                
         }          }
   
           (void)myHandler;
           (void)userData;
     return result;      return result;
 }  }
   
 static void setUpCarbonEvent(void)  static const EventTypeSpec appEventList[] = {
 {                                  {kEventClassAppleEvent, kEventAppleEvent},
     InstallStandardEventHandler(GetWindowEventTarget(hWndMain));                                  {kEventClassMouse,              kEventMouseDown},
         EventTypeSpec   appEventList[] ={       { kEventClassAppleEvent, kEventAppleEvent },  #if defined(NP2GCC)
                                         { kEventClassMouse, kEventMouseDown},                                  {kEventClassMouse,              kEventMouseMoved},
                                         { kEventClassMouse, kEventMouseMoved},                                  {kEventClassMouse,              kEventMouseUp},
                                         { kEventClassMouse, kEventMouseUp}  #endif
                                     };                          };
     EventTypeSpec   windEventList[] ={  { kEventClassWindow, kEventWindowClose},  
                                                         { kEventClassKeyboard, kEventRawKeyDown},  
                                         { kEventClassKeyboard, kEventRawKeyUp},  
                                         { kEventClassKeyboard, kEventRawKeyRepeat},  
                                                         { kEventClassKeyboard, kEventRawKeyModifiersChanged}  
                                      };  
         InstallApplicationEventHandler(NewEventHandlerUPP(MyAppEventHandler), 4, appEventList, 0, NULL);   
         InstallWindowEventHandler(hWndMain, NewEventHandlerUPP(MyWindowEventHandler), 5, windEventList, 0, NULL);  
   
   static const EventTypeSpec windEventList[] = {
                                   {kEventClassWindow,             kEventWindowClose},
                                   {kEventClassKeyboard,   kEventRawKeyDown},
                                   {kEventClassKeyboard,   kEventRawKeyUp},
                                   {kEventClassKeyboard,   kEventRawKeyRepeat},
                                   {kEventClassKeyboard,   kEventRawKeyModifiersChanged},
                           };
   
   
   static void setUpCarbonEvent(void) {
   
           InstallStandardEventHandler(GetWindowEventTarget(hWndMain));
           InstallApplicationEventHandler(NewEventHandlerUPP(np2appevent),
                                                                   sizeof(appEventList)/sizeof(EventTypeSpec),
                                                                   appEventList, 0, NULL);
           InstallWindowEventHandler(hWndMain, NewEventHandlerUPP(np2windowevent),
                                                                   sizeof(windEventList)/sizeof(EventTypeSpec),
                                                                   windEventList, 0, NULL);
 }  }
   

Removed from v.1.11  
changed lines
  Added in v.1.14


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