KrossX / Durazno

XInput wrapper that allows controller customization
MIT License
202 stars 21 forks source link

Durazno doesn't seem to hook to the game (Dark Souls 2 SotFS) #6

Closed cridus closed 9 years ago

cridus commented 9 years ago

So, I was trying to chain Durazno and x360ce by making Durazno load x360ce's dll. Once in the game, I noticed that the mapping was screwed up, so I went to remap the keys in Durazno.exe. Tried again, but the mapping was the same as before. I checked if I wrote the path to x360ce's dll correctly in Durazno.INI, and it was ok. At that point I noticed that the usual sound that x360ce makes when it hooks to the game didn't play. After looking at Durazno's source code I saw that it should display a box with an error if it fails to load the chained dll, so I wondered if Durazno's own dll even hooked itself. As you wrote in another issue, I tried to remove Durazno.exe from the game's directory but nothing changed, and then I tried removing Durazno.INI and open the game to see if the dll would create a new one, but it didn't. As a last resort, I tried using the 32bit dll, but the result was the same.

What could be the problem? Of course, x360ce's dll was either renamed or put into another directory (tried both).

KrossX commented 9 years ago

The main thing would be to just place durazno's dll, and make sure a new INI is created. Since as you guessed, it would otherwise means the dll ain't being loaded at all.

If you just use x360ce? Does it work alright? Maybe x360ce is trying to hook durazno instead of the game (cuz durazno would be loading it) and causing it to never start loading. o.O

PS: The GUI is just to help make INI files, it makes no difference to the wrapper. But it might crash when used inside game folders for some reason.

cridus commented 9 years ago

I tried by removing x360ce's dll and so leaving in only durazno's one, without the INI file. A new INI file didn't get created.

x360ce works, by itself.

KrossX commented 9 years ago

Since you can get x360ce working, it would be a matter of replacing it to at least get an INI file created that is. Thus, I have no idea of why it would not load it.

I'll let you know if I find anything.

cridus commented 9 years ago

Thank you very much. Tell me if you need any information about my system.

KrossX commented 9 years ago

I tested it, and it worked fine with 64bit Durazno. An INI file was created and x360ce was loaded (cuz it also created its log file, when log is enabled).

Please try again with latest Durazno: http://tiny.cc/magicaltools And be sure to be using the 64bit version of the dll.

cridus commented 9 years ago

I removed all of durazno's and x360ce's files from the "Game" directory, redownloaded durazno and put in the directory only the x64 "xinput1_3.dll". after opening the game the INI didn't get created, as before. I also tried running the game as an admin (I didn't try yesterday) but nothing changed.

edit: I don't know if it can change anything: does the game running in windowed mode cause problems?

KrossX commented 9 years ago

Do make sure the dll used is the 64bit version, as the only way I can reproduce nothing happening is by using the 32bit version.

If the game runs, then that's enough.

EDIT: Try installing C++ runtimes in case there's a missing dependency. https://www.microsoft.com/en-us/download/details.aspx?id=40784 Install both, x86 and x64

cridus commented 9 years ago

I tried multiple times both the 32bit and the 64bit dlls... (not together, of course) the game runs, but does that mean that durazno could have hooked correctly even though it didn't create an INI file?

cridus commented 9 years ago

about your edit: I installed them, rebooted the computer just in case, tried again: same as before.

does logging have to be enabled in the INI with a setting or do you use a debug build?

KrossX commented 9 years ago

No, I enabled logging on x360ce to see if the Durazno -> x360ce thing worked.

In my test, all I did was put Durazno's dll alongside the game's exe and it worked just fine. The durazno.ini file was created. Tried again with the 32bit dll and nothing happend (I was expecting an error message).

Then to test x360ce alongside it, I renamed it and edited the durazno.ini file accordingly. I didn't know if it worked so I enabled logging on x360ce and on the next run x360ce created its log. So all working fine.

But maybe there's no write permission to create an ini file in your folder? O.o .... Here's my set of dll and ini files I used: http://www.mediafire.com/download/4lfxr4p1ff3w2gx/testingset.zip

Put them in your game folder as usual, run the game in admin mode (to make sure it can write). x360ce log file should be created. If so, all's working fine and it's just a matter of making ini files and copy them over.

cridus commented 9 years ago

The mediafire account I'm using is fake, btw >_> (I'll delete this post, lol) remove the file or revoke my permission to see it, after I get it (I'll write here when I'll have gotten it).

KrossX commented 9 years ago

Is there a problem with the link? I can upload it somewhere else if you want.

cridus commented 9 years ago

the file is private, I requested authorization to see it. check on mediafire, I dunno how it works.

KrossX commented 9 years ago

Done! Sorry about that.

cridus commented 9 years ago

ok got it. it's better to delete the last few posts maybe >_>

KrossX commented 9 years ago

No need. =P

cridus commented 9 years ago

I tried the files and nothing changed. there's no log file either.

KrossX commented 9 years ago

Whaaaaa? Did you try it on admin mode? See if you can send a screenshot of your game folder. (ALT + PRTSCR)

cridus commented 9 years ago

ok, what the helllllll I tried running the game with the controller unplugged. this time x360ce logged something.

