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
+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>