Direct3D 11 via DDraw.dll

A Forum dedicated to the Suggestion, Creation and Editing of XWA Dynamic Link Library Files

Moderator: JeremyaFr

Post Reply

Re: Direct3D 11 via DDraw.dll

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Fri Sep 21, 2018 12:23 pm

UPDATE
Hello,
I've updated my ddraw.dll v1.3.2.

The changes are:
  • Fix app hang
https://github.com/JeremyAnsel/xwa_ddra ... tag/v1.3.2

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Fri Sep 21, 2018 1:07 pm

Nothing against Reimars version of DDraw, but I'm going to revert back to using Jeremy's versions of DDraw for the XWAUCP and DSUCP now that he has Set CPU affinity to single core, plus it's specifically for XWA and not for any of the other X-Wing games.

Also Reimar hasn't been seen around here since June, so I don't see any update from him anytime soon.

Jeremy, one quick question, So none of your DLL files are still dependent of having Visual C++ 2013 Runtime files installed, correct?
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Fri Sep 21, 2018 2:39 pm

It's correct. All my DLLs are no longer dependent on the Visual C++ Runtime.

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Fri Sep 21, 2018 2:53 pm

Brilliant thanks :) I can remove vcredist_x86.exe :)

Thanks
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

Reimar
Cadet 1st Class
Posts: 239
Joined: Mon Jan 19, 2009 11:45 am

Post by Reimar » Mon Sep 24, 2018 8:46 am

I am still around, but I don't have any new information to act on or anything that would allow me to fix or do anything about the issues reported so far.
There was a question around refresh rate limit, I am not sure what is missing, but there is the RefreshLimit option in the ddraw.cfg at least.
Also if anyone wants to reach me the quickest way is a PM or via the github issues page.

Reimar
Cadet 1st Class
Posts: 239
Joined: Mon Jan 19, 2009 11:45 am

Post by Reimar » Tue Oct 02, 2018 2:49 pm

Made a new release that includes JeremyaFr's fixes to his version.
For the reported hangs/crashes I expect it should fix (most of?) those.
Not so sure about the reports about slowness, the change to default MSAA to off might help with some, but probably not all.

bazr
Cadet 4th Class
Posts: 12
Joined: Tue Sep 30, 2014 5:06 am

Post by bazr » Mon Dec 03, 2018 10:01 pm

I'm thankful and greatly appreciate the DDraw update. It definitely works better than Dgvoodoo especially on lower spec machines and I use Reimar's version too for xvt and the 98 games. I've noticed there is a mouse and keyboard option in the cfg and as someone who uses mouse and keyboard already with third party software (like ppjoy and glove pie or vjoy and freepie) I was wondering if it would be possible to have an option where the mouse and keyboard worked like in the dos versions of x-wing and tie fighter.
So the mouse returns to 0 movement after several ms instead of the mouse direction continuing until it is moved again like it currently does now. Not that you would probably need it but I have a glovepie cfg and a more recent freepie cfg (which uses python) that I use currently that seems to have it very close to dos movement and it properly blends in with the keyboard movement instead of an either/or situation which you would be welcome to use.
I would appreciate it alot if that was implemented at some point and I can finally do away with virtual joysticks and PIEs :)

Reimar
Cadet 1st Class
Posts: 239
Joined: Mon Jan 19, 2009 11:45 am

Post by Reimar » Sat Dec 08, 2018 1:32 pm

Mouse and keyboard are already additive, you can use both at the same time.
For the mouse to be honest I just don't know what would be a good way to handle it. Just hard-resetting to centered after some time doesn't really seem like it would work well to me?
If you can describe the algorithm used by by your current setup in more detail I might give implementing that a try.

bazr
Cadet 4th Class
Posts: 12
Joined: Tue Sep 30, 2014 5:06 am

Post by bazr » Sat Dec 08, 2018 7:10 pm

If you have the DOS version of x-wing or tie fighter it is the same mouse movement in that. So you would be using the arrows or a joystick for fast movement and the mouse for precise smaller movements. What I mean by additive is say you're pressing the key to pitch up but you have some analogue movement from the mouse to pitch down that could blend instead of the pitch up key cancelling out the movement on that axis altogether for the mouse.

