Compare commits

..

3 Commits

Author SHA1 Message Date
Mr_Goldberg 992e5c3faa
Properly initialize user_achievements so functions like
getachievementandunlocktime work properly.
2021-02-28 19:26:29 -05:00
Mr_Goldberg 58a57cc91b
Fix coding mistake in networking socket receive functions. 2021-02-27 16:29:40 -05:00
Mr_Goldberg 8e9d3e8f3a
Add force_listen_port.txt 2021-02-27 16:28:59 -05:00
5 changed files with 19 additions and 4 deletions

View File

@ -29,7 +29,7 @@ Note that these are global so you won't have to change them for each game. For g
If you want to change your steam_id on a per game basis, simply create a settings folder in the game unique directory (Full path: C:\Users\<Your windows user name>\AppData\Roaming\Goldberg SteamEmu Saves\<appid>\settings)
In that settings folder create a user_steam_id.txt file that contains the valid steam id that you want to use for that game only.
You can also make the emu ignore certain global settings by using a force_account_name.txt, force_language.txt or force_steamid.txt that you put in the <path where my emu lib is>\steam_settings\ folder.
You can also make the emu ignore certain global settings by using a force_account_name.txt, force_language.txt, force_listen_port.txt or force_steamid.txt that you put in the <path where my emu lib is>\steam_settings\ folder.
See the steam_settings.EXAMPLE folder for an example.
If for some reason you want it to save in the game directory you can create a file named local_save.txt right beside steam_api(64).dll (libsteam_api.so on linux)

View File

@ -286,6 +286,10 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
} else if (p == "force_account_name.txt") {
int len = Local_Storage::get_file_data(steam_settings_path + "force_account_name.txt", name, sizeof(name) - 1);
if (len > 0) name[len] = 0;
} else if (p == "force_listen_port.txt") {
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);
}
}
}

View File

@ -793,7 +793,7 @@ int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessa
std::lock_guard<std::recursive_mutex> lock(global_mutex);
SteamNetworkingMessage_t *msg = NULL;
int messages = 0;
while ((msg = get_steam_message_connection(hConn)) && messages < nMaxMessages) {
while (messages < nMaxMessages && (msg = get_steam_message_connection(hConn))) {
ppOutMessages[messages] = msg;
++messages;
}
@ -821,7 +821,7 @@ int ReceiveMessagesOnListenSocket( HSteamListenSocket hSocket, SteamNetworkingMe
auto socket_conn = std::begin(connect_sockets);
while (socket_conn != std::end(connect_sockets) && messages < nMaxMessages) {
if (socket_conn->second.listen_socket_id == hSocket) {
while ((msg = get_steam_message_connection(socket_conn->first)) && messages < nMaxMessages) {
while (messages < nMaxMessages && (msg = get_steam_message_connection(socket_conn->first))) {
ppOutMessages[messages] = msg;
++messages;
}
@ -1197,7 +1197,7 @@ int ReceiveMessagesOnPollGroup( HSteamNetPollGroup hPollGroup, SteamNetworkingMe
int messages = 0;
for (auto c : group->second) {
while ((msg = get_steam_message_connection(c)) && messages < nMaxMessages) {
while (messages < nMaxMessages && (msg = get_steam_message_connection(c))) {
ppOutMessages[messages] = msg;
++messages;
}

View File

@ -94,6 +94,16 @@ Steam_User_Stats(Settings *settings, Local_Storage *local_storage, class SteamCa
{
load_achievements_db(); // achievements db
load_achievements(); // achievements per user
for (auto & it : defined_achievements) {
try {
std::string name = static_cast<std::string const&>(it["name"]);
if (user_achievements.find(name) == user_achievements.end()) {
user_achievements[name]["earned"] = false;
user_achievements[name]["earned_time"] = static_cast<uint32>(0);
}
} catch (...) {}
}
}
// Ask the server to send down this user's data and achievements for this game

View File

@ -0,0 +1 @@
47584