Merge branch 'fuzziqersoftware:master' into master

This commit is contained in:
Maria J. Belmonte
2023-12-23 01:47:30 +01:00
committed by GitHub
4 changed files with 7 additions and 13 deletions
+1 -3
View File
@@ -4559,7 +4559,7 @@ struct G_CreateTelepipe_6x68 {
struct G_NPCControl_6x69 { struct G_NPCControl_6x69 {
G_UnusedHeader header; G_UnusedHeader header;
le_uint16_t state = 0; le_uint16_t state = 0;
le_uint16_t npc_client_id = 0; le_uint16_t npc_entity_id = 0;
le_uint16_t command = 0; // 0 = create follower NPC, 1 = stop acting, 2 = start acting, 3 = create attacker NPC le_uint16_t command = 0; // 0 = create follower NPC, 1 = stop acting, 2 = start acting, 3 = create attacker NPC
le_uint16_t npc_template_index = 0; // Specifies which NPC to create if command == 0 or 3; unused otherwise le_uint16_t npc_template_index = 0; // Specifies which NPC to create if command == 0 or 3; unused otherwise
} __packed__; } __packed__;
@@ -4673,8 +4673,6 @@ struct G_SetQuestFlags_6x6F {
// 6x70: Sync player disp data and inventory (used while loading into game) // 6x70: Sync player disp data and inventory (used while loading into game)
// Annoyingly, they didn't use the same format as the 65/67/68 commands here, // Annoyingly, they didn't use the same format as the 65/67/68 commands here,
// and instead rearranged a bunch of things. // and instead rearranged a bunch of things.
// Episode 3 does not send this command, since the relevant data is sent to the
// joining player in the 64 command instead.
struct Telepipe { struct Telepipe {
/* 00 */ le_uint16_t client_id; /* 00 */ le_uint16_t client_id;
+3 -7
View File
@@ -451,12 +451,11 @@ static void on_sync_joining_player_disp_and_inventory(
break; break;
case Version::GC_NTE: case Version::GC_NTE:
case Version::GC_V3: case Version::GC_V3:
case Version::GC_EP3_TRIAL_EDITION:
case Version::GC_EP3:
gc_cmd = &check_size_t<G_SyncPlayerDispAndInventory_GC_6x70>(data, size); gc_cmd = &check_size_t<G_SyncPlayerDispAndInventory_GC_6x70>(data, size);
base = &gc_cmd->base; base = &gc_cmd->base;
break; break;
case Version::GC_EP3_TRIAL_EDITION:
case Version::GC_EP3:
throw runtime_error("Episode 3 should not send 6x70 commands");
case Version::XB_V3: case Version::XB_V3:
xb_cmd = &check_size_t<G_SyncPlayerDispAndInventory_XB_6x70>(data, size); xb_cmd = &check_size_t<G_SyncPlayerDispAndInventory_XB_6x70>(data, size);
base = &xb_cmd->base; base = &xb_cmd->base;
@@ -1018,10 +1017,7 @@ static void on_npc_control(shared_ptr<Client> c, uint8_t command, uint8_t flag,
if (!l->is_game()) { if (!l->is_game()) {
throw runtime_error("cannot create NPCs in the lobby"); throw runtime_error("cannot create NPCs in the lobby");
} }
if (cmd.npc_client_id >= 4) { if ((cmd.npc_entity_id < 4) && l->clients[cmd.npc_entity_id]) {
throw runtime_error("NPC client ID is not valid");
}
if (l->clients[cmd.npc_client_id]) {
throw runtime_error("cannot overwrite existing player with NPC"); throw runtime_error("cannot overwrite existing player with NPC");
} }
forward_subcommand(c, command, flag, data, size); forward_subcommand(c, command, flag, data, size);
+1 -1
View File
@@ -427,7 +427,7 @@ struct pstring {
return std::string(reinterpret_cast<const char*>(&this->data[0]), this->used_chars_8()); return std::string(reinterpret_cast<const char*>(&this->data[0]), this->used_chars_8());
case TextEncoding::CHALLENGE16: { case TextEncoding::CHALLENGE16: {
std::string decrypted(reinterpret_cast<const char*>(&this->data[0]), this->used_chars_16() * 2); std::string decrypted(reinterpret_cast<const char*>(&this->data[0]), this->used_chars_16() * 2);
decrypt_challenge_rank_text_t<le_uint16_t>(decrypted.data(), decrypted.size()); decrypt_challenge_rank_text_t<le_uint16_t>(decrypted.data(), decrypted.size() / 2);
return tt_utf16_to_utf8(decrypted.data(), decrypted.size()); return tt_utf16_to_utf8(decrypted.data(), decrypted.size());
} }
case TextEncoding::MARKED: { case TextEncoding::MARKED: {
+2 -2
View File
@@ -148,7 +148,7 @@ handle_B2:
stw [r1 + 0x44], r0 stw [r1 + 0x44], r0
# Arguments: # Arguments:
# r3 = PSONetworkContext* ctx (we use this to call the send function) # r3 = TProtocol* proto (we use this to call the send function)
# r4 = void* data # r4 = void* data
# Returns: void # Returns: void
@@ -244,7 +244,7 @@ handle_B2_skip_code:
mtctr r4 mtctr r4
addi r4, r1, 0x08 addi r4, r1, 0x08
li r5, 0x0C li r5, 0x0C
bctrl # PSONetworkContext::send_command(ctx, &reply_data, 0x0C) bctrl # TProtocol::send_command(ctx, &reply_data, 0x0C)
# Clean up stack and return # Clean up stack and return
lwz r0, [r1 + 0x44] lwz r0, [r1 + 0x44]