Closed DocNotADr closed 5 years ago
Oh my, someone actually ended up using this!
Stellaris just updated, and I read some forums that CreamAPI stopped working for the new version.
I'm afraid I never had a copy of Stellaris, so I never tried to get this to work with it. I only had a copy of EU4, with some (not all) of the DLCs. I downloaded the missing DLCs from... nefarious sources... and then preloaded "hookey" so that it convinced EU4 I'd actually bought them.
I think you would need to do a similar thing Stellaris. So, first you got to download the DLCs from somewhere (any torrent with Windows' copies of the DLCs will work) then use hookey.
Also, I couldn't find a copy of CreamAPI that worked with linux, so that's why I wrote this. Anyways, if the windows version of CreamAPI stopped working on Windows, then I can't imagine hookey would work, as we follow the same concept: just pretend to be steam.
I must admit, I never actually ended up using hookey, as I found the game to be unbearably slow for some reason. In fact, beyond checking that the game starts, I haven't played any EU4 since, so there might be some bugs I never caught. I'm not sure if it was slow because of hookey, or because of the DLCs, so I decided against buying them. (I only ever wanted to demo the stuff, to see if it would work, which it obviously didn't)
I tried converting the DLC ids to Stellaris DLC ids, but it seems that the fake/ooked SteamApps never initializes. Below is the output of a debug log version of your code (I put printf in just about every function to see what was and was not being called)
If I'm reading this correctly, your hoping hookey is going to download the DLCs for you, which it will not. It makes stellaris think you bought the DLCs, but if the DLCs aren't there, there is nothing to load and initialize. Just grab one of those .ISO files with copies of the DLCs and copy them into the right place.
LD_PRELOAD="/home/d/src/hookey/out-lib/libHookey64.so" ./stellaris
I remember for some odd reason I had to preload both the 64 bit version and the 32 bit version. Just a heads up.
Anyways, try a) preloading both a 64 bit hookey and a 32 bit one and b) if you haven't already, downloading the DLCs to the right folder.
As a followup, I think whether or not it will choose the 64-bit hookey or 32-bit hookey is dependent on which .so file it would normally look for:
$ find ~/.steam/root/ -type f | grep ".so$" | xargs -I % bash -c "echo \"%\"; readelf -Ws \"%\" | grep SteamAPI_Init" | grep SteamAPI_Init -B 1 -A 0 | grep ".so$" | xargs -I % file "%"
readelf: Warning: local symbol 285 found at index >= .dynsym's sh_info value of 1
readelf: Warning: local symbol 289 found at index >= .dynsym's sh_info value of 1
readelf: Warning: local symbol 2 found at index >= .dynsym's sh_info value of 2
readelf: Warning: local symbol 3 found at index >= .dynsym's sh_info value of 2
readelf: Warning: local symbol 4 found at index >= .dynsym's sh_info value of 2
readelf: Warning: local symbol 1 found at index >= .dynsym's sh_info value of 1
readelf: Warning: local symbol 2 found at index >= .dynsym's sh_info value of 1
readelf: Warning: local symbol 3 found at index >= .dynsym's sh_info value of 1
readelf: Error: Not an ELF file - it has the wrong magic bytes at the start
readelf: Error: Not an ELF file - it has the wrong magic bytes at the start
readelf: Error: Not an ELF file - it has the wrong magic bytes at the start
readelf: Error: Not an ELF file - it has the wrong magic bytes at the start
xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option
/home/gentz/.steam/root/steamapps/common/Kingdom New Lands/Kingdom_Data/Plugins/x86_64/libCSteamworks.so: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=09187f8152afe96d64224e005d13d779690e6d43, not stripped
/home/gentz/.steam/root/steamapps/common/Kingdom New Lands/Kingdom_Data/Plugins/x86_64/libsteam_api.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=bdcfa27262b669911cbc7650b929dc472fe02dc0, not stripped
/home/gentz/.steam/root/steamapps/common/Kingdom New Lands/Kingdom_Data/Plugins/x86/libCSteamworks.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=5de91294c129a7c85218b32357d3a086691a04fc, not stripped
/home/gentz/.steam/root/steamapps/common/Kingdom New Lands/Kingdom_Data/Plugins/x86/libsteam_api.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=2b380dea2520fb854d1f6dfee6539425e5821575, not stripped
/home/gentz/.steam/root/steamapps/common/Cultist Simulator/CS_Data/Plugins/x86_64/libsteam_api.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=111902389643b15beee454d61fecc94ed68a83a7, not stripped
/home/gentz/.steam/root/steamapps/common/Cultist Simulator/CS_Data/Plugins/x86/libsteam_api.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=16bcac040eda9bb32cd8504be30a429c9aa92331, not stripped
/home/gentz/.steam/root/steamapps/common/Cities_Skylines/Cities_Data/Plugins/x86_64/libColossalNative.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=27afe65ad3ba9958ee76e093a53ff74ac3abce08, stripped
/home/gentz/.steam/root/steamapps/common/Cities_Skylines/Cities_Data/Plugins/x86_64/libsteam_api.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=e6595bf0c58db930de83bcba83b370d9d34265e8, not stripped
/home/gentz/.steam/root/steamapps/common/Democracy 3/lib/libsteam_api.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=ca8ebce4dd39bcd536d2c14a14d425748314a81b, not stripped
/home/gentz/.steam/root/steamapps/common/Democracy 3/lib64/libsteam_api.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=dc643a428f51369f14c9eb7955ad91a01b936b29, not stripped
/home/gentz/.steam/root/steamapps/common/MiniMetro/Mini Metro_Data/Plugins/x86_64/libsteam_api.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=f839c750958966e1e04fcba801359828da171d0d, not stripped
/home/gentz/.steam/root/steamapps/common/MiniMetro/Mini Metro_Data/Plugins/x86/libsteam_api.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=0566ca15cb3f17fd317f6fa143a2ccc52101d4cd, not stripped
/home/gentz/.steam/root/steamapps/common/Monster Prom/MonsterProm_Data/Plugins/x86_64/libsteam_api.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=111902389643b15beee454d61fecc94ed68a83a7, not stripped
/home/gentz/.steam/root/steamapps/common/Monster Prom/MonsterProm_Data/Plugins/x86/libsteam_api.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=16bcac040eda9bb32cd8504be30a429c9aa92331, not stripped
/home/gentz/.steam/root/steamapps/common/No Time To Explain Remastered/NoTimeToExplain_Data/Plugins/x86/libCSteamworks.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=53f429d33e60dfe79701cf79690194446da5c2ab, not stripped
/home/gentz/.steam/root/steamapps/common/No Time To Explain Remastered/NoTimeToExplain_Data/Plugins/x86/libsteam_api.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=3e268cd051081d8cceed5d879890eb4e3e5618f0, not stripped
/home/gentz/.steam/root/steamapps/common/911 Operator/libCSteamworks.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=ab62736fa8ce8d49cd5ef0cf89027001d5d85c73, not stripped
/home/gentz/.steam/root/steamapps/common/911 Operator/libsteam_api.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=3da0b7ab23c9ac9463629d405754d3db42de97dd, not stripped
/home/gentz/.steam/root/steamapps/common/Kerbal Space Program/KSP_Data/Plugins/x86_64/libsteam_api.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=f839c750958966e1e04fcba801359828da171d0d, not stripped
/home/gentz/.steam/root/steamapps/common/Kerbal Space Program/KSP_Data/Plugins/x86/libsteam_api.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=0566ca15cb3f17fd317f6fa143a2ccc52101d4cd, not stripped
/home/gentz/.steam/root/steamapps/common/NeuroVoider/x86/libCSteamworks.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=3495045fbab6d6440a330e49d70e3cd2230a940e, not stripped
/home/gentz/.steam/root/steamapps/common/NeuroVoider/x86/libsteam_api.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=c4b51253a751d6502ddc96405e170433e7b2d6f6, not stripped
/home/gentz/.steam/root/steamapps/common/NeuroVoider/x64/libCSteamworks.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=a32b416d2d8bad13c4a31927fd884a03e9d75819, not stripped
/home/gentz/.steam/root/steamapps/common/NeuroVoider/x64/libsteam_api.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=e146a36890f0019fbf83ce9ef44523c303ffd242, not stripped
/home/gentz/.steam/root/steamapps/common/dota 2 beta/game/dota/bin/linuxsteamrt64/libserver.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=1aa4472f8ca79a3519b94e6661fea49d88775bdd, not stripped
/home/gentz/.steam/root/steamapps/common/dota 2 beta/game/dota/bin/linuxsteamrt64/libclient.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=32175a0dfdbaa289b9d8f0cdba34d56a2d64074f, not stripped
/home/gentz/.steam/root/steamapps/common/dota 2 beta/game/bin/linuxsteamrt64/libengine2.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=ae3e7c71abc3f0e52ee17099172d9e9659620287, not stripped
/home/gentz/.steam/root/steamapps/common/dota 2 beta/game/bin/linuxsteamrt64/libsteam_api.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=c0fe901a5e7e16e513428965e481b23fb4360805, not stripped
/home/gentz/.steam/root/steamapps/common/Sundered/Sundered_Data/Plugins/x86_64/libCSteamworks.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=97ce82620b51badd69e1645ca13ab0a017af4f8f, not stripped
/home/gentz/.steam/root/steamapps/common/Sundered/Sundered_Data/Plugins/x86_64/libsteam_api.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=ea99f4f166508e015455216f00292c155742b708, not stripped
/home/gentz/.steam/root/steamapps/common/Sundered/Sundered_Data/Plugins/x86/libCSteamworks.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=dab6ad93b47164ba8dfa7fd77277f9207d5dd504, not stripped
/home/gentz/.steam/root/steamapps/common/Sundered/Sundered_Data/Plugins/x86/libsteam_api.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=d9f90b492f120ed821365332e68d2e48466afd09, not stripped
/home/gentz/.steam/root/steamapps/common/Factorio/lib/libsteam_api.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=f839c750958966e1e04fcba801359828da171d0d, not stripped
/home/gentz/.steam/root/steamapps/common/Europa Universalis IV/libsteam_api.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=514edf2a7bb542b33df130168990a498fd5c4c49, not stripped
Notice how EU4 needs a 32-bit ELF.
Thank you for your response. I of course already have the DLC files. A couple days ago it was working fine under windows with CreamAPI. That command you posted with readelf is interesting. Now I want to boot back into windows.
Am I understanding it correctly, that when the game starts to load, ISteamApps* Hookey_SteamApps()
in hookey_steamapps.cpp should run, and fill hookey_steamApps
with both the real and fake SteamApps
object? I noticed when WipeSteamApps was being called, there were no entries in hookey_steamApps.
I understand that you no longer have interest in this program (you'd probably rather help port the ksp mods to the newest versions), but could you tell me where you learned the information for making this library. I could not find CreamAPI source code anywhere.
Am I understanding it correctly, that when the game starts to load,
ISteamApps* Hookey_SteamApps()
in hookey_steamapps.cpp should run, and fillhookey_steamApps
with both the real and fakeSteamApps
object? I noticed when WipeSteamApps was being called, there were no entries in hookey_steamApps.
No, this function should be called first: https://github.com/ZeGentzy/hookey/blob/master/hookey_impls.cpp#L18
Which mangles the function SteamApps
to call https://github.com/ZeGentzy/hookey/blob/master/hookey_steamapps.cpp#L65, before calling steam's init function.
When the game calls our special mangled SteamApps
function, we return a ptr to our class (Hookey_SteamApps_Class
) that implements the required ISteamApps*
interface.
When they call our class asking for DLC info and stuff, we override it as neccecary, or forward it to the real class.
I understand that you no longer have interest in this program (you'd probably rather help port the ksp mods to the newest versions), but could you tell me where you learned the information for making this library. I could not find CreamAPI source code anywhere.
I've never written a KSP mod before. :/
I also could not find the CreamAPI source code, I tried asking them on their fourms, offering to port it to linux myself, but I was silently ignored. :/ I guess it is a well guarded secret or something.
Nevertheless, their installation guide reveals that the main concept behind it is that they hijack the steam_api libs, and so I set out to do just that.
Here's some resources: http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html https://opensourceforu.com/2011/08/lets-hook-a-library-function/ https://blog.netspi.com/function-hooking-part-i-hooking-shared-library-function-calls-in-linux/ http://www-personal.umich.edu/~zhaoyich/blog/2013/07/linux-api-hooking.html
Oh, and this guide too: https://nickguletskii.com/blog/2016/07/24/function-hooking
I also recall there was an opengl one which was very interesting, alas, I can no longer find it.
EDIT: Anyways, if Stellaris is anything like EU4, you need to preload both 32-bit and 64-bit libraries. Just use LD_PRELOAD="$(pwd)/out-lib/libHookey32.so $(pwd)/out-lib/libHookey64.so"
instead of you're current command, and it might work as it is.
@DocNotADr We could chat on Matrix or freenode. My username on both is gentz.
Closing for inactivity.
Stellaris just updated, and I read some forums that CreamAPI stopped working for the new version.
I tried converting the DLC ids to Stellaris DLC ids, but it seems that the fake/ooked SteamApps never initializes. Below is the output of a debug log version of your code (I put printf in just about every function to see what was and was not being called)
LD_PRELOAD="/home/d/src/hookey/out-lib/libHookey64.so" ./stellaris
Close Program
hookey_impls.cpp.txt hookey_steamapps.cpp.txt
Maybe Im misunderstanding how this program works, but shouldn't there be a lot more print statements (that I added) being triggered? Specifically in
Hookey_SteamApps_Class