I have a few programs here that I use which will become clear when you try them. Glovepie is the one I use but vjoy and freepie should work just as well to show how I have the movement setup. There is also a mousetojoystick exe that works with vjoy simply by double right clicking once opened which works almost the same.

https://1drv.ms/u/s!AjpBtLscBphqhGyP2Kh0NRFOvMYK

If you have any questions let me know here or on discord, https://discord.gg/CS98DX

Thanks.

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Dec 22, 2018 4:06 pm

UPDATE
Hello,
I've updated my ddraw.dll v1.3.3.

The changes are:
  • Improve performance
The performance is a bit improved.

https://github.com/JeremyAnsel/xwa_ddra ... tag/v1.3.3

Justagai
Cadet 1st Class
Posts: 218
Joined: Mon Dec 08, 2014 10:59 pm

Post by Justagai » Sat Dec 22, 2018 5:55 pm

JeremyaFr wrote:
Sat Dec 22, 2018 4:06 pm
UPDATE
Hello,
I've updated my ddraw.dll v1.3.3.

The changes are:
  • Improve performance
The performance is a bit improved.

https://github.com/JeremyAnsel/xwa_ddra ... tag/v1.3.3
Awesome, thanks.

I wonder if it helps with the frame loss when targeting a large object with 60FPS? I've noticed that turning off antialiasing in the ddraw config fixes that.

On another note, I've noticed that Reimar's ddraw doesn't have issues with freezing in the hangar while alt+tabbed if the fullscreen option is set to 1 in the config. I'm not knowledgeable with the directdraw api so I'm not sure why its happening. It's much harder to alt+tab between windows with the option on though (but still possible).

Here is the code for the fullscreen option in case you were curious.

Code: Select all

if (SUCCEEDED(hr))
			{
				this->_refreshRate = sd.BufferDesc.RefreshRate;
				if (g_config.Fullscreen == 1)
				{
					// A separate SetFullscreenState is recommended
					// as setting Windowed to FALSE during creation
					// just triggers bugs all over
					this->_swapChain->SetFullscreenState(TRUE, NULL);
				}
			}
EDIT: I forgot to mention Reimar's ddraw in windowed mode outright crashes the game in the hangar. I'll try to get some event viewer logs uploaded later.

Justagai
Cadet 1st Class
Posts: 218
Joined: Mon Dec 08, 2014 10:59 pm

Post by Justagai » Sun Dec 23, 2018 8:40 am

Here are the event viewer logs for when it crashes with windowed mode.

Code: Select all

Fault bucket 2190073609135542273, type 1
Event Name: APPCRASH
Response: Not available
Cab Id: 0

Problem signature:
P1: XWINGALLIANCE.EXE
P2: 2.0.0.2
P3: 3765a9b7
P4: USER32.dll
P5: 10.0.17134.376
P6: beaa4463
P7: c00000fd
P8: 00026fbb
P9: 
P10: 

Attached files:
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER580F.tmp.mdmp
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER5919.tmp.WERInternalMetadata.xml
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER593A.tmp.xml
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER5938.tmp.csv
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER5968.tmp.txt

These files may be available here:
C:\ProgramData\Microsoft\Windows\WER\ReportArchive\AppCrash_XWINGALLIANCE.EX_c34baadb551e52cfaa9894932c60de31f6ef6_6099397f_32015c06

Analysis symbol: 
Rechecking for solution: 0
Report Id: de2060d5-b4ac-4f55-8160-d2b10b05b3e9
Report Status: 268435456
Hashed bucket: aaa91bab2fb1fbc4ee64b458107b5001
Cab Guid: 0

Code: Select all

