Direct3D 11 via DDraw.dll

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

Moderators: Darksaber, General_Trageton, Forceflow, JeremyaFr, DTM

Post Reply

Re: Direct3D 11 via DDraw.dll

Weedman4lbg
Recruit
Posts: 5
Joined: Wed Feb 18, 2015 4:20 pm

Post by Weedman4lbg » Fri Feb 20, 2015 10:04 pm

JeremyaFr wrote:# With xwa_hook_main, you have some random crashes.
Installing xwa_hook_main alone has no effect. So it should not cause any crash.

# xwa_hook_d3dinfos_textures causes crash during loading
Have you followed all the instructions in the readme files?
If you reduce the size value in hook_d3dinfos_textures.cfg (for instance, by setting Size = 2000), does the crash occur?
I don't understand the first step "add hook_d3dinfos_textures.dll to dinput_hooks.lst"

JeremyaFr
Lieutenant Commander
XWAU Member
Posts: 1611
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Fri Feb 20, 2015 10:29 pm

Weedman4lbg wrote:I don't understand the first step "add hook_d3dinfos_textures.dll to dinput_hooks.lst"
dinput_hooks.lst is a text file. You can open it with Notepad.

By default, it contains:

Code: Select all

hook_sample.dll
This line is a sample and it can be removed.

After adding hook_d3dinfos_textures.dll, it will look like:

Code: Select all

hook_d3dinfos_textures.dll

Weedman4lbg
Recruit
Posts: 5
Joined: Wed Feb 18, 2015 4:20 pm

Post by Weedman4lbg » Sat Feb 21, 2015 8:21 am

JeremyaFr wrote:
Weedman4lbg wrote:I don't understand the first step "add hook_d3dinfos_textures.dll to dinput_hooks.lst"
dinput_hooks.lst is a text file. You can open it with Notepad.

By default, it contains:

Code: Select all

hook_sample.dll
This line is a sample and it can be removed.

After adding hook_d3dinfos_textures.dll, it will look like:

Code: Select all

hook_d3dinfos_textures.dll
Many tnx, hook_d3dinfos_textures.dll is now properly installed. The last issue that remains is if I click the left mouse button several times, fast within the cockpit or hangar, the game crashes... It happen with the GOG version as well...

Darkblue
Cadet 2nd Class
Posts: 85
Joined: Sun Mar 09, 2003 12:01 am

Post by Darkblue » Sat Jan 02, 2016 2:27 pm

I know is almost a year from the alst message but I thought it could be better fit here. I have tested this ddraw.dll but I am surprised that it does not start 3DVision mode. If I understand it correctly, it makes the game to use directX11 (is a kind of wrapped from DirectX6 to DirectX11?), so I guess it should actívate the 3D mode (when it is activated in NV CPanel, of course), as other games do (even not rated).

I am completely wrong or it should be possible to use it to play in 3DVision?

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

Post by Reimar » Sun Jan 03, 2016 8:30 pm

3DVision is not enabled automatically because the 3D context/swap chain is generated in windowed mode.
Creating it in fullscreen mode (by changing the code) enables 3DVision but then it crashes immediately if you try to launch a mission.
Interestingly if I change it back to windowed mode after that everything works.
I know that isn't much help, but I think it proves it is caused by some driver stupidity, so maybe try asking NVidia?
All you'd need would be a button to tell it, yes, use 3DVision for this content.
(I wonder if it could be tricked by creating an unused fullscreen context, but that sounds like a horrible hack)

Darkblue
Cadet 2nd Class
Posts: 85
Joined: Sun Mar 09, 2003 12:01 am

Post by Darkblue » Mon Jan 04, 2016 1:21 pm

Yes, I have seen that if when in flight during a mission (not in 2D) I press Alt+Enter, the game changes to fullscreen and 3D is enabled. Also if I press Alt+Enter in 2D it "seems" to change to fullscreen and monitor becames in 3D mode regarding brightness but IR emitter stays in stand-by (so no 3D activated), if then I load a mission it loads ok, but in 2D, and I have to press Alt+Enter still once to enter in 3D. So I think that when in 2D even if ALt+Enter is pressed the game does not enter in fullscreen actually.

I have been searching for some way (tool) to force an application to start in actual fullscreen but with no luck. I would have guessed that modifiyng the ddraw.dll to start in fullscreen could solve that. In any case if you want I am ready to make any test needed, just in case.

In any case, regardless of 3D on or off, I see that if I finish a mission (or quit mission, or quit game to windows) when in fullscreen (so I have had to press Alt+Enter when in flight previously), then the game crashes.

