Skip to content

feat: port KiouEditor sites to 1.0.2 + migrate AFK to CAVE_ENTRY - #7

Merged
tkgstrator merged 3 commits into
mainfrom
feat/1.0.2-kioueditor-sites
Jul 1, 2026
Merged

feat: port KiouEditor sites to 1.0.2 + migrate AFK to CAVE_ENTRY#7
tkgstrator merged 3 commits into
mainfrom
feat/1.0.2-kioueditor-sites

Conversation

@tkgstrator

@tkgstrator tkgstrator commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Two related deliveries bundled together so 1.0.2 chinlan builds route every hookable site through the same CAVE_ENTRY path (no more AFK_SITE special case):

  1. Port the 17 KiouEditor hook sites to recipes/v1_0_2.py — RVAs verified against assets/1.0.2/dump.cs, prologues extracted from assets/1.0.2/Kiou-1.0.2.ipa.
  2. Migrate GameOrchestrator.IsAfkEnabled from the historic AFK_SITE inline patch to a CAVE_ENTRY, matching v1_0_1's shape, and ship KIOUAfkDisableAlwaysFalseInstall(unityBase) so consumers that just want the "AFK is always off" behaviour can wire the slot with one call.

Sites ported to 1.0.2

0x5C3C29C  SyncItemListReply.InternalMergeFrom
0x5C458C4  UpdateCollectionPresetReply.InternalMergeFrom
0x5CACEF8  GameServiceClient.SelectCharacterAsync
0x5C2C034  SelectCharacterReply.InternalMergeFrom
0x5B51C3C  ShogiMatchingPlayerStatus.InternalMergeFrom
0x5C06590  GetShogiHistoryDetailListReply.InternalMergeFrom
0x5C05FF0  GetShogiHistoryDetailListReply.get_IsPremiumUser
0x585E000  KifuDetailModel.IsPremiumUser
0x582E614  CharacterVoicePlayer.SatisfiesRule
0x584DB64  CharacterVoiceScrollerCellModel.get_IsLocked
0x597E608  BeginnerSupportEvaluator.ctor
0x5980890  BeginnerSupportEvaluator.EnsureInitializedLocked
0x5942AA0  ResolvedBeginnerSupport.get_Enabled
0x5942AC0  ResolvedBeginnerSupport.get_Depth
0x5AA4054  HomeUtilityPresenter.ctor
0x5DD7F54  UIButtonBase.OnPointerClick
0x5DD2874  TitleScene+<OnActivateAsync>d__10.MoveNext
0x594A034  GameOrchestrator.IsAfkEnabled   ← migrated from inline

KIOUAfkDisableAlwaysFalseInstall

Drop-in replacement for the retired AFK_SITE inline patch. Publishes a static return false hook body into the AFK cave slot. One call from a consumer's Tweak.m restores the historic "AFK is always off" behaviour without pulling in the KIOUEditor feature-flag surface. The feature-flag-gated variant (KIOUEditorInstallAfkDisableHook in Hook/AfkDisable.m) is unchanged for consumers that want a runtime toggle.

🚨 Coordinated rollout required

Once this merges, any consumer that chinlan-patches with the updated recipe gets the AFK cave inserted. Consumers MUST publish the AFK cave slot before their patched IPA runs, or the first IsAfkEnabled call BLR-jumps to a null slot pointer and crashes.

KiouForge needs a companion change: call KIOUAfkDisableAlwaysFalseInstall(unityBase) from Tweak.m and bump its vendor/KIOU-Hook submodule pointer to this PR's merge commit. That PR will land in the same window as this one.

Verification

  • python -m tools.check_recipesHOOK_IDS=34 ENTRY_SLOT_INDEX=29 sites=61
  • TARGET_VERSION=1.0.2 python -m tools.verify_sites ... --ipa Kiou-1.0.2.ipa → 33/34 rows pass (only the pre-existing Project.Network.HeaderProvider.SetOrUpdateHeader dump-index lookup miss remains, unrelated to this PR)
  • ruff check recipes/ tools/ → clean

Also in this PR

  • Drops tools/__init__.py — PEP-420 namespace packages let python -m tools.check_recipes resolve without it, and its presence shadowed the sibling shared/tools/ package on consumer builds.
  • KIOU-Hook CI (commitlint + ruff + pyright + recipe consistency) will run once this PR opens.

Not addressed (follow-up)

  • C-side catalog RVAs for the KiouEditor sites in KIOUHook.h / KIOUHook.m are still pinned to 1.0.1 (via the KIOU_HOOK_RVA_* macros). On chinlan this is inert — the dispatcher's g_inject_entry table drives dispatch, not the catalog RVAs. Direct-ABI callouts from Hook/AssistTune.m and Hook/FriendUnhide.m (SetHashSize / GameObject.GetComponent / RectTransformUtility.WorldToScreenPoint) will still land at 1.0.1 addresses on a 1.0.2 build until a follow-up PR adds -DKIOU_TARGET_BUILD=12 compile-time selection.

🤖 Generated with Claude Code

tkgstrator and others added 2 commits July 1, 2026 11:14
Adds the 17 non-AFK KiouEditor hook sites to recipes/v1_0_2.py so a
KiouEditor build targeting KIOU 1.0.2 can chinlan-patch them
alongside the existing KiouForge base + kifu observer + HeaderProvider
entries.

