add description of BB patch/checksum command

This commit is contained in:
Martin Michelsen
2022-05-21 23:58:34 -07:00
parent 641639a659
commit 908671c55b
2 changed files with 33 additions and 10 deletions
+29 -6
View File
@@ -1152,10 +1152,9 @@ struct S_ConfirmUpdateQuestStatistics_AB {
// Client will respond with a 99 command.
// B2 (S->C): Execute code and/or checksum memory
// GC v1.0 and v1.1 only.
// GC v1.0/v1.1 and BB only.
// Much of this command's information came from Sylverant's documentation.
// Client will respond with a B3 command.
// Note: BB has a handler for this, but (as of yet) I don't know what it does.
struct S_ExecuteCode_GC_B2 {
// Offsets in this command are relative to the start of the header, not the
@@ -1187,11 +1186,35 @@ struct S_ExecuteCode_Relocations_GC_B2 {
// le_uint16_t offsets[count];
};
// B3 (C->S): Execute code and/or checksum memory result
// GC v1.0 and v1.1 only.
// Support exists in BB for this command, but to my knowledge it has never been
// used. Like on GC, the client will respond with a B3 command.
struct C_ExecuteCodeResult_GC_B3 {
le_uint32_t return_value;
struct S_ExecuteCode_BB_B2 {
// If code_size == 0, no code is executed (but checksumming may still occur).
le_uint32_t code_size; // Size of code (following this struct) and footer
le_uint32_t checksum_address; // May be null if size is zero
le_uint32_t checksum_size;
};
struct S_ExecuteCode_Footer_BB_B2 {
// Relocations is a list of words (le_uint16_t) containing the number of words
// to skip for each relocation. The relocation pointer starts immediately
// after the checksum_size field in the header, and advances by the value of
// one word before each relocation. At each relocated doubleword, the address
// of the first byte of the code (after checksum_size) is added to the
// existing value.
le_uint32_t relocations_offset;
le_uint32_t num_relocations;
le_uint32_t unknown_a1[2];
le_uint32_t entrypoint_offset; // Relative to code base (after checksum_size)
le_uint32_t unknown_a2[3];
};
// B3 (C->S): Execute code and/or checksum memory result
// GC v1.0/v1.1 and BB only.
struct C_ExecuteCodeResult_GC_BB_B3 {
le_uint32_t return_value; // 0 if no code was run
le_uint32_t checksum;
};
+4 -4
View File
@@ -366,7 +366,7 @@ static bool process_server_88(shared_ptr<ServerState>,
return true;
}
static bool process_server_gc_B2(shared_ptr<ServerState>,
static bool process_server_B2(shared_ptr<ServerState>,
ProxyServer::LinkedSession& session, uint16_t, uint32_t flag, string& data) {
if (session.save_files) {
string output_filename = string_printf("code.bin.%" PRId64, now());
@@ -376,7 +376,7 @@ static bool process_server_gc_B2(shared_ptr<ServerState>,
if (session.function_call_return_value >= 0) {
session.log(INFO, "Blocking function call from server");
C_ExecuteCodeResult_GC_B3 cmd;
C_ExecuteCodeResult_GC_BB_B3 cmd;
cmd.return_value = session.function_call_return_value;
cmd.checksum = 0;
session.send_to_end(true, 0xB3, flag, &cmd, sizeof(cmd));
@@ -913,7 +913,7 @@ static process_command_t gc_server_handlers[0x100] = {
/* 80 */ defh, process_server_81<SC_SimpleMail_GC_81>, defh, defh, defh, defh, defh, defh, process_server_88, defh, defh, defh, defh, defh, defh, defh,
/* 90 */ defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, process_server_gc_9A, defh, defh, defh, defh, defh,
/* A0 */ defh, defh, defh, defh, defh, defh, process_server_44_A6<S_OpenFile_PC_GC_44_A6>, process_server_13_A7, defh, defh, defh, defh, defh, defh, defh, defh,
/* B0 */ defh, defh, process_server_gc_B2, defh, defh, defh, defh, defh, process_server_gc_B8, defh, defh, defh, defh, defh, defh, defh,
/* B0 */ defh, defh, process_server_B2, defh, defh, defh, defh, defh, process_server_gc_B8, defh, defh, defh, defh, defh, defh, defh,
/* C0 */ defh, defh, defh, defh, process_server_C4<S_ChoiceSearchResultEntry_GC_C4>, defh, defh, defh, defh, process_server_60_62_6C_6D_C9_CB, defh, process_server_60_62_6C_6D_C9_CB, defh, defh, defh, defh,
/* D0 */ defh, defh, defh, defh, defh, process_server_gc_1A_D5, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh,
/* E0 */ defh, defh, defh, defh, process_server_gc_E4, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh,
@@ -931,7 +931,7 @@ static process_command_t bb_server_handlers[0x100] = {
/* 80 */ defh, defh, defh, defh, defh, defh, defh, defh, process_server_88, defh, defh, defh, defh, defh, defh, defh,
/* 90 */ defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh,
/* A0 */ defh, defh, defh, defh, defh, defh, process_server_44_A6<S_OpenFile_BB_44_A6>, process_server_13_A7, defh, defh, defh, defh, defh, defh, defh, defh,
/* B0 */ defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh,
/* B0 */ defh, defh, process_server_B2, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh,
/* C0 */ defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh,
/* D0 */ defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh,
/* E0 */ defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh, defh,