diff --git a/dll/dll/steam_networking_sockets.h b/dll/dll/steam_networking_sockets.h index abe289d7..036376d3 100644 --- a/dll/dll/steam_networking_sockets.h +++ b/dll/dll/steam_networking_sockets.h @@ -490,9 +490,6 @@ public: /// - k_EResultInvalidParam - nLanes is bad EResult GetConnectionRealTimeStatus( HSteamNetConnection hConn, SteamNetConnectionRealTimeStatus_t *pStatus, int nLanes, SteamNetConnectionRealTimeLaneStatus_t *pLanes ); - // based on reversing the vftable returned from original steamclient64.dll - bool GetConnectionRealTimeStatus_old( HSteamNetConnection hConn, SteamNetConnectionRealTimeStatus_t *pStatus ); - /// Fetch the next available message(s) from the socket, if any. /// Returns the number of messages returned into your array, up to nMaxMessages. /// If the connection handle is invalid, -1 is returned. diff --git a/dll/steam_networking_sockets.cpp b/dll/steam_networking_sockets.cpp index 696d7bf3..c789968b 100644 --- a/dll/steam_networking_sockets.cpp +++ b/dll/steam_networking_sockets.cpp @@ -950,24 +950,6 @@ EResult Steam_Networking_Sockets::GetConnectionRealTimeStatus( HSteamNetConnecti return k_EResultOK; } -// based on reversing the vftable returned from original steamclient64.dll -bool Steam_Networking_Sockets::GetConnectionRealTimeStatus_old( HSteamNetConnection hConn, SteamNetConnectionRealTimeStatus_t *pStatus ) -{ - PRINT_DEBUG("undocumented API, interface v10-11"); - /* - ... - xor r9d, r9d // int nLanes = 0 - mov qword ptr ss:[rsp+0x20], 0x0 // SteamNetConnectionRealTimeLaneStatus_t *pLanes = nullptr - ... - call qword ptr ds:[rax+0x80] // call GetConnectionRealTimeStatus(hConn, pStatus, nLanes, pLanes) - test eax, eax - setne al if (eax !=0) { al=1 } else { al=0 } - ... - ret - */ - return GetConnectionRealTimeStatus(hConn, pStatus, 0, nullptr) != EResult::k_EResultNone; -} - /// Fetch the next available message(s) from the socket, if any. /// Returns the number of messages returned into your array, up to nMaxMessages. /// If the connection handle is invalid, -1 is returned. @@ -1022,10 +1004,19 @@ bool Steam_Networking_Sockets::GetConnectionInfo( HSteamNetConnection hConn, Ste bool Steam_Networking_Sockets::GetQuickConnectionStatus( HSteamNetConnection hConn, SteamNetworkingQuickConnectionStatus *pStats ) { PRINT_DEBUG_ENTRY(); - if (!pStats) - return false; - - return GetConnectionRealTimeStatus(hConn, pStats, 0, NULL) == k_EResultOK; + // based on reversing the vftable returned from original steamclient64.dll + /* + ... + xor r9d, r9d // int nLanes = 0 + mov qword ptr ss:[rsp+0x20], 0x0 // SteamNetConnectionRealTimeLaneStatus_t *pLanes = nullptr + ... + call qword ptr ds:[rax+0x80] // call GetConnectionRealTimeStatus(hConn, pStatus, nLanes, pLanes) + test eax, eax + setne al if (eax !=0) { al=1 } else { al=0 } + ... + ret + */ + return GetConnectionRealTimeStatus(hConn, pStats, 0, NULL) != k_EResultNone; } diff --git a/dll/steam_user_stats_leaderboard.cpp b/dll/steam_user_stats_leaderboard.cpp index af2845f0..3665e82e 100644 --- a/dll/steam_user_stats_leaderboard.cpp +++ b/dll/steam_user_stats_leaderboard.cpp @@ -186,7 +186,7 @@ unsigned int Steam_User_Stats::cache_leaderboard_ifneeded(const std::string &nam // create a new entry in-memory and try reading the entries from disk struct Steam_Leaderboard new_board{}; - new_board.name = common_helpers::ascii_to_lowercase(name); + new_board.name = name; new_board.sort_method = eLeaderboardSortMethod; new_board.display_type = eLeaderboardDisplayType; new_board.entries = load_leaderboard_entries(name); diff --git a/sdk/steam/isteamnetworkingsockets010.h b/sdk/steam/isteamnetworkingsockets010.h index 1e260c88..589b3e6f 100644 --- a/sdk/steam/isteamnetworkingsockets010.h +++ b/sdk/steam/isteamnetworkingsockets010.h @@ -301,8 +301,9 @@ public: /// Returns basic information about the high-level state of the connection. virtual bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pInfo ) = 0; - // based on reversing the vftable returned from original steamclient64.dll - virtual bool GetConnectionRealTimeStatus_old( HSteamNetConnection hConn, SteamNetConnectionRealTimeStatus_t *pStatus ) = 0; + /// Returns a small set of information about the real-time state of the connection + /// Returns false if the connection handle is invalid, or the connection has ended. + virtual bool GetQuickConnectionStatus( HSteamNetConnection hConn, SteamNetworkingQuickConnectionStatus *pStats ) = 0; /// Returns detailed connection stats in text format. Useful /// for dumping to a log, etc. diff --git a/sdk/steam/isteamnetworkingsockets011.h b/sdk/steam/isteamnetworkingsockets011.h index 73fe8aa7..1550a884 100644 --- a/sdk/steam/isteamnetworkingsockets011.h +++ b/sdk/steam/isteamnetworkingsockets011.h @@ -301,8 +301,9 @@ public: /// Returns basic information about the high-level state of the connection. virtual bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pInfo ) = 0; - // based on reversing the vftable returned from original steamclient64.dll - virtual bool GetConnectionRealTimeStatus_old( HSteamNetConnection hConn, SteamNetConnectionRealTimeStatus_t *pStatus ) = 0; + /// Returns a small set of information about the real-time state of the connection + /// Returns false if the connection handle is invalid, or the connection has ended. + virtual bool GetQuickConnectionStatus( HSteamNetConnection hConn, SteamNetworkingQuickConnectionStatus *pStats ) = 0; /// Returns detailed connection stats in text format. Useful /// for dumping to a log, etc. diff --git a/tools/generate_emu_config/controller_config_generator/parse_controller_vdf.py b/tools/generate_emu_config/controller_config_generator/parse_controller_vdf.py index ff7a0958..e77cbcc0 100644 --- a/tools/generate_emu_config/controller_config_generator/parse_controller_vdf.py +++ b/tools/generate_emu_config/controller_config_generator/parse_controller_vdf.py @@ -30,6 +30,8 @@ keymap_digital = { } def add_input_bindings(group, bindings, force_binding=None, keymap=keymap_digital): + if "inputs" not in group: + return bindings for i in group["inputs"]: for act in group["inputs"][i]: for fp in group["inputs"][i][act]: diff --git a/tools/lobby_connect/lobby_connect.cpp b/tools/lobby_connect/lobby_connect.cpp index e5a0709d..596be87a 100644 --- a/tools/lobby_connect/lobby_connect.cpp +++ b/tools/lobby_connect/lobby_connect.cpp @@ -31,9 +31,18 @@ #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #include -#else - #endif + +void title() { + #ifdef _WIN32 + system("cls"); + #else + system("clear"); + #endif + + std::cout << "\n----Lobby Connect----\n\n"; +} + int main() { std::string appid_str(std::to_string(LOBBY_CONNECT_APPID)); set_env_variable("SteamAppId", appid_str); @@ -45,28 +54,32 @@ int main() { //Set appid to: LOBBY_CONNECT_APPID SteamAPI_RestartAppIfNecessary(LOBBY_CONNECT_APPID); - std::cout << "Lobby_Connect.exe for Goldberg Steam Emulator " << std::endl << std::endl; - std::cout << "Steam Emulator API initialized" << std::endl; -top: - std::cout << "Waiting a few seconds for connections" << std::endl << std::endl; + + refresh: + title(); + std::cout << "Please wait...\n"; + for (int i = 0; i < 10; ++i) { SteamAPI_RunCallbacks(); std::this_thread::sleep_for(std::chrono::milliseconds(200)); } - + int friend_count = SteamFriends()->GetFriendCount(k_EFriendFlagAll); - std::cout << "People on the network: " << friend_count << std::endl; + + /* + std::cout << "People on the network: " << friend_count << "\n"; for (int i = 0; i < friend_count; ++i) { CSteamID id = SteamFriends()->GetFriendByIndex(i, k_EFriendFlagAll); const char *name = SteamFriends()->GetFriendPersonaName(id); - + FriendGameInfo_t friend_info = {}; SteamFriends()->GetFriendGamePlayed(id, &friend_info); std::cout << name << " is playing: " << friend_info.m_gameID.AppID() << std::endl; } - - std::cout << std::endl << "----------------------Menu---------------------" << std::endl << " \tappid\t\tname\t\tcmdline" << std::endl << std::endl; - + */ + + title(); + std::vector> arguments; for (int i = 0; i < friend_count; ++i) { CSteamID id = SteamFriends()->GetFriendByIndex(i, k_EFriendFlagAll); @@ -75,100 +88,109 @@ top: FriendGameInfo_t friend_info = {}; SteamFriends()->GetFriendGamePlayed(id, &friend_info); auto appid = friend_info.m_gameID.AppID(); - + if (strlen(connect) > 0) { - std::cout << arguments.size() << ": \t" << appid << "\t\t" << name << "\t\t" << connect << std::endl; + std::cout << arguments.size() << " - " << name << " is playing " << appid << " (" << connect << ").\n"; arguments.emplace_back(connect, appid); } else { if (friend_info.m_steamIDLobby != k_steamIDNil) { std::string connect = "+connect_lobby " + std::to_string(friend_info.m_steamIDLobby.ConvertToUint64()); - std::cout << arguments.size() << ": \t" << appid << "\t\t" << name << "\t\t" << connect << std::endl; + std::cout << arguments.size() << " - " << name << " is playing " << appid << " (" << connect << ").\n"; arguments.emplace_back(connect, appid); } } } - - std::cout << arguments.size() << ": \tRetry" << std::endl; - std::cout << std::endl << "Enter the number corresponding to your choice then press Enter" << std::endl; + + std::cout << arguments.size() << " - Refresh.\n\n"; + std::cout << "Choose an option: "; unsigned int choice; std::cin >> choice; - - if (choice >= arguments.size()) goto top; - + + if (std::cin.fail() || choice >= arguments.size()) { + std::cin.clear(); + std::cin.ignore(std::numeric_limits::max(), '\n'); + goto refresh; + } + + title(); + auto connect = arguments[choice].first; -#ifdef _WIN32 - auto appid = arguments[choice].second; - std::cout << "Starting the game with: " << connect << std::endl; - - char szBaseDirectory[MAX_PATH] = ""; - GetModuleFileNameA(0, szBaseDirectory, MAX_PATH); - if (auto bs = strrchr(szBaseDirectory, '\\')) { - *bs = '\0'; - } - auto lobbyFile = std::string(szBaseDirectory) + "\\lobby_connect_" + std::to_string(appid) + ".txt"; - - auto readLobbyFile = [&lobbyFile]() { - std::string data; - std::ifstream ifs(std::filesystem::u8path(lobbyFile)); - if (ifs.is_open()) - std::getline(ifs, data); - return data; - }; - - auto writeLobbyFile = [&lobbyFile](const std::string& data) { - std::ofstream ofs(std::filesystem::u8path(lobbyFile)); - ofs << data << std::endl; - }; - - auto fileExists = [](const std::string& filename) { - std::ifstream ifs(std::filesystem::u8path(filename)); - return ifs.is_open(); - }; - - auto joinLobby = [&connect](std::string filename) { - filename = "\"" + filename + "\" " + connect; - std::cout << filename << std::endl; - - STARTUPINFOA lpStartupInfo; - PROCESS_INFORMATION lpProcessInfo; - - ZeroMemory( &lpStartupInfo, sizeof( lpStartupInfo ) ); - lpStartupInfo.cb = sizeof( lpStartupInfo ); - ZeroMemory( &lpProcessInfo, sizeof( lpProcessInfo ) ); - - auto success = !!CreateProcessA( NULL, - const_cast(filename.c_str()), NULL, NULL, - NULL, NULL, NULL, NULL, - &lpStartupInfo, - &lpProcessInfo - ); - - CloseHandle(lpProcessInfo.hThread); - CloseHandle(lpProcessInfo.hProcess); - return success; - }; - - std::string filename = readLobbyFile(); - if (filename.empty() || !fileExists(filename) || !joinLobby(filename)) { - std::cout << "Please browse for game exe" << std::endl; - - OPENFILENAMEA ofn; - char szFileName[MAX_PATH] = ""; - ZeroMemory(&ofn, sizeof(ofn)); - ofn.lStructSize = sizeof(ofn); - ofn.hwndOwner = 0; - ofn.lpstrFilter = "Exe Files (*.exe)\0*.exe\0All Files (*.*)\0*.*\0"; - ofn.lpstrFile = szFileName; - ofn.nMaxFile = MAX_PATH; - ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - ofn.lpstrDefExt = "exe"; - if(GetOpenFileNameA(&ofn) && joinLobby(szFileName)) { - writeLobbyFile(szFileName); - } - } -#else - std::cout << "Please launch the game with these arguments: " << connect << std::endl; -#endif - + + #ifdef _WIN32 + auto appid = arguments[choice].second; + std::cout << "Starting the game with: " << connect << "\n"; + + char szBaseDirectory[MAX_PATH] = ""; + GetModuleFileNameA(0, szBaseDirectory, MAX_PATH); + if (auto bs = strrchr(szBaseDirectory, '\\')) { + *bs = '\0'; + } + auto lobbyFile = std::string(szBaseDirectory) + "\\lobby_connect_" + std::to_string(appid) + ".txt"; + + auto readLobbyFile = [&lobbyFile]() { + std::string data; + std::ifstream ifs(std::filesystem::u8path(lobbyFile)); + if (ifs.is_open()) + std::getline(ifs, data); + return data; + }; + + auto writeLobbyFile = [&lobbyFile](const std::string& data) { + std::ofstream ofs(std::filesystem::u8path(lobbyFile)); + ofs << data << "\n"; + }; + + auto fileExists = [](const std::string& filename) { + std::ifstream ifs(std::filesystem::u8path(filename)); + return ifs.is_open(); + }; + + auto joinLobby = [&connect](std::string filename) { + filename = "\"" + filename + "\" " + connect; + std::cout << filename << std::endl; + + STARTUPINFOA lpStartupInfo; + PROCESS_INFORMATION lpProcessInfo; + + ZeroMemory( &lpStartupInfo, sizeof( lpStartupInfo ) ); + lpStartupInfo.cb = sizeof( lpStartupInfo ); + ZeroMemory( &lpProcessInfo, sizeof( lpProcessInfo ) ); + + auto success = !!CreateProcessA( NULL, + const_cast(filename.c_str()), NULL, NULL, + NULL, NULL, NULL, NULL, + &lpStartupInfo, + &lpProcessInfo + ); + + CloseHandle(lpProcessInfo.hThread); + CloseHandle(lpProcessInfo.hProcess); + return success; + }; + + std::string filename = readLobbyFile(); + if (filename.empty() || !fileExists(filename) || !joinLobby(filename)) { + std::cout << "Please select the game executable.\n"; + + OPENFILENAMEA ofn; + char szFileName[MAX_PATH] = ""; + ZeroMemory(&ofn, sizeof(ofn)); + ofn.lStructSize = sizeof(ofn); + ofn.hwndOwner = 0; + ofn.lpstrFilter = "Exe Files (*.exe)\0*.exe\0All Files (*.*)\0*.*\0"; + ofn.lpstrFile = szFileName; + ofn.nMaxFile = MAX_PATH; + ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; + ofn.lpstrDefExt = "exe"; + if(GetOpenFileNameA(&ofn) && joinLobby(szFileName)) { + writeLobbyFile(szFileName); + } + } + #else + std::cout << "Please launch the game with these arguments: " << connect << "\n\n"; + #endif + return 0; } + + diff --git a/tools/steamclient_loader/win/extra_protection/stubdrm.cpp b/tools/steamclient_loader/win/extra_protection/stubdrm.cpp index d94cb4a4..5b0481ef 100644 --- a/tools/steamclient_loader/win/extra_protection/stubdrm.cpp +++ b/tools/steamclient_loader/win/extra_protection/stubdrm.cpp @@ -104,6 +104,10 @@ typedef struct SnrDetails { "F6 C? 02 89 ?? ?? ?? ?? ?? A3 ?? ?? ?? ?? 0F 85", "?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 90 E9 00 03 00 00", }, + { + "F6 05 ?? ?? ?? ?? 02 89 ?? ?? 0F 85 ?? ?? ?? ?? 5? FF ?? 6?", + "?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 90 E9 03 03", + }, }, },