RVAs verified against assets/1.0.2/dump.cs on 2026-07-01; prologue
bytes captured from assets/1.0.2/Kiou-1.0.2.ipa UnityFramework. Ran
python -m tools.verify_sites --recipe recipes --index
assets/1.0.2/dump.cs.index.json --ipa assets/1.0.2/Kiou-1.0.2.ipa:
32 / 33 sites pass (the pre-existing HeaderProvider verification
skip is unrelated — index-lookup misses the fully-qualified type
name).

  0x5C3C29C  SyncItemListReply.InternalMergeFrom
  0x5C458C4  UpdateCollectionPresetReply.InternalMergeFrom
  0x5CACEF8  GameServiceClient.SelectCharacterAsync
  0x5C2C034  SelectCharacterReply.InternalMergeFrom
  0x5B51C3C  ShogiMatchingPlayerStatus.InternalMergeFrom
  0x5C06590  GetShogiHistoryDetailListReply.InternalMergeFrom
  0x5C05FF0  GetShogiHistoryDetailListReply.get_IsPremiumUser
  0x585E000  KifuDetailModel.IsPremiumUser
  0x582E614  CharacterVoicePlayer.SatisfiesRule
  0x584DB64  CharacterVoiceScrollerCellModel.get_IsLocked
  0x597E608  BeginnerSupportEvaluator.ctor
  0x5980890  BeginnerSupportEvaluator.EnsureInitializedLocked
  0x5942AA0  ResolvedBeginnerSupport.get_Enabled
  0x5942AC0  ResolvedBeginnerSupport.get_Depth
  0x5AA4054  HomeUtilityPresenter.ctor
  0x5DD7F54  UIButtonBase.OnPointerClick
  0x5DD2874  TitleScene+<OnActivateAsync>d__10.MoveNext

GAME_ORCHESTRATOR_IS_AFK is intentionally NOT ported to a CAVE_ENTRY
on 1.0.2. KiouForge's build already patches that site inline via
AFK_SITE / AFK_ORIG_8 to force IsAfkEnabled -> false, and a KiouEditor
1.0.2 build that wants feature-flag-gated AFK toggling would crash on
first call unless KiouForge simultaneously publishes the cave slot
(BLR to null slot pointer). Migrating 1.0.2 AFK to a cave will land
in a follow-up PR that coordinates with a KiouForge update.

Also drops tools/__init__.py — PEP-420 namespace packages let
python -m tools.check_recipes resolve without it, and its presence
was shadowing the sibling shared/tools/ package on consumer builds.
Verified: python -m tools.check_recipes still passes locally
(HOOK_IDS=34 ENTRY_SLOT_INDEX=29 sites=60).

Not addressed in this PR:
  - C-side catalog RVAs for the KiouEditor sites in KIOUHook.h /
    KIOUHook.m are still pinned to 1.0.1 (via the KIOU_HOOK_RVA_*
    macros). On chinlan builds this is inert (the dispatcher's
    g_inject_entry table drives hook dispatch, not the catalog
    RVAs), so the recipe port here is sufficient for the primary
    consumer (KiouEditor chinlan). Direct-ABI callouts from
    Hook/AssistTune.m and Hook/FriendUnhide.m (SetHashSize /
    GameObject.GetComponent / RectTransformUtility.WorldToScreenPoint)
    WILL land at wrong addresses on a 1.0.2 build until the catalog
    gains version-aware dispatch — track that as a follow-up.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Retires the AFK_SITE inline patch on 1.0.2 in favour of a CAVE_ENTRY
so both 1.0.1 and 1.0.2 route GameOrchestrator.IsAfkEnabled through
the same hook-body path.

Recipe changes (recipes/v1_0_2.py):
  - AFK_SITE / AFK_ORIG_8 -> None / "" (drops the inline
    `MOVZ W0, #0; RET` patch)
  - GAME_ORCHESTRATOR_IS_AFK row added to SITES (CAVE_ENTRY at
    0x594A034, prologue f44fbea9)

To keep the "AFK is always off" behaviour KiouForge relied on
without pulling in the KIOUEditor feature-flag surface, KIOU-Hook
now exposes a thin convenience installer:

  void KIOUAfkDisableAlwaysFalseInstall(uintptr_t unityBase);

It publishes a static `return false` hook body into the cave's
entry slot. One call from a consumer's Tweak.m is enough to
restore the historic behaviour. The feature-flag-gated variant
(KIOUEditorInstallAfkDisableHook in Hook/AfkDisable.m) is
unchanged.

**Coordinated rollout required.** Once this lands on main, any
consumer that chinlan-patches with the updated recipe will get
the AFK cave inserted. Consumers MUST publish the AFK cave slot
before their patched IPA runs, or the first IsAfkEnabled call
BLR-jumps to a null slot pointer and crashes. KiouForge's
companion change (call `KIOUAfkDisableAlwaysFalseInstall` from
its Tweak.m + submodule bump) is expected to land in the same
window as this PR.

Verified with:
  python -m tools.check_recipes  ->  61 sites (was 60)
  TARGET_VERSION=1.0.2 python -m tools.verify_sites ... ->
    33/34 rows pass (the pre-existing HeaderProvider miss is the
    lone FAIL, unrelated).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@tkgstrator tkgstrator changed the title feat(recipes): port KiouEditor sites to 1.0.2 feat: port KiouEditor sites to 1.0.2 + migrate AFK to CAVE_ENTRY Jul 1, 2026
@tkgstrator
tkgstrator merged commit 2ef91df into main Jul 1, 2026
4 checks passed
@tkgstrator
tkgstrator deleted the feat/1.0.2-kioueditor-sites branch July 1, 2026 16:32
tkgstrator added a commit that referenced this pull request Jul 27, 2026
feat: port KiouEditor sites to 1.0.2 + migrate AFK to CAVE_ENTRY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant