Prevent CoopNet and Discord activity mod name truncation

This commit is contained in:
Agent X 2024-03-17 21:11:08 -04:00
parent 7dd02b5c4d
commit 3567e5b62c
2 changed files with 7 additions and 8 deletions

View File

@ -110,7 +110,7 @@ void discord_activity_update(void) {
sCurActivity.party.size.max_size = 1;
}
if (sCurActivity.party.size.current_size > 1 || configAmountofPlayers == 1) {
if ((sCurActivity.party.size.current_size > 1 || configAmountofPlayers == 1) && !gDjuiInMainMenu) {
strcpy(sCurActivity.state, "Playing!");
} else if (gNetworkType == NT_SERVER) {
strcpy(sCurActivity.state, "Waiting for players...");
@ -120,12 +120,11 @@ void discord_activity_update(void) {
if (sCurActivity.party.size.max_size < 1) { sCurActivity.party.size.max_size = 1; }
}
char details[128] = { 0 };
discord_populate_details(details, 128);
// HACK: give the detail population more space than the Discord details can fit so it gets truncated without cutting off the largest strings
char details[256] = { 0 };
discord_populate_details(details, 256);
if (snprintf(sCurActivity.details, 128, "%s", details) < 0) {
LOG_INFO("truncating details");
}
snprintf(sCurActivity.details, 128, "%s", details);
if (!app.activities) {
LOG_INFO("no activities");

View File

@ -17,7 +17,7 @@
uint64_t gCoopNetDesiredLobby = 0;
char gCoopNetPassword[64] = "";
char sCoopNetDescription[256] = "";
char sCoopNetDescription[512] = "";
static uint64_t sLocalLobbyId = 0;
static uint64_t sLocalLobbyOwnerId = 0;
@ -171,7 +171,7 @@ bool ns_coopnet_is_connected(void) {
static void coopnet_populate_description(void) {
char* buffer = sCoopNetDescription;
int bufferLength = 256;
int bufferLength = 512;
// get version
const char* version = get_version();
int versionLength = strlen(version);