render passes: restore mod callback context after watchdog aborts

Adapted from the original feature commits, retaining their author credit:
[6d44e21d](https://github.com/FractalEngineer/psxrecomp/commit/6d44e21df7ccedd1acbfa31844a53bf8bd8b316e)
[35b209d4](https://github.com/FractalEngineer/psxrecomp/commit/35b209d406c168e14f51bb8bbd549742473c7388)

Source scope and current-master validation: docs/internal/upstream/render-pass-mod-callback-rollback.md

Co-authored-by: Yves <calibratedbeats@gmail.com>
This commit is contained in:
Yves
2026-10-04 05:54:03 +08:00
parent dedbe47c97
commit b491a3597f
9 changed files with 136 additions and 3 deletions
+11
View File
@@ -1603,6 +1603,17 @@ extern "C" int psx_mod_function_entry_active(void) {
return PSXRecompV4::function_entry_depth != 0;
}
extern "C" void mod_runtime_function_entry_context_save(ModFunctionEntryContext *out) {
out->depth = PSXRecompV4::function_entry_depth;
out->plugin = PSXRecompV4::state().current_plugin;
}
extern "C" void mod_runtime_function_entry_context_restore(const ModFunctionEntryContext *in) {
PSXRecompV4::function_entry_depth = in->depth;
PSXRecompV4::state().current_plugin =
static_cast<const PSXRecompV4::ModResolution::Plugin *>(in->plugin);
}
extern "C" void mod_runtime_patch_disc_sector(uint32_t lba, int raw_sector,
uint8_t* bytes, uint32_t size) {
using namespace PSXRecompV4;