diff --git a/src/FunctionCompiler.cc b/src/FunctionCompiler.cc index 284fa0f5..86811133 100644 --- a/src/FunctionCompiler.cc +++ b/src/FunctionCompiler.cc @@ -118,6 +118,7 @@ shared_ptr compile_function_code( ret->arch = arch; ret->name = name; ret->index = 0; + ret->hide_from_patches_menu = false; if (arch == CompiledFunctionCode::Architecture::POWERPC) { auto assembled = PPC32Emulator::assemble(text, {directory}); @@ -133,6 +134,8 @@ shared_ptr compile_function_code( reloc_indexes.emplace(it.second / 4); } else if (starts_with(it.first, "newserv_index_")) { ret->index = stoul(it.first.substr(14), nullptr, 16); + } else if (it.first == "hide_from_patches_menu") { + ret->hide_from_patches_menu = true; } } @@ -206,8 +209,10 @@ vector FunctionCodeIndex::patch_menu() const { ret.emplace_back(PatchesMenuItemID::GO_BACK, u"Go back", u"", 0); for (const auto& it : this->name_to_patch_function) { const auto& fn = it.second; - ret.emplace_back(fn->menu_item_id, decode_sjis(fn->name), u"", - MenuItem::Flag::REQUIRES_SEND_FUNCTION_CALL); + if (!fn->hide_from_patches_menu) { + ret.emplace_back(fn->menu_item_id, decode_sjis(fn->name), u"", + MenuItem::Flag::REQUIRES_SEND_FUNCTION_CALL); + } } return ret; } diff --git a/src/FunctionCompiler.hh b/src/FunctionCompiler.hh index 71ea9057..1e949b72 100644 --- a/src/FunctionCompiler.hh +++ b/src/FunctionCompiler.hh @@ -33,6 +33,7 @@ struct CompiledFunctionCode { std::string name; uint32_t index; // 0 = unused (not registered in index_to_function) uint32_t menu_item_id; + bool hide_from_patches_menu; bool is_big_endian() const; diff --git a/system/ppc/Ep3-AllCards.patch.s b/system/ppc/Ep3-AllCards.patch.s index 6ff6c25e..c4f06d89 100644 --- a/system/ppc/Ep3-AllCards.patch.s +++ b/system/ppc/Ep3-AllCards.patch.s @@ -1,4 +1,13 @@ -# This patch gives you the maximum number of each card in Episode 3 USA. +# This patch gives you the maximum number of each card. It only works if used +# in-game, which means it must be used with the $patch command (and not selected +# from the Patches menu). + +# This patch is only for PSO Episode 3 USA, which means it requires the +# EnableEpisode3SendFunctionCall option to be enabled in config.json. If that +# option is disabled, the Patches menu won't appear for the client. If this +# patch is run on a different client version, it will do nothing. + +hide_from_patches_menu: entry_ptr: reloc0: diff --git a/system/ppc/Ep3-Editors.patch.s b/system/ppc/Ep3-Editors.patch.s index fd4c1149..655c789f 100644 --- a/system/ppc/Ep3-Editors.patch.s +++ b/system/ppc/Ep3-Editors.patch.s @@ -12,6 +12,8 @@ # $patch command, since the client will likely crash if the player is not in a # game or lobby when the patch runs. +hide_from_patches_menu: + entry_ptr: reloc0: .offsetof start diff --git a/system/ppc/Ep3-VIPCard.patch.s b/system/ppc/Ep3-VIPCard.patch.s index b8c66a01..f3ad5d1a 100644 --- a/system/ppc/Ep3-VIPCard.patch.s +++ b/system/ppc/Ep3-VIPCard.patch.s @@ -1,4 +1,4 @@ -# This gives you a VIP card in PSO Episode 3 USA. +# This patch gives you a VIP card in PSO Episode 3 USA. # This patch is only for PSO Episode 3 USA, which means it requires the # EnableEpisode3SendFunctionCall option to be enabled in config.json. If that