From 322c25fa81631ed0d75928fbf7e8c490624b71fe Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Fri, 2 Oct 2026 01:53:43 +0000 Subject: [PATCH 01/10] match(iplSDChannelTitle 64/69, NHTTP_recvbuf 6/7) (worker c82a056b) --- libs/RevoEX/src/nhttp/NHTTP_recvbuf.c | 103 +++++++++--------- .../sdChannelTitle/iplSDChannelTitle.cpp | 6 +- 2 files changed, 56 insertions(+), 53 deletions(-) diff --git a/libs/RevoEX/src/nhttp/NHTTP_recvbuf.c b/libs/RevoEX/src/nhttp/NHTTP_recvbuf.c index decbea91..bd906a85 100644 --- a/libs/RevoEX/src/nhttp/NHTTP_recvbuf.c +++ b/libs/RevoEX/src/nhttp/NHTTP_recvbuf.c @@ -13,7 +13,7 @@ static void FindHeaderBlock(const NHTTPResponseInfo* response, s32 position, NHT } } -static s8 ReadHeaderChar(const NHTTPResponseInfo* response, NHTTPi_HDRBUFLIST** block, s32* offset) { +static int ReadHeaderChar(const NHTTPResponseInfo* response, NHTTPi_HDRBUFLIST** block, s32* offset) { if(!*block) { if(*offset<1024) return (s8)response->hdrBufFirst[(*offset)++]; *block=response->hdrBufBlock_p; @@ -30,30 +30,31 @@ static int LowerCase(int character) { s32 NHTTPi_findNextLineHdrRecvBuf(const NHTTPResponseInfo* response, s32 position, s32 limit, s32* colon, s32* newlineLength) { NHTTPi_HDRBUFLIST* block; s32 offset; - s32 next=-1; - BOOL carriage=FALSE; if(colon) *colon=-1; - if(position>=limit) return -1; - FindHeaderBlock(response,position,&block,&offset); - for(; position=limit) return -1; - FindHeaderBlock(response,position,&block,&offset); - for(; positionresponse->headerLen) return FALSE; - if(length) { - if(position<1024) { - amount=length; - if(length>1024-position) amount=1024-position; - NHTTPi_memcpy(destination,response->hdrBufFirst+position,amount); - position+=amount; length-=amount; destination+=amount; - } + if (position + length <= response->headerLen) { if(length) { - s32 blocks; - position-=1024; - block=response->hdrBufBlock_p; - blocks=position>>9; - position&=511; - while(blocks--) block=block->next_p; - while(length) { + if(position<1024) { amount=length; - if(length>512-position) amount=512-position; - NHTTPi_memcpy(destination,block->block+position,amount); - position=(position+amount)&511; - block=block->next_p; - length-=amount; destination+=amount; + if(length>1024-position) amount=1024-position; + NHTTPi_memcpy(destination,response->hdrBufFirst+position,amount); + position+=amount; length-=amount; destination+=amount; + } + if(length) { + s32 blocks; + position-=1024; + block=response->hdrBufBlock_p; + blocks=position>>9; + position&=511; + while(blocks--) block=block->next_p; + while(length) { + amount=length; + if(length>512-position) amount=512-position; + NHTTPi_memcpy(destination,block->block+position,amount); + position+=amount; + position&=511; + block=block->next_p; + length-=amount; destination+=amount; + } } } + return TRUE; } - return TRUE; + return FALSE; } BOOL NHTTPi_isRecvBufFull(NHTTPResponseInfo* response, u32 length) { return length>=response->recvBufLen; } diff --git a/src/scene/sdChannelTitle/iplSDChannelTitle.cpp b/src/scene/sdChannelTitle/iplSDChannelTitle.cpp index 1b7bf210..f416f08c 100644 --- a/src/scene/sdChannelTitle/iplSDChannelTitle.cpp +++ b/src/scene/sdChannelTitle/iplSDChannelTitle.cpp @@ -225,8 +225,7 @@ void SDChannelTitle::create() { comment->SetString(System::getMessage(0xad)); iplSDChannelTitle_rebuildBannerLayout(this); mpFade = new math::HermiteIntp(); - static f32 fadeRange[2] = {0.0f, 255.0f}; - mpFade->init(fadeRange[0], fadeRange[1], 28.0f, 0.0f, 0.0f); + mpFade->init(0.0f, 255.0f, 28.0f, 0.0f, 0.0f); mpFade->setAnmType(ANIM_TYPE_FORWARD); mpScreenCapture = new (System::getTreasureHeap(), 32) utility::Capture(System::getTreasureHeap(), 0, 0, System::getRenderModeObj()->fbWidth, System::getRenderModeObj()->efbHeight, GX_TF_RGB565); @@ -1016,8 +1015,7 @@ extern "C" void iplSDChannelTitle_preparePageRestart(SDChannelTitle* scene) { if (!scene->mScriptEnabled || scene->mScriptState == 4) { if (scene->mpChannelSelect->prepareRestarting(scene->mPage)) { scene->mpChannelSelect->startPageTransition(scene->mPage, scene->mIndex); - static f32 fadeRange[2] = {0.0f, 255.0f}; - scene->mpFade->init(fadeRange[0], fadeRange[1], 28.0f, 0.0f, 0.0f); + scene->mpFade->init(0.0f, 255.0f, 28.0f, 0.0f, 0.0f); scene->mpFade->setAnmType(ANIM_TYPE_BACKWARD); scene->mpFade->play(); scene->mState = 6; -- 2.49.1 From 4ed63ff786b407e8b5da5ea26fec4b41f9e2c181 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Thu, 1 Oct 2026 20:54:55 -0500 Subject: [PATCH 02/10] match(tiHKBManager): key validity (worker 4e3e9738) (#712) --- src/keyboard/tiHKBManager.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/keyboard/tiHKBManager.cpp b/src/keyboard/tiHKBManager.cpp index 8d35fd5b..53d628ca 100644 --- a/src/keyboard/tiHKBManager.cpp +++ b/src/keyboard/tiHKBManager.cpp @@ -497,7 +497,23 @@ u32 HKBManager::KeySet::GetVCode() const { } u32 HKBManager::KeySet::IsValid() const { - return CheckValidity(); + s8 keyIndex; + u32 keyDevice; + const HKBManager* owner; + + owner = manager; + if (!owner) return false; + keyIndex = index; + if (keyIndex < 0 || keyIndex >= 8) return false; + keyDevice = device; + if (keyDevice >= 2) return false; + switch (type) { + case 0: return (owner->states[keyDevice].held & (1 << keyIndex)) != 0; + case 1: return (owner->states[keyDevice].triggered & (1 << keyIndex)) != 0; + case 2: return (owner->states[keyDevice].released & (1 << keyIndex)) != 0; + case 3: return (owner->states[keyDevice].repeated & (1 << keyIndex)) != 0; + } + return false; } HKBManager::KeySet HKBManager::KeySet::GetNext() const { -- 2.49.1 From 3dcd7234599d4199f94a75e95fdd9ffd932d2fe8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 2 Oct 2026 01:55:54 +0000 Subject: [PATCH 03/10] docs: update progress [skip ci] --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 94ef7669..0aa80c3a 100644 --- a/README.md +++ b/README.md @@ -53,9 +53,9 @@ Progress | Decompiled | Matched | Linked | Data | |:---:|:---:|:---:|:---:| -| 99.39% | 88.25% | 62.52% | 92.12% | +| 99.39% | 88.26% | 62.52% | 92.12% | -units 921/1027 complete, functions 12243/12563 matched. +units 921/1027 complete, functions 12244/12563 matched. decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, linked = code actually linked into the DOL, data = byte-exact data -- 2.49.1 From 618e713b536797daa9c9afe1ec7c4d3cafaf9c79 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Thu, 1 Oct 2026 20:56:59 -0500 Subject: [PATCH 04/10] docs(agents): describe the Claude orchestrator / Codex worker loop (#711) Effort scale, silent mode for workers, gate and landing rules, the PR review daemon and auto-merge conditions, single-orchestrator rule, and the policy additions (no retail .s linking, definition-level volatile). --- AGENTS.md | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 114 insertions(+), 3 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 85a74cd1..4b9dd10f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -164,9 +164,8 @@ This repository targets only Wii Menu 4.3U. Do not configure or build 43E, 43J, or 43K while doing matching work. Most workers should pursue exact matching or safe linking; assign the remainder -to decompilation. Keep up to 75 live workers when the runtime allows it, while -reserving capacity for fixer and validation workers. Fill completed slots with -disjoint tasks. Never duplicate a source file or function +to decompilation. Keep every worker slot busy (currently four Codex slots; see +"Orchestrator loop" below). Fill completed slots with disjoint tasks. Never duplicate a source file or function range. Workers return changed paths, exact objdiff measurements, and validation results. Fuzzy-only results are not accepted. @@ -246,6 +245,12 @@ and merge the PR, fast-forward `origin/main`, and publish progress. If a candidate fails validation, return it to its worker; do not fix the candidate inline in the orchestrator. +Two exceptions, both set by the human: once a leaf has failed at `max` effort +(see the effort scale below) the orchestrator itself takes a crack at it, and +the orchestrator may finish PRs whose authors are gone (rebase, drop a +forbidden pattern, close with evidence). Record every such attempt in the +policy log, including the ones that fail. + A new thread must begin by reading this file, checking the live 43U report and remote branch, and dispatching the worker pool. The parent must not claim a match without fresh independent verification. @@ -320,6 +325,112 @@ Linked: | Fuzzy: | Data: Do not report stale values, unmerged PR results, or add other text to that update. Continue all required verification and coordination silently. +## Orchestrator loop (Claude orchestrator, Codex workers) + +This is the loop currently in use. One Claude session is the orchestrator. +It does not spawn Claude subagents. All decompilation work goes to Codex CLI +workers running `gpt-6.1-sol`. The orchestrator assigns leaves, verifies, +lands, reviews outside PRs, and only decompiles by hand in the cases listed +under the ownership boundary above. + +Only one orchestrator session may run at a time. If a second session resumes +the same thread (for example, the same session opened in two windows), close +one of them. Two orchestrators double-merge PRs and fight over the shared +build tree. + +### Worker slots and the effort scale + +Run four worker slots, each in its own worktree on a fresh branch from +`origin/main`. Every slot gets a disjoint set of three or four leaves (units), +closest-to-matching first. A slot starts at `medium` (or `low`) reasoning +effort and escalates only when a round produces no new exact function: + +``` +low/medium -> high -> xhigh -> max -> orchestrator attempt -> parked +``` + +A round that gains at least one exact function is landed, and the remaining +functions go out again at the same effort or one step up. A set that fails at +`max` goes to the orchestrator. If the orchestrator also fails, the function +is parked as a compiler tie-break with its evidence. Fill freed slots from the +live checklist right away; never leave a slot idle. + +Before starting a function, a worker fetches `origin/main` and checks it is +not already matched. Outside contributors land work in parallel, and +duplicated matches waste a round. + +### Silent mode for workers + +Workers run unattended and must not talk. Every turn is tool calls only: no +plans, no progress notes, no summaries. Progress goes into an attempts log +file in `tools/decomp-assist/`. The only text message in a run is the final +report, at most 8-15 short lines: + +- exact functions per unit, before and after; +- the final `GATE` line; +- commit hashes; +- a link to the attempts log. + +Runs are audited for text messages, and any chatter is a contract +violation. Workers also must not push, open PRs, merge, rebase, touch other +worktrees, or spawn subagents. + +Each worker prompt has this layout: + +1. the `` block (leaves, current exact counts, method, report format); +2. the shared `common.md` block with ``, ``, + `` and ``. + +Resume a stalled worker on the same session with the failure evidence. Don't +replace it with a fresh one. + +### Gate, landing and review + +- `gate.py ` is the acceptance check for workers and for outside + PRs. It covers: + - a full 4.3U build and the DOL SHA1; + - per-unit objdiff and instruction-exact counts; + - regressions against a baseline report of `origin/main`; + - a net forbidden-pattern scan and a readability scan (auto-named + identifiers, raw `*(T*)(p + N)` offset casts). +- A function that disappears because it was renamed is not a regression, + unless the unit's exact count, code or data also drops. +- Landing a worker result builds a branch from `origin/main` with the + worker's diff, gates it, pushes it, then opens and squash-merges a PR on + the fork. After that it regenerates the checklist. +- Never run two full builds in the same build tree at once. +- Never land while the review queue is building. Both use the same + verification worktree. + +Outside PRs are reviewed by a daemon. It re-runs the gate on any open PR +whose head commit changed since its last review. A PR is merged +automatically only when all of these hold: + +- the PR rebases cleanly; +- the full build passes; +- the DOL hash matches; +- the gate passes, or its only failures are renamed-away functions; +- the diff adds no forbidden pattern and no `.s` file. + +Everything else is reviewed by hand: + +- **Conflicts:** comment asking for a rebase. +- **Forbidden patterns:** request changes with a concrete honest + alternative. +- **"Linking" by swapping in retail assembly or pinned labels:** close and + explain. +- **Proven split/ownership corrections** (relocation evidence, total data + unchanged): merge even if one unit's numbers move to its neighbour. + +Policy additions learned in this loop: + +- Linking a unit by building the retail `.s` instead of its C/C++ is + forbidden. "Linked" means the C/C++ itself compiles to the exact bytes. +- Definition-level `volatile` (on the field or object declaration) is allowed + when the target proves it, e.g. back-to-back reloads with no store in + between. Check that it changes no other function in the units that use it. + Use-site volatile casts and the `register` keyword stay forbidden. + ## Goal completion contract The decompilation loop does not stop after a successful wave, a convenient -- 2.49.1 From 4a7353ec731f9f4b95175e0c3e8eaee44e45c4d0 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Thu, 1 Oct 2026 20:57:25 -0500 Subject: [PATCH 05/10] Restore sound globals and link iplSound (#713) --- configure.py | 2 +- include/sound/iplSound.h | 2 +- src/sound/iplSound.cpp | 386 ++++++++++++++++++--------------------- 3 files changed, 182 insertions(+), 208 deletions(-) diff --git a/configure.py b/configure.py index cdd8fa41..27004011 100644 --- a/configure.py +++ b/configure.py @@ -689,7 +689,7 @@ config.libs = [ ] ), IPLSection("sound", [ - Object(NonMatching, "sound/iplSound.cpp"), + Object(Matching, "sound/iplSound.cpp"), ] ), IPLSection("iplwww", [ diff --git a/include/sound/iplSound.h b/include/sound/iplSound.h index ef520961..f9c5a265 100644 --- a/include/sound/iplSound.h +++ b/include/sound/iplSound.h @@ -99,7 +99,7 @@ namespace ipl { long clipGELT_S32(long value, long lo, long hi); private: - u32 unk_0x620[0x18]; + u32 unk_0x620[3]; }; // use getSystem() and getBannerPlayer() instead diff --git a/src/sound/iplSound.cpp b/src/sound/iplSound.cpp index d1cb66f0..e670e31f 100644 --- a/src/sound/iplSound.cpp +++ b/src/sound/iplSound.cpp @@ -10,13 +10,6 @@ #undef IPL_SOUND_RECT_OUT_OF_LINE #undef AutoLock -extern "C" void __ct__Q23EGG20SimpleAudioMgrWithFxFv(); -extern "C" void __dt__Q34nw4r3snd11SoundHandleFv(); -extern "C" void __dl__FPv(); -extern "C" { - void __destroy_arr(); - void __dt__Q33ipl3snd10tagSSeInfoFv(); -} extern "C" void _seBlk__Q23ipl3snd(); extern "C" nw4r::snd::SoundHandle* _mainBGMHandle__Q23ipl3snd; extern "C" const f32 scSoundZeroF; @@ -24,19 +17,9 @@ extern "C" const f32 scSoundOneF; extern "C" const f32 scSoundTwoF; extern "C" const f32 scSoundThirtyF; extern "C" const f32 scSoundSixtyF; -extern "C" { - void _savegpr_29(); - void pauseOffSE__Q33ipl3snd6SystemFv(); - void pauseOnSE__Q33ipl3snd6SystemFv(); -} -extern "C" void _restgpr_29(); -extern "C" void _savegpr_24(); -extern "C" void _restgpr_24(); extern "C" void _savegpr_26(); extern "C" void _restgpr_26(); extern "C" void sBannerSoundPlayer__Q23ipl3snd(); -extern "C" void pause__17BannerSoundPlayerFb(); -extern "C" void initFx__Q33ipl3snd6SystemFv(); extern "C" void GetInstance__Q44nw4r3snd6detail9AxManagerFv(); extern "C" void ClearEffect__Q44nw4r3snd6detail9AxManagerFQ34nw4r3snd6AuxBusi(); extern "C" void stop__17BannerSoundPlayerFUl(); @@ -45,9 +28,8 @@ extern "C" void SetMasterVolume__Q44nw4r3snd6detail9AxManagerFfi(); namespace ipl { namespace snd { - extern "C" void __vt__Q33ipl3snd6System(); - System::System() { + inline System::System() { } struct tagSSeInfo { @@ -59,39 +41,30 @@ namespace ipl { u32 id; }; - tagSSeInfo::tagSSeInfo() { + inline tagSSeInfo::tagSSeInfo() { } - BOOL m_isLocked; struct tagSBgmInfo { nw4r::snd::SoundHandle handle; tagSBgmInfo(); ~tagSBgmInfo(); }; - tagSBgmInfo::tagSBgmInfo() { + inline tagSBgmInfo::tagSBgmInfo() { } - tagSSeInfo::~tagSSeInfo() { + inline tagSSeInfo::~tagSSeInfo() { } - tagSBgmInfo::~tagSBgmInfo() { + inline tagSBgmInfo::~tagSBgmInfo() { } - extern nw4r::snd::SoundHandle _bgmBlk; - extern tagSSeInfo _seBlk[16]; - extern nw4r::snd::SoundHandle* _mainBGMHandle; - - extern "C" asm void __dt__Q33ipl3snd6UnkClsFv() { - nofralloc - lis r3, _seBlk__Q23ipl3snd@ha - lis r4, __dt__Q33ipl3snd10tagSSeInfoFv@ha - addi r3, r3, _seBlk__Q23ipl3snd@l - li r5, 0xc - addi r4, r4, __dt__Q33ipl3snd10tagSSeInfoFv@l - li r6, 0x10 - b __destroy_arr - } + tagSSeInfo _seBlk[16]; + tagSBgmInfo _bgmBlk; + System sSystem; + BannerSoundPlayer sBannerSoundPlayer; + nw4r::snd::SoundHandle* _mainBGMHandle; + BOOL m_isLocked; static const nw4r::snd::FxReverbHi::ReverbHiParam reverbHiParam = { 0.0f, @@ -102,148 +75,6 @@ namespace ipl { 1.0f, }; - void System::stopBGM(int frames) { - if (_mainBGMHandle && _mainBGMHandle->IsAttachedSound()) { - _mainBGMHandle->Stop(frames); - } - } - - void System::muteOnBGM(int frames) { - nw4r::snd::SoundHandle* handle = _mainBGMHandle; - if (handle && handle->IsAttachedSound()) handle->SetVolume(0.0f, frames); - } - - void System::muteOffBGM(int frames) { - nw4r::snd::SoundHandle* handle = _mainBGMHandle; - if (handle && handle->IsAttachedSound()) handle->SetVolume(1.0f, frames); - } - - void System::pauseOnSE() { - for (int index = 0; index < 16; ++index) { - if (_seBlk[index].handle.IsAttachedSound()) { - _seBlk[index].handle.Pause(true, 5); - } - } - } - - void System::pauseOffSE() { - for (int index = 0; index < 16; ++index) { - if (_seBlk[index].handle.IsAttachedSound()) { - _seBlk[index].handle.Pause(false, 5); - } - } - } - - void System::pauseOnBGM() { - if (_mainBGMHandle) { - if (_mainBGMHandle->IsAttachedSound()) _mainBGMHandle->Pause(true, 5); - pauseOnSE(); - sBannerSoundPlayer.pause(true); - nw4r::snd::detail::AxManager::GetInstance().ClearEffect(nw4r::snd::AUX_A, 250); - nw4r::snd::detail::AxManager::GetInstance().ClearEffect(nw4r::snd::AUX_B, 250); - nw4r::snd::detail::AxManager::GetInstance().ClearEffect(nw4r::snd::AUX_C, 250); - } - } - - void System::pauseOffBGM() { - if (_mainBGMHandle) { - initFx(); - if (_mainBGMHandle->IsAttachedSound()) _mainBGMHandle->Pause(false, 5); - pauseOffSE(); - sBannerSoundPlayer.pause(false); - } - } - - void System::stopSE(nw4r::snd::SoundHandle* handle, int frames) { - tagSSeInfo* block; - int i; - if (handle != NULL && handle->IsAttachedSound()) { - for (i = 0; i < 16; i++) { - block = &_seBlk[i]; - if (handle == &block->handle) { - block->handle.Stop(frames); - block->name = NULL; - block->id = 0xFFFF; - } - } - } - } - - extern "C" asm void resetAllSound__Q33ipl3snd6SystemFv() { - nofralloc - stwu r1, -0x20(r1) - mflr r0 - stw r0, 0x24(r1) - addi r11, r1, 0x20 - bl _savegpr_26 - li r26, 0 - lis r28, _seBlk__Q23ipl3snd@ha - lis r3, 1 - li r31, 0 - mr r29, r26 - addi r28, r28, _seBlk__Q23ipl3snd@l - subi r30, r3, 1 - resetAllSound_loop: - lwzx r3, r28, r31 - add r27, r28, r31 - cmpwi r3, 0 - beq resetAllSound_clear - lwz r12, 0(r3) - li r4, 0 - lwz r12, 0x18(r12) - mtctr r12 - bctrl - resetAllSound_clear: - stw r29, 0x4(r27) - addi r26, r26, 1 - cmpwi r26, 0x10 - addi r31, r31, 0xc - stw r30, 0x8(r27) - blt resetAllSound_loop - lwz r3, _mainBGMHandle__Q23ipl3snd - cmpwi r3, 0 - beq resetAllSound_banner - lwz r0, 0(r3) - cmpwi r0, 0 - beq resetAllSound_banner - lwz r3, 0(r3) - li r4, 0 - lwz r12, 0(r3) - lwz r12, 0x18(r12) - mtctr r12 - bctrl - resetAllSound_banner: - lis r31, sBannerSoundPlayer__Q23ipl3snd@ha - li r4, 0 - addi r3, r31, sBannerSoundPlayer__Q23ipl3snd@l - bl stop__17BannerSoundPlayerFUl - bl GetInstance__Q44nw4r3snd6detail9AxManagerFv - li r4, 0 - li r5, 0 - bl ClearEffect__Q44nw4r3snd6detail9AxManagerFQ34nw4r3snd6AuxBusi - bl GetInstance__Q44nw4r3snd6detail9AxManagerFv - li r4, 1 - li r5, 0 - bl ClearEffect__Q44nw4r3snd6detail9AxManagerFQ34nw4r3snd6AuxBusi - bl GetInstance__Q44nw4r3snd6detail9AxManagerFv - li r4, 2 - li r5, 0 - bl ClearEffect__Q44nw4r3snd6detail9AxManagerFQ34nw4r3snd6AuxBusi - bl GetInstance__Q44nw4r3snd6detail9AxManagerFv - lfs f1, scSoundZeroF - li r4, 0 - bl SetMasterVolume__Q44nw4r3snd6detail9AxManagerFfi - lfs f1, scSoundZeroF - addi r3, r31, sBannerSoundPlayer__Q23ipl3snd@l - bl setMasterVolume__17BannerSoundPlayerFf - addi r11, r1, 0x20 - bl _restgpr_26 - lwz r0, 0x24(r1) - mtlr r0 - addi r1, r1, 0x20 - blr - } - void System::shutup(BOOL shutUpDMA) { if (m_isLocked == shutUpDMA) { return; @@ -280,32 +111,10 @@ namespace ipl { sBannerSoundPlayer.setMasterVolume(0.9f); } - extern "C" const f32 scSoundZeroF = 0.0f; - - void System::stopBannerSound(int unk) { - sBannerSoundPlayer.stop(unk); - } - - BOOL System::checkTmpSoundFile(void* data, u32 size) { - return sBannerSoundPlayer.checkData(data, size, false); - } - void System::initFx() { setFxReverbHi(nw4r::snd::AUX_A, &reverbHiParam); } -#pragma force_active on - - } -} -namespace nw4r { -namespace snd { -SoundHandle::SoundHandle() : mSound(NULL) {} -} -} -namespace ipl { -namespace snd { - void System::calc() { EGG::SimpleAudioMgr::calc(); sBannerSoundPlayer.calc(); @@ -316,9 +125,9 @@ namespace snd { return NULL; } - EGG::ArcPlayer::startSound(&_bgmBlk, bgmName); - _mainBGMHandle = &_bgmBlk; - return &_bgmBlk; + EGG::ArcPlayer::startSound(&_bgmBlk.handle, bgmName); + _mainBGMHandle = &_bgmBlk.handle; + return &_bgmBlk.handle; } nw4r::snd::SoundHandle* System::startSE(const char* sndName) { @@ -387,7 +196,7 @@ namespace snd { } block->handle.Stop(0); - mSoundArchivePlayer.StartSound(&block->handle, sndIndex); + EGG::ArcPlayer::startSound(&block->handle, sndIndex); block->id = sndIndex; return (int)block; } @@ -485,6 +294,27 @@ namespace snd { return (int)block; } + void System::stopBGM(int frames) { + if (_mainBGMHandle && _mainBGMHandle->IsAttachedSound()) { + _mainBGMHandle->Stop(frames); + } + } + + void System::stopSE(nw4r::snd::SoundHandle* handle, int frames) { + tagSSeInfo* block; + int i; + if (handle != NULL && handle->IsAttachedSound()) { + for (i = 0; i < 16; i++) { + block = &_seBlk[i]; + if (handle == &block->handle) { + block->handle.Stop(frames); + block->name = NULL; + block->id = 0xFFFF; + } + } + } + } + void System::stopAllSound(int unk) { int frame; tagSSeInfo* block; @@ -508,6 +338,137 @@ namespace snd { nw4r::snd::detail::AxManager::GetInstance().ClearEffect(nw4r::snd::AUX_C, frame); } + extern "C" asm void resetAllSound__Q33ipl3snd6SystemFv() { + nofralloc + stwu r1, -0x20(r1) + mflr r0 + stw r0, 0x24(r1) + addi r11, r1, 0x20 + bl _savegpr_26 + li r26, 0 + lis r28, _seBlk__Q23ipl3snd@ha + lis r3, 1 + li r31, 0 + mr r29, r26 + addi r28, r28, _seBlk__Q23ipl3snd@l + subi r30, r3, 1 + resetAllSound_loop: + lwzx r3, r28, r31 + add r27, r28, r31 + cmpwi r3, 0 + beq resetAllSound_clear + lwz r12, 0(r3) + li r4, 0 + lwz r12, 0x18(r12) + mtctr r12 + bctrl + resetAllSound_clear: + stw r29, 0x4(r27) + addi r26, r26, 1 + cmpwi r26, 0x10 + addi r31, r31, 0xc + stw r30, 0x8(r27) + blt resetAllSound_loop + lwz r3, _mainBGMHandle__Q23ipl3snd + cmpwi r3, 0 + beq resetAllSound_banner + lwz r0, 0(r3) + cmpwi r0, 0 + beq resetAllSound_banner + lwz r3, 0(r3) + li r4, 0 + lwz r12, 0(r3) + lwz r12, 0x18(r12) + mtctr r12 + bctrl + resetAllSound_banner: + lis r31, sBannerSoundPlayer__Q23ipl3snd@ha + li r4, 0 + addi r3, r31, sBannerSoundPlayer__Q23ipl3snd@l + bl stop__17BannerSoundPlayerFUl + bl GetInstance__Q44nw4r3snd6detail9AxManagerFv + li r4, 0 + li r5, 0 + bl ClearEffect__Q44nw4r3snd6detail9AxManagerFQ34nw4r3snd6AuxBusi + bl GetInstance__Q44nw4r3snd6detail9AxManagerFv + li r4, 1 + li r5, 0 + bl ClearEffect__Q44nw4r3snd6detail9AxManagerFQ34nw4r3snd6AuxBusi + bl GetInstance__Q44nw4r3snd6detail9AxManagerFv + li r4, 2 + li r5, 0 + bl ClearEffect__Q44nw4r3snd6detail9AxManagerFQ34nw4r3snd6AuxBusi + bl GetInstance__Q44nw4r3snd6detail9AxManagerFv + lfs f1, scSoundZeroF + li r4, 0 + bl SetMasterVolume__Q44nw4r3snd6detail9AxManagerFfi + lfs f1, scSoundZeroF + addi r3, r31, sBannerSoundPlayer__Q23ipl3snd@l + bl setMasterVolume__17BannerSoundPlayerFf + addi r11, r1, 0x20 + bl _restgpr_26 + lwz r0, 0x24(r1) + mtlr r0 + addi r1, r1, 0x20 + blr + } + + } +} +namespace nw4r { +namespace snd { +inline SoundHandle::SoundHandle() : mSound(NULL) {} +} +} +namespace ipl { +namespace snd { + + void System::muteOnBGM(int frames) { + nw4r::snd::SoundHandle* handle = _mainBGMHandle; + if (handle && handle->IsAttachedSound()) handle->SetVolume(scSoundZeroF, frames); + } + + void System::muteOffBGM(int frames) { + nw4r::snd::SoundHandle* handle = _mainBGMHandle; + if (handle && handle->IsAttachedSound()) handle->SetVolume(scSoundOneF, frames); + } + + void System::pauseOnBGM() { + if (_mainBGMHandle) { + if (_mainBGMHandle->IsAttachedSound()) _mainBGMHandle->Pause(true, 5); + pauseOnSE(); + sBannerSoundPlayer.pause(true); + nw4r::snd::detail::AxManager::GetInstance().ClearEffect(nw4r::snd::AUX_A, 250); + nw4r::snd::detail::AxManager::GetInstance().ClearEffect(nw4r::snd::AUX_B, 250); + nw4r::snd::detail::AxManager::GetInstance().ClearEffect(nw4r::snd::AUX_C, 250); + } + } + + void System::pauseOffBGM() { + if (_mainBGMHandle) { + initFx(); + if (_mainBGMHandle->IsAttachedSound()) _mainBGMHandle->Pause(false, 5); + pauseOffSE(); + sBannerSoundPlayer.pause(false); + } + } + + void System::pauseOnSE() { + for (int index = 0; index < 16; ++index) { + if (_seBlk[index].handle.IsAttachedSound()) { + _seBlk[index].handle.Pause(true, 5); + } + } + } + + void System::pauseOffSE() { + for (int index = 0; index < 16; ++index) { + if (_seBlk[index].handle.IsAttachedSound()) { + _seBlk[index].handle.Pause(false, 5); + } + } + } + void System::setOutputMode(EAudioOutputMode mode) { nw4r::snd::OutputMode outputMode; @@ -589,6 +550,14 @@ namespace snd { return sBannerSoundPlayer.start(data, size); } + void System::stopBannerSound(int unk) { + sBannerSoundPlayer.stop(unk); + } + + BOOL System::checkTmpSoundFile(void* data, u32 size) { + return sBannerSoundPlayer.checkData(data, size, false); + } + long System::clipGELT_S32(long value, long lo, long hi) { long range = hi - lo; @@ -607,5 +576,10 @@ namespace snd { return value; } + extern "C" const f32 scSoundZeroF = 0.0f; + extern "C" const f32 scSoundTwoF = 2.0f; + extern "C" const f32 scSoundOneF = 1.0f; + extern "C" const f32 scSoundThirtyF = 30.0f; + extern "C" const f32 scSoundSixtyF = 60.0f; } // namespace snd } // namespace ipl -- 2.49.1 From 137edaff42e9f87a6e9ecd05ddffc235aa76667a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 2 Oct 2026 01:58:17 +0000 Subject: [PATCH 06/10] docs: update progress [skip ci] --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0aa80c3a..e6aeefcd 100644 --- a/README.md +++ b/README.md @@ -53,9 +53,9 @@ Progress | Decompiled | Matched | Linked | Data | |:---:|:---:|:---:|:---:| -| 99.39% | 88.26% | 62.52% | 92.12% | +| 99.39% | 88.26% | 62.71% | 92.12% | -units 921/1027 complete, functions 12244/12563 matched. +units 922/1027 complete, functions 12245/12563 matched. decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, linked = code actually linked into the DOL, data = byte-exact data -- 2.49.1 From a5f79b81fa051a5e6a16fa57c833ed6c134cb8a5 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Thu, 1 Oct 2026 21:35:19 -0500 Subject: [PATCH 07/10] Correct memo Manager title setter vtable target (#715) --- include/keyboard/tiManager.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/keyboard/tiManager.h b/include/keyboard/tiManager.h index d245e29f..aac91f37 100644 --- a/include/keyboard/tiManager.h +++ b/include/keyboard/tiManager.h @@ -113,6 +113,8 @@ namespace textinput { #ifdef TIMANAGER_IMPLEMENTATION virtual void setTitleText(wchar_t* titleText); void initAspect(); +#elif defined(MYTIMANAGER_IMPLEMENTATION) + virtual void setTitleText(wchar_t* titleText); #else virtual void setTitleText(const wchar_t* titleText); #endif -- 2.49.1 From bc505c3b8a5a5c15f9678c77c009f8f062426c08 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Thu, 1 Oct 2026 21:49:43 -0500 Subject: [PATCH 08/10] Restore sensitivity projection constant pool and link source (#716) --- configure.py | 2 +- src/scene/setting/iplSensitivity.cpp | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/configure.py b/configure.py index 27004011..acd7a1f9 100644 --- a/configure.py +++ b/configure.py @@ -869,7 +869,7 @@ config.libs = [ ), IPLSection("setting", [ Object(NonMatching, "scene/setting/iplSetting.cpp"), - Object(NonMatching, "scene/setting/iplSensitivity.cpp"), + Object(Matching, "scene/setting/iplSensitivity.cpp"), Object(Matching, "scene/setting/iplNCDSetting.cpp"), Object(Matching, "scene/setting/iplParental.cpp"), Object(Matching, "scene/setting/iplAPScanThread.cpp"), diff --git a/src/scene/setting/iplSensitivity.cpp b/src/scene/setting/iplSensitivity.cpp index ff04393d..1d458afa 100644 --- a/src/scene/setting/iplSensitivity.cpp +++ b/src/scene/setting/iplSensitivity.cpp @@ -17,8 +17,16 @@ namespace ipl { class SensitivityDrawing { public: static void draw(nand::File* texture); +private: + static void verticalScale(f32 height, f32& scale); + static f32 horizontalScale(f32 width); + static f32 projectY(s32 y, f32 scale); }; +void SensitivityDrawing::verticalScale(f32 height, f32& scale) { scale = 0.5f * height / 768.0f; } +f32 SensitivityDrawing::horizontalScale(f32 width) { return 0.5f * width / 1024.0f; } +f32 SensitivityDrawing::projectY(s32 y, f32 scale) { return (y - 384) * scale; } + void SensitivityDrawing::draw(nand::File* texture) { GXRenderModeObj renderMode = *System::getRenderModeObj(); nw4r::ut::Rect projection; @@ -47,8 +55,9 @@ void SensitivityDrawing::draw(nand::File* texture) { GXInitTexObjWrapMode(&image, GX_MIRROR, GX_MIRROR); f32 width = projection.GetWidth(); f32 height = projection.GetHeight(); - f32 horizontalScale = (0.5f * width) / 1024.0f; - f32 verticalScale = (0.5f * height) / 768.0f; + f32 horizontalScale = SensitivityDrawing::horizontalScale(width); + f32 verticalScale; + SensitivityDrawing::verticalScale(height, verticalScale); int sample = WPADGetLatestIndexInBuf(controller->getChannel()); DPDObject* object; DPDObject* first; @@ -76,7 +85,7 @@ void SensitivityDrawing::draw(nand::File* texture) { if (object->size != 0) { f32 radius = 0.15f * (object->size + 25); f32 x = (object->x - 512) * horizontalScale; - f32 y = (object->y - 384) * verticalScale; + f32 y = projectY(object->y, verticalScale); GXColor foreground = {255, 255, 255, 255}; nw4r::ut::Rect rectangle(x - radius, -y + radius - -45.0f, x + radius, -y - radius - -45.0f); -- 2.49.1 From f18d945894560a337dd1c0bc9148d94b9e4a39f0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 2 Oct 2026 03:02:34 +0000 Subject: [PATCH 09/10] docs: update progress [skip ci] --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e6aeefcd..a21589ae 100644 --- a/README.md +++ b/README.md @@ -53,9 +53,9 @@ Progress | Decompiled | Matched | Linked | Data | |:---:|:---:|:---:|:---:| -| 99.39% | 88.26% | 62.71% | 92.12% | +| 99.39% | 88.26% | 62.75% | 92.12% | -units 922/1027 complete, functions 12245/12563 matched. +units 923/1027 complete, functions 12245/12563 matched. decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, linked = code actually linked into the DOL, data = byte-exact data -- 2.49.1 From bd762fd1623263e6d51097591a23429264aa30e5 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Thu, 1 Oct 2026 22:44:50 -0500 Subject: [PATCH 10/10] docs(agents): add orchestrator handoff section (tools, state, pickup steps) (#717) --- AGENTS.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index 4b9dd10f..315a3fd6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -431,6 +431,53 @@ Policy additions learned in this loop: between. Check that it changes no other function in the units that use it. Use-site volatile casts and the `register` keyword stay forbidden. +### Handoff: where the loop lives + +The loop's tools and state live outside the repository, in the author's +workers directory `/mnt/drive2/projects/wii-ipl-workers` (`$W` below). A new +orchestrator thread picks up from there. + +Tools in `$W/_restore0928-tools/`: + +| File | Purpose | +|------|---------| +| `gate.py [--base origin/main] [--quick]` | the acceptance gate; `--quick` only skips the clean `rm -rf build/43U` | +| `land.sh merge-base ` | gate a worker's diff on a fresh branch, push, open and squash-merge the PR | +| `luna.sh <worktree> <name> <prompt> <effort> [session]` | start (or resume) one Codex worker; run with `MODEL=gpt-6.1-sol CODEX_BIN=$W/_codex159/bin/codex` | +| `reviewd.sh` | review daemon: queues every open PR whose head changed | +| `revq.sh`, `automerge.py` | the daemon's gate runner and merge decision | +| `checklist.py` | regenerates `$W/CHECKLIST.md` from a report | +| `chatter.py <run-prefix>` | counts worker text messages for the silent-mode audit | +| `baseline-<sha8>.json` | objdiff reports of past `origin/main` commits, used for regressions | + +State: + +- `$W/_luna-runs/prompts/`: worker prompts. `common.md` is shared; each + task is `<name>.task.md`, and the launched prompt is `<name>.md` = task + + common. +- `$W/_luna-runs/<name>.<time>.jsonl` and `.last.md`: worker transcript and + final report. +- `$W/_luna-runs/effort-policy.txt`: the policy log. Records escalations, + parked functions, and every orchestrator attempt with what was tried. +- `$W/CHECKLIST.md`: units with non-exact code, worst first. +- Worktrees: `verify-fix` is the only verification and landing tree; + `sol-low`, `sol-med`, `sol-high` and `w0929-fix-board` are the four worker + slots; `orch` is orchestrator scratch. +- Logs: `/tmp/reviewd.log`, `/tmp/vfq.log` (current review batch) and + `/tmp/automerge.log` (merge decisions). These are lost on reboot, which + only means open PRs get reviewed again. +- `/tmp/wii-git.lock`: every `git fetch` or checkout in a shared worktree + runs under `flock` on this file, because worktrees share refs. + +To pick up the loop: + +1. Make sure no other orchestrator session is running. +2. Check `pgrep -af "reviewd.sh|luna.sh|land.sh"` and restart the review + daemon if it isn't running. +3. Read the newest `.last.md` for each slot. Land gains, then relaunch the + slot per the effort scale. +4. Handle every `NEEDS REVIEW` line in `/tmp/automerge.log`. + ## Goal completion contract The decompilation loop does not stop after a successful wave, a convenient -- 2.49.1