Add a way to config the build id in the emu. Fix crash due to empty lines

in some files

Add a way to disable lobby creation in the emu (lobby creation will return
an error when enabled)
This commit is contained in:
Mr_Goldberg 2021-08-07 01:46:10 -04:00
parent a855cde651
commit f041b95c86
No known key found for this signature in database
GPG key ID: 8597D87419DEF278
6 changed files with 64 additions and 23 deletions

View file

@ -105,6 +105,11 @@ The format is: STAT_NAME=type=default value
The type can be: int, float or avgrate The type can be: int, float or avgrate
The default value is simply a number that represents the default value for the stat. The default value is simply a number that represents the default value for the stat.
Build id:
Add a steam_settings\build_id.txt with the build id if the game doesn't show the correct build id and you want the emu to give it the correct one.
An example can be found in steam_settings.EXAMPLE
Support for CPY steam_api(64).dll cracks: See the build in the experimental folder. Support for CPY steam_api(64).dll cracks: See the build in the experimental folder.
Notes: Notes:

View file

@ -149,6 +149,12 @@ public:
//overlay //overlay
bool disable_overlay = false; bool disable_overlay = false;
//app build id
int build_id = 10;
//make lobby creation fail in the matchmaking interface
bool disable_lobby_creation = false;
}; };
#endif #endif

View file

@ -260,6 +260,9 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
bool steam_offline_mode = false; bool steam_offline_mode = false;
bool disable_networking = false; bool disable_networking = false;
bool disable_overlay = false; bool disable_overlay = false;
bool disable_lobby_creation = false;
int build_id = 10;
{ {
std::string steam_settings_path = Local_Storage::get_game_settings_path(); std::string steam_settings_path = Local_Storage::get_game_settings_path();
@ -272,6 +275,8 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
disable_networking = true; disable_networking = true;
} else if (p == "disable_overlay.txt") { } else if (p == "disable_overlay.txt") {
disable_overlay = true; disable_overlay = true;
} else if (p == "disable_lobby_creation.txt") {
disable_lobby_creation = true;
} else if (p == "force_language.txt") { } else if (p == "force_language.txt") {
int len = Local_Storage::get_file_data(steam_settings_path + "force_language.txt", language, sizeof(language) - 1); int len = Local_Storage::get_file_data(steam_settings_path + "force_language.txt", language, sizeof(language) - 1);
if (len > 0) language[len] = 0; if (len > 0) language[len] = 0;
@ -290,6 +295,10 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
char array_port[10] = {}; char array_port[10] = {};
int len = Local_Storage::get_file_data(steam_settings_path + "force_listen_port.txt", array_port, sizeof(array_port) - 1); int len = Local_Storage::get_file_data(steam_settings_path + "force_listen_port.txt", array_port, sizeof(array_port) - 1);
if (len > 0) port = std::stoi(array_port); if (len > 0) port = std::stoi(array_port);
} else if (p == "build_id.txt") {
char array_id[10] = {};
int len = Local_Storage::get_file_data(steam_settings_path + "build_id.txt", array_id, sizeof(array_id) - 1);
if (len > 0) build_id = std::stoi(array_id);
} }
} }
} }
@ -304,6 +313,10 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
settings_server->disable_networking = disable_networking; settings_server->disable_networking = disable_networking;
settings_client->disable_overlay = disable_overlay; settings_client->disable_overlay = disable_overlay;
settings_server->disable_overlay = disable_overlay; settings_server->disable_overlay = disable_overlay;
settings_client->disable_lobby_creation = disable_lobby_creation;
settings_server->disable_lobby_creation = disable_lobby_creation;
settings_client->build_id = build_id;
settings_server->build_id = build_id;
{ {
std::string dlc_config_path = Local_Storage::get_game_settings_path() + "DLC.txt"; std::string dlc_config_path = Local_Storage::get_game_settings_path() + "DLC.txt";
@ -503,10 +516,12 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
line.pop_back(); line.pop_back();
} }
DepotId_t depot_id = stoul(line); try {
DepotId_t depot_id = std::stoul(line);
settings_client->depots.push_back(depot_id); settings_client->depots.push_back(depot_id);
settings_server->depots.push_back(depot_id); settings_server->depots.push_back(depot_id);
PRINT_DEBUG("Added depot %u\n", depot_id); PRINT_DEBUG("Added depot %u\n", depot_id);
} catch (...) {}
} }
} }
} }
@ -525,10 +540,12 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
line.pop_back(); line.pop_back();
} }
uint64 source_id = stoull(line); try {
uint64 source_id = std::stoull(line);
settings_client->subscribed_groups.insert(source_id); settings_client->subscribed_groups.insert(source_id);
settings_server->subscribed_groups.insert(source_id); settings_server->subscribed_groups.insert(source_id);
PRINT_DEBUG("Added source %llu\n", source_id); PRINT_DEBUG("Added source %llu\n", source_id);
} catch (...) {}
} }
} }
} }

View file

@ -262,7 +262,7 @@ bool Steam_Apps::GetDlcDownloadProgress( AppId_t nAppID, uint64 *punBytesDownloa
int Steam_Apps::GetAppBuildId() int Steam_Apps::GetAppBuildId()
{ {
PRINT_DEBUG("GetAppBuildId\n"); PRINT_DEBUG("GetAppBuildId\n");
return 10; return this->settings->build_id;
} }

View file

@ -559,6 +559,13 @@ void Create_pending_lobbies()
enter_lobby(&lobby, settings->get_local_steam_id()); enter_lobby(&lobby, settings->get_local_steam_id());
lobbies.push_back(lobby); lobbies.push_back(lobby);
if (settings->disable_lobby_creation) {
LobbyCreated_t data;
data.m_eResult = k_EResultFail;
data.m_ulSteamIDLobby = 0;
callback_results->addCallResult(p_c->api_id, data.k_iCallback, &data, sizeof(data));
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
} else {
LobbyCreated_t data; LobbyCreated_t data;
data.m_eResult = k_EResultOK; data.m_eResult = k_EResultOK;
data.m_ulSteamIDLobby = lobby.room_id(); data.m_ulSteamIDLobby = lobby.room_id();
@ -569,6 +576,9 @@ void Create_pending_lobbies()
LobbyEnter_t data; LobbyEnter_t data;
data.m_ulSteamIDLobby = lobby.room_id(); data.m_ulSteamIDLobby = lobby.room_id();
data.m_rgfChatPermissions = 0; //Unused - Always 0 data.m_rgfChatPermissions = 0; //Unused - Always 0
if (p_c->eLobbyType == k_ELobbyTypePrivate)
data.m_bLocked = true;
else
data.m_bLocked = false; data.m_bLocked = false;
data.m_EChatRoomEnterResponse = k_EChatRoomEnterResponseSuccess; data.m_EChatRoomEnterResponse = k_EChatRoomEnterResponseSuccess;
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data)); callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
@ -576,6 +586,8 @@ void Create_pending_lobbies()
on_self_enter_leave_lobby(lobby_id, p_c->eLobbyType, false); on_self_enter_leave_lobby(lobby_id, p_c->eLobbyType, false);
trigger_lobby_dataupdate(lobby_id, lobby_id, true); trigger_lobby_dataupdate(lobby_id, lobby_id, true);
}
p_c = pending_creates.erase(p_c); p_c = pending_creates.erase(p_c);
} else { } else {
++p_c; ++p_c;

View file

@ -0,0 +1 @@
12345