I think there is some problem with the dll, but I don't know what. Specially when there exists dgVoodoo 2 (v2.44 as v2.45 shows some glitches with starfield) library which wraps Directx1-7 to DirectX 11, and it works wonderfully in 3D (emitter is activated and fullscreen) from the very start (logo) of the game, without any problem (including in the hangar!), EXCEPT that for some reason the frame rate drops to 20-17 if some ship is targeted in cockpit, etc.

On the other hand the DirectX11 ddraw.dll here discussed, stays at 31 fps constant regardless of graphic load, which is very smooth, and what it should be, IMHO. If only it could be made to work correctly in fullscreen...

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

Post by Reimar » Mon Jan 04, 2016 1:47 pm

I didn't know alt+enter works...
I expect the crash is the same one I saw, and happens probably when in fullscreen and switching between game modes.
So if you use alt+enter to leave fullscreen before ending the mission that might avoid the crash.
Unfortunately I don't know the history behind choosing the windowed mode as default (is it because of that crash or something more?) so I'm a bit hesitant to even try to change it...
Plus I can only test in red/cyan anyway plus I only have access to NVidia card temporarily.
But I'll tell you in case I end up having some time to find something out.

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

Post by Reimar » Mon Jan 04, 2016 5:38 pm

Here's a version from my branch of the ddraw wrapper code.
The included cfg file configures it for fullscreen, and it fixes the crashes fullscreen mode caused.
My branch has a lot of changes for supporting earlier games in the serious though, so I might have broken some things for XWA.

Edit: for latest version please see https://github.com/rdoeffinger/xwa_ddraw_d3d11/releases
Last edited by Reimar on Thu Jan 21, 2016 8:25 pm, edited 2 times in total.

Darkblue
Cadet 2nd Class
Posts: 85
Joined: Sun Mar 09, 2003 12:01 am

Post by Darkblue » Mon Jan 04, 2016 8:20 pm

Thank you. That works...but with some glitches.

3D Vision is enabled as soon as game is loaded, and it is posible to enter in the hangar and flight in 3D! During flight/hangar the fps are steady 31, allowing to play smooth. And as you say it does not crash when quitting a mission/game.

BUT it has a problem: in 2D the movement (animation, mouse) is lagging quite a lot, even creating a short trail for the cursor and flickering when the system menú is opened. Don't know the cause neither if it is posible to correct without other consequences.

There is another difference regarding the previous ddraw, I have the refresh rate at 120 Hz, and with the previous ddraw, in 2D, the fps where 120, now there are limited to 60, together with the laggy behaviour... Maybe it is linked.

Darkblue
Cadet 2nd Class
Posts: 85
Joined: Sun Mar 09, 2003 12:01 am

Post by Darkblue » Tue Jan 05, 2016 8:28 am

Note: I have realized that the 120 fps vs 60 fps in 2D is 'normal', because before although Alt+Enter was pressed in 2D it did not really went into 3Dvision, so the fps stayed at 120, but now, with this dll it is effectively in 3Dvision mode, thus cutting in half the effective fps, so 60. So the fps thing that I commented in my last post seems normal.

There is a different behaviour vs dgVoodoo for example, when in flight if general menu is accessed ('Esc' key), AND widescreen .exe modification is used (so it is only widescreen during flight, not in 2D part of game), the menu appears in the middle of the screen but the sides at left and right show still the flight (cockpit, etc) in 3D instead of becoming black, which gives a bizarre feeling but not a deal breaker.

Another good thing is that if in 2D part of game you access the library of ships (ships database) or if during a mission briefing it is shown a 3D model of a ship, it shows it in 3Dvision, with depth, even if we are in the 2D part of the game. Which is wonderful and it is as I remember to work with the old stereoscopic solution from nvidia long before 3DVision appeared.

Regarding lag I see it minimized when 3DVision is off, but still strange as other dll manage it smoother. I tried to increase 2D fps with xwahacks but still it do not seem to improve.

PS. At side of that I always wondered if there is out there (or if it is possible to do) to make some separation-convergence presets and link them to some keypress, in that way we could have a pop up effect during external views, and a more toned down one in cockpit, etc.

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

Post by Reimar » Tue Jan 05, 2016 2:06 pm

I don't know what should happen to the boundaries for the in-flight menu. I did remove a few clear calls as it was necessary for the older games, so it could be a bug, but not sure.
The 2D parts aren't particularly optimized.
However I don't experience much of a lag neither in normal nor in anaglyph 3DVision mode (GTX 750 Ti, AMD FX-4300 CPU). Though maybe you are just more sensitive to it, or it is specific to real stereo mode for some reason.
There is the ScalingType option now in the ddraw.cfg, setting that to 1 might cause some slowdown as it's fairly processing-intensive, but I think it should be 0 by default so that's probably not it.

