KoKuToru / koku-xinput-wine

Adds xinput support to wine, without changing the source of wine.
BSD 2-Clause "Simplified" License
69 stars 21 forks source link

[WIP] Wine builtin DLLs #6

Closed KoKuToru closed 8 years ago

KoKuToru commented 8 years ago

New version of koku-xinput-wine will create a builtin wine dll. Should be cleaner.. allows games which use SDL2.dll to work (xinput export original 100).

More about it at https://github.com/KoKuToru/koku-xinput-wine/issues/5#issuecomment-160454996

This version also uses SDL_GameController as https://github.com/Hinsbart/koku-xinput-wine does. Thanks a lot @Hinsbart, somehow will need to credit you..

TODO

I use http://www.generalarcade.com/gamepadtool/ for this with this builtin xinput-dll via wine

mdeguzis commented 8 years ago

Is this still being worked on at all? Repo is quite old. SteamOS users would love to have this for playing games in BPM via this library.

KoKuToru commented 8 years ago

Sorry I am pretty busy with work. When I have time again I will complete this. Maybe next month..

mdeguzis commented 8 years ago

@KoKuToru , no problem, just wanted to see if the project was still alive. I tried to preload this in SteamOS, wrong ELFCLASS, which makes me think Double Dragon Neon was 64 bit, which is unfortunate or something else was going wrong. I did make debian packaging for this project as well, if interested. I also updated CmakeLIsts with what I considered improvements on installing the library. I'm no traditional programmer though. The debian/rules file also makes a symlink in the common /usr/lib/ area for convenience.

KoKuToru commented 8 years ago

went a different approach then I was intending in this pull request.. new version at #9

@ProfessorKaos64 The wrong ELFCLASS message comes on a 64bit system, but must not mean that wine runs in 64bit.. I haven't jet used wine-64Bit... but if the XInput has the same API in 64Bit (same structs with same word-sizes) and you don't need the CoSetProxyBlanket-Hack. We would just need to update Sjmp for 64bit support..

mdeguzis commented 8 years ago

Ah ok, thanks for the note. @strycore, you should review this an the other PR if you plan to re-add koku-xinput-wine back to Lutris.

strycore commented 8 years ago

@ProfessorKaos64 it's back and we are now shipping it in the Lutris runtime. The next branch on the Lutris client has updated code to get the correct location of koku-xinput-wine.

@KoKuToru it's cool to see an update! :D We are currently shipping @Hinsbart's SDL2 branch but now I assume that this is the most up to date version? We're releasing a new version of Lutris soon specifically to make koku-xinput work again (current version doesn't ship the .so), are there any necessary steps I should take to switch to your current version? (I'll try it with the instructions above and see for myself)

mdeguzis commented 8 years ago

@strycore , make sure to review the latest PR as well. #9

KoKuToru commented 8 years ago

@strycore There current version should be the same as @Hinsbart's version, just with a improved CMakeLists.txt. (and dropped SDL 1.2 support)

PR #9 splits the hacks from the xinput-part. If you don't need the CoSetProxyBlanket-hack it won't get loaded now. The CoSetProxyBlanket-hack is very ugly and really only works for special cases.. so I removed it and put it into a separated library. PR #9 also includes the changes I did in this PR.. Well.. more or less.. it's still uses the old LD_PRELOAD trick but replaces the wine builtin dlls with a additional ordinal 100 function in xinput.. SDL2 needs this function..

So usage would be this way with PR #9 (but I still need to test it)

xinput only (should work for games that uses xinput directly):

export LD_PRELOAD="????/koku-xinput-wine.so"

xinput + CoSetProxyBlanket-hack (should work for games that use microsofts example code):

export LD_PRELOAD="????/koku-xinput-wine.so;???/koku-xinput-cosetproxyblanket.so"

xinput + builtindll (adds SDL2 support..):

export LD_PRELOAD="????/koku-xinput-wine.so" and copy dll.so into wine-prefix (or as .dll into application folder

(NOTE for myself: I should add this to the README.md..)

strycore commented 8 years ago

I've rebuilt the lib (using this new script: https://github.com/lutris/buildbot/blob/master/runtime/koku-xinput.sh) and there seems to be some issues with SDL. After replacing the library, I get the following message when starting a game:

/media/data/games/Steam/Steam.exe: symbol lookup error: /home/strider/.local/share/lutris/runtime/lib32/koku-xinput-wine/koku-xinput-wine.so: undefined symbol: SDL_Init

KoKuToru commented 8 years ago

uhm.. checking CMakeLists.txt

if(PKG_CONFIG_FOUND)
    pkg_check_modules (SDL REQUIRED sdl2)
else()
    find_package(SDL2 REQURIED)
    list(APPEND SDL_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
    list(APPEND SDL_LIBRARIES ${SDL2_LIBRARIES})
endif()

# Link SDL
target_link_libraries(koku-xinput-wine ${SDL_LIBRARY})

looks like I screwed up with the sdl2 here..

shouldn't it be

if(PKG_CONFIG_FOUND)
    pkg_check_modules (SDL2 REQUIRED sdl2)
else()
    find_package(SDL2 REQURIED)
    list(APPEND SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
    list(APPEND SDL2_LIBRARIES ${SDL2_LIBRARIES})
endif()

# Link SDL
target_link_libraries(koku-xinput-wine ${SDL2_LIBRARY})

hm.. ? that said I have no idea what pkg_check_modules does..

KoKuToru commented 8 years ago
ldd ../koku-xinput-wine-build/koku-xinput-wine.so 
    linux-gate.so.1 (0xf77cd000)
    libstdc++.so.6 => /usr/lib32/libstdc++.so.6 (0xf75fa000)
    libm.so.6 => /usr/lib32/libm.so.6 (0xf75a5000)
    libgcc_s.so.1 => /usr/lib32/libgcc_s.so.1 (0xf758b000)
    libc.so.6 => /usr/lib32/libc.so.6 (0xf73d6000)
    /usr/lib/ld-linux.so.2 (0x56641000)

No SDL2.. must check how pgk_check_modules works

KoKuToru commented 8 years ago

@strycore I updated the CMakeLists.txt it should link with sdl2 correctly now

strycore commented 8 years ago

Yes, I can confirm, the new build works fine now!