http://bugs.winehq.org/show_bug.cgi?id=30786
Bug #: 30786 Summary: King's Bounty: Armored Princess and Crossworlds need d3dx9_36.dll.D3DXQuaternionSquadSetup Product: Wine Version: 1.5.5 Platform: x86 OS/Version: Linux Status: NEW Severity: minor Priority: P2 Component: directx-d3dx9 AssignedTo: wine-bugs@winehq.org ReportedBy: gyebro69@gmail.com CC: wine-bugs@winehq.org Classification: Unclassified
Created attachment 40313 --> http://bugs.winehq.org/attachment.cgi?id=40313 terminal output
Now that bug #24725 has been fixed, I tried the other King's Bounty games (Armored Princess and it's expansion Crossworlds), using only native d3dx9 dlls. With Wine 1.5.5 both games crash on startup with
wine: Call from 0x7b839b42 to unimplemented function d3dx9_36.dll.D3DXQuaternionSquadSetup, aborting
Native d3dx9_36.dll is a workaround.
There is a demo for KB:AP available on Steam: http://store.steampowered.com/app/3170
Other, non-Steam demos can be found elsewhere on the net, but they're protected with Starforce as far as I remember from my previous testings.
http://bugs.winehq.org/show_bug.cgi?id=30786
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download URL| | | |http://store.steampowered.c | |om/app/3170
http://bugs.winehq.org/show_bug.cgi?id=30786
--- Comment #1 from Michael Mc Donnell michael@mcdonnell.dk 2012-06-06 16:45:33 CDT --- Created attachment 40418 --> http://bugs.winehq.org/attachment.cgi?id=40418 Patch for D3DXQuaternionSquadSetup stub
Does this patch help?
http://bugs.winehq.org/show_bug.cgi?id=30786
Michael Mc Donnell michael@mcdonnell.dk changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |michael@mcdonnell.dk
http://bugs.winehq.org/show_bug.cgi?id=30786
joaopa jeremielapuree@yahoo.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeremielapuree@yahoo.fr
--- Comment #2 from joaopa jeremielapuree@yahoo.fr 2012-06-06 23:05:58 CDT --- Does it happem with the demo http://www.jeuxvideopc.com/demo/43604-princess-in-armor.php
http://bugs.winehq.org/show_bug.cgi?id=30786
--- Comment #3 from nozomi kodama nozomi.kodama@yahoo.com 2012-06-06 23:25:04 CDT --- Created attachment 40421 --> http://bugs.winehq.org/attachment.cgi?id=40421 Implemention od D3DXQuaternionSquadSetup
Can you try this patch?
I tested it in Vista and it worked very well.
That's my first real patch for Wine, so don't be rude with me if I did something wrong. ....
http://bugs.winehq.org/show_bug.cgi?id=30786
--- Comment #4 from nozomi kodama nozomi.kodama@yahoo.com 2012-06-06 23:26:26 CDT --- Comment on attachment 40421 --> http://bugs.winehq.org/attachment.cgi?id=40421 Implemention od D3DXQuaternionSquadSetup
From 667f9f7e55d1e1505f6af2d557f891b6b6575a31 Mon Sep 17 00:00:00 2001 From: Nozomi Kodama Nozomi.Kodama@yahoo.com Date: Thu, 7 Jun 2012 13:16:16 +0800 Subject: Implement D3DXQuaternionSquadSetup
dlls/d3dx9_36/d3dx9_36.spec | 2 +- dlls/d3dx9_36/math.c | 76 +++++++++++++++++++++++++++++++++++++++++++ include/d3dx9math.h | 1 + 3 files changed, 78 insertions(+), 1 deletions(-)
diff --git a/dlls/d3dx9_36/d3dx9_36.spec b/dlls/d3dx9_36/d3dx9_36.spec index 8d7143e..2fbd403 100644 --- a/dlls/d3dx9_36/d3dx9_36.spec +++ b/dlls/d3dx9_36/d3dx9_36.spec @@ -252,7 +252,7 @@ @ stdcall D3DXQuaternionRotationYawPitchRoll(ptr float float float) @ stdcall D3DXQuaternionSlerp(ptr ptr ptr float) @ stdcall D3DXQuaternionSquad(ptr ptr ptr ptr ptr float) -@ stub D3DXQuaternionSquadSetup(ptr ptr ptr ptr ptr ptr ptr) +@ stdcall D3DXQuaternionSquadSetup(ptr ptr ptr ptr ptr ptr ptr) @ stdcall D3DXQuaternionToAxisAngle(ptr ptr ptr) @ stub D3DXRectPatchSize(ptr ptr ptr) @ stub D3DXSaveMeshHierarchyToFileA(ptr long ptr ptr ptr) diff --git a/dlls/d3dx9_36/math.c b/dlls/d3dx9_36/math.c index 10a6cb9..38e44f5 100644 --- a/dlls/d3dx9_36/math.c +++ b/dlls/d3dx9_36/math.c @@ -1375,6 +1375,82 @@ D3DXQUATERNION* WINAPI D3DXQuaternionSquad(D3DXQUATERNION *pout, CONST D3DXQUATE return pout; }
+static D3DXQUATERNION sum(D3DXQUATERNION q1, D3DXQUATERNION q2) +{
- D3DXQUATERNION temp;
- temp.x = q1.x + q2.x;
- temp.y = q1.y + q2.y;
- temp.z = q1.z + q2.z;
- temp.w = q1.w + q2.w;
- return temp;
+}
+static D3DXQUATERNION diff(D3DXQUATERNION q1, D3DXQUATERNION q2) +{
- D3DXQUATERNION temp;
- temp.x = q1.x - q2.x;
- temp.y = q1.y - q2.y;
- temp.z = q1.z - q2.z;
- temp.w = q1.w - q2.w;
- return temp;
+}
+void WINAPI D3DXQuaternionSquadSetup(D3DXQUATERNION *paout, D3DXQUATERNION *pbout, D3DXQUATERNION *pcout, CONST D3DXQUATERNION *pq0, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, CONST D3DXQUATERNION *pq3) +{
- D3DXQUATERNION pqt0, pqt1, pqt2, pqt3, q1, q2, temp, temp0, temp2, temp3, zero;
- zero.x = 0.0f;
- zero.y = 0.0f;
- zero.z = 0.0f;
- zero.w = 0.0f;
- pqt0 = *pq0;
- pqt1 = *pq1;
- pqt2 = *pq2;
- pqt3 = *pq3;
- q1 = sum(pqt0, pqt1);
- q2 = diff(pqt0, pqt1);
- if( D3DXQuaternionLengthSq(&q1) < D3DXQuaternionLengthSq(&q2) ) temp0 = diff(zero, pqt0);
- else temp0 = pqt0;
- q1 = sum(pqt1, pqt2);
- q2 = diff(pqt1, pqt2);
- if( D3DXQuaternionLengthSq(&q1) < D3DXQuaternionLengthSq(&q2) ) temp2 = diff(zero, pqt2);
- else temp2 = pqt2;
- q1 = sum(pqt2, pqt3);
- q2 = diff(pqt2, pqt3);
- if( D3DXQuaternionLengthSq(&q1) < D3DXQuaternionLengthSq(&q2) ) temp3 = diff(zero, pqt3);
- else temp3 = pqt3;
- D3DXQuaternionInverse(&temp, &pqt1);
- D3DXQuaternionMultiply(&q1, &temp, &temp0);
- D3DXQuaternionLn(&q1, &q1);
- D3DXQuaternionMultiply(&q2, &temp, &temp2);
- temp = sum(q1, q2);
- temp.x *= -0.25f; temp.y *= -0.25f; temp.z *= -0.25f; temp.w *= -0.25f;
- D3DXQuaternionExp(&temp, &temp);
- D3DXQuaternionMultiply(paout, &pqt1, &temp);
- D3DXQuaternionInverse(&temp, &temp2);
- D3DXQuaternionMultiply(&q1, &temp, &pqt1);
- D3DXQuaternionLn(&q1, &q1);
- D3DXQuaternionMultiply(&q2, &temp, &temp3);
- temp = sum(q1, q2);
- temp.x *= -0.25f; temp.y *= -0.25f; temp.z *= -0.25f; temp.w *= -0.25f;
- D3DXQuaternionExp(&temp, &temp);
- D3DXQuaternionMultiply(pbout, &temp2, &temp);
- *pcout = temp2;
- return;
+}
void WINAPI D3DXQuaternionToAxisAngle(CONST D3DXQUATERNION *pq, D3DXVECTOR3 *paxis, FLOAT *pangle) { paxis->x = pq->x; diff --git a/include/d3dx9math.h b/include/d3dx9math.h index c31b652..a1fd70a 100644 --- a/include/d3dx9math.h +++ b/include/d3dx9math.h @@ -337,6 +337,7 @@ D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix(D3DXQUATERNION *pout, CONST D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll(D3DXQUATERNION *pout, FLOAT yaw, FLOAT pitch, FLOAT roll); D3DXQUATERNION* WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, FLOAT t); D3DXQUATERNION* WINAPI D3DXQuaternionSquad(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, CONST D3DXQUATERNION *pq3, CONST D3DXQUATERNION *pq4, FLOAT t); +void WINAPI D3DXQuaternionSquadSetup(D3DXQUATERNION *paout, D3DXQUATERNION *pbout, D3DXQUATERNION *pcout, CONST D3DXQUATERNION *pq0, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, CONST D3DXQUATERNION *pq3); void WINAPI D3DXQuaternionToAxisAngle(CONST D3DXQUATERNION *pq, D3DXVECTOR3 *paxis, FLOAT *pangle);
D3DXVECTOR2* WINAPI D3DXVec2BaryCentric(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pv3, FLOAT f, FLOAT g);
1.7.9
http://bugs.winehq.org/show_bug.cgi?id=30786
--- Comment #5 from Michael Mc Donnell michael@mcdonnell.dk 2012-06-07 07:46:20 CDT --- (In reply to comment #4)
Comment on attachment 40421 [details] Implemention od D3DXQuaternionSquadSetup
Please don't include your whole patch as a comment. It clutters the thread.
The patch looks pretty good to me. You need a test though. Do you need any directions?
http://bugs.winehq.org/show_bug.cgi?id=30786
--- Comment #6 from GyB gyebro69@gmail.com 2012-06-07 11:47:50 CDT --- Michael, Nozomi, thanks both of you for contributing your patches. Both patches do the job and the games can be started without crashing. Some minor issues remain though: 1. with Michael's patch the animated background scenery in the main menu is flickering in and out. With nozomi's patch the animated background scenery is missing completely. 2. with Michael's patch the intro video is showing only a red screen when I start a new game. With nozomi's patch the intro video shows a red screen for a second or two, then video begins to play correctly.
Does it happem with the demo
http://www.jeuxvideopc.com/demo/43604-princess-in-armor.php
the demo fails to install for me: 'Setup files are corrupted...'
http://bugs.winehq.org/show_bug.cgi?id=30786
nozomi kodama nozomi.kodama@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |nozomi.kodama@yahoo.com
--- Comment #7 from nozomi kodama nozomi.kodama@yahoo.com 2012-06-07 12:53:23 CDT --- Could you attach the console output with the following command: WINEDEBUG=+d3dx wine xxxxx.exe.
http://bugs.winehq.org/show_bug.cgi?id=30786
--- Comment #8 from GyB gyebro69@gmail.com 2012-06-07 13:16:15 CDT --- Created attachment 40434 --> http://bugs.winehq.org/attachment.cgi?id=40434 KBAP +d3dx debug log (nozomi's patch applied)
The log contains traces when Armored Princess is loaded to the main menu, where the animated background image is missing.
http://bugs.winehq.org/show_bug.cgi?id=30786
nozomi kodama nozomi.kodama@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #40421|0 |1 is obsolete| |
--- Comment #9 from nozomi kodama nozomi.kodama@yahoo.com 2012-06-08 01:03:10 CDT --- Created attachment 40442 --> http://bugs.winehq.org/attachment.cgi?id=40442 patch with some more traces
Could you give a try to this patch?
Please, enable the winedebug d3dx channel.
http://bugs.winehq.org/show_bug.cgi?id=30786
--- Comment #10 from GyB gyebro69@gmail.com 2012-06-08 09:27:44 CDT --- Created attachment 40447 --> http://bugs.winehq.org/attachment.cgi?id=40447 +d3dx updated log
An updated log with the patch in comment #9 applied.
http://bugs.winehq.org/show_bug.cgi?id=30786
nozomi kodama nozomi.kodama@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #40442|0 |1 is obsolete| |
--- Comment #11 from nozomi kodama nozomi.kodama@yahoo.com 2012-06-08 10:55:41 CDT --- Created attachment 40449 --> http://bugs.winehq.org/attachment.cgi?id=40449 Implement D3DXQuaternionSquadSetup and trace input and output
Can you try this one? The previous one did not help.
http://bugs.winehq.org/show_bug.cgi?id=30786
GyB gyebro69@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #40434|0 |1 is obsolete| | Attachment #40447|0 |1 is obsolete| |
--- Comment #12 from GyB gyebro69@gmail.com 2012-06-08 11:23:39 CDT --- Created attachment 40450 --> http://bugs.winehq.org/attachment.cgi?id=40450 +d3dx log
http://bugs.winehq.org/show_bug.cgi?id=30786
--- Comment #13 from nozomi kodama nozomi.kodama@yahoo.com 2012-06-08 11:47:04 CDT ---
0053:trace:d3dx:D3DXQuaternionLn pq = (0.000000, 0.000000, 0.000000, 1.000000) 0053:trace:d3dx:D3DXQuaternionLn Norm = 1.000000 0053:trace:d3dx:D3DXQuaternionLn pout = (-nan, -nan, -nan, 0.000000)
I just tested in Vista. We obtain pout=(0.0f, 0.0f, 0.0f, 0.0f). As expected, the problem is not in my patch but in D3DXQuaternionLn.
http://bugs.winehq.org/show_bug.cgi?id=30786
--- Comment #14 from Michael Mc Donnell michael@mcdonnell.dk 2012-06-08 11:55:47 CDT --- (In reply to comment #11)
Created attachment 40449 [details] Implement D3DXQuaternionSquadSetup and trace input and output
Nozomi, just a small nitpick, why do you make these extra non-constant variables?:
+ pqt0 = *pq0; + pqt1 = *pq1; + pqt2 = *pq2; + pqt3 = *pq3;
The functions you are calling could just as well use pq0, pq1,...
http://bugs.winehq.org/show_bug.cgi?id=30786
--- Comment #15 from Michael Mc Donnell michael@mcdonnell.dk 2012-06-08 12:42:30 CDT --- Created attachment 40451 --> http://bugs.winehq.org/attachment.cgi?id=40451 Adds D3DXQuaternionLn edge case to test
(In reply to comment #13)
0053:trace:d3dx:D3DXQuaternionLn pq = (0.000000, 0.000000, 0.000000, 1.000000) 0053:trace:d3dx:D3DXQuaternionLn Norm = 1.000000 0053:trace:d3dx:D3DXQuaternionLn pout = (-nan, -nan, -nan, 0.000000)
I just tested in Vista. We obtain pout=(0.0f, 0.0f, 0.0f, 0.0f). As expected, the problem is not in my patch but in D3DXQuaternionLn.
Great! I've create a patch with the test case. I'll send it to wine-patches.
http://bugs.winehq.org/show_bug.cgi?id=30786
nozomi kodama nozomi.kodama@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #40449|0 |1 is obsolete| |
--- Comment #16 from nozomi kodama nozomi.kodama@yahoo.com 2012-06-09 00:12:46 CDT --- Created attachment 40454 --> http://bugs.winehq.org/attachment.cgi?id=40454 Implement D3DXQuaternionSquadSetup and fix for D3DXQuaternionLn
Can you try the following patch? I added a fix for D3DXQuaternionLn. I hope that it will fix the first video problem.
http://bugs.winehq.org/show_bug.cgi?id=30786
--- Comment #17 from GyB gyebro69@gmail.com 2012-06-09 01:09:20 CDT --- (In reply to comment #16)
Created attachment 40454 [details] Implement D3DXQuaternionSquadSetup and fix for D3DXQuaternionLn
Can you try the following patch? I added a fix for D3DXQuaternionLn. I hope that it will fix the first video problem.
Thanks, the patch indeed fixes the remaining issues (missing background animation in the main menu as well as the red screen issue when the opening movie begins to play).
http://bugs.winehq.org/show_bug.cgi?id=30786
--- Comment #18 from Michael Mc Donnell michael@mcdonnell.dk 2012-06-09 09:47:45 CDT --- (In reply to comment #16)
Created attachment 40454 [details] Implement D3DXQuaternionSquadSetup and fix for D3DXQuaternionLn
Can you try the following patch? I added a fix for D3DXQuaternionLn. I hope that it will fix the first video problem.
Super! Your D3DXQuaternionLn also fixes an older wine_todo test case. You need to split up the changes into two separate patches before submitting them (to make regression testing easier).
I've sent the patch for one of the test cases, so you should probably wait until that one has been committed, rebase on op of the change, and then remove the wine_todo in tests/math.c for D3DXQuaternionLn. You can run the tests by running the following command in the dlls/d3dx9_36/tests directory:
../../../tools/runtest -M kernel32.dll -T ../../.. -p d3dx9_36_test.exe.so math
http://bugs.winehq.org/show_bug.cgi?id=30786
Alexey Loukianov mooroon2@mail.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mooroon2@mail.ru
http://bugs.winehq.org/show_bug.cgi?id=30786
--- Comment #19 from GyB gyebro69@gmail.com 2012-06-13 10:27:54 CDT --- Created attachment 40528 --> http://bugs.winehq.org/attachment.cgi?id=40528 KBAP:Orcs +d3dx log (nozomi's patch applied)
I found another problem while testing King's Bounty:Crossworlds with Nozomi's latest patch. I'm not sure if it is due to the patch or another problem in Wine's d3dx9_36 implementation. Native d3dx9_36.dll works around the problem though. KB:Crossworlds contains the base game (Armored Princess) + 2 new campaigns + 1 new expansion (Orcs on the March). The problem appears only when the Orcs expansion is loaded. The base game as well as the 2 campaigns are free from the problem.
The problem: when I open the <Load game> option in the main menu of the Orcs expansion, Wine throws an error message: 'Application aborted! .\gui_lib_texture.cpp(40): DirectX call failed: -1, -1, code=0x88760b59 (-2005529767)'. The game is still running but the screen stays black afterwards.
http://bugs.winehq.org/show_bug.cgi?id=30786
--- Comment #20 from nozomi kodama nozomi.kodama@yahoo.com 2012-06-13 12:00:00 CDT --- Created attachment 40529 --> http://bugs.winehq.org/attachment.cgi?id=40529 hackish patch
Quaternion is not related to texture. So I don't think that my patch is related. It is a another problem.
To check that, can you test this hackish patch? The expected behaviour is the game loading with wrong colors.
warn:d3dx:dds_rgb_to_d3dformat Unknown RGB pixel format (0xff, 0xff00, 0xff0000, 0xff000000)
is likely the problem.
http://bugs.winehq.org/show_bug.cgi?id=30786
--- Comment #21 from GyB gyebro69@gmail.com 2012-06-13 13:11:01 CDT --- (In reply to comment #20)
Created attachment 40529 [details] hackish patch
Quaternion is not related to texture. So I don't think that my patch is related. It is a another problem.
I see...otherwise your Quaternion patch works well with this game.
To check that, can you test this hackish patch? The expected behaviour is the game loading with wrong colors.
The hack makes the error message go away and the load screen appears as it should. As for weird colors, it took some time until I realized that blue and yellow colors are reversed in some of the game icons, buttons.
http://bugs.winehq.org/show_bug.cgi?id=30786
nozomi kodama nozomi.kodama@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #40529|0 |1 is obsolete| |
--- Comment #22 from nozomi kodama nozomi.kodama@yahoo.com 2012-06-13 13:42:41 CDT --- Created attachment 40534 --> http://bugs.winehq.org/attachment.cgi?id=40534 Reckonize A8B8G8R8 format
This should fix the problem of colors.
http://bugs.winehq.org/show_bug.cgi?id=30786
GyB gyebro69@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |ed7c28353dd9bdf2b49cba6ddae | |09f0dde6fb5b3 Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #23 from GyB gyebro69@gmail.com 2012-06-14 21:44:16 CDT --- D3DXQuaternionSquadSetup is now implemented in Wine.
http://source.winehq.org/git/wine.git/commitdiff/ed7c28353dd9bdf2b49cba6ddae...
http://bugs.winehq.org/show_bug.cgi?id=30786
--- Comment #24 from nozomi kodama nozomi.kodama@yahoo.com 2012-06-14 23:59:10 CDT --- Does my patch for the missing format fix the problem of colours?
http://bugs.winehq.org/show_bug.cgi?id=30786
--- Comment #25 from GyB gyebro69@gmail.com 2012-06-15 10:40:42 CDT --- (In reply to comment #24)
Does my patch for the missing format fix the problem of colours?
Yes, it does...I have so little free time nowadays that I can hardly keep up with the changes in Wine and I forgot to respond to your comment #22 including this patch. Sorry about that. Should I file a new bug report for the crash issue in the Orcs expansion to get this patch accepted in Wine?
http://bugs.winehq.org/show_bug.cgi?id=30786
--- Comment #26 from nozomi kodama nozomi.kodama@yahoo.com 2012-06-15 11:41:40 CDT --- No problem for the delay. I do not know the Wine policy for tthis.
What I understood is: one bug by report.
So, maybe it is better to open a new bug report for the colour problem.
http://bugs.winehq.org/show_bug.cgi?id=30786
Matteo Bruni matteo.mystral@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |matteo.mystral@gmail.com
--- Comment #27 from Matteo Bruni matteo.mystral@gmail.com 2012-06-15 11:48:31 CDT --- (In reply to comment #26)
No problem for the delay. I do not know the Wine policy for tthis.
What I understood is: one bug by report.
So, maybe it is better to open a new bug report for the colour problem.
Well, you can also just send the patch (but fix the formatting first), it looks "obviously correct"...
http://bugs.winehq.org/show_bug.cgi?id=30786
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #28 from Alexandre Julliard julliard@winehq.org 2012-06-22 13:30:29 CDT --- Closing bugs fixed in 1.5.7.
https://bugs.winehq.org/show_bug.cgi?id=30786
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- URL| |http://store.steampowered.c |http://store.steampowered.c |om/app/3170 |om/app/3170 | CC| |focht@gmx.net