From 70ac37040e67052616060522fd636f74117713f6 Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 3 Jan 2025 09:36:19 +0100 Subject: [PATCH] Simplify trampoline reset, flush cache --- source/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/main.cpp b/source/main.cpp index d121a63..368fb95 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -28,6 +28,7 @@ #include #include +#include #include WUMS_MODULE_EXPORT_NAME("homebrew_wupsbackend"); @@ -309,9 +310,12 @@ void CleanupPlugins(std::vector &&pluginsToDeinit) { if (!pluginContainer.isLinkedAndLoaded() || cur.id != pluginContainer.getPluginLinkInformation().getTrampolineId()) { continue; } - cur.status = RELOC_TRAMP_FREE; + cur = {}; } } + DCFlushRange((void *) gTrampData.data(), gTrampData.size() * sizeof(relocation_trampoline_entry_t)); + ICInvalidateRange((void *) gTrampData.data(), gTrampData.size() * sizeof(relocation_trampoline_entry_t)); + OSMemoryBarrier(); } void CheckCleanupCallbackUsage(const std::vector &plugins) { auto *curThread = OSGetCurrentThread();