From 88f0c90abab71baae0c3db2b2990d604494ede27 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Sun, 3 Apr 2022 23:32:31 -0700 Subject: [PATCH] skip room unlock events in switch assist --- src/CommandFormats.hh | 3 ++- src/ProxyCommands.cc | 2 +- src/ReceiveSubcommands.cc | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/CommandFormats.hh b/src/CommandFormats.hh index d92956c6..b4a2c70a 100644 --- a/src/CommandFormats.hh +++ b/src/CommandFormats.hh @@ -1245,7 +1245,8 @@ struct G_ItemSubcommand { struct G_SwitchStateChanged_6x05 { uint8_t subcommand; uint8_t size; - parray unknown; // includes switch ID + le_uint16_t switch_id; // 0xFFFF for room clear when all enemies defeated + parray unknown; uint8_t area; uint8_t enabled; }; diff --git a/src/ProxyCommands.cc b/src/ProxyCommands.cc index 394cd2e4..c432e20e 100644 --- a/src/ProxyCommands.cc +++ b/src/ProxyCommands.cc @@ -648,7 +648,7 @@ bool process_client_60_62_6C_6D_C9_CB(shared_ptr, if (!data.empty() && (data[0] == 0x05) && session.enable_switch_assist) { auto& cmd = check_size_t(data); - if (cmd.enabled) { + if (cmd.enabled && cmd.switch_id != 0xFFFF) { if (session.last_switch_enabled_command.subcommand == 0x05) { session.log(INFO, "Switch assist: replaying previous enable command"); session.send_to_end(true, 0x60, 0x00, &session.last_switch_enabled_command, diff --git a/src/ReceiveSubcommands.cc b/src/ReceiveSubcommands.cc index 45218429..fbe6fd0b 100644 --- a/src/ReceiveSubcommands.cc +++ b/src/ReceiveSubcommands.cc @@ -214,7 +214,7 @@ static void process_subcommand_switch_state_changed(shared_ptr, return; } forward_subcommand(l, c, command, flag, data); - if (cmd.enabled) { + if (cmd.enabled && cmd.switch_id != 0xFFFF) { if ((l->flags & Lobby::Flag::CHEATS_ENABLED) && c->switch_assist && (c->last_switch_enabled_command.subcommand == 0x05)) { log(INFO, "[Switch assist] Replaying previous enable command");