Compare commits

...

5 Commits

7 changed files with 32 additions and 20 deletions

View File

@ -62,7 +62,7 @@ build_windows:
- dnf -y install wine wget p7zip sed dos2unix - dnf -y install wine wget p7zip sed dos2unix
- unix2dos *.txt - unix2dos *.txt
- unix2dos files_example/*.txt files_example/*/*.txt - unix2dos files_example/*.txt files_example/*/*.txt
- sed -i 's/..\\vcpkg\\packages\\/.\\/g' build_set_protobuf_directories.bat - sed -i 's/..\\vcpkg\\installed\\/.\\/g' build_set_protobuf_directories.bat
- wget 'https://gitlab.com/Mr_Goldberg/goldberg_emulator/uploads/48db8f434a193aae872279dc4f5dde6a/sdk_standalone.7z' - wget 'https://gitlab.com/Mr_Goldberg/goldberg_emulator/uploads/48db8f434a193aae872279dc4f5dde6a/sdk_standalone.7z'
- wget 'https://gitlab.com/Mr_Goldberg/goldberg_emulator/uploads/0119304e030098b4821d73170fe52084/protobuf_x64-windows-static.7z' - wget 'https://gitlab.com/Mr_Goldberg/goldberg_emulator/uploads/0119304e030098b4821d73170fe52084/protobuf_x64-windows-static.7z'
- wget 'https://gitlab.com/Mr_Goldberg/goldberg_emulator/uploads/4185a97ab363ddc1859127e59ec68581/protobuf_x86-windows-static.7z' - wget 'https://gitlab.com/Mr_Goldberg/goldberg_emulator/uploads/4185a97ab363ddc1859127e59ec68581/protobuf_x86-windows-static.7z'

View File

@ -1,7 +1,7 @@
@echo off @echo off
cd /d "%~dp0" cd /d "%~dp0"
SET PROTOBUF_X86_DIRECTORY=..\vcpkg\packages\protobuf_x86-windows-static SET PROTOBUF_X86_DIRECTORY=..\vcpkg\installed\protobuf_x86-windows-static
SET PROTOBUF_X64_DIRECTORY=..\vcpkg\packages\protobuf_x64-windows-static SET PROTOBUF_X64_DIRECTORY=..\vcpkg\installed\protobuf_x64-windows-static
rem location of protoc in protobuf directories: rem location of protoc in protobuf directories:
SET PROTOC_X86_EXE=%PROTOBUF_X86_DIRECTORY%\tools\protobuf\protoc.exe SET PROTOC_X86_EXE=%PROTOBUF_X86_DIRECTORY%\tools\protobuf\protoc.exe

View File

@ -111,7 +111,7 @@ public:
}; };
#define STEAM_CALLRESULT_TIMEOUT 120.0 #define STEAM_CALLRESULT_TIMEOUT 120.0
#define STEAM_CALLRESULT_WAIT_FOR_CB 0.05 #define STEAM_CALLRESULT_WAIT_FOR_CB 0.01
struct Steam_Call_Result { struct Steam_Call_Result {
Steam_Call_Result(SteamAPICall_t a, int icb, void *r, unsigned int s, double r_in, bool run_cc_cb) { Steam_Call_Result(SteamAPICall_t a, int icb, void *r, unsigned int s, double r_in, bool run_cc_cb) {
api_call = a; api_call = a;
@ -243,9 +243,11 @@ public:
auto cb_result = std::find_if(callresults.begin(), callresults.end(), [api_call](struct Steam_Call_Result const& item) { return item.api_call == api_call; }); auto cb_result = std::find_if(callresults.begin(), callresults.end(), [api_call](struct Steam_Call_Result const& item) { return item.api_call == api_call; });
if (cb_result != callresults.end()) { if (cb_result != callresults.end()) {
if (cb_result->reserved) { if (cb_result->reserved) {
std::chrono::high_resolution_clock::time_point created = cb_result->created;
std::vector<class CCallbackBase *> temp_cbs = cb_result->callbacks; std::vector<class CCallbackBase *> temp_cbs = cb_result->callbacks;
*cb_result = Steam_Call_Result(api_call, iCallback, result, size, timeout, run_call_completed_cb); *cb_result = Steam_Call_Result(api_call, iCallback, result, size, timeout, run_call_completed_cb);
cb_result->callbacks = temp_cbs; cb_result->callbacks = temp_cbs;
cb_result->created = created;
return cb_result->api_call; return cb_result->api_call;
} }
} else { } else {

View File

@ -36,12 +36,16 @@ static void background_thread(Steam_Client *client)
} }
} }
unsigned long long time = std::chrono::duration_cast<std::chrono::duration<unsigned long long>>(std::chrono::system_clock::now().time_since_epoch()).count();
if (time > client->last_cb_run + 1) {
global_mutex.lock(); global_mutex.lock();
PRINT_DEBUG("background thread run\n"); PRINT_DEBUG("background thread run\n");
client->network->Run(); client->network->Run();
client->steam_matchmaking->RunBackground(); client->steam_matchmaking->RunBackground();
global_mutex.unlock(); global_mutex.unlock();
} }
}
} }
Steam_Client::Steam_Client() Steam_Client::Steam_Client()
@ -104,6 +108,7 @@ Steam_Client::Steam_Client()
steam_gameserver_game_coordinator = new Steam_Game_Coordinator(settings_server, network, callback_results_server, callbacks_server, run_every_runcb); steam_gameserver_game_coordinator = new Steam_Game_Coordinator(settings_server, network, callback_results_server, callbacks_server, run_every_runcb);
steam_masterserver_updater = new Steam_Masterserver_Updater(settings_server, network, callback_results_server, callbacks_server, run_every_runcb); steam_masterserver_updater = new Steam_Masterserver_Updater(settings_server, network, callback_results_server, callbacks_server, run_every_runcb);
last_cb_run = 0;
PRINT_DEBUG("client init end\n"); PRINT_DEBUG("client init end\n");
} }
@ -1536,8 +1541,8 @@ void Steam_Client::RunCallbacks(bool runClientCB, bool runGameserverCB)
callbacks_server->runCallBacks(); callbacks_server->runCallBacks();
PRINT_DEBUG("Steam_Client::RunCallbacks callbacks_client\n"); PRINT_DEBUG("Steam_Client::RunCallbacks callbacks_client\n");
callbacks_client->runCallBacks(); callbacks_client->runCallBacks();
last_cb_run = std::chrono::duration_cast<std::chrono::duration<unsigned long long>>(std::chrono::system_clock::now().time_since_epoch()).count();
PRINT_DEBUG("Steam_Client::RunCallbacks done\n"); PRINT_DEBUG("Steam_Client::RunCallbacks done\n");
} }
void Steam_Client::DestroyAllInterfaces() void Steam_Client::DestroyAllInterfaces()

