Compare commits
3 Commits
95fc8ac687
...
a0e558ed4c
Author | SHA1 | Date |
---|---|---|
Mr_Goldberg | a0e558ed4c | |
Mr_Goldberg | 6d5cb3181f | |
Mr_Goldberg | a88739a753 |
|
@ -24,9 +24,9 @@ You can download the latest git builds for Linux and Windows on [the Gitlab page
|
|||
|
||||
One of the reasons I made this code open source is because I want contributions. Unless your code is related to the experimental stuff it needs to work on both Linux and Windows. Having accurate behavior is more important than making games work. Having inaccurate behavior might fix one game but it will break others.
|
||||
|
||||
## IRC Channel
|
||||
## Matrix Channel
|
||||
|
||||
[#goldberg_emulator@freenode](https://webchat.freenode.net/?channels=goldberg_emulator)
|
||||
[#goldberg:matrix.org](https://matrix.to/#/#goldberg:matrix.org)
|
||||
|
||||
## Building
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ CSteamID generate_steam_id_anonserver()
|
|||
|
||||
CSteamID generate_steam_id_lobby()
|
||||
{
|
||||
return CSteamID(generate_account_id(), k_unSteamUserDefaultInstance | k_EChatInstanceFlagLobby, k_EUniversePublic, k_EAccountTypeChat);
|
||||
return CSteamID(generate_account_id(), k_EChatInstanceFlagLobby | k_EChatInstanceFlagMMSLobby, k_EUniversePublic, k_EAccountTypeChat);
|
||||
}
|
||||
|
||||
bool check_timedout(std::chrono::high_resolution_clock::time_point old, double timeout)
|
||||
|
|
|
@ -107,7 +107,10 @@ google::protobuf::Map<std::string,std::string>::const_iterator caseinsensitive_f
|
|||
|
||||
Lobby *get_lobby(CSteamID id)
|
||||
{
|
||||
auto lobby = std::find_if(lobbies.begin(), lobbies.end(), [&id](Lobby const& item) { return item.room_id() == id.ConvertToUint64(); });
|
||||
if (!id.IsLobby())
|
||||
return NULL;
|
||||
|
||||
auto lobby = std::find_if(lobbies.begin(), lobbies.end(), [&id](Lobby const& item) { return (item.room_id() & 0xFFFFFFFF) == (id.GetAccountID()); });
|
||||
if (lobbies.end() == lobby)
|
||||
return NULL;
|
||||
|
||||
|
@ -653,8 +656,8 @@ void LeaveLobby( CSteamID steamIDLobby )
|
|||
PRINT_DEBUG("LeaveLobby\n");
|
||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||
PRINT_DEBUG("LeaveLobby pass mutex\n");
|
||||
auto lobby = std::find_if(lobbies.begin(), lobbies.end(), [&steamIDLobby](Lobby const& item) { return item.room_id() == steamIDLobby.ConvertToUint64(); });
|
||||
if (lobbies.end() != lobby) {
|
||||
Lobby *lobby = get_lobby(steamIDLobby);
|
||||
if (lobby) {
|
||||
if (!lobby->deleted()) {
|
||||
on_self_enter_leave_lobby((uint64)lobby->room_id(), lobby->type(), true);
|
||||
self_lobby_member_data.erase(lobby->room_id());
|
||||
|
@ -677,7 +680,6 @@ void LeaveLobby( CSteamID steamIDLobby )
|
|||
send_clients_packet(steamIDLobby, message);
|
||||
lobby->set_deleted(true);
|
||||
lobby->set_time_deleted(std::chrono::duration_cast<std::chrono::duration<uint64>>(std::chrono::system_clock::now().time_since_epoch()).count());
|
||||
//lobbies.erase(lobby);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -755,6 +755,7 @@ EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, u
|
|||
bool reliable = false;
|
||||
if (nSendFlags & k_nSteamNetworkingSend_Reliable) reliable = true;
|
||||
|
||||
if (pOutMessageNumber) *pOutMessageNumber = 1; //TODO
|
||||
if (network->sendTo(&msg, reliable)) return k_EResultOK;
|
||||
return k_EResultFail;
|
||||
}
|
||||
|
@ -800,6 +801,20 @@ EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, u
|
|||
void SendMessages( int nMessages, SteamNetworkingMessage_t *const *pMessages, int64 *pOutMessageNumberOrResult )
|
||||
{
|
||||
PRINT_DEBUG("Steam_Networking_Sockets::SendMessages\n");
|
||||
for (int i = 0; i < nMessages; ++i) {
|
||||
int64 out_number = 0;
|
||||
int result = SendMessageToConnection(pMessages[i]->m_conn, pMessages[i]->m_pData, pMessages[i]->m_cbSize, pMessages[i]->m_nFlags, &out_number);
|
||||
if (pOutMessageNumberOrResult) {
|
||||
if (result == k_EResultOK) {
|
||||
pOutMessageNumberOrResult[i] = out_number;
|
||||
} else {
|
||||
pOutMessageNumberOrResult[i] = -result;
|
||||
}
|
||||
}
|
||||
|
||||
pMessages[i]->m_pfnFreeData(pMessages[i]);
|
||||
pMessages[i]->Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -68,6 +68,18 @@ Steam_Networking_Utils(class Settings *settings, class Networking *network, clas
|
|||
this->run_every_runcb->remove(&Steam_Networking_Utils::steam_run_every_runcb, this);
|
||||
}
|
||||
|
||||
static void free_steam_message_data(SteamNetworkingMessage_t *pMsg)
|
||||
{
|
||||
free(pMsg->m_pData);
|
||||
pMsg->m_pData = NULL;
|
||||
}
|
||||
|
||||
static void delete_steam_message(SteamNetworkingMessage_t *pMsg)
|
||||
{
|
||||
if (pMsg->m_pfnFreeData) pMsg->m_pfnFreeData(pMsg);
|
||||
delete pMsg;
|
||||
}
|
||||
|
||||
/// Allocate and initialize a message object. Usually the reason
|
||||
/// you call this is to pass it to ISteamNetworkingSockets::SendMessages.
|
||||
/// The returned object will have all of the relevant fields cleared to zero.
|
||||
|
@ -90,8 +102,17 @@ Steam_Networking_Utils(class Settings *settings, class Networking *network, clas
|
|||
SteamNetworkingMessage_t *AllocateMessage( int cbAllocateBuffer )
|
||||
{
|
||||
PRINT_DEBUG("Steam_Networking_Utils::AllocateMessage\n");
|
||||
//TODO
|
||||
return NULL;
|
||||
SteamNetworkingMessage_t *pMsg = new SteamNetworkingMessage_t();
|
||||
pMsg->m_pfnFreeData = &free_steam_message_data;
|
||||
pMsg->m_pfnRelease = &delete_steam_message;
|
||||
if (cbAllocateBuffer < 0)
|
||||
cbAllocateBuffer = 0;
|
||||
|
||||
if (cbAllocateBuffer)
|
||||
pMsg->m_pData = malloc(cbAllocateBuffer);
|
||||
|
||||
pMsg->m_cbSize = cbAllocateBuffer;
|
||||
return pMsg;
|
||||
}
|
||||
|
||||
bool InitializeRelayAccess()
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<div>There's also a Readme in the zip that you download. Most issues can be easily resolved by reading it (The first few lines are the most important). </div>
|
||||
|
||||
<h3>Chatroom</h3>
|
||||
<div>Matrix room: <a href="https://element.io/app/#/room/#goldberg:matrix.org">Element</a></div>
|
||||
<div>Matrix room: <a href="https://matrix.to/#/#goldberg:matrix.org">#goldberg:matrix.org</a></div>
|
||||
|
||||
<h3>Other Links</h3>
|
||||
<div><a href="https://www.reddit.com/r/GoldbergEmu/">Subreddit</a></div>
|
||||
|
|
Loading…
Reference in New Issue