mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-25 14:05:57 +00:00
A plugin's write into main's data that points at no plugin code is matched by place only at start (#1437, #1388)
The expect line of such a word says `* *` (tools/exefs_plugins.py plugin_lines), recomp/patches.py carries it into RT_PLUGIN_WRITES as a flag, and runtime/plugin_init.c check_writes accepts any value there through runtime/plugin_writes.h plugin_write_find. Hook branches in .text and pointers into a plugin's .text keep the exact match. Zonai Fieldworks' Self Recall takes its storage off a pool size at main+0x3ad6eb8 that grows with the texture heap of render_scale, so its plugin went off at every start with a grown heap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7da078d1ab
commit
cc749d8679
6 files changed
+139
-25
No files matched your search
@@ -0,0 +1,31 @@
|
||||
// The build's record of what a mod plugin's init writes into the game modules (patches.h RT_PLUGIN_WRITES, from the
|
||||
// `expect` lines of recomp/patches.py), and the lookup plugin_init.c check_writes makes for every word an init changed
|
||||
// at the start of the game.
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
// any: the expect line said `* *`, a word of main's .data or .bss that shapes no lifted code (tools/exefs_plugins.py
|
||||
// plugin_lines). The game may hold another value there at play than in the service run (Zonai Fieldworks' Self Recall
|
||||
// takes its storage off a pool size that grows with the resolution's texture heap), so it matches by place only. A
|
||||
// hook branch in .text and a pointer into a plugin's .text match by place and both words.
|
||||
typedef struct {
|
||||
int plugin;
|
||||
const char *module;
|
||||
uint64_t off;
|
||||
uint32_t old, now;
|
||||
int any;
|
||||
} PluginWrite;
|
||||
|
||||
// The X of RT_PLUGIN_WRITES for a table of PluginWrite.
|
||||
#define PLUGIN_WRITE(p, mod, off, old, now, any) {p, mod, off, old, now, any},
|
||||
|
||||
// The index of the entry of plugin that records the write of module+off from old to now, or -1.
|
||||
static inline int plugin_write_find(const PluginWrite *tab, int n, int plugin, const char *module, uint64_t off,
|
||||
uint32_t old, uint32_t now) {
|
||||
for (int k = 0; k < n; k++)
|
||||
if (tab[k].plugin == plugin && tab[k].off == off && !strcmp(tab[k].module, module) &&
|
||||
(tab[k].any || (tab[k].old == old && tab[k].now == now)))
|
||||
return k;
|
||||
return -1;
|
||||
}
|
||||
Reference in new issue
Block a user