Diff for /np2/macosx/np2.cpp between versions 1.12 and 1.15

version 1.12, 2003/10/23 06:26:16 version 1.15, 2003/10/24 12:35:19
Line 28 Line 28
 #include        "statsave.h"  #include        "statsave.h"
 #include        "mousemng.h"  #include        "mousemng.h"
 #include        "configure.h"  #include        "configure.h"
   #include        "screenopt.h"
   
   
 #define USE_RESUME  #define USE_RESUME
   
   
                 NP2OSCFG        np2oscfg = {0, 2, 0, 0, 0, 0};                  NP2OSCFG        np2oscfg = {0, 2, 0, 0, 0, 0, 1, 0};
   
                 WindowPtr       hWndMain;                  WindowPtr       hWndMain;
                 BOOL            np2running;                  BOOL            np2running;
Line 255  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 464  static void HandleMouseDown(EventRecord  Line 469  static void HandleMouseDown(EventRecord 
         WindowPtr       hWnd;          WindowPtr       hWnd;
         Rect            rDrag;          Rect            rDrag;
   
       soundmng_stop();
         switch(FindWindow(pevent->where, &hWnd)) {          switch(FindWindow(pevent->where, &hWnd)) {
                 case inMenuBar:                  case inMenuBar:
                         HandleMenuChoice(MenuSelect(pevent->where));                          HandleMenuChoice(MenuSelect(pevent->where));
Line 496  static void HandleMouseDown(EventRecord  Line 502  static void HandleMouseDown(EventRecord 
 #endif  #endif
                         break;                          break;
   
   #ifndef NP2GCC
                 case inGoAway:                  case inGoAway:
                         if (TrackGoAway(hWnd, pevent->where)) { }                          if (TrackGoAway(hWnd, pevent->where)) { }
                         np2running = FALSE;                          np2running = FALSE;
                         break;                          break;
   #endif
         }          }
       soundmng_play();
 }  }
   
 #if 0  #if 0
Line 656  int main(int argc, char *argv[]) { Line 665  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 678  int main(int argc, char *argv[]) { Line 689  int main(int argc, char *argv[]) {
 #endif  #endif
                 else {                  else {
                         if (np2oscfg.NOWAIT) {                          if (np2oscfg.NOWAIT) {
 #if defined(NP2GCC) && 0  #if 0
                                 mouse_callback();  
 #endif  
 #if 1  
                                 mackbd_callback();                                  mackbd_callback();
 #endif  #endif
                                 pccore_exec(framecnt == 0);                                  pccore_exec(framecnt == 0);
Line 700  int main(int argc, char *argv[]) { Line 708  int main(int argc, char *argv[]) {
                         }                          }
                         else if (np2oscfg.DRAW_SKIP) {                  // frame skip                          else if (np2oscfg.DRAW_SKIP) {                  // frame skip
                                 if (framecnt < np2oscfg.DRAW_SKIP) {                                  if (framecnt < np2oscfg.DRAW_SKIP) {
 #if defined(NP2GCC) && 0  #if 0
                     mouse_callback();  
 #endif  
 #if 1  
                     mackbd_callback();                      mackbd_callback();
 #endif  #endif
                                         pccore_exec(framecnt == 0);                                          pccore_exec(framecnt == 0);
Line 716  int main(int argc, char *argv[]) { Line 721  int main(int argc, char *argv[]) {
                         else {                                                          // auto skip                          else {                                                          // auto skip
                                 if (!waitcnt) {                                  if (!waitcnt) {
                                         UINT cnt;                                          UINT cnt;
 #if defined(NP2GCC) && 0  #if 0
                     mouse_callback();  
 #endif  
 #if 1  
                     mackbd_callback();                      mackbd_callback();
 #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 737  int main(int argc, char *argv[]) { Line 738  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 757  int main(int argc, char *argv[]) { Line 758  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 803  static pascal OSStatus np2appevent (Even Line 806  static pascal OSStatus np2appevent (Even
     GetEventParameter (event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modif);      GetEventParameter (event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modif);
   
 #if defined(NP2GCC)  #if defined(NP2GCC)
       HIPoint delta;
     EventMouseButton buttonKind;      EventMouseButton buttonKind;
     GetEventParameter (event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(EventMouseButton), NULL, &buttonKind);      GetEventParameter (event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(EventMouseButton), NULL, &buttonKind);
   
Line 822  static pascal OSStatus np2appevent (Even Line 826  static pascal OSStatus np2appevent (Even
                     switch (whatHappened)                      switch (whatHappened)
                         {                          {
                         case kEventMouseMoved:                          case kEventMouseMoved:
 #if 0                              GetEventParameter (event, kEventParamMouseDelta, typeHIPoint, NULL, sizeof(HIPoint), NULL, &delta);
                             if (isFullScreen)                              mouse_callback(delta);
                             {                              result = noErr;
                                 HIPoint delta;                              break;
                                 Point pt;  
                                 GetEventParameter (event, kEventParamMouseDelta, typeHIPoint, NULL, sizeof(HIPoint), NULL, &delta);  
                                 pt.h=(short)delta.x;  
                                 pt.v=(short)delta.y;  
                                 mouse_callback(pt);  
                             }  
                             else {  
                                 mouse_callback(eve.where);  
                             }  
 #endif  
                                 mouse_callback();  
                                 result = noErr;  
                                 break;  
                        case kEventMouseDown:                         case kEventMouseDown:
                             if (buttonKind == kEventMouseButtonSecondary | modif & controlKey) {                              if (buttonKind == kEventMouseButtonSecondary | modif & controlKey) {
                                 ret=mouse_btn(MOUSE_RIGHTDOWN);                                  ret=mouse_btn(MOUSE_RIGHTDOWN);
Line 849  static pascal OSStatus np2appevent (Even Line 840  static pascal OSStatus np2appevent (Even
                             result=noErr;                              result=noErr;
                             break;                              break;
                         case kEventMouseUp:                          case kEventMouseUp:
                                 {                              if (buttonKind == kEventMouseButtonSecondary | modif & controlKey) {
                                     if (buttonKind == kEventMouseButtonSecondary | modif & cmdKey) {                                  ret=mouse_btn(MOUSE_RIGHTUP);
                                         ret=mouse_btn(MOUSE_RIGHTUP);                              }
                                     }                              else if (buttonKind == kEventMouseButtonTertiary) {
                                     else {                                  mouse_running(MOUSE_XOR);
                                         ret=mouse_btn(MOUSE_LEFTUP);                                  menu_setmouse(np2oscfg.MOUSE_SW ^ 1);
                                     }                                  sysmng_update(SYS_UPDATECFG);
                                     result=noErr;                              }
                                     break;                                  else {
                                 }                                                      ret=mouse_btn(MOUSE_LEFTUP);
                               }
                               result=noErr;
                               break;    
                         }                          }
 #else  #else
                                                 if (whatHappened == kEventMouseDown) {                                                  if (whatHappened == kEventMouseDown) {
Line 882  static pascal OSStatus np2windowevent(Ev Line 876  static pascal OSStatus np2windowevent(Ev
     OSStatus    result = eventNotHandledErr;          OSStatus    result = eventNotHandledErr;    
     long                eventClass;      long                eventClass;
           
       
     GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL,      GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL,
                          sizeof(window), NULL, &window);                           sizeof(window), NULL, &window);
     eventClass = GetEventClass(event);      eventClass = GetEventClass(event);
Line 903  static pascal OSStatus np2windowevent(Ev Line 898  static pascal OSStatus np2windowevent(Ev
                 switch (whatHappened)                  switch (whatHappened)
                 {                  {
                     case kEventRawKeyUp:                      case kEventRawKeyUp:
                         //mackeyup((int)key);  
                         mackbd_f12up(key);                          mackbd_f12up(key);
                         result = noErr;                          result = noErr;
                         break;                          break;
                     case kEventRawKeyRepeat:                      case kEventRawKeyRepeat:
                         //mackeydown(0, (int)key);  
                         mackbd_f12down(key);                          mackbd_f12down(key);
                         result = noErr;                          result = noErr;
                         break;                          break;
                     case kEventRawKeyDown:                      case kEventRawKeyDown:
                         mackbd_f12down(key);  
                         if (modif & cmdKey) {                          if (modif & cmdKey) {
                             //if (!mackeydown(1, (int)key)) {                              char        para;
                                 char    para;                              GetEventParameter (event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &para);
                                 GetEventParameter (event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &para);                              HandleMenuChoice(MenuKey(para));
                                 HandleMenuChoice(MenuKey(para));  
                             //}  
                         }                          }
                         else {                          else {
                             //mackeydown(0, (int)key);                              mackbd_f12down(key);
                         }                          }
                         result = noErr;                          result = noErr;
                         break;                          break;
Line 933  static pascal OSStatus np2windowevent(Ev Line 923  static pascal OSStatus np2windowevent(Ev
                         else keystat_senddata(0x73 | 0x80);                          else keystat_senddata(0x73 | 0x80);
                         if (modif & controlKey) keystat_senddata(0x74);                          if (modif & controlKey) keystat_senddata(0x74);
                         else keystat_senddata(0x74 | 0x80);                          else keystat_senddata(0x74 | 0x80);
                         if (modif & alphaLock) keystat_senddata(0x79);                          if (modif & alphaLock) keystat_senddata(0x71);
                         else keystat_senddata(0x79 | 0x80);  
                         result = noErr;                          result = noErr;
                         break;                          break;
                     default:                       default: 

Removed from v.1.12  
changed lines
  Added in v.1.15


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