Commit b65f659
committed
Update MAPI for Hollow Knight 1.5.12459 (Unity 6)
Hollow Knight received a major update on Feb 5, 2026 (build 12459) which
upgraded the engine to Unity 6 (6000.0.61f1) and introduced significant
changes to controller input handling, localization, and scene management.
This commit updates the Modding API to compile against and work correctly
with the new game binaries.
Build system changes (Assembly-CSharp.csproj):
- Use FrameworkPathOverride to resolve assemblies from Vanilla/ directory
instead of individual HintPath references (required for Unity 6 which
ships additional TeamCherry.* and System.* assemblies)
- Add System.Memory NuGet package (Unity 6 uses ReadOnlySpan<byte> in
Texture2D.LoadImage)
- Remove Newtonsoft.Json from dependencies (now shipped with the game)
- Remove mscorlib override (no longer needed with Unity 6 runtime)
Localization system rewrite:
- Delete Patches/Language.cs: The Language class moved from the global
namespace to TeamCherry.Localization in HK 1.5. The old MonoMod patch
targeting "global::Language.Language" no longer resolves.
- Add Language/Language.cs: A backwards-compatible shim in the
Language.Language namespace that delegates to TeamCherry.Localization
via reflection, with MonoModLinkFrom to redirect existing mod references.
This allows mods using Language.Language.Get() to continue working without
recompilation.
- Update ModHooks.cs LanguageGet to call Language.Language.GetInternal
instead of the removed Patches.Language.GetInternal.
Mod loading initialization (StartManager.cs):
- Move mod loading bootstrap from OnScreenDebugInfo.Awake to
StartManager.Awake. The OnScreenDebugInfo component was removed in
HK 1.5, so it can no longer serve as the mod loading entry point.
- Delete Patches/OnScreenDebugInfo.cs (component no longer exists in game).
- Rewrite StartManager.Start to match the new HK 1.5 startup sequence:
language verification, PlayerPrefs loading, and scene load state
management.
- Add deferred Menu_Title scene loading: when mod preloading is active,
wait for mods to finish loading before transitioning to Menu_Title
instead of using the allowSceneActivation pattern.
HeroController patches updated for HK 1.5 game logic:
- rb2d.velocity → rb2d.linearVelocity (Unity 6 Rigidbody2D API change)
- wallSlideVibrationPlayer.Stop() → vibrationCtrl.StopWallSlide()
(HK 1.5 replaced individual vibration players with HeroVibrationController)
- Attack(): Add grubberfly beam (charm_35) support for wall slashes,
change health check from == to >= for grubberfly beam activation on
normal/up/down attacks (matches upstream game logic)
- SoulGain(): String literals to nameof() for PlayerData fields
- LookForQueueInput(): Remove duplicate CanDash() call
- TakeDamage(): Rename flag → carefreeShouldStopDamage for clarity,
string literals to nameof(), add explicit returns after death/hazard
coroutine starts to match upstream flow control, fix ternary null check
on damage angle
- OrigDashVector(): Simplify ternary for bump velocity readability
InputHandler.OnGUI rewrite:
- Replace direct Cursor.visible/Cursor.lockState manipulation with calls
to the game's SetCursorVisible() method. This preserves the
OnCursorVisibilityChange event and proper cursor lock management through
SetCursorEnabled(), fixing controller detection and connection mode
switching that was broken by the old approach.
GameManager patches:
- Import TeamCherry.SharedUtils.Encryption (class moved in HK 1.5)
- Add SetPausedState() MonoModIgnore declaration
- Rewrite PauseToggleDynamicMenu to match HK 1.5 pause/unpause flow
(SetPausedState calls, reordered input prevention, reduced wait times)
- SceneManager.UnloadSceneAsync → SceneManager.UnloadScene (API change)
SceneManager patches:
- Replace DrawBlackBorders() full replacement with OnCameraAspectChanged()
hook. HK 1.5 refactored border drawing into the camera aspect change
handler with persistent border transforms (borderLeft/Right/Up/Down)
instead of instantiating new GameObjects each time.
- The ModHooks.OnDrawBlackBorders hook is preserved by collecting the
border transforms after orig_OnCameraAspectChanged runs.
Other patch updates:
- MenuSetting.cs: Add new HK 1.5 settings enum values (SwitchFrameCap,
Dithering, Noise, ControllerRumble, HudVisibility, CameraShake,
NativeInput, XInput, MFi)
- MenuButtonList.cs: Null-conditional on menuButtonLists to prevent
NullReferenceException during early UIManager initialization
- UIManager.cs: Add ADVANCED_GAMEPAD_MENU and ADVANCED_VIDEO_MENU to
MainMenuState enum
- TakeDamage.cs: Fix Multiplier ternary to match HK 1.5 operand order
- PlayMakerUnity2DProxy.cs: Add explicit this. qualifier
- ModHooks.cs: Add bounds checking on version string split to handle
version formats with fewer than 4 segments
Version: hollowknight.version updated to 1.5.12459
Tested on macOS (Apple M2 Pro) with Unity 6000.0.61f1:
- Game launches and reaches title screen
- Mod menu appears in Options with working mod list
- CompassAlwaysOn and GatheringSwarmAlwaysOn load and function correctly
- Controller support works (USB/Bluetooth, vibration, mode switching)
- Scene transitions, pause menu, and settings menus all functional
- No errors in Player.log or ModLog.txt
Builds on work started in PR hk-modding#164 by SFGrenade.
Closes hk-modding#169.1 parent 4f4ff66 commit b65f659
16 files changed
Lines changed: 363 additions & 285 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
20 | | - | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
75 | | - | |
| 77 | + | |
76 | 78 | | |
77 | | - | |
78 | | - | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| |||
141 | 142 | | |
142 | 143 | | |
143 | 144 | | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
203 | 156 | | |
204 | 157 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | | - | |
| 228 | + | |
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
196 | 197 | | |
197 | 198 | | |
198 | 199 | | |
199 | | - | |
200 | | - | |
201 | | - | |
| 200 | + | |
202 | 201 | | |
203 | 202 | | |
204 | 203 | | |
| |||
578 | 577 | | |
579 | 578 | | |
580 | 579 | | |
581 | | - | |
| 580 | + | |
582 | 581 | | |
583 | 582 | | |
584 | 583 | | |
585 | 584 | | |
586 | | - | |
| 585 | + | |
587 | 586 | | |
588 | 587 | | |
589 | 588 | | |
| |||
628 | 627 | | |
629 | 628 | | |
630 | 629 | | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
631 | 633 | | |
632 | 634 | | |
633 | 635 | | |
634 | | - | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
635 | 641 | | |
636 | | - | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
637 | 647 | | |
638 | | - | |
639 | | - | |
640 | | - | |
641 | | - | |
642 | | - | |
643 | | - | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
648 | | - | |
649 | | - | |
650 | | - | |
651 | | - | |
652 | | - | |
653 | | - | |
| 648 | + | |
654 | 649 | | |
655 | | - | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
656 | 664 | | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
668 | | - | |
669 | | - | |
670 | | - | |
671 | | - | |
| 665 | + | |
672 | 666 | | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
673 | 670 | | |
674 | 671 | | |
675 | 672 | | |
| |||
0 commit comments