Add program to generate steam_interfaces.txt

merge-requests/6/head
Mr_Goldberg 2019-05-15 08:24:39 -04:00
parent c20944ca0a
commit cf05e58266
No known key found for this signature in database
GPG Key ID: 8597D87419DEF278
6 changed files with 92 additions and 3 deletions

View File

@ -0,0 +1,3 @@
Just drag your steam_api.dll or steam_api64.dll on the exe file and it will generate a steam_interfaces.txt file.
If it doesn't work, copy the steam_api dll beside the exe and then drag it on it or open up a command prompt and do: generate_interfaces_file.exe steam_api.dll

View File

@ -7,8 +7,9 @@ Put a steam_appid.txt file that contains the appid of the game right beside it i
If your game has an original steam_api(64).dll older than may 2016 (Properties->Digital Signatures->Timestamp) you might have to add a steam_interfaces.txt beside my emulator library if the game isn't working. If your game has an original steam_api(64).dll older than may 2016 (Properties->Digital Signatures->Timestamp) you might have to add a steam_interfaces.txt beside my emulator library if the game isn't working.
This file contains interface versions, an example (for resident evil 5) is provided. This file contains interface versions, an example (for resident evil 5) is provided.
If you are on linux you can look in the linux/tools folder (or the scripts folder in the repo) for a script to generate the steam_interfaces.txt file. If you are on Windows, look in the tools folder for a program to generate the steam_interfaces.txt file.
If you are on linux you can look in the linux/tools folder (or the scripts folder in the repo) for a script to generate the steam_interfaces.txt file.
You can also just get a hex editor and search for them (Search for the string: SteamUser0) in the original steam_api dll (or libsteam_api.so on linux) or look in the ini of a crack that works on that game. You can also just get a hex editor and search for them (Search for the string: SteamUser0) in the original steam_api dll (or libsteam_api.so on linux) or look in the ini of a crack that works on that game.

View File

@ -0,0 +1,7 @@
mkdir release\tools
del /Q release\tools\*
call build_env_x86.bat
cl generate_interfaces_file.cpp /EHsc /MP12 /Ox /link /debug:none /OUT:release\tools\generate_interfaces_file.exe
del /Q /S release\tools\*.lib
del /Q /S release\tools\*.exp
copy Readme_generate_interfaces.txt release\tools\Readme_generate_interfaces.txt

View File

@ -16,3 +16,4 @@ copy Readme_release.txt release\Readme.txt
xcopy /s files_example\* release\ xcopy /s files_example\* release\
call build_win_release_experimental.bat call build_win_release_experimental.bat
call build_win_lobby_connect.bat call build_win_lobby_connect.bat
call build_win_find_interfaces.bat

View File

@ -684,7 +684,7 @@ void *Steam_Client::GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe
return GetISteamFriends(hSteamUser, hSteamPipe, pchVersion); return GetISteamFriends(hSteamUser, hSteamPipe, pchVersion);
} else if (strstr(pchVersion, "SteamMatchMaking") == pchVersion) { } else if (strstr(pchVersion, "SteamMatchMaking") == pchVersion) {
return GetISteamMatchmaking(hSteamUser, hSteamPipe, pchVersion); return GetISteamMatchmaking(hSteamUser, hSteamPipe, pchVersion);
} else if (strstr(pchVersion, "SteamController") == pchVersion) { } else if (strstr(pchVersion, "SteamController") == pchVersion || strstr(pchVersion, "STEAMCONTROLLER_INTERFACE_VERSION") == pchVersion) {
return GetISteamController(hSteamUser, hSteamPipe, pchVersion); return GetISteamController(hSteamUser, hSteamPipe, pchVersion);
} else if (strstr(pchVersion, "STEAMUGC_INTERFACE_VERSION") == pchVersion) { } else if (strstr(pchVersion, "STEAMUGC_INTERFACE_VERSION") == pchVersion) {
return GetISteamUGC(hSteamUser, hSteamPipe, pchVersion); return GetISteamUGC(hSteamUser, hSteamPipe, pchVersion);

View File

@ -0,0 +1,77 @@
#include <regex>
#include <string>
#include <fstream>
#include <streambuf>
#include <iostream>
unsigned int findinterface(std::ofstream &out_file, std::string &file_contents, std::string interface)
{
std::regex interface_regex(interface);
auto begin = std::sregex_iterator(file_contents.begin(), file_contents.end(), interface_regex);
auto end = std::sregex_iterator();
unsigned int matches = 0;
for (std::sregex_iterator i = begin; i != end; ++i) {
std::smatch match = *i;
std::string match_str = match.str();
out_file << match_str << std::endl;
++matches;
}
return matches;
}
int main (int argc, char *argv[])
{
if (argc < 2) {
std::cout << "usage: " << argv[0] << " <path to steam_api .dll or .so>" << std::endl;
return 1;
}
std::ifstream steam_api_file(argv[1], std::ios::binary);
std::string steam_api_contents((std::istreambuf_iterator<char>(steam_api_file)),
std::istreambuf_iterator<char>());
steam_api_file.close();
if (steam_api_contents.size() == 0) {
std::cout << "Error opening file" << std::endl;
return 1;
}
std::ofstream out_file("steam_interfaces.txt");
std::vector<std::string> interface_names = {"SteamClient",
"SteamGameServer",
"SteamGameServerStats",
"SteamUser",
"SteamFriends",
"SteamUtils",
"SteamMatchMaking",
"SteamMatchMakingServers",
"STEAMUSERSTATS_INTERFACE_VERSION",
"STEAMAPPS_INTERFACE_VERSION",
"SteamNetworking",
"STEAMREMOTESTORAGE_INTERFACE_VERSION",
"STEAMSCREENSHOTS_INTERFACE_VERSION",
"STEAMHTTP_INTERFACE_VERSION",
"STEAMUNIFIEDMESSAGES_INTERFACE_VERSION",
"STEAMUGC_INTERFACE_VERSION",
"STEAMAPPLIST_INTERFACE_VERSION",
"STEAMMUSIC_INTERFACE_VERSION",
"STEAMMUSICREMOTE_INTERFACE_VERSION",
"STEAMHTMLSURFACE_INTERFACE_VERSION_",
"STEAMINVENTORY_INTERFACE_V",
"SteamController",
"SteamMasterServerUpdater",
"STEAMVIDEO_INTERFACE_V"};
for (auto name : interface_names) {
findinterface(out_file, steam_api_contents, name + "\\d{3}");
}
if (!findinterface(out_file, steam_api_contents, "STEAMCONTROLLER_INTERFACE_VERSION\\d{3}")) {
findinterface(out_file, steam_api_contents, "STEAMCONTROLLER_INTERFACE_VERSION");
}
out_file.close();
}