Diff for /np2/win9x/np2.cpp between versions 1.19 and 1.23

version 1.19, 2003/10/30 18:09:06 version 1.23, 2003/11/03 00:49:55
Line 71  static char  szClassName[] = "NP2-MainWi Line 71  static char  szClassName[] = "NP2-MainWi
                                                 {0, 0, 0x3e, 19200, "", "", "", ""},            // ver0.34                                                  {0, 0, 0x3e, 19200, "", "", "", ""},            // ver0.34
                                                 {0, 0, 0x3e, 19200, "", "", "", ""},            // ver0.34                                                  {0, 0, 0x3e, 19200, "", "", "", ""},            // ver0.34
                                                 0xffffff, 0xffbf6a, 0, 0,                                                  0xffffff, 0xffbf6a, 0, 0,
                                                 0, 1, 0, 9801, 0, 0, 0, 0, 0, 0};                       // ver0.38                                                  0, 1, 0, 9801, 0, 0, 0, 0, 0, 0, 0};            // ver0.38
   
                 char    fddfolder[MAX_PATH];                  char    fddfolder[MAX_PATH];
                 char    hddfolder[MAX_PATH];                  char    hddfolder[MAX_PATH];
Line 86  static BYTE np2stopemulate = 0; Line 86  static BYTE np2stopemulate = 0;
 static  int             np2opening = 1;  static  int             np2opening = 1;
 static  int             np2quitmsg = 0;  static  int             np2quitmsg = 0;
                 HMENU   hStat = NULL;                  HMENU   hStat = NULL;
   
 static const char np2help[] = "np2.hlp";  
 static const char np2resume[] = "sav";  
   
   
 static  BYTE    scrnmode;  static  BYTE    scrnmode;
                   WINLOC          wl;
                   WINLOCEX        wlex;
   
   static const char np2help[] = "np2.chm";
   static const char np2flagext[] = "S%02d";
   static const char np2resumeext[] = "sav";
   
   
 static void winuienter(void) {  static void winuienter(void) {
Line 106  static void winuileave(void) { Line 107  static void winuileave(void) {
         soundmng_enable(SNDPROC_MAIN);          soundmng_enable(SNDPROC_MAIN);
 }  }
   
   WINLOCEX np2_winlocexallwin(HWND base) {
   
           HWND    list[3];
           UINT    i;
   
           list[0] = hWndMain;
           list[1] = toolwin_gethwnd();
           list[2] = keydisp_gethwnd();
           for (i=0; i<3; i++) {
                   if (list[i] == base) {
                           list[i] = NULL;
                   }
           }
           if (base != hWndMain) {         // hWndMainのみ全体移動
                   base = NULL;
           }
           return(winlocex_create(base, list, 3));
   }
   
 static void changescreen(BYTE newmode) {  static void changescreen(BYTE newmode) {
   
         BYTE    change;          BYTE            change;
         BYTE    renewal;          BYTE            renewal;
   
         change = scrnmode ^ newmode;          change = scrnmode ^ newmode;
         renewal = (change & SCRNMODE_FULLSCREEN);          renewal = (change & SCRNMODE_FULLSCREEN);
Line 121  static void changescreen(BYTE newmode) { Line 141  static void changescreen(BYTE newmode) {
         }          }
         if (renewal) {          if (renewal) {
                 if (renewal & SCRNMODE_FULLSCREEN) {                  if (renewal & SCRNMODE_FULLSCREEN) {
                         toolwin_close();                          toolwin_destroy();
                           keydisp_destroy();
                 }                  }
                 else if (renewal & SCRNMODE_ROTATEMASK) {                  else if (renewal & SCRNMODE_ROTATEMASK) {
                         toolwin_movingstart();                          winlocex_destroy(wlex);
                           wlex = np2_winlocexallwin(hWndMain);
                 }                  }
                 soundmng_stop();                  soundmng_stop();
                 mouse_running(MOUSE_STOP);                  mouse_running(MOUSE_STOP);
                 keydisp_destroy();  
                 scrnmng_destroy();                  scrnmng_destroy();
                 if (scrnmng_create(newmode) == SUCCESS) {                  if (scrnmng_create(newmode) == SUCCESS) {
                         scrnmode = newmode;                          scrnmode = newmode;
Line 140  static void changescreen(BYTE newmode) { Line 161  static void changescreen(BYTE newmode) {
                         }                          }
                 }                  }
                 scrndraw_redraw();                  scrndraw_redraw();
                 if ((renewal & SCRNMODE_FULLSCREEN) &&                  if (renewal & SCRNMODE_FULLSCREEN) {
                         (!scrnmng_isfullscreen()) && (np2oscfg.toolwin)) {                          if (!scrnmng_isfullscreen()) {
                         toolwin_open();                                  if (np2oscfg.toolwin) {
                                           toolwin_create();
                                   }
                                   if (np2oscfg.keydisp) {
                                           keydisp_create();
                                   }
                           }
                 }                  }
                 else if (renewal & SCRNMODE_ROTATEMASK) {                  else if (renewal & SCRNMODE_ROTATEMASK) {
                         toolwin_movingend();                          winlocex_move(wlex);
                           winlocex_destroy(wlex);
                           wlex = NULL;
                 }                  }
                 mouse_running(MOUSE_CONT);                  mouse_running(MOUSE_CONT);
                 soundmng_play();                  soundmng_play();
Line 275  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 304  LRESULT CALLBACK WndProc(HWND hWnd, UINT
         HDC                     hdc;          HDC                     hdc;
         BOOL            b;          BOOL            b;
         UINT            update;          UINT            update;
           HWND            subwin;
   
         switch (msg) {          switch (msg) {
                 case WM_CREATE:                  case WM_CREATE:
Line 288  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 318  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                         update = 0;                          update = 0;
                         switch(wParam) {                          switch(wParam) {
                                 case IDM_TOOLWIN:                                  case IDM_TOOLWIN:
                                         xmenu_settoolwin(np2oscfg.toolwin ^ 1);                                          sysmenu_settoolwin(np2oscfg.toolwin ^ 1);
                                         if (np2oscfg.toolwin) {                                          if (np2oscfg.toolwin) {
                                                 toolwin_open();                                                  toolwin_create();
                                         }                                          }
                                         else {                                          else {
                                                 toolwin_close();                                                  toolwin_destroy();
                                         }                                          }
                                         update |= SYS_UPDATEOSCFG;                                          update |= SYS_UPDATEOSCFG;
                                         break;                                          break;
   
                                   case IDM_KEYDISP:
                                           sysmenu_setkeydisp(np2oscfg.keydisp ^ 1);
                                           if (np2oscfg.keydisp) {
                                                   keydisp_create();
                                           }
                                           else {
                                                   keydisp_destroy();
                                           }
                                           break;
   
                                 case IDM_SCREENCENTER:                                  case IDM_SCREENCENTER:
                                         if ((!scrnmng_isfullscreen()) &&                                          if ((!scrnmng_isfullscreen()) &&
                                                 (!(GetWindowLong(hWnd, GWL_STYLE) &                                                  (!(GetWindowLong(hWnd, GWL_STYLE) &
                                                                                         (WS_MAXIMIZE | WS_MINIMIZE)))) {                                                                                          (WS_MAXIMIZE | WS_MINIMIZE)))) {
                                                 toolwin_movingstart();                                                  winlocex_destroy(wlex);
                                                   wlex = np2_winlocexallwin(hWnd);
                                                 wincentering(hWnd);                                                  wincentering(hWnd);
                                                 toolwin_movingend();                                                  winlocex_move(wlex);
                                                   winlocex_destroy(wlex);
                                                   wlex = NULL;
                                         }                                          }
                                         break;                                          break;
   
                                 case IDM_SNAPENABLE:                                  case IDM_SNAPENABLE:
                                         xmenu_setwinsnap(np2oscfg.WINSNAP ^ 1);                                          sysmenu_setwinsnap(np2oscfg.WINSNAP ^ 1);
                                         update |= SYS_UPDATEOSCFG;                                          update |= SYS_UPDATEOSCFG;
                                         break;                                          break;
   
                                 case IDM_BACKGROUND:                                  case IDM_BACKGROUND:
                                         xmenu_setbackground(np2oscfg.background ^ 1);                                          sysmenu_setbackground(np2oscfg.background ^ 1);
                                         update |= SYS_UPDATEOSCFG;                                          update |= SYS_UPDATEOSCFG;
                                         break;                                          break;
   
                                 case IDM_BGSOUND:                                  case IDM_BGSOUND:
                                         xmenu_setbgsound(np2oscfg.background ^ 2);                                          sysmenu_setbgsound(np2oscfg.background ^ 2);
                                         update |= SYS_UPDATEOSCFG;                                          update |= SYS_UPDATEOSCFG;
                                         break;                                          break;
   
                                 case IDM_KEYDISP:  
                                         keydisp_create();  
                                         break;  
   
                                 case IDM_MEMORYDUMP:                                  case IDM_MEMORYDUMP:
                                         debugsub_memorydump();                                          debugsub_memorydump();
                                         break;                                          break;
Line 343  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 382  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                                 case IDM_SCRNMUL16:                                  case IDM_SCRNMUL16:
                                         if ((!scrnmng_isfullscreen()) &&                                          if ((!scrnmng_isfullscreen()) &&
                                                 !(GetWindowLong(hWndMain, GWL_STYLE) & WS_MINIMIZE)) {                                                  !(GetWindowLong(hWndMain, GWL_STYLE) & WS_MINIMIZE)) {
                                                 xmenu_setscrnmul(wParam - IDM_SCRNMUL);                                                  sysmenu_setscrnmul(wParam - IDM_SCRNMUL);
                                                 scrnmng_setmultiple(wParam - IDM_SCRNMUL);                                                  scrnmng_setmultiple(wParam - IDM_SCRNMUL);
                                         }                                          }
                                         break;                                          break;
   
                                   case SC_MINIMIZE:
                                           winlocex_destroy(wlex);
                                           wlex = np2_winlocexallwin(hWnd);
                                           winlocex_close(wlex);
                                           winlocex_destroy(wlex);
                                           wlex = NULL;
                                           return(DefWindowProc(hWnd, msg, wParam, lParam));
   
                                   case SC_RESTORE:
                                           subwin = toolwin_gethwnd();
                                           if (subwin) {
                                                   ShowWindow(subwin, SW_SHOWNOACTIVATE);
                                           }
                                           subwin = keydisp_gethwnd();
                                           if (subwin) {
                                                   ShowWindow(subwin, SW_SHOWNOACTIVATE);
                                           }
                                           return(DefWindowProc(hWnd, msg, wParam, lParam));
   
                                 default:                                  default:
                                         return(DefWindowProc(hWnd, msg, wParam, lParam));                                          return(DefWindowProc(hWnd, msg, wParam, lParam));
                         }                          }
Line 820  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 878  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                                         if ((LOWORD(wParam) >= IDM_FLAGSAVE) &&                                          if ((LOWORD(wParam) >= IDM_FLAGSAVE) &&
                                                 (LOWORD(wParam) < IDM_FLAGSAVE + STATSAVEMAX)) {                                                  (LOWORD(wParam) < IDM_FLAGSAVE + STATSAVEMAX)) {
                                                 char ext[4];                                                  char ext[4];
                                                 wsprintf(ext, "S%02d",                                                  wsprintf(ext, np2flagext,
                                                                         (LOWORD(wParam) - IDM_FLAGSAVE) % 100);                                                                          (LOWORD(wParam) - IDM_FLAGSAVE) % 100);
                                                 flagsave(ext);                                                  flagsave(ext);
                                         }                                          }
                                         if ((LOWORD(wParam) >= IDM_FLAGLOAD) &&                                          if ((LOWORD(wParam) >= IDM_FLAGLOAD) &&
                                                 (LOWORD(wParam) < IDM_FLAGLOAD + STATSAVEMAX)) {                                                  (LOWORD(wParam) < IDM_FLAGLOAD + STATSAVEMAX)) {
                                                 char ext[4];                                                  char ext[4];
                                                 wsprintf(ext, "S%02d",                                                  wsprintf(ext, np2flagext,
                                                                         (LOWORD(wParam) - IDM_FLAGLOAD) % 100);                                                                          (LOWORD(wParam) - IDM_FLAGLOAD) % 100);
                                                 flagload(ext, "Status Load", TRUE);                                                  flagload(ext, "Status Load", TRUE);
                                         }                                          }
Line 899  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 957  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                                         np2oscfg.winy = rc.top;                                          np2oscfg.winy = rc.top;
                                         sysmng_update(SYS_UPDATEOSCFG);                                          sysmng_update(SYS_UPDATEOSCFG);
                                 }                                  }
                                 if (GetWindowLong(hWnd, GWL_STYLE) & WS_MINIMIZE) {  
                                         toolwin_close();  
                                 }  
                                 else if (np2oscfg.toolwin) {  
                                         toolwin_open();  
                                 }  
                         }                          }
                         break;                          break;
   
Line 922  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 974  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                 case WM_ENTERSIZEMOVE:                  case WM_ENTERSIZEMOVE:
                         soundmng_disable(SNDPROC_MAIN);                          soundmng_disable(SNDPROC_MAIN);
                         mouse_running(MOUSE_STOP);                          mouse_running(MOUSE_STOP);
                         winloc_movingstart();                          winlocex_destroy(wlex);
                         toolwin_movingstart();                          wlex = np2_winlocexallwin(hWnd);
                         break;  
   
                 case WM_EXITSIZEMOVE:  
                         toolwin_movingend();  
                         mouse_running(MOUSE_CONT);  
                         soundmng_enable(SNDPROC_MAIN);  
                         break;                          break;
   
                 case WM_MOVING:                  case WM_MOVING:
                         if (np2oscfg.WINSNAP) {                          if (np2oscfg.WINSNAP) {
                                 winloc_movingproc((RECT *)lParam);                                  winlocex_moving(wlex, (RECT *)lParam);
                         }                          }
                         break;                          break;
   
                   case WM_EXITSIZEMOVE:
                           winlocex_move(wlex);
                           winlocex_destroy(wlex);
                           wlex = NULL;
                           mouse_running(MOUSE_CONT);
                           soundmng_enable(SNDPROC_MAIN);
                           break;
   
                 case WM_KEYDOWN:                  case WM_KEYDOWN:
                         if (wParam == VK_F11) {                          if (wParam == VK_F11) {
                                 scrnmng_enablemenubar();                                  scrnmng_enablemenubar();
Line 1158  int WINAPI WinMain(HINSTANCE hInstance,  Line 1212  int WINAPI WinMain(HINSTANCE hInstance, 
         np2arg_analize(lpszCmdLine);          np2arg_analize(lpszCmdLine);
         initload();          initload();
         toolwin_readini();          toolwin_readini();
           keydisp_readini();
   
         rand_setseed((unsigned)time(NULL));          rand_setseed((unsigned)time(NULL));
   
Line 1270  int WINAPI WinMain(HINSTANCE hInstance,  Line 1325  int WINAPI WinMain(HINSTANCE hInstance, 
                 EnableMenuItem(GetMenu(hWndMain), IDM_HELP, MF_GRAYED);                  EnableMenuItem(GetMenu(hWndMain), IDM_HELP, MF_GRAYED);
         }          }
   
         xmenu_settoolwin(np2oscfg.toolwin);          sysmenu_settoolwin(np2oscfg.toolwin);
         xmenu_setwinsnap(np2oscfg.WINSNAP);          sysmenu_setkeydisp(np2oscfg.keydisp);
         xmenu_setbackground(np2oscfg.background);          sysmenu_setwinsnap(np2oscfg.WINSNAP);
         xmenu_setbgsound(np2oscfg.background);          sysmenu_setbackground(np2oscfg.background);
         xmenu_setscrnmul(8);                                                                            // ver0.26          sysmenu_setbgsound(np2oscfg.background);
           sysmenu_setscrnmul(8);                                                                          // ver0.26
         if (np2oscfg.toolwin) {  
                 toolwin_open();  
         }  
   
         scrnmode = 0;          scrnmode = 0;
         if (np2arg.fullscreen) {          if (np2arg.fullscreen) {
Line 1321  int WINAPI WinMain(HINSTANCE hInstance,  Line 1373  int WINAPI WinMain(HINSTANCE hInstance, 
         pccore_init();          pccore_init();
         S98_init();          S98_init();
   
   
         sstpmsg_welcome();          sstpmsg_welcome();
   
 #ifdef OPENING_WAIT  #ifdef OPENING_WAIT
Line 1332  int WINAPI WinMain(HINSTANCE hInstance,  Line 1383  int WINAPI WinMain(HINSTANCE hInstance, 
   
         pccore_reset();          pccore_reset();
   
           if (!(scrnmode & SCRNMODE_FULLSCREEN)) {
                   if (np2oscfg.toolwin) {
                           toolwin_create();
                   }
                   if (np2oscfg.keydisp) {
                           keydisp_create();
                   }
           }
   
         np2opening = 0;          np2opening = 0;
   
         // れじうむ          // れじうむ
         if (np2oscfg.resume) {          if (np2oscfg.resume) {
                 int             id;                  int             id;
   
                 id = flagload(np2resume, "Resume", FALSE);                  id = flagload(np2resumeext, "Resume", FALSE);
                 if (id == IDYES) {                  if (id == IDYES) {
                         for (i=0; i<4; i++) np2arg.disk[i] = NULL;                          for (i=0; i<4; i++) np2arg.disk[i] = NULL;
                 }                  }
Line 1371  int WINAPI WinMain(HINSTANCE hInstance,  Line 1431  int WINAPI WinMain(HINSTANCE hInstance, 
                                 if (!GetMessage(&msg, NULL, 0, 0)) {                                  if (!GetMessage(&msg, NULL, 0, 0)) {
                                         break;                                          break;
                                 }                                  }
                                 if ((msg.message != WM_SYSKEYDOWN) &&                                  if ((msg.hwnd != hWndMain) ||
                                         (msg.message != WM_SYSKEYUP)) {                                          ((msg.message != WM_SYSKEYDOWN) &&
                                           (msg.message != WM_SYSKEYUP))) {
                                         TranslateMessage(&msg);                                          TranslateMessage(&msg);
                                 }                                  }
                                 DispatchMessage(&msg);                                  DispatchMessage(&msg);
Line 1452  int WINAPI WinMain(HINSTANCE hInstance,  Line 1513  int WINAPI WinMain(HINSTANCE hInstance, 
                         DispatchMessage(&msg);                          DispatchMessage(&msg);
                 }                  }
         }          }
         toolwin_close();          toolwin_destroy();
   
         pccore_cfgupdate();          pccore_cfgupdate();
   
Line 1460  int WINAPI WinMain(HINSTANCE hInstance,  Line 1521  int WINAPI WinMain(HINSTANCE hInstance, 
         S98_trash();          S98_trash();
   
         if (np2oscfg.resume) {          if (np2oscfg.resume) {
                 flagsave(np2resume);                  flagsave(np2resumeext);
         }          }
         else {          else {
                 flagdelete(np2resume);                  flagdelete(np2resumeext);
         }          }
   
 #ifdef USE_ROMEO  #ifdef USE_ROMEO
Line 1483  int WINAPI WinMain(HINSTANCE hInstance,  Line 1544  int WINAPI WinMain(HINSTANCE hInstance, 
         if (sys_updates & (SYS_UPDATECFG | SYS_UPDATEOSCFG)) {          if (sys_updates & (SYS_UPDATECFG | SYS_UPDATEOSCFG)) {
                 initsave();                  initsave();
                 toolwin_writeini();                  toolwin_writeini();
                   keydisp_writeini();
         }          }
   
         TRACETERM();          TRACETERM();

Removed from v.1.19  
changed lines
  Added in v.1.23


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