Diff for /np2/win9xc/np2.cpp between versions 1.28 and 1.34

version 1.28, 2004/03/31 11:59:18 version 1.34, 2011/02/15 00:51:52
Line 42 Line 42
 #endif  #endif
   
 #if defined(SUPPORT_PC9821)  #if defined(SUPPORT_PC9821)
                 const char szAppCaption[] = "Neko Project-21";                  const TCHAR szAppCaption[] = _T("Neko Project-21");
 #elif defined(CPUCORE_IA32)  #elif defined(CPUCORE_IA32)
                 const char szAppCaption[] = "Neko Project II (IA-32)";                  const TCHAR szAppCaption[] = _T("Neko Project II (IA-32)");
 #else  #else
                 const char szAppCaption[] = "Neko Project II (C Version)";                  const TCHAR szAppCaption[] = _T("Neko Project II (C Version)");
 #endif  #endif
 static  const char      szClassName[] = "NP2-MainWindow";  static  const TCHAR     szClassName[] = _T("NP2-MainWindow");
                 HWND            hWndMain;                  HWND            hWndMain;
                 HINSTANCE       hInst;                  HINSTANCE       hInst;
                 HINSTANCE       hPrev;                  HINSTANCE       hPrev;
Line 59  static const char szClassName[] = "NP2-M Line 59  static const char szClassName[] = "NP2-M
                                                 0, 0, 0, {1, 2, 2, 1},                                                  0, 0, 0, {1, 2, 2, 1},
                                                 0, 0, 0};                                                  0, 0, 0};
   
                 char            modulefile[MAX_PATH];                  TCHAR           modulefile[MAX_PATH];
                 char            fddfolder[MAX_PATH];                  TCHAR           fddfolder[MAX_PATH];
                 char            hddfolder[MAX_PATH];                  TCHAR           hddfolder[MAX_PATH];
                 char            bmpfilefolder[MAX_PATH];                  TCHAR           bmpfilefolder[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  int                     np2opening = 1;  static  int                     np2opening = 1;
 static  int                     np2quitmsg = 0;  static  int                     np2quitmsg = 0;
 static  BYTE    scrnmode;  static  UINT8   scrnmode;
   
   
 static const char np2help[] = "np2.chm";  static const TCHAR np2help[] = _T("np2.chm");
 static const char np2flagext[] = "S%02d";  static const TCHAR np2flagext[] = _T("S%02d");
   
   
 static void winuienter(void) {  static void winuienter(void) {
Line 88  static void winuileave(void) { Line 88  static void winuileave(void) {
         soundmng_enable(SNDPROC_MAIN);          soundmng_enable(SNDPROC_MAIN);
 }  }
   
 static void changescreen(BYTE newmode) {  static void changescreen(UINT8 newmode) {
   
         BYTE    change;          UINT8   change;
         BYTE    renewal;          UINT8   renewal;
   
         change = scrnmode ^ newmode;          change = scrnmode ^ newmode;
         renewal = (change & SCRNMODE_FULLSCREEN);          renewal = (change & SCRNMODE_FULLSCREEN);
Line 129  static void changescreen(BYTE newmode) { Line 129  static void changescreen(BYTE newmode) {
 #define SUPPORT_RESUME  #define SUPPORT_RESUME
   
 #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(TCHAR *path, const TCHAR *ext, int size) {
   
         file_cpyname(path, modulefile, size);          file_cpyname(path, modulefile, size);
         file_cutext(path);          file_cutext(path);
Line 137  static void getstatfilename(char *path,  Line 137  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 TCHAR *ext) {
   
         int             ret;          int             ret;
         char    path[MAX_PATH];          TCHAR   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 152  static int flagsave(const char *ext) { Line 152  static int flagsave(const char *ext) {
         return(ret);          return(ret);
 }  }
   
 static void flagdelete(const char *ext) {  static void flagdelete(const TCHAR *ext) {
   
         char    path[MAX_PATH];          TCHAR   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 TCHAR *ext, const TCHAR *title, BOOL force) {
   
         int             ret;          int             ret;
         int             id;          int             id;
         char    path[MAX_PATH];          TCHAR   path[MAX_PATH];
         char    buf[1024];          TCHAR   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];                  TCHAR buf2[1024 + 256];
                 wsprintf(buf2, "Conflict!\n\n%s\nContinue?", buf);                  wsprintf(buf2, _T("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 552  static void np2cmd(HWND hWnd, UINT16 cmd Line 553  static void np2cmd(HWND hWnd, UINT16 cmd
                         dialog_writebmp(hWnd);                          dialog_writebmp(hWnd);
                         winuileave();                          winuileave();
                         break;                          break;
   #if defined(SUPPPORT_S98)
                 case IDM_S98LOGGING:                  case IDM_S98LOGGING:
                         winuienter();                          winuienter();
                         dialog_s98(hWnd);                          dialog_s98(hWnd);
                         winuileave();                          winuileave();
                         break;                          break;
   #endif
   #if defined(SUPPORT_WAVEREC)
                   case IDM_WAVEREC:
                           winuienter();
                           dialog_waverec(hWnd);
                           winuileave();
                           break;
   #endif
                 case IDM_CALENDAR:                  case IDM_CALENDAR:
                         winuienter();                          winuienter();
                         DialogBox(hInst, MAKEINTRESOURCE(IDD_CALENDAR),                          DialogBox(hInst, MAKEINTRESOURCE(IDD_CALENDAR),
Line 645  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 653  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);  
   #if defined(_WIN64)
                                   hinst = reinterpret_cast<HINSTANCE>(::GetWindowLongPtr(hWnd, GWLP_HINSTANCE));
   #else
                                   hinst = reinterpret_cast<HINSTANCE>(::GetWindowLong(hWnd, GWL_HINSTANCE));
   #endif
                                 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 819  static void framereset(void) { Line 832  static void framereset(void) {
         framecnt = 0;          framecnt = 0;
         sysmng_updatecaption();          sysmng_updatecaption();
         memdbg_process();          memdbg_process();
           skbdwin_process();
 }  }
   
 static void processwait(UINT cnt) {  static void processwait(UINT cnt) {
Line 846  int WINAPI WinMain(HINSTANCE hInstance,  Line 860  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();
         memdbg_readini();          memdbg_readini();
         skbdwin_readini();          skbdwin_readini();
Line 955  int WINAPI WinMain(HINSTANCE hInstance,  Line 969  int WINAPI WinMain(HINSTANCE hInstance, 
         if (scrnmng_create(scrnmode) != SUCCESS) {          if (scrnmng_create(scrnmode) != SUCCESS) {
                 scrnmode ^= SCRNMODE_FULLSCREEN;                  scrnmode ^= SCRNMODE_FULLSCREEN;
                 if (scrnmng_create(scrnmode) != SUCCESS) {                  if (scrnmng_create(scrnmode) != SUCCESS) {
                         MessageBox(hWnd, "Couldn't create DirectDraw Object",                          MessageBox(hWnd, _T("Couldn't create DirectDraw Object"),
                                                                                 szAppCaption, MB_OK | MB_ICONSTOP);                                                                                  szAppCaption, MB_OK | MB_ICONSTOP);
                         return(FALSE);                          return(FALSE);
                 }                  }
Line 1009  int WINAPI WinMain(HINSTANCE hInstance,  Line 1023  int WINAPI WinMain(HINSTANCE hInstance, 
 //      リセットしてから… コマンドラインのディスク挿入。                               // ver0.29  //      リセットしてから… コマンドラインのディスク挿入。                               // ver0.29
         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 1125  int WINAPI WinMain(HINSTANCE hInstance,  Line 1138  int WINAPI WinMain(HINSTANCE hInstance, 
         _MEM_USED("report.txt");          _MEM_USED("report.txt");
         dosio_term();          dosio_term();
   
         return(msg.wParam);          return static_cast<int>(msg.wParam);
 }  }
   

Removed from v.1.28  
changed lines
  Added in v.1.34


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