Faulting application name: XWINGALLIANCE.EXE, version: 2.0.0.2, time stamp: 0x3765a9b7
Faulting module name: USER32.dll, version: 10.0.17134.376, time stamp: 0xbeaa4463
Exception code: 0xc00000fd
Fault offset: 0x00026fbb
Faulting process id: 0x22f0
Faulting application start time: 0x01d49a9ac72ad9ef
Faulting application path: D:\GOG Games\Star Wars - X-Wing Alliance\XWINGALLIANCE.EXE
Faulting module path: C:\WINDOWS\System32\USER32.dll
Report Id: de2060d5-b4ac-4f55-8160-d2b10b05b3e9
Faulting package full name: 
Faulting package-relative application ID: 

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sun Dec 23, 2018 1:07 pm

Hello,
I've reported the issue to Reimar:
https://github.com/rdoeffinger/xwa_ddraw_d3d11/issues/4

Justagai
Cadet 1st Class
Posts: 218
Joined: Mon Dec 08, 2014 10:59 pm

Post by Justagai » Sun Dec 23, 2018 8:59 pm

Cool, thanks!

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Dec 29, 2018 5:17 pm

UPDATE
Hello,
I've updated my ddraw.dll v1.3.4.

The changes are:
  • Improve performance when using XwaHacker's 32 bit rendering
The performance is a bit improved.

https://github.com/JeremyAnsel/xwa_ddra ... tag/v1.3.4

Justagai
Cadet 1st Class
Posts: 218
Joined: Mon Dec 08, 2014 10:59 pm

Post by Justagai » Sun Dec 30, 2018 5:41 pm

I realized I had an outdated version of the ddraw and I've updated to your latest version Jeremy. I don't get any hang on alt+tabbing in the hangar. In addition, I've confirmed that the performance tweak solved the frame drop issue with targeting large objects with 60FPS. I've also confirmed that 32-bit rendering doesn't give me a black screen when I target large objects. Great work!

I apologize for the earlier reports as they were made with an older version. I'm behind the times :(

Reimar
Cadet 1st Class
Posts: 239
Joined: Mon Jan 19, 2009 11:45 am

Post by Reimar » Mon Dec 31, 2018 12:08 am

Windowed mode crash fixed, and JeremyaFr's changes merged in the latest version of my fork.
However I noticed that the XWAHacker 32 bit mode is simply broken (and has been for a long time) with my fork at least on Intel GPUs, the "black screen when targeting things" sounds like the same issue. On the plus side, there isn't much of point in enabling that 32-bit mode when using the dll, but unfortunately it's the default for the GoG and Steam binaries...

Justagai
Cadet 1st Class
Posts: 218
Joined: Mon Dec 08, 2014 10:59 pm

Post by Justagai » Mon Dec 31, 2018 1:24 am

Awesome stuff Reimar!

Bman
Lieutenant Commander
Posts: 1167
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Mon Dec 31, 2018 6:00 am

Great.
Last edited by Bman on Wed Jan 02, 2019 7:21 am, edited 2 times in total.
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Mon Dec 31, 2018 10:33 am

Reimar wrote:
Mon Dec 31, 2018 12:08 am
On the plus side, there isn't much of point in enabling that 32-bit mode when using the dll, but unfortunately it's the default for the GoG and Steam binaries...
This only applies if your playing vanilla versions of GOG or Steam, when either the DSUCP or XWACP are installed, they backup the GOG or Steam versions of xwingalliance.exe and replaces them with the original unmodified disc version of the xwingalliance.exe, so you basically you have a blank canvas to work with and then modifications are applied, but leaving out the

