Diff for /np2/win9x/np2.cpp between versions 1.1.1.1 and 1.13

version 1.1.1.1, 2003/10/16 17:58:56 version 1.13, 2003/10/28 13:03:48
Line 1 Line 1
 #include        "compiler.h"  #include        "compiler.h"
 #include        <time.h>  #include        <time.h>
   #ifndef __GNUC__
 #include        <winnls32.h>  #include        <winnls32.h>
   #endif
 #include        "resource.h"  #include        "resource.h"
 #include        "strres.h"  #include        "strres.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 16 Line 20
 #include        "winkbd.h"  #include        "winkbd.h"
 #include        "ini.h"  #include        "ini.h"
 #include        "menu.h"  #include        "menu.h"
 #include        "dialog.h"  
 #include        "winloc.h"  #include        "winloc.h"
 #include        "sstp.h"  #include        "sstp.h"
 #include        "sstpmsg.h"  #include        "sstpmsg.h"
 #include        "dclock.h"  #include        "dclock.h"
   #ifdef USE_ROMEO
   #include        "juliet.h"
   #endif
   #include        "dialog.h"
 #include        "memory.h"  #include        "memory.h"
 #include        "pccore.h"  #include        "pccore.h"
 #include        "iocore.h"  #include        "iocore.h"
 #include        "pc9861k.h"  #include        "pc9861k.h"
 #include        "mpu98ii.h"  #include        "mpu98ii.h"
 #include        "timing.h"  
 #include        "debugsub.h"  
 #include        "bios.h"  #include        "bios.h"
 #include        "scrndraw.h"  #include        "scrndraw.h"
 #include        "sound.h"  #include        "sound.h"
Line 35 Line 40
 #include        "s98.h"  #include        "s98.h"
 #include        "diskdrv.h"  #include        "diskdrv.h"
 #include        "fddfile.h"  #include        "fddfile.h"
   #include        "timing.h"
 #ifdef USE_ROMEO  #include        "statsave.h"
 #include        "juliet.h"  #include        "debugsub.h"
 #endif  
   
 #include        "keydisp.h"  #include        "keydisp.h"
 #include        "viewer.h"  #include        "viewer.h"
 #include        "statsave.h"  
   
   
 #ifdef BETA_RELEASE  #ifdef BETA_RELEASE
