Diff for /np2/win9x/np2.cpp between versions 1.62 and 1.74

version 1.62, 2005/03/20 23:48:02 version 1.74, 2007/11/11 07:11:27
Line 8 Line 8
 #include        "parts.h"  #include        "parts.h"
 #include        "np2.h"  #include        "np2.h"
 #include        "np2arg.h"  #include        "np2arg.h"
 #include        "cputype.h"  
 #include        "dosio.h"  #include        "dosio.h"
 #include        "extromio.h"  #include        "extromio.h"
 #include        "commng.h"  #include        "commng.h"
Line 23 Line 22
 #include        "winloc.h"  #include        "winloc.h"
 #include        "sstp.h"  #include        "sstp.h"
 #include        "sstpmsg.h"  #include        "sstpmsg.h"
 #include        "dclock.h"  
 #include        "toolwin.h"  #include        "toolwin.h"
 #include        "juliet.h"  #include        "juliet.h"
 #include        "np2class.h"  #include        "np2class.h"
Line 45 Line 43
 #include        "debugsub.h"  #include        "debugsub.h"
 #include        "subwind.h"  #include        "subwind.h"
 #include        "viewer.h"  #include        "viewer.h"
   #if !defined(_WIN64)
   #include        "cputype.h"
   #endif
   #if defined(SUPPORT_DCLOCK)
   #include        "dclock.h"
   #endif
   
   
 #ifdef BETA_RELEASE  #ifdef BETA_RELEASE
