Several issues

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

Moderator: JeremyaFr

Several issues

evilmark
Cadet 2nd Class
Posts: 51
Joined: Tue Feb 05, 2019 12:43 am

Post by evilmark » Tue Feb 05, 2019 1:18 am

Haven't played this game in years but I just purchased it again off of Steam. I first spent an hour or two using xinputplus to get my xbox one controller working how I wanted, and then I installed the latest xwaucp. After this, several things happened:

1) all my controller bindings changed, I've been able to fix some of it however the triggers are controlling throttle in addition to what I bind them to (I had changed them to operate as buttons 11 and 12 rather than the Z axis, and it worked great until installing the craft pack), and left stick down changes to left stick up once it gets all the way down

2) backgrounds aren't working correctly https://i.imgur.com/XJGnbUm.jpg

3) the frame rate has decreased a lot EDIT: I patched the .exe to display the framerate, it seems to be locked at a consistent 11 FPS, gameplay was very smooth before applying the craft pack but I don't know what the exact FPS was.

4) lasers have black lines in the sprites
Last edited by evilmark on Tue Feb 05, 2019 2:00 am, edited 1 time in total.

evilmark
Cadet 2nd Class
Posts: 51
Joined: Tue Feb 05, 2019 12:43 am

Post by evilmark » Tue Feb 05, 2019 1:49 am

I used xwahooksetup and now the backgrounds and lasers look as they should, however the other issues still remain

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

Post by Darksaber » Tue Feb 05, 2019 12:25 pm

Before your post I knew nothing about XInput Plus, so I've taken a look at it, when you have used XInput Plus to change your bindings and you select the exe to apply these changes too, in this case Xwingalliance.exe, XInput Plus then creates 3 files in your XwA Dir

Dinput.dll
Dinput8.dll
XInput1_3.dll

This is where your problem starts

When you install XWAUCPv1.5 or even DSUCPv2.6, the Dinput.dll is replaced, with our own Dinput.dll file that controls all the Hooks that allow so many of the edited changes to work, (JeremyaFr could explain this better).

So in replacing the Dinput.dll file your bindings are lost, but if you try to apply your changes again with XInput Plus I would have thought that XInput Plus might replace or overwrite the Dinput.dll file again, which would allow you to use your Xbox controller, but would disable your ability to use the Hooks, so your background and probably more is screwed up.

I would recommend you either buy a joystick or find some other way to bind your Xbox Controller.
“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

evilmark
Cadet 2nd Class
Posts: 51
Joined: Tue Feb 05, 2019 12:43 am

Post by evilmark » Tue Feb 05, 2019 2:07 pm

Like I said I was able to get the graphics cleared up, and while I don't know anything about hooks (the last time I used xwaupgrade I believe it was only models, textures, and OPTs) it doesn't appear that Dinput.dll was causing the graphics issues, but similarly running xinput plus again doesn't fix the controller either. The full list of steps I took yesterday are as follows:

1) installed XWA and used xinput plus to configure controller

2) installed xwaucp, found graphics, controls, and FPS to be messed up

3) ran xinput plus again and received this error
Image

4) renamed the XWAUCP Dinput.dll and ran xinput plus again, controls still did not function correctly

5) I then used XwaHookSetup (viewtopic.php?p=154911#p154911) to get the newest hooks, and all the graphics problems were resolved

6) since the newest time hook is supposed to have a fix to increase FPS to 60, but wasn't working, I deleted the xinput plus Dinput.dll and replaced it with the xwaucp one that I had renamed, but my FPS stayed locked at 11

I'm going to try some other controller programs to see if I can get the controls setup another way, but being stuck at 11 FPS makes the game unplayable regardless. I do have a Saitek X52 joystick but I've never been able to get it to work right with XWA, and the desk I'm using these days doesn't have enough room for it anyway.

evilmark
Cadet 2nd Class
Posts: 51
Joined: Tue Feb 05, 2019 12:43 am

Post by evilmark » Tue Feb 05, 2019 5:11 pm

