commit 102a7d46f84f44a1a690644265f912bb876c5901 from: p2r3 date: Mon Sep 1 21:33:25 2025 UTC make beef dumps opt-in via config commit - 64846381f41e1779f93e6d7e79dc4946430f5f9e commit + 102a7d46f84f44a1a690644265f912bb876c5901 blob - 1ae63bf9dd3538c263b2cf45c1263641440e2058 blob + 0508ebad858c86d1b872ddc1f51bf9f583a0f81d --- include/globals.h +++ include/globals.h @@ -89,6 +89,10 @@ #define DEV_LOG_LENGTH_DISCREPANCY // If defined, log chunk generation events #define DEV_LOG_CHUNK_GENERATION +// If defined, allows dumping world data by sending 0xBEEF (big-endian), +// and uploading world data by sending 0xFEED, followed by the data buffer. +// Doesn't implement authentication, hence disabled by default. +// #define DEV_ENABLE_BEEF_DUMPS #define STATE_NONE 0 #define STATE_STATUS 1 blob - 8d5625ac5b1b7cc6a68f65bfcbbee4bead07dce9 blob + d1dcaf28eab581dc2f53436389c5c758d2a9be2c --- src/main.c +++ src/main.c @@ -558,6 +558,8 @@ int main () { continue; } + // Handle 0xBEEF and 0xFEED packets for dumping/uploading world data + #ifdef DEV_ENABLE_BEEF_DUMPS // Received BEEF packet, dump world data and disconnect if (recv_buffer[0] == 0xBE && recv_buffer[1] == 0xEF && getClientState(client_fd) == STATE_NONE) { // Send block changes and player data back to back @@ -571,7 +573,6 @@ int main () { disconnectClient(&clients[client_index], 6); continue; } - // Received FEED packet, load world data from socket and disconnect if (recv_buffer[0] == 0xFE && recv_buffer[1] == 0xED && getClientState(client_fd) == STATE_NONE) { // Consume 0xFEED bytes (previous read was just a peek) @@ -592,6 +593,7 @@ int main () { disconnectClient(&clients[client_index], 7); continue; } + #endif // Read packet length int length = readVarInt(client_fd);