Diff for /np2/wince/np2.cpp between versions 1.17 and 1.22

version 1.17, 2004/06/20 02:57:47 version 1.22, 2005/02/12 12:14:00
Line 5 Line 5
 #endif  #endif
 #include        "resource.h"  #include        "resource.h"
 #include        "strres.h"  #include        "strres.h"
   #if defined(UNICODE) && defined(OSLANG_UTF8)
   #include        "codecnv.h"
   #endif
 #include        "np2.h"  #include        "np2.h"
 #include        "dosio.h"  #include        "dosio.h"
 #include        "commng.h"  #include        "commng.h"
Line 36 Line 39
 #include        "softkbd.h"  #include        "softkbd.h"
   
   
 static const TCHAR szAppCaption[] = STRLITERAL("Neko Project II");  static const TCHAR szAppCaption[] = _T("Neko Project II");
 static const TCHAR szClassName[] = STRLITERAL("NP2-MainWindow");  static const TCHAR szClassName[] = _T("NP2-MainWindow");
   
   
                 NP2OSCFG        np2oscfg = {0, 0, 0, 0,                  NP2OSCFG        np2oscfg = {0, 0, 0, 0,
Line 51  static const TCHAR szClassName[] = STRLI Line 54  static const TCHAR szClassName[] = STRLI
                 HWND            hWndMain;                  HWND            hWndMain;
                 HINSTANCE       hInst;                  HINSTANCE       hInst;
                 HINSTANCE       hPrev;                  HINSTANCE       hPrev;
                 char            modulefile[MAX_PATH];                  OEMCHAR         modulefile[MAX_PATH];
                 GXKeyList       gx_keylist;                  GXKeyList       gx_keylist;
   
 enum {  enum {
Line 67  static UINT  framemax = 1; Line 70  static UINT  framemax = 1;
   
 // ---- resume  // ---- resume
   
 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 75  static void getstatfilename(char *path,  Line 78  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));
         ret = statsave_save(path);          ret = statsave_save(path);
         if (ret) {          if (ret) {
                 file_delete(path);                  file_delete(path);
Line 88  static int flagsave(const char *ext) { Line 91  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];
         char    buf2[1024 + 256];          OEMCHAR buf2[1024 + 256];
   
         getstatfilename(path, ext, sizeof(path));          getstatfilename(path, ext, NELEMENTS(path));
         id = DID_YES;          id = DID_YES;
         ret = statsave_check(path, buf, sizeof(buf));          ret = statsave_check(path, buf, NELEMENTS(buf));
         if (ret & (~STATFLAG_DISKCHG)) {          if (ret & (~STATFLAG_DISKCHG)) {
                 menumbox("Couldn't restart", title, MBOX_OK | MBOX_ICONSTOP);                  menumbox("Couldn't restart", title, MBOX_OK | MBOX_ICONSTOP);
                 id = DID_NO;                  id = DID_NO;
         }          }
         else if ((!force) && (ret & STATFLAG_DISKCHG)) {          else if ((!force) && (ret & STATFLAG_DISKCHG)) {
                 SPRINTF(buf2, "Conflict!\n\n%s\nContinue?", buf);                  OEMSPRINTF(buf2, "Conflict!\n\n%s\nContinue?", buf);
                 id = menumbox(buf2, title, MBOX_YESNOCAN | MBOX_ICONQUESTION);                  id = menumbox(buf2, title, MBOX_YESNOCAN | MBOX_ICONQUESTION);
         }          }
         if (id == DID_YES) {          if (id == DID_YES) {
Line 175  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 178  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                         winkbd_keyup(wParam, lParam);                          winkbd_keyup(wParam, lParam);
                         break;                          break;
   
 #if !defined(_WIN32_WCE)  #if 1 // !defined(_WIN32_WCE)
                 case WM_SYSKEYDOWN:                  case WM_SYSKEYDOWN:
                         winkbd_keydown(wParam, lParam);                          winkbd_keydown(wParam, lParam);
                         break;                          break;
Line 198  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 201  LRESULT CALLBACK WndProc(HWND hWnd, UINT
                                 if (menuvram) {                                  if (menuvram) {
                                         menubase_moving(LOWORD(lParam), HIWORD(lParam), 1);                                          menubase_moving(LOWORD(lParam), HIWORD(lParam), 1);
                                 }                                  }
                                 else {                                  else if (scrnmng_kbdpos(&lParam) == SUCCESS) {
 #if defined(SUPPORT_SOFTKBD)  #if defined(SUPPORT_SOFTKBD)
                                         softkbd_down(LOWORD(lParam), HIWORD(lParam) - 200);                                          softkbd_down(LOWORD(lParam), HIWORD(lParam));
 #endif  #endif
                                 }                                  }
                         }                          }
Line 208  LRESULT CALLBACK WndProc(HWND hWnd, UINT Line 211  LRESULT CALLBACK WndProc(HWND hWnd, UINT
   
                 case WM_LBUTTONUP:                  case WM_LBUTTONUP:
                         if (scrnmng_mousepos(&lParam) == SUCCESS) {                          if (scrnmng_mousepos(&lParam) == SUCCESS) {
   
 #if defined(SUPPORT_SOFTKBD)  #if defined(SUPPORT_SOFTKBD)
                                 softkbd_up();                                  softkbd_up();
   #endif
                                 if (menuvram) {                                  if (menuvram) {
                                         menubase_moving(LOWORD(lParam), HIWORD(lParam), 2);                                          menubase_moving(LOWORD(lParam), HIWORD(lParam), 2);
                                 }                                  }
                                 else if ((LOWORD(lParam) < 32) && (HIWORD(lParam) >= 208)) {                                  else if (scrnmng_ismenu(lParam)) {
                                         sysmenu_menuopen(0, LOWORD(lParam), HIWORD(lParam));  
                                 }  
 #else  
                                 if (menuvram) {  
                                         menubase_moving(LOWORD(lParam), HIWORD(lParam), 2);  
                                 }  
                                 else {  
                                         sysmenu_menuopen(0, LOWORD(lParam), HIWORD(lParam));                                          sysmenu_menuopen(0, LOWORD(lParam), HIWORD(lParam));
                                 }                                  }
 #endif  
                         }                          }
                         break;                          break;
   
Line 316  static void processwait(UINT cnt) { Line 311  static void processwait(UINT cnt) {
   
 // ----  // ----
   
 #if !defined(UNICODE)  #if defined(UNICODE) && defined(OSLANG_SJIS)
 #define GetModuleFileName_A(a, b, c)    GetModuleFileName(a, b, c)  static DWORD _GetModuleFileName(HMODULE hModule,
 #else                                                                                  OEMCHAR *lpFileName, DWORD nSize) {
 static DWORD GetModuleFileName_A(HMODULE hModule,  
                                                                 LPSTR lpFileName, DWORD nSize) {  
   
         TCHAR   *FileNameW;          UINT16  ucs2[MAX_PATH];
         DWORD   len;  
   
         if (nSize) {          GetModuleFileName(hModule, ucs2, NELEMENTS(ucs2));
                 FileNameW = (TCHAR *)_MALLOC(nSize * sizeof(TCHAR), "ModuleFile");          nSize = WideCharToMultiByte(CP_ACP, 0, ucs2, -1,
                 if (FileNameW) {  
                         len = GetModuleFileName(hModule, FileNameW, nSize);  
 #if defined(OSLANG_SJIS)  
                         nSize = WideCharToMultiByte(CP_ACP, 0, FileNameW, -1,  
                                                                                 lpFileName, nSize, NULL, NULL);                                                                                  lpFileName, nSize, NULL, NULL);
 #else          if (nSize) {
                         nSize = ucscnv_ucs2toutf8(lpFileName, (UINT)-1, FileNameW, nSize);                  nSize--;
 #endif  
                         if (nSize) {  
                                 nSize--;  
                         }  
                         _MFREE(FileNameW);  
                 }  
                 else {  
                         nSize = 0;  
                 }  
         }          }
         return(nSize);          return(nSize);
 }  }
   #elif defined(UNICODE) && defined(OSLANG_UTF8)
   static DWORD _GetModuleFileName(HMODULE hModule,
                                                                                   OEMCHAR *lpFileName, DWORD nSize) {
   
           UINT16  ucs2[MAX_PATH];
   
           GetModuleFileName(hModule, ucs2, NELEMENTS(ucs2));
           nSize = codecnv_ucs2toutf8(lpFileName, nSize, ucs2, (UINT)-1);
           if (nSize) {
                   nSize--;
           }
           return(nSize);
   }
   #else
   #define _GetModuleFileName(a, b, c)             GetModuleFileName(a, b, c)
 #endif  #endif
   
   
 #if defined(_WIN32_WCE)  #if defined(_WIN32_WCE)
 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst,  int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst,
                                                                                 LPWSTR lpszCmdLine, int nCmdShow)                                                                                  LPWSTR lpszCmdLine, int nCmdShow)
Line 376  int WINAPI WinMain(HINSTANCE hInstance,  Line 371  int WINAPI WinMain(HINSTANCE hInstance, 
                 return(0);                  return(0);
         }          }
   
         GetModuleFileName_A(NULL, modulefile, sizeof(modulefile));          _GetModuleFileName(NULL, modulefile, NELEMENTS(modulefile));
         dosio_init();          dosio_init();
         file_setcd(modulefile);          file_setcd(modulefile);
         initload();          initload();
Line 437  int WINAPI WinMain(HINSTANCE hInstance,  Line 432  int WINAPI WinMain(HINSTANCE hInstance, 
         }          }
         if (scrnmng_create(hWnd, FULLSCREEN_WIDTH, FULLSCREEN_HEIGHT)          if (scrnmng_create(hWnd, FULLSCREEN_WIDTH, FULLSCREEN_HEIGHT)
                                                                                                                                 != SUCCESS) {                                                                                                                                  != SUCCESS) {
                 MessageBox(hWnd, STRLITERAL("Couldn't create DirectDraw Object"),                  MessageBox(hWnd, _T("Couldn't create DirectDraw Object"),
                                                                         szAppCaption, MB_OK | MB_ICONSTOP);                                                                          szAppCaption, MB_OK | MB_ICONSTOP);
                 DestroyWindow(hWnd);                  DestroyWindow(hWnd);
                 goto np2main_err2;                  goto np2main_err2;
Line 483  int WINAPI WinMain(HINSTANCE hInstance,  Line 478  int WINAPI WinMain(HINSTANCE hInstance, 
                         if (!GetMessage(&msg, NULL, 0, 0)) {                          if (!GetMessage(&msg, NULL, 0, 0)) {
                                 break;                                  break;
                         }                          }
 #if !defined(_WIN32_WCE)  #if 1 // !defined(_WIN32_WCE)
                         if ((msg.hwnd != hWnd) ||                          if ((msg.hwnd != hWnd) ||
                                 ((msg.message != WM_SYSKEYDOWN) &&                                  ((msg.message != WM_SYSKEYDOWN) &&
                                 (msg.message != WM_SYSKEYUP))) {                                  (msg.message != WM_SYSKEYUP))) {

Removed from v.1.17  
changed lines
  Added in v.1.22


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