From f3681d79f92913d450d999723beff473b0d57d92 Mon Sep 17 00:00:00 2001 From: James Osborne Date: Sat, 16 May 2026 03:23:36 -0400 Subject: [PATCH] Fix Dreamcast V2 EXP resend behavior --- src/ReceiveCommands.cc | 8 +++++++- src/ReceiveSubcommands.cc | 5 ++++- .../client-functions.disabled/PsoPeepsV2EXP5xDC.s | 15 +++++++++------ system/client-functions/PsoPeepsV2EXP10xDC.s | 10 ++++++---- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/ReceiveCommands.cc b/src/ReceiveCommands.cc index 45e6b862..9150ad3f 100644 --- a/src/ReceiveCommands.cc +++ b/src/ReceiveCommands.cc @@ -473,6 +473,9 @@ static asio::awaitable send_auto_patches_if_needed(shared_ptr c) { } } for (const auto& patch_name : c->login->account->auto_patches_enabled) { + if ((patch_name != "PsoPeepsV2EXP5xDC") && (patch_name != "PsoPeepsV2EXP10xDC")) { + continue; + } try { functions_to_send.emplace(s->client_functions->get(patch_name, c->specific_version)); } catch (const out_of_range&) { @@ -5504,6 +5507,9 @@ static asio::awaitable on_6F(shared_ptr c, Channel::Message& msg) auto s = c->require_server_state(); unordered_set> functions_to_send; for (const auto& patch_name : c->login->account->auto_patches_enabled) { + if ((patch_name != "PsoPeepsV2EXP5xDC") && (patch_name != "PsoPeepsV2EXP10xDC")) { + continue; + } try { functions_to_send.emplace(s->client_functions->get(patch_name, c->specific_version)); } catch (const out_of_range&) { @@ -5513,7 +5519,7 @@ static asio::awaitable on_6F(shared_ptr c, Channel::Message& msg) } if (!functions_to_send.empty()) { - c->log.info_f("Resending {} selected patch-menu function(s) after loading", functions_to_send.size()); + c->log.info_f("Resending {} selected Dreamcast V2 EXP patch function(s) after loading", functions_to_send.size()); co_await send_function_call_multi(c, functions_to_send); } } diff --git a/src/ReceiveSubcommands.cc b/src/ReceiveSubcommands.cc index 25208350..96e9022a 100644 --- a/src/ReceiveSubcommands.cc +++ b/src/ReceiveSubcommands.cc @@ -101,6 +101,9 @@ static asio::awaitable resend_selected_patch_menu_functions_after_dc_floor auto s = c->require_server_state(); unordered_set> functions_to_send; for (const auto& patch_name : c->login->account->auto_patches_enabled) { + if ((patch_name != "PsoPeepsV2EXP5xDC") && (patch_name != "PsoPeepsV2EXP10xDC")) { + continue; + } try { functions_to_send.emplace(s->client_functions->get(patch_name, c->specific_version)); } catch (const out_of_range&) { @@ -110,7 +113,7 @@ static asio::awaitable resend_selected_patch_menu_functions_after_dc_floor } if (!functions_to_send.empty()) { - c->log.info_f("Resending {} selected patch-menu function(s) after {}", functions_to_send.size(), reason); + c->log.info_f("Resending {} selected Dreamcast V2 EXP patch function(s) after {}", functions_to_send.size(), reason); co_await send_function_call_multi(c, functions_to_send); } } diff --git a/system/client-functions.disabled/PsoPeepsV2EXP5xDC.s b/system/client-functions.disabled/PsoPeepsV2EXP5xDC.s index a7ad3e9d..021ef909 100644 --- a/system/client-functions.disabled/PsoPeepsV2EXP5xDC.s +++ b/system/client-functions.disabled/PsoPeepsV2EXP5xDC.s @@ -33,8 +33,9 @@ find_factor: cmpeq r0, r5 bt factor_found add r6, 4 - dt r7 - bf find_factor + add r7, -1 + cmpgt r7, 0 + bt find_factor rets nop @@ -57,8 +58,9 @@ multiply_loop: sts macl, r0 mov.w [r4], r0 add r4, r6 - dt r7 - bf multiply_loop + add r7, -1 + cmpgt r7, 0 + bt multiply_loop rets nop @@ -76,8 +78,9 @@ halve_loop: shlr r0 mov.w [r4], r0 add r4, r6 - dt r7 - bf halve_loop + add r7, -1 + cmpgt r7, 0 + bt halve_loop rets nop diff --git a/system/client-functions/PsoPeepsV2EXP10xDC.s b/system/client-functions/PsoPeepsV2EXP10xDC.s index 09c4ebb4..13f3fd14 100644 --- a/system/client-functions/PsoPeepsV2EXP10xDC.s +++ b/system/client-functions/PsoPeepsV2EXP10xDC.s @@ -39,8 +39,9 @@ find_factor: cmpeq r0, r5 bt factor_found add r6, 4 - dt r7 - bf find_factor + add r7, -1 + cmpgt r7, 0 + bt find_factor rets nop @@ -61,8 +62,9 @@ multiply_loop: sts macl, r0 mov.w [r4], r0 add r4, r6 - dt r7 - bf multiply_loop + add r7, -1 + cmpgt r7, 0 + bt multiply_loop rets nop