Made version mismatch screen more descriptive

This commit is contained in:
MysterD 2020-10-11 18:26:10 -07:00
parent 342a048e0e
commit 7bf2ebd7e8
2 changed files with 13 additions and 2 deletions

View File

@ -146,7 +146,9 @@ static void connect_menu_draw_strings(void) {
if (*sConnectionJoinError) { if (*sConnectionJoinError) {
f32 red = (f32)fabs(sin(gGlobalTimer / 20.0f)); f32 red = (f32)fabs(sin(gGlobalTimer / 20.0f));
gDPSetEnvColor(gDisplayListHead++, 222, 222 * red, 222 * red, gMenuStringAlpha); gDPSetEnvColor(gDisplayListHead++, 222, 222 * red, 222 * red, gMenuStringAlpha);
print_generic_ascii_string(30, 130, sConnectionJoinError); f32 messageX = (SCREEN_WIDTH - get_generic_ascii_string_width(sConnectionJoinError)) / 2.0;
f32 messageY = (SCREEN_HEIGHT + get_generic_ascii_string_height(sConnectionJoinError)) / 2.0;
print_generic_ascii_string(messageX, messageY, sConnectionJoinError);
return; return;
} }

View File

@ -106,7 +106,16 @@ void network_receive_join(struct Packet* p) {
LOG_INFO("server has version: %s", version); LOG_INFO("server has version: %s", version);
if (memcmp(version, remoteVersion, MAX_VERSION_LENGTH) != 0) { if (memcmp(version, remoteVersion, MAX_VERSION_LENGTH) != 0) {
LOG_ERROR("version mismatch"); LOG_ERROR("version mismatch");
custom_menu_connection_error("Your versions don't match, both should rebuild!");
// todo: hack: remove me in the future
// needed because the old style only had 8 characters for the version
if (strcmp("beta", remoteVersion) != 0) {
remoteVersion[8] = '\0';
}
char mismatchMessage[128] = { 0 };
snprintf(mismatchMessage, 128, "Version mismatch.\n\nYour version - %s\nTheir version - %s\n\nSomeone is out of date!\n", version, remoteVersion);
custom_menu_connection_error(mismatchMessage);
return; return;
} }