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

version 1.12, 2003/10/26 11:51:46 version 1.15, 2003/10/28 22:05:46
Line 24 Line 24
 #include        "sstp.h"  #include        "sstp.h"
 #include        "sstpmsg.h"  #include        "sstpmsg.h"
 #include        "dclock.h"  #include        "dclock.h"
   #include        "toolwin.h"
 #ifdef USE_ROMEO  #ifdef USE_ROMEO
 #include        "juliet.h"  #include        "juliet.h"
 #endif  #endif
Line 69  static char  szClassName[] = "NP2-MainWi Line 70  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};                          // ver0.38                                                  0, 1, 0, 9801, 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 90  static const char np2help[] = "np2.hlp"; Line 91  static const char np2help[] = "np2.hlp";
 static const char np2resume[] = "sav";  static const char np2resume[] = "sav";
   
   
 typedef struct {  
 const char      *str;  
         int             id;  
 } SYSMENU_ITEM;  
   
 static SYSMENU_ITEM smenu_item[] = {  
                         {"&Centering",                  IDM_SCREENCENTER},  
                         {"&Window Snap",                IDM_SNAPENABLE},  
                         {"&Background",                 IDM_BACKGROUND},  
                         {"Background &Sound",   IDM_BGSOUND},  
                         {"&Key display",                IDM_KEYDISP},  
                         {NULL,                                  0},  
                         {" 320x200",                    IDM_SCRNMUL4},  
                         {" 480x300",                    IDM_SCRNMUL6},  
                         {" 640x400",                    IDM_SCRNMUL8},  
                         {" 800x500",                    IDM_SCRNMUL10},  
                         {" 960x600",                    IDM_SCRNMUL12},  
                         {"1280x800",                    IDM_SCRNMUL16},  
                         {NULL,                                  0},  
                 };  
   
   
 static  BYTE    scrnmode;  static  BYTE    scrnmode;
   
 static void changescreen(BYTE newmode) {  static void changescreen(BYTE newmode) {
Line 128  static void changescreen(BYTE newmode) { Line 107  static void changescreen(BYTE newmode) {
                 renewal |= (change & SCRNMODE_ROTATEMASK);                  renewal |= (change & SCRNMODE_ROTATEMASK);
         }          }
         if (renewal) {          if (renewal) {
                   if (renewal & SCRNMODE_FULLSCREEN) {
                           toolwin_close();
                   }
                 soundmng_stop();                  soundmng_stop();
                 mouse_running(MOUSE_STOP);                  mouse_running(MOUSE_STOP);
                 keydisp_destroy();                  keydisp_destroy();
Line 142  static void changescreen(BYTE newmode) { Line 124  static void changescreen(BYTE newmode) {
                         }                          }
                 }                  }
                 scrndraw_redraw();                  scrndraw_redraw();
                   if ((renewal & SCRNMODE_FULLSCREEN) &&
                           (!scrnmng_isfullscreen()) && (np2oscfg.toolwin)) {
                           toolwin_open();
                   }
                 mouse_running(MOUSE_CONT);                  mouse_running(MOUSE_CONT);
                 soundmng_play();                  soundmng_play();
         }          }
Line 252  static int flagload(const char *ext, con Line 238  static int flagload(const char *ext, con
         }          }
         if (id == IDYES) {          if (id == IDYES) {
                 statsave_load(path);                  statsave_load(path);
                   toolwin_setfdd(0, fdd_diskname(0));
                   toolwin_setfdd(1, fdd_diskname(1));
         }          }
         sysmng_workclockreset();          sysmng_workclockreset();
         sysmng_updatecaption(1);          sysmng_updatecaption(1);
