unmask ep3 commands on proxy server

This commit is contained in:
Martin Michelsen
2022-12-14 20:37:48 -08:00
parent fa95a2f6d8
commit 7612621fe9
2 changed files with 21 additions and 1 deletions
+6
View File
@@ -2099,6 +2099,12 @@ struct C_SetBlockedSenders_BB_C6 : C_SetBlockedSenders_C6<28> { } __packed__;
// This command is not valid on Episode 3 Trial Edition.
// header.flag determines the client's registration state - 1 if the client is
// registered for the tournament, 0 if not.
// This command controls what's shown in the Check Tactics pane in the pause
// menu. If the client is registered (header.flag==1), the option is enabled and
// the bracket data in the command is shown there, and a third pane on the
// Status item shows the other information (tournament name, ship name, and
// start time). If the client is not registered, the Check Tactics option is
// disabled and the Status item has only two panes.
struct S_ConfirmTournamentEntry_GC_Ep3_CC {
ptext<char, 0x40> tournament_name;
+15 -1
View File
@@ -890,7 +890,21 @@ static HandlerResult S_6x(shared_ptr<ServerState>,
}
}
bool modified = false;
if (!data.empty()) {
// Unmask any masked Episode 3 commands from the server
if ((session.version == GameVersion::GC) && (data.size() > 8) &&
((static_cast<uint8_t>(data[0]) == 0xB3) ||
(static_cast<uint8_t>(data[0]) == 0xB4) ||
(static_cast<uint8_t>(data[0]) == 0xB5))) {
const auto& header = check_size_t<G_CardBattleCommandHeader>(
data, sizeof(G_CardBattleCommandHeader), 0xFFFF);
if (header.mask_key) {
set_mask_for_ep3_game_command(data.data(), data.size(), 0);
modified = true;
}
}
if (data[0] == 0x46) {
const auto& cmd = check_size_t<G_AttackFinished_6x46>(data,
offsetof(G_AttackFinished_6x46, entries),
@@ -962,7 +976,7 @@ static HandlerResult S_6x(shared_ptr<ServerState>,
}
}
return HandlerResult::Type::FORWARD;
return modified ? HandlerResult::Type::MODIFIED : HandlerResult::Type::FORWARD;
}
template <typename T>