remove redirection feature

This commit is contained in:
Martin Michelsen
2023-10-30 15:18:08 -07:00
parent add46095c3
commit 14e6111448
6 changed files with 6 additions and 150 deletions
+6 -3
View File
@@ -3308,7 +3308,10 @@ struct S_TeamMembershipInformation_BB_12EA {
le_uint32_t team_id = 0;
le_uint32_t unknown_a4 = 0;
le_uint32_t privilege_level = 0;
le_uint32_t unknown_a6 = 0;
uint8_t unknown_a6 = 0;
uint8_t unknown_a7 = 0;
uint8_t unknown_a8 = 0;
uint8_t unknown_a9 = 0;
pstring<TextEncoding::UTF16, 0x10> team_name;
} __packed__;
@@ -3352,8 +3355,8 @@ struct S_Unknown_BB_13EA_15EA_Entry {
// 1CEA: Ranking information
// No arguments when sent by the client.
// 1DEA (S->C): Unknown
// No arguments except header.flag.
// 1DEA (S->C): Update team rewards bitmask
// header.flag specifies the new rewards bitmask.
// 1EEA (C->S): Unknown
// header.flag is used, but it's unknown what the value means.
-7
View File
@@ -20,7 +20,6 @@ constexpr uint32_t GAME = 0x44000044;
constexpr uint32_t QUEST = 0x55000055;
constexpr uint32_t QUEST_FILTER = 0x66000066;
constexpr uint32_t PROXY_DESTINATIONS = 0x77000077;
constexpr uint32_t REDIRECT_DESTINATIONS = 0x78000078;
constexpr uint32_t PROGRAMS = 0x88000088;
constexpr uint32_t PATCHES = 0x99000099;
constexpr uint32_t PROXY_OPTIONS = 0xAA0000AA;
@@ -34,7 +33,6 @@ constexpr uint32_t GO_TO_LOBBY = 0x11222211;
constexpr uint32_t INFORMATION = 0x11333311;
constexpr uint32_t DOWNLOAD_QUESTS = 0x11444411;
constexpr uint32_t PROXY_DESTINATIONS = 0x11555511;
constexpr uint32_t REDIRECT_DESTINATIONS = 0x11565611;
constexpr uint32_t PATCHES = 0x11666611;
constexpr uint32_t PROGRAMS = 0x11777711;
constexpr uint32_t DISCONNECT = 0x11888811;
@@ -50,11 +48,6 @@ constexpr uint32_t GO_BACK = 0x77FFFF77;
constexpr uint32_t OPTIONS = 0x77EEEE77;
} // namespace ProxyDestinationsMenuItemID
namespace RedirectDestinationsMenuItemID {
constexpr uint32_t GO_BACK = 0x78FFFF78;
constexpr uint32_t OPTIONS = 0x78EEEE78;
} // namespace RedirectDestinationsMenuItemID
namespace ProgramsMenuItemID {
constexpr uint32_t GO_BACK = 0x88FFFF88;
}
-55
View File
@@ -125,11 +125,6 @@ static void send_proxy_destinations_menu(shared_ptr<Client> c) {
send_menu(c, s->proxy_destinations_menu_for_version(c->version()));
}
static void send_redirect_destinations_menu(shared_ptr<Client> c) {
auto s = c->require_server_state();
send_menu(c, s->redirect_destinations_menu_for_version(c->version()));
}
static bool send_enable_send_function_call_if_applicable(shared_ptr<Client> c) {
auto s = c->require_server_state();
if (function_compiler_available() && c->config.check_flag(Client::Flag::USE_OVERFLOW_FOR_SEND_FUNCTION_CALL)) {
@@ -228,22 +223,6 @@ static void send_main_menu(shared_ptr<Client> c) {
main_menu->items.emplace_back(MainMenuItemID::PROXY_DESTINATIONS, "Proxy server",
"Connect to another\nserver through the\nproxy", proxy_destinations_menu_item_flags);
// If the client is on a virtual connection, redirecting will not work
// properly (they'll just be reconencted to newserv), so hide the option
if (!c->channel.is_virtual_connection) {
uint32_t redirect_destinations_menu_item_flags =
// DCNTE doesn't support multiple ship select menus without changing
// servers (via a 19 command) apparently :(
MenuItem::Flag::INVISIBLE_ON_DCNTE |
(s->redirect_destinations_dc.empty() ? MenuItem::Flag::INVISIBLE_ON_DC : 0) |
(s->redirect_destinations_pc.empty() ? MenuItem::Flag::INVISIBLE_ON_PC : 0) |
(s->redirect_destinations_gc.empty() ? MenuItem::Flag::INVISIBLE_ON_GC : 0) |
(s->redirect_destinations_xb.empty() ? MenuItem::Flag::INVISIBLE_ON_XB : 0) |
MenuItem::Flag::INVISIBLE_ON_BB;
main_menu->items.emplace_back(MainMenuItemID::REDIRECT_DESTINATIONS, "Other servers",
"Connect to another\nserver directly", redirect_destinations_menu_item_flags);
}
main_menu->items.emplace_back(MainMenuItemID::DOWNLOAD_QUESTS, "Download quests",
"Download quests", MenuItem::Flag::INVISIBLE_ON_DCNTE | MenuItem::Flag::INVISIBLE_ON_BB);
if (!s->is_replay) {
@@ -1796,10 +1775,6 @@ static void on_10(shared_ptr<Client> c, uint16_t, uint32_t, string& data) {
send_proxy_destinations_menu(c);
break;
case MainMenuItemID::REDIRECT_DESTINATIONS:
send_redirect_destinations_menu(c);
break;
case MainMenuItemID::DOWNLOAD_QUESTS: {
auto s = c->require_server_state();
if (c->config.check_flag(Client::Flag::IS_EPISODE_3)) {
@@ -1998,36 +1973,6 @@ static void on_10(shared_ptr<Client> c, uint16_t, uint32_t, string& data) {
break;
}
case MenuID::REDIRECT_DESTINATIONS: {
if (item_id == RedirectDestinationsMenuItemID::GO_BACK) {
send_main_menu(c);
} else if (item_id == RedirectDestinationsMenuItemID::OPTIONS) {
send_menu(c, proxy_options_menu_for_client(c));
} else {
auto s = c->require_server_state();
const pair<string, uint16_t>* dest = nullptr;
try {
dest = &s->redirect_destinations_for_version(c->version()).at(item_id);
} catch (const out_of_range&) {
}
if (!dest) {
send_message_box(c, "$C6No such destination exists.");
c->should_disconnect = true;
} else {
// Clear Check Tactics menu so client won't see newserv tournament
// state while logically on another server
if (c->config.check_flag(Client::Flag::IS_EPISODE_3) && !c->config.check_flag(Client::Flag::IS_EP3_TRIAL_EDITION)) {
send_ep3_confirm_tournament_entry(c, nullptr);
}
send_reconnect(c, resolve_ipv4(dest->first), dest->second);
}
}
break;
}
case MenuID::GAME: {
auto s = c->require_server_state();
auto game = s->find_lobby(item_id);
-60
View File
@@ -355,21 +355,6 @@ shared_ptr<const Menu> ServerState::proxy_destinations_menu_for_version(GameVers
}
}
shared_ptr<const Menu> ServerState::redirect_destinations_menu_for_version(GameVersion version) const {
switch (version) {
case GameVersion::DC:
return this->redirect_destinations_menu_dc;
case GameVersion::PC:
return this->redirect_destinations_menu_pc;
case GameVersion::GC:
return this->redirect_destinations_menu_gc;
case GameVersion::XB:
return this->redirect_destinations_menu_xb;
default:
throw out_of_range("no redirect destinations menu exists for this version");
}
}
const vector<pair<string, uint16_t>>& ServerState::proxy_destinations_for_version(GameVersion version) const {
switch (version) {
case GameVersion::DC:
@@ -385,21 +370,6 @@ const vector<pair<string, uint16_t>>& ServerState::proxy_destinations_for_versio
}
}
const vector<pair<string, uint16_t>>& ServerState::redirect_destinations_for_version(GameVersion version) const {
switch (version) {
case GameVersion::DC:
return this->redirect_destinations_dc;
case GameVersion::PC:
return this->redirect_destinations_pc;
case GameVersion::GC:
return this->redirect_destinations_gc;
case GameVersion::XB:
return this->redirect_destinations_xb;
default:
throw out_of_range("no redirect destinations menu exists for this version");
}
}
std::shared_ptr<const ItemParameterTable> ServerState::item_parameter_table_for_version(GameVersion version) const {
switch (version) {
case GameVersion::DC:
@@ -811,36 +781,6 @@ void ServerState::parse_config(const JSON& json, bool is_reload) {
this->information_contents_v2 = information_contents_v2;
this->information_contents_v3 = information_contents_v3;
auto generate_redirect_destinations_menu = [&](vector<pair<string, uint16_t>>& ret_pds, const char* key) -> shared_ptr<const Menu> {
shared_ptr<Menu> ret(new Menu(MenuID::REDIRECT_DESTINATIONS, "Other servers"));
ret_pds.clear();
try {
map<string, const JSON&> sorted_jsons;
for (const auto& it : json.at(key).as_dict()) {
sorted_jsons.emplace(it.first, *it.second);
}
ret->items.emplace_back(RedirectDestinationsMenuItemID::GO_BACK, "Go back", "Return to the\nmain menu", 0);
uint32_t item_id = 0;
for (const auto& item : sorted_jsons) {
const string& netloc_str = item.second.as_string();
const string& description = "$C7Remote server:\n$C6" + netloc_str;
ret->items.emplace_back(item_id, item.first, description, 0);
ret_pds.emplace_back(parse_netloc(netloc_str));
item_id++;
}
} catch (const out_of_range&) {
}
return ret;
};
this->redirect_destinations_menu_dc = generate_redirect_destinations_menu(this->redirect_destinations_dc, "RedirectDestinations-DC");
this->redirect_destinations_menu_pc = generate_redirect_destinations_menu(this->redirect_destinations_pc, "RedirectDestinations-PC");
this->redirect_destinations_menu_gc = generate_redirect_destinations_menu(this->redirect_destinations_gc, "RedirectDestinations-GC");
this->redirect_destinations_menu_xb = generate_redirect_destinations_menu(this->redirect_destinations_xb, "RedirectDestinations-XB");
auto generate_proxy_destinations_menu = [&](vector<pair<string, uint16_t>>& ret_pds, const char* key) -> shared_ptr<const Menu> {
shared_ptr<Menu> ret(new Menu(MenuID::PROXY_DESTINATIONS, "Proxy server"));
ret_pds.clear();
-10
View File
@@ -141,14 +141,6 @@ struct ServerState : public std::enable_shared_from_this<ServerState> {
std::shared_ptr<const Menu> information_menu_v3;
std::shared_ptr<std::vector<std::string>> information_contents_v2;
std::shared_ptr<std::vector<std::string>> information_contents_v3;
std::shared_ptr<const Menu> redirect_destinations_menu_dc;
std::shared_ptr<const Menu> redirect_destinations_menu_pc;
std::shared_ptr<const Menu> redirect_destinations_menu_gc;
std::shared_ptr<const Menu> redirect_destinations_menu_xb;
std::vector<std::pair<std::string, uint16_t>> redirect_destinations_dc;
std::vector<std::pair<std::string, uint16_t>> redirect_destinations_pc;
std::vector<std::pair<std::string, uint16_t>> redirect_destinations_gc;
std::vector<std::pair<std::string, uint16_t>> redirect_destinations_xb;
std::shared_ptr<const Menu> proxy_destinations_menu_dc;
std::shared_ptr<const Menu> proxy_destinations_menu_pc;
std::shared_ptr<const Menu> proxy_destinations_menu_gc;
@@ -214,8 +206,6 @@ struct ServerState : public std::enable_shared_from_this<ServerState> {
uint32_t connect_address_for_client(std::shared_ptr<Client> c) const;
std::shared_ptr<const Menu> information_menu_for_version(GameVersion version) const;
std::shared_ptr<const Menu> redirect_destinations_menu_for_version(GameVersion version) const;
const std::vector<std::pair<std::string, uint16_t>>& redirect_destinations_for_version(GameVersion version) const;
std::shared_ptr<const Menu> proxy_destinations_menu_for_version(GameVersion version) const;
const std::vector<std::pair<std::string, uint16_t>>& proxy_destinations_for_version(GameVersion version) const;
-15
View File
@@ -136,21 +136,6 @@
// connect to 127.0.0.1:5059.
"IPStackListen": [],
// Other servers to support redirecting to. If this is empty for any game
// version, the "Other servers" menu does not appear for that version. Entries
// in these dictionaries should be of the form "name": "address:port"; the
// names are used in the "Other servers" menu. Note that if you connect via
// the IP stack simulator on Dolphin, you cannot redirect your connection to
// another server and the "Other servers" menu will not appear for you (but
// you can still use the proxy server).
// Unlike ProxyDestinations (below), when a client chooses an item from the
// "Other servers" menu, they are redirected to connect directly to that
// server, and their connection no longer goes through newserv.
"RedirectDestinations-DC": {},
"RedirectDestinations-PC": {},
"RedirectDestinations-GC": {},
"RedirectDestinations-XB": {},
// Other servers to support proxying to. If this is empty for any game
// version, the proxy server is disabled for that version. Entries in these
// dictionaries should be of the form "name": "address:port"; the names are