Line 289  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 277  LRESULT CALLBACK WndProc(HWND hWnd, UINT
 #ifndef __GNUC__  #ifndef __GNUC__
                         WINNLSEnableIME(hWnd, FALSE);                          WINNLSEnableIME(hWnd, FALSE);
 #endif  #endif
 //                      DragAcceptFiles(hWnd, TRUE);  
                         break;                          break;
   
                 case WM_SYSCOMMAND:                  case WM_SYSCOMMAND:
                         update = 0;                          update = 0;
                         switch(wParam) {                          switch(wParam) {
                                 case IDM_SCREENCENTER:                                                  // ver0.26                                  case IDM_TOOLWIN:
                                           xmenu_settoolwin(np2oscfg.toolwin ^ 1);
                                           if (np2oscfg.toolwin) {
                                                   toolwin_open();
                                           }
                                           else {
                                                   toolwin_close();
                                           }
                                           update |= SYS_UPDATEOSCFG;
                                           break;
   
                                   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();
                                                 wincentering(hWnd);                                                  wincentering(hWnd);
                                                   toolwin_movingend();
                                         }                                          }
                                         break;                                          break;
   
                                 case IDM_SNAPENABLE:                                  case IDM_SNAPENABLE:
                                         xmenu_setwinsnap(np2oscfg.WINSNAP ^ 1);                                          xmenu_setwinsnap(np2oscfg.WINSNAP ^ 1);
                                         update |= SYS_UPDATECFG;                                          update |= SYS_UPDATEOSCFG;
                                         break;                                          break;
   
                                 case IDM_BACKGROUND:                                  case IDM_BACKGROUND:
                                         xmenu_setbackground(np2oscfg.background ^ 1);                                          xmenu_setbackground(np2oscfg.background ^ 1);
                                         update |= SYS_UPDATECFG;                                          update |= SYS_UPDATEOSCFG;
                                         break;                                          break;
   
                                 case IDM_BGSOUND:                                  case IDM_BGSOUND:
                                         xmenu_setbgsound(np2oscfg.background ^ 2);                                          xmenu_setbgsound(np2oscfg.background ^ 2);
                                         update |= SYS_UPDATECFG;                                          update |= SYS_UPDATEOSCFG;
                                         break;                                          break;
   
                                 case IDM_KEYDISP:                                  case IDM_KEYDISP:
Line 404  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 404  LRESULT CALLBACK WndProc(HWND hWnd, UINT
   
                                 case IDM_FDD1EJECT:                                  case IDM_FDD1EJECT:
                                         diskdrv_setfdd(0, NULL, 0);                                          diskdrv_setfdd(0, NULL, 0);
                                           toolwin_setfdd(0, NULL);
                                         break;                                          break;
   
                                 case IDM_FDD2OPEN:                                  case IDM_FDD2OPEN:
Line 414  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 415  LRESULT CALLBACK WndProc(HWND hWnd, UINT
   
                                 case IDM_FDD2EJECT:                                  case IDM_FDD2EJECT:
                                         diskdrv_setfdd(1, NULL, 0);                                          diskdrv_setfdd(1, NULL, 0);
                                           toolwin_setfdd(1, NULL);
                                         break;                                          break;
   
                                 case IDM_SASI1OPEN:                                  case IDM_SASI1OPEN:
Line 834  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 836  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                 case WM_PAINT:                  case WM_PAINT:
                         hdc = BeginPaint(hWnd, &ps);                          hdc = BeginPaint(hWnd, &ps);
                         if (np2opening) {                          if (np2opening) {
                             HINSTANCE   hinst;                                  HINSTANCE       hinst;
                                 RECT            rect;                                  RECT            rect;
                                 int                     width;                                  int                     width;
                                 int                     height;                                  int                     height;
                             HBITMAP             hbmp;                                  HBITMAP         hbmp;
                             BITMAP              bmp;                                  BITMAP          bmp;
                             HDC                 hmdc;                                  HDC                     hmdc;
                                 HBRUSH          hbrush;                                  HBRUSH          hbrush;
                             hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE);                                  hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE);
                                 GetClientRect(hWnd, &rect);                                  GetClientRect(hWnd, &rect);
                                 width = rect.right - rect.left;                                  width = rect.right - rect.left;
                                 height = rect.bottom - rect.top;                                  height = rect.bottom - rect.top;
                         hbmp = LoadBitmap(hinst, "NP2BMP");                                  hbmp = LoadBitmap(hinst, "NP2BMP");
                             GetObject(hbmp, sizeof(BITMAP), &bmp);                                  GetObject(hbmp, sizeof(BITMAP), &bmp);
                                 hbrush = (HBRUSH)SelectObject(hdc,                                  hbrush = (HBRUSH)SelectObject(hdc,
                                                                                                 GetStockObject(BLACK_BRUSH));                                                                                                  GetStockObject(BLACK_BRUSH));
                                 PatBlt(hdc, 0, 0, width, height, PATCOPY);                                  PatBlt(hdc, 0, 0, width, height, PATCOPY);
                                 SelectObject(hdc, hbrush);                                  SelectObject(hdc, hbrush);
                             hmdc = CreateCompatibleDC(hdc);                                  hmdc = CreateCompatibleDC(hdc);
                             SelectObject(hmdc, hbmp);                                  SelectObject(hmdc, hbmp);
                             BitBlt(hdc, (width - bmp.bmWidth) / 2,                                  BitBlt(hdc, (width - bmp.bmWidth) / 2,
                                                 (height - bmp.bmHeight) / 2,                                                  (height - bmp.bmHeight) / 2,
                                                         bmp.bmWidth, bmp.bmHeight, hmdc, 0, 0, SRCCOPY);                                                          bmp.bmWidth, bmp.bmHeight, hmdc, 0, 0, SRCCOPY);
                             DeleteDC(hmdc);                                  DeleteDC(hmdc);
                         DeleteObject(hbmp);                                  DeleteObject(hbmp);
                         }                          }
                         else {                          else {
 //                              scrnmng_update();  //                              scrnmng_update();
Line 872  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 874  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                         break;                          break;
   
                 case WM_MOVE:                  case WM_MOVE:
                         if ((!scrnmng_isfullscreen()) &&                          if (!scrnmng_isfullscreen()) {
                                 (!(GetWindowLong(hWndMain, GWL_STYLE) &                                  if (!(GetWindowLong(hWnd, GWL_STYLE) &
                                                                         (WS_MAXIMIZE | WS_MINIMIZE)))) {                                                                                          (WS_MAXIMIZE | WS_MINIMIZE))) {
                                 GetWindowRect(hWnd, &rc);                                          GetWindowRect(hWnd, &rc);
                                 np2oscfg.winx = rc.left;                                          np2oscfg.winx = rc.left;
                                 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 897  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 906  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                         soundmng_stop();                          soundmng_stop();
                         mouse_running(MOUSE_STOP);                          mouse_running(MOUSE_STOP);
                         winloc_movingstart();                          winloc_movingstart();
                           toolwin_movingstart();
                         break;                          break;
   
                 case WM_EXITSIZEMOVE:                  case WM_EXITSIZEMOVE:
                           toolwin_movingend();
                         mouse_running(MOUSE_CONT);                          mouse_running(MOUSE_CONT);
                         soundmng_play();                          soundmng_play();
                         break;                          break;
Line 1098  static void processwait(UINT cnt) { Line 1109  static void processwait(UINT cnt) {
                 timing_setcount(0);                  timing_setcount(0);
                 framecnt = 0;                  framecnt = 0;
                 scrnmng_dispclock();                  scrnmng_dispclock();
                 keydisp_draw(np2oscfg.DRAW_SKIP);                  keydisp_draw((BYTE)cnt);
                   toolwin_draw((BYTE)cnt);
                 viewer_allreload(FALSE);                  viewer_allreload(FALSE);
                 if (np2oscfg.DISPCLK & 3) {                  if (np2oscfg.DISPCLK & 3) {
                         if (sysmng_workclockrenewal()) {                          if (sysmng_workclockrenewal()) {
Line 1128  int WINAPI WinMain(HINSTANCE hInstance,  Line 1140  int WINAPI WinMain(HINSTANCE hInstance, 
         file_setcd(modulefile);          file_setcd(modulefile);
         np2arg_analize(lpszCmdLine);          np2arg_analize(lpszCmdLine);
         initload();          initload();
           toolwin_readini();
   
         rand_setseed((unsigned)time(NULL));          rand_setseed((unsigned)time(NULL));
   
Line 1175  int WINAPI WinMain(HINSTANCE hInstance,  Line 1188  int WINAPI WinMain(HINSTANCE hInstance, 
                 if (!RegisterClass(&np2)) {                  if (!RegisterClass(&np2)) {
                         return(FALSE);                          return(FALSE);
                 }                  }
                   toolwin_initapp(hInstance);
         }          }
         keydisp_initialize(hPreInst);          keydisp_initialize(hPreInst);
         viewer_init(hPreInst);                                                                          // ver0.30          viewer_init(hPreInst);                                                                          // ver0.30
Line 1230  int WINAPI WinMain(HINSTANCE hInstance,  Line 1244  int WINAPI WinMain(HINSTANCE hInstance, 
                 }                  }
                 InsertMenu(hMenu, 1, MF_BYPOSITION | MF_POPUP, (UINT)hStat, "S&tat");                  InsertMenu(hMenu, 1, MF_BYPOSITION | MF_POPUP, (UINT)hStat, "S&tat");
         }          }
           sysmenu_init();
         hMenu = GetSystemMenu(hWndMain, FALSE);                                         // ver0.26  
         for (i=0; i<(sizeof(smenu_item)/sizeof(SYSMENU_ITEM)); i++) {  
                 if (smenu_item[i].str) {  
                         InsertMenu(hMenu, i, MF_BYPOSITION | MF_STRING,  
                                                         smenu_item[i].id, smenu_item[i].str);  
                 }  
                 else {  
                         InsertMenu(hMenu, i, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);  
                 }  
         }  
   
         if (np2oscfg.I286SAVE) {  
                 InsertMenu(hMenu, 5, MF_BYPOSITION | MF_STRING, IDM_MEMORYDUMP,  
                                                         "&Memory Dump");  
                 InsertMenu(hMenu, 6, MF_BYPOSITION | MF_STRING, IDM_DEBUGUTY,  
                                                         "&Debug Utility");  
         }  
         DrawMenuBar(hWndMain);          DrawMenuBar(hWndMain);
   
         // ver0.30          // ver0.30
Line 1255  int WINAPI WinMain(HINSTANCE hInstance,  Line 1252  int WINAPI WinMain(HINSTANCE hInstance, 
                 EnableMenuItem(GetMenu(hWndMain), IDM_HELP, MF_GRAYED);                  EnableMenuItem(GetMenu(hWndMain), IDM_HELP, MF_GRAYED);
         }          }
   
           xmenu_settoolwin(np2oscfg.toolwin);
         xmenu_setwinsnap(np2oscfg.WINSNAP);          xmenu_setwinsnap(np2oscfg.WINSNAP);
         xmenu_setbackground(np2oscfg.background);          xmenu_setbackground(np2oscfg.background);
         xmenu_setbgsound(np2oscfg.background);          xmenu_setbgsound(np2oscfg.background);
         xmenu_setscrnmul(8);                                                                            // ver0.26          xmenu_setscrnmul(8);                                                                            // ver0.26
   
           if (np2oscfg.toolwin) {
                   toolwin_open();
           }
   
         scrnmode = 0;          scrnmode = 0;
         if (np2arg.fullscreen) {          if (np2arg.fullscreen) {
                 scrnmode |= SCRNMODE_FULLSCREEN;                  scrnmode |= SCRNMODE_FULLSCREEN;
Line 1432  int WINAPI WinMain(HINSTANCE hInstance,  Line 1434  int WINAPI WinMain(HINSTANCE hInstance, 
                         DispatchMessage(&msg);                          DispatchMessage(&msg);
                 }                  }
         }          }
           toolwin_close();
   
         pccore_cfgupdate();          pccore_cfgupdate();
   
Line 1461  int WINAPI WinMain(HINSTANCE hInstance,  Line 1464  int WINAPI WinMain(HINSTANCE hInstance, 
   
         if (sys_updates & (SYS_UPDATECFG | SYS_UPDATEOSCFG)) {          if (sys_updates & (SYS_UPDATECFG | SYS_UPDATEOSCFG)) {
                 initsave();                  initsave();
                   toolwin_writeini();
         }          }
   
         TRACETERM();          TRACETERM();

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


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