Force 800 mode = Forces X-Wing Alliance to always use the 800x600 mode. (Horrible patch, why this was applied or even thought of, I have no idea, the person or persons (Reimer) should be shot lol :D )
Fix Z Clear = Fixes disappearing objects in X-Wing Alliance. (I believe this is solved by using JeremyaFr's hooks)
32 bit Mode = Changes rendering to use 32 bit mode. Allows using anti-aliasing, but breaks in-flight menu and the briefing summary while loading the mission. (Not necessary)

Apart from the Hooks the only things that are applied to the exe's when installing the DSUCP or XWACP are

Disable briefing wireframe overlay = Disable the briefing wireframe overlay (used to crash the game) (could be included in a hook)
Disable XwaConfig.screenres reset = Prevent the game from resetting the user resolution choice by using the resolution width
Crafts count per region from 96 to 192 = Replace the craft count per region from 96 to 192.
Disable gun turret random rotation = Disable the gun turret rotation when there is no targetted craft.
Remove textures size limit = Remove the 256x256 texture size limit.
Opt textures count limit from 200 to 1024
Backdrop scaling factor from 256.0f to 128.0f
No CD Check = Disable CD Checks and Plays from HDD

Oh and of course craft stats

All screen resolution changes have to be made manually using XwaHacker as there are too many variables to take into consideration.
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

Justagai
Cadet 1st Class
Posts: 218
Joined: Mon Dec 08, 2014 10:59 pm

Post by Justagai » Mon Dec 31, 2018 2:32 pm

Disable briefing wireframe overlay = Disable the briefing wireframe overlay (used to crash the game) (could be included in a hook)
Disable XwaConfig.screenres reset = Prevent the game from resetting the user resolution choice by using the resolution width
Crafts count per region from 96 to 192 = Replace the craft count per region from 96 to 192.
Disable gun turret random rotation = Disable the gun turret rotation when there is no targetted craft.
Remove textures size limit = Remove the 256x256 texture size limit.
Opt textures count limit from 200 to 1024
Backdrop scaling factor from 256.0f to 128.0f
No CD Check = Disable CD Checks and Plays from HDD

Oh and of course craft stats
That's not too bad actually...that could go into a single patching hook. But there could be other variables I'm not accounting for.

EDIT: Ah re-read the craft stats. That could take some time.
All screen resolution changes have to be made manually using XwaHacker as there are too many variables to take into consideration.
Isn't there only screen resolution and FOV to account for? Or is there something more?
Windowed mode crash fixed, and JeremyaFr's changes merged in the latest version of my fork.
However I noticed that the XWAHacker 32 bit mode is simply broken (and has been for a long time) with my fork at least on Intel GPUs, the "black screen when targeting things" sounds like the same issue. On the plus side, there isn't much of point in enabling that 32-bit mode when using the dll, but unfortunately it's the default for the GoG and Steam binaries...
Is it possible to have the ddraw look for the bytes that were modified by xwahacker and revert them back? It would save people a lot of headache I would think.

User avatar
DTM
Fleet Admiral (Administrator)
Posts: 2119
Joined: Tue Apr 22, 2003 11:01 pm
Contact:

Post by DTM » Mon Dec 31, 2018 3:29 pm

Something has changed in Jeremy's last versions (11.1.3.3 and 11.1.3.4):
"PreserveAspectRatio" function dos not work. Set value 0 or 1 is the same (aspect ratio not preserved)

Please check...thanks!

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Mon Dec 31, 2018 3:33 pm

“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

User avatar
JeremyaFr
XWAU Member
Posts: 3918
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Mon Dec 31, 2018 4:34 pm

DTM wrote:
Mon Dec 31, 2018 3:29 pm
Something has changed in Jeremy's last versions (11.1.3.3 and 11.1.3.4):
"PreserveAspectRatio" function dos not work. Set value 0 or 1 is the same (aspect ratio not preserved)

Please check...thanks!
I've checked. You're right. There is a bug.

UPDATE
Hello,
I've updated my ddraw.dll v1.3.5.

The changes are:
  • Fixed a bug in setting viewport
https://github.com/JeremyAnsel/xwa_ddra ... tag/v1.3.5

Reimar
Cadet 1st Class
Posts: 239
Joined: Mon Jan 19, 2009 11:45 am

Post by Reimar » Sat Jan 05, 2019 3:21 pm

@JeremyaFr: for the code you SSE-optimized, I did a quick hack to completely avoid doing the conversion on GPU.
It's not finished since I lack evidence it's worth spending the time, but if you or anyone else is interested, see
https://github.com/rdoeffinger/xwa_ddraw_d3d11/issues/5
and
https://github.com/rdoeffinger/xwa_ddra ... 345f2ce86c
(contains 2 parts: avoiding the texture upload in case of non-native resolution as that seems much slower than going via Map() and catches the colour key in the shader - currently unconditionally, i.e. useColorKey is ignored)

Post Reply