Diff for /np2/win9x/np2.cpp between versions 1.55 and 1.69

version 1.55, 2004/06/14 13:35:40 version 1.69, 2007/01/08 01:16:59
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
 #define         OPENING_WAIT            1500  #define         OPENING_WAIT            1500
 #endif  #endif
   
 static  char            szClassName[] = "NP2-MainWindow";  static  TCHAR           szClassName[] = _T("NP2-MainWindow");
                 HWND            hWndMain;                  HWND            hWndMain;
                 HINSTANCE       hInst;                  HINSTANCE       hInst;
                 HINSTANCE       hPrev;                  HINSTANCE       hPrev;
   #if !defined(_WIN64)
                 int                     mmxflag;                  int                     mmxflag;
                 BYTE            np2break = 0;                                                                   // ver0.30  #endif
                   UINT8           np2break = 0;                                                                   // ver0.30
                 BOOL            winui_en;                  BOOL            winui_en;
   
                 NP2OSCFG        np2oscfg = {                  NP2OSCFG        np2oscfg = {
 #if !defined(SUPPORT_PC9821)                                                  OEMTEXT(PROJECTNAME) OEMTEXT(PROJECTSUBNAME),
                                                 "Neko Project II",                                                  OEMTEXT("NP2"),
 #else                                                  CW_USEDEFAULT, CW_USEDEFAULT, 1, 1, 0, 0, 0, 1, 0, 0,
                                                 "Neko Project 21",  
 #endif  
                                                 "NP2",  
                                                 CW_USEDEFAULT, CW_USEDEFAULT, 1, 1, 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, "", "", "", ""},            // ver0.34                                                  {5, 0, 0x3e, 19200,
                                                 {0, 0, 0x3e, 19200, "", "", "", ""},            // ver0.34                                                   OEMTEXT(""), OEMTEXT(""), OEMTEXT(""), OEMTEXT("")},
                                                 {0, 0, 0x3e, 19200, "", "", "", ""},            // ver0.34                                                  {0, 0, 0x3e, 19200,
                                                 {0, 0, 0x3e, 19200, "", "", "", ""},            // ver0.34                                                   OEMTEXT(""), OEMTEXT(""), OEMTEXT(""), OEMTEXT("")},
                                                   {0, 0, 0x3e, 19200,
                                                    OEMTEXT(""), OEMTEXT(""), OEMTEXT(""), OEMTEXT("")},
                                                   {0, 0, 0x3e, 19200,
                                                    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, 1, 0, 9801, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
   
                 char            fddfolder[MAX_PATH];                  OEMCHAR         fddfolder[MAX_PATH];
                 char            hddfolder[MAX_PATH];                  OEMCHAR         hddfolder[MAX_PATH];
                 char            bmpfilefolder[MAX_PATH];                  OEMCHAR         bmpfilefolder[MAX_PATH];
                 char            modulefile[MAX_PATH];                  OEMCHAR         modulefile[MAX_PATH];
   
 static  UINT            framecnt = 0;  static  UINT            framecnt = 0;
 static  UINT            waitcnt = 0;  static  UINT            waitcnt = 0;
 static  UINT            framemax = 1;  static  UINT            framemax = 1;
 static  BYTE            np2stopemulate = 0;  static  UINT8           np2stopemulate = 0;
 static  int                     np2opening = 1;  static  int                     np2opening = 1;
 static  int                     np2quitmsg = 0;  static  int                     np2quitmsg = 0;
 static  HMENU           hStat = NULL;  static  HMENU           hStat = NULL;
 static  BYTE            scrnmode;  static  UINT8           scrnmode;
 static  WINLOCEX        smwlex;  static  WINLOCEX        smwlex;
   static  HMODULE         resmod;
   
   static const OEMCHAR np2help[] = OEMTEXT("np2.chm");
   static const OEMCHAR np2flagext[] = OEMTEXT("S%02d");
   static const OEMCHAR np2resext[] = OEMTEXT(".%u");
   
   
   // ----
   
   static HINSTANCE loadextinst(HINSTANCE hInstance) {
   
 static const char np2help[] = "np2.chm";          OEMCHAR path[MAX_PATH];
 static const char np2flagext[] = "S%02d";          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) {
   
         winui_en = TRUE;          winui_en = TRUE;
Line 132  WINLOCEX np2_winlocexallwin(HWND base) { Line 174  WINLOCEX np2_winlocexallwin(HWND base) {
         return(winlocex_create(base, list, cnt));          return(winlocex_create(base, list, cnt));
 }  }
   
 static void changescreen(BYTE newmode) {  static void changescreen(UINT8 newmode) {
   
         BYTE            change;          UINT8           change;
         BYTE            renewal;          UINT8           renewal;
         WINLOCEX        wlex;          WINLOCEX        wlex;
   
         change = scrnmode ^ newmode;          change = scrnmode ^ newmode;
Line 244  void np2active_renewal(void) {           Line 286  void np2active_renewal(void) {          
 // ---- resume and statsave  // ---- resume and statsave
   
 #if defined(SUPPORT_RESUME) || defined(SUPPORT_STATSAVE)  #if defined(SUPPORT_RESUME) || defined(SUPPORT_STATSAVE)
 static void getstatfilename(char *path, const char *ext, int size) {  static void getstatfilename(OEMCHAR *path, const OEMCHAR *ext, int size) {
   
         file_cpyname(path, modulefile, size);          file_cpyname(path, modulefile, size);
         file_cutext(path);          file_cutext(path);
Line 252  static void getstatfilename(char *path,  Line 294  static void getstatfilename(char *path, 
         file_catname(path, ext, size);          file_catname(path, ext, size);
 }  }
   
 static int flagsave(const char *ext) {  static int flagsave(const OEMCHAR *ext) {
   
         int             ret;          int             ret;
         char    path[MAX_PATH];          OEMCHAR path[MAX_PATH];
   
         getstatfilename(path, ext, sizeof(path));          getstatfilename(path, ext, NELEMENTS(path));
         soundmng_stop();          soundmng_stop();
         ret = statsave_save(path);          ret = statsave_save(path);
         if (ret) {          if (ret) {
Line 267  static int flagsave(const char *ext) { Line 309  static int flagsave(const char *ext) {
         return(ret);          return(ret);
 }  }
   
 static void flagdelete(const char *ext) {  static void flagdelete(const OEMCHAR *ext) {
   
         char    path[MAX_PATH];          OEMCHAR path[MAX_PATH];
   
         getstatfilename(path, ext, sizeof(path));          getstatfilename(path, ext, NELEMENTS(path));
         file_delete(path);          file_delete(path);
 }  }
   
 static int flagload(const char *ext, const char *title, BOOL force) {  static int flagload(const OEMCHAR *ext, const OEMCHAR *title, BOOL force) {
   
         int             ret;          int             ret;
         int             id;          int             id;
         char    path[MAX_PATH];          OEMCHAR path[MAX_PATH];
         char    buf[1024];          OEMCHAR buf[1024];
   
         getstatfilename(path, ext, sizeof(path));          getstatfilename(path, ext, NELEMENTS(path));
         winuienter();          winuienter();
         id = IDYES;          id = IDYES;
         ret = statsave_check(path, buf, sizeof(buf));          ret = statsave_check(path, buf, NELEMENTS(buf));
         if (ret & (~STATFLAG_DISKCHG)) {          if (ret & (~STATFLAG_DISKCHG)) {
                 MessageBox(hWndMain, "Couldn't restart", title, MB_OK | MB_ICONSTOP);                  MessageBox(hWndMain, _T("Couldn't restart"), title,
                                                                                   MB_OK | MB_ICONSTOP);
                 id = IDNO;                  id = IDNO;
         }          }
         else if ((!force) && (ret & STATFLAG_DISKCHG)) {          else if ((!force) && (ret & STATFLAG_DISKCHG)) {
                 char buf2[1024 + 256];                  OEMCHAR buf2[1024 + 256];
                 wsprintf(buf2, "Conflict!\n\n%s\nContinue?", buf);                  OEMSPRINTF(buf2, OEMTEXT("Conflict!\n\n%s\nContinue?"), buf);
                 id = MessageBox(hWndMain, buf2, title,                  id = MessageBox(hWndMain, buf2, title,
                                                                                 MB_YESNOCANCEL | MB_ICONQUESTION);                                                                                  MB_YESNOCANCEL | MB_ICONQUESTION);
         }          }
Line 332  static void np2popup(HWND hWnd, LPARAM l Line 375  static void np2popup(HWND hWnd, LPARAM l
   
 static void np2cmd(HWND hWnd, UINT16 cmd) {  static void np2cmd(HWND hWnd, UINT16 cmd) {
   
         UINT    update;          HINSTANCE       hInst;
         BOOL    b;          UINT            update;
           BOOL            b;
   
           hInst = GetWindowInst(hWnd);
         update = 0;          update = 0;
         switch(cmd) {          switch(cmd) {
                 case IDM_RESET:                  case IDM_RESET:
Line 344  static void np2cmd(HWND hWnd, UINT16 cmd Line 389  static void np2cmd(HWND hWnd, UINT16 cmd
                         }                          }
                         else if (sstpconfirm_reset()) {                          else if (sstpconfirm_reset()) {
                                 winuienter();                                  winuienter();
                                 if (MessageBox(hWnd, "Sure?", "Reset",                                  if (MessageBox(hWnd, OEMTEXT("Sure?"), OEMTEXT("Reset"),
                                                                         MB_ICONQUESTION | MB_YESNO) == IDYES) {                                                                          MB_ICONQUESTION | MB_YESNO) == IDYES) {
                                         b = TRUE;                                          b = TRUE;
                                 }                                  }
Line 364  static void np2cmd(HWND hWnd, UINT16 cmd Line 409  static void np2cmd(HWND hWnd, UINT16 cmd
                         DialogBox(hInst, MAKEINTRESOURCE(IDD_CONFIG),                          DialogBox(hInst, MAKEINTRESOURCE(IDD_CONFIG),
                                                                         hWnd, (DLGPROC)CfgDialogProc);                                                                          hWnd, (DLGPROC)CfgDialogProc);
                         if (!scrnmng_isfullscreen()) {                          if (!scrnmng_isfullscreen()) {
                                 BYTE thick;                                  UINT8 thick;
                                 thick = (GetWindowLong(hWnd, GWL_STYLE) & WS_THICKFRAME)?1:0;                                  thick = (GetWindowLong(hWnd, GWL_STYLE) & WS_THICKFRAME)?1:0;
                                 if (thick != np2oscfg.thickframe) {                                  if (thick != np2oscfg.thickframe) {
                                         WINLOCEX wlex;                                          WINLOCEX wlex;
Line 438  static void np2cmd(HWND hWnd, UINT16 cmd Line 483  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 498  static void np2cmd(HWND hWnd, UINT16 cmd Line 556  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 871  static void np2cmd(HWND hWnd, UINT16 cmd Line 930  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 894  static void np2cmd(HWND hWnd, UINT16 cmd Line 953  static void np2cmd(HWND hWnd, UINT16 cmd
 #if defined(SUPPORT_STATSAVE)  #if defined(SUPPORT_STATSAVE)
                         if ((cmd >= IDM_FLAGSAVE) &&                          if ((cmd >= IDM_FLAGSAVE) &&
                                 (cmd < (IDM_FLAGSAVE + SUPPORT_STATSAVE))) {                                  (cmd < (IDM_FLAGSAVE + SUPPORT_STATSAVE))) {
                                 char ext[4];                                  OEMCHAR ext[4];
                                 SPRINTF(ext, np2flagext, cmd - IDM_FLAGSAVE);                                  OEMSPRINTF(ext, np2flagext, cmd - IDM_FLAGSAVE);
                                 flagsave(ext);                                  flagsave(ext);
                         }                          }
                         else if ((cmd >= IDM_FLAGLOAD) &&                          else if ((cmd >= IDM_FLAGLOAD) &&
                                 (cmd < (IDM_FLAGLOAD + SUPPORT_STATSAVE))) {                                  (cmd < (IDM_FLAGLOAD + SUPPORT_STATSAVE))) {
                                 char ext[4];                                  OEMCHAR ext[4];
                                 SPRINTF(ext, np2flagext, cmd - IDM_FLAGLOAD);                                  OEMSPRINTF(ext, np2flagext, cmd - IDM_FLAGLOAD);
                                 flagload(ext, "Status Load", TRUE);                                  flagload(ext, OEMTEXT("Status Load"), TRUE);
                         }                          }
 #endif  #endif
                         break;                          break;
Line 1072  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 1131  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                                 BITMAP          bmp;                                  BITMAP          bmp;
                                 HDC                     hmdc;                                  HDC                     hmdc;
                                 HBRUSH          hbrush;                                  HBRUSH          hbrush;
                                 hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE);                                  hinst = GetWindowInst(hWnd);
                                 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, _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 1209  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 1268  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 1238  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 1300  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 1279  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 1344  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                         }                          }
                         else if (sstpconfirm_exit()) {                          else if (sstpconfirm_exit()) {
                                 winuienter();                                  winuienter();
                                 if (MessageBox(hWnd, "Sure?", "Exit",                                  if (MessageBox(hWnd, _T("Sure?"), _T("Exit"),
                                                                         MB_ICONQUESTION | MB_YESNO) == IDYES) {                                                                          MB_ICONQUESTION | MB_YESNO) == IDYES) {
                                         b = TRUE;                                          b = TRUE;
                                 }                                  }
Line 1360  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 1425  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();
         kdispwin_draw((BYTE)cnt);  #endif
           kdispwin_draw((UINT8)cnt);
         skbdwin_process();          skbdwin_process();
         mdbgwin_process();          mdbgwin_process();
         toolwin_draw((BYTE)cnt);          toolwin_draw((UINT8)cnt);
         viewer_allreload(FALSE);          viewer_allreload(FALSE);
         if (np2oscfg.DISPCLK & 3) {          if (np2oscfg.DISPCLK & 3) {
                 if (sysmng_workclockrenewal()) {                  if (sysmng_workclockrenewal()) {
Line 1385  static void processwait(UINT cnt) { Line 1452  static void processwait(UINT cnt) {
         soundmng_sync();          soundmng_sync();
 }  }
   
   
 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst,  int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst,
                                                                                 LPSTR lpszCmdLine, int nCmdShow) {                                                                                  LPSTR lpszCmdLine, int nCmdShow) {
         WNDCLASS        wc;          WNDCLASS        wc;
Line 1400  int WINAPI WinMain(HINSTANCE hInstance,  Line 1466  int WINAPI WinMain(HINSTANCE hInstance, 
   
         _MEM_INIT();          _MEM_INIT();
   
         GetModuleFileName(NULL, modulefile, sizeof(modulefile));          GetModuleFileName(NULL, modulefile, NELEMENTS(modulefile));
         dosio_init();          dosio_init();
         file_setcd(modulefile);          file_setcd(modulefile);
         np2arg_analize(lpszCmdLine);          np2arg_analize();
         initload();          initload();
         toolwin_readini();          toolwin_readini();
         kdispwin_readini();          kdispwin_readini();
Line 1412  int WINAPI WinMain(HINSTANCE hInstance,  Line 1478  int WINAPI WinMain(HINSTANCE hInstance, 
   
         rand_setseed((unsigned)time(NULL));          rand_setseed((unsigned)time(NULL));
   
         CopyMemory(szClassName, np2oscfg.winid, 3);          szClassName[0] = (TCHAR)np2oscfg.winid[0];
           szClassName[1] = (TCHAR)np2oscfg.winid[1];
           szClassName[2] = (TCHAR)np2oscfg.winid[2];
   
         if ((hWnd = FindWindow(szClassName, NULL)) != NULL) {          if ((hWnd = FindWindow(szClassName, NULL)) != NULL) {
                 sstpmsg_running();                  sstpmsg_running();
Line 1422  int WINAPI WinMain(HINSTANCE hInstance,  Line 1490  int WINAPI WinMain(HINSTANCE hInstance, 
                 return(FALSE);                  return(FALSE);
         }          }
   
         hInst = hInstance;          hInst = loadextinst(hInstance);
         hPrev = hPreInst;          hPrev = hPreInst;
   #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 1446  int WINAPI WinMain(HINSTANCE hInstance,  Line 1516  int WINAPI WinMain(HINSTANCE hInstance, 
         winkbd_setf12(np2oscfg.F12COPY);          winkbd_setf12(np2oscfg.F12COPY);
         keystat_initialize();          keystat_initialize();
   
         np2class_initialize(hInstance);          np2class_initialize(hInst);
         if (!hPreInst) {          if (!hPreInst) {
                 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 = NP2GWL_SIZE;
                 wc.hInstance = hInstance;                  wc.hInstance = hInst;
                 wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));                  wc.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1));
                 wc.hCursor = LoadCursor(NULL, IDC_ARROW);                  wc.hCursor = LoadCursor(NULL, IDC_ARROW);
                 wc.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH);                  wc.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH);
                 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);          toolwin_initapp(hInst);
         kdispwin_initialize(hPreInst);          kdispwin_initialize(hPreInst);
         skbdwin_initialize(hPreInst);          skbdwin_initialize(hPreInst);
         mdbgwin_initialize(hPreInst);          mdbgwin_initialize(hPreInst);
Line 1476  int WINAPI WinMain(HINSTANCE hInstance,  Line 1549  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, hInst, NULL);
         hWndMain = hWnd;          hWndMain = hWnd;
         scrnmng_initialize();          scrnmng_initialize();
   
Line 1536  int WINAPI WinMain(HINSTANCE hInstance,  Line 1609  int WINAPI WinMain(HINSTANCE hInstance, 
                 scrnmode ^= SCRNMODE_FULLSCREEN;                  scrnmode ^= SCRNMODE_FULLSCREEN;
                 if (scrnmng_create(scrnmode) != SUCCESS) {                  if (scrnmng_create(scrnmode) != SUCCESS) {
                         if (sstpmsg_dxerror()) {                          if (sstpmsg_dxerror()) {
                                 MessageBox(hWnd, "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);
                 }                  }
         }          }
   
         if (soundmng_initialize() == SUCCESS) {          if (soundmng_initialize() == SUCCESS) {
                 soundmng_pcmload(SOUND_PCMSEEK, "SEEKWAV", EXTROMIO_RES);                  soundmng_pcmload(SOUND_PCMSEEK, OEMTEXT("SEEKWAV"), EXTROMIO_RES);
                 soundmng_pcmload(SOUND_PCMSEEK1, "SEEK1WAV", EXTROMIO_RES);                  soundmng_pcmload(SOUND_PCMSEEK1, OEMTEXT("SEEK1WAV"), EXTROMIO_RES);
                 soundmng_pcmvolume(SOUND_PCMSEEK, np2cfg.MOTORVOL);                  soundmng_pcmvolume(SOUND_PCMSEEK, np2cfg.MOTORVOL);
                 soundmng_pcmvolume(SOUND_PCMSEEK1, np2cfg.MOTORVOL);                  soundmng_pcmvolume(SOUND_PCMSEEK1, np2cfg.MOTORVOL);
         }          }
Line 1584  int WINAPI WinMain(HINSTANCE hInstance,  Line 1660  int WINAPI WinMain(HINSTANCE hInstance, 
   
                 id = flagload(str_sav, str_resume, FALSE);                  id = flagload(str_sav, str_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;
                           }
                 }                  }
                 else if (id == IDCANCEL) {                  else if (id == IDCANCEL) {
                         DestroyWindow(hWnd);                          DestroyWindow(hWnd);
Line 1594  int WINAPI WinMain(HINSTANCE hInstance,  Line 1672  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 1605  int WINAPI WinMain(HINSTANCE hInstance,  Line 1684  int WINAPI WinMain(HINSTANCE hInstance, 
 //      リセットしてから… コマンドラインのディスク挿入。  //      リセットしてから… コマンドラインのディスク挿入。
         for (i=0; i<4; i++) {          for (i=0; i<4; i++) {
                 if (np2arg.disk[i]) {                  if (np2arg.disk[i]) {
                         milstr_ncpy(diskdrv_fname[i], np2arg.disk[i], MAX_PATH);                          diskdrv_readyfdd((REG8)i, np2arg.disk[i], 0);
                         diskdrv_delay[i] = 1;  
                 }                  }
         }          }
   
Line 1637  int WINAPI WinMain(HINSTANCE hInstance,  Line 1715  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 1656  int WINAPI WinMain(HINSTANCE hInstance,  Line 1736  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 1669  int WINAPI WinMain(HINSTANCE hInstance,  Line 1751  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 1745  int WINAPI WinMain(HINSTANCE hInstance,  Line 1829  int WINAPI WinMain(HINSTANCE hInstance, 
         }          }
         skbdwin_deinitialize();          skbdwin_deinitialize();
   
           unloadextinst();
   
         TRACETERM();          TRACETERM();
         _MEM_USED("report.txt");          _MEM_USED("report.txt");
         dosio_term();          dosio_term();

Removed from v.1.55  
changed lines
  Added in v.1.69


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