feat: Remove NET_VERSION define (#1153)

* Remove NET_VERSION define

I get to test this on 4 different platforms.  yay...

* move stuff around

finally fixed you docker

i love this

Update Dockerfile

Update Dockerfile

change type

Update AuthPackets.cpp

Update AuthServer.cpp

* Update CMakeVariables.txt

* Update sharedconfig.ini
This commit is contained in:
David Markowitz 2023-08-03 19:38:33 -07:00 committed by GitHub
parent 040a78c386
commit e5b69745aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 37 additions and 19 deletions

View File

@ -1,12 +1,8 @@
PROJECT_VERSION_MAJOR=1 PROJECT_VERSION_MAJOR=1
PROJECT_VERSION_MINOR=1 PROJECT_VERSION_MINOR=0
PROJECT_VERSION_PATCH=0 PROJECT_VERSION_PATCH=1
# LICENSE # LICENSE
LICENSE=AGPL-3.0 LICENSE=AGPL-3.0
# The network version.
# 171023 - Darkflame Universe client
# 171022 - Unmodded client
NET_VERSION=171022
# Debugging # Debugging
# Set __dynamic to 1 to enable the -rdynamic flag for the linker, yielding some symbols in crashlogs. # Set __dynamic to 1 to enable the -rdynamic flag for the linker, yielding some symbols in crashlogs.
__dynamic=1 __dynamic=1

View File

@ -179,7 +179,7 @@ If you would like to build the server faster, append `-j<number>` where number i
### Notes ### Notes
Depending on your operating system, you may need to adjust some pre-processor defines in [CMakeVariables.txt](./CMakeVariables.txt) before building: Depending on your operating system, you may need to adjust some pre-processor defines in [CMakeVariables.txt](./CMakeVariables.txt) before building:
* If you are on MacOS, ensure OPENSSL_ROOT_DIR is pointing to the openssl root directory. * If you are on MacOS, ensure OPENSSL_ROOT_DIR is pointing to the openssl root directory.
* If you are using a Darkflame Universe client, ensure NET_VERSION is changed to 171023. * If you are using a Darkflame Universe client, ensure `client_net_version` in `build/sharedconfig.ini` is changed to 171023.
## Configuring your server ## Configuring your server
This server has a few steps that need to be taken to configure the server for your use case. This server has a few steps that need to be taken to configure the server for your use case.

View File

@ -113,6 +113,17 @@ int main(int argc, char** argv) {
Game::logger->SetLogToConsole(Game::config->GetValue("log_to_console") != "0"); Game::logger->SetLogToConsole(Game::config->GetValue("log_to_console") != "0");
Game::logger->SetLogDebugStatements(Game::config->GetValue("log_debug_statements") == "1"); Game::logger->SetLogDebugStatements(Game::config->GetValue("log_debug_statements") == "1");
uint32_t clientNetVersion = 0;
if (!GeneralUtils::TryParse(Game::config->GetValue("client_net_version"), clientNetVersion)) {
Game::logger->Log("MasterServer", "Failed to parse (%s) as net version. Cannot start server as no clients could connect.",Game::config->GetValue("client_net_version").c_str());
Game::logger->Log("MasterServer", "As of version 1.1.1, client_net_version is required to be defined in sharedconfig.ini as opposed to in CMakeVariables.txt as NET_VERSION.");
Game::logger->Log("MasterServer", "Rerun cmake to ensure all config values exist. If client_net_version already exists in sharedconfig.ini, please ensure it is a valid number.");
Game::logger->Log("MasterServer", "like 171022");
return EXIT_FAILURE;
}
Game::logger->Log("MasterServer", "Using net version %s", Game::config->GetValue("client_net_version").c_str());
Game::logger->Log("MasterServer", "Starting Master server..."); Game::logger->Log("MasterServer", "Starting Master server...");
Game::logger->Log("MasterServer", "Version: %i.%i", PROJECT_VERSION_MAJOR, PROJECT_VERSION_MINOR); Game::logger->Log("MasterServer", "Version: %i.%i", PROJECT_VERSION_MAJOR, PROJECT_VERSION_MINOR);
Game::logger->Log("MasterServer", "Compiled on: %s", __TIMESTAMP__); Game::logger->Log("MasterServer", "Compiled on: %s", __TIMESTAMP__);

View File

@ -40,7 +40,12 @@ void AuthPackets::HandleHandshake(dServer* server, Packet* packet) {
void AuthPackets::SendHandshake(dServer* server, const SystemAddress& sysAddr, const std::string& nextServerIP, uint16_t nextServerPort, const ServerType serverType) { void AuthPackets::SendHandshake(dServer* server, const SystemAddress& sysAddr, const std::string& nextServerIP, uint16_t nextServerPort, const ServerType serverType) {
RakNet::BitStream bitStream; RakNet::BitStream bitStream;
PacketUtils::WriteHeader(bitStream, eConnectionType::SERVER, eServerMessageType::VERSION_CONFIRM); PacketUtils::WriteHeader(bitStream, eConnectionType::SERVER, eServerMessageType::VERSION_CONFIRM);
bitStream.Write<unsigned int>(NET_VERSION); uint32_t netVersion;
if (!GeneralUtils::TryParse(Game::config->GetValue("client_net_version"), netVersion)) {
Game::logger->Log("AuthPackets", "Failed to parse client_net_version. Cannot authenticate to %s:%i", nextServerIP.c_str(), nextServerPort);
return;
}
bitStream.Write<uint32_t>(netVersion);
bitStream.Write(uint32_t(0x93)); bitStream.Write(uint32_t(0x93));
if (serverType == ServerType::Auth) bitStream.Write(uint32_t(1)); //Conn: auth if (serverType == ServerType::Auth) bitStream.Write(uint32_t(1)); //Conn: auth

View File

@ -12,6 +12,7 @@ services:
- DATABASE_USER=${MARIADB_USER:-darkflame} - DATABASE_USER=${MARIADB_USER:-darkflame}
- DATABASE_PASSWORD=${MARIADB_PASSWORD:-darkflame} - DATABASE_PASSWORD=${MARIADB_PASSWORD:-darkflame}
- EXTERNAL_IP=${EXTERNAL_IP:-darkflame} - EXTERNAL_IP=${EXTERNAL_IP:-darkflame}
- BUILD_VERSION=${BUILD_VERSION:?171022}
volumes: volumes:
- ${CLIENT_PATH:?missing_client_path}:/client - ${CLIENT_PATH:?missing_client_path}:/client
- shared_configs:/docker/ - shared_configs:/docker/

View File

@ -32,13 +32,12 @@ COPY .clang-* CMake* LICENSE /build/
ARG BUILD_THREADS=1 ARG BUILD_THREADS=1
ARG BUILD_VERSION=171022 ARG BUILD_VERSION=171022
RUN echo "Build server" && \ RUN echo "Build server"
mkdir -p cmake_build && \ RUN sed -i -e "s/__maria_db_connector_compile_jobs__=.*/__maria_db_connector_compile_jobs__=${BUILD_THREADS}/g" CMakeVariables.txt
cd cmake_build && \ RUN mkdir -p cmake_build
sed -i -e "s/NET_VERSION=.*/NET_VERSION=${BUILD_VERSION}/g" ../CMakeVariables.txt && \ RUN cd cmake_build && \
sed -i -e "s/__maria_db_connector_compile_jobs__=.*/__maria_db_connector_compile_jobs__=${BUILD_THREADS}/g" ../CMakeVariables.txt && \ cmake .. -DCMAKE_BUILD_RPATH_USE_ORIGIN=TRUE && \
cmake .. -DCMAKE_BUILD_RPATH_USE_ORIGIN=TRUE && \ make -j$BUILD_THREADS
make -j $BUILD_THREADS
FROM gcc:12 as runtime FROM gcc:12 as runtime

View File

@ -17,9 +17,8 @@ function update_database_ini_values_for() {
update_ini $INI_FILE mysql_database $DATABASE update_ini $INI_FILE mysql_database $DATABASE
update_ini $INI_FILE mysql_username $DATABASE_USER update_ini $INI_FILE mysql_username $DATABASE_USER
update_ini $INI_FILE mysql_password $DATABASE_PASSWORD update_ini $INI_FILE mysql_password $DATABASE_PASSWORD
if [[ "$INI_FILE" != "worldconfig.ini" ]]; then update_ini $INI_FILE client_net_version $BUILD_VERSION
update_ini $INI_FILE external_ip $EXTERNAL_IP update_ini $INI_FILE external_ip $EXTERNAL_IP
fi
} }
function update_ini_values() { function update_ini_values() {

View File

@ -36,3 +36,10 @@ maximum_outgoing_bandwidth=80000
# from 512 <= maximum_mtu_size <= 1492 so make sure to keep this # from 512 <= maximum_mtu_size <= 1492 so make sure to keep this
# value within that range. # value within that range.
maximum_mtu_size=1228 maximum_mtu_size=1228
# The client network version to allow to connect to this server.
# Client's that do not match this value will be kicked from the server.
# If you are using a Darkflame Universe client, set this value to 171023.
# This cannot just be any arbitrary number. This has to match the same value that is in your client.
# If you do not know what this value is, default it to 171022.
client_net_version=171022