[TIME]      [THREAD]    [LOG]
00:08:37.658    00003412    Using game database file:
00:08:37.658    00003412    C:\Program Files (x86)\Steam\steamapps\common\Dark Souls II Scholar of the First Sin\Game\x360ce.gdb
00:08:37.658    00003412    InputHook found "Dark Souls II" in database
00:08:37.658    00003412    InputHook starting...
00:08:37.658    00003412    x360ce (x64) 3.4.1.1299 started for "DarkSoulsII.exe"
00:08:37.658    00003412    OS: "Microsoft Windows 8.1 (x64)"
00:08:37.658    00003412    Using config file:
00:08:37.658    00003412    C:\Program Files (x86)\Steam\steamapps\common\Dark Souls II Scholar of the First Sin\Game\x360ce.ini
00:08:37.658    00003412    WARNING: Configuration file version mismatch detected
00:09:25.873    00003412    ControllerManager shutdown
KrossX commented 9 years ago

Yay! So now it's just something else that's going wrong. =D

cridus commented 9 years ago

here's a creenshot of the folder. the highlighted files are the ones you gave me.

image

what do you think the problem could be? how could the controller be the problem if it gets recognized by both x360ce and Durazno.exe?

KrossX commented 9 years ago

I would guess it's a problem of both wrappers working together AND how the game detects controllers.

So, the game would detect your controller by checking direct input and thus never attempt to do any xinput action at all. Without any xinput action triggered, durazno would not init itself and never load x360ce either.

x360ce on the other hand, might've hooked DInput before the game checked for it.

cridus commented 9 years ago

so there's no hope for me unless you modify the dll? >_>

KrossX commented 9 years ago

I could try and make you a custom build that does not-recommended and unsafe things.

cridus commented 9 years ago

it would be cool, lol but why does x360ce work? does it not care about those unsafe things?

KrossX commented 9 years ago

Cuz x360ce when first called, it loads the hook. Durazno has no hooking magic at all, cuz it ain't needed. You're supposed to be using it on xinput devices only. Loading dlls on that first call ain't good either, so Durazno waits until used.

http://www.mediafire.com/download/r158pztx1xsi8n1/durazno_unsafe_x64.zip

PS: Also, I have no clue how the hooking magic works.

cridus commented 9 years ago

I see. thank you, I'll try it right away >_>

cridus commented 9 years ago

image

>_>

KrossX commented 9 years ago

See? Unsafe things. XD I'll let you know when I have something less unsafe.

cridus commented 9 years ago

thanks a lot! really, I didn't expect to get so much support >_>

KrossX commented 9 years ago

http://www.mediafire.com/download/putksia3olfj6gx/durazno_unsafe2_x64.zip

Make sure xinput_x360ce.dll is on the same folder too. (though that's on the ini anyhow)

cridus commented 9 years ago

same error as before.

KrossX commented 9 years ago

Copy the Durazno.exe in there and see if it runs.... the file is right there, dunno why it complains. =S

Have you tried running it on admin mode?

cridus commented 9 years ago

yes.

do you need the log?

KrossX commented 9 years ago

The Durazno GUI works? Check the Test tab.

EDIT: Try editing the Durazno ini file and change the dll to the full path.

cridus commented 9 years ago

yes, works perfectly.

KrossX commented 9 years ago

Yet the game still complains about the DLL the GUI had no problems with? Dangit.

Copy that xinput_x360ce.dll to anywhere it complains it ain't. I dunno where you would need x360ce INI file to be by then though.

cridus commented 9 years ago

in system32? lol

KrossX commented 9 years ago

Yup. It won't replace anything.

cridus commented 9 years ago

the game crashed. I ran it as an admin.

last line of the log:

01:38:54.947 00002940 [Core ] Loading C:\Windows\system32\xinput_x360ce.dll

KrossX commented 9 years ago

Fine, I give up. Sorry. It works fine here, but for some reason it hates you.

You should delete that file from system32 now. Make sure it's the _x360ce.dll one. The others are kinda important in there. =P

cridus commented 9 years ago

what if I put the entire path to the dll in the INI? but I think in your code you take only the name of the file.

KrossX commented 9 years ago

It's what I suggested before. The code works fine with relative or full path alike.

cridus commented 9 years ago

doesn't work, it still looks for it in system32.

KrossX commented 9 years ago

And I cannot reproduce it at all to find out why it fails.

cridus commented 9 years ago

could I do that in some way? I'm a programmer, I'm not hopeless >_>

KrossX commented 9 years ago

Well, if you're a programmer, then I suggest to merge durazno into x360ce itself and all your problems would be gone.

Shouldn't take too long me thinks. A lot less than to debug loadlibrary and find out why it ain't good to load things during dllmain. o.o

cridus commented 9 years ago

at this point, I must ask: why does durazno manage to change things like deadzone and antideadzone and x360ce doesn't? I tried changing these in x360ce but they didn't change anything. in what is durazno different?

KrossX commented 9 years ago

Probably it's something that got un-implemented or bugged during one of x360ce's rewrites. There's nothing special in Durazno, it's just a simple wrapper. Most of the code is there to load settings or use the GUI.

cridus commented 9 years ago

I see. thanks for all the help and infos. I'll see what I can do when I'll have time.