diff --git a/src/ReceiveCommands.cc b/src/ReceiveCommands.cc index f586fbbe..57f17751 100644 --- a/src/ReceiveCommands.cc +++ b/src/ReceiveCommands.cc @@ -2372,7 +2372,7 @@ void process_encryption_ok_patch(shared_ptr, shared_ptr c, send_command(c, 0x04, 0x00); // This requests the user's login information } -void process_login_patch(shared_ptr, shared_ptr c, +void process_login_patch(shared_ptr s, shared_ptr c, uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data); @@ -2382,24 +2382,13 @@ void process_login_patch(shared_ptr, shared_ptr c, // On BB we can use colors and newlines should be \n; on PC we can't use // colors, the text is auto-word-wrapped, and newlines should be \r\n. - u16string message; - if (c->flags & Client::Flag::BB_PATCH) { - message = u"\ -$C7newserv patch server\n\ -\n\ -This server is not affiliated with, sponsored by, or in any\n\ -other way connected to SEGA or Sonic Team, and is owned\n\ -and operated completely independently."; - } else { - message = u"\ -newserv patch server\r\n\ -\r\n\ -This server is not affiliated with, sponsored by, or in any other way \ -connected to SEGA or Sonic Team, and is owned and operated completely \ -independently."; + const u16string& message = (c->flags & Client::Flag::BB_PATCH) + ? s->bb_patch_server_message : s->pc_patch_server_message; + if (!message.empty()) { + send_message_box(c, message.c_str()); } - send_message_box(c, message.c_str()); + // TODO: Implement patch serving for realz. send_enter_directory_patch(c, "."); send_enter_directory_patch(c, "data"); send_enter_directory_patch(c, "scene"); diff --git a/src/ServerState.cc b/src/ServerState.cc index f9523eef..43b951b0 100644 --- a/src/ServerState.cc +++ b/src/ServerState.cc @@ -389,4 +389,10 @@ void ServerState::create_menus(shared_ptr config_json) { try { this->welcome_message = decode_sjis(d.at("WelcomeMessage")->as_string()); } catch (const out_of_range&) { } + try { + this->pc_patch_server_message = decode_sjis(d.at("PCPatchServerMessage")->as_string()); + } catch (const out_of_range&) { } + try { + this->bb_patch_server_message = decode_sjis(d.at("BBPatchServerMessage")->as_string()); + } catch (const out_of_range&) { } } diff --git a/src/ServerState.hh b/src/ServerState.hh index 41db60f2..4cd88c8b 100644 --- a/src/ServerState.hh +++ b/src/ServerState.hh @@ -20,7 +20,7 @@ -// Forwawrd declarations due to reference cycles +// Forward declarations due to reference cycles class ProxyServer; class Server; @@ -73,6 +73,8 @@ struct ServerState { std::pair proxy_destination_patch; std::pair proxy_destination_bb; std::u16string welcome_message; + std::u16string pc_patch_server_message; + std::u16string bb_patch_server_message; std::map> id_to_lobby; std::vector> public_lobby_search_order; diff --git a/system/config.example.json b/system/config.example.json index 3e72a495..ccdb4546 100644 --- a/system/config.example.json +++ b/system/config.example.json @@ -189,9 +189,18 @@ // Welcome message. If not blank, this message will be shown to PSO GC users // upon first connecting. (If this is blank, they will be taken directly to // the main menu instead.) The welcome message is never shown to PSO PC or PSO - // BB users. + // BB users, though the patch server message (below) can be used for a similar + // purpose. "WelcomeMessage": "", + // Patch server message. If not blank, these messages will be shown to PSO PC + // and PSO BB users (respectively) when they connect to the patch server. Note + // that PSO PC displays the text in a Windows edit control instead of using + // PSO's normal text renderer, so linebreaks must be \r\n and color escapes + // (e.g. $C6) do not work in PCPatchServerMessage. + "PCPatchServerMessage": "$C7newserv patch server\n\nThis server is not affiliated with, sponsored by, or in any\nother way connected to SEGA or Sonic Team, and is owned\nand operated completely independently.", + "BBPatchServerMessage": "newserv patch server\r\n\r\nThis server is not affiliated with, sponsored by, or in any other way connected to SEGA or Sonic Team, and is owned and operated completely independently.", + // Default lobby event. If set, this sets the holiday event in all lobbies at // server start time, as well as the pre-lobby holiday event. The event can be // changed in each lobby independently with the $event command, or in all