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 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.
Notes:

View File

@ -149,6 +149,12 @@ public:
//overlay
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

View File

@ -260,6 +260,9 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
bool steam_offline_mode = false;
bool disable_networking = 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();
@ -272,6 +275,8 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
disable_networking = true;
} else if (p == "disable_overlay.txt") {
disable_overlay = true;
} else if (p == "disable_lobby_creation.txt") {
disable_lobby_creation = true;
} else if (p == "force_language.txt") {
int len = Local_Storage::get_file_data(steam_settings_path + "force_language.txt", language, sizeof(language) - 1);
if (len > 0) language[len] = 0;
@ -290,6 +295,10 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
char array_port[10] = {};
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);
} 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_client->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";
@ -503,10 +516,12 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
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_server->depots.push_back(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();
}
uint64 source_id = stoull(line);
try {
uint64 source_id = std::stoull(line);
settings_client->subscribed_groups.insert(source_id);
settings_server->subscribed_groups.insert(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()
{
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());
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;
data.m_eResult = k_EResultOK;
data.m_ulSteamIDLobby = lobby.room_id();
@ -569,6 +576,9 @@ void Create_pending_lobbies()
LobbyEnter_t data;
data.m_ulSteamIDLobby = lobby.room_id();
data.m_rgfChatPermissions = 0; //Unused - Always 0
if (p_c->eLobbyType == k_ELobbyTypePrivate)
data.m_bLocked = true;
else
data.m_bLocked = false;
data.m_EChatRoomEnterResponse = k_EChatRoomEnterResponseSuccess;
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);
trigger_lobby_dataupdate(lobby_id, lobby_id, true);
}
p_c = pending_creates.erase(p_c);
} else {
++p_c;

View File

@ -0,0 +1 @@
12345