winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
February 2009
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
965 discussions
Start a n
N
ew thread
Dylan Smith : richedit: Fixed EM_FINDTEXT to pass todo tests.
by Alexandre Julliard
02 Feb '09
02 Feb '09
Module: wine Branch: master Commit: 95d82484e19ce2da3928798bc29216d3f3856e3c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=95d82484e19ce2da3928798bc…
Author: Dylan Smith <dylan.ah.smith(a)gmail.com> Date: Mon Feb 2 01:32:36 2009 -0500 richedit: Fixed EM_FINDTEXT to pass todo tests. There was a bug in ME_FindText which would cause the final caracter offset to be incorrect when a paragraph was crossed while matching characters. The problem was the character offset of the wrong paragraph was used in the calculation of the start offset of the match. --- dlls/riched20/editor.c | 12 +++++------- dlls/riched32/tests/editor.c | 11 ++--------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 352b827..ca1eb97 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -1763,7 +1763,6 @@ ME_FindText(ME_TextEditor *editor, DWORD flags, const CHARRANGE *chrg, const WCH if (nCurStart + nMatched == ME_StrLen(pCurItem->member.run.strText)) { pCurItem = ME_FindItemFwd(pCurItem, diRun); - para = ME_GetParagraph(pCurItem); nCurStart = -nMatched; } } @@ -1814,14 +1813,13 @@ ME_FindText(ME_TextEditor *editor, DWORD flags, const CHARRANGE *chrg, const WCH ME_DisplayItem *pCurItem = item; int nCurEnd = nEnd; int nMatched = 0; - - if (nCurEnd - nMatched == 0) + + if (nCurEnd == 0) { pCurItem = ME_FindItemBack(pCurItem, diRun); - para = ME_GetParagraph(pCurItem); nCurEnd = ME_StrLen(pCurItem->member.run.strText) + nMatched; } - + while (pCurItem && ME_CharCompare(pCurItem->member.run.strText->szData[nCurEnd - nMatched - 1], text[nLen - nMatched - 1], (flags & FR_MATCHCASE))) { if ((flags & FR_WHOLEWORD) && isalnumW(wLastChar)) @@ -1853,7 +1851,8 @@ ME_FindText(ME_TextEditor *editor, DWORD flags, const CHARRANGE *chrg, const WCH break; } - nStart = para->member.para.nCharOfs + pCurItem->member.run.nCharOfs + nCurEnd - nMatched; + nStart = ME_GetParagraph(pCurItem)->member.para.nCharOfs + + pCurItem->member.run.nCharOfs + nCurEnd - nMatched; if (chrgText) { chrgText->cpMin = nStart; @@ -1867,7 +1866,6 @@ ME_FindText(ME_TextEditor *editor, DWORD flags, const CHARRANGE *chrg, const WCH pCurItem = ME_FindItemBack(pCurItem, diRun); /* Don't care about pCurItem becoming NULL here; it's already taken * care of in the exterior loop condition */ - para = ME_GetParagraph(pCurItem); nCurEnd = ME_StrLen(pCurItem->member.run.strText) + nMatched; } } diff --git a/dlls/riched32/tests/editor.c b/dlls/riched32/tests/editor.c index e81f033..006da7d 100644 --- a/dlls/riched32/tests/editor.c +++ b/dlls/riched32/tests/editor.c @@ -672,15 +672,8 @@ static void run_tests_EM_FINDTEXT(HWND hwnd, const char *name, struct find_s *fi int i; for (i = 0; i < num_tests; i++) { - if (*name == '3' && i == 0) { - todo_wine { - check_EM_FINDTEXT(hwnd, name, &find[i], i); - check_EM_FINDTEXTEX(hwnd, name, &find[i], i); - } - } else { - check_EM_FINDTEXT(hwnd, name, &find[i], i); - check_EM_FINDTEXTEX(hwnd, name, &find[i], i); - } + check_EM_FINDTEXT(hwnd, name, &find[i], i); + check_EM_FINDTEXTEX(hwnd, name, &find[i], i); } }
1
0
0
0
Dylan Smith : richedit: Implement EM_GETTEXTMODE.
by Alexandre Julliard
02 Feb '09
02 Feb '09
Module: wine Branch: master Commit: 8662c6fe7b60d9ff563ba790d4431ef30250249b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8662c6fe7b60d9ff563ba790d…
Author: Dylan Smith <dylan.ah.smith(a)gmail.com> Date: Mon Feb 2 01:32:29 2009 -0500 richedit: Implement EM_GETTEXTMODE. The text mode is already stored, and EM_SETTEXTMODE already exists. There was however a bug in EM_MakeEditor that could cause TM_PLAINTEXT and TM_RICHEDIT to be set at the same time. This was corrected to ensure EM_GETTEXTMODE returned the proper mode being used. --- dlls/riched20/editor.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index f875385..352b827 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -69,7 +69,7 @@ ! - EM_GETTHUMB + EM_GETTEXTEX 2.0 + EM_GETTEXTLENGTHEX (GTL_PRECISE unimplemented) - - EM_GETTEXTMODE 2.0 + + EM_GETTEXTMODE 2.0 ? + EM_GETTEXTRANGE (ANSI&Unicode) - EM_GETTYPOGRAPHYOPTIONS 3.0 - EM_GETUNDONAME @@ -2680,7 +2680,7 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) ed->bHideSelection = FALSE; ed->pfnWordBreak = NULL; ed->lpOleCallback = NULL; - ed->mode = TM_RICHTEXT | TM_MULTILEVELUNDO | TM_MULTICODEPAGE; + ed->mode = TM_MULTILEVELUNDO | TM_MULTICODEPAGE; ed->mode |= (props & TXTBIT_RICHTEXT) ? TM_RICHTEXT : TM_PLAINTEXT; ed->AutoURLDetect_bEnable = FALSE; ed->bHaveFocus = FALSE; @@ -2999,7 +2999,6 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, UNSUPPORTED_MSG(EM_SETIMESTATUS) UNSUPPORTED_MSG(EM_GETLANGOPTIONS) UNSUPPORTED_MSG(EM_GETREDONAME) - UNSUPPORTED_MSG(EM_GETTEXTMODE) UNSUPPORTED_MSG(EM_GETTYPOGRAPHYOPTIONS) UNSUPPORTED_MSG(EM_GETUNDONAME) UNSUPPORTED_MSG(EM_GETWORDBREAKPROCEX) @@ -4290,6 +4289,8 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, editor->pfnWordBreak = (EDITWORDBREAKPROCW)lParam; return (LRESULT)pfnOld; } + case EM_GETTEXTMODE: + return editor->mode; case EM_SETTEXTMODE: { LRESULT ret;
1
0
0
0
Dylan Smith : richedit: Use width from EM_SETTARGETDEVICE for wrapping.
by Alexandre Julliard
02 Feb '09
02 Feb '09
Module: wine Branch: master Commit: 1a3551b630eae2418692f21790fcc7fc973f5366 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1a3551b630eae2418692f2179…
Author: Dylan Smith <dylan.ah.smith(a)gmail.com> Date: Mon Feb 2 01:32:20 2009 -0500 richedit: Use width from EM_SETTARGETDEVICE for wrapping. The width for EM_SETTARGETDEVICE is used by some applications to set the wrapping width to a certain distance in twips. This can be used even though the target device is ignored. --- dlls/riched20/context.c | 6 +++++- dlls/riched20/editor.c | 15 ++++++++++++--- dlls/riched20/editstr.h | 6 ++++-- dlls/riched20/tests/editor.c | 4 ++-- dlls/riched20/wrap.c | 2 +- dlls/riched32/tests/editor.c | 4 ++-- 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/dlls/riched20/context.c b/dlls/riched20/context.c index 6d4a2a9..93d5caa 100644 --- a/dlls/riched20/context.c +++ b/dlls/riched20/context.c @@ -22,7 +22,7 @@ void ME_InitContext(ME_Context *c, ME_TextEditor *editor, HDC hDC) { - c->nSequence = editor->nSequence++; + c->nSequence = editor->nSequence++; c->hDC = hDC; c->editor = editor; c->pt.x = 0; @@ -35,6 +35,10 @@ void ME_InitContext(ME_Context *c, ME_TextEditor *editor, HDC hDC) } else { c->dpi.cx = c->dpi.cy = 96; } + if (editor->nAvailWidth) + c->nAvailWidth = ME_twips2pointsX(c, editor->nAvailWidth); + else + c->nAvailWidth = c->rcView.right - c->rcView.left; } void ME_DestroyContext(ME_Context *c) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 574118a..f875385 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -4332,14 +4332,23 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, if (wParam == 0) { BOOL new = (lParam == 0); - if (editor->bWordWrap != new) + if (editor->nAvailWidth || editor->bWordWrap != new) { editor->bWordWrap = new; + editor->nAvailWidth = 0; /* wrap to client area */ ME_RewrapRepaint(editor); } + } else { + int width = max(0, lParam); + if (!editor->bWordWrap || editor->nAvailWidth != width) + { + editor->nAvailWidth = width; + editor->bWordWrap = TRUE; + ME_RewrapRepaint(editor); + } + FIXME("EM_SETTARGETDEVICE doesn't use non-NULL target devices\n"); } - else FIXME("Unsupported yet non NULL device in EM_SETTARGETDEVICE\n"); - break; + return TRUE; default: do_default: *phresult = S_FALSE; diff --git a/dlls/riched20/editstr.h b/dlls/riched20/editstr.h index a645075..63ef7f9 100644 --- a/dlls/riched20/editstr.h +++ b/dlls/riched20/editstr.h @@ -342,6 +342,7 @@ typedef struct tagME_TextEditor SIZE sizeWindow; int nTotalLength, nLastTotalLength; int nTotalWidth, nLastTotalWidth; + int nAvailWidth; /* 0 = wrap to client area, else wrap width in twips */ int nUDArrowX; int nSequence; COLORREF rgbBackColor; @@ -396,6 +397,7 @@ typedef struct tagME_Context RECT rcView; HBRUSH hbrMargin; SIZE dpi; + int nAvailWidth; /* those are valid inside ME_WrapTextParagraph and related */ POINT ptFirstRun; @@ -413,9 +415,9 @@ typedef struct tagME_WrapContext POINT pt; BOOL bOverflown, bWordWrap; ME_DisplayItem *pRowStart; - + ME_DisplayItem *pLastSplittableRun; POINT ptLastSplittableRun; -} ME_WrapContext; +} ME_WrapContext; #endif diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 29d3124..f8da3fa 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -5939,12 +5939,12 @@ static void test_word_wrap(void) /* Test the effect of EM_SETTARGETDEVICE on word wrap. */ res = SendMessage(hwnd, EM_SETTARGETDEVICE, 0, 1); - todo_wine ok(res, "EM_SETTARGETDEVICE failed (returned %d).\n", res); + ok(res, "EM_SETTARGETDEVICE failed (returned %d).\n", res); pos = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM) &point); ok(!pos, "pos=%d indicating word wrap when none is expected.\n", pos); res = SendMessage(hwnd, EM_SETTARGETDEVICE, 0, 0); - todo_wine ok(res, "EM_SETTARGETDEVICE failed (returned %d).\n", res); + ok(res, "EM_SETTARGETDEVICE failed (returned %d).\n", res); pos = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM) &point); ok(pos, "pos=%d indicating no word wrap when it is expected.\n", pos); DestroyWindow(hwnd); diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c index 4edbbb2..a2da5eb 100644 --- a/dlls/riched20/wrap.c +++ b/dlls/riched20/wrap.c @@ -77,7 +77,7 @@ static void ME_BeginRow(ME_WrapContext *wc, ME_DisplayItem *para) - (wc->nRow ? wc->nLeftMargin : wc->nFirstMargin) - wc->nRightMargin; wc->bWordWrap = TRUE; } else { - wc->nAvailWidth = wc->context->rcView.right - wc->context->rcView.left + wc->nAvailWidth = wc->context->nAvailWidth - (wc->nRow ? wc->nLeftMargin : wc->nFirstMargin) - wc->nRightMargin; } wc->pt.x = wc->context->pt.x; diff --git a/dlls/riched32/tests/editor.c b/dlls/riched32/tests/editor.c index ac98d16..e81f033 100644 --- a/dlls/riched32/tests/editor.c +++ b/dlls/riched32/tests/editor.c @@ -897,12 +897,12 @@ static void test_word_wrap(void) /* Test the effect of EM_SETTARGETDEVICE on word wrap. */ res = SendMessage(hwnd, EM_SETTARGETDEVICE, 0, 1); - todo_wine ok(res, "EM_SETTARGETDEVICE failed (returned %d).\n", res); + ok(res, "EM_SETTARGETDEVICE failed (returned %d).\n", res); pos = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM) &point); ok(!pos, "pos=%d indicating word wrap when none is expected.\n", pos); res = SendMessage(hwnd, EM_SETTARGETDEVICE, 0, 0); - todo_wine ok(res, "EM_SETTARGETDEVICE failed (returned %d).\n", res); + ok(res, "EM_SETTARGETDEVICE failed (returned %d).\n", res); pos = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM) &point); ok(pos, "pos=%d indicating no word wrap when it is expected.\n", pos); DestroyWindow(hwnd);
1
0
0
0
David Adam : d3dx8: Implement D3DXFresnelTerm.
by Alexandre Julliard
02 Feb '09
02 Feb '09
Module: wine Branch: master Commit: f20ba244049f5473369e32df5fe108244da3e180 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f20ba244049f5473369e32df5…
Author: David Adam <david.adam.cnrs(a)gmail.com> Date: Sat Jan 31 14:57:13 2009 +0100 d3dx8: Implement D3DXFresnelTerm. --- dlls/d3dx8/d3dx8.spec | 1 + dlls/d3dx8/math.c | 14 ++++++++++++++ dlls/d3dx8/tests/math.c | 10 ++++++++++ include/d3dx8math.h | 2 ++ 4 files changed, 27 insertions(+), 0 deletions(-) diff --git a/dlls/d3dx8/d3dx8.spec b/dlls/d3dx8/d3dx8.spec index 3587c6b..036a510 100644 --- a/dlls/d3dx8/d3dx8.spec +++ b/dlls/d3dx8/d3dx8.spec @@ -68,6 +68,7 @@ @ stdcall D3DXPlaneTransform(ptr ptr ptr) @ stdcall D3DXColorAdjustSaturation(ptr ptr long) @ stdcall D3DXColorAdjustContrast(ptr ptr long) +@ stdcall D3DXFresnelTerm(long long) @ stdcall D3DXCreateMatrixStack(long ptr) @ stdcall D3DXCreateFont(ptr ptr ptr) @ stub D3DXCreateFontIndirect diff --git a/dlls/d3dx8/math.c b/dlls/d3dx8/math.c index bde0e84..b355c9c 100644 --- a/dlls/d3dx8/math.c +++ b/dlls/d3dx8/math.c @@ -58,6 +58,20 @@ D3DXCOLOR* WINAPI D3DXColorAdjustSaturation(D3DXCOLOR *pout, CONST D3DXCOLOR *pc return pout; } +/*_________________Misc__________________________*/ + +FLOAT WINAPI D3DXFresnelTerm(FLOAT costheta, FLOAT refractionindex) +{ + FLOAT a, d, g, result; + + g = sqrt(refractionindex * refractionindex + costheta * costheta - 1.0f); + a = g + costheta; + d = g - costheta; + result = ( costheta * a - 1.0f ) * ( costheta * a - 1.0f ) / ( ( costheta * d + 1.0f ) * ( costheta * d + 1.0f ) ) + 1.0f; + result = result * 0.5f * d * d / ( a * a ); + return result; +} + /*_________________D3DXMatrix____________________*/ D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX *pout, FLOAT scaling, CONST D3DXVECTOR3 *rotationcenter, CONST D3DXQUATERNION *rotation, CONST D3DXVECTOR3 *translation) diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index b1bfd74..6a7f99d 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -166,6 +166,15 @@ static void D3DXColorTest(void) ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); } +static void D3DXFresnelTest(void) +{ + FLOAT expected, got; + + expected = 0.089187; + got = D3DXFresnelTerm(0.5f,1.5); + ok( fabs(got - expected) < admitted_error, "Expected: %f, Got: %f\n", expected, got); +} + static void D3DXMatrixTest(void) { D3DXMATRIX expectedmat, gotmat, mat, mat2, mat3; @@ -1498,6 +1507,7 @@ static void test_matrix_stack(void) START_TEST(math) { D3DXColorTest(); + D3DXFresnelTest(); D3DXMatrixTest(); D3DXPlaneTest(); D3X8QuaternionTest(); diff --git a/include/d3dx8math.h b/include/d3dx8math.h index 88da2b0..ee5c220 100644 --- a/include/d3dx8math.h +++ b/include/d3dx8math.h @@ -271,6 +271,8 @@ extern "C" { D3DXCOLOR* WINAPI D3DXColorAdjustContrast(D3DXCOLOR *pout, CONST D3DXCOLOR *pc, FLOAT s); D3DXCOLOR* WINAPI D3DXColorAdjustSaturation(D3DXCOLOR *pout, CONST D3DXCOLOR *pc, FLOAT s); +FLOAT WINAPI D3DXFresnelTerm(FLOAT costheta, FLOAT refractionindex); + D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX *pout, FLOAT scaling, CONST D3DXVECTOR3 *rotationcenter, CONST D3DXQUATERNION *rotation, CONST D3DXVECTOR3 *translation); FLOAT WINAPI D3DXMatrixfDeterminant(CONST D3DXMATRIX *pm); D3DXMATRIX* WINAPI D3DXMatrixInverse(D3DXMATRIX *pout, FLOAT *pdeterminant, CONST D3DXMATRIX *pm);
1
0
0
0
David Adam : d3dx8: Simplify some functions.
by Alexandre Julliard
02 Feb '09
02 Feb '09
Module: wine Branch: master Commit: 082d740fc11dcd7c5efb78020df922ec959a54b9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=082d740fc11dcd7c5efb78020…
Author: David Adam <david.adam.cnrs(a)gmail.com> Date: Sat Jan 31 11:19:47 2009 +0100 d3dx8: Simplify some functions. --- dlls/d3dx8/math.c | 36 ++++++++++++++++++------------------ 1 files changed, 18 insertions(+), 18 deletions(-) diff --git a/dlls/d3dx8/math.c b/dlls/d3dx8/math.c index 8dda418..bde0e84 100644 --- a/dlls/d3dx8/math.c +++ b/dlls/d3dx8/math.c @@ -1346,15 +1346,15 @@ D3DXVECTOR3* WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv) D3DXVECTOR3* WINAPI D3DXVec3Project(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, CONST D3DVIEWPORT8 *pviewport, CONST D3DXMATRIX *pprojection, CONST D3DXMATRIX *pview, CONST D3DXMATRIX *pworld) { - D3DXMATRIX m1, m2; - D3DXVECTOR3 out, vec; - - D3DXMatrixMultiply(&m1, pworld, pview); - D3DXMatrixMultiply(&m2, &m1, pprojection); - D3DXVec3TransformCoord(&vec, pv, &m2); - out.x = pviewport->X + ( 1.0f + vec.x ) * pviewport->Width / 2.0f; - out.y = pviewport->Y + ( 1.0f - vec.y ) * pviewport->Height / 2.0f; - out.z = pviewport->MinZ + vec.z * ( pviewport->MaxZ - pviewport->MinZ ); + D3DXMATRIX m; + D3DXVECTOR3 out; + + D3DXMatrixMultiply(&m, pworld, pview); + D3DXMatrixMultiply(&m, &m, pprojection); + D3DXVec3TransformCoord(&out, pv, &m); + out.x = pviewport->X + ( 1.0f + out.x ) * pviewport->Width / 2.0f; + out.y = pviewport->Y + ( 1.0f - out.y ) * pviewport->Height / 2.0f; + out.z = pviewport->MinZ + out.z * ( pviewport->MaxZ - pviewport->MinZ ); *pout = out; return pout; } @@ -1404,16 +1404,16 @@ D3DXVECTOR3* WINAPI D3DXVec3TransformNormal(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 D3DXVECTOR3* WINAPI D3DXVec3Unproject(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, CONST D3DVIEWPORT8 *pviewport, CONST D3DXMATRIX *pprojection, CONST D3DXMATRIX *pview, CONST D3DXMATRIX *pworld) { - D3DXMATRIX m1, m2, m3; - D3DXVECTOR3 out, vec; + D3DXMATRIX m; + D3DXVECTOR3 out; - D3DXMatrixMultiply(&m1, pworld, pview); - D3DXMatrixMultiply(&m2, &m1, pprojection); - D3DXMatrixInverse(&m3, NULL, &m2); - vec.x = 2.0f * ( pv->x - pviewport->X ) / pviewport->Width - 1.0f; - vec.y = 1.0f - 2.0f * ( pv->y - pviewport->Y ) / pviewport->Height; - vec.z = ( pv->z - pviewport->MinZ) / ( pviewport->MaxZ - pviewport->MinZ ); - D3DXVec3TransformCoord(&out, &vec, &m3); + D3DXMatrixMultiply(&m, pworld, pview); + D3DXMatrixMultiply(&m, &m, pprojection); + D3DXMatrixInverse(&m, NULL, &m); + out.x = 2.0f * ( pv->x - pviewport->X ) / pviewport->Width - 1.0f; + out.y = 1.0f - 2.0f * ( pv->y - pviewport->Y ) / pviewport->Height; + out.z = ( pv->z - pviewport->MinZ) / ( pviewport->MaxZ - pviewport->MinZ ); + D3DXVec3TransformCoord(&out, &out, &m); *pout = out; return pout; }
1
0
0
0
David Adam : d3dx8: Allow output pointer to be equal to input pointer.
by Alexandre Julliard
02 Feb '09
02 Feb '09
Module: wine Branch: master Commit: 77c857d8885e94452854c2c03f401405e3815189 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=77c857d8885e94452854c2c03…
Author: David Adam <david.adam.cnrs(a)gmail.com> Date: Sat Jan 31 11:17:45 2009 +0100 d3dx8: Allow output pointer to be equal to input pointer. --- dlls/d3dx8/math.c | 116 ++++++++++++++++++++++++++++++----------------------- 1 files changed, 66 insertions(+), 50 deletions(-) diff --git a/dlls/d3dx8/math.c b/dlls/d3dx8/math.c index bcab3b4..8dda418 100644 --- a/dlls/d3dx8/math.c +++ b/dlls/d3dx8/math.c @@ -114,6 +114,7 @@ FLOAT WINAPI D3DXMatrixfDeterminant(CONST D3DXMATRIX *pm) D3DXMATRIX* WINAPI D3DXMatrixInverse(D3DXMATRIX *pout, FLOAT *pdeterminant, CONST D3DXMATRIX *pm) { int a, i, j; + D3DXMATRIX out; D3DXVECTOR4 v, vec[3]; FLOAT det; @@ -135,11 +136,12 @@ D3DXMATRIX* WINAPI D3DXMatrixInverse(D3DXMATRIX *pout, FLOAT *pdeterminant, CONS } } D3DXVec4Cross(&v, &vec[0], &vec[1], &vec[2]); - pout->u.m[0][i] = pow(-1.0f, i) * v.x / det; - pout->u.m[1][i] = pow(-1.0f, i) * v.y / det; - pout->u.m[2][i] = pow(-1.0f, i) * v.z / det; - pout->u.m[3][i] = pow(-1.0f, i) * v.w / det; + out.u.m[0][i] = pow(-1.0f, i) * v.x / det; + out.u.m[1][i] = pow(-1.0f, i) * v.y / det; + out.u.m[2][i] = pow(-1.0f, i) * v.z / det; + out.u.m[3][i] = pow(-1.0f, i) * v.w / det; } + *pout = out; return pout; } @@ -938,23 +940,25 @@ D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine(D3DXVECTOR3 *pout, CONST D3DXPLANE *p D3DXPLANE* WINAPI D3DXPlaneNormalize(D3DXPLANE *pout, CONST D3DXPLANE *pp) { + D3DXPLANE out; FLOAT norm; norm = sqrt(pp->a * pp->a + pp->b * pp->b + pp->c * pp->c); if ( norm ) { - pout->a = pp->a / norm; - pout->b = pp->b / norm; - pout->c = pp->c / norm; - pout->d = pp->d / norm; + out.a = pp->a / norm; + out.b = pp->b / norm; + out.c = pp->c / norm; + out.d = pp->d / norm; } else { - pout->a = 0.0f; - pout->b = 0.0f; - pout->c = 0.0f; - pout->d = 0.0f; + out.a = 0.0f; + out.b = 0.0f; + out.c = 0.0f; + out.d = 0.0f; } + *pout = out; return pout; } @@ -1062,23 +1066,25 @@ D3DXQUATERNION* WINAPI D3DXQuaternionMultiply(D3DXQUATERNION *pout, CONST D3DXQU D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq) { + D3DXQUATERNION out; FLOAT norm; norm = D3DXQuaternionLength(pq); if ( !norm ) { - pout->x = 0.0f; - pout->y = 0.0f; - pout->z = 0.0f; - pout->w = 0.0f; + out.x = 0.0f; + out.y = 0.0f; + out.z = 0.0f; + out.w = 0.0f; } else { - pout->x = pq->x / norm; - pout->y = pq->y / norm; - pout->z = pq->z / norm; - pout->w = pq->w / norm; + out.x = pq->x / norm; + out.y = pq->y / norm; + out.z = pq->z / norm; + out.w = pq->w / norm; } + *pout=out; return pout; } @@ -1229,19 +1235,21 @@ D3DXVECTOR2* WINAPI D3DXVec2Hermite(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, C D3DXVECTOR2* WINAPI D3DXVec2Normalize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv) { + D3DXVECTOR2 out; FLOAT norm; norm = D3DXVec2Length(pv); if ( !norm ) { - pout->x = 0.0f; - pout->y = 0.0f; + out.x = 0.0f; + out.y = 0.0f; } else { - pout->x = pv->x / norm; - pout->y = pv->y / norm; + out.x = pv->x / norm; + out.y = pv->y / norm; } + *pout=out; return pout; } @@ -1316,35 +1324,38 @@ D3DXVECTOR3* WINAPI D3DXVec3Hermite(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, C D3DXVECTOR3* WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv) { + D3DXVECTOR3 out; FLOAT norm; norm = D3DXVec3Length(pv); if ( !norm ) { - pout->x = 0.0f; - pout->y = 0.0f; - pout->z = 0.0f; + out.x = 0.0f; + out.y = 0.0f; + out.z = 0.0f; } else { - pout->x = pv->x / norm; - pout->y = pv->y / norm; - pout->z = pv->z / norm; + out.x = pv->x / norm; + out.y = pv->y / norm; + out.z = pv->z / norm; } + *pout = out; return pout; } D3DXVECTOR3* WINAPI D3DXVec3Project(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, CONST D3DVIEWPORT8 *pviewport, CONST D3DXMATRIX *pprojection, CONST D3DXMATRIX *pview, CONST D3DXMATRIX *pworld) { D3DXMATRIX m1, m2; - D3DXVECTOR3 vec; + D3DXVECTOR3 out, vec; D3DXMatrixMultiply(&m1, pworld, pview); D3DXMatrixMultiply(&m2, &m1, pprojection); D3DXVec3TransformCoord(&vec, pv, &m2); - pout->x = pviewport->X + ( 1.0f + vec.x ) * pviewport->Width / 2.0f; - pout->y = pviewport->Y + ( 1.0f - vec.y ) * pviewport->Height / 2.0f; - pout->z = pviewport->MinZ + vec.z * ( pviewport->MaxZ - pviewport->MinZ ); + out.x = pviewport->X + ( 1.0f + vec.x ) * pviewport->Width / 2.0f; + out.y = pviewport->Y + ( 1.0f - vec.y ) * pviewport->Height / 2.0f; + out.z = pviewport->MinZ + vec.z * ( pviewport->MaxZ - pviewport->MinZ ); + *pout = out; return pout; } @@ -1359,6 +1370,7 @@ D3DXVECTOR4* WINAPI D3DXVec3Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR3 *pv, D3DXVECTOR3* WINAPI D3DXVec3TransformCoord(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, CONST D3DXMATRIX *pm) { + D3DXVECTOR3 out; FLOAT norm; norm = pm->u.m[0][3] * pv->x + pm->u.m[1][3] * pv->y + pm->u.m[2][3] *pv->z + pm->u.m[3][3]; @@ -1366,16 +1378,17 @@ D3DXVECTOR3* WINAPI D3DXVec3TransformCoord(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 if ( norm ) { CONST D3DXVECTOR3 v = *pv; - pout->x = (pm->u.m[0][0] * v.x + pm->u.m[1][0] * v.y + pm->u.m[2][0] * v.z + pm->u.m[3][0]) / norm; - pout->y = (pm->u.m[0][1] * v.x + pm->u.m[1][1] * v.y + pm->u.m[2][1] * v.z + pm->u.m[3][1]) / norm; - pout->z = (pm->u.m[0][2] * v.x + pm->u.m[1][2] * v.y + pm->u.m[2][2] * v.z + pm->u.m[3][2]) / norm; + out.x = (pm->u.m[0][0] * v.x + pm->u.m[1][0] * v.y + pm->u.m[2][0] * v.z + pm->u.m[3][0]) / norm; + out.y = (pm->u.m[0][1] * v.x + pm->u.m[1][1] * v.y + pm->u.m[2][1] * v.z + pm->u.m[3][1]) / norm; + out.z = (pm->u.m[0][2] * v.x + pm->u.m[1][2] * v.y + pm->u.m[2][2] * v.z + pm->u.m[3][2]) / norm; } else { - pout->x = 0.0f; - pout->y = 0.0f; - pout->z = 0.0f; + out.x = 0.0f; + out.y = 0.0f; + out.z = 0.0f; } + *pout = out; return pout; } @@ -1392,7 +1405,7 @@ D3DXVECTOR3* WINAPI D3DXVec3TransformNormal(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 D3DXVECTOR3* WINAPI D3DXVec3Unproject(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, CONST D3DVIEWPORT8 *pviewport, CONST D3DXMATRIX *pprojection, CONST D3DXMATRIX *pview, CONST D3DXMATRIX *pworld) { D3DXMATRIX m1, m2, m3; - D3DXVECTOR3 vec; + D3DXVECTOR3 out, vec; D3DXMatrixMultiply(&m1, pworld, pview); D3DXMatrixMultiply(&m2, &m1, pprojection); @@ -1400,7 +1413,8 @@ D3DXVECTOR3* WINAPI D3DXVec3Unproject(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, vec.x = 2.0f * ( pv->x - pviewport->X ) / pviewport->Width - 1.0f; vec.y = 1.0f - 2.0f * ( pv->y - pviewport->Y ) / pviewport->Height; vec.z = ( pv->z - pviewport->MinZ) / ( pviewport->MaxZ - pviewport->MinZ ); - D3DXVec3TransformCoord(pout, &vec, &m3); + D3DXVec3TransformCoord(&out, &vec, &m3); + *pout = out; return pout; } @@ -1453,23 +1467,25 @@ D3DXVECTOR4* WINAPI D3DXVec4Hermite(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, C D3DXVECTOR4* WINAPI D3DXVec4Normalize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv) { + D3DXVECTOR4 out; FLOAT norm; norm = D3DXVec4Length(pv); if ( !norm ) { - pout->x = 0.0f; - pout->y = 0.0f; - pout->z = 0.0f; - pout->w = 0.0f; + out.x = 0.0f; + out.y = 0.0f; + out.z = 0.0f; + out.w = 0.0f; } else { - pout->x = pv->x / norm; - pout->y = pv->y / norm; - pout->z = pv->z / norm; - pout->w = pv->w / norm; + out.x = pv->x / norm; + out.y = pv->y / norm; + out.z = pv->z / norm; + out.w = pv->w / norm; } + *pout = out; return pout; }
1
0
0
0
David Adam : d3dx9_36: Fix failing tests in Windows.
by Alexandre Julliard
02 Feb '09
02 Feb '09
Module: wine Branch: master Commit: 3f1a7abf48fdf628a00ecbb236218398a6a75dc1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3f1a7abf48fdf628a00ecbb23…
Author: David Adam <david.adam.cnrs(a)gmail.com> Date: Sat Jan 31 12:04:55 2009 +0100 d3dx9_36: Fix failing tests in Windows. --- dlls/d3dx9_36/math.c | 8 ++++---- dlls/d3dx9_36/tests/math.c | 39 +++++++++++++++++++++++++++++++-------- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/dlls/d3dx9_36/math.c b/dlls/d3dx9_36/math.c index 13b8bd3..b8416c6 100644 --- a/dlls/d3dx9_36/math.c +++ b/dlls/d3dx9_36/math.c @@ -164,13 +164,13 @@ D3DXMATRIX* WINAPI D3DXMatrixTransformation2D( { sca.x=pscaling->x; sca.y=pscaling->y; - sca.z=0.0f; + sca.z=1.0f; } else { - sca.x=0.0f; - sca.y=0.0f; - sca.z=0.0f; + sca.x=1.0f; + sca.y=1.0f; + sca.z=1.0f; } if ( protationcenter ) diff --git a/dlls/d3dx9_36/tests/math.c b/dlls/d3dx9_36/tests/math.c index 50db67b..8a9c3e2 100644 --- a/dlls/d3dx9_36/tests/math.c +++ b/dlls/d3dx9_36/tests/math.c @@ -612,7 +612,7 @@ static void test_Matrix_Transformation2D(void) U(exp_mat).m[3][1] = -13.401899f; U(exp_mat).m[0][2] = 0.0f; U(exp_mat).m[1][2] = 0.0f; - U(exp_mat).m[2][2] = 0.0f; + U(exp_mat).m[2][2] = 1.0f; U(exp_mat).m[3][2] = 0.0f; U(exp_mat).m[0][3] = 0.0f; U(exp_mat).m[1][3] = 0.0f; @@ -635,17 +635,17 @@ static void test_Matrix_Transformation2D(void) sca_rot = 5.0f*D3DX_PI/4.0f; - U(exp_mat).m[0][0] = 0.0f; - U(exp_mat).m[1][0] = 0.0f; + U(exp_mat).m[0][0] = 0.50f; + U(exp_mat).m[1][0] = -0.866025f; U(exp_mat).m[2][0] = 0.0f; - U(exp_mat).m[3][0] = 2.830127f; - U(exp_mat).m[0][1] = 0.0f; - U(exp_mat).m[1][1] = 0.0f; + U(exp_mat).m[3][0] = -6.0f; + U(exp_mat).m[0][1] = 0.866025f; + U(exp_mat).m[1][1] = 0.50f; U(exp_mat).m[2][1] = 0.0f; - U(exp_mat).m[3][1] = 12.294229f; + U(exp_mat).m[3][1] = 7.0f; U(exp_mat).m[0][2] = 0.0f; U(exp_mat).m[1][2] = 0.0f; - U(exp_mat).m[2][2] = 0.0f; + U(exp_mat).m[2][2] = 1.0f; U(exp_mat).m[3][2] = 0.0f; U(exp_mat).m[0][3] = 0.0f; U(exp_mat).m[1][3] = 0.0f; @@ -655,6 +655,29 @@ static void test_Matrix_Transformation2D(void) D3DXMatrixTransformation2D(&got_mat, &sca_center, sca_rot, NULL, NULL, rot, &trans); expect_mat(&exp_mat, &got_mat); + +/*_________*/ + + U(exp_mat).m[0][0] = 0.50f; + U(exp_mat).m[1][0] = -0.866025f; + U(exp_mat).m[2][0] = 0.0f; + U(exp_mat).m[3][0] = 0.0f; + U(exp_mat).m[0][1] = 0.866025f; + U(exp_mat).m[1][1] = 0.50f; + U(exp_mat).m[2][1] = 0.0f; + U(exp_mat).m[3][1] = 0.0f; + U(exp_mat).m[0][2] = 0.0f; + U(exp_mat).m[1][2] = 0.0f; + U(exp_mat).m[2][2] = 1.0f; + U(exp_mat).m[3][2] = 0.0f; + U(exp_mat).m[0][3] = 0.0f; + U(exp_mat).m[1][3] = 0.0f; + U(exp_mat).m[2][3] = 0.0f; + U(exp_mat).m[3][3] = 1.0f; + + D3DXMatrixTransformation2D(&got_mat, NULL, sca_rot, NULL, NULL, rot, NULL); + + expect_mat(&exp_mat, &got_mat); } static void test_D3DXVec_Array(void)
1
0
0
0
Vincent Pelletier : dinput: Move gain support from effect to device.
by Alexandre Julliard
02 Feb '09
02 Feb '09
Module: wine Branch: master Commit: befb0a06b1477edbb399f29364ce3a4880a71839 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=befb0a06b1477edbb399f2936…
Author: Vincent Pelletier <plr.vincent(a)gmail.com> Date: Thu Jan 29 21:26:30 2009 +0100 dinput: Move gain support from effect to device. --- dlls/dinput/effect_linuxinput.c | 10 ++---- dlls/dinput/joystick_linuxinput.c | 37 +++++++++++++++++++++-- dlls/dinput/tests/joystick.c | 60 +++++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 10 deletions(-) diff --git a/dlls/dinput/effect_linuxinput.c b/dlls/dinput/effect_linuxinput.c index 155d800..b309af9 100644 --- a/dlls/dinput/effect_linuxinput.c +++ b/dlls/dinput/effect_linuxinput.c @@ -512,12 +512,6 @@ static HRESULT WINAPI LinuxInputEffectImpl_Start( } event.type = EV_FF; - - event.code = FF_GAIN; - event.value = This->gain; - if (write(*(This->fd), &event, sizeof(event)) == -1) - FIXME("Failed setting gain. Error: %d \"%s\".\n", errno, strerror(errno)); - event.code = This->effect.id; event.value = dwIterations; if (write(*(This->fd), &event, sizeof(event)) == -1) { @@ -627,8 +621,10 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters( /* Gain and Sample Period settings are not supported by the linux * event system */ - if (dwFlags & DIEP_GAIN) + if (dwFlags & DIEP_GAIN) { This->gain = 0xFFFF * peff->dwGain / 10000; + TRACE("Effect gain requested but no effect gain functionality present.\n"); + } if (dwFlags & DIEP_SAMPLEPERIOD) TRACE("Sample period requested but no sample period functionality present.\n"); diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index e1b92f7..c24ade9 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -194,6 +194,7 @@ struct JoystickImpl struct list ff_effects; int ff_state; int ff_autocenter; + int ff_gain; }; static void fake_current_js_state(JoystickImpl *ji); @@ -461,6 +462,7 @@ static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputIm Instead, track it with ff_autocenter, and assume it's initialy enabled. */ newDevice->ff_autocenter = 1; + newDevice->ff_gain = 0xFFFF; InitializeCriticalSection(&newDevice->base.crit); newDevice->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JoystickImpl*->base.crit"); @@ -670,12 +672,16 @@ static HRESULT WINAPI JoystickAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface) } else { + struct input_event event; + + event.type = EV_FF; + event.code = FF_GAIN; + event.value = This->ff_gain; + if (write(This->joyfd, &event, sizeof(event)) == -1) + ERR("Failed to set gain (%i): %d %s\n", This->ff_gain, errno, strerror(errno)); if (!This->ff_autocenter) { - struct input_event event; - /* Disable autocenter. */ - event.type = EV_FF; event.code = FF_AUTOCENTER; event.value = 0; if (write(This->joyfd, &event, sizeof(event)) == -1) @@ -974,6 +980,23 @@ static HRESULT WINAPI JoystickAImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface, fake_current_js_state(This); break; } + case (DWORD_PTR)DIPROP_FFGAIN: { + LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph; + + TRACE("DIPROP_FFGAIN(%d)\n", pd->dwData); + This->ff_gain = MulDiv(pd->dwData, 0xFFFF, 10000); + if (This->base.acquired) { + /* Update immediately. */ + struct input_event event; + + event.type = EV_FF; + event.code = FF_GAIN; + event.value = This->ff_gain; + if (write(This->joyfd, &event, sizeof(event)) == -1) + ERR("Failed to set gain (%i): %d %s\n", This->ff_gain, errno, strerror(errno)); + } + break; + } default: return IDirectInputDevice2AImpl_SetProperty(iface, rguid, ph); } @@ -1085,6 +1108,14 @@ static HRESULT WINAPI JoystickAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface, TRACE("autocenter(%d)\n", pd->dwData); break; } + case (DWORD_PTR) DIPROP_FFGAIN: + { + LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph; + + pd->dwData = MulDiv(This->ff_gain, 10000, 0xFFFF); + TRACE("DIPROP_FFGAIN(%d)\n", pd->dwData); + break; + } default: return IDirectInputDevice2AImpl_GetProperty(iface, rguid, pdiph); diff --git a/dlls/dinput/tests/joystick.c b/dlls/dinput/tests/joystick.c index 371f7ee..944dbb1 100644 --- a/dlls/dinput/tests/joystick.c +++ b/dlls/dinput/tests/joystick.c @@ -330,6 +330,7 @@ static BOOL CALLBACK EnumJoysticks( LONG cnt1, cnt2; HWND real_hWnd; HINSTANCE hInstance = GetModuleHandle(NULL); + DIPROPDWORD dip_gain_set, dip_gain_get; trace("Testing force-feedback\n"); memset(&eff, 0, sizeof(eff)); @@ -486,6 +487,65 @@ static BOOL CALLBACK EnumJoysticks( ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %08x\n", hr); hr = IDirectInputDevice2_GetProperty(pJoystick, DIPROP_AUTOCENTER, &diprop_word.diph); + /* Device gain (DIPROP_FFGAIN). + * From MSDN: + * 0..10000 range, otherwise DIERR_INVALIDPARAM. + * Can be changed even if device is acquired. + * Difference found by tests: + * <0 is refused, >10000 is accepted + */ + dip_gain_set.diph.dwSize = sizeof(DIPROPDWORD); + dip_gain_set.diph.dwHeaderSize = sizeof(DIPROPHEADER); + dip_gain_set.diph.dwObj = 0; + dip_gain_set.diph.dwHow = DIPH_DEVICE; + dip_gain_set.dwData = 10000; + dip_gain_get.diph.dwSize = sizeof(DIPROPDWORD); + dip_gain_get.diph.dwHeaderSize = sizeof(DIPROPHEADER); + dip_gain_get.diph.dwObj = 0; + dip_gain_get.diph.dwHow = DIPH_DEVICE; + dip_gain_get.dwData = 0; + + /* Test device is acquisition (non)impact. */ + hr = IDirectInputDevice_Unacquire(pJoystick); + ok(hr == DI_OK, "IDirectInputDevice_Unacquire() should have returned S_FALSE, got: %08x\n", hr); + dip_gain_set.dwData = 1; + hr = IDirectInputDevice_SetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_set.diph); + ok(hr==DI_OK, "IDirectInputDevice_SetProperty() failed: %08x\n", hr); + hr = IDirectInputDevice_GetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_get.diph); + ok(hr==DI_OK, "IDirectInputDevice_GetProperty() failed: %08x\n", hr); + ok(dip_gain_get.dwData==dip_gain_set.dwData, "Gain not udated: %i\n", dip_gain_get.dwData); + hr = IDirectInputDevice_Acquire(pJoystick); + ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %08x\n", hr); + dip_gain_set.dwData = 2; + hr = IDirectInputDevice_SetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_set.diph); + ok(hr==DI_OK, "IDirectInputDevice_SetProperty() failed: %08x\n", hr); + hr = IDirectInputDevice_GetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_get.diph); + ok(hr==DI_OK, "IDirectInputDevice_GetProperty() failed: %08x\n", hr); + ok(dip_gain_get.dwData==dip_gain_set.dwData, "Gain not udated: %i\n", dip_gain_get.dwData); + /* Test range and internal clamping. */ + dip_gain_set.dwData = -1; + hr = IDirectInputDevice_SetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_set.diph); + todo_wine ok(hr==DIERR_INVALIDPARAM, "IDirectInputDevice_SetProperty() should have returned %08x: %08x\n", DIERR_INVALIDPARAM, hr); + dip_gain_set.dwData = 0; + hr = IDirectInputDevice_SetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_set.diph); + ok(hr==DI_OK, "IDirectInputDevice_SetProperty() failed: %08x\n", hr); + hr = IDirectInputDevice_GetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_get.diph); + ok(hr==DI_OK, "IDirectInputDevice_GetProperty() failed: %08x\n", hr); + ok(dip_gain_get.dwData==dip_gain_set.dwData, "Gain not updated: %i\n", dip_gain_get.dwData); + dip_gain_set.dwData = 10000; + hr = IDirectInputDevice_SetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_set.diph); + ok(hr==DI_OK, "IDirectInputDevice_SetProperty() failed: %08x\n", hr); + hr = IDirectInputDevice_GetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_get.diph); + ok(hr==DI_OK, "IDirectInputDevice_GetProperty() failed: %08x\n", hr); + ok(dip_gain_get.dwData==dip_gain_set.dwData, "Gain not updated: %i\n", dip_gain_get.dwData); + /* WARNING: This call succeeds, on the contrary of what is stated on MSDN. */ + dip_gain_set.dwData = 10001; + hr = IDirectInputDevice_SetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_set.diph); + ok(hr==DI_OK, "IDirectInputDevice_SetProperty() failed: %08x\n", hr); + hr = IDirectInputDevice_GetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_get.diph); + ok(hr==DI_OK, "IDirectInputDevice_GetProperty() failed: %08x\n", hr); + ok(dip_gain_get.dwData==dip_gain_set.dwData, "Gain not updated: %i\n", dip_gain_get.dwData); + ref = IUnknown_Release(effect); ok(ref == 0, "IDirectInputDevice_Release() reference count = %d\n", ref); }
1
0
0
0
Michael Stefaniuc : jscript: Remove superfluous pointer casts.
by Alexandre Julliard
02 Feb '09
02 Feb '09
Module: wine Branch: master Commit: 981f733e41b3cc793c519de38dc8d5ac15c3dc97 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=981f733e41b3cc793c519de38…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Mon Feb 2 11:01:02 2009 +0100 jscript: Remove superfluous pointer casts. --- dlls/jscript/engine.c | 2 +- dlls/jscript/jscript.c | 10 +++++----- dlls/jscript/lex.c | 4 ++-- dlls/jscript/regexp.c | 16 ++++++++-------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index 423df46..05c6225 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -497,7 +497,7 @@ static HRESULT identifier_eval(exec_ctx_t *ctx, BSTR identifier, DWORD flags, ex } if(item) { - exprval_set_idref(ret, (IDispatch*)item->disp, id); + exprval_set_idref(ret, item->disp, id); return S_OK; } diff --git a/dlls/jscript/jscript.c b/dlls/jscript/jscript.c index bc182f4..de7cf96 100644 --- a/dlls/jscript/jscript.c +++ b/dlls/jscript/jscript.c @@ -44,11 +44,11 @@ typedef struct { parser_ctx_t *queue_tail; } JScript; -#define ACTSCRIPT(x) ((IActiveScript*) &(x)->lpIActiveScriptVtbl) -#define ASPARSE(x) ((IActiveScriptParse*) &(x)->lpIActiveScriptParseVtbl) -#define ASPARSEPROC(x) ((IActiveScriptParseProcedure2*) &(x)->lpIActiveScriptParseProcedure2Vtbl) -#define ACTSCPPROP(x) ((IActiveScriptProperty*) &(x)->lpIActiveScriptPropertyVtbl) -#define OBJSAFETY(x) ((IObjectSafety*) &(x)->lpIObjectSafetyVtbl) +#define ACTSCRIPT(x) ((IActiveScript*) &(x)->lpIActiveScriptVtbl) +#define ASPARSE(x) (&(x)->lpIActiveScriptParseVtbl) +#define ASPARSEPROC(x) (&(x)->lpIActiveScriptParseProcedure2Vtbl) +#define ACTSCPPROP(x) (&(x)->lpIActiveScriptPropertyVtbl) +#define OBJSAFETY(x) (&(x)->lpIObjectSafetyVtbl) void script_release(script_ctx_t *ctx) { diff --git a/dlls/jscript/lex.c b/dlls/jscript/lex.c index a937804..bf298bf 100644 --- a/dlls/jscript/lex.c +++ b/dlls/jscript/lex.c @@ -479,7 +479,7 @@ int parser_lex(void *lval, parser_ctx_t *ctx) if(ret) return ret; - return parse_identifier(ctx, (const WCHAR**)lval); + return parse_identifier(ctx, lval); } if(isdigitW(*ctx->ptr)) @@ -684,7 +684,7 @@ int parser_lex(void *lval, parser_ctx_t *ctx) case '\"': case '\'': - return parse_string_literal(ctx, (const WCHAR**)lval, *ctx->ptr); + return parse_string_literal(ctx, lval, *ctx->ptr); case '_': case '$': diff --git a/dlls/jscript/regexp.c b/dlls/jscript/regexp.c index c531f26..8ae2152 100644 --- a/dlls/jscript/regexp.c +++ b/dlls/jscript/regexp.c @@ -559,7 +559,7 @@ EmitREBytecode(CompilerState *state, JSRegExp *re, size_t treeDepth, emitStateSP->jumpToJumpFlag = FALSE; ++emitStateSP; assert((size_t)(emitStateSP - emitStateStack) <= treeDepth); - t = (RENode *) t->kid; + t = t->kid; op = t->op; assert(op < REOP_LIMIT); continue; @@ -572,7 +572,7 @@ EmitREBytecode(CompilerState *state, JSRegExp *re, size_t treeDepth, emitStateSP->continueOp = REOP_ENDALT; ++emitStateSP; assert((size_t)(emitStateSP - emitStateStack) <= treeDepth); - t = (RENode *) t->u.kid2; + t = t->u.kid2; op = t->op; assert(op < REOP_LIMIT); continue; @@ -676,7 +676,7 @@ EmitREBytecode(CompilerState *state, JSRegExp *re, size_t treeDepth, emitStateSP->jumpToJumpFlag = FALSE; ++emitStateSP; assert((size_t)(emitStateSP - emitStateStack) <= treeDepth); - t = (RENode *) t->kid; + t = t->kid; op = t->op; assert(op < REOP_LIMIT); continue; @@ -699,7 +699,7 @@ EmitREBytecode(CompilerState *state, JSRegExp *re, size_t treeDepth, while (t->next && t->next->op == REOP_FLAT && (WCHAR*)t->kid + t->u.flat.length == - (WCHAR*)t->next->kid) { + t->next->kid) { t->u.flat.length += t->next->u.flat.length; t->next = t->next->next; } @@ -727,7 +727,7 @@ EmitREBytecode(CompilerState *state, JSRegExp *re, size_t treeDepth, emitStateSP->continueOp = REOP_RPAREN; ++emitStateSP; assert((size_t)(emitStateSP - emitStateStack) <= treeDepth); - t = (RENode *) t->kid; + t = t->kid; op = t->op; continue; @@ -747,7 +747,7 @@ EmitREBytecode(CompilerState *state, JSRegExp *re, size_t treeDepth, emitStateSP->continueOp = REOP_ASSERTTEST; ++emitStateSP; assert((size_t)(emitStateSP - emitStateStack) <= treeDepth); - t = (RENode *) t->kid; + t = t->kid; op = t->op; continue; @@ -765,7 +765,7 @@ EmitREBytecode(CompilerState *state, JSRegExp *re, size_t treeDepth, emitStateSP->continueOp = REOP_ASSERTNOTTEST; ++emitStateSP; assert((size_t)(emitStateSP - emitStateStack) <= treeDepth); - t = (RENode *) t->kid; + t = t->kid; op = t->op; continue; @@ -793,7 +793,7 @@ EmitREBytecode(CompilerState *state, JSRegExp *re, size_t treeDepth, emitStateSP->continueOp = REOP_ENDCHILD; ++emitStateSP; assert((size_t)(emitStateSP - emitStateStack) <= treeDepth); - t = (RENode *) t->kid; + t = t->kid; op = t->op; continue;
1
0
0
0
Marcus Meissner : dmloader: Fixed some pointer read/write checks (Coverity) .
by Alexandre Julliard
02 Feb '09
02 Feb '09
Module: wine Branch: master Commit: 2aebb568a8ffb749b0249907f8b26c8fa83734d2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2aebb568a8ffb749b0249907f…
Author: Marcus Meissner <marcus(a)jet.franken.de> Date: Sat Jan 31 23:36:44 2009 +0100 dmloader: Fixed some pointer read/write checks (Coverity). --- dlls/dmloader/container.c | 28 +++++++--------------------- 1 files changed, 7 insertions(+), 21 deletions(-) diff --git a/dlls/dmloader/container.c b/dlls/dmloader/container.c index 081fcce..3cd166e 100644 --- a/dlls/dmloader/container.c +++ b/dlls/dmloader/container.c @@ -125,29 +125,15 @@ static HRESULT WINAPI IDirectMusicContainerImpl_IDirectMusicContainer_EnumObject TRACE("(%p, %s, %d, %p, %p)\n", This, debugstr_dmguid(rguidClass), dwIndex, pDesc, pwszAlias); - /* check if we can write to whole pDesc */ - if (pDesc) { - if (IsBadReadPtr (pDesc, sizeof(DWORD))) { - ERR(": pDesc->dwSize bad read pointer\n"); - return E_POINTER; - } - if (pDesc->dwSize != sizeof(DMUS_OBJECTDESC)) { - ERR(": invalid pDesc->dwSize\n"); - return E_INVALIDARG; - } - if (IsBadWritePtr (pDesc, sizeof(DMUS_OBJECTDESC))) { - ERR(": pDesc bad write pointer\n"); - return E_POINTER; - } - } - /* check if wszAlias is big enough */ - if (pwszAlias && IsBadWritePtr (pwszAlias, DMUS_MAX_FILENAME_SIZE)) { - ERR(": wszAlias bad write pointer\n"); - return E_POINTER; + if (!pDesc) + return E_POINTER; + if (pDesc->dwSize != sizeof(DMUS_OBJECTDESC)) { + ERR(": invalid pDesc->dwSize %d\n", pDesc->dwSize); + return E_INVALIDARG; } - + DM_STRUCT_INIT(pDesc); - + LIST_FOR_EACH (pEntry, This->pContainedObjects) { pContainedObject = LIST_ENTRY (pEntry, WINE_CONTAINER_ENTRY, entry);
1
0
0
0
← Newer
1
...
90
91
92
93
94
95
96
97
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
Results per page:
10
25
50
100
200