Dedi hostname & discord changes
This commit is contained in:
parent
4f18bce545
commit
954543228f
@ -196,9 +196,6 @@ namespace dedicated
|
|||||||
// Disable r_preloadShaders
|
// Disable r_preloadShaders
|
||||||
dvars::override::register_bool("r_preloadShaders", false, game::DVAR_FLAG_READ);
|
dvars::override::register_bool("r_preloadShaders", false, game::DVAR_FLAG_READ);
|
||||||
|
|
||||||
// Don't allow sv_hostname to be changed by the game
|
|
||||||
dvars::disable::set_string("sv_hostname");
|
|
||||||
|
|
||||||
// Stop crashing from sys_errors
|
// Stop crashing from sys_errors
|
||||||
utils::hook::jump(0x140511520, sys_error_stub);
|
utils::hook::jump(0x140511520, sys_error_stub);
|
||||||
|
|
||||||
|
@ -49,17 +49,21 @@ namespace discord
|
|||||||
|
|
||||||
discord_presence.details = utils::string::va("%s on %s", gametype, mapname);
|
discord_presence.details = utils::string::va("%s on %s", gametype, mapname);
|
||||||
|
|
||||||
auto host_name = game::Dvar_FindVar("sv_hostname")->current.string;
|
char clean_hostname[0x100] = {0};
|
||||||
|
utils::string::strip(game::Dvar_FindVar("sv_hostname")->current.string,
|
||||||
|
clean_hostname, sizeof(clean_hostname));
|
||||||
auto max_clients = game::Dvar_FindVar("sv_maxclients")->current.integer;
|
auto max_clients = game::Dvar_FindVar("sv_maxclients")->current.integer;
|
||||||
|
|
||||||
if (game::SV_Loaded())
|
if (game::SV_Loaded())
|
||||||
{
|
{
|
||||||
|
strcpy_s(clean_hostname, "Private Match");
|
||||||
max_clients = party::server_client_count();
|
max_clients = party::server_client_count();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto clients = *(reinterpret_cast<int*>(0x14621BE00));
|
auto clients = *reinterpret_cast<int*>(0x14621BE00);
|
||||||
discord_presence.partySize = clients;
|
discord_presence.partySize = clients;
|
||||||
discord_presence.partyMax = max_clients;
|
discord_presence.partyMax = max_clients;
|
||||||
discord_presence.state = host_name;
|
discord_presence.state = clean_hostname;
|
||||||
discord_presence.largeImageKey = map;
|
discord_presence.largeImageKey = map;
|
||||||
}
|
}
|
||||||
else if (game::environment::is_sp())
|
else if (game::environment::is_sp())
|
||||||
|
@ -268,6 +268,9 @@ namespace patches
|
|||||||
utils::hook::jump(0x140578D30, realloc);
|
utils::hook::jump(0x140578D30, realloc);
|
||||||
utils::hook::jump(0x140578B60, _aligned_realloc);
|
utils::hook::jump(0x140578B60, _aligned_realloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Change default hostname and make it replicated
|
||||||
|
dvars::override::register_string("sv_hostname", "^2H1-Mod^7 Default Server", game::DVAR_FLAG_REPLICATED);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user