fix PSO PC corruption message caused by multiple proxy sessions
This commit is contained in:
+45
-35
@@ -162,7 +162,10 @@ void on_connect(std::shared_ptr<Client> c) {
|
||||
break;
|
||||
}
|
||||
|
||||
case ServerBehavior::LOGIN_SERVER:
|
||||
case ServerBehavior::SUBSEQUENT_LOGIN_SERVER:
|
||||
c->config.set_flag(Client::Flag::SAVE_ENABLED);
|
||||
[[fallthrough]];
|
||||
case ServerBehavior::INITIAL_LOGIN_SERVER:
|
||||
send_server_init(c, SendServerInitFlag::IS_INITIAL_CONNECTION);
|
||||
break;
|
||||
|
||||
@@ -259,51 +262,58 @@ static void send_main_menu(shared_ptr<Client> c) {
|
||||
void on_login_complete(shared_ptr<Client> c) {
|
||||
// On BB, this function is called when the data server phase is done (and we
|
||||
// should send the ship select menu), so we don't need to check for it here.
|
||||
if (c->server_behavior == ServerBehavior::LOGIN_SERVER) {
|
||||
auto s = c->require_server_state();
|
||||
switch (c->server_behavior) {
|
||||
case ServerBehavior::INITIAL_LOGIN_SERVER:
|
||||
case ServerBehavior::SUBSEQUENT_LOGIN_SERVER: {
|
||||
auto s = c->require_server_state();
|
||||
|
||||
// On the login server, send the events/songs, ep3 updates, and the main
|
||||
// menu or welcome message
|
||||
if (is_ep3(c->version())) {
|
||||
if (s->ep3_menu_song >= 0) {
|
||||
send_ep3_change_music(c->channel, s->ep3_menu_song);
|
||||
} else if (s->pre_lobby_event) {
|
||||
send_change_event(c, s->pre_lobby_event);
|
||||
}
|
||||
|
||||
send_ep3_rank_update(c);
|
||||
send_get_player_info(c);
|
||||
|
||||
// On the login server, send the events/songs, ep3 updates, and the main
|
||||
// menu or welcome message
|
||||
if (is_ep3(c->version())) {
|
||||
if (s->ep3_menu_song >= 0) {
|
||||
send_ep3_change_music(c->channel, s->ep3_menu_song);
|
||||
} else if (s->pre_lobby_event) {
|
||||
send_change_event(c, s->pre_lobby_event);
|
||||
}
|
||||
|
||||
send_ep3_rank_update(c);
|
||||
send_get_player_info(c);
|
||||
|
||||
} else if (s->pre_lobby_event) {
|
||||
send_change_event(c, s->pre_lobby_event);
|
||||
}
|
||||
|
||||
if (s->welcome_message.empty() ||
|
||||
c->config.check_flag(Client::Flag::NO_D6) ||
|
||||
!c->config.check_flag(Client::Flag::AT_WELCOME_MESSAGE)) {
|
||||
c->config.clear_flag(Client::Flag::AT_WELCOME_MESSAGE);
|
||||
if (send_enable_send_function_call_if_applicable(c)) {
|
||||
send_update_client_config(c);
|
||||
if (s->welcome_message.empty() ||
|
||||
c->config.check_flag(Client::Flag::NO_D6) ||
|
||||
!c->config.check_flag(Client::Flag::AT_WELCOME_MESSAGE)) {
|
||||
c->config.clear_flag(Client::Flag::AT_WELCOME_MESSAGE);
|
||||
if (send_enable_send_function_call_if_applicable(c)) {
|
||||
send_update_client_config(c);
|
||||
}
|
||||
send_main_menu(c);
|
||||
} else {
|
||||
send_message_box(c, s->welcome_message.c_str());
|
||||
}
|
||||
send_main_menu(c);
|
||||
} else {
|
||||
send_message_box(c, s->welcome_message.c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
} else if (c->server_behavior == ServerBehavior::LOBBY_SERVER) {
|
||||
case ServerBehavior::LOBBY_SERVER:
|
||||
if (c->version() == Version::BB_V4) {
|
||||
// This implicitly loads the client's account and player data
|
||||
send_complete_player_bb(c);
|
||||
c->should_update_play_time = true;
|
||||
}
|
||||
|
||||
if (c->version() == Version::BB_V4) {
|
||||
// This implicitly loads the client's account and player data
|
||||
send_complete_player_bb(c);
|
||||
c->should_update_play_time = true;
|
||||
}
|
||||
if (is_ep3(c->version())) {
|
||||
send_ep3_rank_update(c);
|
||||
}
|
||||
|
||||
if (is_ep3(c->version())) {
|
||||
send_ep3_rank_update(c);
|
||||
}
|
||||
send_lobby_list(c);
|
||||
send_get_player_info(c);
|
||||
break;
|
||||
|
||||
send_lobby_list(c);
|
||||
send_get_player_info(c);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ struct PSOGCSystemFile {
|
||||
// This field stores the effective time zone offset between the server and
|
||||
// client, in frames. The default value is 1728000, which corresponds to 16
|
||||
// hours. This is recomputed when the client receives a B1 command.
|
||||
/* 0008 */ be_uint32_t server_time_delta_frames;
|
||||
/* 0008 */ be_int32_t server_time_delta_frames;
|
||||
/* 000C */ be_uint16_t udp_behavior; // 0 = auto, 1 = on, 2 = off
|
||||
/* 000E */ be_uint16_t surround_sound_enabled;
|
||||
/* 0010 */ parray<uint8_t, 0x100> event_flags; // Can be set by quest opcode D8 or E8
|
||||
@@ -125,7 +125,7 @@ struct PSOBBMinimalSystemFile {
|
||||
/* 0004 */ be_int16_t music_volume = 0;
|
||||
/* 0006 */ int8_t sound_volume = 0;
|
||||
/* 0007 */ uint8_t language = 0;
|
||||
/* 0008 */ be_uint32_t server_time_delta_frames = 1728000;
|
||||
/* 0008 */ be_int32_t server_time_delta_frames = 1728000;
|
||||
/* 000C */ be_uint16_t udp_behavior = 0; // 0 = auto, 1 = on, 2 = off
|
||||
/* 000E */ be_uint16_t surround_sound_enabled = 0;
|
||||
/* 0010 */ parray<uint8_t, 0x0100> event_flags;
|
||||
@@ -691,7 +691,7 @@ struct PSOPCSystemFile { // PSO______COM
|
||||
/* 0004 */ le_int16_t music_volume;
|
||||
/* 0006 */ int8_t sound_volume;
|
||||
/* 0007 */ uint8_t language;
|
||||
/* 0008 */ le_uint32_t server_time_delta_frames;
|
||||
/* 0008 */ le_int32_t server_time_delta_frames;
|
||||
/* 000C */ parray<le_uint16_t, 0x10> unknown_a4; // Last one is always 0x1234?
|
||||
/* 002C */ parray<uint8_t, 0x100> event_flags;
|
||||
/* 012C */ le_uint32_t round1_seed;
|
||||
|
||||
+10
-4
@@ -166,8 +166,10 @@ const char* name_for_enum<ServerBehavior>(ServerBehavior behavior) {
|
||||
switch (behavior) {
|
||||
case ServerBehavior::PC_CONSOLE_DETECT:
|
||||
return "pc_console_detect";
|
||||
case ServerBehavior::LOGIN_SERVER:
|
||||
return "login_server";
|
||||
case ServerBehavior::INITIAL_LOGIN_SERVER:
|
||||
return "initial_login_server";
|
||||
case ServerBehavior::SUBSEQUENT_LOGIN_SERVER:
|
||||
return "subsequent_login_server";
|
||||
case ServerBehavior::LOBBY_SERVER:
|
||||
return "lobby_server";
|
||||
case ServerBehavior::PATCH_SERVER_PC:
|
||||
@@ -184,8 +186,12 @@ template <>
|
||||
ServerBehavior enum_for_name<ServerBehavior>(const char* name) {
|
||||
if (!strcasecmp(name, "pc_console_detect")) {
|
||||
return ServerBehavior::PC_CONSOLE_DETECT;
|
||||
} else if (!strcasecmp(name, "login_server") || !strcasecmp(name, "login") || !strcasecmp(name, "data_server_bb")) {
|
||||
return ServerBehavior::LOGIN_SERVER;
|
||||
} else if (!strcasecmp(name, "login_server")) {
|
||||
throw invalid_argument("the login_server behavior name is not supported; replace it with initial_login_server or subsequent_login_server");
|
||||
} else if (!strcasecmp(name, "initial_login_server")) {
|
||||
return ServerBehavior::INITIAL_LOGIN_SERVER;
|
||||
} else if (!strcasecmp(name, "subsequent_login_server") || !strcasecmp(name, "data_server_bb")) {
|
||||
return ServerBehavior::SUBSEQUENT_LOGIN_SERVER;
|
||||
} else if (!strcasecmp(name, "lobby_server") || !strcasecmp(name, "lobby")) {
|
||||
return ServerBehavior::LOBBY_SERVER;
|
||||
} else if (!strcasecmp(name, "patch_server_pc") || !strcasecmp(name, "patch_pc")) {
|
||||
|
||||
+2
-1
@@ -109,7 +109,8 @@ uint32_t default_specific_version_for_version(Version version, int64_t sub_versi
|
||||
|
||||
enum class ServerBehavior {
|
||||
PC_CONSOLE_DETECT = 0,
|
||||
LOGIN_SERVER,
|
||||
INITIAL_LOGIN_SERVER,
|
||||
SUBSEQUENT_LOGIN_SERVER,
|
||||
LOBBY_SERVER,
|
||||
PATCH_SERVER_PC,
|
||||
PATCH_SERVER_BB,
|
||||
|
||||
Reference in New Issue
Block a user