Darkblue
Cadet 2nd Class
Posts: 85
Joined: Sun Mar 09, 2003 12:01 am

Post by Darkblue » Tue Jan 05, 2016 4:44 pm

I have seen that if I increase the 2D fps with xwahack the 2D gets slower. It gets slower and slower as I increase the max fps. And 24 fps seems the optimal, which still lags as I described (less tan 24 increases lag too).

For a fixed 2D max fps setting the 'lag' is somewhat random: sometimes it is horrible and you see the lag (2, 3 or 4 instances of cursor, or whatever is moving), and sometimes it is not too much although still bothering: you feel that the cursor is 'heavy' and it 'jumps' and for example, the text of briefings appear slowly (you can see quite clearly the dark blue text written first, and then the light blue one over it).

I have tested just in case, 32 bit mode (xwahacker) which gives a black screen just after the mission loading screen (so in the hangar), and gives no gain in 2D. In any case the game does not hang itself ('q' still works).

I have tested it in anaglyph. In anaglyph it is wonderfully smooth, as it is in normal (no 3D vision) mode... Can't see why. It seems that one ddraw.dll (yours) is lagging in 2D and the other (dgVoodoo) is so slow in 3D (inflight) ? What a real pity. Still, the dll you posted allows to fly in 3D from the hangar itself ! If only something could be done for the 2D part...

BTW, ScalingType was set to 0. I tested it set to 1, and at side of making image smoothed, did not changed anything (maybe worse). I tested also to pout XWA=0 (it was =1 in your cfg file). The 3Dvision works ok from the game loading logo, just as with XWA=1, no crashes. The 2D lagging do not change though. There is some consequence with XWA=0, with XWA=0 when is accessed the inflight menú, there is no problem with the bands at left and right showing parts of the game, it is all black around the menu!...but the menú appears at the flight resolution, so small in the center of the screen (I fly at 1680x1050). Don't know if that could give a hint or not regarding this.

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

Post by Reimar » Tue Jan 05, 2016 5:05 pm

The XWA=0 mode should also at least break the screenshot functionality :)
But dgVodoo does not handle 2D as stereoscopic mode (i.e. the models in the library are not stereo)?
I think that the driver simply is broken (performance-wise at least) for the operations that are used to draw the 2D interface.
Since it doesn't happen with anaglyph I can't even really find out what the issue is to work around it though...
I did a bit of cleanup for when the screen is cleared before drawing a scene, and then the 3D part was cleared when entering the inflight menu, so here's an updated version.
I also optimized 2D rendering a bit, but I don't think it will help with the issue you have since it seems specific to certain stereoscopic modes.

Edit: for latest version please see https://github.com/rdoeffinger/xwa_ddraw_d3d11/releases
Last edited by Reimar on Thu Jan 21, 2016 8:26 pm, edited 1 time in total.

Darkblue
Cadet 2nd Class
Posts: 85
Joined: Sun Mar 09, 2003 12:01 am

Post by Darkblue » Tue Jan 05, 2016 6:36 pm

Thank you!

