implement some parts of DC NTE (but not all of it)

This commit is contained in:
Martin Michelsen
2022-09-23 00:33:03 -07:00
parent 9524d05279
commit a9cf98a24f
9 changed files with 178 additions and 47 deletions
+4 -4
View File
@@ -77,8 +77,8 @@ void CatSession::on_channel_input(
uint16_t command, uint32_t flag, std::string& data) {
if (this->channel.version != GameVersion::BB) {
if (command == 0x02 || command == 0x17 || command == 0x91 || command == 0x9B) {
const auto& cmd = check_size_t<S_ServerInit_DC_PC_V3_02_17_91_9B>(data,
offsetof(S_ServerInit_DC_PC_V3_02_17_91_9B, after_message), 0xFFFF);
const auto& cmd = check_size_t<S_ServerInitDefault_DC_PC_V3_02_17_91_9B>(data,
sizeof(S_ServerInitDefault_DC_PC_V3_02_17_91_9B), 0xFFFF);
if ((this->channel.version == GameVersion::GC) ||
(this->channel.version == GameVersion::XB)) {
this->channel.crypt_in.reset(new PSOV3Encryption(cmd.server_key));
@@ -97,8 +97,8 @@ void CatSession::on_channel_input(
if (!this->bb_key_file) {
throw runtime_error("BB encryption requires a key file");
}
const auto& cmd = check_size_t<S_ServerInit_BB_03_9B>(data,
offsetof(S_ServerInit_DC_PC_V3_02_17_91_9B, after_message), 0xFFFF);
const auto& cmd = check_size_t<S_ServerInitDefault_BB_03_9B>(data,
sizeof(S_ServerInitDefault_BB_03_9B), 0xFFFF);
this->channel.crypt_in.reset(new PSOBBEncryption(*this->bb_key_file, &cmd.server_key[0], sizeof(cmd.server_key)));
this->channel.crypt_out.reset(new PSOBBEncryption(*this->bb_key_file, &cmd.client_key[0], sizeof(cmd.client_key)));
this->log.info("Enabled BB encryption");