From ab932c5eb96e5794faaa451fafcdaff490dc084f Mon Sep 17 00:00:00 2001 From: MysterD Date: Thu, 20 Apr 2023 11:21:15 -0700 Subject: [PATCH] Remove old code that tracked 'patches' --- src/pc/network/network.c | 7 ---- src/pc/network/network.h | 2 - src/pc/network/packets/packet_join.c | 59 ---------------------------- 3 files changed, 68 deletions(-) diff --git a/src/pc/network/network.c b/src/pc/network/network.c index 1d268c98..c3e8b326 100644 --- a/src/pc/network/network.c +++ b/src/pc/network/network.c @@ -65,8 +65,6 @@ u32 sNetworkReconnectTimer = 0; u32 sNetworkRehostTimer = 0; enum NetworkSystemType sNetworkReconnectType = NS_SOCKET; -struct StringLinkedList gRegisteredMods = { 0 }; - struct ServerSettings gServerSettings = { .playerInteractions = PLAYER_INTERACTIONS_SOLID, .playerKnockbackStrength = 25, @@ -591,11 +589,6 @@ void network_update(void) { } -void network_register_mod(char* modName) { - if (string_linked_list_contains(&gRegisteredMods, modName)) { return; } - string_linked_list_append(&gRegisteredMods, modName); -} - void network_shutdown(bool sendLeaving, bool exiting, bool popup, bool reconnecting) { if (gDjuiChatBox != NULL) { djui_base_destroy(&gDjuiChatBox->base); diff --git a/src/pc/network/network.h b/src/pc/network/network.h index 7f12e95e..10cd992e 100644 --- a/src/pc/network/network.h +++ b/src/pc/network/network.h @@ -86,7 +86,6 @@ extern u32 gNetworkAreaTimer; extern u32 gNetworkAreaTimerClock; extern void* gNetworkServerAddr; extern struct ServerSettings gServerSettings; -extern struct StringLinkedList gRegisteredMods; extern bool gNetworkSentJoin; extern u16 gNetworkRequestLocationTimer; extern u8 gDebugPacketIdBuffer[]; @@ -109,7 +108,6 @@ void network_reconnect_begin(void); bool network_is_reconnecting(void); void network_rehost_begin(void); void network_update(void); -void network_register_mod(char* modName); void network_shutdown(bool sendLeaving, bool exiting, bool popup, bool reconnecting); #endif diff --git a/src/pc/network/packets/packet_join.c b/src/pc/network/packets/packet_join.c index 4cc4f321..ff2ad27b 100644 --- a/src/pc/network/packets/packet_join.c +++ b/src/pc/network/packets/packet_join.c @@ -122,19 +122,6 @@ void network_send_join(struct Packet* joinRequestPacket) { packet_write(&p, &gServerSettings.maxPlayers, sizeof(u8)); packet_write(&p, eeprom, sizeof(u8) * 512); - u8 modCount = string_linked_list_count(&gRegisteredMods); - packet_write(&p, &modCount, sizeof(u8)); - - struct StringLinkedList* node = &gRegisteredMods; - char nullchar = '\0'; - while (node != NULL && node->string != NULL) { - s32 length = strlen(node->string); - packet_write(&p, node->string, sizeof(u8) * length); - packet_write(&p, &nullchar, sizeof(u8)); - LOG_INFO("sending registered mod: %s", node->string); - node = node->next; - } - network_send_to(globalIndex, &p); LOG_INFO("sending join packet"); @@ -155,7 +142,6 @@ void network_receive_join(struct Packet* p) { char remoteVersion[MAX_VERSION_LENGTH] = { 0 }; u8 myGlobalIndex = UNKNOWN_GLOBAL_INDEX; - u8 modCount = 0; if (gNetworkPlayerLocal != NULL && gNetworkPlayerLocal->connected) { LOG_ERROR("Received join packet, but already in-game!"); @@ -186,51 +172,6 @@ void network_receive_join(struct Packet* p) { packet_read(p, &gServerSettings.headlessServer, sizeof(u8)); packet_read(p, &gServerSettings.maxPlayers, sizeof(u8)); packet_read(p, eeprom, sizeof(u8) * 512); - packet_read(p, &modCount, sizeof(u8)); - - struct StringLinkedList head = { 0 }; - for (s32 i = 0; i < modCount; i++) { - char* modName = (char*) &p->buffer[p->cursor]; - s32 length = strlen(modName); - LOG_INFO("host has mod: %s", modName); - string_linked_list_append(&head, modName); - p->cursor += length + 1; - } - - if (string_linked_list_mismatch(&gRegisteredMods, &head)) { - network_shutdown(true, false, false, false); - - struct StringBuilder* builder = string_builder_create(512); - string_builder_append(builder, "\\#ffa0a0\\Error:\\#c8c8c8\\ mods don't match.\n\n"); - - string_builder_append(builder, "\\#c8c8c8\\Yours: "); - struct StringLinkedList* node = &gRegisteredMods; - bool first = true; - while (node != NULL && node->string != NULL) { - string_builder_append(builder, first ? "\\#%s\\%s" : ", \\#%s\\%s", - string_linked_list_contains(&head, node->string) ? "a0ffa0" : "ffa0a0" - , node->string); - first = false; - node = node->next; - } - - string_builder_append(builder, "\n\n\\#c8c8c8\\Theirs: "); - node = &head; - first = true; - while (node != NULL && node->string != NULL) { - string_builder_append(builder, first ? "\\#%s\\%s" : ", \\#%s\\%s", - string_linked_list_contains(&gRegisteredMods, node->string) ? "a0ffa0" : "ffa0a0" - , node->string); - first = false; - node = node->next; - } - - djui_panel_join_message_error(builder->string); - string_builder_destroy(builder); - string_linked_list_free(&head); - return; - } - string_linked_list_free(&head); network_player_connected(NPT_SERVER, 0, 0, &DEFAULT_MARIO_PALETTE, "Player"); network_player_connected(NPT_LOCAL, myGlobalIndex, configPlayerModel, &configPlayerPalette, configPlayerName);