Merge branch 'dev' into dev

This commit is contained in:
alex47exe 2024-09-16 15:17:36 +01:00 committed by GitHub
commit c0b071e78a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 143 additions and 125 deletions

View File

@ -490,9 +490,6 @@ public:
/// - k_EResultInvalidParam - nLanes is bad /// - k_EResultInvalidParam - nLanes is bad
EResult GetConnectionRealTimeStatus( HSteamNetConnection hConn, SteamNetConnectionRealTimeStatus_t *pStatus, int nLanes, SteamNetConnectionRealTimeLaneStatus_t *pLanes ); 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. /// Fetch the next available message(s) from the socket, if any.
/// Returns the number of messages returned into your array, up to nMaxMessages. /// Returns the number of messages returned into your array, up to nMaxMessages.
/// If the connection handle is invalid, -1 is returned. /// If the connection handle is invalid, -1 is returned.

View File

@ -950,24 +950,6 @@ EResult Steam_Networking_Sockets::GetConnectionRealTimeStatus( HSteamNetConnecti
return k_EResultOK; 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. /// Fetch the next available message(s) from the socket, if any.
/// Returns the number of messages returned into your array, up to nMaxMessages. /// Returns the number of messages returned into your array, up to nMaxMessages.
/// If the connection handle is invalid, -1 is returned. /// 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 ) bool Steam_Networking_Sockets::GetQuickConnectionStatus( HSteamNetConnection hConn, SteamNetworkingQuickConnectionStatus *pStats )
{ {
PRINT_DEBUG_ENTRY(); PRINT_DEBUG_ENTRY();
if (!pStats) // based on reversing the vftable returned from original steamclient64.dll
return false; /*
...
return GetConnectionRealTimeStatus(hConn, pStats, 0, NULL) == k_EResultOK; 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;
} }

View File

@ -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 // create a new entry in-memory and try reading the entries from disk
struct Steam_Leaderboard new_board{}; 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.sort_method = eLeaderboardSortMethod;
new_board.display_type = eLeaderboardDisplayType; new_board.display_type = eLeaderboardDisplayType;
new_board.entries = load_leaderboard_entries(name); new_board.entries = load_leaderboard_entries(name);

View File

@ -301,8 +301,9 @@ public:
/// Returns basic information about the high-level state of the connection. /// Returns basic information about the high-level state of the connection.
virtual bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pInfo ) = 0; virtual bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pInfo ) = 0;
// based on reversing the vftable returned from original steamclient64.dll /// Returns a small set of information about the real-time state of the connection
virtual bool GetConnectionRealTimeStatus_old( HSteamNetConnection hConn, SteamNetConnectionRealTimeStatus_t *pStatus ) = 0; /// 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 /// Returns detailed connection stats in text format. Useful
/// for dumping to a log, etc. /// for dumping to a log, etc.

View File

@ -301,8 +301,9 @@ public:
/// Returns basic information about the high-level state of the connection. /// Returns basic information about the high-level state of the connection.
virtual bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pInfo ) = 0; virtual bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pInfo ) = 0;
// based on reversing the vftable returned from original steamclient64.dll /// Returns a small set of information about the real-time state of the connection
virtual bool GetConnectionRealTimeStatus_old( HSteamNetConnection hConn, SteamNetConnectionRealTimeStatus_t *pStatus ) = 0; /// 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 /// Returns detailed connection stats in text format. Useful
/// for dumping to a log, etc. /// for dumping to a log, etc.

View File

@ -30,6 +30,8 @@ keymap_digital = {
} }
def add_input_bindings(group, bindings, force_binding=None, keymap=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 i in group["inputs"]:
for act in group["inputs"][i]: for act in group["inputs"][i]:
for fp in group["inputs"][i][act]: for fp in group["inputs"][i][act]:

View File

@ -31,9 +31,18 @@
#ifdef _WIN32 #ifdef _WIN32
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#else
#endif #endif
void title() {
#ifdef _WIN32
system("cls");
#else
system("clear");
#endif
std::cout << "\n----Lobby Connect----\n\n";
}
int main() { int main() {
std::string appid_str(std::to_string(LOBBY_CONNECT_APPID)); std::string appid_str(std::to_string(LOBBY_CONNECT_APPID));
set_env_variable("SteamAppId", appid_str); set_env_variable("SteamAppId", appid_str);
@ -45,17 +54,20 @@ int main() {
//Set appid to: LOBBY_CONNECT_APPID //Set appid to: LOBBY_CONNECT_APPID
SteamAPI_RestartAppIfNecessary(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; refresh:
top: title();
std::cout << "Waiting a few seconds for connections" << std::endl << std::endl; std::cout << "Please wait...\n";
for (int i = 0; i < 10; ++i) { for (int i = 0; i < 10; ++i) {
SteamAPI_RunCallbacks(); SteamAPI_RunCallbacks();
std::this_thread::sleep_for(std::chrono::milliseconds(200)); std::this_thread::sleep_for(std::chrono::milliseconds(200));
} }
int friend_count = SteamFriends()->GetFriendCount(k_EFriendFlagAll); 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) { for (int i = 0; i < friend_count; ++i) {
CSteamID id = SteamFriends()->GetFriendByIndex(i, k_EFriendFlagAll); CSteamID id = SteamFriends()->GetFriendByIndex(i, k_EFriendFlagAll);
const char *name = SteamFriends()->GetFriendPersonaName(id); const char *name = SteamFriends()->GetFriendPersonaName(id);
@ -64,8 +76,9 @@ top:
SteamFriends()->GetFriendGamePlayed(id, &friend_info); SteamFriends()->GetFriendGamePlayed(id, &friend_info);
std::cout << name << " is playing: " << friend_info.m_gameID.AppID() << std::endl; 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<std::pair<std::string, uint32>> arguments; std::vector<std::pair<std::string, uint32>> arguments;
for (int i = 0; i < friend_count; ++i) { for (int i = 0; i < friend_count; ++i) {
@ -77,98 +90,107 @@ top:
auto appid = friend_info.m_gameID.AppID(); auto appid = friend_info.m_gameID.AppID();
if (strlen(connect) > 0) { 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); arguments.emplace_back(connect, appid);
} else { } else {
if (friend_info.m_steamIDLobby != k_steamIDNil) { if (friend_info.m_steamIDLobby != k_steamIDNil) {
std::string connect = "+connect_lobby " + std::to_string(friend_info.m_steamIDLobby.ConvertToUint64()); 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); arguments.emplace_back(connect, appid);
} }
} }
} }
std::cout << arguments.size() << ": \tRetry" << std::endl; std::cout << arguments.size() << " - Refresh.\n\n";
std::cout << std::endl << "Enter the number corresponding to your choice then press Enter" << std::endl; std::cout << "Choose an option: ";
unsigned int choice; unsigned int choice;
std::cin >> 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<std::streamsize>::max(), '\n');
goto refresh;
}
title();
auto connect = arguments[choice].first; 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] = ""; #ifdef _WIN32
GetModuleFileNameA(0, szBaseDirectory, MAX_PATH); auto appid = arguments[choice].second;
if (auto bs = strrchr(szBaseDirectory, '\\')) { std::cout << "Starting the game with: " << connect << "\n";
*bs = '\0';
}
auto lobbyFile = std::string(szBaseDirectory) + "\\lobby_connect_" + std::to_string(appid) + ".txt";
auto readLobbyFile = [&lobbyFile]() { char szBaseDirectory[MAX_PATH] = "";
std::string data; GetModuleFileNameA(0, szBaseDirectory, MAX_PATH);
std::ifstream ifs(std::filesystem::u8path(lobbyFile)); if (auto bs = strrchr(szBaseDirectory, '\\')) {
if (ifs.is_open()) *bs = '\0';
std::getline(ifs, data); }
return data; auto lobbyFile = std::string(szBaseDirectory) + "\\lobby_connect_" + std::to_string(appid) + ".txt";
};
auto writeLobbyFile = [&lobbyFile](const std::string& data) { auto readLobbyFile = [&lobbyFile]() {
std::ofstream ofs(std::filesystem::u8path(lobbyFile)); std::string data;
ofs << data << std::endl; std::ifstream ifs(std::filesystem::u8path(lobbyFile));
}; if (ifs.is_open())
std::getline(ifs, data);
return data;
};
auto fileExists = [](const std::string& filename) { auto writeLobbyFile = [&lobbyFile](const std::string& data) {
std::ifstream ifs(std::filesystem::u8path(filename)); std::ofstream ofs(std::filesystem::u8path(lobbyFile));
return ifs.is_open(); ofs << data << "\n";
}; };
auto joinLobby = [&connect](std::string filename) { auto fileExists = [](const std::string& filename) {
filename = "\"" + filename + "\" " + connect; std::ifstream ifs(std::filesystem::u8path(filename));
std::cout << filename << std::endl; return ifs.is_open();
};
STARTUPINFOA lpStartupInfo; auto joinLobby = [&connect](std::string filename) {
PROCESS_INFORMATION lpProcessInfo; filename = "\"" + filename + "\" " + connect;
std::cout << filename << std::endl;
ZeroMemory( &lpStartupInfo, sizeof( lpStartupInfo ) ); STARTUPINFOA lpStartupInfo;
lpStartupInfo.cb = sizeof( lpStartupInfo ); PROCESS_INFORMATION lpProcessInfo;
ZeroMemory( &lpProcessInfo, sizeof( lpProcessInfo ) );
auto success = !!CreateProcessA( NULL, ZeroMemory( &lpStartupInfo, sizeof( lpStartupInfo ) );
const_cast<char *>(filename.c_str()), NULL, NULL, lpStartupInfo.cb = sizeof( lpStartupInfo );
NULL, NULL, NULL, NULL, ZeroMemory( &lpProcessInfo, sizeof( lpProcessInfo ) );
&lpStartupInfo,
&lpProcessInfo
);
CloseHandle(lpProcessInfo.hThread); auto success = !!CreateProcessA( NULL,
CloseHandle(lpProcessInfo.hProcess); const_cast<char *>(filename.c_str()), NULL, NULL,
return success; NULL, NULL, NULL, NULL,
}; &lpStartupInfo,
&lpProcessInfo
);
std::string filename = readLobbyFile(); CloseHandle(lpProcessInfo.hThread);
if (filename.empty() || !fileExists(filename) || !joinLobby(filename)) { CloseHandle(lpProcessInfo.hProcess);
std::cout << "Please browse for game exe" << std::endl; return success;
};
OPENFILENAMEA ofn; std::string filename = readLobbyFile();
char szFileName[MAX_PATH] = ""; if (filename.empty() || !fileExists(filename) || !joinLobby(filename)) {
ZeroMemory(&ofn, sizeof(ofn)); std::cout << "Please select the game executable.\n";
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = 0; OPENFILENAMEA ofn;
ofn.lpstrFilter = "Exe Files (*.exe)\0*.exe\0All Files (*.*)\0*.*\0"; char szFileName[MAX_PATH] = "";
ofn.lpstrFile = szFileName; ZeroMemory(&ofn, sizeof(ofn));
ofn.nMaxFile = MAX_PATH; ofn.lStructSize = sizeof(ofn);
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; ofn.hwndOwner = 0;
ofn.lpstrDefExt = "exe"; ofn.lpstrFilter = "Exe Files (*.exe)\0*.exe\0All Files (*.*)\0*.*\0";
if(GetOpenFileNameA(&ofn) && joinLobby(szFileName)) { ofn.lpstrFile = szFileName;
writeLobbyFile(szFileName); ofn.nMaxFile = MAX_PATH;
} ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
} ofn.lpstrDefExt = "exe";
#else if(GetOpenFileNameA(&ofn) && joinLobby(szFileName)) {
std::cout << "Please launch the game with these arguments: " << connect << std::endl; writeLobbyFile(szFileName);
#endif }
}
#else
std::cout << "Please launch the game with these arguments: " << connect << "\n\n";
#endif
return 0; return 0;
} }

View File

@ -104,6 +104,10 @@ typedef struct SnrDetails {
"F6 C? 02 89 ?? ?? ?? ?? ?? A3 ?? ?? ?? ?? 0F 85", "F6 C? 02 89 ?? ?? ?? ?? ?? A3 ?? ?? ?? ?? 0F 85",
"?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 90 E9 00 03 00 00", "?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 90 E9 00 03 00 00",
}, },
{
"F6 05 ?? ?? ?? ?? 02 89 ?? ?? 0F 85 ?? ?? ?? ?? 5? FF ?? 6?",
"?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 90 E9 03 03",
},
}, },
}, },