fix LoginExtended format

This commit is contained in:
Martin Michelsen
2022-08-27 19:04:56 -07:00
parent f59347c5c2
commit d2bcc5d261
4 changed files with 20 additions and 9 deletions
+4 -1
View File
@@ -1431,7 +1431,10 @@ struct C_Login_DC_PC_GC_9D {
ptext<char, 0x30> access_key2; // On XB, this is the XBL user ID
ptext<char, 0x10> name;
};
struct C_LoginExtended_DC_PC_GC_9D : C_Login_DC_PC_GC_9D {
struct C_LoginExtended_DC_GC_9D : C_Login_DC_PC_GC_9D {
C_Login_MeetUserExtension<char> extension;
};
struct C_LoginExtended_PC_9D : C_Login_DC_PC_GC_9D {
C_Login_MeetUserExtension<char16_t> extension;
};
+3 -2
View File
@@ -280,7 +280,7 @@ void ProxyServer::UnlinkedSession::on_input(Channel& ch, uint16_t command, uint3
client_config.cfg.flags |= Client::Flag::DCV1;
} else if (command == 0x9D) {
const auto& cmd = check_size_t<C_Login_DC_PC_GC_9D>(
data, sizeof(C_Login_DC_PC_GC_9D), sizeof(C_LoginExtended_DC_PC_GC_9D));
data, sizeof(C_Login_DC_PC_GC_9D), sizeof(C_LoginExtended_DC_GC_9D));
license = session->server->state->license_manager->verify_pc(
stoul(cmd.serial_number, nullptr, 16), cmd.access_key);
sub_version = cmd.sub_version;
@@ -297,7 +297,7 @@ void ProxyServer::UnlinkedSession::on_input(Channel& ch, uint16_t command, uint3
throw runtime_error("command is not 9D");
}
const auto& cmd = check_size_t<C_Login_DC_PC_GC_9D>(
data, sizeof(C_Login_DC_PC_GC_9D), sizeof(C_LoginExtended_DC_PC_GC_9D));
data, sizeof(C_Login_DC_PC_GC_9D), sizeof(C_LoginExtended_PC_9D));
license = session->server->state->license_manager->verify_pc(
stoul(cmd.serial_number, nullptr, 16), cmd.access_key);
sub_version = cmd.sub_version;
@@ -307,6 +307,7 @@ void ProxyServer::UnlinkedSession::on_input(Channel& ch, uint16_t command, uint3
} else if (session->version == GameVersion::GC) {
// We should only get a 9E while the session is unlinked; if we get
// anything else, disconnect
// TODO: GCTE will send 9D; we should presumably handle that too, sigh
if (command != 0x9E) {
throw runtime_error("command is not 9E");
}
+11 -4
View File
@@ -415,11 +415,18 @@ void process_login_d_e_dc_pc_v3(shared_ptr<ServerState> s, shared_ptr<Client> c,
const C_Login_DC_PC_GC_9D* base_cmd;
if (command == 0x9D) {
base_cmd = &check_size_t<C_Login_DC_PC_GC_9D>(data,
sizeof(C_Login_DC_PC_GC_9D), sizeof(C_LoginExtended_DC_PC_GC_9D));
sizeof(C_Login_DC_PC_GC_9D), sizeof(C_LoginExtended_PC_9D));
if (base_cmd->is_extended) {
const auto& cmd = check_size_t<C_LoginExtended_DC_PC_GC_9D>(data);
if (cmd.extension.menu_id == MenuID::LOBBY) {
c->preferred_lobby_id = cmd.extension.preferred_lobby_id;
if (c->version() == GameVersion::PC) {
const auto& cmd = check_size_t<C_LoginExtended_PC_9D>(data);
if (cmd.extension.menu_id == MenuID::LOBBY) {
c->preferred_lobby_id = cmd.extension.preferred_lobby_id;
}
} else {
const auto& cmd = check_size_t<C_LoginExtended_DC_GC_9D>(data);
if (cmd.extension.menu_id == MenuID::LOBBY) {
c->preferred_lobby_id = cmd.extension.preferred_lobby_id;
}
}
}
+2 -2
View File
@@ -106,7 +106,7 @@ void ReplaySession::check_for_password(shared_ptr<const Event> ev) const {
check_pw(cmd.password);
} else if (header.command == 0x9D) {
const auto& cmd = check_size_t<C_Login_DC_PC_GC_9D>(cmd_data, cmd_size,
sizeof(C_Login_DC_PC_GC_9D), sizeof(C_LoginExtended_DC_PC_GC_9D));
sizeof(C_Login_DC_PC_GC_9D), sizeof(C_LoginExtended_PC_9D));
check_ak(cmd.v1_access_key);
check_ak(cmd.access_key);
check_ak(cmd.access_key2);
@@ -139,7 +139,7 @@ void ReplaySession::check_for_password(shared_ptr<const Event> ev) const {
check_pw(cmd.password);
} else if (header.command == 0x9D) {
const auto& cmd = check_size_t<C_Login_DC_PC_GC_9D>(cmd_data, cmd_size,
sizeof(C_Login_DC_PC_GC_9D), sizeof(C_LoginExtended_DC_PC_GC_9D));
sizeof(C_Login_DC_PC_GC_9D), sizeof(C_LoginExtended_DC_GC_9D));
check_ak(cmd.v1_access_key);
check_ak(cmd.access_key);
check_ak(cmd.access_key2);