HSML - Code Mod Loader for Hookshot 1.3.0

A Mod for The Legend of Zelda: Ocarina of Time
HSML - Code Mod Loader for Hookshot akl_mod_preview_image
  • hsm-log.png
    hsm-log.png
    124.5 KB · Views: 5
The Ocarina of Time (Switch 2) recomps Hookshot, Longshot, Triforce and ReLink load only RomFS mods; changing the game's code means editing and rebuilding the port. HSML is a loader for such code mods: it starts with the game and loads every mod DLL from the mods folder. Each mod hooks the recompiled game functions it needs, found by their Switch address, and HSML redirects them to the mod's code in memory, leaving the port's files untouched.

HOW TO INSTALL
Extract hsml-v.zip into the port's root folder: the one holding bin\, or the exe itself when there is no bin\. That gives mfplat.dll, bin\mfplat.dll and hsml\hsml.dll; the mfplat.dll beside the exe loads, the other stays unused.

Updating from HSML 1.2 or older: first delete its dbghelp.dll and winmm.dll (root and bin\).

Then:
  • Mods: extract each into the root, giving mods\\hsml\.dll. Turn one off by renaming its folder to start with _.
  • Check: after a game start, hsml.log in the root lists each mod as running or why not. No hsml.log means HSML didn't load, so the zip is not in the root.
  • Update: extract the newer zip over the old one.
  • Uninstall: delete both mfplat.dll, hsml\ and the mods.

TECHNICALS
  1. Proxy: mfplat.dll in the root and in bin\. Every port imports Media Foundation, so Windows loads the proxy from beside the exe. It forwards all exports to System32\mfplat.dll and loads the core.
  2. Core: hsml\hsml.dll. Runs once per process. It reads the exe's f_ symbols (COFF symbol table, or .map with a matching timestamp), loads mods\\hsml\*.dll in folder-name order (folders starting with _ or - are skipped) and calls each mod's int HsmlInit(const HsmlApi*, const char* modDir). The API is in hsml.h: HostOf, Hook, HookHost, HostSym, Log, memory base, port name.
  3. Hooks: the first 5+ bytes of the function become a jmp to a relay near the exe; the moved instructions go to a trampoline, relocated by loader/x64len.hpp. Functions under 5 bytes, loop / jrcxz and branches back into the moved bytes are refused and logged. The last hook installed runs first and chains to the previous one.
  4. Mods: built with sdk/. A detour is u64 D(Ctx* c, ...) with the guest registers in c. HsmlModStart checks the memory layout and keeps the mod off on a mismatch.

Another Hookshot-derived port works if it keeps:
  • the f_ symbols (COFF table or .map)
  • the mfplat.dll import (otherwise the spare winmm / dbghelp proxies, built but not shipped)
  • the exe in the root or bin\
  • guest memory at 0x100000000000, main at 0x80020000
  • the register context (x0.. +0, lr +0xf0, sp +0xf8, v0.. +0x110)

Build with sh build.sh (msys2 ucrt64 g++) into out\. Offline hook test against a port's exe: sh build.sh test all. Release zip: python release/pack.py.

MORE FROM ME
241.7 KB
Log in or sign up to download
Uploaded by
Clausioporosis
Downloads
5
Comments
1
Views
40
First release
Last update
Platform
PC 
Version
1.3.0
Total Size
241.7 KB
Rating
0.00 star(s) 0 ratings

Uploaded by

  • 5
  • 40

Ratings

0.00 star(s) 0 ratings

Tags

There are no tags available.

More mods from Clausioporosis

  • PC Ragdoll Button

  • PC Immersive First Person

There are no comments to display.