]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
stuff2
authorToni Wilen <twilen@winuae.net>
Thu, 5 Aug 2010 08:44:57 +0000 (11:44 +0300)
committerToni Wilen <twilen@winuae.net>
Thu, 5 Aug 2010 08:44:57 +0000 (11:44 +0300)
inputdevice.cpp
od-win32/win32gui.cpp
od-win32/win32gui_extra.cpp
uaeipc.cpp

index f091ef7ee7549a4ce899dfe0574a099340c379aa..15074d00bbed1c26dcf3b82fd54524805251cd8b 100644 (file)
@@ -5613,18 +5613,6 @@ int jsem_iskbdjoy (int port, const struct uae_prefs *p)
        return v;
 }
 
-// reject same joystick in parallel ports if it is already in normal ports, AF2008 workaround
-static bool checkjpc (struct uae_prefs *p, int portnum, int idnum)
-{
-       if (portnum < 2 || idnum < 0)
-               return true;
-       for (int i = 0; i < MAX_JPORTS; i++) {
-               if (p->jports[i].id == idnum && portnum != i)
-                       return false;
-       }
-       return true;
-}
-
 int inputdevice_joyport_config (struct uae_prefs *p, TCHAR *value, int portnum, int mode, int type)
 {
        switch (type)
@@ -5646,8 +5634,6 @@ int inputdevice_joyport_config (struct uae_prefs *p, TCHAR *value, int portnum,
                                        TCHAR *name1 = idf->get_friendlyname (i);
                                        TCHAR *name2 = idf->get_uniquename (i);
                                        if ((name1 && !_tcscmp (name1, value)) || (name2 && !_tcscmp (name2, value))) {
-                                               if (!checkjpc (p, portnum, idnum + 1))
-                                                       return 0;
                                                p->jports[portnum].id = idnum + i;
                                                if (mode >= 0)
                                                        p->jports[portnum].mode = mode;
index 8bb31f0640b9546bf1c3daf168b6777c36fc9d21..ee7d96242178c5e2c0194b5babd37638eeeba3d5 100644 (file)
@@ -7708,7 +7708,7 @@ static void values_to_cpudlg (HWND hDlg)
                        SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY2, WM_SETTEXT, 0, (LPARAM)txt);
                }
        } else {
-               SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY2, WM_SETTEXT, 0, (LPARAM)"");
+               SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY2, WM_SETTEXT, 0, (LPARAM)L"");
        }
 }
 
index f6b4f568d29384279ccd591d08d4730182e47566..4ed2e6d309a89497b96fa37e07f808e2b3e66033 100644 (file)
@@ -51,7 +51,7 @@ typedef struct {
        WORD weight;
        BYTE italic;
        BYTE charset;
-       WCHAR typeface[0];
+       WCHAR typeface[1];
 } DLGTEMPLATEEX_END;
 
 typedef struct {
@@ -64,7 +64,7 @@ typedef struct {
        short cy;
        WORD id;
        WORD reserved;
-       WCHAR windowClass[0];
+       WCHAR windowClass[1];
        /* variable data after this */
        /* sz_Or_Ord title; */
        /* WORD extraCount; */
@@ -78,6 +78,18 @@ static wchar_t wfont_old[] = L"MS Sans Serif";
 static TCHAR font_vista[] = L"Segoe UI";
 static TCHAR font_xp[] = L"Tahoma";
 
+static BYTE *skiptextone (BYTE *s)
+{
+       s -= sizeof (WCHAR);
+       if (s[0] == 0xff && s[1] == 0xff) {
+               s += 4;
+               return s;
+       }
+       while (s[0] != 0 || s[1] != 0)
+               s += 2;
+       s += 2;
+       return s;
+}
 
 static BYTE *skiptext (BYTE *s)
 {
@@ -174,13 +186,13 @@ struct newresource *scaleresource (struct newresource *res, HWND parent)
        d2 = (DLGTEMPLATEEX_END*)p;
        p2 = p;
        p2 += sizeof (DLGTEMPLATEEX_END);
-       p2 = skiptext (p2);
+       p2 = skiptextone (p2);
        p2 = todword (p2);
 
        modifytemplatefont (d, d2);
 
        p += sizeof (DLGTEMPLATEEX_END);
-       p = skiptext (p);
+       p = skiptextone (p);
        p = todword (p);
 
        if (p != p2)
@@ -192,8 +204,8 @@ struct newresource *scaleresource (struct newresource *res, HWND parent)
                dt = (DLGITEMTEMPLATEEX*)p;
                modifyitem (d, d2, dt, ns->tmpl, mult);
                p += sizeof (DLGITEMTEMPLATEEX);
-               p = skiptext(p);
-               p = skiptext(p);
+               p = skiptextone (p);
+               p = skiptext (p);
                p += ((WORD*)p)[0];
                p += sizeof (WORD);
                p = todword (p);
index 329523dbdbe90534f4e8ec2690d99eb911c5590a..c4b6bc96b988580be0dfe87bd7f6216478c22cc4 100644 (file)
@@ -164,6 +164,8 @@ void *createIPC (const TCHAR *name, int binary)
 void *geteventhandleIPC (void *vipc)
 {
        struct uaeipc *ipc = (struct uaeipc*)vipc;
+       if (!ipc)
+               return INVALID_HANDLE_VALUE;
        return ipc->olevent;
 }
 
@@ -199,6 +201,8 @@ int checkIPC (void *vipc, struct uae_prefs *p)
        BOOL ok;
        DWORD ret, err;
 
+       if (!ipc)
+               return 0;
        if (ipc->hipc == INVALID_HANDLE_VALUE)
                return 0;
        if (WaitForSingleObject(ipc->olevent, 0) != WAIT_OBJECT_0)