Line 51 Line 53
   
 #define STATSAVEMAX             10  #define STATSAVEMAX             10
   
 static  char            np2help[] = "np2.hlp";  
 static  char            np2resume[] = "sav";  
   
 static  char            szClassName[] = "NP2-MainWindow";  static  char            szClassName[] = "NP2-MainWindow";
                 HWND            hWndMain;                  HWND            hWndMain;
                 HINSTANCE       hInst;                  HINSTANCE       hInst;
                 HINSTANCE       hPrev;                  HINSTANCE       hPrev;
                   int                     mmxflag;
   
                 NP2OSCFG        np2oscfg = {                  NP2OSCFG        np2oscfg = {
                                                 "Neko Project II", "NP2",                                                  "Neko Project II", "NP2",
Line 69  static char  szClassName[] = "NP2-MainWi Line 69  static char  szClassName[] = "NP2-MainWi
                                                 {0, 0, 0x3e, 19200, "", "", "", ""},            // ver0.34                                                  {0, 0, 0x3e, 19200, "", "", "", ""},            // ver0.34
                                                 {0, 0, 0x3e, 19200, "", "", "", ""},            // ver0.34                                                  {0, 0, 0x3e, 19200, "", "", "", ""},            // ver0.34
                                                 0xffffff, 0xffbf6a, 0, 0,                                                  0xffffff, 0xffbf6a, 0, 0,
                                                 0, 1, 0, 9801, 0, 0, 0, 0};                                     // ver0.34                                                  0, 1, 0, 9801, 0, 0, 0, 0, 0};                          // ver0.38
   
                 char    fddfolder[MAX_PATH];                  char    fddfolder[MAX_PATH];
                 char    hddfolder[MAX_PATH];                  char    hddfolder[MAX_PATH];
Line 86  static int  np2opening = 1; Line 86  static int  np2opening = 1;
 static  int             np2quitmsg = 0;  static  int             np2quitmsg = 0;
                 HMENU   hStat = NULL;                  HMENU   hStat = NULL;
   
   static const char np2help[] = "np2.hlp";
   static const char np2resume[] = "sav";
   
   
 typedef struct {  typedef struct {
 const char      *str;  const char      *str;
Line 217  static int flagsave(const char *ext) { Line 220  static int flagsave(const char *ext) {
         return(ret);          return(ret);
 }  }
   
   static void flagdelete(const char *ext) {
   
           char    path[MAX_PATH];
   
           getstatfilename(path, ext, sizeof(path));
           file_delete(path);
   }
   
 static int flagload(const char *ext, const char *title, BOOL force) {  static int flagload(const char *ext, const char *title, BOOL force) {
   
         int             ret;          int             ret;
Line 275  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 286  LRESULT CALLBACK WndProc(HWND hWnd, UINT
         switch (msg) {          switch (msg) {
                 case WM_CREATE:                  case WM_CREATE:
                         sstp_construct(hWnd);                          sstp_construct(hWnd);
   #ifndef __GNUC__
                         WINNLSEnableIME(hWnd, FALSE);                          WINNLSEnableIME(hWnd, FALSE);
   #endif
 //                      DragAcceptFiles(hWnd, TRUE);  //                      DragAcceptFiles(hWnd, TRUE);
                         break;                          break;
   
Line 323  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 336  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                                 case IDM_SCRNMUL10:                                  case IDM_SCRNMUL10:
                                 case IDM_SCRNMUL12:                                  case IDM_SCRNMUL12:
                                 case IDM_SCRNMUL16:                                  case IDM_SCRNMUL16:
 #if 0                                          if ((!scrnmng_isfullscreen()) &&
                                         if ((SCREENMODE & SCMD_WINDOWED) &&  
                                                 !(GetWindowLong(hWndMain, GWL_STYLE) & WS_MINIMIZE)) {                                                  !(GetWindowLong(hWndMain, GWL_STYLE) & WS_MINIMIZE)) {
                                                 xmenu_setscrnmul(wParam - IDM_SCRNMUL);                                                  xmenu_setscrnmul(wParam - IDM_SCRNMUL);
                                                 ddraws_setmul(wParam - IDM_SCRNMUL);                                                  scrnmng_setmultiple(wParam - IDM_SCRNMUL);
                                         }                                          }
 #endif  
                                         break;                                          break;
   
                                 default:                                  default:
Line 810  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 821  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                         if (LOWORD(wParam) != WA_INACTIVE) {                          if (LOWORD(wParam) != WA_INACTIVE) {
                                 np2break &= ~NP2BREAK_MAIN;                                  np2break &= ~NP2BREAK_MAIN;
                                 scrnmng_update();                                  scrnmng_update();
                                   keystat_allrelease();
                                 mouse_running(MOUSE_CONT_M);                                  mouse_running(MOUSE_CONT_M);
                         }                          }
                         else {                          else {
Line 822  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 834  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;
                             HDC                 hmdc;                                  RECT            rect;
                             HBITMAP             hbmp;                                  int                     width;
                             BITMAP              bmp;                                  int                     height;
                             HINSTANCE   hinst;                                  HBITMAP         hbmp;
                                 int                     sx = 640 + np2oscfg.paddingx;                                  BITMAP          bmp;
                                 int                     sy = 400 + np2oscfg.paddingy;                                  HDC                     hmdc;
                                   HBRUSH          hbrush;
                             hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE);                                  hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE);
 #if 1                                  GetClientRect(hWnd, &rect);
                         hbmp = LoadBitmap(hinst, "NP2BMP");                                  width = rect.right - rect.left;
                             GetObject(hbmp, sizeof(BITMAP), &bmp);                                  height = rect.bottom - rect.top;
                             hmdc = CreateCompatibleDC(hdc);                                  hbmp = LoadBitmap(hinst, "NP2BMP");
                             SelectObject(hmdc, hbmp);                                  GetObject(hbmp, sizeof(BITMAP), &bmp);
                             BitBlt(hdc, (sx - 252) / 2, (sy - 28) / 2,                                  hbrush = (HBRUSH)SelectObject(hdc,
                                                         bmp.bmWidth, bmp.bmHeight, hmdc, 0, 0, SRCCOPY);                                                                                                  GetStockObject(BLACK_BRUSH));
                             DeleteDC(hmdc);                                  PatBlt(hdc, 0, 0, width, height, PATCOPY);
                         DeleteObject(hbmp);                                  SelectObject(hdc, hbrush);
 #else                                  hmdc = CreateCompatibleDC(hdc);
                         hbmp = LoadBitmap(hinst, "NP2EXT");                                  SelectObject(hmdc, hbmp);
                             GetObject(hbmp, sizeof(BITMAP), &bmp);                                  BitBlt(hdc, (width - bmp.bmWidth) / 2,
                             hmdc = CreateCompatibleDC(hdc);                                                  (height - bmp.bmHeight) / 2,
                             SelectObject(hmdc, hbmp);  
                             BitBlt(hdc, (sx - 160) / 2, (sy - 140) / 2,  
                                                         bmp.bmWidth, bmp.bmHeight, hmdc, 0, 0, SRCCOPY);                                                          bmp.bmWidth, bmp.bmHeight, hmdc, 0, 0, SRCCOPY);
                             DeleteDC(hmdc);                                  DeleteDC(hmdc);
                         DeleteObject(hbmp);                                  DeleteObject(hbmp);
 #endif  
                         }                          }
                         else {                          else {
 //                              scrnmng_update();  //                              scrnmng_update();
Line 903  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 912  LRESULT CALLBACK WndProc(HWND hWnd, UINT
   
                 case WM_KEYDOWN:                  case WM_KEYDOWN:
                         if (wParam == VK_F11) {                          if (wParam == VK_F11) {
                                   scrnmng_enablemenubar();
                                 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 914  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 924  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                                 winkeydown106(wParam, lParam);                                  winkeydown106(wParam, lParam);
                         }                          }
                         break;                          break;
   
                 case WM_KEYUP:                  case WM_KEYUP:
                         if (wParam == VK_F11) {                          if (wParam == VK_F11) {
                                 return(DefWindowProc(hWnd, WM_SYSKEYUP, VK_F10, lParam));                                  return(DefWindowProc(hWnd, WM_SYSKEYUP, VK_F10, lParam));
Line 941  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 952  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                         winkeyup106(wParam, lParam);                          winkeyup106(wParam, lParam);
                         break;                          break;
   
                   case WM_MOUSEMOVE:
                           if (scrnmng_isfullscreen()) {
                                   POINT p;
                                   if (GetCursorPos(&p)) {
                                           scrnmng_fullscrnmenu(p.y);
                                   }
                           }
                           break;
   
                 case WM_LBUTTONDOWN:                  case WM_LBUTTONDOWN:
                         if (!mouse_btn(MOUSE_LEFTDOWN)) {                          if (!mouse_btn(MOUSE_LEFTDOWN)) {
                                 if (scrnmng_isfullscreen()) {                                  if (scrnmng_isfullscreen()) {
                                         POINT   p;                                          POINT p;
                                         if ((GetCursorPos(&p)) && (p.y >= 466)) {                                          if ((GetCursorPos(&p)) && (p.y >= 466)) {
                                                 np2oscfg.clk_x++;                                                  np2oscfg.clk_x++;
                                                 sysmng_update(SYS_UPDATEOSCFG);                                                  sysmng_update(SYS_UPDATEOSCFG);
Line 954  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 974  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                                 return(DefWindowProc(hWnd, msg, wParam, lParam));                                  return(DefWindowProc(hWnd, msg, wParam, lParam));
                         }                          }
                         break;                          break;
   
                 case WM_LBUTTONUP:                  case WM_LBUTTONUP:
                         if (!mouse_btn(MOUSE_LEFTUP)) {                          if (!mouse_btn(MOUSE_LEFTUP)) {
                                 return(DefWindowProc(hWnd, msg, wParam, lParam));                                  return(DefWindowProc(hWnd, msg, wParam, lParam));
Line 1071  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 1092  LRESULT CALLBACK WndProc(HWND hWnd, UINT
 }  }
   
   
 static void processwait(WORD cnt) {  static void processwait(UINT cnt) {
   
         if (timing_getcount() >= cnt) {          if (timing_getcount() >= cnt) {
                 timing_setcount(0);                  timing_setcount(0);
Line 1079  static void processwait(WORD cnt) { Line 1100  static void processwait(WORD cnt) {
                 scrnmng_dispclock();                  scrnmng_dispclock();
                 keydisp_draw(np2oscfg.DRAW_SKIP);                  keydisp_draw(np2oscfg.DRAW_SKIP);
                 viewer_allreload(FALSE);                  viewer_allreload(FALSE);
                 if (np2oscfg.DISPCLK & 2) {                  if (np2oscfg.DISPCLK & 3) {
                         if (sysmng_workclockrenewal()) {                          if (sysmng_workclockrenewal()) {
                                 sysmng_updatecaption(2);                                  sysmng_updatecaption(3);
                         }                          }
                 }                  }
         }          }
Line 1097  int WINAPI WinMain(HINSTANCE hInstance,  Line 1118  int WINAPI WinMain(HINSTANCE hInstance, 
         MSG                     msg;          MSG                     msg;
         HMENU           hMenu;          HMENU           hMenu;
         HWND            hwndorg;          HWND            hwndorg;
         int                     i;          UINT            i;
 #ifdef OPENING_WAIT  #ifdef OPENING_WAIT
         UINT32          tick;          UINT32          tick;
 #endif  #endif
Line 1105  int WINAPI WinMain(HINSTANCE hInstance,  Line 1126  int WINAPI WinMain(HINSTANCE hInstance, 
         GetModuleFileName(NULL, modulefile, sizeof(modulefile));          GetModuleFileName(NULL, modulefile, sizeof(modulefile));
         dosio_init();          dosio_init();
         file_setcd(modulefile);          file_setcd(modulefile);
         np2arg_analize(lpszCmdLine);                            // タイミング修正       // ver0.29          np2arg_analize(lpszCmdLine);
         initload();          initload();
   
         srand((unsigned)time(NULL));          rand_setseed((unsigned)time(NULL));
   
 //      np2arg_analize(lpszCmdLine);  
   
         CopyMemory(szClassName, np2oscfg.winid, 3);          CopyMemory(szClassName, np2oscfg.winid, 3);
   
Line 1124  int WINAPI WinMain(HINSTANCE hInstance,  Line 1143  int WINAPI WinMain(HINSTANCE hInstance, 
   
         hInst = hInstance;          hInst = hInstance;
         hPrev = hPreInst;          hPrev = hPreInst;
           mmxflag = (havemmx())?0:MMXFLAG_NOTSUPPORT;
           mmxflag += (np2oscfg.disablemmx)?MMXFLAG_DISABLE:0;
         TRACEINIT();          TRACEINIT();
   
         if (np2oscfg.KEYBOARD >= KEY_TYPEMAX) {                                                 // ver0.28          if (np2oscfg.KEYBOARD >= KEY_TYPEMAX) {                                                 // ver0.28
Line 1148  int WINAPI WinMain(HINSTANCE hInstance,  Line 1169  int WINAPI WinMain(HINSTANCE hInstance, 
                 np2.hInstance = hInstance;                  np2.hInstance = hInstance;
                 np2.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));                  np2.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
                 np2.hCursor = LoadCursor(NULL, IDC_ARROW);                  np2.hCursor = LoadCursor(NULL, IDC_ARROW);
                 np2.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);                  np2.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH);
                 np2.lpszMenuName = MAKEINTRESOURCE(IDM_MAIN);                  np2.lpszMenuName = MAKEINTRESOURCE(IDM_MAIN);
                 np2.lpszClassName = szClassName;                  np2.lpszClassName = szClassName;
                 if (!RegisterClass(&np2)) {                  if (!RegisterClass(&np2)) {
Line 1369  int WINAPI WinMain(HINSTANCE hInstance,  Line 1390  int WINAPI WinMain(HINSTANCE hInstance, 
                                 }                                  }
                                 else {                                                          // auto skip                                  else {                                                          // auto skip
                                         if (!waitcnt) {                                          if (!waitcnt) {
                                                   UINT cnt;
                                                 joy_flash();                                                  joy_flash();
                                                 mouse_callback();                                                  mouse_callback();
                                                 pccore_exec(framecnt == 0);                                                  pccore_exec(framecnt == 0);
                                                 dclock_callback();                                                  dclock_callback();
                                                 framecnt++;                                                  framecnt++;
                                                 if (timing_getcount() < framecnt) {                                                  cnt = timing_getcount();
                                                   if (framecnt > cnt) {
                                                         waitcnt = framecnt;                                                          waitcnt = framecnt;
                                                         if (framemax > 1) {                                                          if (framemax > 1) {
                                                                 framemax--;                                                                  framemax--;
                                                         }                                                          }
                                                 }                                                  }
                                                 else if (framecnt >= framemax) {                                                  else if (framecnt >= framemax) {
                                                         waitcnt = framecnt;  
                                                         if (framemax < 12) {                                                          if (framemax < 12) {
                                                                 framemax++;                                                                  framemax++;
                                                         }                                                          }
                                                           if (cnt >= 12) {
                                                                   timing_reset();
                                                           }
                                                           else {
                                                                   timing_setcount(cnt - framecnt);
                                                           }
                                                           processwait(0);
                                                 }                                                  }
                                         }                                          }
                                         else {                                          else {
Line 1413  int WINAPI WinMain(HINSTANCE hInstance,  Line 1442  int WINAPI WinMain(HINSTANCE hInstance, 
                 flagsave(np2resume);                  flagsave(np2resume);
         }          }
         else {          else {
 //              DeleteFile(file_getcd(np2resume));                  flagdelete(np2resume);
         }          }
   
 #ifdef USE_ROMEO  #ifdef USE_ROMEO

Removed from v.1.1.1.1  
changed lines
  Added in v.1.13


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