Line 52 Line 56
 #endif  #endif
   
 static  TCHAR           szClassName[] = _T("NP2-MainWindow");  static  TCHAR           szClassName[] = _T("NP2-MainWindow");
                 HWND            hWndMain;                  HWND            g_hWndMain;
                 HINSTANCE       hInst;                  HINSTANCE       g_hInstance;
                 HINSTANCE       hPrev;                  HINSTANCE       g_hPrevInst;
   #if !defined(_WIN64)
                 int                     mmxflag;                  int                     mmxflag;
   #endif
                 UINT8           np2break = 0;                                                                   // ver0.30                  UINT8           np2break = 0;                                                                   // ver0.30
                 BOOL            winui_en;                  BOOL            winui_en;
   
                 NP2OSCFG        np2oscfg = {                  NP2OSCFG        np2oscfg = {
 #if !defined(SUPPORT_PC9821)                                                  OEMTEXT(PROJECTNAME) OEMTEXT(PROJECTSUBNAME),
                                                 OEMTEXT("Neko Project II"),  
 #else  
                                                 OEMTEXT("Neko Project 21"),  
 #endif  
                                                 OEMTEXT("NP2"),                                                  OEMTEXT("NP2"),
                                                 CW_USEDEFAULT, CW_USEDEFAULT, 1, 1, 0, 1, 0, 0,                                                  CW_USEDEFAULT, CW_USEDEFAULT, 1, 1, 0, 0, 0, 1, 0, 0,
                                                 0, 0, KEY_UNKNOWN, 0,                                                  0, 0, KEY_UNKNOWN, 0,
                                                 0, 0, 0, {1, 2, 2, 1},                                                  0, 0, 0, {1, 2, 2, 1},
                                                 {5, 0, 0x3e, 19200,                                                  {5, 0, 0x3e, 19200,
Line 78  static TCHAR  szClassName[] = _T("NP2-Ma Line 80  static TCHAR  szClassName[] = _T("NP2-Ma
                                                 {0, 0, 0x3e, 19200,                                                  {0, 0, 0x3e, 19200,
                                                  OEMTEXT(""), OEMTEXT(""), OEMTEXT(""), OEMTEXT("")},                                                   OEMTEXT(""), OEMTEXT(""), OEMTEXT(""), OEMTEXT("")},
                                                 0xffffff, 0xffbf6a, 0, 0,                                                  0xffffff, 0xffbf6a, 0, 0,
                                                 0, 1, 0, 9801, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};                                                  0, 1, 0, 9801, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
   
                 OEMCHAR         fddfolder[MAX_PATH];                  OEMCHAR         fddfolder[MAX_PATH];
                 OEMCHAR         hddfolder[MAX_PATH];                  OEMCHAR         hddfolder[MAX_PATH];
Line 94  static int   np2quitmsg = 0; Line 96  static int   np2quitmsg = 0;
 static  HMENU           hStat = NULL;  static  HMENU           hStat = NULL;
 static  UINT8           scrnmode;  static  UINT8           scrnmode;
 static  WINLOCEX        smwlex;  static  WINLOCEX        smwlex;
   static  HMODULE         resmod;
   
 static const OEMCHAR np2help[] = OEMTEXT("np2.chm");  static const OEMCHAR np2help[] = OEMTEXT("np2.chm");
 static const OEMCHAR np2flagext[] = OEMTEXT("S%02d");  static const OEMCHAR np2flagext[] = OEMTEXT("S%02d");
   static const OEMCHAR np2resext[] = OEMTEXT(".%u");
   
   
   // ----
   
   static HINSTANCE loadextinst(HINSTANCE hInstance) {
   
           OEMCHAR path[MAX_PATH];
           OEMCHAR cpstr[16];
           HMODULE dll;
   
           file_cpyname(path, modulefile, NELEMENTS(path));
           file_cutext(path);
           OEMSPRINTF(cpstr, np2resext, GetOEMCP());
           file_catname(path, cpstr, NELEMENTS(path));
           dll = LoadLibrary(path);
           resmod = dll;
           if (dll != NULL) {
                   hInstance = (HINSTANCE)dll;
           }
           return(hInstance);
   }
   
   static void unloadextinst(void) {
   
           HMODULE dll;
   
           dll = resmod;
           if (dll) {
                   resmod = 0;
                   FreeLibrary(dll);
           }
   }
   
   
   // ----
   
 static void winuienter(void) {  static void winuienter(void) {
   
Line 120  WINLOCEX np2_winlocexallwin(HWND base) { Line 158  WINLOCEX np2_winlocexallwin(HWND base) {
         HWND    list[5];          HWND    list[5];
   
         cnt = 0;          cnt = 0;
         list[cnt++] = hWndMain;          list[cnt++] = g_hWndMain;
         list[cnt++] = toolwin_gethwnd();          list[cnt++] = toolwin_gethwnd();
         list[cnt++] = kdispwin_gethwnd();          list[cnt++] = kdispwin_gethwnd();
         list[cnt++] = skbdwin_gethwnd();          list[cnt++] = skbdwin_gethwnd();
Line 130  WINLOCEX np2_winlocexallwin(HWND base) { Line 168  WINLOCEX np2_winlocexallwin(HWND base) {
                         list[i] = NULL;                          list[i] = NULL;
                 }                  }
         }          }
         if (base != hWndMain) {         // hWndMainのみ全体移動          if (base != g_hWndMain) {               // hWndMainのみ全体移動
                 base = NULL;                  base = NULL;
         }          }
         return(winlocex_create(base, list, cnt));          return(winlocex_create(base, list, cnt));
Line 159  static void changescreen(UINT8 newmode)  Line 197  static void changescreen(UINT8 newmode) 
                         mdbgwin_destroy();                          mdbgwin_destroy();
                 }                  }
                 else if (renewal & SCRNMODE_ROTATEMASK) {                  else if (renewal & SCRNMODE_ROTATEMASK) {
                         wlex = np2_winlocexallwin(hWndMain);                          wlex = np2_winlocexallwin(g_hWndMain);
                         winlocex_setholdwnd(wlex, hWndMain);                          winlocex_setholdwnd(wlex, g_hWndMain);
                 }                  }
                 soundmng_stop();                  soundmng_stop();
                 mousemng_disable(MOUSEPROC_WINUI);                  mousemng_disable(MOUSEPROC_WINUI);
Line 178  static void changescreen(UINT8 newmode)  Line 216  static void changescreen(UINT8 newmode) 
                 if (renewal & SCRNMODE_FULLSCREEN) {                  if (renewal & SCRNMODE_FULLSCREEN) {
                         if (!scrnmng_isfullscreen()) {                          if (!scrnmng_isfullscreen()) {
                                 if (np2oscfg.toolwin) {                                  if (np2oscfg.toolwin) {
                                         toolwin_create();                                          toolwin_create(g_hInstance);
                                 }                                  }
                                 if (np2oscfg.keydisp) {                                  if (np2oscfg.keydisp) {
                                         kdispwin_create();                                          kdispwin_create(g_hInstance);
                                 }                                  }
                         }                          }
                 }                  }
Line 215  static void wincentering(HWND hWnd) { Line 253  static void wincentering(HWND hWnd) {
                 np2oscfg.winy = 0;                  np2oscfg.winy = 0;
         }          }
         sysmng_update(SYS_UPDATEOSCFG);          sysmng_update(SYS_UPDATEOSCFG);
         MoveWindow(hWndMain, np2oscfg.winx, np2oscfg.winy, width, height, TRUE);          MoveWindow(g_hWndMain, np2oscfg.winx, np2oscfg.winy, width, height, TRUE);
 }  }
   
 void np2active_renewal(void) {                                                                          // ver0.30  void np2active_renewal(void) {                                                                          // ver0.30
Line 291  static int flagload(const OEMCHAR *ext,  Line 329  static int flagload(const OEMCHAR *ext, 
         id = IDYES;          id = IDYES;
         ret = statsave_check(path, buf, NELEMENTS(buf));          ret = statsave_check(path, buf, NELEMENTS(buf));
         if (ret & (~STATFLAG_DISKCHG)) {          if (ret & (~STATFLAG_DISKCHG)) {
                 MessageBox(hWndMain, _T("Couldn't restart"), title,                  MessageBox(g_hWndMain, _T("Couldn't restart"), title,
                                                                                 MB_OK | MB_ICONSTOP);                                                                                  MB_OK | MB_ICONSTOP);
                 id = IDNO;                  id = IDNO;
         }          }
         else if ((!force) && (ret & STATFLAG_DISKCHG)) {          else if ((!force) && (ret & STATFLAG_DISKCHG)) {
                 OEMCHAR buf2[1024 + 256];                  OEMCHAR buf2[1024 + 256];
                 OEMSPRINTF(buf2, OEMTEXT("Conflict!\n\n%s\nContinue?"), buf);                  OEMSPRINTF(buf2, OEMTEXT("Conflict!\n\n%s\nContinue?"), buf);
                 id = MessageBox(hWndMain, buf2, title,                  id = MessageBox(g_hWndMain, buf2, title,
                                                                                 MB_YESNOCANCEL | MB_ICONQUESTION);                                                                                  MB_YESNOCANCEL | MB_ICONQUESTION);
         }          }
         if (id == IDYES) {          if (id == IDYES) {
Line 322  static void np2popup(HWND hWnd, LPARAM l Line 360  static void np2popup(HWND hWnd, LPARAM l
         HMENU   hMenu;          HMENU   hMenu;
         POINT   pt;          POINT   pt;
   
         mainmenu = (HMENU)GetWindowLong(hWnd, NP2GWL_HMENU);          mainmenu = (HMENU)GetWindowLongPtr(hWnd, NP2GWLP_HMENU);
         if (mainmenu == NULL) {          if (mainmenu == NULL) {
                 return;                  return;
         }          }
Line 335  static void np2popup(HWND hWnd, LPARAM l Line 373  static void np2popup(HWND hWnd, LPARAM l
         DestroyMenu(hMenu);          DestroyMenu(hMenu);
 }  }
   
 static void np2cmd(HWND hWnd, UINT16 cmd) {  static void OnCommand(HWND hWnd, WPARAM wParam)
   {
         UINT    update;          HINSTANCE       hInstance;
         BOOL    b;          UINT            update;
           UINT            uID;
           BOOL            b;
   
           hInstance = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE);
         update = 0;          update = 0;
         switch(cmd) {          uID = LOWORD(wParam);
           switch(uID)
           {
                 case IDM_RESET:                  case IDM_RESET:
                         b = FALSE;                          b = FALSE;
                         if (!np2oscfg.comfirm) {                          if (!np2oscfg.comfirm) {
Line 366  static void np2cmd(HWND hWnd, UINT16 cmd Line 409  static void np2cmd(HWND hWnd, UINT16 cmd
                 case IDM_CONFIG:                  case IDM_CONFIG:
                         winuienter();                          winuienter();
                         sstpmsg_config();                          sstpmsg_config();
                         DialogBox(hInst, MAKEINTRESOURCE(IDD_CONFIG),                          DialogBox(hInstance, MAKEINTRESOURCE(IDD_CONFIG),
                                                                         hWnd, (DLGPROC)CfgDialogProc);                                                                          hWnd, (DLGPROC)CfgDialogProc);
                         if (!scrnmng_isfullscreen()) {                          if (!scrnmng_isfullscreen()) {
                                 UINT8 thick;                                  UINT8 thick;
Line 443  static void np2cmd(HWND hWnd, UINT16 cmd Line 486  static void np2cmd(HWND hWnd, UINT16 cmd
                         toolwin_setfdd(3, NULL);                          toolwin_setfdd(3, NULL);
                         break;                          break;
   
                 case IDM_SASI1OPEN:                  case IDM_IDE0OPEN:
                         winuienter();                          winuienter();
                         dialog_changehdd(hWnd, 0x00);                          dialog_changehdd(hWnd, 0x00);
                         winuileave();                          winuileave();
                         break;                          break;
   
                 case IDM_SASI1EJECT:                  case IDM_IDE0EJECT:
                         diskdrv_sethdd(0x00, NULL);                          diskdrv_sethdd(0x00, NULL);
                         break;                          break;
   
                 case IDM_SASI2OPEN:                  case IDM_IDE1OPEN:
                         winuienter();                          winuienter();
                         dialog_changehdd(hWnd, 0x01);                          dialog_changehdd(hWnd, 0x01);
                         winuileave();                          winuileave();
                         break;                          break;
   
                 case IDM_SASI2EJECT:                  case IDM_IDE1EJECT:
                         diskdrv_sethdd(0x01, NULL);                          diskdrv_sethdd(0x01, NULL);
                         break;                          break;
   
   #if defined(SUPPORT_IDEIO)
                   case IDM_IDE2OPEN:
                           winuienter();
                           dialog_changehdd(hWnd, 0x02);
                           winuileave();
                           break;
   
                   case IDM_IDE2EJECT:
                           diskdrv_sethdd(0x02, NULL);
                           break;
   #endif
   
 #if defined(SUPPORT_SCSI)  #if defined(SUPPORT_SCSI)
                 case IDM_SCSI0OPEN:                  case IDM_SCSI0OPEN:
                         winuienter();                          winuienter();
Line 503  static void np2cmd(HWND hWnd, UINT16 cmd Line 559  static void np2cmd(HWND hWnd, UINT16 cmd
                         diskdrv_sethdd(0x23, NULL);                          diskdrv_sethdd(0x23, NULL);
                         break;                          break;
 #endif  #endif
   
                 case IDM_WINDOW:                  case IDM_WINDOW:
                         changescreen(scrnmode & (~SCRNMODE_FULLSCREEN));                          changescreen(scrnmode & (~SCRNMODE_FULLSCREEN));
                         break;                          break;
Line 739  static void np2cmd(HWND hWnd, UINT16 cmd Line 796  static void np2cmd(HWND hWnd, UINT16 cmd
                         update |= SYS_UPDATECFG;                          update |= SYS_UPDATECFG;
                         break;                          break;
   
   #if defined(SUPPORT_PX)
                   case IDM_PX1:
                           xmenu_setsound(0x30);
                           update |= SYS_UPDATECFG;
                           break;
   
                   case IDM_PX2:
                           xmenu_setsound(0x50);
                           update |= SYS_UPDATECFG;
                           break;
   #endif  // defined(SUPPORT_PX)
   
                 case IDM_JASTSOUND:                  case IDM_JASTSOUND:
                         xmenu_setjastsound(np2oscfg.jastsnd ^ 1);                          xmenu_setjastsound(np2oscfg.jastsnd ^ 1);
                         update |= SYS_UPDATEOSCFG;                          update |= SYS_UPDATEOSCFG;
Line 793  static void np2cmd(HWND hWnd, UINT16 cmd Line 862  static void np2cmd(HWND hWnd, UINT16 cmd
   
                 case IDM_MPUPC98:                  case IDM_MPUPC98:
                         winuienter();                          winuienter();
                         DialogBox(hInst, MAKEINTRESOURCE(IDD_MPUPC98),                          DialogBox(hInstance, MAKEINTRESOURCE(IDD_MPUPC98),
                                                                                         hWnd, (DLGPROC)MidiDialogProc);                                                                                          hWnd, (DLGPROC)MidiDialogProc);
                         winuileave();                          winuileave();
                         break;                          break;
Line 841  static void np2cmd(HWND hWnd, UINT16 cmd Line 910  static void np2cmd(HWND hWnd, UINT16 cmd
   
                 case IDM_CALENDAR:                  case IDM_CALENDAR:
                         winuienter();                          winuienter();
                         DialogBox(hInst, MAKEINTRESOURCE(IDD_CALENDAR),                          DialogBox(hInstance, MAKEINTRESOURCE(IDD_CALENDAR),
                                                                                         hWnd, (DLGPROC)ClndDialogProc);                                                                                          hWnd, (DLGPROC)ClndDialogProc);
                         winuileave();                          winuileave();
                         break;                          break;
Line 876  static void np2cmd(HWND hWnd, UINT16 cmd Line 945  static void np2cmd(HWND hWnd, UINT16 cmd
                         update |= SYS_UPDATECFG;                          update |= SYS_UPDATECFG;
                         break;                          break;
   
                 case IDM_I286SAVE:                  case IDM_CPUSAVE:
                         debugsub_status();                          debugsub_status();
                         break;                          break;
   
Line 889  static void np2cmd(HWND hWnd, UINT16 cmd Line 958  static void np2cmd(HWND hWnd, UINT16 cmd
                         sstpmsg_about();                          sstpmsg_about();
                         if (sstp_result() != SSTP_SENDING) {                          if (sstp_result() != SSTP_SENDING) {
                                 winuienter();                                  winuienter();
                                 DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT),                                  DialogBox(hInstance, MAKEINTRESOURCE(IDD_ABOUT),
                                                                 hWnd, (DLGPROC)AboutDialogProc);                                                                  hWnd, (DLGPROC)AboutDialogProc);
                                 winuileave();                                  winuileave();
                         }                          }
Line 897  static void np2cmd(HWND hWnd, UINT16 cmd Line 966  static void np2cmd(HWND hWnd, UINT16 cmd
   
                 default:                  default:
 #if defined(SUPPORT_STATSAVE)  #if defined(SUPPORT_STATSAVE)
                         if ((cmd >= IDM_FLAGSAVE) &&                          if ((uID >= IDM_FLAGSAVE) &&
                                 (cmd < (IDM_FLAGSAVE + SUPPORT_STATSAVE))) {                                  (uID < (IDM_FLAGSAVE + SUPPORT_STATSAVE))) {
                                 OEMCHAR ext[4];                                  OEMCHAR ext[4];
                                 OEMSPRINTF(ext, np2flagext, cmd - IDM_FLAGSAVE);                                  OEMSPRINTF(ext, np2flagext, uID - IDM_FLAGSAVE);
                                 flagsave(ext);                                  flagsave(ext);
                         }                          }
                         else if ((cmd >= IDM_FLAGLOAD) &&                          else if ((uID >= IDM_FLAGLOAD) &&
                                 (cmd < (IDM_FLAGLOAD + SUPPORT_STATSAVE))) {                                  (uID < (IDM_FLAGLOAD + SUPPORT_STATSAVE))) {
                                 OEMCHAR ext[4];                                  OEMCHAR ext[4];
                                 OEMSPRINTF(ext, np2flagext, cmd - IDM_FLAGLOAD);                                  OEMSPRINTF(ext, np2flagext, uID - IDM_FLAGLOAD);
                                 flagload(ext, OEMTEXT("Status Load"), TRUE);                                  flagload(ext, OEMTEXT("Status Load"), TRUE);
                         }                          }
 #endif  #endif
Line 941  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 1010  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                                 case IDM_TOOLWIN:                                  case IDM_TOOLWIN:
                                         sysmenu_settoolwin(np2oscfg.toolwin ^ 1);                                          sysmenu_settoolwin(np2oscfg.toolwin ^ 1);
                                         if (np2oscfg.toolwin) {                                          if (np2oscfg.toolwin) {
                                                 toolwin_create();                                                  toolwin_create(g_hInstance);
                                         }                                          }
                                         else {                                          else {
                                                 toolwin_destroy();                                                  toolwin_destroy();
Line 953  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 1022  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                                 case IDM_KEYDISP:                                  case IDM_KEYDISP:
                                         sysmenu_setkeydisp(np2oscfg.keydisp ^ 1);                                          sysmenu_setkeydisp(np2oscfg.keydisp ^ 1);
                                         if (np2oscfg.keydisp) {                                          if (np2oscfg.keydisp) {
                                                 kdispwin_create();                                                  kdispwin_create(g_hInstance);
                                         }                                          }
                                         else {                                          else {
                                                 kdispwin_destroy();                                                  kdispwin_destroy();
Line 962  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 1031  LRESULT CALLBACK WndProc(HWND hWnd, UINT
 #endif  #endif
 #if defined(SUPPORT_SOFTKBD)  #if defined(SUPPORT_SOFTKBD)
                                 case IDM_SOFTKBD:                                  case IDM_SOFTKBD:
                                         skbdwin_create();                                          skbdwin_create(g_hInstance);
                                         break;                                          break;
 #endif  #endif
 #if defined(CPUCORE_IA32) && defined(SUPPORT_MEMDBG32)  #if defined(CPUCORE_IA32) && defined(SUPPORT_MEMDBG32)
                                 case IDM_MEMDBG32:                                  case IDM_MEMDBG32:
                                         mdbgwin_create();                                          mdbgwin_create(g_hInstance);
                                         break;                                          break;
 #endif  #endif
                                 case IDM_SCREENCENTER:                                  case IDM_SCREENCENTER:
Line 1001  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 1070  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                                         break;                                          break;
   
                                 case IDM_DEBUGUTY:                                  case IDM_DEBUGUTY:
                                         viewer_open();                                          viewer_open(g_hInstance);
                                         break;                                          break;
   
                                 case IDM_SCRNMUL4:                                  case IDM_SCRNMUL4:
Line 1011  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 1080  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                                 case IDM_SCRNMUL12:                                  case IDM_SCRNMUL12:
                                 case IDM_SCRNMUL16:                                  case IDM_SCRNMUL16:
                                         if ((!scrnmng_isfullscreen()) &&                                          if ((!scrnmng_isfullscreen()) &&
                                                 !(GetWindowLong(hWndMain, GWL_STYLE) & WS_MINIMIZE)) {                                                  !(GetWindowLong(g_hWndMain, GWL_STYLE) & WS_MINIMIZE))
                                                 sysmenu_setscrnmul(wParam - IDM_SCRNMUL);                                          {
                                                 scrnmng_setmultiple(wParam - IDM_SCRNMUL);                                                  sysmenu_setscrnmul((UINT8)(wParam - IDM_SCRNMUL));
                                                   scrnmng_setmultiple((int)(wParam - IDM_SCRNMUL));
                                         }                                          }
                                         break;                                          break;
   
Line 1049  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 1119  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                         break;                          break;
   
                 case WM_COMMAND:                  case WM_COMMAND:
                         np2cmd(hWnd, LOWORD(wParam));                          OnCommand(hWnd, wParam);
                         break;                          break;
   
                 case WM_ACTIVATE:                  case WM_ACTIVATE:
Line 1069  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 1139  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       hInstance;
                                 RECT            rect;                                  RECT            rect;
                                 int                     width;                                  int                     width;
                                 int                     height;                                  int                     height;
Line 1077  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 1147  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                                 BITMAP          bmp;                                  BITMAP          bmp;
                                 HDC                     hmdc;                                  HDC                     hmdc;
                                 HBRUSH          hbrush;                                  HBRUSH          hbrush;
                                 hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE);                                  hInstance = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_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, _T("NP2BMP"));                                  hbmp = LoadBitmap(hInstance, _T("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));
Line 1157  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 1227  LRESULT CALLBACK WndProc(HWND hWnd, UINT
   
                 case WM_KEYDOWN:                  case WM_KEYDOWN:
                         if (wParam == VK_F11) {                          if (wParam == VK_F11) {
                                 np2class_enablemenu(hWndMain, TRUE);                                  np2class_enablemenu(g_hWndMain, TRUE);
                                 return(DefWindowProc(hWnd, WM_SYSKEYDOWN, VK_F10, lParam));                                  return(DefWindowProc(hWnd, WM_SYSKEYDOWN, VK_F10, lParam));
                         }                          }
                         if ((wParam == VK_F12) && (!np2oscfg.F12COPY)) {                          if ((wParam == VK_F12) && (!np2oscfg.F12COPY)) {
Line 1214  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 1284  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                                                                                                                         HTCAPTION, 0L));                                                                                                                          HTCAPTION, 0L));
                                         }                                          }
                                 }                                  }
   #if defined(SUPPORT_DCLOCK)
                                 else {                                  else {
                                         POINT p;                                          POINT p;
                                         if ((GetCursorPos(&p)) && (p.y >= 466)) {                                          if ((GetCursorPos(&p)) &&
                                                   (scrnmng_isdispclockclick(&p))) {
                                                 np2oscfg.clk_x++;                                                  np2oscfg.clk_x++;
                                                 sysmng_update(SYS_UPDATEOSCFG);                                                  sysmng_update(SYS_UPDATEOSCFG);
                                                 dclock_reset();                                                  dclock_reset();
                                         }                                          }
                                 }                                  }
   #endif
                                 return(DefWindowProc(hWnd, msg, wParam, lParam));                                  return(DefWindowProc(hWnd, msg, wParam, lParam));
                         }                          }
                         break;                          break;
Line 1243  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 1316  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                                 if (!scrnmng_isfullscreen()) {                                  if (!scrnmng_isfullscreen()) {
                                         np2popup(hWnd, lParam);                                          np2popup(hWnd, lParam);
                                 }                                  }
   #if defined(SUPPORT_DCLOCK)
                                 else {                                  else {
                                         POINT p;                                          POINT p;
                                         if ((GetCursorPos(&p)) && (p.y >= 466) &&                                          if ((GetCursorPos(&p)) &&
                                                                                                 (np2oscfg.clk_x)) {                                                  (scrnmng_isdispclockclick(&p)) &&
                                                   (np2oscfg.clk_x)) {
                                                 np2oscfg.clk_fnt++;                                                  np2oscfg.clk_fnt++;
                                                 sysmng_update(SYS_UPDATEOSCFG);                                                  sysmng_update(SYS_UPDATEOSCFG);
                                                 dclock_reset();                                                  dclock_reset();
                                         }                                          }
                                 }                                  }
   #endif
                                 return(DefWindowProc(hWnd, msg, wParam, lParam));                                  return(DefWindowProc(hWnd, msg, wParam, lParam));
                         }                          }
                         break;                          break;
Line 1365  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 1441  LRESULT CALLBACK WndProc(HWND hWnd, UINT
 static void framereset(UINT cnt) {  static void framereset(UINT cnt) {
   
         framecnt = 0;          framecnt = 0;
   #if defined(SUPPORT_DCLOCK)
         scrnmng_dispclock();          scrnmng_dispclock();
   #endif
         kdispwin_draw((UINT8)cnt);          kdispwin_draw((UINT8)cnt);
         skbdwin_process();          skbdwin_process();
         mdbgwin_process();          mdbgwin_process();
Line 1390  static void processwait(UINT cnt) { Line 1468  static void processwait(UINT cnt) {
         soundmng_sync();          soundmng_sync();
 }  }
   
   int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,
 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst,  
                                                                                 LPSTR lpszCmdLine, int nCmdShow) {                                                                                  LPSTR lpszCmdLine, int nCmdShow) {
         WNDCLASS        wc;          WNDCLASS        wc;
         MSG                     msg;          MSG                     msg;
Line 1429  int WINAPI WinMain(HINSTANCE hInstance,  Line 1506  int WINAPI WinMain(HINSTANCE hInstance, 
                 return(FALSE);                  return(FALSE);
         }          }
   
         hInst = hInstance;          g_hInstance = loadextinst(hInstance);
         hPrev = hPreInst;          g_hPrevInst = hPrevInst;
   #if !defined(_WIN64)
         mmxflag = (havemmx())?0:MMXFLAG_NOTSUPPORT;          mmxflag = (havemmx())?0:MMXFLAG_NOTSUPPORT;
         mmxflag += (np2oscfg.disablemmx)?MMXFLAG_DISABLE:0;          mmxflag += (np2oscfg.disablemmx)?MMXFLAG_DISABLE:0;
   #endif
         TRACEINIT();          TRACEINIT();
   
         xrollkey = (np2oscfg.xrollkey == 0);          xrollkey = (np2oscfg.xrollkey == 0);
Line 1454  int WINAPI WinMain(HINSTANCE hInstance,  Line 1533  int WINAPI WinMain(HINSTANCE hInstance, 
         keystat_initialize();          keystat_initialize();
   
         np2class_initialize(hInstance);          np2class_initialize(hInstance);
         if (!hPreInst) {          if (!hPrevInst) {
                 wc.style = CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;                  wc.style = CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
                 wc.lpfnWndProc = WndProc;                  wc.lpfnWndProc = WndProc;
                 wc.cbClsExtra = 0;                  wc.cbClsExtra = 0;
                 wc.cbWndExtra = NP2GWL_SIZE;                  wc.cbWndExtra = NP2GWLP_SIZE;
                 wc.hInstance = hInstance;                  wc.hInstance = hInstance;
                 wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));                  wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
                 wc.hCursor = LoadCursor(NULL, IDC_ARROW);                  wc.hCursor = LoadCursor(NULL, IDC_ARROW);
Line 1466  int WINAPI WinMain(HINSTANCE hInstance,  Line 1545  int WINAPI WinMain(HINSTANCE hInstance, 
                 wc.lpszMenuName = MAKEINTRESOURCE(IDR_MAIN);                  wc.lpszMenuName = MAKEINTRESOURCE(IDR_MAIN);
                 wc.lpszClassName = szClassName;                  wc.lpszClassName = szClassName;
                 if (!RegisterClass(&wc)) {                  if (!RegisterClass(&wc)) {
                           unloadextinst();
                           TRACETERM();
                           dosio_term();
                         return(FALSE);                          return(FALSE);
                 }                  }
   
                   toolwin_initapp(hInstance);
                   kdispwin_initialize(hInstance);
                   skbdwin_initialize(hInstance);
                   mdbgwin_initialize(hInstance);
                   viewer_init(hInstance);
         }          }
         toolwin_initapp(hInstance);  
         kdispwin_initialize(hPreInst);  
         skbdwin_initialize(hPreInst);  
         mdbgwin_initialize(hPreInst);  
         viewer_init(hPreInst);  
   
         mousemng_initialize();          mousemng_initialize();
   
Line 1484  int WINAPI WinMain(HINSTANCE hInstance,  Line 1567  int WINAPI WinMain(HINSTANCE hInstance, 
         hWnd = CreateWindowEx(0, szClassName, np2oscfg.titles, style,          hWnd = CreateWindowEx(0, szClassName, np2oscfg.titles, style,
                                                 np2oscfg.winx, np2oscfg.winy, 640, 400,                                                  np2oscfg.winx, np2oscfg.winy, 640, 400,
                                                 NULL, NULL, hInstance, NULL);                                                  NULL, NULL, hInstance, NULL);
         hWndMain = hWnd;          g_hWndMain = hWnd;
         scrnmng_initialize();          scrnmng_initialize();
   
         xmenu_setroltate(0);          xmenu_setroltate(0);
Line 1546  int WINAPI WinMain(HINSTANCE hInstance,  Line 1629  int WINAPI WinMain(HINSTANCE hInstance, 
                                 MessageBox(hWnd, _T("Couldn't create DirectDraw Object"),                                  MessageBox(hWnd, _T("Couldn't create DirectDraw Object"),
                                                                                 np2oscfg.titles, MB_OK | MB_ICONSTOP);                                                                                  np2oscfg.titles, MB_OK | MB_ICONSTOP);
                         }                          }
                           unloadextinst();
                           TRACETERM();
                           dosio_term();
                         return(FALSE);                          return(FALSE);
                 }                  }
         }          }
Line 1603  int WINAPI WinMain(HINSTANCE hInstance,  Line 1689  int WINAPI WinMain(HINSTANCE hInstance, 
                         sstp_destruct();                          sstp_destruct();
                         soundmng_deinitialize();                          soundmng_deinitialize();
                         scrnmng_destroy();                          scrnmng_destroy();
                           unloadextinst();
                         TRACETERM();                          TRACETERM();
                         dosio_term();                          dosio_term();
                         viewer_term();                          viewer_term();
                         return(0);                          return(FALSE);
                 }                  }
         }          }
 #endif  #endif
Line 1620  int WINAPI WinMain(HINSTANCE hInstance,  Line 1707  int WINAPI WinMain(HINSTANCE hInstance, 
   
         if (!(scrnmode & SCRNMODE_FULLSCREEN)) {          if (!(scrnmode & SCRNMODE_FULLSCREEN)) {
                 if (np2oscfg.toolwin) {                  if (np2oscfg.toolwin) {
                         toolwin_create();                          toolwin_create(hInstance);
                 }                  }
                 if (np2oscfg.keydisp) {                  if (np2oscfg.keydisp) {
                         kdispwin_create();                          kdispwin_create(hInstance);
                 }                  }
         }          }
   
Line 1645  int WINAPI WinMain(HINSTANCE hInstance,  Line 1732  int WINAPI WinMain(HINSTANCE hInstance, 
                                         joymng_sync();                                          joymng_sync();
                                         mousemng_sync();                                          mousemng_sync();
                                         pccore_exec(framecnt == 0);                                          pccore_exec(framecnt == 0);
   #if defined(SUPPORT_DCLOCK)
                                         dclock_callback();                                          dclock_callback();
   #endif
                                         if (np2oscfg.DRAW_SKIP) {               // nowait frame skip                                          if (np2oscfg.DRAW_SKIP) {               // nowait frame skip
                                                 framecnt++;                                                  framecnt++;
                                                 if (framecnt >= np2oscfg.DRAW_SKIP) {                                                  if (framecnt >= np2oscfg.DRAW_SKIP) {
Line 1664  int WINAPI WinMain(HINSTANCE hInstance,  Line 1753  int WINAPI WinMain(HINSTANCE hInstance, 
                                                 joymng_sync();                                                  joymng_sync();
                                                 mousemng_sync();                                                  mousemng_sync();
                                                 pccore_exec(framecnt == 0);                                                  pccore_exec(framecnt == 0);
   #if defined(SUPPORT_DCLOCK)
                                                 dclock_callback();                                                  dclock_callback();
   #endif
                                                 framecnt++;                                                  framecnt++;
                                         }                                          }
                                         else {                                          else {
Line 1677  int WINAPI WinMain(HINSTANCE hInstance,  Line 1768  int WINAPI WinMain(HINSTANCE hInstance, 
                                                 joymng_sync();                                                  joymng_sync();
                                                 mousemng_sync();                                                  mousemng_sync();
                                                 pccore_exec(framecnt == 0);                                                  pccore_exec(framecnt == 0);
   #if defined(SUPPORT_DCLOCK)
                                                 dclock_callback();                                                  dclock_callback();
   #endif
                                                 framecnt++;                                                  framecnt++;
                                                 cnt = timing_getcount();                                                  cnt = timing_getcount();
                                                 if (framecnt > cnt) {                                                  if (framecnt > cnt) {
Line 1753  int WINAPI WinMain(HINSTANCE hInstance,  Line 1846  int WINAPI WinMain(HINSTANCE hInstance, 
         }          }
         skbdwin_deinitialize();          skbdwin_deinitialize();
   
           unloadextinst();
   
         TRACETERM();          TRACETERM();
         _MEM_USED("report.txt");          _MEM_USED("report.txt");
         dosio_term();          dosio_term();
   
         viewer_term();                                                                                                  // ver0.30          viewer_term();                                                                                                  // ver0.30
   
         return(msg.wParam);          return((int)msg.wParam);
 }  }
   

Removed from v.1.62  
changed lines
  Added in v.1.74


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