View File

@ -135,6 +135,7 @@ public:
bool server_init = false; bool server_init = false;
std::thread background_keepalive; std::thread background_keepalive;
bool steamclient_server_inited = false; bool steamclient_server_inited = false;
std::atomic<unsigned long long> last_cb_run;
unsigned steam_pipe_counter = 1; unsigned steam_pipe_counter = 1;
std::map<HSteamPipe, enum Steam_Pipe> steam_pipes; std::map<HSteamPipe, enum Steam_Pipe> steam_pipes;

View File

@ -113,7 +113,7 @@ void send_lobby_data()
} }
} }
void trigger_lobby_dataupdate(CSteamID lobby, CSteamID member, bool success, double cb_timeout=0.0) void trigger_lobby_dataupdate(CSteamID lobby, CSteamID member, bool success, double cb_timeout=0.0, bool send_changed_lobby=true)
{ {
PRINT_DEBUG("Lobby dataupdate %llu %llu\n", lobby.ConvertToUint64(), member.ConvertToUint64()); PRINT_DEBUG("Lobby dataupdate %llu %llu\n", lobby.ConvertToUint64(), member.ConvertToUint64());
LobbyDataUpdate_t data; LobbyDataUpdate_t data;
@ -132,11 +132,13 @@ void trigger_lobby_dataupdate(CSteamID lobby, CSteamID member, bool success, dou
Lobby *l = get_lobby(lobby); Lobby *l = get_lobby(lobby);
if (l && l->owner() == settings->get_local_steam_id().ConvertToUint64()) { if (l && l->owner() == settings->get_local_steam_id().ConvertToUint64()) {
if (send_changed_lobby) {
Common_Message msg = Common_Message(); Common_Message msg = Common_Message();
msg.set_source_id(settings->get_local_steam_id().ConvertToUint64()); msg.set_source_id(settings->get_local_steam_id().ConvertToUint64());
msg.set_allocated_lobby(new Lobby(*l)); msg.set_allocated_lobby(new Lobby(*l));
network->sendToAllIndividuals(&msg, true); network->sendToAllIndividuals(&msg, true);
} }
}
} }
void trigger_lobby_member_join_leave(CSteamID lobby, CSteamID member, bool leaving, bool success, double cb_timeout=0.0) void trigger_lobby_member_join_leave(CSteamID lobby, CSteamID member, bool leaving, bool success, double cb_timeout=0.0)
@ -774,10 +776,9 @@ bool SetLobbyData( CSteamID steamIDLobby, const char *pchKey, const char *pchVal
} }
auto result = lobby->values().find(pchKey); auto result = lobby->values().find(pchKey);
if (result == lobby->values().end() || result->second != std::string(pchValue)) { bool changed = (result == lobby->values().end()) || (result->second != std::string(pchValue));
(*lobby->mutable_values())[pchKey] = pchValue; (*lobby->mutable_values())[pchKey] = pchValue;
trigger_lobby_dataupdate(steamIDLobby, steamIDLobby, true); trigger_lobby_dataupdate(steamIDLobby, steamIDLobby, true, 0.0, changed);
}
return true; return true;
} }

View File

@ -629,6 +629,7 @@ void Steam_Overlay::OverlayProc()
if (show_overlay) if (show_overlay)
{ {
io.ConfigFlags &= ~ImGuiConfigFlags_NoMouseCursorChange;
// Set the overlay windows to the size of the game window // Set the overlay windows to the size of the game window
ImGui::SetNextWindowPos({ 0,0 }); ImGui::SetNextWindowPos({ 0,0 });
ImGui::SetNextWindowSize({ static_cast<float>(io.DisplaySize.x), ImGui::SetNextWindowSize({ static_cast<float>(io.DisplaySize.x),
@ -681,7 +682,9 @@ void Steam_Overlay::OverlayProc()
if (!show) if (!show)
ShowOverlay(false); ShowOverlay(false);
}// if(show_overlay) } else {
io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange;
}
} }
void Steam_Overlay::Callback(Common_Message *msg) void Steam_Overlay::Callback(Common_Message *msg)