You are right, dgVoodoo activates the emitter but it is not really in stereo in 2D... (in fact, I didn't recall that it even blocks one of the glasses -left eye- all time dark when in 2D).

Thanks for the cleanup, now it is posible to access menu without glitches and big as the screen is.

I have played with nvidia inspector that allows to tweak some parameters for stereo but with no luck. If I was close to you I could help with the 3D Vision equipment, but I'm afraid we are far away. Don't know if it is possible to do something more...

User avatar
Darksaber

Fleet Admiral (Administrator)
Posts: 10319
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Tue Jan 19, 2016 10:29 pm

@Reimar it might be an idea to remove your older files, and if the DLL is the same please name the file the same

at the moment you have
In the thread Direct3D 11 via DDraw.dll
ddraw_for_3D.zip dated Mon Jan 04, 2016 which is 39.1 KiB
in the same thread lower down you have
ddraw_for_3D.zip dated Tue Jan 05, 2016 which is 40.17 KiB

This might be confusing to some people, could you please remove the outdated version please

Then you have
ddraw_for_XvT_BoP_TIE95_XWing95.zip
in the thread ddraw.dll for XvT BoP
But looking at the ddraw.cfg from both zip files there are minimal differences but the ddraw.dll one for XvT_BoP_TIE95_XWing95 is 256kb the other from ddraw_for_3D is 89kb, but can these be interchangeable between XWA and the older games?

I think you need some sort of text file in with the other files stating what these files do and for what game, also including the info Jeremy added to his text file, if your ddraw.dll is based off of his work which it looks to be, please.
“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

Darkblue
Cadet 2nd Class
Posts: 85
Joined: Sun Mar 09, 2003 12:01 am

Post by Darkblue » Mon Feb 15, 2016 5:57 pm

Thanks Reimar for this 1.4 versión, it seems to improve somewhat the problema while in 2D (although still lags). I am trying to put it together with ReShade (although it is too much, too laggy and flickering while in 2D).

tarasis
Recruit
Posts: 2
Joined: Thu Mar 03, 2016 11:33 pm

Post by tarasis » Thu Mar 03, 2016 11:41 pm

does the xwa_ddraw work with the Steam version of the game, or am I going to need to break out my old CD's?

When I try and use the 1.4 version from Reimar I get a black screen in the hangar with two small green circles before the game hangs (the hanging appears to be a separate issue). If I revert to the original ddraw.* files, I get to see the hanger (before the game then hangs a short time later; regardless of setting the affinity to a single cpu or using runfirst.exe)

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

Post by Reimar » Fri Mar 04, 2016 8:59 pm

If you're asking me: I don't have the Steam version, so I don't know if it works.
I don't see any sane reason why it shouldn't work with it, but then again from what I hear what Steam did to the binary doesn't qualify as sane...
Yet again, as long as you get a hang you should probably try to fix that first. That it doesn't work while the hang issue is around doesn't mean all that much, it might just be a random effect of how far it gets with rendering the hangar before it hangs?

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

Post by Reimar » Thu Mar 24, 2016 11:06 pm

About the slow 2D interface: Can anyone test if there might be an issue with the refresh rate?
Can anyone confirm whether it works fine with a display refresh rate of for example 120 Hz?
I suspect that maybe stereoscopic via frame doubling maybe causes this simply due to doubling the refresh rate.

EDIT: People testing this reported it not to help.
I made another possible fix I'm interesting in someone with the issue trying out:
https://github.com/rdoeffinger/xwa_ddra ... g_test.zip

ext_
Recruit
Posts: 2
Joined: Tue Nov 29, 2016 11:48 am

Post by ext_ » Tue Nov 29, 2016 11:53 am

Hello, XWA crashes with the patch after starting a new mission with the following error.
https://s14.postimg.org/j5xfodg69/chyba.png
(the message says "Not enough space for the completion of the operation."
I tried multiple DLLs libraries from this thread and combinations of the configurations with no luck. Could somebody help me?

JeremyaFr
Lieutenant Commander
XWAU Member
Posts: 1611
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Fri Dec 02, 2016 12:54 pm

Hello,
Do you have enough available memory to run the game?

ext_
Recruit
Posts: 2
Joined: Tue Nov 29, 2016 11:48 am

Post by ext_ » Fri Dec 02, 2016 1:24 pm

You mean RAM, I pressume. I have 3 gb RAM with around 1,8 gb available. I read the minimum requirements are 2 gb, so that should be fine. (or not?). Other specrs are: Win7 64, directX 9 card, 2,2 gHz double core.
Last edited by ext_ on Sat Dec 03, 2016 9:01 am, edited 1 time in total.

tarasis
Recruit
Posts: 2
Joined: Thu Mar 03, 2016 11:33 pm

Post by tarasis » Fri Dec 02, 2016 4:25 pm

Reimar wrote: EDIT: People testing this reported it not to help.
I made another possible fix I'm interesting in someone with the issue trying out:
https://github.com/rdoeffinger/xwa_ddra ... g_test.zip
Its been a while since I last tried running this, having made no other changes to XwA, I installed your new DDraw file and that game was starting perfectly. No hangs in the hanger, I could sit there for a few minutes swapping between the various views and then launch into space without issue.

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

Post by Reimar » Sun Jan 01, 2017 3:55 pm

ext_ wrote:You mean RAM, I pressume. I have 3 gb RAM with around 1,8 gb available. I read the minimum requirements are 2 gb, so that should be fine. (or not?). Other specrs are: Win7 64, directX 9 card, 2,2 gHz double core.
It's not sure, but it's more likely the GPU memory that is running out.
The wrapper uses quite a few full-resolution buffers, and anti-aliasing.
So if you are running with a graphics card with less than 1 GB RAM I'd suggest trying to disable anti-aliasing in the ddraw.cfg.

BigYehudah
Recruit
Posts: 1
Joined: Sat Jun 24, 2017 10:24 pm

Post by BigYehudah » Sat Jun 24, 2017 10:29 pm

This seems to be capping my fps at 24 in Tie Fighter 98. (TIE95.exe) I can't find a way to fix it. all the other dwrappers crash. I'm on steam, but using the GoG exe (doesn't matter because Steam and GoG's exes have the same effect.

Post Reply