From 946a9f3be0cf93f4da8fe84b8f69ee47efa456fd Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Thu, 5 Aug 2010 11:44:57 +0300 Subject: [PATCH] stuff2 --- inputdevice.cpp | 14 -------------- od-win32/win32gui.cpp | 2 +- od-win32/win32gui_extra.cpp | 24 ++++++++++++++++++------ uaeipc.cpp | 4 ++++ 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/inputdevice.cpp b/inputdevice.cpp index f091ef7e..15074d00 100644 --- a/inputdevice.cpp +++ b/inputdevice.cpp @@ -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; diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 8bb31f06..ee7d9624 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -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""); } } diff --git a/od-win32/win32gui_extra.cpp b/od-win32/win32gui_extra.cpp index f6b4f568..4ed2e6d3 100644 --- a/od-win32/win32gui_extra.cpp +++ b/od-win32/win32gui_extra.cpp @@ -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); diff --git a/uaeipc.cpp b/uaeipc.cpp index 329523db..c4b6bc96 100644 --- a/uaeipc.cpp +++ b/uaeipc.cpp @@ -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) -- 2.47.3