mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-20 04:35:57 +00:00
totk.exe --plugin-init runs a mod plugin's init on our kernel and records what it did (#845)
The plugin service run loads the modules as boot does, runs sdk's DT_INIT and then each plugin's from nn::init::Start's module-init callback (rtld initialises the last loaded module first), writes the record and exits before any game constructor, graphics or audio. The record holds every word the init wrote into a game module, the plugin's image before and after its init, the process-memory maps, and the svcs and imports it called. exlaunch's init needs a Switch-like address space: QueryMemory shows the game's own rtld image below main and the host's ranges as Inaccessible (it takes Code RX runs for modules), and a 64 GiB free pool for its random alias picks. New svcs: GetSystemTick, GetInfo 65001 (current process handle), and Map/UnmapProcessMemory, which only the service run serves: an alias is a copy whose changed words go back into the source when it is unmapped. Any other svc, such as the CreateSession fallback, ends the run with a reason. nn::oe::GetDisplayVersion is answered with the build's game version. The game calls none of these svcs; the SVC trace test is still one mask test per SVC. After the design in #845 by itaskaev2, with the init run natively instead of under Unicorn. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b94e8127af
commit
b488d9e41d
11 files changed
+559
-22
No files matched your search
@@ -562,6 +562,9 @@ static uint64_t run_start(const uint8_t *p, uint64_t i, uint8_t v) { // first
|
||||
return i;
|
||||
}
|
||||
|
||||
// The plugin service run (plugin_init.c) shows rtld, its process-memory aliases and its free pool here.
|
||||
void (*mem_query_hook)(uint64_t a, RtMemoryInfo *r);
|
||||
|
||||
uint32_t mem_query(uint64_t a, RtMemoryInfo *out) {
|
||||
RtMemoryInfo r = {.base = a & ~(PAGE - 1), .size = PAGE};
|
||||
uint64_t low = L.aslr.base;
|
||||
@@ -632,6 +635,7 @@ uint32_t mem_query(uint64_t a, RtMemoryInfo *out) {
|
||||
r.size = hi - lo;
|
||||
}
|
||||
plat_mutex_unlock_shared(&lock);
|
||||
if (mem_query_hook) mem_query_hook(a, &r);
|
||||
if (out) *out = r;
|
||||
return R_OK;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user