implement ss shell command on game server

This commit is contained in:
Martin Michelsen
2022-12-28 00:29:55 -08:00
parent eb2463a820
commit 52db9008a8
3 changed files with 37 additions and 5 deletions
+29
View File
@@ -4081,3 +4081,32 @@ void on_command(shared_ptr<ServerState> s, shared_ptr<Client> c,
on_unimplemented_command(s, c, command, flag, data);
}
}
void on_command_with_header(shared_ptr<ServerState> s, shared_ptr<Client> c,
string& data) {
switch (c->version()) {
case GameVersion::DC:
case GameVersion::GC:
case GameVersion::XB: {
auto& header = check_size_t<PSOCommandHeaderDCV3>(data,
sizeof(PSOCommandHeaderDCV3), 0xFFFF);
on_command(s, c, header.command, header.flag, data.substr(sizeof(header)));
break;
}
case GameVersion::PC:
case GameVersion::PATCH: {
auto& header = check_size_t<PSOCommandHeaderPC>(data,
sizeof(PSOCommandHeaderPC), 0xFFFF);
on_command(s, c, header.command, header.flag, data.substr(sizeof(header)));
break;
}
case GameVersion::BB: {
auto& header = check_size_t<PSOCommandHeaderBB>(data,
sizeof(PSOCommandHeaderBB), 0xFFFF);
on_command(s, c, header.command, header.flag, data.substr(sizeof(header)));
break;
}
default:
throw logic_error("unimplemented game version in on_command_with_header");
}
}