I got the controls to something I don't like, but that I could probably get used to, the most annoying part being that I can't invert the Y-axis (stick works fine when not inverted, but when I set it to inverted it doesn't act right at Y: -100)

Still can't get the FPS above 11, it DID go up to 20 fps during one of my controller tests, but I can't seem to reproduce that, and 20 still was too low to be playable

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Tue Feb 05, 2019 7:21 pm

Have you try the "invert y-axis" option in ddraw.cfg?

I also recommend getting the latest ddraw.dll. Might fix the fps problem. https://github.com/JeremyAnsel/xwa_ddraw_d3d11

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

Post by Reimar » Tue Feb 05, 2019 8:13 pm

I am afraid the input issues you describe sound like issues with the dedicated XInput support in old versions of my fork of the ddraw.dll.
I would quite welcome testing and feedback if it works reasonably without xinputplus (which I have a feeling will just end up running into conflicts with all the other patches) https://github.com/rdoeffinger/xwa_ddra ... ses/latest

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

Post by Reimar » Tue Feb 05, 2019 8:18 pm

Oh, the invert Y axis option breaking things is actually something I noted and worked around in the XInput code:
// The 65536 value breaks XWA with in-game invert Y axis option
pji->dwYpos = std::min(pji->dwYpos, DWORD(65535));

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Tue Feb 05, 2019 9:02 pm

Curious... if it's a 16-bit unsigned value, max value should be 65535 to begin with. Is it starting as a 32-bit value and getting truncated? That could explain it. 65536 truncated to 16 bits becomes 0.

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

Post by Reimar » Wed Feb 06, 2019 7:46 pm

The type is DWORD (i.e. unsigned 32-bit) for the old joyGetPosEx functions.
It is signed 16-bit for XInput though.
So to convert signed to unsigned it's necessary to add 32768.
To then match DINPUT/joyGetPosEx expected behaviour it is then also necessary to flip it around, but maintain the same 0 point.
So 65536 - original value (thus the original neutral value of 32768 stays that).
And thus you end up at the value of 65536.
However as all this only results in an issue when the in-game inversion option is on as well, it's not just a simple truncation causing the issue still but related to how the game does the y axis inversion.

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Wed Feb 06, 2019 11:04 pm

Ah, I see. So it's more due to the fact that, for a signed 16-bit value, -32768 is in range, but 32768 is out of range (because it has the same binary representation as -32768).

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

Post by JeremyaFr » Fri Feb 08, 2019 1:24 pm

Darksaber wrote:
Tue Feb 05, 2019 12:25 pm
When you install XWAUCPv1.5 or even DSUCPv2.6, the Dinput.dll is replaced, with our own Dinput.dll file that controls all the Hooks that allow so many of the edited changes to work, (JeremyaFr could explain this better).
The main hook is implemented in a custom Dinput.dll. The main hook loads the other hooks and auto patches the exe.

To auto patch the main hook, it is needed to implement it in a dll that is auto loaded by the game.

The DLLs that are auto loaded are:
- DINPUT.dll
- KERNEL32.dll
- USER32.dll
- GDI32.dll
- SHELL32.dll
- WINMM.dll
- tgsmush.dll
- DPLAYX.dll
- DSOUND.dll
- DDRAW.dll
- ADVAPI32.dll
- ole32.dll
- and their dependences

I chose Dinput.dll because it has less functions and so is easier to wrap.

To avoid a conflict with an other custom Dinput.dll, I can can modify the name of the main hook. For example I can name it hooks_main.dll. But it will be needed to manually (or via XwaExePatcher with a patcher.xml file) patch the exe to setup the main hook. The main hook will still auto patch the exe to setup the others hooks.

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

Post by Darksaber » Fri Feb 08, 2019 1:50 pm

This is entirely up to you Jeremy, but leaving the name as Dinput.dll, does make things a lot easier for all of us, the problem with the XInput Plus Joypad bindings has only been reported once to my knowledge. Most people would normally buy a joystick to play this game, so on average I don't think it's worth changing names just for one incident.
“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”
So I would say sorry to evilmark, but he needs to buy a compatible joystick to play XWA
“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: 3921
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Fri Feb 08, 2019 3:45 pm

Here a modified main hook:
xwa_hook_main_no_dinput.zip

Note that this conflicts with the main hook (Dinput.dll). You need to choose one of them.
Last edited by JeremyaFr on Mon Feb 11, 2019 7:59 pm, edited 1 time in total.

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Fri Feb 08, 2019 6:15 pm

Heh... I had the opposite problem with GTA4/5. Being console ports, they expect game controllers. I had to download a controller emulator (which also used a dinput.dll wrapper) to let me use my joystick to fly the helicopters & airplanes.

I don't even think you can make all of the people happy some of the time. Some people just can't be pleased.

User avatar
Trevor
Lieutenant JG
Posts: 541
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Sat Feb 09, 2019 10:32 pm

I would say that since Jeremya has now posted the hook to be called directly by xwa leaving the dinput alone this would be the better option (unless there are any downsides? it looks like its new code in a blank area so it should be ok)
it means dinput can be used by input wrappers which better fit the goal and avoid any future conflicts since xwa hacks will now always be unique.

Trev

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

Post by Reimar » Sun Feb 10, 2019 1:37 pm

Not naming it dinput.dll would mean you have to patch the .exe? The idea of requiring an exe patch to load a framework for patching it seems a bit questionable to me if I'm very blunt.
It's not a good solution short term, but wouldn't a better longer-term solution be to integrate the stuff we have a bit more, so that the ddraw.dll can chain-load the hooks? (as an example)
To be honest what I'd really like (but don't think I have time for) would be to have a replacement for the alliance.exe launcher.
The reasons being
1) the launcher as-is breaks Steam integration, so it kind of calls for a replacement anyway
2) could install and/or update ddraw.dll if desired
3) it could provide easy ways to configure the resolution, with good defaults. Since there are trade-offs involved (like HUD-scale > 1.49 might be necessary for the fonts to be big enough but some things then become unreadable) IMO this rather needs a solution that can guide users.
4) it probably would be reasonable to also integrate a downloader for the hooks and possibly a updater, plus configuration, documentation etc
5) maybe even built-in bug reporting tool? With all respect to this forum, it isn't a particular good tool for issue tracking I think.

