hide patches from menu if they should only run in lobby/game
This commit is contained in:
@@ -118,6 +118,7 @@ shared_ptr<CompiledFunctionCode> compile_function_code(
|
|||||||
ret->arch = arch;
|
ret->arch = arch;
|
||||||
ret->name = name;
|
ret->name = name;
|
||||||
ret->index = 0;
|
ret->index = 0;
|
||||||
|
ret->hide_from_patches_menu = false;
|
||||||
|
|
||||||
if (arch == CompiledFunctionCode::Architecture::POWERPC) {
|
if (arch == CompiledFunctionCode::Architecture::POWERPC) {
|
||||||
auto assembled = PPC32Emulator::assemble(text, {directory});
|
auto assembled = PPC32Emulator::assemble(text, {directory});
|
||||||
@@ -133,6 +134,8 @@ shared_ptr<CompiledFunctionCode> compile_function_code(
|
|||||||
reloc_indexes.emplace(it.second / 4);
|
reloc_indexes.emplace(it.second / 4);
|
||||||
} else if (starts_with(it.first, "newserv_index_")) {
|
} else if (starts_with(it.first, "newserv_index_")) {
|
||||||
ret->index = stoul(it.first.substr(14), nullptr, 16);
|
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<MenuItem> FunctionCodeIndex::patch_menu() const {
|
|||||||
ret.emplace_back(PatchesMenuItemID::GO_BACK, u"Go back", u"", 0);
|
ret.emplace_back(PatchesMenuItemID::GO_BACK, u"Go back", u"", 0);
|
||||||
for (const auto& it : this->name_to_patch_function) {
|
for (const auto& it : this->name_to_patch_function) {
|
||||||
const auto& fn = it.second;
|
const auto& fn = it.second;
|
||||||
ret.emplace_back(fn->menu_item_id, decode_sjis(fn->name), u"",
|
if (!fn->hide_from_patches_menu) {
|
||||||
MenuItem::Flag::REQUIRES_SEND_FUNCTION_CALL);
|
ret.emplace_back(fn->menu_item_id, decode_sjis(fn->name), u"",
|
||||||
|
MenuItem::Flag::REQUIRES_SEND_FUNCTION_CALL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ struct CompiledFunctionCode {
|
|||||||
std::string name;
|
std::string name;
|
||||||
uint32_t index; // 0 = unused (not registered in index_to_function)
|
uint32_t index; // 0 = unused (not registered in index_to_function)
|
||||||
uint32_t menu_item_id;
|
uint32_t menu_item_id;
|
||||||
|
bool hide_from_patches_menu;
|
||||||
|
|
||||||
bool is_big_endian() const;
|
bool is_big_endian() const;
|
||||||
|
|
||||||
|
|||||||
@@ -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:
|
entry_ptr:
|
||||||
reloc0:
|
reloc0:
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
# $patch command, since the client will likely crash if the player is not in a
|
# $patch command, since the client will likely crash if the player is not in a
|
||||||
# game or lobby when the patch runs.
|
# game or lobby when the patch runs.
|
||||||
|
|
||||||
|
hide_from_patches_menu:
|
||||||
|
|
||||||
entry_ptr:
|
entry_ptr:
|
||||||
reloc0:
|
reloc0:
|
||||||
.offsetof start
|
.offsetof start
|
||||||
|
|||||||
@@ -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
|
# This patch is only for PSO Episode 3 USA, which means it requires the
|
||||||
# EnableEpisode3SendFunctionCall option to be enabled in config.json. If that
|
# EnableEpisode3SendFunctionCall option to be enabled in config.json. If that
|
||||||
|
|||||||
Reference in New Issue
Block a user