fix differentiation between Episode 3 Trial Edition and final JP version

This commit is contained in:
Martin Michelsen
2023-08-20 10:59:53 -07:00
parent dd5ef0c8a4
commit 8adbe38617
4 changed files with 26 additions and 26184 deletions
+20 -10
View File
@@ -231,15 +231,6 @@ static void send_main_menu(shared_ptr<ServerState> s, shared_ptr<Client> c) {
}
void on_login_complete(shared_ptr<ServerState> s, shared_ptr<Client> c) {
if (c->flags & Client::Flag::IS_EPISODE_3) {
auto team = s->ep3_tournament_index->team_for_serial_number(c->license->serial_number);
auto tourn = team ? team->tournament.lock() : nullptr;
c->ep3_tournament_team = team;
if (!(c->flags & Client::Flag::IS_EP3_TRIAL_EDITION)) {
send_ep3_confirm_tournament_entry(s, c, tourn);
}
}
// On the BB data server, this function is called only on the last connection
// (when we should send the ship select menu).
if ((c->server_behavior == ServerBehavior::LOGIN_SERVER) ||
@@ -252,8 +243,8 @@ void on_login_complete(shared_ptr<ServerState> s, shared_ptr<Client> c) {
} else if (s->pre_lobby_event) {
send_change_event(c, s->pre_lobby_event);
}
send_ep3_card_list_update(s, c);
send_ep3_rank_update(c);
send_get_player_info(c);
} else if (s->pre_lobby_event) {
send_change_event(c, s->pre_lobby_event);
}
@@ -2493,9 +2484,28 @@ static void on_61_98(shared_ptr<ServerState> s, shared_ptr<Client> c,
c->game_data.ep3_config.reset(new Episode3::PlayerConfig(pd3->ep3_config));
cmd = reinterpret_cast<const C_CharacterData_V3_61_98*>(pd3);
} else {
if (c->flags & Client::Flag::IS_EPISODE_3) {
c->flags = (c->flags | Client::Flag::IS_EP3_TRIAL_EDITION) & (~Client::Flag::ENCRYPTED_SEND_FUNCTION_CALL);
}
cmd = &check_size_t<C_CharacterData_V3_61_98>(data, 0xFFFF);
}
// We use the flag field in this command to differentiate between Ep3
// Trial Edition and the final version: Trial Edition sends flag=3, and
// the final version sends flag=4. Because the contents of the card list
// update and the current tournament entry depend on this flag, we have
// to delay sending them until now, instead of sending them during the
// login sequence.
if ((c->flags & Client::Flag::IS_EPISODE_3) && !(c->flags & Client::Flag::HAS_EP3_CARD_DEFS)) {
send_ep3_card_list_update(s, c);
auto team = s->ep3_tournament_index->team_for_serial_number(c->license->serial_number);
auto tourn = team ? team->tournament.lock() : nullptr;
c->ep3_tournament_team = team;
if (!(c->flags & Client::Flag::IS_EP3_TRIAL_EDITION)) {
send_ep3_confirm_tournament_entry(s, c, tourn);
}
}
auto account = c->game_data.account();
auto player = c->game_data.player();
player->inventory = cmd->inventory;
+5 -5
View File
@@ -81,14 +81,14 @@ uint32_t flags_for_version(GameVersion version, int64_t sub_version) {
return Client::Flag::NO_D6_AFTER_LOBBY |
Client::Flag::NO_SEND_FUNCTION_CALL;
case 0x40: // GC Ep3 trial
// TODO: Is this sub_version used for any other Ep3 versions? Is the final
// JP release really 42 and not 40?
case 0x40: // GC Ep3 JP and Trial Edition
// sub_version can't be used to tell JP final and Trial Edition apart; we
// instead look at header.flag in the 61 command.
return Client::Flag::NO_D6_AFTER_LOBBY |
Client::Flag::IS_EPISODE_3 |
Client::Flag::IS_EP3_TRIAL_EDITION |
Client::Flag::ENCRYPTED_SEND_FUNCTION_CALL |
Client::Flag::SEND_FUNCTION_CALL_NO_CACHE_PATCH;
case 0x42: // GC Ep3 JP
case 0x42: // Also GC Ep3 JP?
return Client::Flag::NO_D6_AFTER_LOBBY |
Client::Flag::IS_EPISODE_3 |
Client::Flag::ENCRYPTED_SEND_FUNCTION_CALL |