I know a lot of stuff is kind of there but it's spread out all over the place. The craft pack is great, but for areas with heavy development it still means a lot of manual work for any who wants the latest features.

I totally understand that probably nobody else has time for such a project either, but I wanted to at least throw out some ideas. Also since I'd prefer time to be spent on user-friendly solutions instead of one-off workarounds...
I might at some point try to extend XWAHacker in that direction, but that might be a long way off...

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

Post by Darksaber » Sun Feb 10, 2019 2:13 pm

Seems like a really good idea

The only thing that are needed from the old launcher would be the Play Xwing Alliance button Pilot Options perhaps the Joystick options, there rest of the old launcher options could be removed.

You could also have a settings option so the launch path could be customizable to include skipintro or Generate (generates a new Spec.rci file) or console (I think there was another one but I can't remember it :)
“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

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

Post by Bman » Sun Feb 10, 2019 5:08 pm

Great idea. Perhaps also include a submenu of the XWAExePatcher (Patcher.xml) options which would make it more user friendly. These would only be the patches that are Not already addressed by custom *.dll files.
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

evilmark
Cadet 2nd Class
Posts: 51
Joined: Tue Feb 05, 2019 12:43 am

Post by evilmark » Sun Feb 10, 2019 8:05 pm

Reimar wrote:
Tue Feb 05, 2019 8:13 pm
I am afraid the input issues you describe sound like issues with the dedicated XInput support in old versions of my fork of the ddraw.dll.
I would quite welcome testing and feedback if it works reasonably without xinputplus (which I have a feeling will just end up running into conflicts with all the other patches) https://github.com/rdoeffinger/xwa_ddra ... ses/latest
This worked perfectly, thanks!

evilmark
Cadet 2nd Class
Posts: 51
Joined: Tue Feb 05, 2019 12:43 am

Post by evilmark » Sun Feb 10, 2019 8:17 pm

Darksaber wrote:
Fri Feb 08, 2019 1:50 pm
So I would say sorry to evilmark, but he needs to buy a compatible joystick to play XWA
It was just the ddraw.dll that Reimar mentioned, what's interesting though is that all of the settings I had applied with xinputplus are still working even with the xwaucp dinput.dll (had to uninstall and reinstall xwaucp after something I did caused targeting non-fighters to make the screen go black). I suspect that even though it creates a dinput.dll you don't actually need it, only the Xinput1_3.dll and XInputPlus.ini which obviously were not deleted when I uninstalled the xwaucp.

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

Post by Reimar » Tue Feb 12, 2019 4:41 pm

evilmark wrote:
Sun Feb 10, 2019 8:17 pm
It was just the ddraw.dll that Reimar mentioned, what's interesting though is that all of the settings I had applied with xinputplus are still working even with the xwaucp dinput.dll (had to uninstall and reinstall xwaucp after something I did caused targeting non-fighters to make the screen go black). I suspect that even though it creates a dinput.dll you don't actually need it, only the Xinput1_3.dll and XInputPlus.ini which obviously were not deleted when I uninstalled the xwaucp.
Yeah... this comes back to the confusion some people rightfully complained about (but I don't have a simple answer to).
There are 2 variants of the ddraw.dll, JermeyA's original one and mine.
Now since a while back mine adds support for XInput. So that would end up caring only about the XInput1_3.dll.
Now actually I am wondering if this dinput.dll was not a red herring all along: the game does not use DirectInput for joysticks at all, it uses winmm.dll. Does xinputplus replacing dinput.dll also affect the winmm interface? Or would it not work at all on an unmodified game?

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

Post by JeremyaFr » Tue Feb 12, 2019 5:12 pm

The game uses DirectInput for joystick with force feedback.

evilmark
Cadet 2nd Class
Posts: 51
Joined: Tue Feb 05, 2019 12:43 am

Post by evilmark » Tue Feb 12, 2019 7:21 pm

Reimar wrote:
Tue Feb 12, 2019 4:41 pm
evilmark wrote:
Sun Feb 10, 2019 8:17 pm
It was just the ddraw.dll that Reimar mentioned, what's interesting though is that all of the settings I had applied with xinputplus are still working even with the xwaucp dinput.dll (had to uninstall and reinstall xwaucp after something I did caused targeting non-fighters to make the screen go black). I suspect that even though it creates a dinput.dll you don't actually need it, only the Xinput1_3.dll and XInputPlus.ini which obviously were not deleted when I uninstalled the xwaucp.
Yeah... this comes back to the confusion some people rightfully complained about (but I don't have a simple answer to).
There are 2 variants of the ddraw.dll, JermeyA's original one and mine.
Now since a while back mine adds support for XInput. So that would end up caring only about the XInput1_3.dll.
Now actually I am wondering if this dinput.dll was not a red herring all along: the game does not use DirectInput for joysticks at all, it uses winmm.dll. Does xinputplus replacing dinput.dll also affect the winmm interface? Or would it not work at all on an unmodified game?
It worked perfectly with the unmodified Steam version. Honestly I don't know too much about how Xinputplus works, when I was considering playing again I did a google search about using controllers in place of a joystick and found a Steam discussion post suggesting to use Xinputplus. By default directinput is not enabled in XIP, so knowing what I know now I suppose using your ddraw.ll and not enabling DI output in XIP is the way to go to avoid conflicts with the various hooks.

Aril
Recruit
Posts: 2
Joined: Fri Mar 04, 2011 12:01 am

Post by Aril » Fri Feb 15, 2019 3:05 pm

Edit: My bad, I dindt read the topic well enough, I did find the answer and manage to fix the problem.

Hello there,

I do have the same issue with background but i dindt get what is xwahooksetup. Could someone point it out for me? I'm kind a lost out here.
Last edited by Aril on Fri Feb 15, 2019 3:43 pm, edited 1 time in total.

Post Reply