Compare commits

..

63 Commits

Author SHA1 Message Date
coah
f67d0d010f decomp: restore Korean scan entry and lookup widths 2026-10-02 19:50:29 -05:00
coah
e5987de5ad fix(nwc24): use a defined unsigned retry mask (#1006) 2026-10-02 19:43:11 -05:00
coah
11bd51b3a9 fix(keyboard): use bounded OEM dictionary accessor (#1005) 2026-10-02 19:42:46 -05:00
coah
e4a9449256 decomp(keyboard): reconstruct candidate animation descriptor lifetimes (#1004) 2026-10-02 19:33:27 -05:00
coah
b940710632 decomp: align Bopomofo consumed-count return contract (#1003) 2026-10-02 19:25:17 -05:00
coah
1fa33882ae decomp(inputform): recover pane lookup and animation slot flow (#1002) 2026-10-02 19:15:58 -05:00
coah
aba50ea278 decomp: recover AOSS initialization guards and request lifetimes (#1001) 2026-10-02 19:15:32 -05:00
coah
14a8b23adb decomp: correct Chinese phonetic contracts and Zhuyin dispatch (#1000) 2026-10-02 19:07:43 -05:00
coah
b8931fae6f decomp: recover card rename retry reset boundary (#999) 2026-10-02 19:07:35 -05:00
coah
bcac23375a decomp(keyboard): correct prediction refresh and character flow (#998) 2026-10-02 19:07:28 -05:00
coah
ed49ada973 decomp: recover ATERM digest and payload lifetimes (#997) 2026-10-02 19:07:02 -05:00
coah
fa0cb9b7b4 decomp(nhttp): recover token loop and Base64 byte flow (#996) 2026-10-02 18:51:40 -05:00
coah
8ffaa9d25a decomp(bs2): preserve update publications and repeated entry reads (#995) 2026-10-02 18:49:17 -05:00
coah
cc812ad30e ci: live README progress badges from a progress-data branch (#994)
The README progress table only changed when a landing commit rewrote it, so
merges outside land.sh left it stale, and the decomp.dev badges showed
upstream's numbers. The progress workflow now publishes shields.io endpoint
JSON to an orphan progress-data branch (one force-pushed commit), so the
badges refresh on every push to main without extra commits on main.
The build badge now points at the workflow that actually builds (Build is
disabled: it needs upstream's private container).
2026-10-02 18:47:05 -05:00
coah
3d3448e3a8 decomp(kbd): reconstruct asynchronous LED dispatch and completion (#993) 2026-10-02 18:42:29 -05:00
coah
654c65dd27 decomp: align EXIF rational denominator address structure (#992) 2026-10-02 18:37:40 -05:00
coah
bb93684b95 decomp: reconstruct alpha boundary and output expressions (#991) 2026-10-02 18:37:35 -05:00
coah
39648c8aa6 decomp(aes): reconstruct final-round word dependencies (#990) 2026-10-02 18:37:29 -05:00
coah
230c3af28f decomp: recover typed partition word decoding (#989) 2026-10-02 18:37:04 -05:00
coah
13881c99fb match(kbd): reconstruct synchronous LED command reservation (#988) 2026-10-02 18:29:15 -05:00
coah
b26e248bb0 decomp: reconstruct BS2 partition and banner paths (#987) 2026-10-02 18:12:23 -05:00
coah
8350f2b4df decomp: recover EXIF entry aliasing and tag semantics (#986) 2026-10-02 18:11:57 -05:00
coah
3851d2cc74 decomp: reconstruct one-key phonetic and result widths (#985) 2026-10-02 18:10:11 -05:00
coah
7bdf4629fd decomp: refine AES table and inverse-key XOR dependencies (#984) 2026-10-02 18:09:45 -05:00
coah
5a222cdec4 match(fa): pfd_sddrv_get_total_sectors byte-identical (#983)
Fold the (max_multiplier - 9) shift count back into max_multiplier so the literal 1 stays in r0 and the count is an in-place clrlwi on r3.
2026-10-02 17:55:54 -05:00
coah
ac8d46d231 fix: model Run stack address independently of printf (#982) 2026-10-02 17:49:33 -05:00
coah
813660b96e match(iplSetting): Setting::draw byte-identical (#980)
draw is 632/632 against retail. The TU stays NonMatching, so the DOL is unchanged.
2026-10-02 17:36:11 -05:00
coah
e82417345a decomp: refine JPEG butterfly and color source structure (#978) 2026-10-02 17:32:07 -05:00
coah
230c2f8d34 decomp: reconstruct typed CHANSVm operands (#977) 2026-10-02 17:31:41 -05:00
coah
524350ed8f decomp: reconstruct alpha output and dictionary scan (#976) 2026-10-02 17:31:14 -05:00
coah
c62453dac9 decomp: recover ESMisc ticket scratch lifetime and cleanup flow (#975) 2026-10-02 17:30:27 -05:00
coah
6b17698b84 match(odh): cdj_c_colorConv byte-identical (#974)
Pad with a named remainder and declare sourceStride after rowIndex so cbPlane stays r22 and the stride stays r29. decompressLoop is unchanged.
2026-10-02 17:28:16 -05:00
devin-ai-integration[bot]
f9358f6e46 Decode BS2Mach Run asm + nup dead-static fossil (stays NonMatching) (#973)
* decomp: BS2Mach Run asm + CoverBlock/state decodes; nup dead-static fossil

- BS2Mach::Run: retail zeroes r0-r31 and installs a custom stack
  (__pformatter+640) before the dcbz/dcbf flush loop and tail jump —
  inexpressible in C, so asm with the exact retail sequence.
- BS2StartGCGame: CoverBlock.state direct member read (orig inlined
  DVDGetCommandBlockStatus accessor).
- BS2StateMachine: GamePartition!=0 polarity fold.
- nup.cpp __nupOp: 'static u32 lo' dead static reproduces orig's second
  .sbss word (orig .sbss=8: rvThread$2389 + 4B dead static).

Verified vs main: BS2Mach 25/29 fns byte-exact, nup 20/23 + .sbss 8=8.
Units stay NonMatching. Full build + DOL sha1 verified.

Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>

* decomp: drop dead 'static u32 lo' padding from __nupOp

Per review: the extra .sbss word is a padding object — no relocation
references it, and nup data is already exact without it. Left unowned
for the linking pass.

Co-Authored-By: wch <usernamecole7@gmail.com>

---------

Co-authored-by: devin <devin@cognition.ai>
Co-authored-by: coah80 <usernamecole7@gmail.com>
2026-10-02 17:26:43 -05:00
devin-ai-integration[bot]
3aa9daf94a decomp: emission gates for iplSDChannelTitle + MemoryCardManager decodes (#972)
IPL_SD_CHANNEL_TITLE_CPP gates move inline members to declarations so the
TU emits non-inlined calls like retail (same dedup-loss pattern as
#834's vtable restoration): iplInterporation::get, math::VEC3 ctor,
FaderSceneBase::initCalcNormal/calcCommonAfter, SceneBase::isReady/
isResetProcessDone/getParent/getChild/getNext/getPrev, NANDTask::
isFinished/checkData, Graphics::setOrthoTrans/setOrthoScale,
ut::Rect/RuntimeTypeInfo.

Verified vs main: iplSDChannelTitle 68/69 fns byte-exact (152B tail
residual in iplSDChannelTitle_flushSaveBeforeExit), iplMemoryCardManager
18/26. Units stay NonMatching; documented walls in revisit.attempts.md.

Co-authored-by: devin <devin@cognition.ai>
Co-authored-by: coah80 <usernamecole7@gmail.com>
2026-10-02 17:22:10 -05:00
coah
dc48b109b0 match(odh): cdj_d_decompressLoop byte-identical (#971)
Keep the updated 2x2 plane in requiredBlockEnd so MWCC uses r15 for the
plane and r16 for the block end. 899/899, 0 diffs.
2026-10-02 17:15:30 -05:00
devin-ai-integration[bot]
b6f2304efc decomp(scene4): nested-switch guards + dead-store fossils (address/sdChannelSelect) (#970)
Decodes:
- start_drag_event: nested single-case switch emits the b<cond>+b
  two-branch guard (insn-identical, 7-word web-home residual)
- onEventDerived: no-break TRIG->ON_POINT fallthrough + || polarity fold
  (insn-identical, regname residuals)
- set_err_msg: default arm reads uninitialized messageId register,
  matching the orig's uninit-r4 retail bug (verified in base asm)
- movePane_onDrag width-accumulate scoping, FriendListCache::update
  member-chain regroup, AddressEdit::create/get_friendinfo arg marshals

All three units stay NonMatching; data 100% on all; documented walls in
tools/decomp-assist/scene4.attempts.md.

Co-authored-by: devin <devin@cognition.ai>
Co-authored-by: coah80 <usernamecole7@gmail.com>
2026-10-02 17:13:22 -05:00
coah
7fac2b91ec decomp: refine MD5 rotation sums and word consumption (#969) 2026-10-02 17:09:45 -05:00
coah
6456e33a4c decomp: reconstruct AES last-round key cursor (#968) 2026-10-02 17:09:20 -05:00
coah
3244c6d7ff decomp: reconstruct CHANSVm opcode-local error paths (#967) 2026-10-02 16:59:59 -05:00
coah
b2089fbdba decomp: reconstruct alpha restriction gates and suffix fallback (#966) 2026-10-02 16:53:19 -05:00
coah
580b79f40d decomp: reconstruct MD5 endian-loaded rotation operands (#965) 2026-10-02 16:47:00 -05:00
coah
255f3e0530 decomp: reconstruct ESMisc cleanup helpers and return ABI (#964) 2026-10-02 16:42:08 -05:00
coah
d0e5483630 decomp: preserve CHANSVm string-load deletion errors (#963) 2026-10-02 16:35:31 -05:00
coah
d725e02301 link(ut_ArchiveFontBase): Matching after 23/23 code match (#962)
Flip NonMatching→Matching after #961 match(ut_ArchiveFontBase 23/23).
Full 43U rebuild keeps DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d.

Co-authored-by: linker <linker@users.noreply.github.com>
2026-10-02 16:27:44 -05:00
devin-ai-integration[bot]
87eaad4a42 decomp(CDBRecord): dead-fn literal fossils + Encrypt 284/284 insn-equal (#960)
Restores ~15 link-deadstripped retail fns whose emitted .data fossil
literals exist in the orig object; DOL-verified byte-identical at the
expected vaddrs. CDBRecordEncrypt auto-inlines dead CDBRecordGetFileSize:
284/284 instructions identical. Unit stays NonMatching: Encrypt's 57-byte
residual is an equal-cost register-packing tie-break (18 source probes
documented in tools/decomp-assist/CDBRecord.attempts.md).

Co-authored-by: devin <devin@cognition.ai>
Co-authored-by: coah80 <usernamecole7@gmail.com>
2026-10-02 16:25:40 -05:00
coah
e32aad81fb match(ut_ArchiveFontBase 23/23) (rt7f, prior-art ref) (worker 2fe052a9) (#961) 2026-10-02 16:23:57 -05:00
coah
449529d924 match(KPAD 25/29) (fz16j) (worker fe716b2a) (#959) 2026-10-02 16:10:06 -05:00
coah
8a07484e8a link(vi) (worker 5b1f07ee) (#957) 2026-10-02 16:07:02 -05:00
coah
2d3bc63c09 match(vi 30/30) (prior1, prior-art ref) (worker 999cdc11) (#956) 2026-10-02 16:04:28 -05:00
coah
3efb9d8676 match(iqdec_b65): port sibling semantics for decode_iquant (30→13 reg) (#955)
Port decode_iquant_rc-style table access / load_buff / conv_row patterns
into TMCJPEGDEC_decode_iquant. Cuts reg-only diffs 30→13 (276/276,
structural 0). Remaining wall is AC huff/zztbl/zz callee-saved
permutation (r29/r30/r24/r25 vs r25/r24/r29/r30).
2026-10-02 16:02:45 -05:00
coah
805e84045c match(NWC24Download 26/30) (pk2) (worker 9f86df06) (#954) 2026-10-02 15:50:50 -05:00
coah
26d7e1e052 link(wprintf): Matching after 9/9 code match (#952)
Flip MSL_Common/wprintf.c NonMatching → Matching.
Unit is instruction-exact (9/9, .text identical, weaks 0/0);
full 43U DOL SHA1 unchanged.

Co-authored-by: linker <linker@users.noreply.github.com>
2026-10-02 15:32:21 -05:00
coah
d78210528f match(KPAD 24/29) (fz16i) (worker f6bc72ec) (#953) 2026-10-02 15:30:01 -05:00
coah
e3457d11a2 match(wprintf 9/9) (#951)
__wpformatter → 100%: drop wideLength temp; narrow #s length via *buff_ptr
(MSL stale-pointer form used by matched TP/SS sources). DOL 26116613…

Co-authored-by: decomp worker 3 <decomp-worker-3@grok.local>
2026-10-02 15:16:41 -05:00
coah
b33a493cec data(MyTiManager, pf_path data 100%) (data-d16) (worker ecdb36e9) (#950) 2026-10-02 15:11:07 -05:00
coah
6f49df32b3 link(iplChannelObj native) (link3) (worker 76a29df1) (#948) 2026-10-02 15:02:31 -05:00
coah
8864436cde match(iplChannelObj 56/56) (near1c) (worker f210b2fc) (#946) 2026-10-02 14:56:25 -05:00
coah
a9a3f36cf0 usbkbd: rename USBKBDCmdLEDAsync unused gap to pad_0x08 (#945)
Padding between USBKBDCmdLED base and the async callback fields;
never accessed by name in Matching usb_kbd.
2026-10-02 14:51:48 -05:00
coah
ffeed96e49 cleanup(iplCSSavedata): rename sMountPath (#943)
unk_0x00 → sMountPath: optional NAND archive path used to VF-mount @CS.
Empty → load from NAND via sPath; set (two-arg ctor) → load_vf_ mounts
that path and opens sPath inside the volume.
2026-10-02 14:49:08 -05:00
coah
1216db0acb sc: rename SC_BT_DEV_INFO unused gaps to pad_* (#942)
unk_0x14 / unk_0x15 / unk_0x30 sit between devName and linkKey
(and after linkKey) with no named field readers in Matching units;
mark them as pads.
2026-10-02 14:48:42 -05:00
coah
85b993f48c cleanup(eZiText): rename work unk_0x1F to ignoreCase (#938)
When set, PUD/UWD/OEM matching tries Zi8ChangeCharCase and UWD
stores the folded form in the alt prefix buffer.
2026-10-02 14:47:52 -05:00
coah
a2a0460567 cleanup(AudioWavePlayer): rename mbFillInCallback (#937)
unk_0xB5 → mbFillInCallback: when true MakeWave runs in the wave-packet
callback; when false it runs from update(). Ctor defaults true.
2026-10-02 14:47:25 -05:00
coah
df0fa22203 cleanup(eZiText): rename zi8DawgCtx unk_0x338 to endNode (#936)
Walk stops when the current node equals endNode; cleared on reset.
2026-10-02 14:47:19 -05:00
116 changed files with 19412 additions and 1018 deletions

View File

@@ -2,8 +2,8 @@ name: README progress
# runs on the self-hosted runner on cole's server so it doesn't use hosted minutes.
# only push/schedule/manual triggers, never pull_request, so fork PRs can't reach this machine.
# README progress is written inside each landing commit by the orchestrator, so this job never commits;
# it only rebuilds and publishes the current numbers to the job summary.
# it never commits to main: it rebuilds, publishes the numbers to the job summary, and force-pushes
# the README badge JSON as a single commit on the orphan progress-data branch.
on:
push:
branches: [main]
@@ -17,7 +17,7 @@ concurrency:
cancel-in-progress: true
permissions:
contents: read
contents: write
jobs:
progress:
@@ -55,3 +55,17 @@ jobs:
python3 tools/update_readme_progress.py build/43U/report.json README.md "$GITHUB_SHA"
sed -n '/progress:start/,/progress:end/p' README.md >> "$GITHUB_STEP_SUMMARY"
git checkout -- README.md
- name: Publish badges
if: github.ref == 'refs/heads/main'
run: |
out="$RUNNER_TEMP/progress-data"
rm -rf "$out"
python3 tools/progress_badges.py build/43U/report.json "$out"
cd "$out"
git init -q -b progress-data
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -q -m "progress for $GITHUB_SHA"
git push -q -f "https://x-access-token:${{ github.token }}@github.com/$GITHUB_REPOSITORY.git" HEAD:refs/heads/progress-data

View File

@@ -7,23 +7,23 @@
<!--- Github Actions Badge -->
[Build Status]: https://github.com/coah80/wii-ipl/actions/workflows/build.yml/badge.svg
[actions]: https://github.com/coah80/wii-ipl/actions/workflows/build.yml
[Build Status]: https://github.com/coah80/wii-ipl/actions/workflows/readme-progress.yml/badge.svg?branch=main
[actions]: https://github.com/coah80/wii-ipl/actions/workflows/readme-progress.yml
<!--- Discord Badge -->
[Discord Badge]: https://img.shields.io/discord/727908905392275526?color=%237289DA&logo=discord&logoColor=%23FFFFFF
[discord]: https://discord.gg/hKx3FJJgrV
<!-- Progress links -->
<!-- Progress badges: JSON on the progress-data branch, refreshed by the README progress workflow on every push to main -->
[V43U]: https://decomp.dev/koopthekoopa/wii-ipl/43U
<!--- Version 4.3U progress Badge -->
[DecompBadgeV43U]: https://decomp.dev/koopthekoopa/wii-ipl/43U.svg?&measure=code&label=Decompiled&mode=shield&labelColor=%237c7c7c&color=%2333b8ff&style=plastic
[LinkBadgeV43U]: https://decomp.dev/koopthekoopa/wii-ipl/43U.svg?&measure=complete_code&label=Linked&mode=shield&labelColor=%237c7c7c&color=%2333b8ff&style=plastic
[FuncBadgeV43U]: https://decomp.dev/koopthekoopa/wii-ipl/43U.svg?&measure=functions&label=Functions&mode=shield&labelColor=%237c7c7c&color=%2333b8ff&style=plastic
[progress]: https://github.com/coah80/wii-ipl/actions/workflows/readme-progress.yml
[DecompiledBadge]: https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fcoah80%2Fwii-ipl%2Fprogress-data%2Fdecompiled.json
[MatchedBadge]: https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fcoah80%2Fwii-ipl%2Fprogress-data%2Fmatched.json
[LinkedBadge]: https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fcoah80%2Fwii-ipl%2Fprogress-data%2Flinked.json
[DataBadge]: https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fcoah80%2Fwii-ipl%2Fprogress-data%2Fdata.json
[FunctionsBadge]: https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fcoah80%2Fwii-ipl%2Fprogress-data%2Ffunctions.json
[UnitsBadge]: https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fcoah80%2Fwii-ipl%2Fprogress-data%2Funits.json
<!--- Header -->
@@ -43,28 +43,17 @@ Live decomp status
[![Build status]][actions]
Open the latest successful [Build workflow run][actions] and check its summary for the current objdiff metrics. It includes perfect-match/decompiled, fuzzy-match, fully linked, data, function, unit, and category breakdowns. The run also publishes the 43U report artifact and generated decomp-status report.
Every push to `main` rebuilds 4.3U, checks the DOL hash, and refreshes the progress badges below. Open the latest [README progress run][actions] for the full objdiff summary.
Supported versions:
- `43U` - Version **4.3U** (USA)
Progress
========
<!-- progress:start -->
| Decompiled | Matched | Linked | Data |
|:---:|:---:|:---:|:---:|
| 99.59% | 90.92% | 73.37% | 99.37% |
units 960/1027 complete, functions 12368/12563 matched.
[![DecompiledBadge]][progress] [![MatchedBadge]][progress] [![LinkedBadge]][progress] [![DataBadge]][progress]
[![FunctionsBadge]][progress] [![UnitsBadge]][progress]
decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, linked = code actually linked into the DOL, data = byte-exact data
<!-- progress:end -->
| Version | Progress |
|-----------------------|------------------------------------------------------------------------------|
| [Wii Menu 4.3U][V43U] | [![FuncBadgeV43U]][V43U] [![DecompBadgeV43U]][V43U] [![LinkBadgeV43U]][V43U] |
> You can see the full progress and its history by clicking on one of the versions in the table.
Dependencies
============

View File

@@ -37,6 +37,9 @@ force_active:
# textinput::toolbar::csPaneToAnimation points one past the end of csAninationFile.
block_relocations:
# Run establishes a fixed stack at 0x81600000, not __pformatter + 0x280.
- source: .text:0x8137B468
- source: .text:0x8137B46C
- source: .data:0x8165E15C
- source: .data:0x8165E19C

View File

@@ -18106,7 +18106,7 @@ __vt__Q49textinput6extend4memo15AppearMemoState = .data:0x81667FA0; // type:obje
__vt__Q49textinput6extend4memo13DispMemoState = .data:0x81667FF8; // type:object size:0x58
__vt__Q49textinput6extend4memo5State = .data:0x81668050; // type:object size:0x58
__vt__Q49textinput6extend4memo7Manager = .data:0x816680A8; // type:object size:0x140
lbl_816681E8 = .data:0x816681E8; // type:object size:0x28
lbl_816681E8 = .data:0x816681E8; // type:object size:0x24
lbl_81668210 = .data:0x81668210; // type:object size:0x9 data:string
lbl_8166821C = .data:0x8166821C; // type:object size:0x9 data:string
lbl_81668228 = .data:0x81668228; // type:object size:0x9 data:string
@@ -23275,7 +23275,7 @@ lbl_81698388 = .sdata:0x81698388; // type:object size:0x2 data:string
lbl_8169838C = .sdata:0x8169838C; // type:object size:0x4 data:string
lbl_81698390 = .sdata:0x81698390; // type:object size:0x1 data:byte
lbl_81698391 = .sdata:0x81698391; // type:object size:0x1 data:byte
lbl_81698394 = .sdata:0x81698394; // type:object size:0x2 data:string
lbl_81698394 = .sdata:0x81698394; // type:object size:0x4 data:string
lbl_81698398 = .sdata:0x81698398; // type:object size:0x2 data:string
lbl_8169839C = .sdata:0x8169839C; // type:object size:0x4
drvInitFunc = .sdata:0x816983A0; // type:object size:0x8 scope:local data:4byte

View File

@@ -768,7 +768,7 @@ config.libs = [
IPLSection("channelSelect", [
Object(Matching, "scene/channelSelect/iplChannelSelect.cpp"),
Object(Matching, "scene/channelSelect/iplClock.cpp"),
Object(Equivalent, "scene/channelSelect/iplChannelObj.cpp"),
Object(Matching, "scene/channelSelect/iplChannelObj.cpp"),
]
),
IPLSection("channelTitle", [
@@ -1299,7 +1299,7 @@ config.libs = [
Object(Matching, "ut/ut_RomFont.cpp"),
Object(Matching, "ut/ut_ResFontBase.cpp"),
Object(Matching, "ut/ut_ResFont.cpp"),
Object(NonMatching, "ut/ut_ArchiveFontBase.cpp"),
Object(Matching, "ut/ut_ArchiveFontBase.cpp"),
Object(Matching, "ut/ut_ArchiveFont.cpp"),
Object(Matching, "ut/ut_CharWriter.cpp"),
Object(Matching, "ut/ut_TextWriterBase.cpp"),
@@ -1388,7 +1388,7 @@ config.libs = [
]
),
RVLSDKLib("vi", [
Object(NonMatching, "vi/vi.c"),
Object(Matching, "vi/vi.c"),
Object(Matching, "vi/i2c.c"),
Object(Matching, "vi/vi3in1.c"),
]
@@ -1970,7 +1970,7 @@ config.libs = [
Object(Matching, "MSL_Common/time.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/wctype.c"),
Object(Matching, "MSL_Common/wmem.c"),
Object(NonMatching, "MSL_Common/wprintf.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/wprintf.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/wstring.c"),
Object(Matching, "MSL_Common/wchar_io.c"),
Object(Matching, "PPC_EABI/time.dolphin.c"),

View File

@@ -24,7 +24,7 @@ typedef struct BS2UpdateHeader {
typedef struct BS2UpdateEntry {
// Update Meta Data
u32 type; // 0x00
vu32 type; // 0x00
u32 attr; // 0x04
u32 size; // 0x08
u32 depend; // 0x0C

View File

@@ -43,7 +43,7 @@ private:
bool mIsPlaying; // 0xB2
bool mIsSetBuf; // 0xB3
bool mThreadRunning; // 0xB4
bool unk_0xB5; // 0xB5
bool mbFillInCallback; // 0xB5
WaveFileAiff mAiff; // 0xB8
WaveFileWav mWav; // 0xE8

View File

@@ -163,6 +163,9 @@ namespace ipl {
void init(const f32& start, const f32& end, f32 maxFrame, f32 startTangent, f32 endTangent, int playback = ANIM_TYPE_FORWARD,
f32 speed = 1.0f);
#ifdef IPL_SD_CHANNEL_TITLE_CPP
f32 get() const;
#else
f32 get() const {
f32 var_f27 = mFrame;
f32 var_f28 = 1.0f / mMaxFrame;
@@ -181,6 +184,7 @@ namespace ipl {
return r;
}
#endif
protected:
f32 mStart;

View File

@@ -103,7 +103,7 @@ namespace ipl {
y = r.y;
z = 0.0f;
}
#if defined(IPL_ADDRESS_EDIT_CPP) || defined(IPL_SD_CHANNEL_SELECT_CPP) || defined(IPL_GC_WINDOW_CPP)
#if defined(IPL_ADDRESS_EDIT_CPP) || defined(IPL_SD_CHANNEL_SELECT_CPP) || defined(IPL_GC_WINDOW_CPP) || defined(IPL_SD_CHANNEL_TITLE_CPP)
VEC3(f32 fx, f32 fy, f32 fz);
#else
VEC3(f32 fx, f32 fy, f32 fz) {

View File

@@ -31,8 +31,12 @@ namespace ipl {
virtual void calc();
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual void initCalcNormal();
#else
virtual void initCalcNormal() {
} // 0x4C
#endif
virtual void initCalcFadeout() {
} // 0x50
@@ -49,8 +53,12 @@ namespace ipl {
return FADER_SCN_NEXT;
} // 0x60
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual void calcCommonAfter();
#else
virtual void calcCommonAfter() {
} // 0x64
#endif
int getSceneFadeState() {
return mScnFadeState;

View File

@@ -62,7 +62,11 @@ namespace ipl {
virtual ~Base();
/** @brief If the scene is ready */
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual BOOL isReady() const;
#else
virtual BOOL isReady() const { return FALSE; }
#endif
/** @brief If the user can power off/reset the system */
#ifdef IPL_SD_CHANNEL_TITLE_CPP
@@ -73,7 +77,11 @@ namespace ipl {
/** @brief The scene running code when powering off/resetting the system */
virtual void startResetting() {}
/** @brief If the scene has finished its powering off/resetting task */
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual BOOL isResetProcessDone();
#else
virtual BOOL isResetProcessDone() { return TRUE; }
#endif
/** @brief Prepare to create scene */
virtual void prepare() {}
@@ -86,10 +94,17 @@ namespace ipl {
/** @brief Destroy the scene and clear from memory */
virtual void destroy() {}
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual Base* getParent();
virtual Base* getChild();
virtual Base* getNext();
virtual Base* getPrev();
#else
virtual Base* getParent() { return (Base*)mpParent; }
virtual Base* getChild() { return (Base*)mpChild; }
virtual Base* getNext() { return (Base*)mpNext; }
virtual Base* getPrev() { return (Base*)mpPrev; }
#endif
/** @brief Check if scene has been created.*/
bool isSceneCreated() const { return (mScnState & SCN_STATE_CREATED); }

View File

@@ -65,8 +65,13 @@ namespace ipl {
/** @brief Writes the file contents. */
virtual void write(); // 0x10
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual bool isFinished();
virtual int checkData();
#else
virtual bool isFinished() { return mbDoneTask; } // 0x14
virtual int checkData() { return mResult; } // 0x18
#endif
virtual bool isFatalError(); // 0x1C
u8* getBuffer() const { return mpBuffer; }

View File

@@ -50,7 +50,7 @@ namespace ipl {
static BOOL IsLastTicketExpired(ESTitleId* titleId);
static void DeleteExpiredFlagFile();
static void DeleteUnauthorizedData(EGG::Heap* heap);
static s32 DeleteUnauthorizedData(EGG::Heap* heap);
static u32 CheckTmdCountryCode(ESTmdView* tmdView);
static u32 CheckTmdParentalControl(ESTmdView* tmdView);

View File

@@ -51,12 +51,17 @@ namespace ipl {
mArg.mOrthoScale = scale;
}
#ifdef IPL_SD_CHANNEL_TITLE_CPP
static void setOrthoTrans(const math::VEC3& translate);
static void setOrthoScale(const math::VEC2& scale);
#else
static void setOrthoTrans(const math::VEC3& translate) { mArg.mOrthoTrans = translate; }
static void setOrthoScale(const math::VEC2& scale) NO_INLINE {
mArg.mOrthoScale.x = scale.x;
mArg.mOrthoScale.y = scale.y;
}
#endif
private:
static Arg mArg;

View File

@@ -1120,32 +1120,28 @@ static int __wpformatter(void* (*write_proc)(void*, const wchar_t*, size_t),
case 's':
if (format.argument_options == wchar_argument) {
wchar_t* wcs_ptr = va_arg(args, wchar_t*);
int wideLength;
if (wcs_ptr == NULL) {
wcs_ptr = L"";
}
if (format.alternate_form) {
wchar_t first = *wcs_ptr++;
wideLength = (unsigned char)first;
num_chars = (unsigned char)*wcs_ptr++;
if (format.precision_specified && wideLength > format.precision) {
wideLength = format.precision;
if (format.precision_specified && num_chars > format.precision) {
num_chars = format.precision;
}
} else if (format.precision_specified) {
wideLength = format.precision;
num_chars = format.precision;
if ((string_end = wmemchr((wchar_t*)wcs_ptr, 0, wideLength)) != 0) {
wideLength = string_end - wcs_ptr;
if ((string_end = wmemchr(wcs_ptr, 0, num_chars)) != 0) {
num_chars = string_end - wcs_ptr;
}
} else {
wideLength = wcslen(wcs_ptr);
num_chars = wcslen(wcs_ptr);
}
num_chars = wideLength;
buff_ptr = wcs_ptr;
break;
} else {
@@ -1156,7 +1152,7 @@ static int __wpformatter(void* (*write_proc)(void*, const wchar_t*, size_t),
}
if (format.alternate_form) {
num_chars = (unsigned char)*(const wchar_t*)wcs_ptr;
num_chars = (unsigned char)*buff_ptr;
if (format.precision_specified && num_chars > format.precision) {
num_chars = format.precision;

View File

@@ -9,7 +9,7 @@ namespace nw4r {
namespace ut {
class Rect {
public:
#ifdef IPL_SOUND_RECT_OUT_OF_LINE
#if defined(IPL_SOUND_RECT_OUT_OF_LINE) || defined(IPL_SD_CHANNEL_TITLE_CPP)
Rect();
#else
Rect() : left(), top(), right(), bottom() {}
@@ -20,7 +20,7 @@ namespace nw4r {
Rect(f32 l, f32 t, f32 r, f32 b) : left(l), top(t), right(r), bottom(b) {}
#endif
#if !defined(IPL_CONTROLLER_TRIVIAL_RECT_DTOR) && !defined(IPL_MEMORYCARD_BASE_CPP)
#if !defined(IPL_CONTROLLER_TRIVIAL_RECT_DTOR) && !defined(IPL_MEMORYCARD_BASE_CPP) && !defined(IPL_SD_CHANNEL_TITLE_CPP)
~Rect() {}
#endif

View File

@@ -37,7 +37,7 @@ namespace nw4r {
} // namespace detail
template <typename TDerived, typename TBase>
#if defined(IPL_BOARD_OBJECT_EXTERNAL_DYNAMIC_CAST) || defined(IPL_MEMORYCARD_BASE_CPP)
#if defined(IPL_BOARD_OBJECT_EXTERNAL_DYNAMIC_CAST) || defined(IPL_MEMORYCARD_BASE_CPP) || defined(IPL_SD_CHANNEL_TITLE_CPP)
TDerived DynamicCast(TBase* pPtr);
#else
inline TDerived DynamicCast(TBase* pPtr) {

View File

@@ -252,14 +252,17 @@ namespace nw4r {
}
inline void updateSheetFlags(const void* glgrHdr, u32 groupIdx, u16* sheetOffsets, u32 flagsStep, const u32* sheetFlags) {
const GlyphGroups* glgr = (GlyphGroups*)((u8*)glgrHdr + sizeof(BinaryBlockHeader));
for (int sheetI = 0; sheetI < glgr->sheetCount; sheetI++) {
u32 groupBitIdx = sheetI + groupIdx * flagsStep * 8;
const GlyphGroups* glgr = (const GlyphGroups*)((const u8*)glgrHdr + sizeof(BinaryBlockHeader));
int sheetIndex;
u32 groupBitOffset;
u16* sheetOffset = sheetOffsets;
groupBitOffset = groupIdx * flagsStep * 8;
for (sheetIndex = 0; sheetIndex < glgr->sheetCount; sheetOffset++, sheetIndex++) {
u32 groupBitIdx = sheetIndex + groupBitOffset;
const u32* bitBlockPtr = sheetFlags + (groupBitIdx & ~0x1F) / 32;
u32 bitBlock = *(u32*)bitBlockPtr;
u32 bitBlock = *bitBlockPtr;
if (((bitBlock << (groupBitIdx & 0x1F)) & 0x80000000) != 0) {
sheetOffsets[sheetI] = 1;
*sheetOffset = 1;
}
}
}
@@ -268,14 +271,16 @@ namespace nw4r {
const u32* bitBlocksPtr, u32 sheetFlagsSize) {
HeaderedGlyphGroups* pGlgr = (HeaderedGlyphGroups*)glgrHdr;
for (int i = 0; i < pGlgr->inner.sheetCount; i++) {
sheetOffsets[i] = 0;
int i;
u16* sheetOffset;
for (i = 0, sheetOffset = sheetOffsets; i < pGlgr->inner.sheetCount; sheetOffset++, i++) {
*sheetOffset = 0;
}
for (int i = 0; i < pGlgr->inner.nameCount; i++) {
const char* includedGroups = ctx->pIncludedGroups;
u16 offset = pGlgr->inner.nameOffsets[i];
char* name = (char*)((u8*)hdr + offset);
char* name = (char*)(offset + (u32)hdr);
if (*includedGroups != 0) {
if (!ArchiveFontBase::IncludeName(includedGroups, name)) {
continue;
@@ -288,21 +293,23 @@ namespace nw4r {
inline void convertSheetOffsetBooleansToOffsets(const void* glgrHdr, u16* sheetOffsets) {
HeaderedGlyphGroups* pGlgr = (HeaderedGlyphGroups*)glgrHdr;
int i;
u16 glyphIdxOffset = 0;
for (int i = 0; i < pGlgr->inner.sheetCount; i++) {
if (sheetOffsets[i] == 1) {
sheetOffsets[i] = glyphIdxOffset;
u16* sheetOffset;
for (i = 0, sheetOffset = sheetOffsets; i < pGlgr->inner.sheetCount; sheetOffset++, i++) {
if (*sheetOffset == 1) {
*sheetOffset = glyphIdxOffset;
} else {
sheetOffsets[i] = -1;
*sheetOffset = -1;
glyphIdxOffset += pGlgr->inner.sheetGlyphCount;
}
}
}
inline void copyFlagOffsets(ArchiveFontBase::ConstructContext* ctx, u16* sheetOffsetsScratch, u32 workSize, u32 scratchSize) {
inline void copyFlagOffsets(ArchiveFontBase::ConstructContext* ctx, u16* sheetOffsetsScratch, u32 workSize, const u16* sheetOffsetsScratchEnd) {
u8* sheetOffsets = ctx->pWorkCurr;
ctx->pWorkCurr = sheetOffsets + workSize;
memmove(sheetOffsets, sheetOffsetsScratch, scratchSize);
memmove(sheetOffsets, sheetOffsetsScratch, (sheetOffsetsScratchEnd - sheetOffsetsScratch) * sizeof(u16));
ctx->pSheetOffsets = (u16*)sheetOffsets;
}
@@ -311,31 +318,64 @@ namespace nw4r {
// *sheetOffsetsScratch = (u16*)ROUNDDOWN((u32)((u8*)fontData + remWorkSpace) - sheetOffsetsSize, 2);
// return sheetOffsetsSize;
// }
ArchiveFontBase::ConstructState ArchiveFontBase::ConstructOpAnalyzeGLGR(ConstructContext* ctx, CachedStreamReader* reader) {
u32 glgrInnerLen;
HeaderedGlyphGroups* pGlgr;
const ArchiveFontBinaryLayout* font;
u8* glgrEnd;
class FontGlyphGroupsAcs {
public:
explicit FontGlyphGroupsAcs(const ArchiveFontBinaryLayout* font)
: mFont(font), mGroups(&font->glgr) {}
const GlyphGroups& GetGroups() const { return mGroups->inner; }
void SetSheetFlags(u32 flagsStep, const u32* sheetFlags) {
mFlagsStep = flagsStep;
mSheetFlags = sheetFlags;
}
u16 GetNumSheet() const { return mGroups->inner.sheetCount; }
int GetGlyphsPerSheet() const { return mGroups->inner.sheetGlyphCount; }
u16 GetNumSet() const { return mGroups->inner.nameCount; }
const char* GetSetName(int groupIndex) const {
const u16 nameOffset = mGroups->inner.nameOffsets[groupIndex];
return (const char*)(nameOffset + (u32)mFont);
}
bool IsUseSheet(int groupIndex, int sheetIndex) const {
const u32 groupBitIndex = sheetIndex + groupIndex * mFlagsStep * 8;
const u32* bitBlock = mSheetFlags + (groupBitIndex & ~0x1F) / 32;
return ((*bitBlock << (groupBitIndex & 0x1F)) & 0x80000000) != 0;
}
private:
const ArchiveFontBinaryLayout* mFont;
const HeaderedGlyphGroups* mGroups;
u32 mFlagsStep;
const u32* mSheetFlags;
};
ArchiveFontBase::ConstructState ArchiveFontBase::ConstructOpAnalyzeGLGR(ConstructContext* ctx, CachedStreamReader* reader) {
const u32* flagsSheets;
u32 sheetOffsetsSize;
u32 flagsSheetsOff;
u32 glgrInnerLen;
const ArchiveFontBinaryLayout* font;
u16 sheetGlyphCount;
u32 countSheet;
HeaderedGlyphGroups* pGlgr;
u8* glgrEnd;
u32 expectedMaxSize;
u32 dataBlockCount;
u16* sheetOffsetsScratch;
int groupIndex;
font = (ArchiveFontBinaryLayout*)ctx->pWorkCurr;
glgrInnerLen = ctx->mNextBlockHdr.size - sizeof(BinaryBlockHeader);
// Check for RFNA
if (font->hdr.signature != SIGNATURE_FONT_ARCHIVE) {
return CONSTRUCT_STATE_FATAL_ERR;
}
// Check that there's enough data available, and the space to
// put that data
ENSURE_READER_HAS_SIZE(ctx, reader, glgrInnerLen);
ENSURE_WORK_HAS_SIZE(ctx, glgrInnerLen);
expectedMaxSize = ctx->mNextBlockHdr.size + sizeof(BinaryFileHeader);
// Copy the glgr to work
{
pGlgr = (HeaderedGlyphGroups*)&font->glgr;
glgrEnd = (u8*)pGlgr + (u32)ctx->mNextBlockHdr.size;
@@ -348,80 +388,45 @@ namespace nw4r {
return CONSTRUCT_STATE_FATAL_ERR;
}
// Before here is fine (other than regswaps)
// u16 sheetGlyphCount = FORCE_REACCESS_2(font->glgr.inner.sheetGlyphCount, u16); // 0x1C
// u16 dataBlockCount = FORCE_REACCESS_2(font->hdr.dataBlocks, u16); // 0x0E
// FORCE_REACCESS_2(font->glgr.inner.sheetCount, u16);
// return ConstructOpAnalyzeGLGRInner(ctx, font, pGlgr, glgrEnd);
FontGlyphGroupsAcs gg(font);
sheetGlyphCount = gg.GetGlyphsPerSheet();
dataBlockCount = font->hdr.dataBlocks;
countSheet = gg.GetNumSheet();
const u32 stepSheetFlags = detail::CalcSizeFlagSet(countSheet);
flagsSheetsOff = detail::CalcOffsetSheetFlags(gg.GetGroups().nameCount, countSheet, gg.GetGroups().smthCount_0x0a,
gg.GetGroups().smthCount_0x0c);
flagsSheets = (const u32*)((flagsSheetsOff & ~3) + (u32)font);
gg.SetSheetFlags(stepSheetFlags, flagsSheets);
// u32 fontSizeToEndOfGlgr;
u16 countSheet;
u16 sheetGlyphCount, dataBlockCount;
u32 stepSheetFlags;
u32 flagsSheetsOff;
const u32* flagsSheets;
u32 sheetOffsetsSize;
u16* sheetOffsetsScratch;
u32 sheetOffsetsScratchSize;
sheetGlyphCount = font->glgr.inner.sheetGlyphCount; // 0x1C
dataBlockCount = font->hdr.dataBlocks; // 0x0E
// countName = font->glgr.inner.nameCount;
countSheet = font->glgr.inner.sheetCount;
// count0A = font->glgr.inner.smthCount_0x0a;
// count0C = font->glgr.inner.smthCount_0x0c;
stepSheetFlags = detail::CalcSizeFlagSet(countSheet);
flagsSheetsOff = detail::CalcOffsetSheetFlags(font->glgr.inner.nameCount, countSheet, font->glgr.inner.smthCount_0x0a,
font->glgr.inner.smthCount_0x0c);
flagsSheets = (const u32*)font + (flagsSheetsOff >> 2);
sheetOffsetsSize = ROUNDUP(countSheet * sizeof(u16), 4);
sheetOffsetsSize = (RoundUp)(countSheet * sizeof(u16), 4);
sheetOffsetsScratch = (u16*)ROUNDDOWN((u32)((u8*)font + ctx->remWorkSpace()) - sheetOffsetsSize, 2);
pGlgr = (HeaderedGlyphGroups*)&font->glgr;
ENSURE_WORK_HAS_SIZE(ctx, glgrEnd - (u8*)font + sheetOffsetsSize);
// if (ctx->pWorkEnd - workCurr < fontSizeToEndOfGlgr + sheetOffsetsSize) {
// return CONSTRUCT_STATE_FATAL_ERR;
// }
// Clear sheet offsets scratch
// for (s32 i = 0; i < pGlgr->inner.sheetCount; i++) {
// sheetOffsetsScratch[i] = 0;
// }
{
u16* sheetOffset;
int sheetIndex;
for (sheetIndex = 0, sheetOffset = sheetOffsetsScratch; sheetIndex < gg.GetNumSheet(); sheetOffset++, sheetIndex++) {
*sheetOffset = 0;
}
for (groupIndex = 0; groupIndex < gg.GetNumSet(); groupIndex++) {
const char* includedGroups = ctx->pIncludedGroups;
const char* name = gg.GetSetName(groupIndex);
if (*includedGroups && !ArchiveFontBase::IncludeName(includedGroups, name)) {
continue;
}
for (int sheetIndex = 0; sheetIndex < gg.GetNumSheet(); sheetIndex++) {
if (gg.IsUseSheet(groupIndex, sheetIndex)) {
sheetOffsetsScratch[sheetIndex] = 1;
}
}
}
}
// for (s32 i = 0; i < pGlgr->inner.nameCount; i++) {
// // const char* includedGroups = ctx->pIncludedGroups;
// u16 offset = pGlgr->inner.nameOffsets[i];
// const char* name = (char*)((u8*)font + offset);
// if (*ctx->pIncludedGroups != 0) {
// if (!ArchiveFontBase::IncludeName(ctx->pIncludedGroups, name)) {
// continue;
// }
// }
// updateSheetFlags(pGlgr, i, sheetOffsetsScratch, stepSheetFlags, flagsSheets);
// }
setSheetOffsetBooleans(ctx, pGlgr, font, sheetOffsetsScratch, flagsSheets, stepSheetFlags);
// u16 glyphIdxOffset = 0;
// for (s32 i = 0; i < pGlgr->inner.sheetCount; i++) {
// if (sheetOffsetsScratch[i] == 1) {
// sheetOffsetsScratch[i] = glyphIdxOffset;
// } else {
// sheetOffsetsScratch[i] = -1;
// glyphIdxOffset += pGlgr->inner.sheetGlyphCount;
// }
// }
convertSheetOffsetBooleansToOffsets(pGlgr, sheetOffsetsScratch);
sheetOffsetsScratchSize = (u32)countSheet << 1;
sheetOffsetsScratchSize += (sheetOffsetsScratchSize >> 31);
sheetOffsetsScratchSize &= ~1;
copyFlagOffsets(ctx, sheetOffsetsScratch, sheetOffsetsSize, sheetOffsetsScratchSize);
copyFlagOffsets(ctx, sheetOffsetsScratch, sheetOffsetsSize, sheetOffsetsScratch + (u16)countSheet);
ctx->mSheetCount = countSheet;
ctx->mGlyphsPerSheet = sheetGlyphCount;

View File

@@ -15,55 +15,8 @@ static void readHuffmanLimit(const TMCHuffmanEntry* entries, TMCHuffmanEntry* li
limit->symbol = entries->symbol;
}
static inline s32 decodeLongHuffman(s32 bitCount, const TMCHuffmanEntry* table, const u8* symbols, TMCCJPEGDecWork* work, TMCHuffmanEntry* limit, TMCHuffmanEntry* decoded) {
u32 bitData;
u32 code;
u32 length;
const TMCHuffmanEntry* entry;
if (bitCount <= 17) {
s32 result = TMCJPEGDEC_load_buff(work);
if (result < 0) {
return result;
}
}
bitCount = work->bitCount;
bitData = work->bitBuf;
bitCount -= 9;
code = (bitData >> bitCount) & 0x1FF;
work->bitCount = bitCount;
length = 9;
entry = table + 9;
goto read_entry;
while (1) {
length++;
entry++;
if (length > 16) {
return TMCC_ERROR_OVERFLOW;
}
bitCount = work->bitCount;
code <<= 1;
bitData = work->bitBuf;
bitCount--;
work->bitCount = bitCount;
code |= (bitData >> bitCount) & 1;
read_entry:
{
readHuffmanLimit(entry, limit);
*decoded = *limit;
if (code > (u32)decoded->bitLength) {
continue;
}
{
u32 relativeCode = code - entry->bitLength;
u32 symbolIndex = relativeCode + entry->symbol;
return symbols[symbolIndex & 0xFF];
}
}
}
}
static inline s32 decodeACHuffman(s32 bitCount, const TMCHuffmanEntry* entry, const u8* symbols, TMCCJPEGDecWork* work, TMCHuffmanEntry* limit, TMCHuffmanEntry* decoded) {
static inline s32 decodeLongHuffman(s32 bitCount, u32* huff_tbl, u8* symbols, TMCCJPEGDecWork* work, TMCHuffmanEntry* limit, TMCHuffmanEntry* decoded) {
u16* entry;
u32 bitData;
u32 code;
u32 length;
@@ -75,16 +28,16 @@ static inline s32 decodeACHuffman(s32 bitCount, const TMCHuffmanEntry* entry, co
}
}
bitCount = work->bitCount;
entry = (u16*)(huff_tbl + 9);
bitData = work->bitBuf;
length = 9;
bitCount -= 9;
code = (bitData >> bitCount) & 0x1FF;
work->bitCount = bitCount;
length = 9;
entry += 9;
goto read_entry;
while (1) {
length++;
entry++;
entry += 2;
if (length > 16) {
return TMCC_ERROR_OVERFLOW;
}
@@ -96,20 +49,71 @@ static inline s32 decodeACHuffman(s32 bitCount, const TMCHuffmanEntry* entry, co
code |= (bitData >> bitCount) & 1;
read_entry:
{
readHuffmanLimit(entry, limit);
limit->bitLength = entry[0];
limit->symbol = entry[1];
*decoded = *limit;
if (code > (u32)decoded->bitLength) {
continue;
}
{
u32 relativeCode = code - entry->bitLength;
u32 symbolIndex = relativeCode + entry->symbol;
u32 relativeCode = code - limit->bitLength;
u32 symbolIndex = relativeCode + limit->symbol;
return symbols[symbolIndex & 0xFF];
}
}
}
}
static inline s32 decodeACHuffman(s32 bitCount, u32* huff_tbl, u8* symbols, TMCCJPEGDecWork* work, TMCHuffmanEntry* limit, TMCHuffmanEntry* decoded) {
u16* entry;
u32 bitData;
u32 code;
u32 length;
if (bitCount <= 17) {
s32 result = TMCJPEGDEC_load_buff(work);
if (result < 0) {
return result;
}
}
bitCount = work->bitCount;
entry = (u16*)(huff_tbl + 9);
bitData = work->bitBuf;
length = 9;
bitCount -= 9;
code = (bitData >> bitCount) & 0x1FF;
work->bitCount = bitCount;
goto read_entry;
while (1) {
length++;
entry += 2;
if (length > 16) {
return TMCC_ERROR_OVERFLOW;
}
bitCount = work->bitCount;
code <<= 1;
bitData = work->bitBuf;
bitCount--;
work->bitCount = bitCount;
code |= (bitData >> bitCount) & 1;
read_entry:
{
limit->bitLength = entry[0];
limit->symbol = entry[1];
*decoded = *limit;
if (code > (u32)decoded->bitLength) {
continue;
}
{
u32 relativeCode = code - limit->bitLength;
u32 symbolIndex = relativeCode + limit->symbol;
return symbols[symbolIndex & 0xFF];
}
}
}
}
s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_ptr, TMCCJPEGDecWork* work) {
TMCHuffmanEntry dcEntry;
TMCHuffmanEntry dcDecoded;
@@ -117,7 +121,7 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
TMCHuffmanEntry acDecoded;
TMCHuffmanEntry acLimit;
u8* huff_sym;
const TMCHuffmanEntry* ac_fast;
u16* ac_fast;
s32 idx;
u32* huff_tbl;
s32 bit_pos;
@@ -130,11 +134,13 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
s32 t;
s32 zz;
s32 q;
const TMCHuffmanEntry* dc_fast;
u16* dc_fast;
const u8* zztbl;
s32* conv_row;
conv_row = (s32*)conv_row_ptr;
bit_pos = work->bitCount;
dc_fast = (const TMCHuffmanEntry*)work->pDCFast;
dc_fast = work->pDCFast;
if (bit_pos <= 8) {
r = TMCJPEGDEC_load_buff(work);
@@ -146,7 +152,7 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
bit_pos = work->bitCount;
bit_data = work->bitBuf;
{
dcEntry = readHuffmanEntry(dc_fast, (bit_data >> (bit_pos - 8)) & 0xFF);
dcEntry = readHuffmanEntry((const TMCHuffmanEntry*)dc_fast, (bit_data >> (bit_pos - 8)) & 0xFF);
r = dcEntry.bitLength;
extra = dcEntry.symbol;
}
@@ -157,30 +163,28 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
} else {
huff_sym = work->pDCHuffSym;
huff_tbl = work->pDCHuffTbl;
r = decodeLongHuffman(bit_pos, (const TMCHuffmanEntry*)huff_tbl, huff_sym, work, &dcLimit, &dcDecoded);
r = decodeLongHuffman(bit_pos, huff_tbl, huff_sym, work, &dcLimit, &dcDecoded);
if (r < 0) {
return r;
}
}
blk0 = ((s32*)conv_row_ptr)[0];
blk0 = conv_row[0];
if (r != 0) {
bit_pos = work->bitCount;
if (bit_pos <= r) {
s32 load_ret = TMCJPEGDEC_load_buff(work);
if (load_ret < 0) {
if (work->bitCount <= r) {
s32 load_ret;
if (load_ret = TMCJPEGDEC_load_buff(work), load_ret < 0) {
return load_ret;
}
}
bit_pos = work->bitCount;
bit_data = work->bitBuf;
tmp = 1 << r;
extra = tmp - 1;
bit_pos -= r;
tmp = 1UL << r;
bit_pos = work->bitCount - r;
work->bitCount = bit_pos;
bit_data = work->bitBuf;
extra = tmp - 1;
extra = extra & (bit_data >> bit_pos);
if (((s32)tmp >> 1) > extra) {
extra -= tmp - 1;
extra -= (tmp - 1);
}
dc_predict_row_ptr[0] += extra;
}
@@ -188,7 +192,7 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
*block = dc_predict_row_ptr[0] * blk0;
{
ac_fast = (const TMCHuffmanEntry*)work->pACFast;
ac_fast = work->pACFast;
huff_tbl = work->pACHuffTbl;
huff_sym = work->pACHuffSym;
@@ -206,7 +210,7 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
zztbl = TMCJPEGDEC_Zigzag_data;
bit_data = work->bitBuf;
t = bit_pos - 8;
acEntry = readHuffmanEntry(ac_fast, (bit_data >> t) & 0xFF);
acEntry = readHuffmanEntry((const TMCHuffmanEntry*)ac_fast, (bit_data >> t) & 0xFF);
do {
s32 ac_thresh = acEntry.bitLength;
@@ -217,7 +221,7 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
r = acEntry.symbol;
} else {
bit_pos = work->bitCount;
r = decodeACHuffman(bit_pos, (const TMCHuffmanEntry*)huff_tbl, huff_sym, work, &acLimit, &acDecoded);
r = decodeACHuffman(bit_pos, huff_tbl, huff_sym, work, &acLimit, &acDecoded);
if (r < 0) {
return r;
}
@@ -241,19 +245,18 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
return r;
}
}
bit_pos = work->bitCount;
tmp = 1 << t;
tmp = 1UL << t;
bit_pos = work->bitCount - t;
work->bitCount = bit_pos;
bit_data = work->bitBuf;
extra = tmp - 1;
bit_pos -= t;
work->bitCount = bit_pos;
t = bit_pos - 8;
extra = extra & (bit_data >> bit_pos);
q = ((s32*)conv_row_ptr)[(u8)zz];
acEntry = readHuffmanEntry(ac_fast, (bit_data >> t) & 0xFF);
t = bit_pos - 8;
q = conv_row[(u8)zz];
acEntry = readHuffmanEntry((const TMCHuffmanEntry*)ac_fast, (bit_data >> t) & 0xFF);
if (((s32)tmp >> 1) > extra) {
extra -= tmp - 1;
extra -= (tmp - 1);
}
block[(u8)zz] = extra * q;
@@ -274,7 +277,7 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
bit_pos = work->bitCount;
t = bit_pos - 8;
tmp = ((bit_data >> t) & 0xFF) << 2;
acEntry = readHuffmanEntry(ac_fast, tmp >> 2);
acEntry = readHuffmanEntry((const TMCHuffmanEntry*)ac_fast, tmp >> 2);
idx += 16;
}

View File

@@ -92,18 +92,20 @@ void TMCJPEGDEC_IdctBlock_Lumi(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigz
dst[0] = val;
} else {
s32 oddLowSum;
s32 oddLowDifference;
s32 oddHighSum;
s32 oddHighDifference;
s32 dcValue;
t = b2 - b6;
oddLowSum = b5 + b3;
b5 = b5 - b3;
oddLowDifference = b5 - b3;
oddHighSum = b1 + b7;
b1 = b1 - b7;
oddHighDifference = b1 - b7;
u = b6 + b2;
t = t * 0xB5 >> 8;
x_factor = oddHighSum - oddLowSum;
z_factor = b5 + b1;
z_factor = oddLowDifference + oddHighDifference;
dcValue = block[0];
a = dcValue - b4;
x = x_factor * 0xB5 >> 8;
@@ -113,14 +115,14 @@ void TMCJPEGDEC_IdctBlock_Lumi(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigz
z = z_factor * 0x62 >> 8;
w = d + u;
y = d - u;
m_part = b1 * 0x14E >> 8;
m_part = oddHighDifference * 0x14E >> 8;
e = a - t;
m = m_part - z;
oddLowSum += m;
n = oddHighSum + oddLowSum;
o = x + m;
dst[0] = w + n;
p_part = b5 * 0x8B;
p_part = oddLowDifference * 0x8B;
dst[7] = w - n;
p_part >>= 8;
dst[1] = v + o;

View File

@@ -3,7 +3,7 @@
#include <tmc_jpeg_internal.h>
static s32 TMCJPEGDEC_exif_parse(const u8* data, u32 size, TMCCJPEGDecExifData* pInfo);
static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder, const u8* entry);
static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder, u8* entry);
static void TMCJPEGDEC_IFD1_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder, const u8* entry);
static s32 TMCJPEGDEC_ThumbnailCheck(TMCCJPEGDecInitParam* param, TMCCJPEGDecExifInfo* info, u32 totalSize);
@@ -280,7 +280,7 @@ static s32 TMCJPEGDEC_exif_parse(const u8* data, u32 size, TMCCJPEGDecExifData*
return -161;
}
for (index = 0; index < count; index++) {
TMCJPEGDEC_IFD0_tag_parse(pInfo, byteOrder, entries);
TMCJPEGDEC_IFD0_tag_parse(pInfo, byteOrder, (u8*)entries);
entries += 12;
}
remaining -= entriesSize;
@@ -331,19 +331,19 @@ static s32 TMCJPEGDEC_exif_parse(const u8* data, u32 size, TMCCJPEGDecExifData*
return -161;
}
for (index = 0; index < count; index++) {
TMCJPEGDEC_IFD0_tag_parse(pInfo, byteOrder, entries);
TMCJPEGDEC_IFD0_tag_parse(pInfo, byteOrder, (u8*)entries);
entries += 12;
}
}
return 0;
}
static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder, const u8* entry) {
static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder, u8* entry) {
s32 tag;
u16 type;
u32 type;
tag = readU16(entry, byteOrder);
type = readU16(entry + 2, byteOrder);
tag = readExifU16(entry, byteOrder);
type = readExifU16(entry + 2, byteOrder);
switch (tag) {
case 0x0103:
@@ -366,7 +366,7 @@ static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
return;
}
pInfo->xResNum = readU32(p, byteOrder);
p = (const u8*)(pInfo->thumbnailData + offset + 4);
p = pInfo->thumbnailData + (offset + 4);
if (pInfo->thumbnailData > p) {
return;
}
@@ -386,7 +386,7 @@ static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
return;
}
pInfo->yResNum = readU32(p, byteOrder);
p = (const u8*)(pInfo->thumbnailData + offset + 4);
p = pInfo->thumbnailData + (offset + 4);
if (pInfo->thumbnailData > p) {
return;
}
@@ -501,6 +501,10 @@ static void TMCJPEGDEC_IFD1_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
case 0x8769:
case 0x9000:
case 0x9101:
case 0x011C:
case 0xA000:
case 0xA001:
case 0xA002:
case 0xA003: {
break;
}
@@ -516,7 +520,7 @@ static void TMCJPEGDEC_IFD1_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
return;
}
pInfo->xResNumIfd1 = readU32(p, byteOrder);
p = (const u8*)(pInfo->thumbnailData + offset + 4);
p = pInfo->thumbnailData + (offset + 4);
if (pInfo->thumbnailData > p) {
return;
}
@@ -538,7 +542,7 @@ static void TMCJPEGDEC_IFD1_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
return;
}
pInfo->planarConfigIfd1 = readU32(p, byteOrder);
p = (const u8*)(pInfo->thumbnailData + offset + 4);
p = pInfo->thumbnailData + (offset + 4);
if (pInfo->thumbnailData > p) {
return;
}

View File

@@ -816,7 +816,6 @@ static void TMCJPEGDEC_converterYUV444toRGB565(TMCCJPEGDecWork* work, s32 x, s32
u8* luminance;
u8* cb;
u8* cr;
s32 value;
s32 column;
s32 xEnd;
s32 cbValue;
@@ -844,17 +843,17 @@ static void TMCJPEGDEC_converterYUV444toRGB565(TMCCJPEGDecWork* work, s32 x, s32
for (column = x; column < xEnd; column++) {
cbValue = (s8)*cb++;
crValue = (s8)*cr++;
value = *luminance++;
green = value + (-(cbValue * 88 + crValue * 183) >> 8);
red = value + ((crValue * 359) >> 8);
blue = value + ((cbValue * 454) >> 8);
red = *luminance++;
green = red + (-(cbValue * 88 + crValue * 183) >> 8);
blue = red + ((cbValue * 454) >> 8);
red = red + ((crValue * 359) >> 8);
if ((blue | green | red) >> 8) {
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
green = green > 255 ? 255 : green < 0 ? 0 : green;
red = red > 255 ? 255 : red < 0 ? 0 : red;
}
output[(column & 3) + (((column >> 2) + tileRow) << 4)] =
((blue & 0xF8) >> 3) + ((red & 0xF8) << 8) + ((green & 0xFC) << 3);
((blue & 0xF8) >> 3) + (((red & 0xF8) << 8) + ((green & 0xFC) << 3));
}
luminance += rowSkip;
cb += rowSkip;

View File

@@ -656,10 +656,10 @@ static void TMCJPEGDEC_converterYUV420toRGBA8edge(TMCCJPEGDecWork* work, s32 x,
blueOffset = (cbValue * 454) >> 8;
}
{
s32 value = *luminance++;
s32 green = value + greenOffset;
s32 red = value + redOffset;
s32 blue = value + blueOffset;
s32 red = *luminance++;
s32 green = red + greenOffset;
s32 blue = red + blueOffset;
red = red + redOffset;
if ((green | red | blue) >> 8) {
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
green = green > 255 ? 255 : green < 0 ? 0 : green;

View File

@@ -195,7 +195,7 @@ typedef struct _zi8DawgCtx {
ziU8* table; // 0x10
ziU8* p14; // 0x14
zi8DawgRec recs[0x32]; // 0x18
ziU32 unk_0x338; // 0x338
ziU32 endNode; // 0x338
} zi8DawgCtx;
typedef struct _ziUwdNode {
@@ -221,7 +221,7 @@ struct __zi8_work_data_s {
ziU8 unk_0x19;
ziU16 separator; // 0x1A
ziU8 unk_0x1C[3];
ziU8 unk_0x1F;
ziU8 ignoreCase;
ziU16 unk_0x20[0x40];
ziU16 unk_0xA0[0x42];
ziU16* unk_0x124[1];

View File

@@ -311,21 +311,21 @@ Zi8UInt Zi8SpellingPY(ziU16 *output,Zi8UInt key,ziU8 includeTone)
return length;
}
ziU8 Zi8IsMatch1Key(ziU16 *input,Zi8UInt inputLength,Zi8UInt key,ziU8 requireFull,ziU8 usePinyin,ziU8 tone)
ziU8 Zi8IsMatch1Key(ziU16 *input,Zi8UInt inputLength,ziU16 key,ziU8 requireFull,ziU8 usePinyin,ziU8 tone)
{
ziU16 spelling[16];
Zi8UInt spellingLength;
if ((key & 0xffff) == 0) {
if (key == 0) {
return 0;
}
if ((inputLength & 0xff) == 0) {
return 1;
}
if (usePinyin != 0) {
spellingLength = Zi8SpellingPY(spelling,key & 0xffff,tone & 0xff);
spellingLength = Zi8SpellingPY(spelling,key,tone & 0xff);
} else {
spellingLength = Zi8SpellingZY(spelling,key & 0xffff,tone & 0xff);
spellingLength = Zi8SpellingZY(spelling,key,tone & 0xff);
}
if ((requireFull != 0) && ((inputLength & 0xff) != (spellingLength & 0xff))) {
return 0;
@@ -1327,7 +1327,7 @@ int Zi8Get1KeyPressCandidates(Zi8OneKeyParam *params,Zi8OneKeyOptions *options,Z
}
if (elementIndex == 0) continue;
if (!emitWords) {
if (trackDuplicates && Zi8SetFindCand(params->scratch,candidateOrdinal,work) != 0) continue;
if (trackDuplicates && (ziU8)Zi8SetFindCand(params->scratch,candidateOrdinal,work) != 0) continue;
for (index = 0; index < candidateCount; index++) {
if (candidateCharacter == output[index]) break;
}
@@ -1396,7 +1396,7 @@ int Zi8Get1KeyPressCandidates(Zi8OneKeyParam *params,Zi8OneKeyOptions *options,Z
}
if (elementIndex == 0) continue;
if (!emitWords) {
if (trackDuplicates && Zi8SetFindCand(params->scratch,candidateOrdinal,work) != 0) continue;
if (trackDuplicates && (ziU8)Zi8SetFindCand(params->scratch,candidateOrdinal,work) != 0) continue;
for (index = 0; index < candidateCount; index++) {
if (candidateCharacter == output[index]) break;
}
@@ -1519,7 +1519,7 @@ int Zi8Get1KeyPressCandidates(Zi8OneKeyParam *params,Zi8OneKeyOptions *options,Z
}
if (elementIndex == 0) goto nextPhrase;
if (!emitWords) {
if (trackDuplicates && Zi8SetFindCand(params->scratch,phraseCharacter,work) != 0) goto nextPhrase;
if (trackDuplicates && (ziU8)Zi8SetFindCand(params->scratch,phraseCharacter,work) != 0) goto nextPhrase;
for (index = 0; index < candidateCount; index++) {
if (firstOrdinal == output[index]) goto nextPhrase;
}
@@ -1601,7 +1601,7 @@ finishPhrases:
}
if (elementIndex == 0) goto nextSortedOrdinal;
if (!emitWords) {
if (trackDuplicates && Zi8SetFindCand(params->scratch,ordinal,work) != 0) goto nextSortedOrdinal;
if (trackDuplicates && (ziU8)Zi8SetFindCand(params->scratch,ordinal,work) != 0) goto nextSortedOrdinal;
ordinal = Zi8Ord2Uni(ordinal,work);
for (index = 0; index < candidateCount; index++) {
if (ordinal == output[index]) break;
@@ -1629,11 +1629,11 @@ nextSortedOrdinal:
;
}
}
if ((options->countOnly == '\0') && Zi8GetZHuwdPtr(&userEntries,&userCount,work) != 0)
if ((options->countOnly == '\0') && (ziU8)Zi8GetZHuwdPtr(&userEntries,&userCount,work) != 0)
{
for (phraseOrdinal = 0; phraseOrdinal < userCount;) {
if ((params->elementCount == '\0') || ((userEntries[1] & 0x80) != 0)) {
userOrdinal = (userEntries[1] & 0x7f) << 8 | (ziU16)userEntries[2];
userOrdinal = (ziU16)(userEntries[1] & 0x7f) << 8 | (ziU16)userEntries[2];
phraseTable = syllableTable + (Zi8UInt)userOrdinal * 0xc;
if (((*phraseTable & languageMask) != 0) &&
((characterSetTable == 0 || ((characterSet & characterSetTable[(Zi8UInt)userOrdinal]) != 0)))) {
@@ -1654,7 +1654,7 @@ nextSortedOrdinal:
}
if (elementIndex == 0) goto nextUserOrdinal;
if (!emitWords) {
if (trackDuplicates && Zi8SetFindCand(params->scratch,userOrdinal,work) != 0) goto nextUserOrdinal;
if (trackDuplicates && (ziU8)Zi8SetFindCand(params->scratch,userOrdinal,work) != 0) goto nextUserOrdinal;
userCharacter = Zi8Ord2Uni(userOrdinal,work);
for (duplicateIndex = 0; duplicateIndex < candidateCount; duplicateIndex++) {
if (userCharacter == output[duplicateIndex]) break;
@@ -1710,7 +1710,7 @@ nextUserOrdinal:
if (unicodeCharacter == previousCharacter) goto nextOrdinal;
previousCharacter = unicodeCharacter;
if (!emitWords) {
if (trackDuplicates && Zi8SetFindCand(params->scratch,ordinal,work) != 0) goto nextOrdinal;
if (trackDuplicates && (ziU8)Zi8SetFindCand(params->scratch,ordinal,work) != 0) goto nextOrdinal;
for (index = 0; index < candidateCount; index++) {
if (unicodeCharacter == output[index]) break;
}
@@ -1738,8 +1738,7 @@ nextOrdinal:
}
finishCandidates:
if ((emitWords) && (outputIndex != 0)) {
output[outputIndex] = 0;
outputIndex++;
output[outputIndex++] = 0;
}
params->count = candidateCount;
Zi8LogError(100,work);

View File

@@ -920,8 +920,7 @@ selectDictionary:
if ((((wordLength == 0) && (*punctuationCursor != 0)) && (dictionaryExact != 0)) &&
((((ZiAlphaWork*)workData)->singleCharacter != 0 && (parameters->elementCount == 2)))) {
*wordCursor = ((ZiAlphaWork*)workData)->singleCharacter;
wordCursor[1] = *punctuationCursor;
punctuationCursor = punctuationCursor + 1;
wordCursor[1] = *punctuationCursor++;
wordCursor[2] = 0;
wordLength = 2;
}
@@ -1068,7 +1067,7 @@ filterVowelCandidate:
(((ZiAlphaWork*)workData)->requiredLength != parameters->elementCount)) &&
(((((ZiAlphaWork*)workData)->prefixLength == '\0' ||
(((ZiAlphaWork*)workData)->prefixLength + 1 >= parameters->elementCount)) && (dictionaryExact != 0)))
))) && ((((completionAllowed && (prefixCount == 0)) && (dictionaryKind != 0xb)) &&
))) && ((((currentVowelRestriction && (prefixCount == 0)) && (dictionaryKind != 0xb)) &&
((((int)dictionaryIndex < (int)(unsigned int)((ZiAlphaWork*)workData)->dictionaryCount &&
(((ZiAlphaOptions*)optionData)->lookupMode == '\0')) &&
(((ZiAlphaWork*)workData)->dictionaries[language] == 0)))))) {
@@ -1084,7 +1083,7 @@ filterVowelCandidate:
goto retryDictionary;
}
}
if ((((((dictionaryExact == 0) || (!completionAllowed)) || (prefixCount != 0)) ||
if ((((((dictionaryExact == 0) || (!currentVowelRestriction)) || (prefixCount != 0)) ||
((dictionaryKind == 0xb ||
(dictionaryIndex >= ((ZiAlphaWork*)workData)->dictionaryCount)))) ||
(elements == 0)) ||
@@ -1139,7 +1138,7 @@ prepareCandidate:
Zi8ChangeWordCase(wordCursor - prefixCount,language,workData);
}
if ((((ZiAlphaOptions*)optionData)->suffixOnly != '\0') &&
((int)((ZiAlphaOptions*)optionData)->maxWordLength < (int)(wordLength + prefixCount))) {
((wordLength + prefixCount) > ((ZiAlphaOptions*)optionData)->maxWordLength)) {
wordLength = ((ZiAlphaOptions*)optionData)->maxWordLength - prefixCount;
wordCursor[wordLength] = 0;
}
@@ -1208,16 +1207,14 @@ emitCandidate:
if (((ZiAlphaOptions*)optionData)->maxResults <= candidateCount) goto finishCandidates;
} else {
if (((ZiAlphaOptions*)optionData)->lookupMode != '\0') {
for (index = 0;
(index <= (int)wordLength &&
(wordCursor[index] == ((ZiAlphaOptions*)optionData)->dictionary[index]));
index = index + 1) {
for (index = 0; index <= wordLength; index++) {
if (wordCursor[index] != ((ZiAlphaOptions*)optionData)->dictionary[index]) break;
}
if ((((((ZiAlphaWork*)workData)->operation != '\0') || ((int)wordLength <= index))
if ((((((ZiAlphaWork*)workData)->operation != '\0') || (index >= wordLength))
&& ((((ZiAlphaWork*)workData)->operation == '\0' ||
((exactLengthOnly == 0 ||
((int)(ziU16)Zi8WCharCount(((ZiAlphaOptions*)optionData)->dictionary,workData) <= index)))))) &&
((exactLengthOnly != 0 || ((int)wordLength <= index)))) {
(index >= (int)(ziU16)Zi8WCharCount(((ZiAlphaOptions*)optionData)->dictionary,workData))))))) &&
((exactLengthOnly != 0 || (index >= wordLength)))) {
candidateCount = 1;
goto finishCandidates;
}
@@ -1367,7 +1364,7 @@ emitCandidate:
}
}
retryDictionary:;
} while (dictionaryKind != 0);
} while (dictionaryIndex != 0);
}
finishDictionaryPass:;
}
@@ -1376,27 +1373,23 @@ finishDictionaryPass:;
(((parameters->elementCount == 1 &&
(((Zi8GetTableCount(parameters->language,0x1f,workData)) & 0x40) == 0)) &&
(*parameters->elements >= 0xeff1)))))) &&
((*parameters->elements < 0xf011 &&
((*parameters->elements <= 0xf010 &&
((Zi8getKeyLayout(parameters->language,*parameters->elements,&punctuationBuffer[0],1,workData)) != '\0')))) {
punctuationCandidate = ZI8_TRUE;
}
if (((candidateCount == 0) && (punctuationCandidate)) && (firstCandidate == 0)) {
candidateCount = 1;
if ((((ZiAlphaOptions*)optionData)->countOnly == '\0') && ((parameters->getOptions & 0xfd) != 0x81)) {
*encodedOutput = 0x3e;
encodedOutput[2] = 0;
encodedOutput[1] = 0;
}
else {
if (((ZiAlphaOptions*)optionData)->countOnly != 0 || (parameters->getOptions & 0xFD) == 0x81) {
if (parameters->getMode == 1) {
*wordCursor = *elements;
} else {
*wordCursor = 0x3E;
}
else {
*wordCursor = 0x3e;
}
wordCursor[2] = 0;
wordCursor[1] = 0;
wordCursor = wordCursor + 2;
wordCursor[1] = wordCursor[2] = 0;
wordCursor += 2;
} else {
*encodedOutput = 0x3E;
encodedOutput[1] = encodedOutput[2] = 0;
}
if (((ZiAlphaOptions*)optionData)->lookupMode == '\0') {
((ZiAlphaWork*)workData)->singleCharacter = 0;
@@ -1406,13 +1399,13 @@ finishDictionaryPass:;
secondLanguagePass = ZI8_TRUE;
languagePassCount = 0;
language = parameters->subLanguage;
completionAllowed = secondaryCompletionAllowed;
currentVowelRestriction = secondaryVowelRestriction;
dictionaryStatus[9] = 0;
dictionaryStatus[5] = 0;
dictionaryStatus[6] = 0;
dictionaryStatus[7] = 0;
dictionaryStatus[8] = 0;
completionAllowed = secondaryCompletionAllowed;
currentVowelRestriction = secondaryVowelRestriction;
if (switchedLanguage) {
secondLanguagePass = ZI8_FALSE;
dictionaryStatus[1] = 0;
@@ -1426,14 +1419,15 @@ finishDictionaryPass:;
if (language == 0) {
language = parameters->language;
}
completionAllowed = secondaryCompletionAllowed;
currentVowelRestriction = secondaryVowelRestriction;
if (language == parameters->language) {
completionAllowed = primaryCompletionAllowed;
currentVowelRestriction = primaryVowelRestriction;
} else {
completionAllowed = secondaryCompletionAllowed;
currentVowelRestriction = secondaryVowelRestriction;
}
if ((((ZiAlphaOptions*)optionData)->lookupMode != '\0') || ((!currentVowelRestriction && (!completionAllowed)))) goto finishCandidates;
if ((completionAllowed) &&
if ((((ZiAlphaOptions*)optionData)->lookupMode != '\0') || ((!completionAllowed && (!currentVowelRestriction)))) goto finishCandidates;
if ((currentVowelRestriction) &&
((((((ZiAlphaWork*)workData)->suffixMode == '\0' && (2 < (int)elementCount)) &&
(elements[elementCount - 2] == 0xeff1)) &&
((int)((ZiAlphaWork*)workData)->prefixCount == elementCount - 2)))) {
@@ -1444,66 +1438,65 @@ finishDictionaryPass:;
prefixPrepared = ZI8_TRUE;
goto preparePrefix;
}
if (!((((completionAllowed) && (((ZiAlphaWork*)workData)->suffixMode != '\0')) &&
((((ZiAlphaWork*)workData)->suffixLocked == '\0' && (2 < (int)elementCount)))) &&
(((elements[elementCount - 2] == 0xeff1 &&
((int)((ZiAlphaWork*)workData)->suffixCount == elementCount - 2)) ||
(((int)((ZiAlphaWork*)workData)->suffixCount == elementCount - 1 &&
((Zi8IsAlphaPunct(elements[elementCount - 1])) != '\0'))))))) {
tryAlternatePrefix:
if ((prefixPrepared) && (1 < ((ZiAlphaWork*)workData)->alternatePrefixCount)) {
if (language == parameters->language) {
if (primaryMatched) {
((ZiAlphaWork*)workData)->alternatePrefixCount = 0;
}
}
else if (secondaryMatched) {
((ZiAlphaWork*)workData)->alternatePrefixCount = 0;
}
if (((ZiAlphaWork*)workData)->alternatePrefixCount != '\0') {
if (currentVowelRestriction && ((ZiAlphaWork*)workData)->suffixMode != 0 &&
((ZiAlphaWork*)workData)->suffixLocked == 0 && elementCount > 2 &&
((elements[elementCount - 2] == 0xEFF1 &&
((ZiAlphaWork*)workData)->suffixCount == elementCount - 2) ||
(((ZiAlphaWork*)workData)->suffixCount == elementCount - 1 &&
Zi8IsAlphaPunct(elements[elementCount - 1]) != 0))) {
if (((ZiAlphaWork*)workData)->prefixEnabled >= 1 && elements[elementCount - 1] == 0xEFF1) {
goto checkPrefixPunctuation;
}
if (!primaryMatched && !secondaryMatched) {
((ZiAlphaWork*)workData)->suffixLocked = 1;
((ZiAlphaWork*)workData)->suffixElementCount = parameters->elementCount - 1;
if (prefixCount != 0) {
wordCursor -= prefixCount;
elements -= prefixCount;
elementCount = elementCount + prefixCount;
wordCapacity = wordCapacity + prefixCount;
prefixCount = 0;
prefixPrepared = ZI8_FALSE;
((ZiAlphaWork*)workData)->suffixMode = 0;
((ZiAlphaWork*)workData)->suffixLocked = 0;
((ZiAlphaWork*)workData)->suffixCount = 0;
for (index = 0; index < (int)(unsigned int)((ZiAlphaWork*)workData)->alternatePrefixCount; index = index + 1) {
((ZiAlphaWork*)workData)->prefix[index] =
((ZiAlphaWork*)workData)->alternatePrefix[index];
}
((ZiAlphaWork*)workData)->prefixCount = (ziU8)index;
if (((ZiAlphaWork*)workData)->language == parameters->language) {
((ZiAlphaWork*)workData)->language = parameters->subLanguage;
}
else {
((ZiAlphaWork*)workData)->language = parameters->language;
}
}
goto preparePrefix;
}
}
if ((prefixPrepared) && (1 < ((ZiAlphaWork*)workData)->alternatePrefixCount)) {
if (language == parameters->language) {
if (primaryMatched) {
((ZiAlphaWork*)workData)->alternatePrefixCount = 0;
}
}
if ((((primaryMatched) && (secondaryMatched)) || (elementCount == 0)) ||
(((language == parameters->language && (primaryMatched)) || ((language == parameters->subLanguage && (secondaryMatched))))))
goto finishCandidates;
if (completionAllowed) goto checkPrefixPunctuation;
} else {
if ((((ZiAlphaWork*)workData)->prefixEnabled == '\0') || (elements[elementCount - 1] != 0xeff1)) {
if ((!primaryMatched) && (!secondaryMatched)) {
((ZiAlphaWork*)workData)->suffixLocked = 1;
((ZiAlphaWork*)workData)->suffixElementCount = parameters->elementCount - 1;
if (prefixCount != 0) {
wordCursor -= prefixCount;
elements -= prefixCount;
elementCount = elementCount + prefixCount;
wordCapacity = wordCapacity + prefixCount;
prefixCount = 0;
}
goto preparePrefix;
}
goto tryAlternatePrefix;
else if (secondaryMatched) {
((ZiAlphaWork*)workData)->alternatePrefixCount = 0;
}
if (((ZiAlphaWork*)workData)->alternatePrefixCount != '\0') {
wordCursor -= prefixCount;
elements -= prefixCount;
elementCount = elementCount + prefixCount;
wordCapacity = wordCapacity + prefixCount;
prefixCount = 0;
prefixPrepared = ZI8_FALSE;
((ZiAlphaWork*)workData)->suffixMode = 0;
((ZiAlphaWork*)workData)->suffixLocked = 0;
((ZiAlphaWork*)workData)->suffixCount = 0;
for (index = 0; index < (int)(unsigned int)((ZiAlphaWork*)workData)->alternatePrefixCount; index = index + 1) {
((ZiAlphaWork*)workData)->prefix[index] =
((ZiAlphaWork*)workData)->alternatePrefix[index];
}
((ZiAlphaWork*)workData)->prefixCount = (ziU8)index;
if (((ZiAlphaWork*)workData)->language == parameters->language) {
((ZiAlphaWork*)workData)->language = parameters->subLanguage;
}
else {
((ZiAlphaWork*)workData)->language = parameters->language;
}
((ZiAlphaWork*)workData)->alternatePrefixCount = 0;
}
}
if ((((primaryMatched) && (secondaryMatched)) || (elementCount == 0)) ||
(((language == parameters->language && (primaryMatched)) || ((language == parameters->subLanguage && (secondaryMatched))))))
goto finishCandidates;
if (currentVowelRestriction) {
checkPrefixPunctuation:
if ((1 < ((ZiAlphaWork*)workData)->prefixEnabled) &&
(parameters->elements[parameters->elementCount - 1] != 0xEFF1))
@@ -1576,17 +1569,17 @@ checkPrefixFields:
finishCandidates:
((ZiAlphaWork*)workData)->usePrefixAsElements = 0;
if (((ZiAlphaOptions*)optionData)->countOnly == '\0') {
parameters->letters = candidateCount;
if (((ZiAlphaOptions*)optionData)->countOnly != '\0') {
parameters->letters = 0;
}
else {
parameters->letters = 0;
parameters->letters = candidateCount;
}
wordCursor[-prefixCount] = 0;
if (((((ZiAlphaOptions*)optionData)->countOnly == '\0') && (((ZiAlphaOptions*)optionData)->lookupMode == '\0')) && (parameters->elementCount != 0)) {
elementIndex = parameters->elementCount - 1;
if (((primaryVowelRestriction) || (secondaryVowelRestriction)) &&
((((ZiAlphaWork*)workData)->prefixEnabled < 2 ||
((((ZiAlphaWork*)workData)->prefixEnabled <= 1 ||
(parameters->elements[elementIndex] == 0xEFF1)))) {
index = 0;
while (elementIndex >= 0) {

View File

@@ -138,11 +138,11 @@ extern ziU16 Zi8GetTableCount(ziU8 language, ziU8 table, ziPtr work);
extern ziU8 Zi8IsDupWChar(ziWChar character, ziPtr work);
extern ziU8 Zi8IsDupWordW(ziWChar* word, ziU8 length, ziPtr work);
extern ziWChar Zi8Ord2Uni(ziU16 ordinal, ziPtr work);
extern ziU8 Zi8MatchPhonetic(ziU8* phonetics, ZiChineseRecord* records,
ziPtr indexTable, ziU16 indexCount, ziPtr dictionary,
ZiChineseRecord* record, ziU16* mask, ziU16* match,
ziU16* length, ZiChineseRecord** matchedRecord,
int* matchedIndex, ziU8 wordMode, ziU8 partial,
extern ziU8 Zi8MatchPhonetic(ziPtr phonetics, ziU8* records,
ziPtr indexTable, ziU16 indexCount, ziU32 dictionary,
ziU8* record, ziU16* mask, ziU16* match,
ziU16* length, ziU8** matchedRecord,
ziU8** matchedString, ziU8 wordMode, ziU8 partial,
ziU8 oneCharacter, ziU16 excludedMask,
ziU16 excludedMatch, ziU8 charset, ziU8 options,
ziU16 ordinal, ziU16* tone, ziU8 spellingOnly,
@@ -614,10 +614,10 @@ static int zi8InternalGetZH(ziGetParam* request, ZiChineseOptions* options, ziPt
case 56: case 59:
if (((ziFuzzyZYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B2C.word)->fANDh) ordinalIndex = 0xF9FF;
break;
case 52: case 55:
case 60: case 63:
if (((ziFuzzyZYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B2C.word)->bANDp) ordinalIndex = 0xF9FF;
break;
case 60: case 63:
case 52: case 55:
if (((ziFuzzyZYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B2C.word)->gANDk) ordinalIndex = 0xF9FF;
break;
case 38:
@@ -1612,9 +1612,9 @@ phonetic_ordinal_search:
record = records + phraseOrdinal * 12;
candidateCount = 0;
phoneticGroups = 0;
if (!Zi8MatchPhonetic(phoneticTable, (ZiChineseRecord*)records, alternateTable, alternateCount,
phraseTable, (ZiChineseRecord*)record, match.phon, match.phon2,
&candidateCount, (ZiChineseRecord**)&record, (int*)&phoneticGroups,
if (!Zi8MatchPhonetic(phoneticTable, records, alternateTable, alternateCount,
(ziU32)phraseTable, record, match.phon, match.phon2,
&candidateCount, &record, &phoneticGroups,
0, 1, match.nCand, phoneticMask, phoneticMatch, charset, requireFull,
phraseOrdinal, &candidateOrdinal, 0, work)) continue;
if (charsetTable) {
@@ -2323,9 +2323,9 @@ phonetic_ordinals:
candidateCount = recordCount;
phoneticGroups = 0;
while (emittedCount < request->maxCandidates && candidateCount) {
if (!Zi8MatchPhonetic(phoneticTable, (ZiChineseRecord*)records, alternateTable, alternateCount,
phraseTable, (ZiChineseRecord*)record, match.phon, match.phon2,
&candidateCount, (ZiChineseRecord**)&record, (int*)&phoneticGroups,
if (!Zi8MatchPhonetic(phoneticTable, records, alternateTable, alternateCount,
(ziU32)phraseTable, record, match.phon, match.phon2,
&candidateCount, &record, &phoneticGroups,
emitWords, singleCharacterPass, match.nCand, phoneticMask, phoneticMatch, charset,
requireFull, recordCount, &candidateOrdinal, filteringMode, work)) break;
ordinalIndex = recordCount - candidateCount - 1;
@@ -2608,10 +2608,10 @@ static int Zi8NewMatchPhonetic(ziGetParam* request, ZiChineseRecord* records,
ziU8* phonetics;
int totalResults;
int emittedCharacters;
ZiChineseRecord* matchedRecord;
ziU8* matchedRecord;
ziU8* phoneticGroups;
ziU8* candidateGroups;
int matchedIndex;
ziU8* matchedString;
int capacity;
ziU8* groupCandidates;
ziU16 phoneticCount;
@@ -2782,12 +2782,12 @@ next_group_candidate:
}
}
if (stopAfterTone) {
matchedRecord = records + character;
matchedRecord = (ziU8*)(records + character);
matchedLength = 0;
matchedIndex = 0;
if (!Zi8MatchPhonetic(phonetics, records, indexTable, indexCount,
dictionary, matchedRecord, &mask, &match,
&matchedLength, &matchedRecord, &matchedIndex,
matchedString = 0;
if (!Zi8MatchPhonetic(phonetics, (ziU8*)records, indexTable, indexCount,
(ziU32)dictionary, matchedRecord, &mask, &match,
&matchedLength, &matchedRecord, &matchedString,
wordMode, 1, 1, excludedMask, excludedMatch,
charset, request->getOptions & 0x40, character,
&matchedTone, 0, work)) {

View File

@@ -32,7 +32,7 @@ ziU32 Zi8MatchROMdata0(ziWChar* elements, ziU8 count, ziU8 language,
if (language != context->lang || graphTable != context->key) records[0].key = 0;
if (count == 1 && mode != 0 && graphTable == 0xe) goto finish_graph;
if (status != 0) {
if (records[context->cnt - 1].node == (ziU8*)context->unk_0x338) goto finish_graph;
if (records[context->cnt - 1].node == (ziU8*)context->endNode) goto finish_graph;
for (index = 0; index < count; index++) {
if (records[index].key != elements[index] &&
(ziU16)records[index].attr != elements[index]) goto finish_graph;
@@ -82,7 +82,7 @@ check_keys:
records[0].node = ZiDAWGGetGraphInfo(context, keyData, (ziS16*)keys);
} else {
records[0].node = ZiDAWGGetGraph(context);
context->unk_0x338 = 0;
context->endNode = 0;
context->p14 = 0;
}
records[0].key = 0;
@@ -98,7 +98,7 @@ check_keys:
}
searching = 1;
current = &records[context->cnt - 1];
while (searching && context->cnt != 0 && current->node != (ziU8*)context->unk_0x338) {
while (searching && context->cnt != 0 && current->node != (ziU8*)context->endNode) {
if (capacity < context->cnt) goto finish_graph;
current->attr = ZiDAWGgetCHARattribute(context, current->node, ZI_WORK);
if (context->cnt <= count) {

View File

@@ -254,7 +254,7 @@ ziBool Zi8PriMatchNextComp(ziU8* node, ziU8 mask0, ziU8 value0, ziU8 mask1, ziU8
return 0;
}
ziBool Zi8SecMatchComp(ziPtr nodeAddress, ziMatchParam* matchAddress, ziPtr dictionaryAddress) {
ziBool Zi8SecMatchComp(ziPtr nodeAddress, ziMatchParam* matchAddress, ziPtr dictionaryAddress ZI_NEED_WORK) {
int chainIndex;
ziU16 matchCode;
ziU16 targetCode;
@@ -743,9 +743,9 @@ check_row:
return 0;
}
ziS32 Zi8GetBpmfPhonetic(ziWChar* text, ziU8 count, ziU16* initial, ziU16* final, ziU16* bestInitial, ziU16* bestFinal ZI_NEED_WORK) {
ziU8 Zi8GetBpmfPhonetic(ziWChar* text, ziU8 count, ziU16* initial, ziU16* final, ziU16* bestInitial, ziU16* bestFinal ZI_NEED_WORK) {
ziU16 value;
ziU32 resultCount = 0;
ziU8 resultCount = 0;
Zi8LogError(0x64, ZI_WORK);
if (count == 0) {

View File

@@ -126,7 +126,7 @@ matchText:
if (pattern[index] != Zi8ConvertUC2Key(word[index], language, __zi8_work_data)) goto next;
} else {
folded = Zi8ConvertUC2WC(word[index], language, __zi8_work_data);
if (folded != pattern[index] && (!ZI_WORK->unk_0x1F || !Zi8ChangeCharCase(0, &folded, language, __zi8_work_data) || folded != pattern[index])) goto next;
if (folded != pattern[index] && (!ZI_WORK->ignoreCase || !Zi8ChangeCharCase(0, &folded, language, __zi8_work_data) || folded != pattern[index])) goto next;
}
}
matched:

View File

@@ -148,7 +148,7 @@ ziU8 Zi8MatchUWDdata(ziWChar* pattern, ziU8 length, ziWChar* currentWord, ziU16
folded = currentWord[position];
ZI_WORK->unk_0x141[previousOffset] = Zi8ConvertWC2UC(folded, language, __zi8_work_data);
ZI_WORK->unk_0x184[previousOffset] = 0;
if (ZI_WORK->unk_0x1F != 0) {
if (ZI_WORK->ignoreCase != 0) {
if (!Zi8ChangeCharCase(1, &folded, language, __zi8_work_data)) Zi8ChangeCharCase(0, &folded, language, __zi8_work_data);
ZI_WORK->unk_0x184[previousOffset] = Zi8ConvertWC2UC(folded, language, __zi8_work_data);
}
@@ -192,7 +192,7 @@ next:
if (pattern[position] != Zi8ConvertUC2Key(text[position], language, __zi8_work_data)) goto next;
} else {
folded = Zi8ConvertUC2WC(text[position], language, __zi8_work_data);
if (folded != pattern[position] && (!ZI_WORK->unk_0x1F || !Zi8ChangeCharCase(0, &folded, language, __zi8_work_data) || folded != pattern[position])) goto next;
if (folded != pattern[position] && (!ZI_WORK->ignoreCase || !Zi8ChangeCharCase(0, &folded, language, __zi8_work_data) || folded != pattern[position])) goto next;
}
}
if (ZI_WORK->unk_0x140 != 0) {

View File

@@ -199,10 +199,10 @@ checkEntry:
}
result = graph + (ziU32)entry[4] * 0x10000 + (((ziU16)entry[5] << 8) + entry[6]);
((zi8DawgCtx*)context)->unk_0x338 =
((zi8DawgCtx*)context)->endNode =
graph + (ziU32)entry[7] * 0x10000 + (((ziU16)entry[8] << 8) + entry[9]);
if (((zi8DawgCtx*)context)->unk_0x338 == graph) {
((zi8DawgCtx*)context)->unk_0x338 = 0;
if (((zi8DawgCtx*)context)->endNode == graph) {
((zi8DawgCtx*)context)->endNode = 0;
}
if ((((ziU16)entry[0] << 8) + entry[1]) == 0) {

View File

@@ -11,15 +11,15 @@ typedef struct {
ziU8 characterLow;
} ZiKoreanKeyEntry;
ziU32 Zi8_8148302C(ziU16 key, ziU8* table ZI_NEED_WORK) {
ziU16 Zi8_8148302C(ziU16 key, ziU8* table ZI_NEED_WORK) {
ziU32 value;
ziU16 count;
ziU32 i;
ziU16 i;
count = Zi8GetTableCount(ZI8_LANG_KO, 9, ZI_WORK);
for (i = 0; (ziU16)i < count; i++) {
value = (ziU16)(((ziU16)table[((i & 0xFFFF) << 3) + (i & 0xFFFF) + 7] << 8) |
table[((i & 0xFFFF) << 3) + (i & 0xFFFF) + 8]);
for (i = 0; i < count; i++) {
value = (ziU16)(((ziU16)table[(i << 3) + i + 7] << 8) |
table[(i << 3) + i + 8]);
if (value == key) {
Zi8LogError(0x64, ZI_WORK);
return i;
@@ -313,7 +313,8 @@ ziU32 Zi8GetKOcandidates(ziGetParam* param, ZiKoreanCandidateOptions* options ZI
param->candidates[0] = 0;
}
Zi8LogError(100, ZI_WORK);
if (param->wordCharCount != 0) {
if (param->wordCharCount == 0) goto scan_key_table;
{
if (((search.keyIndex = Zi8_8148302C(param->currentWord[0], keyTable, ZI_WORK)) != 0xFFFF) &&
((((ZiKoreanKeyEntry*)(((search.keyIndex << 3) + search.keyIndex) + keyTable))->keyBytes[4] & 8) != 0)) {
search.wordOffset = ((ZiKoreanKeyEntry*)(((search.keyIndex << 3) + search.keyIndex) + keyTable))->childLow |
@@ -438,6 +439,7 @@ search_table:
param->count = search.candidateCount;
param->letters = search.candidateCount;
}
scan_key_table:
if (param->elementCount > 9) {
param->letters = 0;
return 0;

View File

@@ -45,7 +45,7 @@ posEntry:
if (pattern[position] == Zi8ConvertWC2Key(word[position], language, __zi8_work_data)) continue;
break;
} else if (word[position] != pattern[position]) {
if (!ZI_WORK->unk_0x1F || language == 1) break;
if (!ZI_WORK->ignoreCase || language == 1) break;
folded = pattern[position];
if (!Zi8ChangeCharCase(1, &folded, language, __zi8_work_data) || folded != word[position]) break;
}

View File

@@ -152,10 +152,10 @@ u32 __SCGetConfBufSize();
typedef struct SC_BT_DEV_INFO {
u8 devName[20]; // 0x00
u8 unk_0x14;
u8 unk_0x15[0xB];
u8 pad_0x14; // 0x14
u8 pad_0x15[0xB]; // 0x15
LINK_KEY linkKey; // 0x20
u8 unk_0x30[0x10];
u8 pad_0x30[0x10]; // 0x30
} SC_BT_DEV_INFO;
typedef struct SCBtDeviceInfo {

View File

@@ -26,7 +26,7 @@ typedef struct USBKBDCmdLED {
typedef struct USBKBDCmdLEDAsync {
USBKBDCmdLED base; // 0x00
u8 unk_0x08[0x10];
u8 pad_0x08[0x10]; // 0x08
USBKBDCmdLEDCallback cb; // 0x18
void* cbArg; // 0x1C
} USBKBDCmdLEDAsync;

View File

@@ -749,7 +749,8 @@ s32 pfd_sddrv_get_total_sectors(u32* sectors, u16* bytes_per_sector) {
minimum_multiplier = multiplier >= 9 ? multiplier : 9;
max_multiplier = minimum_multiplier <= 11 ? minimum_multiplier : 11;
multiplier_factor = 1;
multiplier_factor <<= (u16)(max_multiplier - 9);
max_multiplier = (u16)(max_multiplier - 9);
multiplier_factor = (u16)(multiplier_factor << max_multiplier);
*sectors = cluster_blocks * multiplier_factor;
} else {
*sectors = ((csd[1] >> 8 & 0x3fffff) + 1) * 0x400;

View File

@@ -1,11 +1,15 @@
#include <private/fa/pdm.h>
#include <revolution/types.h>
#define MBR_WORD(buf, offset) (((pf_u32)(buf)[(offset) + 3] << 24) + ((pf_u32)(buf)[(offset) + 2] << 16) + ((pf_u32)(buf)[(offset) + 1] << 8) + (buf)[offset])
static inline pf_u16 read_boot_u16(pf_u8* buf, pf_u32 offset) {
if ((pf_u32)&buf[offset] & 1) { return (buf[offset + 1] << 8) | buf[offset]; }
return PF_SWAP_16(*(pf_u16*)&buf[(offset + 1) & ~1]);
}
static inline pf_u32 read_partition_u32(const pf_u8* buf, pf_u32 offset) {
return (((pf_u32)buf[offset + 2] << 16) + buf[offset]) +
(((pf_u32)buf[offset + 3] << 24) + ((pf_u32)buf[offset + 1] << 8));
}
pf_s32 pdm_part_is_master_boot_sector(pf_u8* buf, pf_u32 total, pf_bool* p_is_mbr) {
pf_s16 index;
pf_u32 start[4];
@@ -18,8 +22,8 @@ pf_s32 pdm_part_is_master_boot_sector(pf_u8* buf, pf_u32 total, pf_bool* p_is_mb
p_count = count;
for (index = 0; index < 4; index++) {
*p_start = 0;
*p_start = (((pf_u32)buf[456] << 16) + buf[454]) + (((pf_u32)buf[457] << 24) + ((pf_u32)buf[455] << 8));
*p_count = (((pf_u32)buf[460] << 16) + buf[458]) + (((pf_u32)buf[461] << 24) + ((pf_u32)buf[459] << 8));
*p_start = read_partition_u32(buf, 454);
*p_count = read_partition_u32(buf, 458);
if (*p_start != 0 && *p_count != 0) {
if (index == 0) { *p_is_mbr = 1; }
} else {
@@ -91,14 +95,14 @@ pf_s32 pdm_part_get_start_sector(PDM_PARTITION* p_part) {
if (err != 0) { return err; }
pdm_part_is_master_boot_sector(buf, p_part->p_disk->disk_info.total_sectors, &is_mbr);
if (is_mbr) {
start[0] = MBR_WORD(buf, 454);
start[1] = MBR_WORD(buf, 470);
start[2] = MBR_WORD(buf, 486);
start[3] = MBR_WORD(buf, 502);
count[0] = MBR_WORD(buf, 458);
count[1] = MBR_WORD(buf, 474);
count[2] = MBR_WORD(buf, 490);
count[3] = MBR_WORD(buf, 506);
start[0] = read_partition_u32(buf, 454);
start[1] = read_partition_u32(buf, 470);
start[2] = read_partition_u32(buf, 486);
start[3] = read_partition_u32(buf, 502);
count[0] = read_partition_u32(buf, 458);
count[1] = read_partition_u32(buf, 474);
count[2] = read_partition_u32(buf, 490);
count[3] = read_partition_u32(buf, 506);
part_index = 0;
for (index = 0; index < 4; index++) {
sector = start[index];
@@ -112,15 +116,15 @@ pf_s32 pdm_part_get_start_sector(PDM_PARTITION* p_part) {
sector = base;
for (extended_index = 0; extended_index < 2; extended_index++) {
if (extended_index == 0) {
sector = sector + MBR_WORD(buf, 454);
length = MBR_WORD(buf, 458);
sector = sector + read_partition_u32(buf, 454);
length = read_partition_u32(buf, 458);
err = pdm_disk_physical_read(p_part->p_disk, buf, sector, 1, 512, &success);
if (err != 0) { return err; }
if (requested == part_index) { p_part->start_sector = sector; p_part->total_sector = length; return 0; }
part_index++;
} else {
sector = base + MBR_WORD(buf, 470);
length = MBR_WORD(buf, 474);
sector = base + read_partition_u32(buf, 470);
length = read_partition_u32(buf, 474);
if (sector == 0 || length == 0) { break; }
err = pdm_disk_physical_read(p_part->p_disk, buf, sector, 1, 512, &success);
if (err != 0) { return err; }

View File

@@ -557,15 +557,11 @@ static void kbdSendKey(KBDKeyEventData* event) {
}
}
static inline u32 kbdChannelFlags(u32 channel) {
return kbdData[channel].flags;
}
static void kbd_led_handler(BOOL success, void* callbackArg) {
const KBDLEDCallbackData* callback;
u32 index;
s32 index;
u32 err;
index = (u32)callbackArg;
index = (s32)callbackArg;
callback = &kbdLCBuf[index];
kbdCmdBuf[index].device = 0;
if (callback->callbackAddress == (USBKBDCmdLEDCallback)(u32)kbdCmdBuf[index].device) {
@@ -579,12 +575,11 @@ static void kbd_led_handler(BOOL success, void* callbackArg) {
err = 0;
break;
}
kbdLCBuf[index].callbackAddress(err, kbdLCBuf[index].callbackArg);
kbdLCBuf[(u32)callbackArg].callbackAddress(err, kbdLCBuf[(u32)callbackArg].callbackArg);
}
USBKBDErr KBDSetLedsAsync(u32 channel, u32 leds, USBKBDCmdLEDCallback callback, void* callbackArg) {
s32 index;
u32 ofs;
u32 index;
u8 ledBits;
BOOL interrupts;
USBKBDErr result;
@@ -594,14 +589,18 @@ USBKBDErr KBDSetLedsAsync(u32 channel, u32 leds, USBKBDCmdLEDCallback callback,
if (channel >= 4) {
return 4;
}
if ((s32)kbdChannelFlags(channel) == 1 || (s32)kbdChannelFlags(channel) == 4) {
return 5;
{
KBDChannel* data = &kbdData[(s32)channel];
if ((s32)data->flags == 1 || (s32)data->flags == 4) {
return 5;
}
}
ledBits = leds;
interrupts = OSDisableInterrupts();
for (index = 0, ofs = 0; index < 12; index++, ofs += sizeof(KBDLEDCommand)) {
if (*(u32*)&((u8*)kbdCmdBuf)[ofs] == 0) {
*(u32*)&((u8*)kbdCmdBuf)[ofs] = (u32)kbdData[channel].device;
for (index = 0; index < 12; index++) {
if (kbdCmdBuf[(s32)index].device == 0) {
KBDChannel* data = &kbdData[channel];
kbdCmdBuf[(s32)index].device = (u32)data->device;
break;
}
}
@@ -609,11 +608,14 @@ USBKBDErr KBDSetLedsAsync(u32 channel, u32 leds, USBKBDCmdLEDCallback callback,
if (index == 12) {
return 7;
}
kbdLCBuf[index].callbackAddress = callback;
kbdLCBuf[index].callbackArg = callbackArg;
result = USBKBDSetLEDAsync((u32)kbdData[channel].device, ledBits,
(USBKBDCmdLEDAsync*)&kbdCmdBuf[index],
kbd_led_handler, (void*)index);
{
KBDChannel* data = &kbdData[channel];
kbdLCBuf[index].callbackAddress = callback;
kbdLCBuf[index].callbackArg = callbackArg;
result = USBKBDSetLEDAsync((u32)data->device, ledBits,
(USBKBDCmdLEDAsync*)&kbdCmdBuf[index],
kbd_led_handler, (void*)index);
}
switch (result) {
default:
return 7;
@@ -624,7 +626,6 @@ USBKBDErr KBDSetLedsAsync(u32 channel, u32 leds, USBKBDCmdLEDCallback callback,
USBKBDErr KBDSetLeds(u32 channel, u32 leds) {
u32 index;
KBDLEDCommand* command;
BOOL interrupts;
USBKBDErr result;
u8 ledBits;
@@ -634,20 +635,16 @@ USBKBDErr KBDSetLeds(u32 channel, u32 leds) {
if (channel >= 4) {
return 4;
}
if ((s32)kbdChannelFlags(channel) == 1 || (s32)kbdChannelFlags(channel) == 4) {
if ((s32)kbdData[(s32)channel].flags == 1 || (s32)kbdData[(s32)channel].flags == 4) {
return 5;
}
ledBits = leds & 0xff;
interrupts = OSDisableInterrupts();
index = 0;
command = kbdCmdBuf;
while (index < 12) {
if (command->device == 0) {
command->device = (u32)kbdData[channel].device;
for (index = 0; index < 12; index++) {
if (kbdCmdBuf[(s32)index].device == 0) {
kbdCmdBuf[(s32)index].device = (u32)kbdData[channel].device;
break;
}
index++;
command++;
}
OSRestoreInterrupts(interrupts);
if (index == 12) {
@@ -655,7 +652,7 @@ USBKBDErr KBDSetLeds(u32 channel, u32 leds) {
}
result = USBKBDSetLED((u32)kbdData[channel].device, ledBits,
(USBKBDCmdLED*)&kbdCmdBuf[index]);
kbdCmdBuf[index].device = 0;
kbdCmdBuf[(s32)index].device = 0;
switch (result) {
default:
return 7;

View File

@@ -353,38 +353,41 @@ static void reset_kpad(KPADInside* kpad) {
}
void KPADGetProjectionPos(Vec2* dest, Vec2* src, const Rect* rect, f32 scale) {
f64 scaled;
f32 height = rect->bottom - rect->top;
f32 halfHeight = height * 0.5f;
f32 x = src->x * halfHeight;
f32 y = src->y * halfHeight;
x *= 1.2f;
y *= 1.2f;
scaled = 0.908 * scale;
dest->y = y;
dest->x = (f32)(x * scaled);
f32 aspect;
f32 halfHeight;
f32 half;
f32 x;
f32 height;
height = rect->bottom - rect->top;
half = 0.5f;
halfHeight = height * half;
x = src->x * halfHeight;
aspect = 1.2f;
x = aspect * x;
dest->y = aspect * (src->y * halfHeight);
dest->x = (f32)(x * (0.908 * scale));
}
void KPADSetSensorHeight(s32 chan, f32 sensorHeight) {
KPADInside* kpad;
f32 halfHeightSquared;
f32 halfHeight;
f32 barOffsetX;
f32 barDiagonal;
f32 halfWidthSquared;
f32 halfWidth;
f32 negativeSensorHeight;
f32 barDiagonalSquared;
f32 halfHeightSquared;
f32 zero;
halfWidth = 1.0f;
kpad = &inside_kpads[chan];
kpad = chan + inside_kpads;
halfHeight = 0.75f;
negativeSensorHeight = -sensorHeight;
halfWidthSquared = halfWidth * halfWidth;
halfHeightSquared = halfHeight * halfHeight;
kpad->sensorBarCenter.x = 0.0f;
zero = 0.0f;
kpad->sensorBarCenter.x = zero;
kpad->sensorBarCenter.y = negativeSensorHeight;
barDiagonalSquared = halfWidthSquared + halfHeightSquared;
barDiagonal = (f32)sqrt(barDiagonalSquared);
barDiagonal = (f32)sqrt(halfWidthSquared + halfHeightSquared);
barOffsetX = kpad->sensorBarCenter.x;
if (barOffsetX < 0.0f) {
halfWidth += barOffsetX;
@@ -465,29 +468,24 @@ static void calc_button_repeat(KPADInside* kpad, u8 extension, s32 elapsed) {
}
static void calc_acc_horizon(KPADInside* kpad) {
f32 magnitude = (f32)sqrt(kpad->acceleration.x * kpad->acceleration.x + kpad->acceleration.y * kpad->acceleration.y);
f32 magnitude;
f32 normalizedX;
f32 normalizedY;
f32 targetY;
f32 targetX;
f32 productX;
f32 oldX;
f32 oldY;
f32 blend;
f32 projectedX;
f32 smoothing;
f32 deltaX;
f32 nextX;
f32 nextY;
f32 normalized;
f32 unitX;
f32 oldCircleX;
f32 oldCircleY;
f32 unitY;
f32 circleX;
f32 oldCircleX;
f32 unitY;
f32 unitX;
f32 deltaCircleX;
f32 circleY;
f32 deltaCircleY;
magnitude = (f32)sqrt(kpad->acceleration.x * kpad->acceleration.x + kpad->acceleration.y * kpad->acceleration.y);
if (magnitude == 0.0f || magnitude >= 2.0f) {
return;
}
@@ -497,17 +495,12 @@ static void calc_acc_horizon(KPADInside* kpad) {
if (magnitude > 1.0f) {
magnitude = 2.0f - magnitude;
}
targetY = kpad->accelNormal.y;
targetX = kpad->accelNormal.x;
productX = targetX * normalizedX;
oldX = kpad->horizonAxis.x;
oldY = kpad->horizonAxis.y;
blend = magnitude * kp_acc_horizon_pw;
projectedX = productX + targetY * normalizedY;
smoothing = magnitude * blend;
deltaX = smoothing * (projectedX - oldX);
nextX = oldX + deltaX;
nextY = oldY + smoothing * (((targetY * normalizedX) - (targetX * normalizedY)) - oldY);
projectedX = kpad->accelNormal.x * normalizedX + kpad->accelNormal.y * normalizedY;
magnitude *= blend;
deltaX = magnitude * (projectedX - kpad->horizonAxis.x);
nextX = kpad->horizonAxis.x + deltaX;
nextY = kpad->horizonAxis.y + magnitude * (((kpad->accelNormal.y * normalizedX) - (kpad->accelNormal.x * normalizedY)) - kpad->horizonAxis.y);
normalized = (f32)sqrt(nextX * nextX + nextY * nextY);
if (normalized != 0.0f) {
unitX = nextX / normalized;
@@ -788,24 +781,18 @@ nextObject:
static s8 select_1obj_first(KPADInside* kpad) {
KPADDPDObject* object = kpad->dpdState.objects;
KPADDPDObject* end = kpad->dpdState.candidates;
f32 scale = kpad->dpdObjectScale;
f32 productX = kpad->horizonTangent.x * kpad->horizonAxis.x;
f32 productY = kpad->horizonTangent.y * kpad->horizonAxis.x;
f32 offsetX = productX + kpad->horizonTangent.y * kpad->horizonAxis.y;
f32 offsetY = productY - kpad->horizonTangent.x * kpad->horizonAxis.y;
offsetX *= scale;
offsetY *= scale;
f32 offsetX = kpad->horizonTangent.x * kpad->horizonAxis.x + kpad->horizonTangent.y * kpad->horizonAxis.y;
f32 offsetY = kpad->horizonTangent.y * kpad->horizonAxis.x - kpad->horizonTangent.x * kpad->horizonAxis.y;
offsetX *= kpad->dpdObjectScale;
offsetY *= kpad->dpdObjectScale;
do {
if ((s8)object->metadata.bytes.flags == 0) {
f32 x = object->x;
f32 y = object->y;
Vec2 leftPosition;
Vec2 rightPosition;
leftPosition.x = x - offsetX;
leftPosition.y = y - offsetY;
rightPosition.x = x + offsetX;
rightPosition.y = y + offsetY;
leftPosition.x = object->x - offsetX;
leftPosition.y = object->y - offsetY;
rightPosition.x = object->x + offsetX;
rightPosition.y = object->y + offsetY;
if (leftPosition.x <= kpad->value4F4 || leftPosition.x >= kpad->value4FC || leftPosition.y <= kpad->value4F8 || leftPosition.y >= kpad->value500) {
if (rightPosition.x > kpad->value4F4 && rightPosition.x < kpad->value4FC && rightPosition.y > kpad->value4F8 && rightPosition.y < kpad->value500) {
kpad->dpdState.candidates[1] = *object;
@@ -822,7 +809,7 @@ static s8 select_1obj_first(KPADInside* kpad) {
return -1;
}
}
} while (++object < end);
} while (++object < kpad->dpdState.candidates);
return 0;
}

View File

@@ -580,7 +580,7 @@ void VIInit(void)
u16 displayConfig;
u32 __VIDVDStopFlag_Enable_old;
s32 format;
u32 value;
u16 value;
u32 tv;
u32 bootromTv;

View File

@@ -393,6 +393,67 @@ CDBErr CDBRecordGetDataSize(CDBRecord* record, u32* size) {
return err;
}
CDBErr CDBRecordReduceFileSize(CDBRecord* record, u32 newFileSize) {
CDBRecordFile* recordFile;
CDBErr err;
u32 fileSize;
recordFile = record->file;
if (recordFile == NULL) {
CDBReportError("can't reduce file size of the record ; the record is closed\n");
return CDB_ERROR_27;
}
if ((recordFile->allocFlag & 2) == 0) {
CDBReportError("can't reduce file size of the record ; the record is opened as READONLY\n");
return CDB_ERROR_27;
}
CDBAttrGetFileSize(&recordFile->attr, &fileSize);
if (newFileSize > fileSize) {
CDBReportError("can't reduce file size of the record ; file size must be over %d bytes\n", fileSize);
return CDB_ERROR_26;
}
CDBAttrSetFileSize(&recordFile->attr, newFileSize);
recordFile->attr.dirty = TRUE;
err = CDBRecordFileWriteAttrBuf(record);
if (err != CDB_ERROR_OK) {
return err;
}
return CDB_ERROR_OK;
}
CDBErr CDBRecordReduceDataSize(CDBRecord* record, u32 newDataSize) {
CDBRecordFile* recordFile;
CDBErr err = CDB_ERROR_OK;
u32 dataSize;
recordFile = record->file;
if (recordFile == NULL) {
CDBReportError("can't reduce data size of the record ; the record is closed\n");
return CDB_ERROR_27;
}
if ((recordFile->allocFlag & 2) == 0) {
CDBReportError("can't reduce data size of the record ; the record is opened as READONLY\n");
return CDB_ERROR_27;
}
if (!CDBRecordBelongedDBOpenedAsRW(record)) {
CDBReportError("can't reduce data size of the record; permission denied\n");
return CDB_ERROR_ACCESS_DENIED;
}
err = CDBRecordFileGetDataSize(record, &dataSize);
if (err != CDB_ERROR_OK) {
return err;
}
if (newDataSize < dataSize) {
CDBAttrSetFileSize(&recordFile->attr, newDataSize);
recordFile->attr.dirty = TRUE;
}
err = CDBRecordFileWriteAttrBuf(record);
if (err != CDB_ERROR_OK) {
return err;
}
return CDB_ERROR_OK;
}
CDBErr CDBRecordRemove(CDBRecord* record) {
CDBErr err;
CDBLock();
@@ -430,6 +491,50 @@ void CDBRecordGetTypeForce(CDBRecord* record, char* type) {
CDBUnlock();
}
CDBErr CDBRecordSetFileType(CDBRecord* record, const char* fileType) {
CDBRecordDatabaseState* instance;
CDBRecordFile* recordFile;
CDBErr err;
instance = ((CDBDatabase*)record->database)->instance;
recordFile = record->file;
if ((instance->openFlags & 2) == 0) {
CDBReportError("can't set file type of the record; the database is opened as READONLY\n");
return CDB_ERROR_26;
}
if (recordFile == NULL) {
CDBReportError("can't set file type of the record ; the record is closed\n");
return CDB_ERROR_27;
}
if ((recordFile->allocFlag & 2) == 0) {
CDBReportError("can't set file type of the record ; the record is opened as READONLY\n");
return CDB_ERROR_27;
}
if (record->key.location != CDB_FS_LOCATION_NAND) {
CDBReportError("can't set file type of the record ; the record must exsist on NAND\n");
return CDB_ERROR_26;
}
CDBLock();
strcpy(CDBKeyStrType(record->key.keyString), fileType);
CDBAttrSetKeyStr(&recordFile->attr, &record->key);
err = CDBRecordFileWriteAttrBuf(record);
CDBUnlock();
return err;
}
CDBErr CDBRecordGetFileType(CDBRecord* record, char* fileType) {
CDBErr err = CDB_ERROR_OK;
CDBLock();
if (record->file == NULL) {
CDBReportError("can't get file type of the record ; the record is closed\n");
err = CDB_ERROR_27;
} else {
CDBConvKeyStrToType(record->key.keyString, fileType);
}
CDBUnlock();
return err;
}
void CDBRecordGetGameCodeForce(CDBRecord* record, char* gameCode) {
u32 value;
CDBLock();
@@ -438,12 +543,122 @@ void CDBRecordGetGameCodeForce(CDBRecord* record, char* gameCode) {
CDBUnlock();
}
CDBErr CDBRecordGetGameCode(CDBRecord* record, u32* gameCode) {
CDBErr err = CDB_ERROR_OK;
CDBLock();
if (record->file == NULL) {
CDBReportError("can't get game code of the record ; the record is closed\n");
err = CDB_ERROR_27;
} else {
CDBConvKeyStrToGameCode(record->key.keyString, gameCode);
}
CDBUnlock();
return err;
}
CDBErr CDBRecordGetMakerCode(CDBRecord* record, u32* makerCode) {
CDBErr err = CDB_ERROR_OK;
CDBLock();
if (record->file == NULL) {
CDBReportError("can't get maker code of the record ; the record is closed\n");
err = CDB_ERROR_27;
} else {
CDBConvKeyStrToMakerCode(record->key.keyString, makerCode);
}
CDBUnlock();
return err;
}
CDBErr CDBRecordGetModifiedTime(CDBRecord* record, u32* modifiedTime) {
CDBErr err = CDB_ERROR_OK;
CDBLock();
if (record->file == NULL) {
CDBReportError("can't get modified time of the record; the record is closed\n");
err = CDB_ERROR_27;
} else {
*modifiedTime = ((CDBRecordFile*)record->file)->attr.buf.lastModifiedDate;
}
CDBUnlock();
return err;
}
CDBErr CDBRecordGetModifiedCount(CDBRecord* record, u32* modifiedCount) {
CDBErr err = CDB_ERROR_OK;
CDBLock();
if (record->file == NULL) {
CDBReportError("can't get modified count of the record; the record is closed\n");
err = CDB_ERROR_27;
} else {
CDBAttrGetModifiedCount(&((CDBRecordFile*)record->file)->attr, modifiedCount);
}
CDBUnlock();
return err;
}
void CDBRecordGetKeyForce(CDBRecord* record, CDBRecordKey* key) {
CDBLock();
CDBRecordKeyCopy(key, &record->key);
CDBUnlock();
}
CDBErr CDBRecordSetName(CDBRecord* record, const char* name, const char* keyword) {
CDBRecordDatabaseState* instance;
CDBRecordFile* recordFile;
CDBErr err;
instance = ((CDBDatabase*)record->database)->instance;
recordFile = record->file;
if ((instance->openFlags & 2) == 0) {
CDBReportError("can't set a name of the record; the database is opened as READONLY\n");
return CDB_ERROR_26;
}
if (!CDBRecordBelongedDBOpenedAsRW(record)) {
CDBReportError("can't add keyword to the record; permission denied\n");
return CDB_ERROR_ACCESS_DENIED;
}
if (recordFile == NULL) {
CDBReportError("can't set a name of the record; the record is closed\n");
return CDB_ERROR_27;
}
if ((recordFile->allocFlag & 2) == 0) {
CDBReportError("can't set a name of the record; the record is opened as READONLY\n");
return CDB_ERROR_27;
}
CDBLock();
strncpy(recordFile->attr.buf.desc, name, CDB_ATTR_BUF_MAX_DESC_LEN);
recordFile->attr.buf.descLength = strlen(name);
recordFile->attr.dirty = TRUE;
err = CDBRecordFileWriteAttrBuf(record);
CDBUnlock();
return err;
}
CDBErr CDBRecordGetKeyword(CDBRecord* record, char* keyword) {
CDBErr err = CDB_ERROR_OK;
CDBLock();
if (record->file == NULL) {
CDBReportError("can't get keyword from the record; the record is closed\n");
err = CDB_ERROR_27;
} else {
strcpy(keyword, ((CDBRecordFile*)record->file)->attr.buf.desc);
}
CDBUnlock();
return err;
}
CDBErr CDBRecordGetKey(CDBRecord* record, CDBRecordKey* key) {
CDBErr err = CDB_ERROR_OK;
CDBLock();
if (record->file == NULL) {
CDBReportError("can't get key from the record; the record is closed\n");
err = CDB_ERROR_27;
} else {
CDBRecordKeyCopy(key, &record->key);
}
CDBUnlock();
return err;
}
void CDBRecordGetCalendarTimeForce(CDBRecord* record, int* year, int* month, int* day, int* hour, int* min, int* sec) {
char epochString[64];
CDBDate epoch;
@@ -454,6 +669,23 @@ void CDBRecordGetCalendarTimeForce(CDBRecord* record, int* year, int* month, int
CDBUnlock();
}
CDBErr CDBRecordGetCalendarTime(CDBRecord* record, int* year, int* month, int* day, int* hour, int* min, int* sec) {
char epochString[64];
CDBDate epoch;
CDBErr err = CDB_ERROR_OK;
CDBLock();
if (record->file == NULL) {
CDBReportError("can't get calender time from the record; the record is closed\n");
err = CDB_ERROR_27;
} else {
CDBConvKeyStrToEpochStr(record->key.keyString, epochString);
CDBConvEpochStrToEpochValue(epochString, &epoch);
CDBConvEpochValueToDate(epoch, year, month, day, hour, min, sec);
}
CDBUnlock();
return err;
}
CDBErr CDBRecordGetId(CDBRecord* record, CDBId* id) {
CDBErr err = CDB_ERROR_OK;
CDBRecordFile* recordFile;
@@ -532,6 +764,27 @@ CDBErr CDBRecordUpdateModifiedDate(CDBRecord* record) {
return CDB_ERROR_OK;
}
CDBErr CDBRecordDuplicate(CDBRecord* record, CDBRecord* newRecord) {
CDBRecordFile* recordFile;
CDBErr err;
if (record->key.location != CDB_FS_LOCATION_NAND && record->key.location != CDB_FS_LOCATION_SD) {
OSPanic(__FILE__, __LINE__, "CDBRecordDuplicate invalud location\n");
return CDB_ERROR_1;
}
recordFile = record->file;
if (recordFile == NULL) {
return CDB_ERROR_27;
}
CDBLock();
CDBRecordKeyCopy(&newRecord->key, &record->key);
newRecord->file = NULL;
newRecord->database = record->database;
err = CDBRecordFileCreateBlank(newRecord);
CDBUnlock();
return err;
}
CDBErr CDBRecordBackupToSD(CDBRecord* record) {
CDBErr err;
CDBLock();
@@ -695,8 +948,7 @@ CDBErr CDBRecordEncrypt(CDBRecord* record, void* buffer, CDBRecordKey* key, u32
}
{
CDBErr result;
CDBRecordFile* tempFile;
tempFile = record->file;
CDBRecordFile* tempFile = record->file;
if ((s32)tempFile == 0) {
result = CDB_ERROR_27;
} else if (tempFile->allocFlag == 1) {
@@ -825,7 +1077,7 @@ CDBErr CDBRecordEncrypt(CDBRecord* record, void* buffer, CDBRecordKey* key, u32
CDBErr CDBRecordDecrypt(CDBRecord* record, void* buffer, u32 size, u32* dataSize, CDBRecordKey* key) {
CDBErr status;
int fileOffset;
s32 fileOffset;
CDBRecordFile* recordFile;
u32 fileDataSize;
u32 fileSize;
@@ -960,3 +1212,32 @@ CDBErr CDBRecordDecrypt(CDBRecord* record, void* buffer, u32 size, u32* dataSize
}
return CDB_ERROR_OK;
}
CDBErr CDBRecordPrivateChangeOwner(CDBRecord* record, u64 newWiiId) {
CDBRecordFile* recordFile;
char fullPath[256];
char newPath[256];
CDBErr err;
u64 preWiiId;
u64 recordWiiId;
CDBReportError("CDBRecordPrivateChangeOwner\n");
recordFile = record->file;
if (recordFile == NULL) {
return CDB_ERROR_27;
}
preWiiId = CDBGetWiiId();
recordWiiId = record->key.wiiId;
OSReport(" i_pre-wiiid = %lX\n", preWiiId);
OSReport(" record-wiiid = %lX\n", recordWiiId);
CDBConvKeyToFullPath(&record->key, fullPath);
record->key.wiiId = newWiiId;
CDBConvKeyToFullPath(&record->key, newPath);
OSReport("path =%s\n", fullPath);
OSReport("path2=%s\n", newPath);
CDBLock();
err = CDBAttrSetWiiId(&recordFile->attr, newWiiId);
CDBUnlock();
return err;
}

View File

@@ -169,11 +169,11 @@ static const u32 AESiDecryptTable[] = {
};
#define ROTATE(x,n) (((x) << (n)) | ((x) >> (32 - (n))))
#define ENCRYPT(a,b,c,d) (ROTATE(AESiEncryptTable[(a)>>24],24) ^ ROTATE(AESiEncryptTable[((b)>>16)&255],16) ^ ROTATE(AESiEncryptTable[((c)>>8)&255],8) ^ AESiEncryptTable[(d)&255])
#define DECRYPT(a,b,c,d) (ROTATE(AESiDecryptTable[(a)>>24],24) ^ ROTATE(AESiDecryptTable[((b)>>16)&255],16) ^ ROTATE(AESiDecryptTable[((c)>>8)&255],8) ^ AESiDecryptTable[(d)&255])
#define SUBSTITUTE(table,a,b,c,d) (((u32)table[(a)>>24]<<24) | ((u32)table[((b)>>16)&255]<<16) | ((u32)table[((c)>>8)&255]<<8) | table[(d)&255])
#define ENCRYPT(a,b,c,d) (((ROTATE(AESiEncryptTable[((b)>>16)&255],16) ^ ROTATE(AESiEncryptTable[(a)>>24],24)) ^ AESiEncryptTable[(d)&255]) ^ ROTATE(AESiEncryptTable[((c)>>8)&255],8))
#define DECRYPT(a,b,c,d) (((ROTATE(AESiDecryptTable[((b)>>16)&255],16) ^ AESiDecryptTable[(d)&255]) ^ ROTATE(AESiDecryptTable[(a)>>24],24)) ^ ROTATE(AESiDecryptTable[((c)>>8)&255],8))
#define SUBSTITUTE(table,a,b,c,d) ((((u32)table[(a)>>24]<<24) | table[(d)&255]) | (((u32)table[((b)>>16)&255]<<16) | ((u32)table[((c)>>8)&255]<<8)))
#define SUBSTITUTE_XOR(table,a,b,c,d) (((u32)table[(a)>>24]<<24) ^ ((u32)table[((b)>>16)&255]<<16) ^ ((u32)table[((c)>>8)&255]<<8) ^ table[(d)&255])
#define SUBSTITUTE_XOR(table,a,b,c,d) (((((u32)table[(a)>>24]<<24) ^ table[(d)&255]) ^ ((u32)table[((c)>>8)&255]<<8)) ^ ((u32)table[((b)>>16)&255]<<16))
void AESiEncryptBlock(AESContext* context, u32* output, const u32* input) {
u32 rounds = context->rounds;
@@ -197,8 +197,9 @@ void AESiEncryptBlock(AESContext* context, u32* output, const u32* input) {
void AESiDecryptBlock(AESContext* context, u32* output, const u32* input) {
u32 rounds=context->rounds;
u32* key=context->keys + rounds*4;
u32* key=context->keys;
u32 a,b,c,d;
key += rounds*4;
if (context->needsTransform) {
u32 round;
for (round=1; round<context->rounds; ++round) {
@@ -209,9 +210,9 @@ void AESiDecryptBlock(AESContext* context, u32* output, const u32* input) {
u32 twice=DOUBLE_BYTES(value);
u32 four=DOUBLE_BYTES(twice);
u32 eight=DOUBLE_BYTES(four)^value;
u32 mixed=eight ^ (four ^ ROTATE(eight,8));
mixed ^= twice ^ ROTATE(mixed,8);
mixed ^= value ^ ROTATE(mixed,8);
u32 mixed=(ROTATE(eight,8) ^ (eight ^ four));
mixed=(ROTATE(mixed,8) ^ (mixed ^ twice));
mixed=(ROTATE(mixed,8) ^ (mixed ^ value));
keys[word]=mixed;
}
}

View File

@@ -68,8 +68,14 @@ void NETMD5GetDigest(NETMD5Context* context, void* digest) {
memset(context, 0, sizeof(*context));
}
#define ROTATE(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
#define STEP(a, b, c, d, f, word, n) ((a) += (f), (a) = (b) + ROTATE(__lwbrx(0, (int)(word)) + (*constant + (a)), n))
static inline u32 rotateSum(u32 state, const u32* word, u32 constant, int shift) {
// Each rotation half reads its own byte-reversed message word.
u32 right = __lwbrx((void*)word, 0);
u32 left = __lwbrx((void*)word, 0);
return ((state + (constant + left)) << shift) | ((constant + (state + right)) >> (32 - shift));
}
#define STEP(a, b, c, d, f, word, n) ((a) = (b) + rotateSum((a) + (f), word, *constant, n))
static void ProcessBlock(NETMD5Context* context) {
static u32 constants[64] = {0xD76AA478, 0xE8C7B756, 0x242070DB, 0xC1BDCEEE, 0xF57C0FAF, 0x4787C62A, 0xA8304613, 0xFD469501, 0x698098D8, 0x8B44F7AF, 0xFFFF5BB1, 0x895CD7BE, 0x6B901122, 0xFD987193, 0xA679438E, 0x49B40821, 0xF61E2562, 0xC040B340, 0x265E5A51, 0xE9B6C7AA, 0xD62F105D, 0x02441453, 0xD8A1E681, 0xE7D3FBC8, 0x21E1CDE6, 0xC33707D6, 0xF4D50D87, 0x455A14ED, 0xA9E3E905, 0xFCEFA3F8, 0x676F02D9, 0x8D2A4C8A, 0xFFFA3942, 0x8771F681, 0x6D9D6122, 0xFDE5380C, 0xA4BEEA44, 0x4BDECFA9, 0xF6BB4B60, 0xBEBFBC70, 0x289B7EC6, 0xEAA127FA, 0xD4EF3085, 0x04881D05, 0xD9D4D039, 0xE6DB99E5, 0x1FA27CF8, 0xC4AC5665, 0xF4292244, 0x432AFF97, 0xAB9423A7, 0xFC93A039, 0x655B59C3, 0x8F0CCC92, 0xFFEFF47D, 0x85845DD1, 0x6FA87E4F, 0xFE2CE6E0, 0xA3014314, 0x4E0811A1, 0xF7537E82, 0xBD3AF235, 0x2AD7D2BB, 0xEB86D391};
@@ -83,13 +89,13 @@ static void ProcessBlock(NETMD5Context* context) {
block = context->buffer32;
word = block;
constant = constants;
index = indices;
for (round = 0; round < 4; ++round) {
STEP(a,b,c,d,(b & c) | (~b & d),word,7); ++word; ++constant;
STEP(d,a,b,c,(a & b) | (~a & c),word,12); ++word; ++constant;
STEP(c,d,a,b,(d & a) | (~d & b),word,17); ++word; ++constant;
STEP(b,c,d,a,(c & d) | (~c & a),word,22); ++word; ++constant;
STEP(a,b,c,d,(b & c) | (~b & d),word++,7); ++constant;
STEP(d,a,b,c,(a & b) | (~a & c),word++,12); ++constant;
STEP(c,d,a,b,(d & a) | (~d & b),word++,17); ++constant;
STEP(b,c,d,a,(c & d) | (~c & a),word++,22); ++constant;
}
index = indices;
for (round = 0; round < 4; ++round) {
STEP(a,b,c,d,(b & d) | (c & ~d),block + *index,5); ++index; ++constant;
STEP(d,a,b,c,(a & c) | (b & ~c),block + *index,9); ++index; ++constant;

View File

@@ -7,8 +7,7 @@ s32 NHTTPi_strcmp(const char* left, const char* right) { return strcmp(left,righ
void* NHTTPi_memclr(void* destination, u32 size) { return memset(destination,0,size); }
static int LowerCase(int character) {
if((character>='A') & (character<='Z')) character+=32;
return character;
return ((character >= 'A') & (character <= 'Z')) ? character + 32 : character;
}
s32 NHTTPi_strnicmp(const char* left, const char* right, s32 length) {
@@ -127,12 +126,13 @@ s32 NHTTPi_intToStr(char* destination, u32 value) {
}
s32 NHTTPi_compareToken(const char* left, const char* right) {
for (;;) {
int rightCharacter=LowerCase(*right);
int leftCharacter=LowerCase(*left);
if(leftCharacter!=rightCharacter) break;
if(*left==0 || *left==' ') return 0;
++left; ++right;
u8 rawLeft;
while (LowerCase((s8)(rawLeft = *(const u8*)left)) == LowerCase(*right)) {
if ((s8)rawLeft == 0 || (s8)rawLeft == ' ') {
return 0;
}
++left;
++right;
}
return -1;
}
@@ -161,13 +161,16 @@ s32 NHTTPi_Base64Encode(char* destination, const char* source) {
static char alphabet[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
const char* table=alphabet;
char* output=destination;
u32 length=strlen(source);
s32 length=strlen(source);
s32 consumed=0;
for(; consumed<(s32)length; consumed+=3) {
output[0]=table[source[0]>>2];
output[1]=table[((source[0]&3)<<4)+(source[1]>>4)];
output[2]=table[((source[1]&15)<<2)+(source[2]>>6)];
output[3]=table[source[2]&63];
for(; consumed<length; consumed+=3) {
s8 first = source[0];
s8 second = source[1];
s8 third = source[2];
output[0]=table[first>>2];
output[1]=table[(second>>4)+((first&3)<<4)];
output[2]=table[(third>>6)+((second&15)<<2)];
output[3]=table[third&63];
source+=3; output+=4;
}
if(consumed==length+1) output[-1]='=';

View File

@@ -548,7 +548,7 @@ NWC24Err NWC24DumpDlTask(NWC24DlTask* dlTask) {
NWC24Err NWC24IterateDlTask(NWC24DlId* dlIterateId, BOOL begin) {
DlTaskListHeader* entriesHeader;
NWC24Work* work;
const NWC24Work* work;
u16 taskId;
u16 maxTaskCount;
DlTaskListHeader* header;
@@ -715,7 +715,7 @@ static inline NWC24Err CheckDlTaskRetry(NWC24DlTask* dlTask, u8 retryCount) {
retryMask = task->retryMask;
if (retryMask == 0) { return NWC24_ERR_FATAL; }
if (retryCount > 31) { return NWC24_ERR_INVALID_VALUE; }
if ((retryMask & (1 << retryCount)) == 0) { return NWC24_ERR_DISABLED; }
if ((retryMask & (1U << retryCount)) == 0) { return NWC24_ERR_DISABLED; }
return NWC24_OK;
}
static inline NWC24Err UpdateDlTaskAccessTime(NWC24DlTask* dlTask) {

View File

@@ -242,14 +242,63 @@ BOOL BS2IsDiagDisc() { return (u8)(*(u8 *)OSPhysicalToCached(OS_ADDR_BOOT_INFO)
extern vu32 BS2VideoMode;
extern vu32 __DVDLayoutFormat;
void Run(u32 entryPoint, void *start, u32 blockCount, u32 argument) {
u8 *block = start;
for (; blockCount != 0; --blockCount) {
__dcbz(block, 0);
__dcbf(block, 0);
block += 32;
}
((void (*)(u32))entryPoint)(argument);
asm void Run(u32 entryPoint, void *start, u32 blockCount, u32 argument) {
// clang-format off
#ifdef __MWERKS__
nofralloc
mtctr r5
mtlr r3
li r0, 0
li r2, 0
li r3, 0
li r5, 0
li r7, 0
li r8, 0
li r9, 0
li r10, 0
li r11, 0
li r12, 0
li r13, 0
li r14, 0
li r15, 0
li r16, 0
li r17, 0
li r18, 0
li r19, 0
li r20, 0
li r21, 0
li r22, 0
li r23, 0
li r24, 0
li r25, 0
li r26, 0
li r27, 0
li r28, 0
li r29, 0
li r30, 0
li r31, 0
// The application stack is fixed; it is unrelated to the formatter.
lis r1, 0x8160
ori r1, r1, 0
li r6, 0
b Run_loop_entry
Run_loop:
dcbz r4, r0
dcbf r4, r0
addi r4, r4, 0x20
bdnz Run_loop
b Run_done
Run_done:
li r4, 0
blr
Run_loop_entry:
b Run_loop
#endif
// clang-format on
}
BOOL BS2GetLockedTitles(ESTitleId *pTitleIds, u32 *count) {
@@ -803,7 +852,7 @@ void BS2StartGCGame() {
OSTime time;
StartingGame = TRUE;
while (DVDGetCommandBlockStatus(&CoverBlock) != DVD_STATE_IDLE) {
while (CoverBlock.state != DVD_STATE_IDLE) {
}
soundMode = SCGetSoundMode();
@@ -1796,21 +1845,24 @@ invalidRvlRegion:
State = BS2_STT_RESET_SYSTEM;
break;
}
if (GamePartition == 0) {
if (GamePartition != 0) {
State = BS2_STT_37;
} else {
State = BS2_STT_54;
break;
}
State = BS2_STT_37;
case 0x25:
case 0x25: {
u32 partitionOffset = (u32)((DVDPartitionInfo *)GamePartition)->partition;
if (BS2BootFromCache != 0) {
BS2Report("Open partition from cache.dat\n");
NandPending = 1;
BS2NANDDivideReadAsync(&BS2CacheFileInfo, &PartitionParams.tmd, 0x4a00, BS2NANDCallback, &BS2NandBlock);
} else
DVDOpenPartitionAsync(&Block, &PartitionParams.tmd, (u32)((DVDPartitionInfo *)GamePartition)->partition, BS2DVDCallback);
DVDOpenPartitionAsync(&Block, &PartitionParams.tmd, partitionOffset, BS2DVDCallback);
PartitionOpen = 1;
State = BS2_STT_38;
break;
}
case 0x26: {
status = CheckBS2CommandStatus();
if (status == 0)
@@ -1837,13 +1889,16 @@ invalidRvlRegion:
titlePrefix = titleCode >> 0x18;
titleCharacters[3] = (u8)titleCode;
titleCharacters[0] = (char)(titleCode >> 0x18);
if (titlePrefix < 'R') {
if (titlePrefix == 'D')
goto check_title_region;
} else if (titlePrefix < 'U')
switch (titlePrefix) {
case 'D':
case 'R':
case 'S':
case 'T':
goto check_title_region;
regionMatches = TRUE;
goto title_region_checked;
default:
regionMatches = TRUE;
goto title_region_checked;
}
{
check_title_region:
if (titleCharacters[3] == 0x41) {
@@ -2001,8 +2056,8 @@ invalidRvlRegion:
if (status == 0)
OSPanic("BS2Mach.c", 0x12c8, "BS2 ERROR >>> Cannnot alloc 0x%08x from MEMAllocator", bannerFile.length);
BannerLength = bannerFile.length;
BannerBuffer = OSRoundDown32B(BannerAllocation) + 32;
BS2Report("BannerBufferAddr : %08X\n");
BannerBuffer = BannerAllocation + 32 - BannerAllocation % 32;
BS2Report("BannerBufferAddr : %08X\n", BannerBuffer);
} else {
if ((BannerBuffer != 0) && (BannerLength != 0)) {
if (BannerLength < ((bannerFile.length + 0x1fU) & 0xffffffe0))

View File

@@ -23,10 +23,10 @@ s32 WADImportDVDForBS(const char* path, void* buffer, u32 length);
s32 WADImportDVDExForBS(const char* path, void* buffer, u32 length);
static BS2UpdateEntry* pEntries = NULL;
static u32 EntriesCount = 0;
static volatile u32 EntriesCount = 0;
static u32* pFlags = NULL;
static void* MemAllocator = NULL;
int State = 0;
volatile int State = 0;
BS2UpdateEntry* CurrentEntry = 0;
static u32 RebootRequired = 0;
static BOOL ContainsSeatTitles = 0;

View File

@@ -64,13 +64,13 @@ void SimpleWavePlayer::wavePacketCallback(WavePacketCallbackStatus status, WaveP
return;
}
if (self->unk_0xB5) {
if (self->mbFillInCallback) {
MakeWave(player, packet, self);
}
}
SimpleWavePlayer::SimpleWavePlayer() : mSetupParam(1, nw4r::snd::SAMPLE_FORMAT_PCM_S16, 32000, 1.0f, 1) {
unk_0xB5 = true;
mbFillInCallback = true;
unk_0xB0 = false;
mIsSetData = false;
mIsPlaying = false;
@@ -196,7 +196,7 @@ void SimpleWavePlayer::stop() {
void SimpleWavePlayer::update() {
if (mIsPlaying) {
if (!unk_0xB5) {
if (!mbFillInCallback) {
for (int i = 0; i < 3; i++) {
if (mWavePackets[i].GetAppendFlag()) {
continue;

View File

@@ -7207,7 +7207,7 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
u32 cmpLow;
struct {
CHANSVmObjType operandTypes[2];
u64 floatBits;
double floatLiteral;
CHANSVmObjHdr copies[2];
CHANSVmObjHdr load;
CHANSVmObjHdr operand;
@@ -7291,8 +7291,8 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
case CHANS_VM_OP_LOAD_FLOAT: {
opSize = 9;
operandBuf = VmGetOperand(vm, 1, 9);
memcpy(&scratch.floatBits, operandBuf, 8);
result = CHANSVmSetFloat(vm, &pVm->accumulator, *(double*)&scratch.floatBits);
memcpy(&scratch.floatLiteral, operandBuf, 8);
result = CHANSVmSetFloat(vm, &pVm->accumulator, scratch.floatLiteral);
break;
}
@@ -7441,8 +7441,7 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
}
if (leftOp == vmNull || rightOp == vmNull) {
result = CHANS_VM_ERR_RESULT_TYPE;
break;
return CHANS_VM_ERR_RESULT_TYPE;
}
result = opFunc(vm, convTypeIdx, &pVm->accumulator, leftOp, rightOp);
@@ -7717,30 +7716,27 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
CHANSVmObjHdr* pAcc;
CHANSVmExecutionCtx* ctx;
CHANSVmModule* dbg;
CHANSVmErr loadResult;
opSize = 3;
operandBuf = VmGetOperand(vm, 1, 3);
if (operandBuf == vmNull) {
return CHANS_VM_ERR_CODE_RANGE;
}
pAcc = &pVm->accumulator;
result = CHANSVmDeleteObject(vm, pAcc);
if (result == CHANS_VM_OK) {
loadResult = CHANSVmDeleteObject(vm, pAcc);
if (loadResult == CHANS_VM_OK) {
imm16Val = VM_READ_BE_U16(operandBuf, 0);
ctx = pVm->pActiveCtx;
dbg = ctx->pDbg;
if (imm16Val < dbg->stringCount) {
if (dbg->pStringTbl[imm16Val].pStringData != vmNull) {
goto load_str_ok;
}
if (imm16Val >= dbg->stringCount || dbg->pStringTbl[imm16Val].pStringData == vmNull) {
loadResult = CHANS_VM_ERR_LOAD_STRING_CONST;
} else {
pAcc->type = CHANS_VM_OBJ_TYPE_STRING;
pAcc->hasData = vmTrue;
pAcc->value.wstring_v = (vmWStringObjVal*)&ctx->pDbg->pStringTbl[imm16Val];
}
}
result = CHANS_VM_ERR_LOAD_STRING_CONST;
break;
load_str_ok:
pAcc->type = CHANS_VM_OBJ_TYPE_STRING;
pAcc->hasData = vmTrue;
pAcc->value.wstring_v = (vmWStringObjVal*)&ctx->pDbg->pStringTbl[imm16Val];
result = loadResult;
break;
}
@@ -7773,8 +7769,8 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
arrayIdx = (u32)stackPtr->value.int_v;
goto set_index_ok;
case CHANS_VM_OBJ_TYPE_FLOAT: {
double stackFloat = *(double*)stackPtr;
if (stackFloat <= 4294967294.0 && 0.0 <= stackFloat) {
double stackFloat = stackPtr->value.float_v;
if (stackFloat >= 0.0 && stackFloat <= 4294967294.0) {
arrayIdx = (u32)stackFloat;
goto set_index_ok;
}
@@ -7885,8 +7881,7 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
computedAddr += pVm->pActiveCtx->pc + 5;
}
if (computedAddr < 1 || computedAddr >= pVm->pActiveCtx->pDbg->codeSize) {
result = CHANS_VM_ERR_CODE_RANGE;
break;
return CHANS_VM_ERR_CODE_RANGE;
}
pVm->pActiveCtx->pc = computedAddr;
opSize = 0;
@@ -7934,8 +7929,7 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
computedAddr += pVm->pActiveCtx->pc + 4;
}
if (computedAddr < 1 || computedAddr >= pVm->pActiveCtx->pDbg->codeSize) {
result = CHANS_VM_ERR_CODE_RANGE;
break;
return CHANS_VM_ERR_CODE_RANGE;
}
pVm->pActiveCtx->pc = computedAddr;
opSize = 0;
@@ -7960,11 +7954,13 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
}
case CHANS_VM_OP_DELETE_INDIRECT: {
result = CHANS_VM_ERR_DELETE_INDIRECT;
if (pVm->accumulator.type == CHANS_VM_TYPE_INDEX_REF) {
foundObj = VmGetArrayElement(vm, &pVm->accumulator, *((u32*)&pVm->accumulator.value + 1), vmFalse);
result = VmDeleteCommon(vm, foundObj);
CHANSVmObjHdr* accumulator = &pVm->accumulator;
CHANSVmErr deleteResult = CHANS_VM_ERR_DELETE_INDIRECT;
if (accumulator->type == CHANS_VM_TYPE_INDEX_REF) {
foundObj = VmGetArrayElement(vm, accumulator, accumulator->value.data.len, vmFalse);
deleteResult = VmDeleteCommon(vm, foundObj);
}
result = deleteResult;
break;
}
@@ -8008,34 +8004,27 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
if (pVm->pActiveCtx->stackDepth != 0 && pVm->pObjStackTopBuf + sizeof(CHANSVmObjHdr) <= pVm->pHeapEnd) {
CHANSVmObjHdr* stackTop = (CHANSVmObjHdr*)pVm->pObjStackTopBuf;
isTypeMatch = 0;
if (pVm->accumulator.type == stackTop->type) {
if (stackTop->type == pVm->accumulator.type) {
switch (stackTop->type) {
case CHANS_VM_OBJ_TYPE_INTEGER: {
u32 low1 = *(u32*)stackTop;
u32 low2 = *(u32*)&pVm->accumulator;
u32 high1 = *((u32*)stackTop + 1);
u32 high2 = *((u32*)&pVm->accumulator + 1);
u32 xor1 = low1 ^ low2;
u32 xor2 = high1 ^ high2;
isTypeMatch = !(xor1 | xor2);
isTypeMatch = stackTop->value.int_v == pVm->accumulator.value.int_v;
goto end_branch_check;
}
case CHANS_VM_OBJ_TYPE_FLOAT: {
double stackFloat = stackTop->value.float_v;
double accFloat = pVm->accumulator.value.float_v;
isTypeMatch = stackFloat == accFloat ? 1 : 0;
isTypeMatch = stackTop->value.float_v == pVm->accumulator.value.float_v;
goto end_branch_check;
}
case CHANS_VM_OBJ_TYPE_STRING: {
u32 len1, len2;
CHANSVmObjHdr* stackObj = (CHANSVmObjHdr*)pVm->pObjStackTopBuf;
const vmWStringObjVal* accumulatorString = pVm->accumulator.value.wstring_v;
const vmWStringObjVal* stackString = stackTop->value.wstring_v;
u32 strEqual;
isTypeMatch = 0;
len1 = stackObj->value.wstring_v->len;
len2 = pVm->accumulator.value.wstring_v->len;
len1 = stackString->len;
len2 = accumulatorString->len;
if (len1 == len2) {
strEqual = 0;
if (len1 == 0 || memcmp(stackObj->value.wstring_v->spData, pVm->accumulator.value.wstring_v->spData, len1) == 0) {
if (len1 == 0 || memcmp(stackString->spData, accumulatorString->spData, len1) == 0) {
strEqual = 1;
}
if (strEqual) {

View File

@@ -433,16 +433,18 @@ namespace textinput {
nw4r::ut::List_Append(&mAnmPanes, pane);
for (u16 j = 0; j < p.count; j++) {
const AnimationFile* animation = p.pAnims[j];
void* pResource = mpMultiArcResourceAccessor->GetResource(0, p.pAnims[j]->fileName);
const char* forceAddName = p.forceAddName;
u32 animationCount = p.count;
for (u16 j = 0; j < animationCount; j++) {
const AnimationFile* const& animation = p.pAnims[j];
void* pResource = mpMultiArcResourceAccessor->GetResource(0, animation->fileName);
AnimTransformPane* transform =
static_cast<AnimTransformPane*>(getLayout()->CreateAnimTransform(pResource, mpMultiArcResourceAccessor));
if (p.forceAddName == NULL) {
if (forceAddName == NULL) {
pane->addAnimation(allocator, animation->id, transform, false, true);
} else {
pane->forceAddAnimation(allocator, animation->id, transform, p.forceAddName, false, true);
pane->forceAddAnimation(allocator, animation->id, transform, forceAddName, false, true);
}
}
}
@@ -1082,7 +1084,7 @@ namespace textinput {
nw4r::lyt::TextBox* textPane = mpTextBoxPane[i]->getTextPane();
nw4r::lyt::Bounding* boundPane = mpBoundingPane[i]->getBoundPane();
nw4r::lyt::Size sz1 = textPane->GetSize();
textPane->SetString(L"");
textPane->SetString(scEmptyWChars);
textPane->SetVisible(false);
boundPane->SetSize(nw4r::lyt::Size(0.0f, sz1.height));
}
@@ -1683,9 +1685,9 @@ namespace textinput {
void UIOnOffButton::Create(nw4rmanager::Layout* layout) {
gui::PaneManager* mgr = layout->getPaneManager();
mpOnPictPane = mgr->searchPaneComponent("P_OnBtn");
mpOnBoundPane = mgr->searchPaneComponent("B_OnBtn");
mpOnAnmPane = static_cast<OnOffAnmPane*>(layout->searchAnmPane("P_OnBtn"));
mpOnPictPane = mgr->searchPaneComponent(scP_OnBtn);
mpOnBoundPane = mgr->searchPaneComponent(scB_OnBtn);
mpOnAnmPane = static_cast<OnOffAnmPane*>(layout->searchAnmPane(scP_OnBtn));
mpOffPictPane = mgr->searchPaneComponent(scCandidatePaneData.tail);
mpOffBoundPane = mgr->searchPaneComponent(scPaneNameTable);
mpOffAnmPane = static_cast<OnOffAnmPane*>(layout->searchAnmPane(scCandidatePaneData.tail));

View File

@@ -1169,7 +1169,7 @@ void LayoutByNW4R::create(MEMAllocator* allocator, EditBuffer* editBuffer) {
setVisible("N_2line", true);
mpPaneManager->setAllComponentTriggerTarget(false);
mpPaneManager->setAllBoundingBoxComponentTriggerTarget(true);
nw4r::lyt::Pane* pane = getPane(static_cast<const LanguagePaneData*>(mpLanguageData)->textBox);
nw4r::lyt::Pane* pane = mpLayout->GetRootPane()->FindPaneByName(static_cast<const LanguagePaneData*>(mpLanguageData)->textBox, true);
if (!pane) pane = mpLayout->GetRootPane()->FindPaneByName(getLanguageTextPane() ? static_cast<const LanguagePaneData*>(mpLanguageData)->textBox : "T_2l_TextBox", true);
mpPaneManager->getPaneComponentByPane(pane)->setTriggerTarget(true);
for (u32 buttonIndex = 0; buttonIndex < 2; ++buttonIndex) {
@@ -1187,7 +1187,7 @@ void LayoutByNW4R::create(MEMAllocator* allocator, EditBuffer* editBuffer) {
const char* bindingName = button.bindingName;
count = button.count;
for (u16 animationIndex = 0; animationIndex < count; ++animationIndex) {
const InputFormAnimationFile* file = button.files[animationIndex];
const InputFormAnimationFile* const& file = button.files[animationIndex];
void* resource = mpMultiArcResourceAccessor->GetResource(0, file->fileName, NULL);
AnimTransformPane* transform = static_cast<AnimTransformPane*>(getLayout()->CreateAnimTransform(resource, mpMultiArcResourceAccessor));
if (!bindingName) animationPane->addAnimation(allocator, file->id, transform, false, true);
@@ -3177,7 +3177,7 @@ u32 Base::calcCursorPos(f32 x, f32 y) {
info.character = *string;
calcRect(info);
lineBottom = lineTop + scale.y * (info.rect.bottom - info.rect.top);
f32 right = cursorX + scale.x * (info.rect.right - info.rect.left);
f32 right = cursorX + scale.x * info.rect.GetWidth();
if (doWordWrap(mpString->getWCString(), pos, cursorX)) {
if (localY >= lineTop && localY <= lineBottom) {
if (pos != 0) return pos - 1;
@@ -3186,14 +3186,14 @@ u32 Base::calcCursorPos(f32 x, f32 y) {
lineTop += scale.y * getLineHeight();
cursorX = getScale().x;
lineBottom = lineTop + scale.y * (info.rect.bottom - info.rect.top);
right = cursorX + scale.x * (info.rect.right - info.rect.left);
right = cursorX + scale.x * info.rect.GetWidth();
}
if (right >= scale.x * (mRect.right - mRect.left)) {
if (right >= scale.x * mRect.GetWidth()) {
if (localY >= lineTop && localY <= lineBottom) return pos;
lineTop += scale.y * getLineHeight();
cursorX = getScale().x;
lineBottom = lineTop + scale.y * (info.rect.bottom - info.rect.top);
right = cursorX + scale.x * (info.rect.right - info.rect.left);
right = cursorX + scale.x * info.rect.GetWidth();
}
if (x <= info.rect.left && localY >= lineTop && localY <= lineBottom) return pos;
if (*string == L'\n') {
@@ -3207,7 +3207,7 @@ u32 Base::calcCursorPos(f32 x, f32 y) {
if (cursorX + 0.5f * (right - cursorX) > x) return pos;
return pos + 1;
}
cursorX += scale.x * (info.rect.right - info.rect.left);
cursorX += scale.x * info.rect.GetWidth();
}
++string;
++pos;

View File

@@ -298,7 +298,6 @@ void WithZi::update() {
return;
}
wchar_t* candidateOutput = reinterpret_cast<wchar_t*>(&CandidatesBuffer[0x200]);
mSelectedCandidate = 0;
s32 elementCount = static_cast<u16>(setElementBuffer());
mSearch.language = getPredictLanguage();
@@ -307,7 +306,7 @@ void WithZi::update() {
mSearch.context = 1;
mSearch.getOptions = 0x81;
mSearch.elements = reinterpret_cast<wchar_t*>(ElementBuffer);
mSearch.candidates = candidateOutput;
mSearch.candidates = reinterpret_cast<wchar_t*>(&CandidatesBuffer[0x200]);
mSearch.maxCandidates = 0x28;
mSearch.elementCount = static_cast<u8>(elementCount);
mSearch.firstCandidate = 0;
@@ -355,25 +354,24 @@ void WithZi::update() {
ChangeDictionaryLanguage(getPredictLanguage());
u32 count = EZTXGetCandidates(&mSearch, mpDictionaryWork) & 0xff;
if (getPredictLanguage() == 1 && count == 0x61) {
wchar_t* candidateOutput = reinterpret_cast<wchar_t*>(&CandidatesBuffer[0x200]);
mSearch.firstCandidate = 0x61;
mSearch.candidates = reinterpret_cast<wchar_t*>(&CandidatesBuffer[0x2c2]);
mSearch.candidates = candidateOutput + 0xC2;
mSearch.maxCandidates = 199;
count = EZTXGetCandidates(&mSearch, mpDictionaryWork) & 0xff;
count += EZTXGetCandidates(&mSearch, mpDictionaryWork) & 0xff;
mSearch.firstCandidate = 0;
count += 0x61;
mSearch.candidates = candidateOutput;
}
if (static_cast<s32>(count) > 0x28) {
count = 0x28;
}
if (getPredictLanguage() == 1 && mbContextChanged != 0 &&
(mbContextChanged = 0, mSearch.wordCharCount == 0)) {
(mbContextChanged = 0, mSearch.count == 0)) {
u32 length = mCurrentWordLength;
u32 wordLength = wcslen((wchar_t*)LatestWord) & 0xff;
u32 copied;
u16* source = LatestWord + wordLength - length;
for (copied = 0; copied < length; ++copied) {
LatestWord[copied] = source[copied];
LatestWord[copied] = LatestWord[(wordLength - length) + copied];
}
LatestWord[copied] = 0;
mSearch.wordCharCount = wcslen((wchar_t*)LatestWord);
@@ -409,8 +407,10 @@ void WithZi::update() {
destination[1] = 0;
} else if (getPredictLanguage() == 0x12) {
u16* output = destination;
while (*source >= 0x100) {
*output++ = *source++;
u16 character;
while ((character = *source) >= 0x100) {
*output++ = character;
++source;
}
} else if (EZTXCopy(reinterpret_cast<wchar_t*>(destination), &mSearch, index & 0xff, mpDictionaryWork) == 0) {
goto nextCandidate;
@@ -430,6 +430,8 @@ void WithZi::update() {
if (position == 0) *candidate = util::toWUpper(*candidate);
else *candidate = util::toWLower(*candidate);
break;
case LM_3:
break;
default:
break;
}

View File

@@ -1179,10 +1179,10 @@ namespace ipl {
return;
}
if (mState != STATE_NORMAL || mMode != 0) {
return;
}
switch (mState) {
case STATE_NORMAL:
switch (mMode) {
case 0:
if (!mpFriendCache->isThere(buttonNo + mPage * BTN_MAX)) {
return;
}
@@ -1240,6 +1240,8 @@ namespace ipl {
snd::getSystem()->startSEwithPos("WIPL_SE_CH_HOLD", mDrag.mPos.x);
mState = STATE_DRAG;
}
}
}
void Address::start_drag_point_event(const char* paneName, controller::Interface* con) {
@@ -1425,10 +1427,7 @@ namespace ipl {
if (con->downTrg(controller::BTN_INTERACT)) {
Button* button = static_cast<Button*>(System::getScene(SCENE_BUTTON));
if (mState != STATE_COVER_NORMAL && mState != STATE_NORMAL) {
break;
}
if (mState == STATE_COVER_NORMAL || mState == STATE_NORMAL) {
if (Button::cmpButtonName(paneName, Button::BTN_EXIT) == 0) {
MailAddressSelect* mailAddrSel = static_cast<MailAddressSelect*>(System::getScene(SCENE_MAIL_ADDRESS_SELECT));
button->animation(Button::IDANIM_SELECT_CALENDAR_EXIT);
@@ -1477,7 +1476,7 @@ namespace ipl {
snd::getSystem()->startSE("WIPL_SE_FL_PAGE_DEC");
onPreviousPage();
}
break;
}
}
// fallthrough
}
@@ -1783,13 +1782,15 @@ namespace ipl {
nw4r::math::VEC3 baseTrans = mpLayout->FindPaneByName("N_base_move")->GetTranslate();
math::VEC2 pos = System::getControllerManager()->getController(mDrag.mChan)->getDpdProjectionPos();
nw4r::lyt::TextBox* textBox = static_cast<nw4r::lyt::TextBox*>(mpLayout->FindPaneByName("T_name_move"));
const u16* name = mpFriendCache->getInfo(mDrag.mButton + mDrag.mPage * BTN_MAX).attr.name;
f32 width = 0.0f;
if (textBox != NULL && name != NULL) {
textBox->GetFont()->GetWidth();
for (; *name != 0; name++) {
width += textBox->GetFont()->GetCharWidth(*name);
if (textBox != NULL) {
const u16* name = mpFriendCache->getInfo(mDrag.mButton + mDrag.mPage * BTN_MAX).attr.name;
if (name != NULL) {
textBox->GetFont()->GetWidth();
for (; *name != 0; name++) {
width += textBox->GetFont()->GetCharWidth(*name);
}
}
}
width += 0.01f;
@@ -1946,11 +1947,10 @@ namespace ipl {
}
void FriendListCache::update(u32 index, const wchar_t* name, u64 fdId) {
NWC24FriendInfo* info = &mInfos[index];
info->attr.fdId = fdId;
memset(info->attr.name, 0, sizeof(info->attr.name));
wcsncpy((wchar_t*)info->attr.name, name, 10);
System::getNwc24Manager()->updateFriendInfo(info, index);
mInfos[index].attr.fdId = fdId;
memset(mInfos[index].attr.name, 0, sizeof(mInfos[index].attr.name));
wcsncpy((wchar_t*)getInfo(index).attr.name, name, 10);
System::getNwc24Manager()->updateFriendInfo(&getInfo(index), index);
}
void FriendListCache::del(u32 index) {

View File

@@ -521,7 +521,8 @@ void ipl::scene::AddressEdit::create() {
set_textbox(textPane, friendText);
textPane = (mpCodeLayout)
->getNW4RLyt()->GetRootPane()->FindPaneByName("T_frnd_crd_00", true);
set_textbox(textPane, mString.mDisplayText);
friendText = mString.mDisplayText;
set_textbox(textPane, friendText);
mState = 0;
break;
}
@@ -2779,7 +2780,7 @@ void ipl::scene::AddressEdit::set_err_msg(wchar_t* outErrMsg, u32 outErrMsgLen,
swprintf(nwc24ErrStr, sizeof(nwc24ErrStr) / sizeof(wchar_t), L"%06d\n", errorCode);
wcsncat(outErrMsg, nwc24ErrStr, outErrMsgLen - wcslen(outErrMsg));
u32 messageId = MESG_ERROR_NWC24_SERVER;
u32 messageId;
switch (nwc24Err) {
case NWC24_ERR_NETWORK:
messageId = MESG_ERROR_NWC24_NETWORK;
@@ -2865,10 +2866,7 @@ void ipl::scene::AddressEdit::get_friendinfo() {
memcpy(&ipl::scene::sFriendInfo, &mpFriendCache->getInfo(mSelectedFriend),
sizeof(ipl::scene::sFriendInfo));
mString.setName(reinterpret_cast<const wchar_t*>(ipl::scene::sFriendInfo.attr.name));
const wchar_t* name = mString.mName;
nw4r::lyt::Pane* namePane =
mpCodeLayout->getNW4RLyt()->GetRootPane()->FindPaneByName("T_name_00", true);
set_textbox(namePane, name);
set_textbox(mpCodeLayout->getNW4RLyt()->GetRootPane()->FindPaneByName("T_name_00", true), mString.mName);
wchar_t wiiNo[0x100];
wchar_t email[0x102];
@@ -2881,10 +2879,7 @@ void ipl::scene::AddressEdit::get_friendinfo() {
ipl::utility::CharacterCode::ANSIToUTF16(email, reinterpret_cast<const u8*>(&ipl::scene::sFriendInfo.addr), 0x102);
mString.setEMail(email);
}
const wchar_t* displayText = mString.mDisplayText;
nw4r::lyt::Pane* friendCodePane =
mpCodeLayout->getNW4RLyt()->GetRootPane()->FindPaneByName("T_frnd_crd_00", true);
set_textbox(friendCodePane, displayText);
set_textbox(mpCodeLayout->getNW4RLyt()->GetRootPane()->FindPaneByName("T_frnd_crd_00", true), mString.mDisplayText);
memcpy(&mCreateID, &ipl::scene::sFriendInfo.attr.fdId, sizeof(mCreateID));
}

View File

@@ -1198,8 +1198,8 @@ copyIoDone:
renamedStatus = moveStatus;
memset(renamedStatus.company, 0, 2);
memset(renamedStatus.gameName, 0, 4);
memset(renamedStatus.fileName, 0, 0x20);
do {
memset(renamedStatus.fileName, 0, 0x20);
sprintf((char*)renamedStatus.fileName, "Broken File%03d", attempt);
result = __CARDSetStatusEx(slot, fileNo, &renamedStatus);
if (result < 0 && result != -7) {

View File

@@ -674,7 +674,8 @@ namespace ipl {
if (foundLangGroup) {
nw4r::lyt::Group* group = layout->FindGroupByName(langGroup);
for (nw4r::lyt::PaneLinkList::Iterator it = group->GetPaneList().GetBeginIter(); it != group->GetPaneList().GetEndIter(); it++) {
nw4r::lyt::Group* const& groupView = group;
for (nw4r::lyt::PaneLinkList::Iterator it = groupView->GetPaneList().GetBeginIter(); it != groupView->GetPaneList().GetEndIter(); it++) {
it->mTarget->SetVisible(true);
}
} else {
@@ -685,7 +686,8 @@ namespace ipl {
}
if (strcmp(scModuleData.langGroupLookup[region][i], langCodeBuf[scLangLookup[region][i]]) == 0) {
nw4r::lyt::Group* group = layout->FindGroupByName(scModuleData.langGroupLookup[region][i]);
for (nw4r::lyt::PaneLinkList::Iterator it = group->GetPaneList().GetBeginIter(); it != group->GetPaneList().GetEndIter(); it++) {
nw4r::lyt::Group* const& groupView = group;
for (nw4r::lyt::PaneLinkList::Iterator it = groupView->GetPaneList().GetBeginIter(); it != groupView->GetPaneList().GetEndIter(); it++) {
it->mTarget->SetVisible(true);
}
break;

View File

@@ -237,10 +237,7 @@ bool MemoryCardManager::isIconValidate(u8 slot, s16 index) {
bool MemoryCardManager::isBannerEnable(u8 slot, s16 index) {
CardIcons* icons = reinterpret_cast<CardIcons*>(memorycard::getIconStateArray());
u32 file = mFile[slot][index].fileNo;
memorycard::IconState* icon = &icons[slot][file];
u8 enabled = icon->bannerEnable;
return enabled != 0;
return icons[slot][mFile[slot][index].fileNo].bannerEnable != 0;
}
void MemoryCardManager::update_icon_anm() {

View File

@@ -1341,13 +1341,11 @@ namespace ipl {
wchar_t* titleName = System::getChannelManager()->getTitleName(
page, channelIndex, 0);
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
u32 nextTitleCount = *titleCount + 1;
*titleCount = nextTitleCount;
++*titleCount;
if (bytes < secondUsage[0] || blocks < secondUsage[1]) {
continue;
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
return true;
}
return true;
}
}
}

View File

@@ -3,6 +3,10 @@
#define IPL_SDMEMORY_DIALOG_STATE_ACCESSOR
#define IPL_SDMEMORY_COMPLETION_PCT_ACCESSOR
#define IPL_CHANNEL_TITLE_NOVTABLE
#include "math/iplInterporation.h"
#undef IPL_CHANNEL_TITLE_NOVTABLE
#include "scene/sdChannelTitle/iplSDChannelTitle.h"
#include "scene/sdChannelSelect/iplSDChannelSelect.h"
#include "system/iplSystem.h"
@@ -1554,15 +1558,5 @@ void SDChannelTitle::startResetting() {
snd::getSystem()->resetAllSound();
}
extern "C" void iplSDChannelTitle_onTitleButtonEvent(SDTitleButtonEventHandler* handler, u32 component,
u32 event, const controller::Interface* controller) {
handler->onEventDerived(component, event, controller);
}
extern "C" void iplSDChannelTitle_onTitlePaneEvent(SDTitlePaneEventHandler* handler, u32 component,
u32 event, const controller::Interface* controller) {
handler->onEvent(component, event, const_cast<controller::Interface*>(controller));
}
}
}

View File

@@ -617,6 +617,20 @@ int AOSS_Init_old(AOSSInitInput* input)
}
resultCode = 0xffffffff;
} else {
/* The original initialization path repeats this status check. */
if (state != 0) {
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = 0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
s_accessPointList = 0;
}
resultCode = 0xffffffff;
goto finish_initialization;
}
s_accessPointConfig = (int *)AOSSi_Alloc(0x58);
if (s_accessPointConfig == 0) {
input->status = 0xf;
@@ -724,19 +738,15 @@ handle_initial_link:
AOSSi_Free(s_accessPointList);
s_accessPointList = 0;
}
requestResult = 0;
state = 0;
do {
AOSSRequestRecord* currentRecord = &requestRecords.records[requestResult];
u16 transactionId;
memcpy(requestRecords.bytes + state,input->optionData,6);
transactionId = rand();
currentRecord->transactionId = transactionId;
receivedLength = SOHtoNs(transactionId);
currentRecord->transactionId = receivedLength;
requestResult++;
state += sizeof(AOSSRequestRecord);
} while (requestResult < 3);
{
int recordIndex;
for (recordIndex = 0; recordIndex < 3; recordIndex++) {
memcpy(requestRecords.records[recordIndex].address, input->optionData, 6);
requestRecords.records[recordIndex].transactionId = rand();
requestRecords.records[recordIndex].transactionId =
SOHtoNs(requestRecords.records[recordIndex].transactionId);
}
}
s_socket = SOSocket(2,2,0);
if (s_socket < 0) {
input->status = 0xf;
@@ -801,7 +811,7 @@ perform_request:
if (s_socketStarted == 1) {
s_socketStarted = 0;
requestResult = SOCleanup();
if (-1 < requestResult) goto request_socket_cleanup_complete;
if (requestResult >= 0) goto request_socket_cleanup_complete;
requestResult = -1;
}
else {
@@ -890,7 +900,6 @@ request_socket_cleanup_complete:
resultCode = 0xffffffff;
goto finish_initialization;
}
initialSleep = remainingWait <= 100 ? remainingWait : 100;
AOSSi_Sleep(remainingWait > 100 ? 100 : remainingWait);
if (remainingWait > 100) initialSleep = 100;
else initialSleep = remainingWait;
@@ -943,73 +952,76 @@ request_socket_cleanup_complete:
goto finish_initialization;
}
}
requestResult = s_socket;
switch (protocolState) {
case 0:
if (s_operationState != 2) {
s_operationState = 2;
AOSSi_Status(2);
}
requestResult = AOSSSendDiscoveryRequest(networkAddresses,&requestRecords,requestResult);
break;
case 1:
if (s_operationState != 3) {
s_operationState = 3;
AOSSi_Status(3);
}
requestResult = AOSSSendHelloRequest(networkAddresses,&requestRecords,requestResult);
{
int sendResult;
int requestSocket = s_socket;
switch (protocolState) {
case 0:
if (s_operationState != 2) {
s_operationState = 2;
AOSSi_Status(2);
}
sendResult = AOSSSendDiscoveryRequest(networkAddresses,&requestRecords,requestSocket);
break;
case 1:
if (s_operationState != 3) {
s_operationState = 3;
AOSSi_Status(3);
}
sendResult = AOSSSendHelloRequest(networkAddresses,&requestRecords,requestSocket);
break;
case 2:
if (s_operationState != 5) {
s_operationState = 5;
AOSSi_Status(5);
}
packetWords = s_responseBuffer;
memset(s_responseBuffer,0,0x5dc);
memcpy(messageIdentity,&requestRecords.records[2],8);
manufacturerLength = strlen(s_manufacturer);
AOSSXorBufferWithKey(messageIdentity,8,s_manufacturer,manufacturerLength);
receivedLength = SOHtoNs(1);
packetWords->initialLength = receivedLength;
packetWords->initialType = 0;
packetWords->initialSequence = 0;
packetWords->responseLength = SOHtoNs(0x3000);
packetWords->responseType = 0;
packetWords->finalLength = SOHtoNs(0);
packetWords->finalSequence = SOHtoNs(0);
packetWords->reserved = 0;
packetWords->messageType = 0x11;
memcpy(packetWords->messageIdentity,messageIdentity,8);
memset(&replyAddress,0,8);
replyAddress.family = 2;
replyAddress.port = SOHtoNs(0x5790);
replyAddress.address = SOHtoNl(s_runtime.ipAddress);
if ((s8)s_runtime.active == 0) {
replyAddress.address = 0xffffffff;
}
replyAddress.length = 8;
SOSendTo(requestResult,packetWords,0x18,0,&replyAddress);
requestResult = 0;
break;
case 2:
if (s_operationState != 5) {
s_operationState = 5;
AOSSi_Status(5);
}
packetWords = s_responseBuffer;
memset(s_responseBuffer,0,0x5dc);
memcpy(messageIdentity,&requestRecords.records[2],8);
manufacturerLength = strlen(s_manufacturer);
AOSSXorBufferWithKey(messageIdentity,8,s_manufacturer,manufacturerLength);
receivedLength = SOHtoNs(1);
packetWords->initialLength = receivedLength;
packetWords->initialType = 0;
packetWords->initialSequence = 0;
packetWords->responseLength = SOHtoNs(0x3000);
packetWords->responseType = 0;
packetWords->finalLength = SOHtoNs(0);
packetWords->finalSequence = SOHtoNs(0);
packetWords->reserved = 0;
packetWords->messageType = 0x11;
memcpy(packetWords->messageIdentity,messageIdentity,8);
memset(&replyAddress,0,8);
replyAddress.family = 2;
replyAddress.port = SOHtoNs(0x5790);
replyAddress.address = SOHtoNl(s_runtime.ipAddress);
if ((s8)s_runtime.active == 0) {
replyAddress.address = 0xffffffff;
}
replyAddress.length = 8;
SOSendTo(requestSocket,packetWords,0x18,0,&replyAddress);
sendResult = 0;
break;
default:
requestResult = -1;
break;
}
if (requestResult == -1) {
s_errorCode = protocolState + 0x1000;
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = (int *)0x0;
break;
default:
sendResult = -1;
break;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
s_accessPointList = 0;
if (sendResult == -1) {
s_errorCode = protocolState + 0x1000;
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
s_accessPointList = 0;
}
resultCode = 0xffffffff;
goto finish_initialization;
}
resultCode = 0xffffffff;
goto finish_initialization;
}
memset(packetBuffer,0,0x5f8);
pollTime.seconds = timeoutMilliseconds / 1000;
@@ -1028,10 +1040,12 @@ request_socket_cleanup_complete:
if (0 < requestResult) goto process_received_packet;
receivedPackets = receivedPackets + 1;
if (receivedPackets > attemptCount) {
switch (protocolState) {
case 0: s_errorCode = 0xf; break;
case 1: s_errorCode = 0x10; break;
default: s_errorCode = 0x11; break;
if (protocolState == 0) {
s_errorCode = 0xf;
} else if (protocolState == 1) {
s_errorCode = 0x10;
} else {
s_errorCode = 0x11;
}
protocolResult = -1;
goto close_protocol_socket;
@@ -1098,8 +1112,7 @@ process_received_packet:
}
else {
if (protocolState != requestResult) {
protocolState = requestResult;
if (requestResult != 2) goto perform_request;
if (requestResult != 2) goto advance_protocol_state;
if (s_socket != -1) {
SOClose(s_socket);
}
@@ -1237,7 +1250,8 @@ wait_for_packet:
goto finish_initialization;
}
AOSSi_Sleep(remainingWait > 100 ? 100 : remainingWait);
initialSleep = remainingWait <= 100 ? remainingWait : 100;
if (remainingWait > 100) initialSleep = 100;
else initialSleep = remainingWait;
}
if (AOSSi_cancel_flag == 1) {
input->status = 0xf;
@@ -1294,15 +1308,18 @@ wait_for_packet:
resultCode = 0xffffffff;
goto finish_initialization;
}
advance_protocol_state:
protocolState = requestResult;
goto perform_request;
}
protocolState = requestResult;
if (receivedPackets > waitSettings.halfwords.high) {
switch (requestResult) {
case 0: s_errorCode = 0xf; break;
case 1: s_errorCode = 0x10; break;
default: s_errorCode = 0x11; break;
if (requestResult == 0) {
s_errorCode = 0xf;
} else if (requestResult == 1) {
s_errorCode = 0x10;
} else {
s_errorCode = 0x11;
}
protocolResult = -1;
goto close_protocol_socket;
@@ -1322,8 +1339,7 @@ wait_for_packet:
resultCode = 0xffffffff;
goto finish_initialization;
}
if (retryDelay > 100) AOSSi_Sleep(100);
else AOSSi_Sleep(retryDelay);
AOSSi_Sleep(retryDelay > 100 ? 100 : retryDelay);
if (retryDelay > 100) delayStep = 100;
else delayStep = retryDelay;
}
@@ -1350,7 +1366,7 @@ close_protocol_socket:
if (s_socketStarted == 1) {
s_socketStarted = 0;
state = SOCleanup();
if (-1 < state) goto protocol_socket_cleanup_complete;
if (state >= 0) goto protocol_socket_cleanup_complete;
state = -1;
}
else {

View File

@@ -1442,8 +1442,6 @@ s32 ATERMRunConfigProtocol(void) {
AtermSocketAddress peerAddress;
AtermThreadBuffer* response = (AtermThreadBuffer*)&gAtermConfigurationResult.responseLength;
void* sessionKey = gAtermResponseBuffer.session.keyMaterial;
AtermMd5Context digestContext;
u8 digestLength[8];
s32 socket = 0;
s32 result = -5;
s32 failed = 0;
@@ -1617,13 +1615,11 @@ s32 ATERMRunConfigProtocol(void) {
u32 checksum = 0;
u8* cursor = gAtermConfigurationResult.packetBuffer;
u8* packetEnd = packet->payload + payloadLength;
u8* payload = packet->payload;
u8* payload;
for (; cursor < packetEnd; cursor++) {
checksum += *cursor;
}
if ((u16)checksum != SONtoHs(*(u16*)packetEnd)) {
payload = NULL;
}
payload = (u16)checksum == SONtoHs(*(u16*)packetEnd) ? packet->payload : NULL;
if (payload == NULL) {
payloadLength = 0;
} else if (sequence != 3) {
@@ -1652,6 +1648,8 @@ s32 ATERMRunConfigProtocol(void) {
}
{
AtermProgress progress;
AtermMd5Context digestContext;
u8 digestLength[8];
u32 authenticationTime = (u32)(OSGetTime() /
(__mulhwu(reciprocal, OS_BUS_CLOCK >> 2) >> 6));
u32 index;
@@ -1677,22 +1675,13 @@ s32 ATERMRunConfigProtocol(void) {
ATERMMd5Update(&digestContext, gAtermDigestFill,
digestBytes < 56 ? 56 - digestBytes : 120 - digestBytes);
ATERMMd5Update(&digestContext, digestLength, sizeof(digestLength));
response->authentication.digest[0] = digestContext.state[0];
response->authentication.digest[1] = digestContext.state[0] >> 8;
response->authentication.digest[2] = digestContext.state[0] >> 16;
response->authentication.digest[3] = digestContext.state[0] >> 24;
response->authentication.digest[4] = digestContext.state[1];
response->authentication.digest[5] = digestContext.state[1] >> 8;
response->authentication.digest[6] = digestContext.state[1] >> 16;
response->authentication.digest[7] = digestContext.state[1] >> 24;
response->authentication.digest[8] = digestContext.state[2];
response->authentication.digest[9] = digestContext.state[2] >> 8;
response->authentication.digest[10] = digestContext.state[2] >> 16;
response->authentication.digest[11] = digestContext.state[2] >> 24;
response->authentication.digest[12] = digestContext.state[3];
response->authentication.digest[13] = digestContext.state[3] >> 8;
response->authentication.digest[14] = digestContext.state[3] >> 16;
response->authentication.digest[15] = digestContext.state[3] >> 24;
for (index = 0; index < 4; index++) {
u32 word = digestContext.state[index];
response->authentication.digest[index * 4] = word;
response->authentication.digest[index * 4 + 1] = word >> 8;
response->authentication.digest[index * 4 + 2] = word >> 16;
response->authentication.digest[index * 4 + 3] = word >> 24;
}
{
u8* contextByte = (u8*)&digestContext;
for (index = 0; index < sizeof(digestContext); index++) {
@@ -1750,13 +1739,11 @@ s32 ATERMRunConfigProtocol(void) {
u32 checksum = 0;
u8* cursor = gAtermConfigurationResult.packetBuffer;
u8* packetEnd = packet->payload + payloadLength;
u8* payload = packet->payload;
u8* payload;
for (; cursor < packetEnd; cursor++) {
checksum += *cursor;
}
if ((u16)checksum != SONtoHs(*(u16*)packetEnd)) {
payload = NULL;
}
payload = (u16)checksum == SONtoHs(*(u16*)packetEnd) ? packet->payload : NULL;
if (payload == NULL) {
payloadLength = 0;
} else if (sequence != 5) {

View File

@@ -1379,30 +1379,34 @@ namespace ipl {
return;
}
ext_ead::www::BrowserThread* browser = surface->GetBrowserThread();
if (browser == NULL) {
// One pointer, overwritten by the standard-buffer fetch, so the
// browser `this` and standardBuffer share a callee-saved reg.
void* held = surface->GetBrowserThread();
if (held == NULL) {
return;
}
if (browser->GetTextureBuffer(0, NULL) == NULL) {
if (static_cast<ext_ead::www::BrowserThread*>(held)->GetTextureBuffer(0, NULL) == NULL) {
return;
}
ext_ead::www::BrowserWindow* browserWindow =
static_cast<ext_ead::www::BrowserWindow*>(browser->mpBrowserWindows[0]);
if ((browserWindow != NULL ? browserWindow->unk_0x2C4[3] : 0) != 0) {
static_cast<ext_ead::www::BrowserWindow*>(static_cast<ext_ead::www::BrowserThread*>(held)->mpBrowserWindows[0]);
if ((browserWindow == NULL ? 0 : browserWindow->unk_0x2C4[3]) != 0) {
unk_0x91C[2] = 1;
mState = 0;
browserWindow = static_cast<ext_ead::www::BrowserWindow*>(browser->mpBrowserWindows[0]);
browserWindow = static_cast<ext_ead::www::BrowserWindow*>(static_cast<ext_ead::www::BrowserThread*>(held)->mpBrowserWindows[0]);
if (browserWindow != NULL) {
browserWindow->unk_0x2C4[3] = 0;
}
www::trasition::ScrollState scrollState = www::trasition::GetScrollState();
browserScrollDirection = scrollState == www::trasition::SCROLL_LEFT
? 1
: (scrollState == www::trasition::SCROLL_RIGHT ? -1 : 0);
if (scrollState == www::trasition::SCROLL_LEFT) {
browserScrollDirection = 1;
} else {
browserScrollDirection = scrollState == www::trasition::SCROLL_RIGHT ? -1 : 0;
}
www::trasition::ResetScrollState();
void* changedWideBuffer = browser->GetTextureBuffer(1, NULL);
void* changedStandardBuffer = browser->GetTextureBuffer(0, NULL);
void* changedWideBuffer = static_cast<ext_ead::www::BrowserThread*>(held)->GetTextureBuffer(1, NULL);
void* changedStandardBuffer = static_cast<ext_ead::www::BrowserThread*>(held)->GetTextureBuffer(0, NULL);
OSReport("changed %p %p\n", changedStandardBuffer, changedWideBuffer);
ext_ead::www::Heap::reportLeaHeap();
}
@@ -1415,8 +1419,9 @@ namespace ipl {
WWWRect* standardRect;
WWWRect* wideRect;
void* wideBuffer = browser->GetTextureBuffer(1, &wideRect);
void* standardBuffer = browser->GetTextureBuffer(0, &standardRect);
void* wideBuffer = static_cast<ext_ead::www::BrowserThread*>(held)->GetTextureBuffer(1, &wideRect);
held = static_cast<ext_ead::www::BrowserThread*>(held)->GetTextureBuffer(0, &standardRect);
void* standardBuffer = held;
nw4r::ut::Rect projection4x3;
System::getProjectionRect4x3(&projection4x3);
int screenWidth = abs(static_cast<int>(projection4x3.GetWidth()));
@@ -1443,33 +1448,33 @@ namespace ipl {
int wideWidth = abs(static_cast<int>(projection16x9.GetWidth()));
int wideHeight = abs(static_cast<int>(projection16x9.GetHeight()));
f32 wideLeft = -wideWidth / 2;
f32 wideTop = wideHeight / 2;
f32 wideTopL = wideHeight / 2;
f32 wideRight = wideWidth / 2;
nw4r::ut::Rect leftSide(wideLeft, wideTop,
f32 wideTopR = wideHeight / 2;
nw4r::ut::Rect leftSide(wideLeft, wideTopL,
wideLeft + sideDescriptor->textureHeader->width,
wideTop - sideDescriptor->textureHeader->height);
wideTopL - sideDescriptor->textureHeader->height);
nw4r::ut::Rect rightSide(wideRight - sideDescriptor->textureHeader->width,
wideTop, wideRight, wideTop - sideDescriptor->textureHeader->height);
wideTopR, wideRight, wideTopR - sideDescriptor->textureHeader->height);
if (browserScrollDirection != 0) {
nw4r::lyt::Material* wideMaterial =
void* wideMaterial =
mpChangeLayout->FindPaneByName("N_Tra0")->FindMaterialByName("Tex0");
nw4r::lyt::Material* firstStandardMaterial =
mpChangeLayout->FindPaneByName("N_Tra0")->FindMaterialByName("Tex1");
nw4r::lyt::Material* secondStandardMaterial =
mpChangeLayout->FindPaneByName("N_Tra0")->FindMaterialByName("Tex2");
wideMaterial->SetTexture(0, wideTexture);
static_cast<nw4r::lyt::Material*>(wideMaterial)->SetTexture(0, wideTexture);
firstStandardMaterial->SetTexture(0, standardTexture);
secondStandardMaterial->SetTexture(0, standardTexture);
mpChangeLayout->FindPaneByName("N_Tra0")->SetVisible(true);
if (browserScrollDirection == 1) {
utility::FrameController* animation = mpSecondAnimation;
animation->initFrame();
animation->restart();
wideMaterial = mpSecondAnimation;
static_cast<utility::FrameController*>(wideMaterial)->initFrame();
static_cast<utility::FrameController*>(wideMaterial)->restart();
} else {
utility::FrameController* animation = mpFirstAnimation;
animation->initFrame();
animation->restart();
wideMaterial = mpFirstAnimation;
static_cast<utility::FrameController*>(wideMaterial)->initFrame();
static_cast<utility::FrameController*>(wideMaterial)->restart();
}
mpChangeLayout->calc();
browserScrollDirection = 0;
@@ -1509,13 +1514,44 @@ namespace ipl {
}
if (mpWiiSettingFlag->smthMsgData >= 2 && mpWiiSettingFlag->smthMsgData <= 7) {
GXRenderModeObj renderMode = *System::getRenderModeObj();
GXRenderModeObj* pRmode = System::getRenderModeObj();
GXRenderModeObj renderMode;
volatile GXRenderModeObj* srcMode = pRmode;
volatile GXRenderModeObj* dstMode = &renderMode;
int n = 12;
u8* src;
u8* dst = &renderMode.aa;
src = &pRmode->aa;
dstMode->viTVmode = srcMode->viTVmode;
dstMode->fbWidth = srcMode->fbWidth;
dstMode->efbHeight = srcMode->efbHeight;
dstMode->xfbHeight = srcMode->xfbHeight;
dstMode->viXOrigin = srcMode->viXOrigin;
dstMode->viYOrigin = srcMode->viYOrigin;
dstMode->viWidth = srcMode->viWidth;
dstMode->viHeight = srcMode->viHeight;
dstMode->xFBmode = srcMode->xFBmode;
dstMode->field_rendering = srcMode->field_rendering;
dstMode->aa = srcMode->aa;
for (; n != 0; n--) {
dst[1] = src[1];
dst[2] = src[2];
src += 2;
dst += 2;
}
dstMode->vfilter[0] = srcMode->vfilter[0];
dstMode->vfilter[1] = srcMode->vfilter[1];
dstMode->vfilter[2] = srcMode->vfilter[2];
dstMode->vfilter[3] = srcMode->vfilter[3];
dstMode->vfilter[4] = srcMode->vfilter[4];
dstMode->vfilter[5] = srcMode->vfilter[5];
dstMode->vfilter[6] = srcMode->vfilter[6];
u32 left;
u32 top;
u32 width;
u32 height;
GXGetScissor(&left, &top, &width, &height);
GXSetScissor(0, renderMode.efbHeight / 2 - 0xA4, renderMode.fbWidth, 0x132);
GXSetScissor(0, dstMode->efbHeight / 2 - 0xA4, dstMode->fbWidth, 0x132);
mpMainLayout->draw();
GXSetScissor(left, top, width, height);
}

View File

@@ -211,13 +211,13 @@ namespace ipl {
systemDict = System::getZiDicData(i);
}
if (oemDict == NULL && System::getZiDicData(i) != NULL) {
oemDict = System::getZiDicData(oemIndex);
oemDict = System::getZiOemDicData(oemIndex - EZTX_LANG_MAX);
}
}
for (int i = 0, oemIndex = EZTX_LANG_MAX; i < EZTX_LANG_MAX; i++, oemIndex++) {
u8* usedSystemDict = System::getZiDicData(i);
u8* usedOemDict = System::getZiDicData(oemIndex);
u8* usedOemDict = System::getZiOemDicData(oemIndex - EZTX_LANG_MAX);
usedSystemDict = usedSystemDict != NULL ? usedSystemDict : systemDict;
if (usedOemDict == NULL) {

View File

@@ -931,17 +931,15 @@ void CArGBAOdh::cdj_c_makeHeader(SArCDJ_OdhMaster* master, u32 size) {
}
s32 CArGBAOdh::cdj_c_colorConv(SArCDJ_OdhMaster* master, u8* sourceData, int format) {
u32 paddedWidth;
u16 width;
u16 height;
u8* workPlane;
int sourceStride;
u8* crPlane;
u8* cbPlane;
u8* crPlane;
u16* dimensions;
int rowIndex;
int sourceStride;
int i;
u16 dimension;
u16 paddedDimensions[2];
dimensions = &master->width;
@@ -952,11 +950,11 @@ s32 CArGBAOdh::cdj_c_colorConv(SArCDJ_OdhMaster* master, u8* sourceData, int for
height = dimensions[1];
for (i = 0; i < 2; i++) {
dimension = dimensions[i];
if ((dimension & 7) != 0) {
paddedDimensions[i] = (dimension + 8) - (dimension & 7);
u16 remainder = dimensions[i] & 7;
if (remainder != 0) {
paddedDimensions[i] = (dimensions[i] + 8) - remainder;
} else {
paddedDimensions[i] = dimension;
paddedDimensions[i] = dimensions[i];
}
}
@@ -972,13 +970,12 @@ s32 CArGBAOdh::cdj_c_colorConv(SArCDJ_OdhMaster* master, u8* sourceData, int for
}
}
paddedWidth = paddedDimensions[0];
for (rowIndex = 0; rowIndex < (s32)height; rowIndex++) {
LineConv11(sourceData + (rowIndex & 3) * 8 + rowIndex / 4 * sourceStride, workPlane, cbPlane, crPlane,
dimensions[0], dimensions[1], (const long*)gArConvPlttTbl, format);
workPlane += paddedWidth;
cbPlane += paddedWidth;
crPlane += paddedWidth;
workPlane += paddedDimensions[0];
cbPlane += paddedDimensions[0];
crPlane += paddedDimensions[0];
}
return 0;
@@ -1362,12 +1359,10 @@ s32 CArGBAOdh::cdj_d_initializeDecompressOdh(SArCDJ_OdhMaster* master, u8* workB
}
s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int workSize) {
int blockStride;
int workBufferSize = workSize;
u8 xSampling;
u8 coefficientIndex;
u16 blockWidth;
int blockRowStride;
int planeOffset;
u32 sourceLimit = srcSize;
int statusOrOffset;
@@ -1380,8 +1375,6 @@ s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int w
blockWidth = master->blocksWide;
blockRowSize = (u32)blockWidth * 0x38;
rowStride = (u32)blockWidth << 3;
blockRowStride = blockRowSize * 2;
blockStride = (u32)blockWidth << 4;
do {
xSampling = master->xSampling;
if ((xSampling == 1U) && (master->ySampling == 1U)) {
@@ -1412,9 +1405,9 @@ s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int w
coefficientIndex = odh_natural_order[naturalIndex];
master->coefficients[coefficientIndex] = master->dcCoefficients[naturalIndex];
}
statusOrOffset = ((u32)master->blockY << 6) * (u32)master->blocksWide +
((u32)master->blocksHigh * ((u32)master->blocksWide << 6) +
(u32)master->blockX * 8);
statusOrOffset = (u32)master->blockX * 8 +
(u32)master->blocksWide * ((u32)master->blockY << 6) +
(u32)master->blocksHigh * ((u32)master->blocksWide << 6);
if (statusOrOffset + blockRowSize + 8 > workBufferSize) {
statusOrOffset = -0x7ffffffa;
goto finishBlock;
@@ -1454,14 +1447,14 @@ s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int w
}
planeOffset = (u32)master->blockX * 0x10 +
(u32)master->blocksWide * ((u32)master->blockY << 6) * 2;
requiredBlockEnd = planeOffset + blockRowStride + 8;
requiredBlockEnd = planeOffset + (blockRowSize * 2) + 8;
if (requiredBlockEnd > workBufferSize) {
statusOrOffset = -0x7ffffffa;
goto finishBlock;
}
idct_fast
(range_limit,master->quantizationTables,master->coefficients,master->workBuffer + planeOffset
,blockStride);
, ((u32)blockWidth << 4));
statusOrOffset = huffmanDecoder
(master->dcCoefficients, &master->luminanceRequest, (u16**)hufftreePtr.tables, 0, sourceLimit);
master->chrominanceRequest.bitstream = master->luminanceRequest.bitstream;
@@ -1477,7 +1470,7 @@ s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int w
}
idct_fast
(range_limit,master->quantizationTables,master->coefficients,
planeOffset + master->workBuffer + 8,blockStride);
(u8*)((u32)planeOffset + (u32)master->workBuffer) + 8, ((u32)blockWidth << 4));
statusOrOffset = huffmanDecoder
(master->dcCoefficients, &master->chrominanceRequest, (u16**)(hufftreePtr.tables + 2), 1, sourceLimit);
if (statusOrOffset != 0) return statusOrOffset;
@@ -1543,7 +1536,7 @@ s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int w
coefficientIndex = odh_natural_order[naturalIndex];
master->coefficients[coefficientIndex] = master->dcCoefficients[naturalIndex];
}
planeOffset = planeOffset + (u32)master->blocksWide * 0x40;
planeOffset += (u32)master->blocksWide << 6;
if (planeOffset + blockRowSize + 8 > workBufferSize) {
statusOrOffset = -0x7ffffffa;
goto finishBlock;
@@ -1600,14 +1593,14 @@ s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int w
}
planeOffset = (u32)master->blockX * 0x10 +
(u32)master->blocksWide * ((u32)master->blockY << 6) * 4;
requiredBlockEnd = planeOffset + blockRowStride + 8;
requiredBlockEnd = planeOffset + (blockRowSize * 2) + 8;
if (requiredBlockEnd > workBufferSize) {
statusOrOffset = -0x7ffffffa;
goto finishBlock;
}
idct_fast
(range_limit,master->quantizationTables,master->coefficients,master->workBuffer + planeOffset
,blockStride);
, ((u32)blockWidth << 4));
statusOrOffset = huffmanDecoder
(master->dcCoefficients, &master->luminanceRequest, (u16**)hufftreePtr.tables, 0, sourceLimit);
if (statusOrOffset != 0) return statusOrOffset;
@@ -1618,13 +1611,13 @@ s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int w
}
int nextOffset = planeOffset + 8;
planeOffset = nextOffset;
if (nextOffset + blockRowStride + 8 > workBufferSize) {
if (nextOffset + (blockRowSize * 2) + 8 > workBufferSize) {
statusOrOffset = -0x7ffffffa;
goto finishBlock;
}
idct_fast
(range_limit,master->quantizationTables,master->coefficients,master->workBuffer + nextOffset
,blockStride);
, ((u32)blockWidth << 4));
statusOrOffset = huffmanDecoder
(master->dcCoefficients, &master->luminanceRequest, (u16**)hufftreePtr.tables, 0, sourceLimit);
if (statusOrOffset != 0) return statusOrOffset;
@@ -1633,15 +1626,16 @@ s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int w
coefficientIndex = odh_natural_order[naturalIndex];
master->coefficients[coefficientIndex] = master->dcCoefficients[naturalIndex];
}
planeOffset = planeOffset + (u32)master->blocksWide * 0x80 + -8;
requiredBlockEnd = planeOffset + blockRowStride + 8;
if (requiredBlockEnd > workBufferSize) {
// Store the updated plane in requiredBlockEnd so MWCC keeps it in r15.
requiredBlockEnd = planeOffset + (u32)master->blocksWide * 0x80 + -8;
planeOffset = requiredBlockEnd + (blockRowSize * 2) + 8;
if (planeOffset > workBufferSize) {
statusOrOffset = -0x7ffffffa;
goto finishBlock;
}
idct_fast
(range_limit,master->quantizationTables,master->coefficients,master->workBuffer + planeOffset
,blockStride);
(range_limit,master->quantizationTables,master->coefficients,master->workBuffer + requiredBlockEnd
, ((u32)blockWidth << 4));
statusOrOffset = huffmanDecoder
(master->dcCoefficients, &master->luminanceRequest, (u16**)hufftreePtr.tables, 0, sourceLimit);
master->chrominanceRequest.bitstream = master->luminanceRequest.bitstream;
@@ -1651,13 +1645,13 @@ s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int w
coefficientIndex = odh_natural_order[naturalIndex];
master->coefficients[coefficientIndex] = master->dcCoefficients[naturalIndex];
}
if (requiredBlockEnd + 8 > workBufferSize) {
if (planeOffset + 8 > workBufferSize) {
statusOrOffset = -0x7ffffffa;
goto finishBlock;
}
idct_fast
(range_limit,master->quantizationTables,master->coefficients,
planeOffset + master->workBuffer + 8,blockStride);
(u8*)((u32)requiredBlockEnd + (u32)master->workBuffer) + 8, ((u32)blockWidth << 4));
statusOrOffset = huffmanDecoder
(master->dcCoefficients, &master->chrominanceRequest, (u16**)(hufftreePtr.tables + 2), 1, sourceLimit);
if (statusOrOffset != 0) return statusOrOffset;
@@ -1696,9 +1690,9 @@ s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int w
(range_limit,master->quantizationTables + 64,master->coefficients,master->workBuffer + statusOrOffset,
rowStride);
}
blockX = master->blockX + 1;
master->blockX = blockX;
if (blockX == master->blocksWide) {
int nextBlockX = master->blockX + 1;
master->blockX = nextBlockX;
if ((u16)nextBlockX == master->blocksWide) {
master->blockX = 0;
master->blockY = master->blockY + 1;
}

View File

@@ -884,172 +884,187 @@ namespace ipl {
return ret;
}
void ESMisc::DeleteUnauthorizedData(EGG::Heap* heap) {
u32 titleCount = 0;
ESTitleId* titleIds = NULL;
char path[88];
static inline void verifySavedataZD(EGG::Heap* heap, ESTitleId titleId, NANDFileInfo* fileInfo) {
char path[NAND_MAX_PATH];
s32 ret;
u8* saveData = NULL;
BOOL fileOpen = FALSE;
BOOL deleteSaveData = FALSE;
sprintf(path, "/title/%08x/%08x/data/%s", (u32)((titleId & 0x00FFFFFFFFFFFFFFULL) >> 32), (u32)(titleId & 0x00FFFFFFFFFFFFFFULL), "zeldaTp.dat");
if (!ESMisc::ChangeUid(titleId)) {
OSReport("%s::%s: ChangeUid failed\n", __FILE__, __FUNCTION__);
ESMisc::DeleteTitle(heap, titleId);
} else {
ret = NANDPrivateOpen(path, fileInfo, NAND_ACCESS_READ);
if (ret == NAND_RESULT_NOEXISTS) {
OSReport("%s::%s: Does not exist %s: %d\n", __FILE__, __FUNCTION__, path, ret);
} else if (ret != NAND_RESULT_OK) {
OSReport("%s::%s: Open save data file failed: %d\n", __FILE__, __FUNCTION__, ret);
} else {
fileOpen = TRUE;
saveData = (u8*)heap->alloc(0x4000, -DEFAULT_ALIGN);
if (saveData == NULL) {
OSReport("%s::%s: Alloc failed: %d\n", __FILE__, __FUNCTION__, -2);
} else {
memset(saveData, 0, 0x4000);
ret = NANDRead(fileInfo, saveData, 0x4000);
if (ret < 0) {
OSReport("%s::%s: Read file failed: %d\n", __FILE__, __FUNCTION__, ret);
goto cleanup;
} else if (ret != 0x4000) {
OSReport("%s::%s: File size is not correct: %d\n", __FILE__, __FUNCTION__, ret);
deleteSaveData = TRUE;
} else {
u32 offset = 8;
u32 j = 0;
BOOL valid = FALSE;
while (j < 3) {
u8* block = saveData + offset;
if (!checkForNullTermination((char*)block + 0x4e, 8) ||
!checkForNullTermination((char*)block + 0x58, 8) ||
!checkForNullTermination((char*)block + 0x72, 8) ||
!checkForNullTermination((char*)block + 0x8e, 8) ||
!checkForNullTermination((char*)block + 0x1b4, 0x11) ||
!checkForNullTermination((char*)block + 0x1c5, 0x11)) {
goto verify_failed;
}
j++;
offset += 0xa94;
}
offset = 0x2008;
j = 0;
while (j < 3) {
u8* block = saveData + offset;
if (!checkForNullTermination((char*)block + 0x4e, 8) ||
!checkForNullTermination((char*)block + 0x58, 8) ||
!checkForNullTermination((char*)block + 0x72, 8) ||
!checkForNullTermination((char*)block + 0x8e, 8) ||
!checkForNullTermination((char*)block + 0x1b4, 0x11) ||
!checkForNullTermination((char*)block + 0x1c5, 0x11)) {
goto verify_failed;
}
j++;
offset += 0xa94;
}
valid = TRUE;
verify_failed:
if (!valid) {
OSReport("%s::%s: Verify failed for %016llx\n", __FILE__, __FUNCTION__,
titleId);
deleteSaveData = TRUE;
}
}
NANDClose(fileInfo);
fileOpen = FALSE;
if (deleteSaveData) {
ESMisc::DeleteSavedata(titleId, heap);
}
}
}
}
cleanup:
if (saveData != NULL) {
heap->free(saveData);
}
if (fileOpen) {
NANDClose(fileInfo);
}
ESMisc::ChangeUid(SYSMENU_TITLE_ID);
}
static inline s32 DeleteTicketsForce(EGG::Heap* heap, ESTitleId titleId, u8* ticketViews, u32* ticketViewCount) {
ESTicketView* ticketViewList = NULL;
s32 ret;
memset(ticketViews, 0, OSRoundUp32B(sizeof(ESTicketView)));
ret = ES_GetTicketViews(titleId, NULL, ticketViewCount);
if (ret != ES_ERR_OK) {
OSReport("%s::%s: ES_GetTicketViews failed: %d for %016llx\n", __FILE__, __FUNCTION__, ret, titleId);
goto cleanup;
}
if (*ticketViewCount == 0) {
return ret;
}
ticketViewList = (ESTicketView*)heap->alloc(*ticketViewCount * OSRoundUp32B(sizeof(ESTicketView)), -DEFAULT_ALIGN);
ret = ES_GetTicketViews(titleId, ticketViewList, ticketViewCount);
if (ret != ES_ERR_OK) {
OSReport("%s::%s: ES_GetTicketViews failed: %d for %016llx\n", __FILE__, __FUNCTION__, ret, titleId);
goto cleanup;
}
for (u32 j = 0; j < *ticketViewCount; j++) {
memcpy(ticketViews, (u8*)ticketViewList + j * sizeof(ESTicketView), sizeof(ESTicketView));
ret = ES_DeleteTicket((ESTicketView*)ticketViews);
if (ret != ES_ERR_OK) {
OSReport("%s::%s: ES_DeleteTicket failed: %d for %016llx\n", __FILE__, __FUNCTION__, ret,
((ESTicketView*)ticketViews)->ticketId);
}
}
cleanup:
if (ticketViewList != NULL) {
heap->free(ticketViewList);
}
return ret;
}
static inline s32 InitSavedata(EGG::Heap* heap) {
u8 ticketViews[OSRoundUp32B(sizeof(ESTicketView))] ALIGN32;
NANDFileInfo fileInfo ALIGN32;
u8 ticketViews[0xe0] ALIGN32;
u32 ticketViewCount;
ESTicketView* ticketViewList;
ESTitleId* titleIds = NULL;
u32 titleCount = 0;
s32 ret = ES_ListTitlesOnCard(NULL, &titleCount);
if (ret == ES_ERR_OK) {
titleIds = (ESTitleId*)heap->alloc(OSRoundUp32B(titleCount * sizeof(ESTitleId)), -DEFAULT_ALIGN);
if (ret != ES_ERR_OK) {
OSReport("%s::%s: Failed to ES_ListTitlesOnCard1: %d\n", __FILE__, __FUNCTION__, ret);
goto cleanup;
}
titleIds = (ESTitleId*)heap->alloc(OSRoundUp32B(titleCount * sizeof(ESTitleId)), -DEFAULT_ALIGN);
if (titleIds == NULL) {
OSReport("%s::%s: Unable to allocate\n", __FILE__, "InitSavedata");
} else {
ret = ES_ListTitlesOnCard(titleIds, &titleCount);
if (ret == ES_ERR_OK) {
u32 titleIdOffset = 0;
for (u32 i = 0; i < titleCount; i++) {
u32 titleIdHi = *(u32*)((u8*)titleIds + titleIdOffset);
u32 titleIdLo = *(u32*)((u8*)titleIds + titleIdOffset + 4);
if ((titleIdLo & 0xffffff00) == 0x525a4400 && titleIdHi == 0x10000) {
u8* saveData = NULL;
BOOL fileOpen = FALSE;
BOOL deleteSaveData = FALSE;
sprintf(path - 8, "/title/%08x/%08x/data/%s", titleIdHi & 0xffffff, titleIdLo, "zeldaTp.dat");
if (!ChangeUid(((ESTitleId)titleIdHi << 32) | titleIdLo)) {
OSReport("%s::%s: ChangeUid failed\n", __FILE__, "verifySavedataZD");
DeleteTitle(heap, ((ESTitleId)titleIdHi << 32) | titleIdLo);
} else {
ret = NANDPrivateOpen(path - 8, (NANDFileInfo*)((u8*)&fileInfo - 0x20), NAND_ACCESS_READ);
if (ret == NAND_RESULT_NOEXISTS) {
OSReport("%s::%s: Does not exist %s: %d\n", __FILE__, "verifySavedataZD", path - 8, ret);
} else if (ret != NAND_RESULT_OK) {
OSReport("%s::%s: Open save data file failed: %d\n", __FILE__, "verifySavedataZD", ret);
} else {
fileOpen = TRUE;
saveData = (u8*)heap->alloc(0x4000, -DEFAULT_ALIGN);
if (saveData == NULL) {
OSReport("%s::%s: Alloc failed: %d\n", __FILE__, "verifySavedataZD", -2);
} else {
memset(saveData, 0, 0x4000);
ret = NANDRead((NANDFileInfo*)((u8*)&fileInfo - 0x20), saveData, 0x4000);
if (ret < 0) {
OSReport("%s::%s: Read file failed: %d\n", __FILE__, "verifySavedataZD", ret);
} else if (ret != 0x4000) {
OSReport("%s::%s: File size is not correct: %d\n", __FILE__, "verifySavedataZD", ret);
deleteSaveData = TRUE;
} else {
u32 offset = 8;
u32 j = 0;
BOOL valid = FALSE;
while (j < 3) {
u8* block = saveData + offset;
if (!checkForNullTermination((char*)block + 0x4e, 8) ||
!checkForNullTermination((char*)block + 0x58, 8) ||
!checkForNullTermination((char*)block + 0x72, 8) ||
!checkForNullTermination((char*)block + 0x8e, 8) ||
!checkForNullTermination((char*)block + 0x1b4, 0x11) ||
!checkForNullTermination((char*)block + 0x1c5, 0x11)) {
goto verify_failed;
}
j++;
offset += 0xa94;
}
offset = 0x2008;
j = 0;
while (j < 3) {
u8* block = saveData + offset;
if (!checkForNullTermination((char*)block + 0x4e, 8) ||
!checkForNullTermination((char*)block + 0x58, 8) ||
!checkForNullTermination((char*)block + 0x72, 8) ||
!checkForNullTermination((char*)block + 0x8e, 8) ||
!checkForNullTermination((char*)block + 0x1b4, 0x11) ||
!checkForNullTermination((char*)block + 0x1c5, 0x11)) {
goto verify_failed;
}
j++;
offset += 0xa94;
}
valid = TRUE;
verify_failed:
if (!valid) {
OSReport("%s::%s: Verify failed for %016llx\n", __FILE__, "verifySavedataZD",
((ESTitleId)titleIdHi << 32) | titleIdLo);
deleteSaveData = TRUE;
}
}
NANDClose((NANDFileInfo*)((u8*)&fileInfo - 0x20));
fileOpen = FALSE;
if (deleteSaveData) {
DeleteSavedata(((ESTitleId)titleIdHi << 32) | titleIdLo, heap);
}
}
}
}
if (saveData != NULL) {
heap->free(saveData);
}
if (fileOpen) {
NANDClose((NANDFileInfo*)((u8*)&fileInfo - 0x20));
}
ChangeUid(SYSMENU_TITLE_ID);
continue;
}
if ((((ESTitleId)titleIdHi << 32) | titleIdLo) == 0x0001000844495343ULL ||
((((ESTitleId)titleIdHi << 32) | titleIdLo) < 0x0001000844495343ULL &&
((((ESTitleId)titleIdHi << 32) | titleIdLo) == 0x000100014a4f4449ULL ||
((((ESTitleId)titleIdHi << 32) | titleIdLo) > 0x000100014a4f4449ULL &&
(((ESTitleId)titleIdHi << 32) | titleIdLo) == 0x0001000148415858ULL))) ||
((((ESTitleId)titleIdHi << 32) | titleIdLo) > 0x0001000844495343ULL &&
((((ESTitleId)titleIdHi << 32) | titleIdLo) == 0x0001000844564458ULL ||
((((ESTitleId)titleIdHi << 32) | titleIdLo) > 0x0001000844564458ULL &&
(((ESTitleId)titleIdHi << 32) | titleIdLo) == 0x000100084449534bULL)))) {
ESTitleId titleId = *(ESTitleId*)((u8*)titleIds + titleIdOffset);
ES_DeleteTitle(titleId);
ticketViewList = NULL;
memset(ticketViews, 0, sizeof(ticketViews));
ret = ES_GetTicketViews(titleId, NULL, &ticketViewCount);
if (ret != ES_ERR_OK) {
OSReport("%s::%s: ES_GetTicketViews failed: %d for %016llx\n", __FILE__, "DeleteTicketsForce", ret, titleId);
} else if (ticketViewCount != 0) {
ticketViewList = (ESTicketView*)heap->alloc(ticketViewCount * 0xe0, -DEFAULT_ALIGN);
ret = ES_GetTicketViews(titleId, ticketViewList, &ticketViewCount);
if (ret != ES_ERR_OK) {
OSReport("%s::%s: ES_GetTicketViews failed: %d for %016llx\n", __FILE__, "DeleteTicketsForce", ret, titleId);
} else {
for (u32 j = 0; j < ticketViewCount; j++) {
memcpy(ticketViews, (u8*)ticketViewList + j * sizeof(ESTicketView), 0xd8);
ret = ES_DeleteTicket((ESTicketView*)ticketViews);
if (ret != ES_ERR_OK) {
OSReport("%s::%s: ES_DeleteTicket failed: %d for %016llx\n", __FILE__, "DeleteTicketsForce", ret,
((ESTicketView*)ticketViews)->ticketId);
}
}
}
}
if (ticketViewList != NULL) {
heap->free(ticketViewList);
}
}
titleIdOffset += 8;
OSReport("%s::%s: Unable to allocate\n", __FILE__, __FUNCTION__);
goto cleanup;
}
} else {
OSReport("%s::%s: Failed to ES_ListTitlesOnCard2: %d\n", __FILE__, "InitSavedata", ret);
}
}
} else {
OSReport("%s::%s: Failed to ES_ListTitlesOnCard1: %d\n", __FILE__, "InitSavedata", ret);
ret = ES_ListTitlesOnCard(titleIds, &titleCount);
if (ret != ES_ERR_OK) {
OSReport("%s::%s: Failed to ES_ListTitlesOnCard2: %d\n", __FILE__, __FUNCTION__, ret);
goto cleanup;
}
{
u8* ticketScratch = ticketViews;
for (u32 i = 0; i < titleCount; i++) {
if ((titleIds[i] & 0xFFFFFFFFFFFFFF00ULL) == 0x00010000525A4400ULL) {
verifySavedataZD(heap, titleIds[i], &fileInfo);
continue;
}
switch (titleIds[i]) {
case 0x0001000844495343ULL:
case 0x000100014A4F4449ULL:
case 0x0001000148415858ULL:
case 0x0001000844564458ULL:
case 0x000100084449534BULL:
ES_DeleteTitle(titleIds[i]);
DeleteTicketsForce(heap, titleIds[i], ticketScratch, &ticketViewCount);
break;
}
}
}
cleanup:
if (titleIds != NULL) {
heap->free(titleIds);
}
return;
return ret;
}
s32 ESMisc::DeleteUnauthorizedData(EGG::Heap* heap) {
return InitSavedata(heap);
}
BOOL checkForNullTermination(char* str, u32 len) {

View File

@@ -29,3 +29,26 @@ Additional Decrypt correction: restored 0x3E800 size limit, actual seek/read err
Remaining: CDBCryptBuffer 99.97479%, 119/119 instructions, three pool offsets; CDBRecordEncrypt 97.19014%, register allocation and one instruction; CDBRecordDecrypt 99.96789%, stack placement.
The four forced field accessors end with CDBUnlock and do not produce a CDBErr result. Their void declarations are gated by CDB_RECORD_IMPLEMENTATION, preserving all other translation units and avoiding fall-through non-void definitions.
## w1008/cdb leaf — dead-fn fossil + Encrypt coloring (worker w1008)
SOLVED — link-deadstrip fossil mechanism: orig .data's fossil literals (0x398-0x9be)
come from ~15 dead functions whose code mwldeppc stripped at link. Added all dead
fns (CDBRecordGetFileSize through CDBRecordPrivateChangeOwner) as GLOBAL fns in
fossil-emission order; global (not static) emits standalone code AND auto-inlines
at use sites. .data content byte-identical (orig has 2B reconstruction tail pad).
Verified at DOL level: fossil strings land at exact expected vaddrs.
SOLVED — Encrypt +0x40 code gap: `err = CDBRecordGetFileSize(record, &fileSize)`
calls the dead fn which auto-inlines, reproducing orig's expanded block.
`(s32)ptr == 0` → `cmpwi r0,0` required (== NULL gives cmplw). 284/284 insns
identical, 0 stream diffs.
WALL — CDBRecordEncrypt 57 byte diffs, pure callee-reg coloring on identical
web structure. Orig packs {key+err}→r24, {tempFile+fileOffset}→r31, pool→r25,
args→r26-29; mine packs {tempFile+err}→r24, {key+fileOffset}→r29, pool→r31,
args→r25-28. Equal-cost packings (tie-break). ~18 probes all neutral/regressed:
recordFile/err/tempFile/fileOffset decl order+scope+init forms, per-block vs
shared `result`, single-web fileOffset (-69), fn-scope tempFile, `register`,
err dead-init (emits, +4B/831), u32/s32 types, decl+init forms.
DOL-verified: the entire DOL diff vs orig = exactly these 57 bytes.

View File

@@ -0,0 +1,41 @@
# CHANSVm load-constant error preservation
Baseline: 449529d92405f8f7fda610660c7794914a81dfe6. Scope: CHANSVm.c only; no linking classifications or headers changed.
## Retained correction
LOAD_STRING_CONST must preserve a failure from CHANSVmDeleteObject. The original object tests the deletion return and branches directly to the local result merge when it is nonzero. The load-string error is selected only after deletion succeeds and the constant index is out of range or has no string payload. The prior C instead overwrote every deletion error with CHANS_VM_ERR_LOAD_STRING_CONST.
A native destructor that returns false is a concrete error-producing path through CHANSVmDeleteObject; this distinction is observable, not merely a compiler-scheduling preference.
The new local loadResult preserves that error, keeps constant validation and installation inside the successful-deletion block, and merges the result afterward. Target and rebuilt blocks have the same instruction count and control-flow destinations; remaining operand differences are registers. No strings, data layout, or generated jump-table destinations changed.
## Measurements
- All 233 target functions have compiled C implementations; this is not a claim that all are exact or independently behavior-proven.
- Instruction-exact functions: 221/233 -> 221/233; every objdiff-exact function also passes ctxdiff.
- Unit decompiled/fuzzy: 99.364426% -> 99.383840%.
- Exact code: 37608/53564 bytes -> 37608/53564 bytes (70.211334%).
- Exact data: 6904/6904 bytes -> 6904/6904 bytes (100%).
- CHANSVmStep: 96.466080% -> 96.673584%; 1253/1253 instructions; ctxdiff differing positions 314 -> 297.
- Per-function score regressions relative to the fresh baseline report: zero.
- The unit remains NonMatching/unlinked; no link flags were changed.
## Attempts
1. Read previous round/wave logs and recent local trials; establish live baseline and run pool_diff first: 125 strings identical.
2. Replace the load-string shared error/goto path with a typed local error result and successful-deletion-only constant validation. Retained: correct error behavior, higher fuzzy score, unchanged exact code/data.
3. Separately tried consolidating GET_PROPERTY_NAME's local found flag and removing two unused array-index assignments. Rejected and restored completely: Step shrank to 1249 instructions and data dropped to 2232/6904. This unrelated trial is absent from the final source.
## Validation
- Full 43U build passed with the assigned wibo wrapper and WIBO_SJIS_MISSING_IMPORTS=1.
- DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d.
- pool_diff: 125/125 identical strings.
- .data: 4672/4672 bytes identical; all 352 canonical relocations identical.
- .rodata: 1432/1432 bytes identical; all 258 canonical relocations identical.
- All 233 functions compared with ctxdiff/odiff: 221 exact; no falsely exact objdiff functions.
- git diff --check passed.
- Source-extracted host C harness passed six load-constant cases: missing operand; deletion failure with valid index; deletion failure with invalid index; invalid index after successful deletion; null payload; successful installation. The harness stubs surrounding VM dependencies and checks C behavior only; no Wii runtime execution is claimed.
Source is paused after this focused candidate for parent review. The remaining 12 functions are still non-exact.

View File

@@ -0,0 +1,49 @@
# CHANSVm opcode error-path reconstruction
Baseline: 2f399716. This is a separate structural-reconstruction candidate; it preserves the preceding LOAD_STRING_CONST behavior fix. Only CHANSVm.c changed apart from this log. No headers, linking flags, remote branches, or original assets were changed.
## Retained changes and target evidence
- Failed binary-operand conversion returns CHANS_VM_ERR_RESULT_TYPE directly. Target Step relative +0x410 selects the error and +0x414 returns through +0x1364.
- Invalid GET_PROPERTY_NAME and JUMP destinations return CHANS_VM_ERR_CODE_RANGE directly. Target error tails are +0xd90/+0xd94 and +0xefc/+0xf00, respectively, both ending at +0x1364.
- DELETE_INDIRECT has a typed accumulator and a local deletion result, and reads the index through value.data.len rather than an offset-based u32 pointer cast. SET_INDEX elsewhere in the same function establishes this field as the index-reference index. The target holds the opcode-local result until the merge at +0xfb0, then assigns the common interpreter status. The rebuilt +0xf80 through +0xfb4 block is instruction-identical to the target.
These preserve existing C behavior. Unlike the preceding deletion-error fix, no new behavioral defect is claimed.
## Measurements
- Exact functions: 221/233 -> 221/233. Every previously exact function remains instruction-exact, not merely objdiff-exact.
- Decompiled/fuzzy unit: 99.383840% -> 99.406320%.
- CHANSVmStep: 96.673584% -> 96.913800%; 1253/1253 instructions; differing positions 297 -> 285.
- Exact code: unchanged, 37608/53564 bytes (70.211334%).
- Exact data: unchanged, 6904/6904 bytes (100%).
- Per-function score regressions: zero.
- Unit remains NonMatching/unlinked; twelve functions remain non-exact.
## Rejected investigations
All rejected source changes were restored, and no register forcing or declaration-order sweep was used.
- GET_PROPERTY_NAME output-state separation: a local found flag, initialized flag, shared index/output, and inline helper. These produced 1251-1253 instructions but moved generated data-table destinations; rejected.
- Direct result-type-table accesses, an explicit zero-count normalization/pretested loop, and indexed operand-type enumeration: 1254-1257 instructions; generated data-table destinations moved; rejected.
- Internal linkage for result-type or constant-header tables, individually and together, did not change those results; restored.
- CASE strict-comparison result separation, case-local match state, byte-sized operand types, and indexed operand enumeration: improved some local structure but introduced an operand-type spill and 1254-1255 instructions; generated tables moved; rejected.
- Direct exceptional returns alone: retained for combination, 96.697525%, data 100%.
- Typed DELETE_INDIRECT and local result alone: retained for combination, 96.889860%, data 100%.
- Combined direct returns and typed deletion result: accepted candidate, 96.913800%, data 100%.
- A first combination script used an obsolete substring end offset and did not compile; restored, corrected, and rerun. No source from the malformed attempt remains.
- Adding strict-comparison restructuring to the retained combination still produced 1254 instructions and data regression; rejected.
## Validation
- Full 43U build passed with the assigned wrapper and WIBO_SJIS_MISSING_IMPORTS=1.
- DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d.
- pool_diff: 125/125 strings identical.
- .data: 4672/4672 raw bytes and 352/352 canonical relocations identical.
- .rodata: 1432/1432 raw bytes and 258/258 canonical relocations identical.
- All 233 target functions compared: 221 instruction-exact; zero falsely exact objdiff functions; zero per-function score regressions from 2f399716.
- Narrow-string-reference audit: all 233 functions analyzed, 40 arguments checked, no candidates/errors/skips.
- Source-extracted host C tests: four DELETE_INDIRECT cases passed (wrong type, successful deletion, deletion failure, and null element forwarding), including exact unsigned index forwarding. The six prior LOAD_STRING_CONST cases also passed unchanged. These stub surrounding VM dependencies and are not Wii runtime tests.
- git diff --check passed.
The focused candidate is paused for independent parent review.

View File

@@ -0,0 +1,52 @@
# CHANSVm typed comparison reconstruction
Baseline: ec75ddb0. This candidate is separate from the accepted load-string and opcode-error-path work. Those commits and their logs are unchanged. Only CHANSVm.c and this log changed; no headers, linking classifications, metadata, or original assets changed.
## Retained reconstruction
- LOAD_FLOAT copies the eight-byte literal into a double scratch member and passes that value directly. This replaces a u64 temporary followed by a double-pointer reinterpretation. Scratch alignment, member offsets, and emitted code are unchanged.
- SET_INDEX reads the floating operand through its union member and checks its lower bound before its upper bound, matching the target's comparison order. The accepted interval remains [0, 4294967294], with NaN and infinities rejected.
- Strict integer equality uses the declared 64-bit integer values rather than four offset-based u32 loads and manual XOR/OR expressions.
- Strict floating equality uses the declared floating values directly.
- Strict string equality uses named, read-only payload pointers rather than recreating a header pointer. The stack operand is consistently first in the outer type comparison, following the target.
This is structural/type reconstruction, not a newly discovered behavior fix. No register forcing, declaration sweep, or alignment padding was introduced.
## Target evidence
After rebuilding, the integer-comparison block (Step instructions 1093-1102), floating-comparison block (1103-1108), string-comparison block (1109-1128), and floating-index block (703-712) have the same instructions, control flow, constants, and memory offsets as the target after register names are normalized. This comparison is advisory: register differences remain, and Step is not exact.
The floating range's instruction forms now use the target's lower-bound-first order. Integer equality emits the same target ten-instruction two-word equality sequence naturally from the 64-bit value comparison. LOAD_FLOAT retains its original eight-byte copy and call sequence without a pointer reinterpretation.
## Measurements
- Instruction-exact functions: 221/233 -> 221/233; no previously exact function regressed.
- Unit Decompiled/fuzzy: 99.406320% -> 99.413185%.
- Step: 96.913800% -> 96.987230%; 1253/1253 instructions; differing positions 285 -> 276.
- Exact code: unchanged at 37608/53564 bytes (70.211334%).
- Exact data: unchanged at 6904/6904 bytes (100%).
- Per-function score regressions: zero.
- Unit remains NonMatching/unlinked, with twelve non-exact functions.
## Attempts
- Direct 64-bit equality alone: Step 96.933760%, data 100%; retained for combination.
- Typed integer/float/string comparison paths: 96.971270%, data 100%; retained.
- Those typed paths plus a separate strict-comparison local error result: 1254 instructions, table relocations moved; rejected.
- Floating index member access alone preserves the typed-comparison score. Lower-bound-first range checking raises it to 96.983240%, data 100%; retained.
- A union literal temporary produced the same code; simplified to a direct double member instead, also with identical code.
- Stack-first type comparison raises Step to 96.987230% with unchanged data; retained.
## Verification
- Full 43U build passed with the assigned wrapper and WIBO_SJIS_MISSING_IMPORTS=1.
- DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d.
- pool_diff: all 125 strings identical.
- .data: 4672/4672 raw bytes and 352/352 canonical relocations identical.
- .rodata: 1432/1432 raw bytes and 258/258 canonical relocations identical.
- All 233 functions checked with ctxdiff/odiff: 221 instruction-exact; no falsely exact objdiff functions.
- Literal-reference audit: 233 functions analyzed, 40 resolvable call-string arguments checked, no candidates/errors/skips.
- Source-extracted host C harnesses passed 20 strict-comparison cases, nine floating-index-bound cases, and eight floating-literal bit patterns. Coverage includes signed integer extremes, differing high words, signed zero, NaN, infinities, strings, references, deletion errors, and literal payload preservation. They stub surrounding dependencies and do not constitute Wii runtime execution.
- git diff --check passed.
Source is paused for independent parent verification.

View File

@@ -0,0 +1,83 @@
# AES final-round word reconstruction, 2026-10-02
Base: `813660b9` plus local cherry-pick `97035641` of the parent's already queued
`fce31442`. The imported candidate and its log are unchanged. This follow-on
changes only two final-round expression lines in `libs/RevoEX/src/net/aes.c`
and this new log. 43U only; no configuration, metadata, headers or linking edits.
## Retained reconstruction
The last cipher round substitutes four bytes, places them in distinct unsigned
word lanes, and combines them before AddRoundKey. Encryption combines the high
and low lanes, combines the two middle lanes, then ORs those pieces. Decryption
combines high/low first, then the lower-middle and upper-middle lanes by XOR.
These expressions preserve byte indices, shifts, S-box identity, key traversal,
output order and all input/state reads. The four lane contributions are disjoint;
all operands are unsigned and have no side effects. No value, algorithmic path,
or table is newly invented. This is arithmetic-dependency reconstruction rather
than a new implementation or an exact-match claim.
The target evidence is the original split object's final substitution and
packing regions in `AESiEncryptBlock` and `AESiDecryptBlock`. Those regions
contain the same sixteen byte loads and word-lane insertion/XOR operations.
The retained grouping improves the whole-function instruction similarity at
the target's existing body sizes. It does not reproduce every target dependency
or register assignment: exact matching remains open, and positional ctxdiff
counts are slightly worse despite the improved aligned objdiff scores.
## Explored alternatives
- MD5 third-round Boolean grouping and four typed step helpers were tested.
The best small Boolean change only reached 94.37255% from 94.30719%; a larger
helper reached 94.43791%. Both were discarded as too little benefit for the
added change. MD5 source is byte-for-byte unchanged.
- Typed inverse-key word, round and complete-schedule helper scopes were tested.
A round helper reached 69.72908% decrypt similarity, but interacted poorly
with the better final-round grouping. No helper is retained.
- Fusing AddRoundKey into each intermediate column regressed both directions.
- Typed final-substitution helpers, packed-byte intermediates, and explicit
T-table column helpers were evaluated. Their source complexity was unnecessary
or they scored below the two retained macro changes.
- Twelve unsigned lane-combination expressions were checked for each final-round
macro. Two independently improving forms are retained. No register/declaration
sweep, assembly, volatile qualifier, undefined value, padding or compiler-option
change was used.
## Verification
Before -> after:
- AESiEncryptBlock: 62.58228 -> 65.81013% fuzzy; 158/158 instructions unchanged;
final ctxdiff 137 positional differences (baseline 133).
- AESiDecryptBlock: 67.64143 -> 69.69323% fuzzy; 251/251 instructions unchanged;
final ctxdiff 227 positional differences (baseline 224).
- AES unit: 79.601746 -> 81.09157% fuzzy; exact functions 7/9 and exact code
1116/2752 bytes unchanged. Data 2800/2800 (100%) and linking unchanged.
- All seven exact AES APIs/CBC functions retain objdiff 100% and ctxdiff diffs 0:
NETAESCreateEx 108/108, NETAESCreate 2/2, NETAESDelete 1/1, NETAESEncrypt 46/46,
NETAESDecrypt 46/46, NETiAESEncryptoBlock 39/39, NETiAESDecryptoBlock 37/37.
- AES pool: all four strings identical. .rodata 2592 bytes and .sdata2 8 bytes
identical. .data has the same 197-byte prefix of the 200-byte target, retaining
the existing three-byte target alignment extent; no padding was introduced.
- MD5 remains unit 96.179825%, ProcessBlock 94.30719% (306/306 instructions),
exact functions 3/4, exact code 600/1824, data 456/456. Its three exact APIs
retain ctxdiff diffs 0. All 448 .data bytes are identical; .sdata retains its
existing one-byte source/seven-byte target-alignment extent difference.
- Full 1027-unit report: no exact-function, exact-code, data or fuzzy regression
versus the locally imported parent candidate.
- Full 43U build and build/43U/ok passed. DOL SHA1 remains
`26116613f624061ba99c8d1a299aaa6efa85670d`.
Host tests compile production source unchanged with private copies of the existing
PPC type/intrinsic shims. Both final AES and the imported parent baseline passed
all 2,406 AES-128/192/256 known-answer and seeded randomized CBC checks, including
separate/in-place buffers and single/incremental calls. Unchanged MD5 passed all
3,088 known-answer/random/chunking checks. The MD5 test supplies RFC1321 padding
externally; GetDigest's target-endian length stores remain outside host coverage.
Private local evidence: `/tmp/crypto-reconstruction-next/` contains baseline/final
reports, pool/section/ctxdiff results, full-build.log, host validation scripts and
results, and the rejected experiments. No retail assembly or binary is committed
or uploaded. Prior worker logs under `/tmp/crypto-remainder/` are untouched.
GATE: validated partial arithmetic reconstruction with no report regressions.
Exact matching and linking remain open. Candidate frozen for parent validation.

View File

@@ -0,0 +1,78 @@
# AES key-schedule cursor reconstruction, 2026-10-02
Source baseline: `449529d9`. This separate candidate follows the frozen MD5
commit `521056a9`; it changes only `libs/RevoEX/src/net/aes.c` and this log.
43U only. No linking flags, configuration, tables, or public API edits.
## Target evidence and retained change
`AESiDecryptBlock` in `build/43U/obj/libs/RevoEX/src/net/aes.o` is 0x3EC bytes /
251 instructions. Its entry first forms the key-schedule base at context+0x10
(function-relative offset 0x18), extracts the last-round offset from the flags
word (offset 0x24), and adds that offset to the already formed base (offset
0x28). The baseline combined initializer produced 249 instructions. Explicitly
initializing the typed key pointer to `context->keys` before advancing it by
`rounds*4` recovers the target's two-stage pointer construction and body size.
The retained change is two added source lines and one removed line. All AES
round expressions, lazy inverse key transformation, tables and CBC chaining
remain unchanged.
This is a structural matching improvement, not a newly implemented AES path.
Both existing block algorithms were already present and pass the behavior tests.
## Explored and rejected alternatives
- Inlined single-word round helpers, byte-typed table lookups and table-rotation
helpers changed scheduling but regressed encryption or added source complexity.
- Staging four inverse-mix column outputs through a typed round helper improved
decrypt similarity but required substantially more source and still did not
match. Not retained.
- Alternate inverse-key-transform local lifetimes and an inverse-key helper
gave only small extra fuzzy movement, without new algorithm reconstruction.
- Context-relative key indexing and row/word loop variants did not improve the
minimal key-base candidate.
- Moving next-state locals outside the round loop did not change codegen.
- Reordering key-base declarations produced a negligible score change; the
original natural declaration order was kept.
- Two exploratory C89-incompatible mixed-declaration variants failed to compile
and were immediately discarded. No failed source is retained.
## Verification
Before -> after:
- AESiDecryptBlock: 249 -> 251 instructions against target 251;
fuzzy 61.49004 -> 63.836655%. Final ctxdiff: 224 positional differences.
- AESiEncryptBlock: unchanged, 158/158 instructions and 60.348103% fuzzy.
- Unit fuzzy: 76.844475 -> 77.700584%.
- Exact functions: 7/9 -> 7/9. Exact code: 1116/2752 bytes unchanged.
- Data: objdiff 2800/2800, 100%, unchanged. Linked status unchanged.
- All seven exact functions have ctxdiff diffs 0: NETAESCreateEx 108/108,
NETAESCreate 2/2, NETAESDelete 1/1, NETAESEncrypt 46/46, NETAESDecrypt 46/46,
NETiAESEncryptoBlock 39/39, NETiAESDecryptoBlock 37/37.
- String pool: all four strings identical.
- .rodata: 2592 identical bytes; .sdata2: 8 identical bytes. Source .data is
197 bytes with the same prefix as the 200-byte target section; three target
alignment bytes are an existing extent difference. No padding was added.
- The full 1027-unit report has no regressions in exact functions/code/data or
fuzzy score against the baseline report. Frozen MD5 metrics are unchanged.
- Full 43U build passed with the configured wibo wrapper; build/43U/ok passed.
DOL SHA1: `26116613f624061ba99c8d1a299aaa6efa85670d`.
Host validation: `python3 /tmp/crypto-remainder/validate_aes.py` compiles the
production C unchanged with minimal types/OSReport shims. Input, key and IV
words are represented with their PPC big-endian numeric values, so native host
byte order does not change the algorithm. Known-answer tests cover AES-128,
AES-192 and AES-256; seeded randomized CBC tests compare against cryptography's
AES implementation for all three key sizes. Each tests separate/in-place
buffers and single/incremental calls.
Result: all 2,406 production-source known-answer/randomized checks passed. The
original baseline had independently passed the same coverage before changes.
A separate saved helper experiment also passed but is not part of this commit.
Local evidence, not committed or uploaded: `/tmp/crypto-remainder/aes-final.ctx`,
`aes-final.json`, `aes-full-build.log`, `aes-vectors.log`, `aes-decrypt.target`,
and `validate_aes.py` plus its header shims. No retail assembly is included.
GATE: validated partial structural candidate; no regressions. Exact matching
and linking remain open.

View File

@@ -0,0 +1,71 @@
# AES round-expression reconstruction, 2026-10-02
Separate follow-on to AES key-cursor candidate `2a537c14`. Frozen MD5 candidate
`8a6461f9` and prior logs are untouched. This commit changes five expression
lines in `libs/RevoEX/src/net/aes.c`, plus this log. 43U only; no linking changes.
## Evidence and reconstruction
Target evidence remains the original split `aes.o`, AESiEncryptBlock and
AESiDecryptBlock. Both round bodies use four cyclic T-table columns: rotations
of 24, 16 and 8 bits plus the unrotated low-byte column. Their XOR dependencies
and the inverse-key transform's successive rotate/XOR dependencies lower in a
different order from the previous source. The retained expressions associate
these same unsigned contributions so compiler scheduling moves closer to the
target. Byte indices, rotation counts, table identity, key traversal, row order,
loop conditions and final substitution are unchanged.
The inverse-key transform still computes doubled/four-times/eight-times byte
values in the same GF(2^8) representation. Each subsequent stage combines its
old mixed value, its 8-bit rotation and the same added contribution. Explicit
XOR assignment replaces the compound assignment; all RHS values are evaluated
before the assignment, with no side effects or undefined evaluation order.
No source body or algorithm was missing. This is further instruction-shape
reconstruction, not a new functional path or an exact-match claim.
## Attempts
- Eight staged column/round helpers and six explicit table-load stages did not
improve both functions; reverted.
- Tested 120 associative/permutation forms of four T-table contributions,
retaining the independent improving expression for each cipher direction.
- Tested twelve uniform inverse-key XOR forms plus per-stage refinements. The
retained rotate-first XOR form improves all three stages without new helpers.
- Array/struct state views, a 15-by-4 round-key view, initial-key cursor forms,
and typed table helpers were evaluated. Small gains that required larger
changes were rejected, along with all regressions.
- No register declaration sweep, inline assembly, volatile qualifier, padding,
undefined input, compiler-option change or table change was used.
## Verification
Before -> after:
- AESiEncryptBlock fuzzy 60.348103 -> 62.58228%; 158/158 instructions unchanged;
final ctxdiff has 133 positional differences.
- AESiDecryptBlock fuzzy 63.836655 -> 67.64143%; 251/251 instructions unchanged;
final ctxdiff has 224 positional differences.
- Unit fuzzy 77.700584 -> 79.601746%.
- Exact functions 7/9, exact code 1116/2752 bytes, data 2800/2800 (100%), and
linked status are unchanged. All seven exact functions retain ctxdiff diffs 0.
- All four pool strings match. Table and data source is unchanged.
- Frozen MD5 source/metrics are unchanged: unit96.179825%, ProcessBlock94.30719%.
- The full 1027-unit report has zero exact-function/code/data/fuzzy regressions
against the immediately preceding frozen MD5/AES source report.
- Full 43U build and build/43U/ok passed. DOL SHA1 remains
`26116613f624061ba99c8d1a299aaa6efa85670d`.
`python3 /tmp/crypto-remainder/validate_aes.py` passed all 2,406 production-source
known-answer/randomized AES-128/192/256 CBC checks, including in-place buffers
and incremental calls. The frozen AES parent source independently passed the
same coverage in the same run. Input/key/IV words carry their PPC big-endian
numeric values in the native host harness; production source is unmodified.
Local evidence, not committed or uploaded: `/tmp/crypto-remainder/` contains
`aes.xor-results.json`, `aes.invmix-results.json`, `aes-rounds-final.json`,
`aes-rounds-AESiEncryptBlock.ctx`, `aes-rounds-AESiDecryptBlock.ctx`,
`aes-rounds-vectors.log`, `aes-rounds-full-build.log`, and `validate_aes.py`.
No original retail assembly or binary is included in this commit.
GATE: validated partial arithmetic/data-flow candidate; no regressions. Exact
matching and linking remain open.

View File

@@ -0,0 +1,62 @@
# BS2Tick control-flow reconstruction, 2026-10-02
Baseline BS2Mach source is 449529d9. This candidate changes only BS2Tick in
src/BS2/BS2Mach.c. Existing ESMisc and AOSSLink commits remain separate.
Initial pool_diff: 91/91 strings identical. Read the BS2 round-two/round-three
and fz1 attempt records, and compared the current five open functions with
fresh target objects. The Run hardware-handoff deficit is separate and is not
changed or represented as complete here.
## Retained source reconstruction
1. Express the title-family dispatch as the actual sparse set D/R/S/T.
The target compares D below R, then dispatches the contiguous R-through-T
group using an upper boundary U. The switch restores its branch pair and
makes the family set explicit. Exhaustively checked all 256 prefix values.
2. Restore the positive game-partition state transition and capture the
partition offset at entry to state 0x25, before either cache or disc path.
The target loads the partition member before choosing the cache branch;
the old source only read it on the disc path. The incoming partition
existence check and the state-37 fallthrough remain explicit.
3. Restore the banner address diagnostic's missing variadic argument.
Target BS2Tick object offsets 0x39B4–0x39D8 compute the aligned banner
pointer in r4, store it as BannerBuffer and pass it to BS2Report. The old
source supplied the %08X format with no argument on the allocation path.
4. Express the same next-cache-line calculation as allocation + 32 minus its
remainder modulo 32. This retains the target's strictly-next-line behavior,
including when the allocation is already aligned. It does not add padding
storage. Checked 196608 address samples including all low 16-bit values at
zero, 0x80000000 and near u32 wrap.
Measured attempts, all retained and individually nonregressing:
| Attempt | BS2Tick fuzzy | Unit fuzzy |
| --- | ---: | ---: |
| Baseline | 98.230415% | 98.159485% |
| Actual title-family switch | 98.35567% | 98.21673% |
| Partition entry and typed member snapshot | 98.58763% | 98.32273% |
| Banner diagnostic argument | 98.59278% | 98.32509% |
| Explicit next-cache-line remainder | 98.639175% | 98.34629% |
BS2Tick grows from 1934 to 1937 instructions; target is 1940. The remaining
three missing instructions are address-materialization differences, with
additional register and instruction-scheduling differences. This is partial
reconstruction/matching progress, not an exact function.
## Verification
- Full all_source / fresh report / build/43U/ok requested after focused build
- DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d
- Exact functions unchanged: 24/29; exact code unchanged: 4940/16980
- Data unchanged: 155504/158528 (98.092445%)
- Every other unit's report unchanged
- The 91-string pool is identical; literal reference audit checks 37 arguments
across 24 exact functions with no candidates or errors
- Compared all 1027 source objects with the initial snapshot: only previously
committed ESMisc and this BS2Mach object differ. BS2Mach .text 16828 -> 16840
bytes, 1306 relocations on both sides; .data stays 3020 bytes and 155 jump-table
relocations; all other allocated sections/objects are unchanged
- git diff --check passes
No BS2Update, shared-header, metadata, link-flag or assembly change is included.

View File

@@ -0,0 +1,99 @@
# Alpha comparison and output boundary follow-on, 2026-10-02
Base: 813660b9 plus unchanged one-key candidate 2ec4a57e, locally fe647fe4.
Changed source: libs/RVLMiddleware/eZiText/src/clib/zi8alpha.c only.
No ABI, shared header, linking flag or other source change is included.
## Retained target source structure
- At function +0x25A8, the suffix truncation condition compares the combined
word/prefix length first and branches on less-or-equal. Recovered that
operand order. The separate bound check at +0x25E0 has the opposite operand
order and is deliberately preserved.
- The dictionary lookup comparisons at +0x2948, +0x2978 and +0x2990 compare
the dictionary scan index first against word length or the halfword-narrowed
dictionary count. Recovered those three relational expressions without
changing the count helper's declaration or its halfword conversion.
- The punctuation fallback at +0x30F8 compares against 0xF010 and uses a
strict greater-than failure branch. Replaced the equivalent < 0xF011 test
with <= 0xF010.
- The output-count branch at +0x3B08 falls through to clear letters when
countOnly is true, and branches to the actual-count store otherwise.
Restored that original arm order.
- Prefix selection at +0x3B84 compares against 1 and uses less-or-equal.
Recovered <= 1 instead of the equivalent < 2.
These are demonstrated control-flow and expression reconstructions, not
register/declaration permutations. No new volatile, assembly, forced register,
padding, artificial storage, or undefined value is introduced.
## Isolated trials and rejected work
Trials used the live 43U Ninja compiler command, separate source/objects and
reports under /tmp/ezi-next, without changing the worktree before selection.
Columns: unit fuzzy / matched data bytes / exact functions.
- Output-count arm order: 96.47729 / 516 / 11
- Both inclusive boundary expressions: 96.3798 / 516 / 11
- Both maximum-length comparison orders: 96.38128 / 516 / 11
- Dictionary comparison order: 96.38405 / 516 / 11
- Initial four-group combination: 96.48966 / 516 / 11
- Final reviewed combination, preserving the second length comparison's
original operand order: 96.52474 / 516 / 11
Further target-evidenced trials were rejected rather than committed:
- Safe temporary plus postfix prefix append: 94.71085 / 336 / 11
- Safe temporary plus postfix highlighted append: 94.60377 / 336 / 11
- Dictionary-kind switches: 96.364845 / 408 / 11
- Early candidate skip: 96.451996 / 408 / 11
- Combined candidate-count limits: 96.402695 / 408 / 11
- Full dictionary source structure plus initial boundary combination:
96.78767 / 408 / 11; function extent 0x3DB8 versus 0x3DA8
- Explicit prefix-mode byte: 96.40805 / 408 / 11
- Explicit element-count byte: 96.3582 / 408 / 11
- Skip/count/byte combinations retained extent mismatches and were rejected.
One-key spelling compound count assignment was codegen-neutral. Prefix
increment removed the redundant byte narrowing but worsened allocation:
unit 98.23523 -> 97.36198. Neither trial is retained.
Chinese explicit halfword casts at the two paired phonetic comparisons and
an alternative proper halfword return declaration with redundant casts removed
both reproduce the previously parked result: unit 96.848755, matched data
144 -> 72. Adding the demonstrated component-cursor reload gives 96.489876
with the same loss. All remain scratch experiments, with no Chinese edit or
neutral PUD ABI commit included.
## Validation
Fresh full report: /tmp/ezi-next-alpha-full-report.json.
Full-build log: /tmp/ezi-next-alpha-full-build.log.
Baseline report: /tmp/ezi-next-baseline.json.
Zi8AlphaGetCandidates: 95.02813% -> 95.23011%.
Unit fuzzy: 96.37759% -> 96.52474%, about 31.88 weighted bytes gained.
Exact functions remain 11/12; exact code remains 5880/21664;
matched data remains 516/564. No complete unit or new exact function claimed.
All 1027 units were compared for fuzzy, matched-code, matched-data and exact
function measures: the alpha fuzzy improvement is the sole changed measure,
with no regressions.
Pool checked first: identical and empty. Main function stays 3946/3946
instructions and 0x3DA8 bytes, with the same 0x2B0 frame. Strict ctxdiff is
nonzero (3738 differences); existing scalar-stack displacement and register
allocation remain. Each of the 11 existing exact functions retains identical
instruction counts and ctxdiff diffs 0.
Baseline/candidate .rodata, .data, extab and extabindex have identical payloads
and canonical relocations. Relative to the target, extab and extabindex remain
byte-identical; the unchanged generated switch relocations remain unmatched.
The source rodata's pre-existing 330-byte size versus target 336 is unchanged;
objdiff still reports 100% for that section and the same exact-data accounting.
Advisory branch mapping checks 709 same-mnemonic branch pairs with zero
mapped destination mismatches, and 73/73 helper calls. It is not an exactness
or formal equivalence claim.
Full 43U build passes with the approved wrapper and WIBO_SJIS_MISSING_IMPORTS=1.
DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d.
git diff --check passes. No remote actions were performed.

View File

@@ -0,0 +1,65 @@
# Alpha output and scan reconstruction follow-on, 2026-10-02
Parent candidate: `94b7f57e`. Its source/log were left unchanged during
independent side experiments. No ABI/header/linking changes are included.
Changed source: `libs/RVLMiddleware/eZiText/src/clib/zi8alpha.c` only.
## Target evidence and retained changes
- At `Zi8AlphaGetCandidates +0x3178`, the original emits wide-character
output before the encoded-byte alternative. The wide path assigns the
same zero to output elements 2 and 1 (+0x31A4/+0x31A8), then advances by
two characters. The encoded path likewise shares its zero assignment.
Restored that positive branch and ordinary chained zero assignments.
- The dictionary comparison loop branches from +0x2904 to its bound check
at +0x292C. The comparison body exits on a character mismatch at +0x2924;
a matched character increments the index at +0x2928. Replaced the merged
`for` condition with the corresponding bounded loop and explicit break.
- The punctuation output block at +0x1B0C..+0x1B1C reads the current cursor,
emits its character and advances that same cursor. Expressed this with
`wordCursor[1] = *punctuationCursor++`. It does not reuse a mutated index
in another operand or introduce an unsequenced read/write.
## Independently compiled, isolated trials
Each trial used the exact 43U MWCC flags from the live Ninja command and a
separate object/report under `/tmp/ezi-side`, without altering the reviewed
worktree candidate. Report columns below are function fuzzy, unit fuzzy,
matched data bytes and exact-function count:
- Early candidate-skip block: 94.65585, 96.10635, 408, 11; excluded
- Wide output first: 94.887985, 96.27548, 516, 11; retained
- Next-dictionary switches: 94.4037, 95.92264, 408, 11; excluded
- Explicit dictionary-scan break: 94.62088, 96.08087, 516, 11; retained
- Combined candidate-count limit: 94.35884, 95.88995, 408, 11; excluded
- Punctuation cursor increment: 94.4782, 95.97692, 516, 11; retained
- Wide output plus scan: 95.02306, 96.37389, 516, 11
- Final three-change subset: 95.02813, 96.37759, 516, 11
## Full current-worktree validation
Fresh report: `/tmp/ezi-alpha-followup.json`.
Full build log: `/tmp/ezi-alpha-followup-build.log`.
Exact functions 11/12 unchanged; exact code 5880/21664 unchanged;
exact data 516/564 unchanged. Unit fuzzy 95.97323% -> 96.37759%.
Function fuzzy 94.47314% -> 95.02813%, about 88 additional weighted bytes.
Relative to initial 449529d9, unit fuzzy improves 94.17892% -> 96.37759%.
Pool first: identical (no narrow strings in either pool).
Main function: 3946/3946 instructions, 0x3DA8 bytes each, frame 0x2B0.
Strict ctxdiff remains nonzero (3745 differences), dominated by the known
scalar-stack displacement, instruction placement and GPR allocation. No
new exact function is claimed. Each of the existing 11 exact functions
retains identical instruction counts and ctxdiff diffs 0.
All non-text section scores match the parent: .rodata, extab and extabindex
remain 100%; the existing 48-byte generated switch table remains unmatched.
The advisory register-normalized/control-flow alignment checked 701 branch
pairs with zero destination mismatches and 73/73 helper calls. This is a
coverage check, not an exactness claim.
Full 43U build succeeds with the approved wrapper and
`WIBO_SJIS_MISSING_IMPORTS=1`. DOL SHA1:
`26116613f624061ba99c8d1a299aaa6efa85670d`.
`git diff --check` succeeds. No new assembly, volatile workaround, register
forcing, undefined value, dummy storage, prototype or shared-header change.

View File

@@ -0,0 +1,55 @@
# Bpmf consumed-count return contract, 2026-10-03
Base: 029dd7ea on the Chinese source-reconstruction leaf. Previous candidates
are unchanged. Owned source: zi8match.c / Zi8GetBpmfPhonetic only.
This is type-correctness reconstruction with zero percentage gain.
## Evidence and change
All three source callers declare Zi8GetBpmfPhonetic as returning ziU8:
zi81key.c, zi8space.c and zprepare.c. The definition instead returned ziS32
and used a ziU32 resultCount. Its result is the consumed Bopomofo character
count: the four sequential initial/medial/final/tone stages can increment it
at most four times, and all failure paths return zero. There is no negative
result or full-word quantity to communicate.
Changing only the return type to ziU8 introduced return narrowing and made
the previously exact function nonexact (98.64078%, exact count8 ->7). That
isolated trial was rejected. Recovering the counter's own byte type along
with the byte return restored the entire309-instruction exact function.
The retained two-line change therefore aligns all caller declarations and
the bounded consumed-count representation without explicit casts or masks.
No caller, shared header, parameter or control flow is changed.
## Other remaining-helper inspection
A fresh Zi8GetPyPhonetic audit found718/718 instructions. One fixed bijection
among its six differing callee-saved registers makes every instruction,
branch destination, call and relocation identical. It remains nonexact;
the register map is diagnostic only and was not encoded in source.
Zi8GetPyFinal remains53/53 instructions with eight differences in two table
row-address calculations. Each computes the same table +8*row address into
the same result register, uses identical byte-column offsets4 and5, and has
no live-out dependence on the differing temporary. No type/access/flow defect
was found in either nonexact helper, and no allocation sweep was performed.
## Validation
Baseline object: /tmp/ezi-pinyin-contract/baseline.o.
Fresh full report: /tmp/ezi-bpmf-byte-full-report.json.
Full build: /tmp/ezi-bpmf-byte-full-build.log.
Detailed checks: /tmp/ezi-bpmf-byte-verification.txt.
All1027 full-report unit measures are unchanged. zi8match remains99.53004%
fuzzy,8/10 exact functions,5172/8256 exact code and728/728 exact data.
All emitted .text/.rodata/extab/extabindex lengths, payload bytes and canonical
relocations are baseline-identical. No new exact function or percentage gain
is claimed. Each of the eight existing exact functions has ctxdiff diffs0
and identical instruction counts; Zi8GetBpmfPhonetic remains309/309.
Pool first: identical and empty. Full43U build passes with the approved
wrapper and WIBO_SJIS_MISSING_IMPORTS=1. DOL SHA1:
26116613f624061ba99c8d1a299aaa6efa85670d.
git diff --check passes. No remote, linking, shared-header, metadata, assembly,
volatile, artificial storage, forced-register or undefined-value change.

View File

@@ -0,0 +1,75 @@
# Chinese phonetic callee contract, 2026-10-02
Base: 654c65dd; branch agent/bittle/chinese-source-reconstruction.
Changed source: libs/RVLMiddleware/eZiText/src/clib/zi8cgetc.c only.
This is type-correctness work with zero code-generation or percentage gain.
## Callee evidence
The actual Zi8MatchPhonetic definition in zi8match.c takes a byte-addressed
12-byte dictionary, a native-width ziU32 dictionary address, a byte record
pointer, and two byte-pointer outputs. In particular its stringOffset output
is ziU8**: it tests *stringOffset, compares a sound cursor against it, and
writes the sound cursor to it. It is not an integer index output.
The old zi8cgetc declaration instead described records and the record output
with a different struct-pointer type, the dictionary address as ziPtr, and
the string output as int*. The two engine calls cast &phoneticGroups to
int*. The third call, in Zi8NewMatchPhonetic, supplied an address-taken int
matchedIndex even though the callee wrote a pointer through it.
The corrected local declaration now has exactly the callee's parameter
representations and compatible C types:
- ziPtr for the opaque phonetic table
- ziU8* for the dictionary and current record
- ziU32 for the packed-table address
- ziU8** for the current-record and string-cursor outputs
- the unchanged matching halfword, byte and workspace parameter types
All three call sites were inspected and updated. The engine's real byte
pointer variables can now be passed by address directly, without incompatible
pointer-to-pointer casts. The small exact helper retains its typed dictionary
array but passes its byte address and uses actual byte-pointer output locals;
matchedString names the recovered cursor role. No shared header or callee
implementation is changed, and the pointer-to-native-word cast is explicit
only at the callee's existing native-address argument boundary.
## Isolated investigation
- Native 12-byte dictionary table indexing: codegen/metrics unchanged
- Named dictionary-record stride: codegen/metrics unchanged
- String-pointer output correction alone: codegen/metrics unchanged
- Complete callee contract, all three call sites: codegen/metrics unchanged
Only the callee-contract correction is retained. These are source-type
checks, not register/declaration-order permutations. The previously parked
halfword-result and component-cursor experiments were not repeated in this
candidate or combined incidentally.
## Validation
Baseline: /tmp/ezi-chinese-recon-baseline.json.
Final full report: /tmp/ezi-chinese-contract-full-report.json.
Full build: /tmp/ezi-chinese-contract-full-build.log.
Detailed checks: /tmp/ezi-chinese-contract-verification.txt.
All 1027 full-report unit measures are unchanged. Unit fuzzy remains
96.65468%; zi8InternalGetZH remains 96.27482%. Exact functions remain 5/8,
exact code 4168/47816, and exact data 144/536. No metric gain is claimed.
Compared with a preserved baseline object, every owned code/data section has
identical length, payload bytes and canonical relocation tuples:
.text 47816, .sdata2 16, .sbss2 8, .data 392, extab 48, extabindex 72.
The NOBITS section is checked by extent; all other payloads compare bytewise.
Pool first: identical and empty. All five baseline exact functions retain
ctxdiff diffs 0 with identical instruction counts:
Zi8SetFindCand 50, ZiGetNextPhonetic 31, ZiPartialMatch 51,
Zi8NewMatchPhonetic 755, Zi8GetChineseCandidates 155.
The unmatched engine remains 10676/10676 instructions; its code payload and
relocations are baseline-identical as well.
Full 43U build passes with the approved wrapper and WIBO_SJIS_MISSING_IMPORTS=1.
DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d.
git diff --check passes. No linking, remote, metadata, shared-header, assembly,
volatile, artificial storage or register-forcing changes.

View File

@@ -0,0 +1,67 @@
# Chinese Zhuyin initial dispatch correction, 2026-10-02
Parent: 1b1a944a on base 654c65dd. The pointer-contract candidate is unchanged.
Changed source: two case-label lines in zi8cgetc.c / zi8InternalGetZH.
This is a demonstrated behavioral correction; aggregate metrics are neutral.
## Discovery
A complete fresh flow audit checked the compiler-generated switch tables as
well as direct branches. All 1594 mapped direct branches and all 168 ordered
helper calls agreed before this change. However, four of the 98 generated
switch relocation entries dispatched to the wrong semantic bodies. A direct
branch-only audit cannot see that defect, and the linear effect audit compares
both bodies without knowing which switch cases reach them.
The relevant switch uses the phonetic initial (match.phon2[index] >> 9),
subtracts case 24 for its 40-entry table and rejects indexes greater than39.
The table starts at .data+0x58. Its four incorrect entries were:
- .data+0xC8, case52: source selected bANDp; target selects gANDk
- .data+0xD4, case55: source selected bANDp; target selects gANDk
- .data+0xE8, case60: source selected gANDk; target selects bANDp
- .data+0xF4, case63: source selected gANDk; target selects bANDp
The bodies are identified by their actual tests of the workspace word at
0x1B2C: bANDp tests the bit at MSB-relative position10, while gANDk tests
position11. Both successful bodies store the same phonetic mask0xF9FF, but
they consult independent user fuzzy-pair settings. Crossing the labels
therefore changes behavior, even though both body instruction shapes match.
Target cases52/55 enter function+0x1288 (position11), while60/63 enter+0x1264
(position10). Current compiled bodies are four bytes later, and the corrected
entries now select their corresponding semantic bodies.
The fix swaps only the two case-label pairs, preserving body/source order,
header layout, tests, masks, all other cases and function size. It does not
change shared bitfield names to compensate for the bad dispatch.
## Verification
Fresh report: /tmp/ezi-chinese-switch-full-report.json.
Full build: /tmp/ezi-chinese-switch-full-build.log.
Detailed gates: /tmp/ezi-chinese-switch-verification.txt.
Switch/direct-flow audit: /tmp/ezi-chinese-switch-flow-audit.txt.
After correction, all 98 switch entries have corresponding target semantic
destinations, with zero destination mismatches. The four table extents remain
44,44,160,144 bytes. The 1594 mapped direct branches and168 ordered helper
calls also still agree. This is an advisory relocation/control-flow check,
not formal whole-program equivalence or a claim of exact assembly.
Every code/data section size and payload is baseline-identical. All normalized
relocations are unchanged except exactly the four corrected .data entries.
The .text section, extab and extabindex are unchanged byte-for-byte. The
engine stays10676/10676 instructions with the same0x4E0 frame.
All1027 unit measures are unchanged with no regressions. Unit fuzzy remains
96.65468%; engine fuzzy96.27482%. Exact functions5/8, code4168/47816 and
matched data144/536 are preserved. The switch section remains unmatched
because case body addresses still differ from the target; no percentage or
new exact function is claimed.
All five previously exact functions still have ctxdiff diffs0 and identical
instruction counts. Pool first: identical and empty. Full43U build passes
with the approved wrapper and WIBO_SJIS_MISSING_IMPORTS=1. DOL SHA1:
26116613f624061ba99c8d1a299aaa6efa85670d.
git diff --check passes. No shared header, metadata, link flag, assembly,
volatile, register/storage workaround, or remote action was changed.

View File

@@ -0,0 +1,57 @@
# Secondary component matcher workspace formal, 2026-10-02
Parent: bfcc8a44. Scope extension to zi8match.c was coordinated before editing.
Changed source: the Zi8SecMatchComp definition's parameter list only.
This is an interface correction with no percentage or code-generation gain.
## All-caller and callee evidence
A source-wide search finds one caller, in zi8InternalGetZH, and its explicit
four-argument declaration. A scan of every extracted43U object's relocation
tables likewise finds exactly one text reference, in zi8cgetc.o. The only
other direct symbol reference is the function's own extabindex entry.
No function-pointer data reference or second callsite was found.
The target caller at zi8InternalGetZH+0x8380 supplies the component cursor,
match object, dictionary base and workspace in argument registers3..6.
The workspace is the same saved incoming pointer used by the surrounding
engine helpers. This agrees with the reconstructed caller and its declaration.
The target callee is68 instructions /0x110 bytes and does not consume the
incoming fourth argument. Every path that reads register6 first defines a
new temporary there; no incoming workspace load or use is present. The
missing fourth formal is therefore an unused workspace parameter, consistent
with neighboring component matchers' ZI_NEED_WORK convention. Removing the
caller argument would contradict the target call sequence.
Added ZI_NEED_WORK to the existing definition, preserving its first three
formals and entire body. No local or storage was added, no value was made
volatile, and no register/spill was forced. The existing shared macro simply
expands to the same ziPtr workspace formal already declared by the caller.
No shared header or caller change was needed.
## Validation
Before-object: /tmp/ezi-chinese-reconstruction/zi8match-before-work-formal.o.
Fresh full report: /tmp/ezi-component-contract-full-report.json.
Build log: /tmp/ezi-component-contract-full-build.log.
Detailed checks: /tmp/ezi-component-contract-verification.txt.
All owned emitted sections have identical lengths, payloads and normalized
relocations: .text8256, .rodata528, extab80, extabindex120. The compiler
comment section is also unchanged. Symbol entries, relocation records and
section extents are unchanged; only compiler-generated anonymous extab names
in .strtab advance numerically after the additional formal. The entire object
file is therefore not byte-identical, but its emitted code/data and relocation
meaning are identical. No symbol-metadata edits were made to hide this.
All1027 full-report unit measures are unchanged. zi8match remains8/10 exact,
5172/8256 exact code,728/728 exact data and99.53004% unit fuzzy. All eight
baseline exact functions have ctxdiff diffs0 and identical instruction counts;
Zi8SecMatchComp remains68/68 instructions,0x110 bytes and exact100%.
Pool first: identical and empty. Full43U build passes with the approved
wrapper and WIBO_SJIS_MISSING_IMPORTS=1. DOL SHA1:
26116613f624061ba99c8d1a299aaa6efa85670d.
git diff --check passes. No remote, linking, shared-header, assembly, metadata,
artificial storage or undefined-value change.

View File

@@ -0,0 +1,51 @@
# Korean empty-context flow recovery, 2026-10-03
Base: 1fa33882; branch agent/bittle/korean-candidate-reconstruction.
Owned source: zkokeyp.c / Zi8GetKOcandidates only.
## Target evidence
The first context-length test at target function+0x158 sends an empty current
word directly to+0x730, the input-length/key-table scan setup. The compiled
source instead sent this case to its+0x6C8, the prefix-search result copy and
candidate cleanup. That block corresponds to target+0x6BC, which is reached
only after a nonempty context lookup attempt or word-table search.
Added an explicit empty-context guard to a label immediately before the
existing input-length check. The nonempty prefix-search paths still enter
search_table and perform the original result/candidate cleanup. The change
recovers the target control-flow edge without moving any body or introducing
storage, helper calls, or artificial register constraints. The old edge did
not necessarily change visible output for initialized empty context; this
is a target-flow correction, not a claim of a newly demonstrated user bug.
## Validation
Fresh baseline: /tmp/ezi-korean-recon-baseline.json.
Fresh final report: /tmp/ezi-korean-flow-full-report.json.
Full build: /tmp/ezi-korean-flow-full-build.log.
Detailed gates: /tmp/ezi-korean-flow-verification.txt.
Zi8GetKOcandidates: 97.96712% ->97.97459%.
Unit fuzzy: 98.65385% ->98.65769%.
Exact functions remain1/7, exact code332/5200, matched data96/180.
All1027 units were checked: the unit fuzzy gain is the only changed measure,
with no code/data/function or fuzzy regressions. No new exact function claimed.
The source object differs from its preserved baseline at exactly one .text
payload byte, the corrected branch displacement. All section sizes and all
canonical relocation tuples remain unchanged. .data40, extab56 and
extabindex84 are byte-identical to baseline. The unit's existing exact
Zi8_81483118 remains83/83 instructions and ctxdiff diffs0, with its exact
10-entry generated switch table unchanged.
Pool first: identical and empty. Main still673/669 instructions; the known
extra zero materialization, two lookup-result narrowings and return-value
move remain. All92 mapped direct main branches now preserve their target
destinations; the17 ordered helper calls agree. The filter's43 direct branches
also agree. These are advisory correspondence checks, not an exactness claim.
Full43U build passes with the approved wrapper and WIBO_SJIS_MISSING_IMPORTS=1.
DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d.
git diff --check passes. No header, metadata, linking, remote, assembly,
volatile, dummy-storage or forced-register changes.

View File

@@ -0,0 +1,76 @@
# Korean lookup halfword contract, 2026-10-03
Parent: dea3851e; its empty-context correction is unchanged.
Owned source: zkokeyp.c / Zi8_8148302C and its two local callers.
## Recovered type boundary
The lookup traverses a table whose count is ziU16, comparing and addressing
records through a halfword index, and returns either that index or0xFFFF.
For countN<=65535, successful indexes are0..N-1. The loop exits atN; a
halfword index cannot wrap on any traversed iteration. There is no need for
a full-word index or return value in this contract.
Both callers store the result into the halfword search.keyIndex. The target
stores the returned register directly through the halfword store. The first
caller then narrows for its assignment-value comparison, while the second
reloads the halfword for comparison. The current full-word declaration made
MWCC emit an additional narrowing before both stores.
Recovered the helper's ziU16 return and ziU16 loop index together, then used
the typed index directly in the loop condition and nine-byte address
expressions. The old explicit masks were the reconstruction of those same
halfword promotions while the local had the wrong full-word type. They are
not stripped from a full-word value or replaced by register constraints.
The resulting helper body is byte-for-byte identical to its previous body,
including its59 instructions and resolved calls. This demonstrates that the
same lookup operations and return representation are preserved while its
callers recover the target halfword assignment boundary. Both source callers
are in this unit. A scan of all extracted target objects found the same two
text references and only the helper's own extabindex reference otherwise.
No shared declaration or header changes are needed.
## Separate trials
A native unsigned-int return alone and explicit caller-store casts were
codegen-neutral and were not retained. The coherent halfword index/return
pair is the sole selected candidate. No old Chinese ABI experiment or
arbitrary declaration/register sweep was repeated.
## Validation
Baseline: /tmp/ezi-korean-flow-full-report.json.
Fresh full report: /tmp/ezi-korean-lookup-full-report.json.
Full build: /tmp/ezi-korean-lookup-full-build.log.
Detailed gates: /tmp/ezi-korean-lookup-verification.txt.
Zi8GetKOcandidates: 97.97459% ->98.146484%.
Unit fuzzy: 98.65769% ->98.746155%.
Relative to initial1fa33882, unit98.65385% ->98.746155%.
Exact functions remain1/7, exact code332/5200, matched data96/180.
All1027 unit measures and all per-function fuzzy scores were checked: the
Korean unit/main-function gains are the only metric changes, with no
regressions. No new exact function or complete unit is claimed.
Every other function's disassembly is baseline-identical, including the
changed lookup helper. The existing exact packing helper remains83/83
instructions and ctxdiff diffs0. Main shrinks673 ->671 instructions versus
target669, from0xA84 to0xA7C versus target0xA74. Its0x60 frame is preserved.
The remaining normalized differences are one zero materialization and one
call-result move; no further width or flow difference is identified.
.data40 and extab56 retain identical payloads and canonical relocations.
The already-unmatched84-byte extabindex changes only its main-function size
byte at0x4F,0x84 ->0x7C; its score remains97.61904%, and exact-data accounting
is unchanged. No real data object or section extent was changed.
Pool first: identical and empty. All92 mapped main branches preserve their
corrected target destinations; all17 helper calls correspond. An associative,
register-value-aware advisory audit pairs all163 store/call/branch effects
without differences. These checks are not formal equivalence or exactness
claims. Full43U build passes with the approved wrapper and
WIBO_SJIS_MISSING_IMPORTS=1. DOL SHA1:
26116613f624061ba99c8d1a299aaa6efa85670d.
git diff --check passes. No linking, remote, header, assembly, volatile,
dummy-storage, undefined-value or forced-register change.

View File

@@ -0,0 +1,108 @@
# One-key candidate boundary reconstruction, 2026-10-02
Parent commits: alpha 94b7f57e and 35677806, neutral Chinese ABI 105f3b45.
This pass changes only `libs/RVLMiddleware/eZiText/src/clib/zi81key.c`.
Alpha source/logs and Chinese source/log are unchanged.
## Retained target-defined boundaries
- `Zi8IsMatch1Key` consumes a halfword key. Six candidate calls narrow that
argument after Zi8GetPCode: target +0x0B0C, +0x0F30, +0x16C0, +0x1BA4,
+0x1F4C and +0x22A8. Restored the ziU16 formal and removed its three
redundant key masks. The helper itself remains 97/97 instructions,
objdiff 100%, ctxdiff diffs 0. All source call sites are in this same unit.
- Each of the six duplicate-bit checks consumes a byte result in the target.
Made the byte conversion explicit at these call boundaries rather than
changing the already-exact full-width duplicate helper.
- The user-dictionary availability result is narrowed to a byte at target
+0x1E00. The existing full-width declaration remains; the caller now
performs the demonstrated conversion explicitly.
- User ordinal decoding narrows the masked high byte to a halfword before
its shift at target +0x1E44. Recovered that type boundary.
- Final output termination stores through the current output index and then
increments that index without reloading it (+0x2524..+0x2534). Recovered
the ordinary postfix-index store. Its right-hand side is constant zero,
so there is no unsequenced index read/write.
These are source/ABI shape reconstructions with demonstrated target
conversions; no callee-saved-register or declaration-order sweep was used.
## Isolated source trials
Each trial used the exact 43U Ninja compiler command in `/tmp/ezi-onekey-pass`,
without modifying the worktree until the final candidate was selected.
Below: candidate-function fuzzy / unit fuzzy / matched data / exact functions.
- Halfword formal retaining old masks: 95.26784 / 97.65741 / 1232 / 4; rejected
- Byte duplicate-helper return: 94.73383 / 97.4822 / 1232 / 5; rejected
- Explicit duplicate-result bytes alone: same as preceding; not retained alone
- User-dictionary result byte alone: 95.240715 / 97.708664 / 1280 / 5
- User ordinal halfword alone: 95.30121 / 97.735695 / 1280 / 5
- Combined count-limit increments: 95.106384 / 97.64865 / 1232 / 5; rejected
- Terminal postfix index alone: 95.4368 / 97.79627 / 1280 / 5
- Halfword formal/old masks + duplicate bytes + limits:
95.984566 / 97.97763 / 1232 / 4; rejected
- Halfword formal with ordinary typed uses:
95.26784 / 97.72078 / 1232 / 5; restores the exact helper
- Typed key + duplicate bytes: 95.83312 / 97.97334 / 1280 / 5
- Typed key + duplicate bytes + count limits:
95.984566 / 98.04101 / 1232 / 5; excluded for data regression
- Preceding plus terminal postfix: 96.01794 / 98.055916 / 1232 / 5; excluded
- Preceding plus user-dictionary/ordinal conversions:
95.926155 / 98.01491 / 1232 / 5; excluded
- Typed key + duplicate bytes + terminal postfix:
95.858154 / 97.98453 / 1280 / 5
- Typed key + duplicate bytes + user-dictionary byte:
95.87484 / 97.99198 / 1280 / 5
- Typed key + duplicate bytes + ordinal halfword:
95.93533 / 98.01901 / 1280 / 5
- Typed key + duplicate bytes + terminal postfix + user-dictionary byte:
95.86858 / 97.98919 / 1280 / 5
- Typed key + duplicate bytes + terminal postfix + ordinal halfword:
95.98957 / 98.04324 / 1280 / 5
- Final complete boundary subset: 96.41927 / 98.23523 / 1280 / 5
After selecting that subset, the three count-limit blocks were tested
individually against it. OEM: 96.17564 / 98.12637 / 1280 / 5; PUD:
95.725075 / 97.92507 / 1232 / 5; phrase: 95.93575 / 98.019196 / 1280 / 5.
All three were rejected. No count-limit rewrite remains in the candidate.
## Full validation and exact data disclosure
Fresh report `/tmp/ezi-onekey-boundary.json`; full-build log
`/tmp/ezi-onekey-boundary-build.log`.
Unit fuzzy 97.778564% -> 98.23523%. Candidate-function fuzzy
95.39716% -> 96.41927%, about 98 fewer weighted deficit bytes.
Exact functions remain 5/9; exact code remains 3952/21460;
matched data remains 1280/1388. All five baseline exact functions have
ctxdiff diffs 0 and identical instruction counts.
Candidate instructions: 2387 -> 2405 versus target 2397; size
0x254C -> 0x2594 versus target 0x2574. Frame remains 0x140.
It is not exact, and no new exact function is claimed.
The spelling tables remain 1152 byte-identical bytes. .sdata2 and extab
remain byte-identical at 8 and 72 bytes. The switch table's source is 44
bytes versus target 48, the pre-existing four-byte section-alignment tail;
all 44 bytes and all eleven canonical relocation targets/addends match.
No real data object was resized or renamed and no padding was added.
The already-unmatched 108-byte extabindex still has two differing bytes at
0x4F and 0x5B, with the same 98.14815% section score. They are the function
extent words: spelling remains 0x1A94 versus target 0x1A90; candidate extent
changes from 0x254C to 0x2594 versus target 0x2574. This is changed unmatched
metadata, not a claim that all data bytes are unchanged.
Pool check: identical (no narrow strings). Advisory branch mapping: all 351
pairs preserve their destination and all 71 helper calls correspond. A
register-value-aware linear audit pairs 621 observable store/call/branch
effects. The seven missing byte-boundary differences are resolved; its
remaining three differences are the unchanged count-limit reloads, not a
formal proof or an exactness claim.
Full 43U build succeeds with the approved wrapper and
WIBO_SJIS_MISSING_IMPORTS=1. DOL SHA1:
26116613f624061ba99c8d1a299aaa6efa85670d.
`git diff --check` succeeds. No remote, linking, shared-header, assembly,
volatile, register-forcing, dummy-storage or undefined-value changes.

View File

@@ -0,0 +1,89 @@
# eZiText remainder reconstruction, 2026-10-02
Base: `449529d9`; branch `agent/bittle/allhands-ezi-decompile`.
Only 43U was configured, using `../toolchain/wibo-build/wibo` and
`WIBO_SJIS_MISSING_IMPORTS=1 ../.venv/bin/ninja`. No linking flags, shared
headers, remote refs, or upstream resources were changed.
## Baseline and first candidate: alpha engine
Fresh baseline report: `/tmp/ezi-baseline.json`.
`zi8alpha`: 11/12 exact functions, 5880/21664 exact code bytes,
516/564 exact data bytes; unit fuzzy 94.17892%.
`Zi8AlphaGetCandidates`: 3946/3946 instructions, function fuzzy 92.01039%.
These function and unit percentages are deliberately distinguished.
The scalar layout is four bytes lower in source than in the target because
of the target's existing workspace snapshot at stack 0x20. No dummy alias,
padding, or unused local was added to occupy that slot.
Six semantic corrections were established from definitions and uses, not
from equal-looking raw offsets:
- The flag initialized at target stack 0x84 is the current vowel/punctuation
restriction. At function +0x0798, the table-31 flag test for bit 4 clears
target 0x84 and its primary-language snapshot at 0x8C. Source uses 0x80
and 0x88 for those same definitions.
- The different completion flag is at target 0x88. The table-31 bit-2 test
at +0x07C8 clears target 0x88 and primary snapshot 0x90. Its source slots
are 0x84 and 0x8C. Language-pass restoration confirms both identities.
- Target reads of 0x84 at +0x2114, +0x2214, +0x32F4, +0x3384 and +0x3664
gate punctuation retries, suffix activation, suffix locking and prefix
punctuation. The source incorrectly read the completion flag in all five
places. The candidate uses the traced current-restriction variable.
- At +0x1430 the target loads the dictionary-order index from 0x64, uses it
to select a byte dictionary kind, and stores that kind at 0x60. The retry
condition at +0x3060 reads 0x64, also used by the following outer-loop
increment. Source incorrectly tested dictionaryKind; it now tests
dictionaryIndex. The safe existing early dictionaryIndex initialization
was preserved.
The isolated six-line semantic patch is preserved at
`/tmp/ezi-alpha-six-conditions.patch`. Alone it gives function 92.009125%,
unit 94.17799%, with code/data/exact counts unchanged. This tiny fuzzy
fluctuation does not invalidate the traced variable corrections.
The first handed-off candidate also restores the original address-order
suffix-lock block before alternate-prefix fallback, restores positive branch
conditions, and places each language's restriction snapshots at its actual
control-flow position. No helper prototype change is included in this first
candidate.
First-candidate fresh report: `/tmp/ezi-alpha-minimal.json`.
`Zi8AlphaGetCandidates`: 94.47314%, 3946/3946 instructions.
Unit fuzzy: 94.17892% -> 95.97323% (about 389 fewer weighted deficit bytes).
Exact functions: 11/12 -> 11/12. Exact code: 5880 -> 5880 bytes.
Exact data: 516 -> 516 bytes. All non-text section scores are unchanged.
Both pools contain no strings and compare identical.
## Separate later research, not part of the first candidate
- Further emission/cursor/comparison/switch reconstruction reached function
95.63913%, unit 96.82275%, 3950/3946 instructions. Existing exact functions
remain exact, but extabindex accounting drops by 108 bytes. Preserved at
`/tmp/ezi-alpha-deliver.c`; not included in the first candidate.
- Matching PUD return declarations to zi8pud2.c's ziU32 definitions, with
explicit caller byte narrowing, leaves alpha's score unchanged but moves
one-key candidates 95.39716% -> 95.32416%. Its 5 exact functions and data
1280/1388 remain unchanged. Held separately for ABI review.
- Matching Chinese Zi8GetPCode to zi8match.c's ziU16 definition restores the
two target halfword narrowings in paired-phonetic lookup. Together with the
explicit PUD ABI correction: engine 96.27482% -> 96.492134%, unit
96.65468% -> 96.848755%, 10678/10676 instructions, 5 exact unchanged.
extabindex accounting drops 72 bytes. Held for section/relocation audit.
- Splitting the Chinese component cursor/table chained assignment reproduces
the target's intermediate reload but lowers the engine to 96.090294%;
rejected and restored.
- Replacing the spelling candidate-count assignment with postfix increment
lowers spelling 99.555885% -> 96.8%; rejected and restored.
The larger scratch candidate's branch-destination audit found no mapped
branch-target differences over 720 alpha, 351 one-key and 1594 Chinese
branches. Helper-call counts are respectively 73/73, 71/71 and 168/168.
This audit ignores register choices and accounts for the known stack shift;
it is evidence of control-flow coverage, not a claim of exact matching.
First-candidate validation: full 43U build succeeds; DOL SHA1 is
`26116613f624061ba99c8d1a299aaa6efa85670d`. Every one of the 11 baseline
exact alpha functions has identical instruction counts and ctxdiff diffs 0.
`git diff --check` succeeds. No new exact function or complete unit is claimed.

View File

@@ -0,0 +1,102 @@
# Input-form source reconstruction, 2026-10-02/03 UTC
Base `cc812ad3`, branch `agent/bittle/input-form-reconstruction`, 43U only.
Only `src/keyboard/tiInputForm.cpp` and this log are changed. Existing attempt
logs, headers, metadata, compiler settings, linking flags and assembly bodies
are untouched.
## Retained changes and target evidence
### LayoutByNW4R::create
The first language text-pane lookup in the target loads the layout's root pane
and invokes FindPaneByName with the recursive flag. The old source instead
invoked the Layout virtual getPane slot. The retained source directly expresses
the root-pane lookup, recovering two missing instructions and the correct call
receiver path. The later const getLanguageTextPane fallback remains intact.
The animation loop in the target keeps the address of the selected files[] slot.
It loads the file for GetResource, then reloads that slot after the resource and
animation-transform calls to obtain the animation ID. The old source captured
the file pointer once. A const reference to the existing typed pointer slot now
expresses the target's lifetime and recovers the other two missing loads. No
new storage, qualifier forcing, table entry, or helper was introduced.
Together these changes restore the target's 356-instruction body. The fallback
name-selection block still schedules some receiver loads differently, and most
remaining differences concern register allocation. This is not an exact match.
### Base::calcCursorPos
The source now uses the already defined Rect::GetWidth accessor for glyph and
form widths. That existing accessor computes exactly right minus left. The
change preserves the arithmetic, hit-test inequalities, wrap/newline paths,
scroll handling, recursive fallback, and all helper calls. It recovers more of
the target's rectangle-expression boundaries at unchanged body size. Height
accessors and midpoint operand reversal did not improve the result and were not
retained. No new geometry abstraction or arithmetic reassociation was added.
## Attempts and rejected alternatives
- Read the previous sol-high-inputform and data-d4 logs. Revisited their concrete
root-query and file-slot defects under the user's current partial-decompilation
priority; did not repeat the historical declaration searches.
- Tested the two create corrections independently and together. Explicit fallback
selector locals produced the same code. Duplicating the root lookup in both
fallback branches grew the function to 363 instructions and was rejected.
- Tested small inline fallback-lookup wrappers; they added source complexity
without improving the retained result. A trial binding the derived layout
pointer to a base pointer reference did not compile and was restored.
- Existing width and height accessors and midpoint operand order were tested
independently. Only the width accessor change is retained.
- No artificial allocation sweep, new assembly, use-site volatile, dummy storage,
undefined input, padding, header edit, or linking experiment was used.
## Gates
Before -> after:
- calcCursorPos: 91.622696 -> 93.05215% fuzzy, 326/326 instructions unchanged;
final raw ctxdiff 50 differences (baseline 52, including existing relocation
aliases and floating-point scheduling/allocation differences).
- LayoutByNW4R::create: 95.02809 -> 96.40169% fuzzy, 352 -> 356 instructions against
target 356; final ctxdiff 155 differences.
- Unit fuzzy: 99.578094 -> 99.6535%.
- Existing objdiff-exact symbols: 218/221 unchanged; exact code 46980/50656 bytes;
matched data 3772/3772 (100%); linked status unchanged.
- Independently rebuilt the baseline and candidate objects. All 218 previously
objdiff-100 symbols have identical baseline/candidate instruction streams.
This preserves the pre-existing distinction between objdiff and raw ctxdiff
exactness rather than claiming every alias-normalized symbol has diffs 0.
- Baseline/candidate raw .data, .rodata, .bss, .sdata, .sbss, .sdata2 and .ctors
section bytes and extents are identical. All 20 pool strings match the target.
- Literal audit: 20 arguments checked, 221 functions analyzed, no candidates,
skips or errors. Target-sized create is now included in that audit.
- Full 1027-unit report: no exact-function, exact-code, data or fuzzy regressions.
- Full 43U build and build/43U/ok passed, again after rebuilding the baseline and
restoring the candidate. DOL SHA1:
`26116613f624061ba99c8d1a299aaa6efa85670d`.
## Focused behavior coverage and limits
A private host harness extracts the production baseline/candidate calcCursorPos
bodies without rewriting them, supplies the same Rect::GetWidth expression, and
uses deterministic font/scale/wrap stubs. Compiled with single-precision float,
-fno-fast-math and -ffp-contract=off, it checks returned positions, helper-call
traces and wrap counters across empty text, newlines, forced word wraps, width
wraps, boundary hits, scale, non-positive scroll and recursive fallback.
159,320 terminating cases agreed. Another 680 synthetic font/wrap states reached
the same 1,000-scale-call model budget with identical traces in both versions;
no termination claim is made for those states. The initial unrestricted harness
also reached its budget in the baseline, so this is equivalence coverage for the
accessor change, not proof of general termination or a newly diagnosed Wii bug.
The layout/resource creation path is validated by target call/load evidence and
the real 43U compile; no Wii UI/runtime execution is claimed.
Private local evidence: `/tmp/input-form-reconstruction/` contains baseline/final
reports and object copies, pool/literal audits, both final ctxdiffs, build logs,
validate_cursor.py and cursor-tests.log, plus rejected experiments. No retail
assembly or binary is committed or uploaded.
GATE: validated partial source/control/data-flow reconstruction; no regressions.
Exact matching and linking remain open. Candidate frozen for parent validation.

View File

@@ -0,0 +1,70 @@
# Keyboard dictionary accessor contract, 2026-10-03 UTC
Base `1fa33882`, branch `agent/bittle/keyboard-manager-reconstruction`.
Only two calls in `src/system/iplKeyboard.cpp` and this log are changed. 43U only;
no header, metadata, compiler-setting, assembly, linking or data edits.
## Source defect and retained correction
Manager::create's two dictionary loops use an OEM index in the range 10..19.
They passed that index to System::getZiDicData(int), which is currently defined
as `smArg.mZiDicData.sys[i]`. The sys subarray has ten elements. Thus the source
expressed the OEM reads beyond that subarray's bounds, despite landing at the
intended adjacent OEM bytes on the target compiler.
The retained calls use the already existing System::getZiOemDicData accessor,
passing the OEM-relative index `oemIndex - EZTX_LANG_MAX` (0..9). This accessor
indexes the actual ten-element oem subarray. The target loads from the combined
system/OEM table base plus four times the absolute OEM index; the corrected
accessor computes the same addresses through the proper object member.
No shared accessor or data layout is changed. The existing system-dictionary
presence check governing fallback selection is preserved, as the target proves.
This is a source-correctness improvement, not a new exact match or a matching-
percentage gain. The entire generated source .text section remains byte-identical.
## Other investigations
- Read the prior fz1 and data-d1 construction/index/memo-copy attempts.
- The existing zero-argument twenty-entry dictionary accessor also preserved
the baseline score. The dedicated OEM accessor was preferred for its explicit
index domain and object-member contract.
- Using the system index directly for OEM lookup or changing to an independent
zero-based OEM counter changed induction lowering and reduced similarity;
those forms were not retained.
- Explicit allocation followed by placement construction was tried for the arc
link, resource accessor and allocator. It did not improve output, so those
larger changes and the extra include were discarded.
- No declaration/register sweep, artificial storage, volatile cast, padding,
assembly, header change or linking experiment was used.
## Verification
Baseline -> candidate:
- Manager::create: 94.00944 -> 94.00944%, 318/318 instructions unchanged.
- Unit fuzzy: 98.73506 -> 98.73506%.
- Exact functions 31/32, exact code 4752/6024, data 1184/1184 (100%), and linked
status unchanged. Exact matching of create remains open.
- Fresh baseline and candidate object builds: all 32 reported function instruction
streams are identical. Entire source .text (6240 bytes), .data (1161 bytes),
.sdata (6 bytes) and .sdata2 (8 bytes) are byte-identical.
- Pool: all 28 strings identical to target.
- Literal audit: 25 arguments, 32 functions, no candidates, skips or errors.
- Full 1027-unit report has no exact-function/code/data/fuzzy regressions.
- Full 43U build and build/43U/ok passed. DOL SHA1:
`26116613f624061ba99c8d1a299aaa6efa85670d`.
A host harness extracts the actual production dictionary loops and uses bounded
system/OEM accessor stubs. Compiled with undefined-behavior/bounds sanitizers,
it passes all 1,048,576 combinations of ten system and ten OEM availability bits.
The independent reference checks the target's fallback-selection rule, every
result pointer, the preserved language IDs and both final table sentinels.
No Wii resource-loading or UI runtime execution is claimed.
Private evidence: `/tmp/keyboard-manager-reconstruction/` contains baseline/final
reports and object copies, pool/literal audits, full-build.log, source experiments,
validate_dictionaries.py and dictionary-tests.log. No retail assembly or binary
is included in this commit.
GATE: source accessor bounds corrected with byte-identical generated code and
no matching/data regressions. Frozen for parent validation; no completion claim.

View File

@@ -0,0 +1,62 @@
# MD5 unsigned arithmetic and cursor reconstruction, 2026-10-02
Separate follow-on to accepted MD5 commit `521056a9`. AES commit `2a537c14`
and both prior logs are unchanged. Only 43U was configured or built.
## Target-grounded changes
The target ProcessBlock rotation halves retain independently grouped additions
of the unsigned state, round constant and separately byte-reversed message
words. Reassociating those three u32 operands inside the accepted helper brings
the compiler's data-flow closer to the target while preserving modulo-2^32
arithmetic. The first MD5 round consumes sequential message words; expressing
that consumption with `word++` as the helper's pointer argument improves its
schedule. STEP evaluates this pointer argument exactly once; the helper still
uses that captured pointer for both byte-reversed reads. No evaluation-order
ambiguity, extra read, undefined value, or new helper is introduced.
Experiments enumerated 144 valid addition operand/grouping combinations for
the two halves. The best target-sized arithmetic expression reached 93.447716%
ProcessBlock fuzzy. Five cursor/loop variants and eight independent cursor-
consumption combinations then identified the minimal `word++` form, reaching
94.30719%. A larger by-reference cursor helper reached 94.98366% but duplicated
rotation code for a small gain and was rejected. Three explicit feed-forward
variants did not improve the retained result. No declaration/register sweep,
assembly, volatile qualifier, padding or linking change was used.
## Verification
Accepted MD5 -> this candidate:
- ProcessBlock: 81.82026 -> 94.30719% fuzzy; 306/306 instructions unchanged.
- Unit fuzzy: 87.80044 -> 96.179825%.
- Exact functions 3/4 and exact code 600/1824 are unchanged.
- Data 456/456 (100%) and linking status are unchanged.
- NETMD5Init 16/16, NETMD5Update 60/60 and NETMD5GetDigest 74/74 still have
ctxdiff diffs 0 and objdiff 100%.
- ProcessBlock has 215 positional differences. An advisory comparison that
ignores GPR names leaves five opcode/immediate-order differences: three
sequential cursor offsets and two final state-load positions. This is not
an exact match or a proof that every remaining difference is register-only.
- Empty string pools remain identical. Constants/index tables and end-marker
data are unchanged from the accepted candidate.
- AES metrics and source are unchanged from commit 2a537c14.
- Full 1027-unit report: zero exact-function/code/data/fuzzy regressions versus
baseline449529d9; additionally both owned units preserve the immediately
preceding candidate's exact/data scores and improve or preserve fuzzy scores.
- Full 43U build and build/43U/ok passed. DOL SHA1:
`26116613f624061ba99c8d1a299aaa6efa85670d`.
All 3,088 MD5 known-answer/random/chunking comparisons passed again against
Python hashlib. Run `python3 /tmp/crypto-remainder/validate_md5.py`. The test
compiles production C unchanged with PPC intrinsic shims, supplies RFC1321
padding externally, and exercises ProcessBlock through NETMD5Update. The
instruction-exact GetDigest platform-endian stores are not host-tested.
Local evidence (not committed/uploaded): `/tmp/crypto-remainder/` contains
`md5.grouping-results.json`, `md5-grouping-final.json`,
`md5-grouping-ProcessBlock.ctx`, `md5-grouping-vectors.log`, and
`md5-grouping-full-build.log`. Original target evidence remains in the local
split object and disassembly; no retail assembly is included in this commit.
GATE: validated partial structural candidate; no regressions. Exact matching
and linking remain open.

View File

@@ -0,0 +1,86 @@
# MD5 rotation-expression reconstruction, 2026-10-02
Baseline: `449529d9`, 43U only. Owned source: `libs/RevoEX/src/net/md5.c`.
The current user priority permits validated structural/fuzzy improvements before
exact matching and linking. This is a partial matching candidate, not an exact
match or a linking change. AES experiments were saved outside the checkout and
AES was restored to the baseline before this candidate was validated.
## Source evidence
- Ground truth: `build/43U/obj/libs/RevoEX/src/net/md5.o`, `ProcessBlock`.
- The target is 0x4C8 bytes / 306 instructions, with a 0x20-byte stack frame.
- Each of the sixteen unrolled MD5 steps contains two byte-reversed word loads.
The first pair is at function-relative offsets 0x3C and 0x40. The right-shift
half consumes the first value, and the left-shift half consumes the second.
- The target retains four additions across the two rotation halves: the
right-shift half adds the message word to (round constant + state), and the
left-shift half adds the state to (message word + round constant). The state
includes the round Boolean function. The first rotation uses right shift 25
and left shift 7; the remaining shifts follow the existing MD5 round schedule.
- The index-table address is first materialized after the first sixteen steps,
rather than before the sequential-word round.
- The inline helper expresses these real unsigned 32-bit operands and restores
the target-sized body. It introduces no assembly, volatile qualifier,
uninitialized value, fake storage, padding, or compiler-option change.
- All four round algorithms, all 64 constants, all 48 indices, and all public
API bodies are otherwise unchanged. The old ROTATE macro became unused and
was removed.
## Attempts
1. Direct pointer-form byte-reversed loads and alternate ordinary arithmetic
groupings: 274-294 instructions, at best near the starting score. Rejected.
2. A typed inline endian-load wrapper: improved instruction similarity but
retained 276 instructions and insufficient target operation boundaries.
3. Rotation-expression helpers without independent load results: 288-290
instructions, approximately 41-44% ProcessBlock fuzzy. Rejected.
4. Explicitly named byte-reversed operands for the two rotation halves:
306 instructions / 81.82026% fuzzy. Retained the target's first-read/right-
shift ordering. Reversing those loads reached 82.0% but added two instructions
and contradicted the target's operand ordering, so it was rejected.
5. Sequential partial-sum statements and equivalent regroupings did not
improve the retained structural form. No register-only declaration sweep.
## Validation
Command setup:
`python3 configure.py --version 43U --wrapper ../toolchain/wibo-build/wibo`
`WIBO_SJIS_MISSING_IMPORTS=1 ../.venv/bin/ninja`
- `pool_diff.py`: identical empty MD5 string pool, 0/0 strings.
- `.data`: all 448 bytes identical. The source `.sdata` is the one-byte
end marker (0x80); the target has the same byte followed by seven alignment
zeros. This existing section-size difference is unchanged, and objdiff
reports `.sdata` and unit data at 100%. No padding was added.
- `NETMD5Init`: 16/16 instructions, ctxdiff diffs 0, objdiff 100%.
- `NETMD5Update`: 60/60 instructions, ctxdiff diffs 0, objdiff 100%.
- `NETMD5GetDigest`: 74/74 instructions, ctxdiff diffs 0, objdiff 100%.
- `ProcessBlock`: 294 -> 306 instructions against target 306;
43.290848 -> 81.82026% fuzzy. Final ctxdiff has 255 positional differences,
primarily allocation, scheduling and remaining arithmetic grouping. Not exact.
- MD5 unit: 61.945175 -> 87.80044% fuzzy; exact 3/4 -> 3/4;
exact code 600/1824 unchanged; data 456/456 (100%) unchanged; unlinked unchanged.
- Full 1027-unit report: no unit regressed in exact functions, exact code,
exact data or fuzzy score versus the baseline report. Overall fuzzy moved
99.588615 -> 99.60437%; exact code and linking did not change.
- Full 43U build passed. `build/43U/ok` passed. DOL SHA1:
`26116613f624061ba99c8d1a299aaa6efa85670d`.
Host algorithm validation: `/tmp/crypto-remainder/validate_md5.py` compiles the
production source unchanged with host shims for PPC byte-reversed intrinsics.
It verifies ProcessBlock through NETMD5Update with externally supplied RFC1321
padding, comparing state words with Python hashlib. The host test deliberately
does not exercise GetDigest's platform-specific big-endian length stores.
Result: 3,088 successful digest/chunking comparisons, covering the seven RFC1321
example strings, one million `a` bytes, 1,500 seeded messages, lengths around
55/56/63/64/65 and larger block boundaries, and fixed/random chunk sizes.
Run: `python3 /tmp/crypto-remainder/validate_md5.py`.
Local evidence (not committed or uploaded): `/tmp/crypto-remainder/md5.target`,
`md5-final.ctx`, `md5-final.json`, `baseline.json`, `full-build.log`, and the
host test plus its header shim. Only source and this summary are committed.
GATE: partial decompilation candidate validated; no regressions; exact matching
and linking remain open. No claim of all-100% completion.

View File

@@ -0,0 +1,99 @@
# NHTTP stdlib source reconstruction, 2026-10-02
Base `b26e248b`, branch `agent/bittle/nhttp-source-reconstruction`, 43U only.
Owned source: `libs/RevoEX/src/nhttp/NHTTP_stdlib_RVL.c`. No headers, metadata,
configuration, linking flags, binary data, or other source files changed.
The earlier `four-leaves-r9.attempts.md` and other worker logs are untouched.
## Target-grounded changes
### NHTTPi_compareToken
The target enters through its case-folded equality test, then checks the raw left
byte for NUL/space before advancing the two pointers. It retains the unsigned
byte separately and sign-extends it for both the case fold and termination check.
The baseline unconditional loop placed that control-flow boundary differently
and compiled to 44 instructions rather than the target's 45.
The retained while condition captures the raw u8 load and explicitly sign-extends
it into LowerCase. The body reuses that captured byte for termination. LowerCase
returns its conditional value directly, preserving the target's separate folded
value lifetime. This recovers the complete 45-instruction control-flow shape.
The common helper's other callers remain unchanged at the instruction level.
A separate token-only helper gave the same result; it was removed to avoid
unnecessary duplication.
Remaining differences: two initial constant loads are reversed, and eight
instruction operands use different scratch/callee-saved registers. This is not
an exact match.
### NHTTPi_Base64Encode
The target retains signed length/padding comparisons. The length local is now
s32, matching those comparisons without the previous mixed-sign comparisons.
Each quartet snapshots its three signed input bytes before writing the output,
then combines each later byte's high fragment with the preceding byte's masked
low fragment. This expresses the target's byte-load and index dependency
structure more closely, preserving the 119-instruction body size.
The target and existing implementation use signed byte shifts, a NUL-terminated
input, and full three-byte reads even for a short final group. This candidate does
not broaden the API to arbitrary binary data or repair those original constraints.
The repository's caller supplies a separate temporary source and authorization
output buffer (`d_nhttp.c`, NHTTP_CreateRequest proxy authorization path).
## Experiments
- Recovered the previously logged loop-test/raw-byte/ternary-fold approach rather
than repeat register/declaration searches. Local conditional-loop alternatives
were measured against the target before retaining the compact while condition.
- One exploratory assignment/read condition was found to be unsequenced. It was
withdrawn, never behavior-tested, and is not part of the retained source.
- Signed/unsigned/raw byte representations and explicit sextet fragments were
checked against target load/sign-extension evidence. Signed byte snapshots
with the retained index grouping gave the best compact source.
- Stream-cursor forms generated identical code and were not retained.
- A separate quartet helper improved Base64 only 67.63025 -> 67.79832%; it was
discarded as unnecessary source expansion. There is no new helper in the diff.
- No declaration/register sweep, inline assembly, use-site volatile, dummy value,
padding, compiler-option change, or linking experiment was performed.
## Verification
Before -> after:
- NHTTPi_compareToken: 54.622223 -> 98.844444% fuzzy; 44 -> 45 instructions against
target 45. Final ctxdiff: 10 positional differences.
- NHTTPi_Base64Encode: 60.285713 -> 67.63025% fuzzy; 119/119 instructions unchanged.
Final ctxdiff: 67 positional differences (baseline 58); aligned objdiff improves
despite that positional metric. Exact dependency scheduling remains open.
- Unit fuzzy: 87.93594 -> 93.03203%.
- Exact functions 11/14, exact code 1388/2248, data 112/112 (100%) and linked status
are unchanged. All 11 previously exact functions have ctxdiff diffs 0.
- The unchanged strnicmp remains 99.76471%, 51/51 instructions, two constant-order
differences. LowerCase's other exact users remain exact.
- Pool: the one alphabet string is identical. .data's 65 bytes and .rodata's
36 bytes equal the prefixes of their 72-byte/40-byte target sections. Existing
trailing target alignment extents are unchanged; no padding was introduced.
- Literal-reference audit: 14 functions analyzed, no candidates, skips or errors;
zero statically addressed call arguments, so this is not a separate proof of
complete data matching.
- Full 1027-unit report: zero exact-function/code/data/fuzzy regressions.
- Full 43U build and build/43U/ok passed. DOL SHA1 remains
`26116613f624061ba99c8d1a299aaa6efa85670d`.
Host behavior validation compiles both unchanged production sources (baseline
and candidate) with -fsigned-char and fixed-width SDK type shims:
- 75,536 compareToken cases: all 65,536 first-byte pairs plus 10,000 seeded
multi-byte/case-fold/mismatch cases, against an independent token reference.
- 3,033 Base64 cases: known answers, every length 0..1024, and 2,000 seeded ASCII
strings up to 4096 bytes, against Python base64. Return length, NUL terminator
and a 16-byte output canary are checked. Inputs have readable zero tail bytes
for the original full-triplet reads. High-bit/binary inputs are not claimed.
Private local evidence: `/tmp/nhttp-source-reconstruction/` contains baseline and
final reports, all function ctxdiffs, pool/literal audits, full-build.log,
validate_nhttp.py, vectors.log, and the rejected local experiments. No retail
assembly or binary is included in this commit.
GATE: validated partial control/data-flow/type reconstruction; no regressions.
Exact matching and linking remain open. Frozen for independent parent validation.

View File

@@ -0,0 +1,199 @@
# System remainder decompilation, 2026-10-02
Baseline: `449529d92405f8f7fda610660c7794914a81dfe6`.
Branch: `agent/bittle/allhands-system-decompile`.
Owned units: `src/utility/iplESMisc.cpp`, `src/scene/setting/AOSS.c`,
`src/scene/setting/ATERM.c`. Parent additionally approved the single ESMisc
return-type declaration change in `include/utility/iplESMisc.h`.
The current user priority is complete source reconstruction first, exact code
matching second, linking last. This candidate is decompilation progress, not an
exact match or a linking change. No configuration, symbol, split, or link flag
was changed. AOSS and ATERM are unchanged.
## Initial audit
- Read AGENTS.md, CONTRIBUTING.md, local skill inventory, AOSS/ATERM attempt
histories, and ESMisc rounds 9/11. The sole local skill is unrelated TypeSafe
integration guidance.
- Configured and built only 43U with the approved Wibo wrapper.
- Before source work, pool_diff found ATERM 0/0 strings and AOSS 1/1 identical.
ESMisc first diverged at string 83; both contained 114 strings.
- ESMisc's 30 exact functions were preserved in earlier rounds, but a meaningful
helper reconstruction had been discarded solely because it was not exact.
Reconstructed it from the current C++ and target object, without importing an
old experimental source or altering linker behavior.
## ESMisc reconstruction
Restored three ordinary inline boundaries named by the target's diagnostic
literals: `verifySavedataZD`, `DeleteTicketsForce`, and `InitSavedata`.
`ESMisc::DeleteUnauthorizedData` returns the initializer status.
Concrete correctness corrections:
1. Use a real NAND_MAX_PATH buffer and a real caller-owned, 32-byte-aligned
NANDFileInfo. Removed the out-of-object `path - 8` and `fileInfo - 0x20`
accesses. The caller also owns the aligned, rounded ticket-view scratch.
2. Traverse `ESTitleId` values by typed array index, with one unconditional loop
increment for every title. The old verifier branch continued without
advancing its separate byte offset and could repeat the same title.
3. Replace the handwritten nested 64-bit switch-lowering expression with the
five actual title cases and the independently masked save-title predicate.
4. Preserve the two ES_ListTitlesOnCard results independently of inlined file
and ticket operation status. The public declaration now returns s32.
5. A negative NANDRead result jumps to cleanup, which frees the save buffer
before closing the still-open file. The old source took the success-path
close before freeing it. Successful or invalid-size reads retain their
close-before-delete/free path.
6. Use sizeof(ESTicketView) for the 0xD8-byte copy and OSRoundUp32B for the 0xE0
scratch/allocation extent, preserving the target's distinct sizes.
### ABI and control-flow evidence
Target function: address 0x813673E0, size 0x704 (449 instructions).
At original object offsets 0x1D20 and 0x1D9C, the two enumeration return values
are saved in r27. Calls through both verifier/ticket paths leave that saved
value independent. At 0x23C0 it is copied to return register r3 after the
optional title-list free. The prior void declaration discarded this ABI.
The only declaration is in include/utility/iplESMisc.h. The only call is
src/system/iplSystem.cpp:680; it intentionally ignores the result. The symbol
name is unchanged because the return type is not encoded in this member name.
All 1027 compiled source objects were compared after a forced full rebuild;
iplSystem and every unit except iplESMisc were byte/relocation unchanged.
The target's verifier branch joins the common increment at 0x238C (index +1,
byte offset +8). Its negative-read path joins cleanup at 0x2104, whereas its
successful close begins at 0x20E0. The reconstruction restores these distinct
paths instead of compensating with stack offsets or register tricks.
### Measurements
| Unit / measure | Before | After |
| --- | ---: | ---: |
| ESMisc exact functions | 30/31 | 30/31 |
| ESMisc exact code | 9404/11200 | 9404/11200 |
| ESMisc fuzzy | 96.76036% | 99.33143% |
| DeleteUnauthorizedData fuzzy | 79.797325% | 95.830734% |
| Function instructions | 434/449 | 446/449 |
| ESMisc matched data | 4416/4416 | 4416/4416 |
| ATERM exact / fuzzy / data | 17/26; 96.624664%; 18584/18864 | unchanged |
| AOSS exact / fuzzy / data | 16/21; 96.777916%; 3928/3928 | unchanged |
| Whole-report fuzzy | 99.588615% | 99.598236% |
pool_diff now reports all 114 strings identical. The source .data is 4378
bytes and exactly equals the original section's first 4378 bytes. The target
section is 4384 bytes and ends in six zero alignment bytes. No synthetic
padding was added. The objdiff data score remains 100%, and the literal audit
checks 204 arguments in all 30 exact functions with zero candidates or errors.
The candidate remains non-exact. ctxdiff shows 446/449 instructions and
remaining register allocation, -1 mask materialization, and scratch-pointer
lifetime differences. No brute-force declaration/register search was run.
## Validation
Commands:
- python3 configure.py --version 43U --wrapper ../toolchain/wibo-build/wibo
- Delete generated native `build/43U/src/**/*.o`, retaining a private baseline
object snapshot for comparison.
- WIBO_SJIS_MISSING_IMPORTS=1 ../.venv/bin/ninja all_source build/43U/report.json build/43U/ok
- PYTHONPATH=../local-tools ../.venv/bin/python tools/decomp-assist/pool_diff.py
- PYTHONPATH=../local-tools ../.venv/bin/python tools/decomp-assist/ctxdiff.py src/utility/iplESMisc DeleteUnauthorizedData__Q33ipl7utility6ESMiscFPQ23EGG4Heap
- PYTHONPATH=../local-tools ../.venv/bin/python tools/decomp-assist/literal_reference_diff.py src/utility/iplESMisc
- Compare every unit in the fresh report and all 1027 source objects' allocated
bytes and normalized relocations against the baseline.
- git diff --check
Full rebuild passed (1031 Ninja steps). DOL SHA1:
`26116613f624061ba99c8d1a299aaa6efa85670d`.
Only the ESMisc report changed: its fuzzy and one function's fuzzy improved.
No report metric regressed. Only ESMisc's allocated .text and .data changed:
.text 11360 -> 11408 bytes (390 relocations on both sides), .data 4378 -> 4378
bytes (zero relocations). Every other allocated section/object is unchanged.
A temporary host harness extracted the actual reconstructed helper bodies,
substituted fake Wii/heap calls, and exercised 12 control-flow scenarios:
first and second enumeration errors, title-list allocation failure, mixed
Zelda/blocked/ordinary title traversal, negative read, short read, second-save
verification failure, absent file, save-buffer allocation failure, ChangeUid
failure, ticket enumeration failure, and zero-ticket handling. Tests ran with
AddressSanitizer and UndefinedBehaviorSanitizer. LeakSanitizer is unavailable
under the execution environment's ptrace, so only that component was disabled.
The harness is supplemental behavioral validation, not a retail runtime test.
GATE: focused decompilation improvement; full 43U/DOL and no-regression checks
pass; exact-matching gate remains incomplete at 30/31. No linking claimed.
## Follow-on: recover the last ESMisc structural differences
Baseline for this follow-on is the accepted reconstruction `1f9db89d`:
30/31 exact functions, function 95.830734%, unit 99.33143%, 446/449 instructions,
data 4416/4416. The source/header correction remains intact.
Natural source attempts, in order:
| Attempt | Instructions | Function fuzzy | Disposition |
| --- | ---: | ---: | --- |
| Ticket helper uses error-first cleanup and returns early with no tickets | 446/449 | 95.830734% | Same generated code |
| Caller gives aligned ticket scratch an explicit pointer lifetime | 448/449 | 98.004456% | Improved |
| Move aligned ticket scratch into the ticket helper | 446/449 | 95.817375% | Rejected |
| Scope caller's scratch pointer to successful title enumeration | 448/449 | 98.89755% | Retained |
| Restore nested ticket helper with scoped scratch | 448/449 | 98.89755% | Same generated code |
| Ticket helper returns its actual ES operation status | 449/449 | 99.14254% | Retained |
The scratch pointer is initialized only in the block reached after successful
second enumeration, and remains live across the title loop. This restores the
saved scratch cursor and per-iteration 64-bit mask materialization. No pointer
is used before initialization and no artificial use extends its lifetime.
The private ticket helper now returns the status already obtained from
ES_GetTicketViews or ES_DeleteTicket, including its zero-ticket early return
and normal cleanup. Its caller intentionally discards that status. The return
contract of an independently emitted original helper cannot be established
because this helper was fully inlined; this is a natural equivalent source
form whose zero-ticket branch structure is confirmed by the target. It does
not overwrite the outer enumeration status or change the public ABI further.
Final ctxdiff: 449/449 instructions, 74 differences. Every mnemonic,
non-register operand, stack offset, resolved call target and branch target
agrees. The remaining differences are register substitutions, including the
title list, scratch cursor, title index, verifier flags and title halves. No
register/declaration permutation search was performed after reaching this
structural agreement.
Measurements after a fresh full report:
- ESMisc exact functions 30/31 -> 30/31
- ESMisc exact code 9404/11200 -> 9404/11200
- ESMisc fuzzy 99.33143% -> 99.8625%
- DeleteUnauthorizedData fuzzy 95.830734% -> 99.14254%
- Matched data 4416/4416 -> 4416/4416
- Pool: all 114 strings identical
- Literal audit: 204 arguments in 30 exact functions, no candidates/errors
- Every other unit's full report is unchanged
- Full 43U build/check and DOL SHA1 pass:
26116613f624061ba99c8d1a299aaa6efa85670d
- The same 12 ASan/UBSan host control-flow scenarios pass on helper bodies
freshly extracted from this final candidate (LeakSanitizer disabled only
for the environment limitation already noted)
- git diff --check passes
This remains a partial matching improvement, not an exact function or unit.
### Rejected ATERM ownership experiment
Read-only target evidence identified that the old typed reply view spans the
last eight bytes of one BSS object and the following option-buffer allocation.
With parent approval, tried a real two-object protocol-workspace aggregate and
corresponding narrow metadata consolidation. It preserved storage, addresses,
all 17 exact functions and matched data, and reduced the main protocol from
972 to 959 instructions (target 951). However, its unit fuzzy regressed from
96.624664% to 96.49781%; wider grouping and a decoder-helper experiment also
failed the no-regression condition. All ATERM source and symbol metadata were
restored. Fresh report after restoration was identical to the accepted ESMisc
baseline, and the DOL hash passed. Detailed rejected source/metadata and
address evidence were kept privately for future work; none is in this commit.

View File

@@ -0,0 +1,102 @@
# AOSS initialization source reconstruction, 2026-10-02
Baseline 3d3448e3. Only src/scene/setting/AOSS.c changed; ATERM, AOSSLink,
headers, metadata, and linking remain untouched. Read AGENTS and the AOSS,
round-five/six/seven, and fz1 attempt records before starting.
## Retained source boundaries
1. Restore the repeated initial-address status check and its cleanup block.
In the target AOSS_Init_old object, the first address-setup error path ends
at 0x6EC, followed by a second check and cleanup at 0x6F0-0x730 before the
access-point allocation at 0x734. This check is redundant on the successful
edge, but the original retains the complete branch and cleanup. A short
source comment explains why it is not folded away in the reconstruction.
2. Give the send operation a local result separate from its socket descriptor.
The target keeps the socket snapshot through send setup, but consumes each
send return directly at the common result test. The previous source reused
one long-lived variable for both roles and copied both call results into a
saved register before testing them.
3. Restore two explicit zero/one/default timeout-error chains. Target error
dispatch tests state zero first, then one, rather than using the previous
switch's range dispatch.
4. Publish the next protocol state at the common reconnection join. The target
carries the returned state through reconnect processing, then assigns the
protocol-state local once. The old source assigned it before reconnect and
repeated the assignment afterward.
5. Traverse the three request records with one actual array index. Both the
six-byte address copy and the transaction-ID conversion use the same record.
The previous source maintained an independent byte offset as well as the
array index, producing a redundant second induction variable.
6. Restore retry and cleanup boundaries: one conditional-argument sleep call,
no unused pre-sleep delay assignment, consistent large-delay-first update,
and the target's nonnegative socket-cleanup test.
All changes are ordinary initialized C. No new qualifiers, helpers, assembly,
register declarations, data padding, or source/metadata pins were used.
## Measurements
| Cumulative source form | Init fuzzy | Instructions / 1584 |
| --- | ---: | ---: |
| Baseline | 93.78725% | 1575 |
| Timeout error chains | 94.41288% | 1571 |
| Also scoped send result | 94.454544% | 1569 |
| Also repeated address guard | 95.45013% | 1586 |
| Also receive-state join | 95.51326% | 1585 |
| Also request-record array traversal | 95.78409% | 1583 |
| Also retry/cleanup boundaries | 96.18624% | 1581 |
The instruction count need not monotonically approach the target: several
changes remove extra source instructions while the guard restores an omitted
block. Final Init remains nonexact. Unit fuzzy improves 96.777916% -> 97.71665%.
Exact functions remain 16/21, exact code 6436/16192, and data 3928/3928.
Every other AOSS function and every other unit's report remains unchanged.
Rejected experiments, all restored:
- Moving the receive-state join alone regressed the original baseline; it
improved the retained scope/guard reconstruction when retested there.
- Grouping timeout/receive/descriptors into one real polling context regressed
Init 95.51326 -> 95.29293. No stack-layout aggregate was retained.
- Deriving the current request record from an explicit byte cursor regressed
95.51326 -> 95.423615; the final ordinary array traversal improved it.
- Original extracted BSS symbols have global binding, but making the actual
CRC table global changed no instructions. Global packet-state/runtime
definitions changed no instructions and regressed data; all restored.
## Hello and remaining limits
AOSSSendHelloRequest stays at 92.190475%, 271/273 instructions. Its target
materializes separate runtime/CRC/key-state bases; the source hoists a shared
BSS base. The fresh audit found no omitted packet, CRC, key-schedule, or socket
operation. Prior loop/temporary/register permutations were not repeated.
Init still differs in default-option object boundaries, redundant target
link-result branches, polling scratch lifetimes/stack slots, and register and
instruction scheduling. The preexisting initialized result fallback remains:
no undefined read was introduced to imitate the target's uncertain early
register use. No full-function, unit, or project-completion claim is made.
## Verification
- Configured only 43U with ../toolchain/wibo-build/wibo
- WIBO_SJIS_MISSING_IMPORTS=1 ../.venv/bin/ninja all_source build/43U/report.json build/43U/ok
- Pool identical (one ordinary .data string); every allocated data section is
byte-identical to the fresh baseline and all five report 100%
- All 16 exact functions freshly verified with ctxdiff, zero differences
- Literal audit: 10 arguments across 16 exact functions; no skipped functions,
candidates, or errors
- Complete reports: only AOSS changes; its only improved function is Init;
no per-function, code, data, or cross-unit regression
- Focused native C harness passes 65536 retry spans, 20003 timeout-error states,
and 65536 three-record initializations with boundary canaries. These check
the rewritten local algorithms; they do not simulate network initialization
- Harness source/executable: /tmp/aoss-reconstruction-harness.c and the same
path without .c in the current executor
- git diff --check passes
- DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d
GATE: nonregression, exact-function preservation, complete data, pool, focused
native tests, full 43U build, and DOL checks pass. Frozen for independent parent
review; this is partial source reconstruction only.

View File

@@ -0,0 +1,23 @@
# iplSetting worker3 — Setting::draw (Oct 2 2026)
Worktree: `/workspace/worktrees/iplSetting-draw`
Branch: `agent/grok/decomp-worker-3/draw`
Unit: `src/scene/setting/iplSetting.cpp` `Setting::draw` only.
`scanAP` / `convertRevIP` source not touched. File stays `NonMatching` (not linked).
## Result
**632/632 byte-identical** to retail (`draw__Q33ipl5scene7SettingFv`, 2528 bytes, 0 diffs).
A HEAD compile of the same TU differs from this object only in `draw`. No sibling codegen change (`-ipa file`).
## Levers that closed it
1. `wideTopL` / `wideTopR` as separate locals (no CSE of the int-to-float). Gets `xoris r6,r6` and `fsubs f2`.
2. One `void* held` is the browser thread, then overwritten by the standard-buffer fetch, so browser and `standardBuffer` share r31.
3. Tex0 material pointer reused as the scroll `FrameController*` (`wideMaterial`), with `initFrame`/`restart` duplicated in each arm.
4. Field copy through `volatile GXRenderModeObj*` so loads and stores interleave on r4/r0.
5. Sample-pattern loop is direct `dst[1]=src[1]; dst[2]=src[2]` with `src` declared before `dst` is assigned (`u8* src; u8* dst = ...; src = ...`).
## Not linked
`configure.py` still has `Object(NonMatching, "scene/setting/iplSetting.cpp")`. DOL SHA1 is unchanged because this TU is not linked. Do not flip the object to Matching until `scanAP` / `convertRevIP` (and the rest of the TU) match.

View File

@@ -0,0 +1,75 @@
# iqdec_b65_frv32 / TMCJPEGDEC_decode_iquant (worker1)
Worktree: `/workspace/worktrees/iqdec-b65-worker1`
Branch: `agent/grok/decomp-worker-1/iqdec_b65`
## Scores
| State | Insns | Diffs | Notes |
|---|---|---|---|
| main baseline | 276/276 | **30** reg-only | entry/DC extract + AC coloring |
| this PR (sibling semantics) | 276/276 | **13** reg-only | structural 0 |
| target wall | 276/276 | 13 | AC huff/zztbl/zz permutation |
## Sibling semantics ported (from matching `decode_iquant_rc` C reference under `#else`)
- `u16*` fast indexing in `decodeLongHuffman` / `decodeACHuffman` (`entry = (u16*)(huff_tbl+9)`, `entry += 2`, `limit->bitLength = entry[0]`)
- comma-op `load_buff`: `if (load_ret = TMCJPEGDEC_load_buff(work), load_ret < 0)`
- early `s32* conv_row = (s32*)conv_row_ptr`
- `1UL << r/t`, `extra -= (tmp - 1)` paren form
- bitCount update before bitBuf read on DC/AC extract
These fixed the 17 non-AC diffs (30→13).
## Remaining wall (13 reg-only)
Permutation of 4 callee-saved across AC setup:
| Value | Ours | Target |
|---|---|---|
| `huff_tbl` (pACHuffTbl) | r29 | **r25** |
| `huff_sym` (pACHuffSym) | r30 | **r24** |
| `zztbl` | r24 | **r29** |
| `zz` | r25 | **r30** |
Cascaded: `tmp-1` in r7 vs r6; `zz<<2` index in r6 vs r7.
Insns 0–114 (through `ac_fast` load) are byte-identical. Divergence starts at AC huff loads (115–116).
## Coloring levers tried (≥12) — none beat 13
1. Separate AC-block `ac_huff_tbl`/`ac_huff_sym` → 32 (DC shifted)
2. DC-only block-local huff → 46 (prologue shifted)
3. Fully scoped DC/AC huff (no top-level) → 32
4. Early `zztbl` at function start → 138 (schedule)
5. `zztbl` before huff (before memset) → 32 (schedule)
6. Swap AC huff_tbl/huff_sym assign order → 13 (swapped wrong load order)
7. Swap DC huff assign order → build fail / unrestored
8. Decl reorder huff near zztbl → 17 (DC shifted)
9. `u8 zz` → 36
10. `u32 zz` → 13 (no change)
11. Move `zz = zztbl[idx]` after `load_buff` → 100
12. Eliminate `zz` temp (double `zztbl[idx]`) → 100
13. Huff before `ac_fast` → 14
14. Split `r` into `dc_r` + `r` → 13
15. Null-kill `huff_*=0` before AC reassign → 13
16. DC passes `work->pDCHuff*` directly → 30
17. Sibling decl order + `ac_vl`/`ac_sym` → 96
18. Scope DC HuffmanEntry temps → 33
19. Dummy pad locals → 13
20. Sibling `*(s32*)((u8*)block + zz*4)` store form → 13
21. `zztbl` first in decl list → 36
22. Coalesce huff_tbl via reassigning `dc_fast` → 36
23. `u32 idx` → 33
24. `s16 idx` → build fail
25. `unsigned long tmp` → 30
26. AC huff via `work->` at call only (no AC locals) → 120
27. Nested temp copies into huff_* → 32
28. `u8* zztbl` non-const → 13
29. **declsearch** 80 evals on decls 118–139 → best still (0, 13)
Root cause: `huff_sym`/`huff_tbl` keep DC-path preferred colors (r29/…) when reassigned for AC; target recycles freed `r24` (dc_predict) / `r25` (dc `r`) for AC huff and pushes `zztbl`/`zz` high. Any split of DC/AC names reshuffles the already-matching DC body.
## Recommendation
Need a shape that keeps DC 0–114 identical **and** births AC huff into r25/r24 (e.g. true live-range split / coalescing onto freed dc_predict/r without extra locals that raise pressure). Sibling `#else` C uses separate `ac_vl`/`ac_sym` and never shares DC huff locals — porting that cleanly without DC regen is the open problem.

View File

@@ -0,0 +1,26 @@
# odh `cdj_d_decompressLoop` (worker-2) 2026-10-02
Claim was only `cdj_d_decompressLoop`. colorConv, huffmanDecoder, and LineConv11 were not modified in the committed diff.
## Result
`cdj_d_decompressLoop` **899/899, 0 diffs, byte-identical** (3596 bytes) to retail. Was 43, then 7.
## What matched
- Inlined `(blockRowSize * 2)` and `((u32)blockWidth << 4)` (init `slwi r18` / `slwi r17`).
- `planeOffset += (u32)master->blocksWide << 6` coalesces the 1x2 update into `add r15, r15, r0`.
- `int nextBlockX = master->blockX + 1` with `(u16)` compare (same shape as compressLoop).
- Second 1x1 chroma sum written blockX term first.
- idct destinations that need plane-first `add` use `(u8*)((u32)planeOffset + (u32)master->workBuffer) + 8`.
- 2x2 tail stores the updated plane in `requiredBlockEnd` and the end pointer in `planeOffset`. That is what puts the plane in r15 and the end in r16 (`addi r15, r3, -8` / `add r16, r15, r18`). Assigning the plane back to `planeOffset` left those two callee-saves swapped (7 diffs). Splitting the `-8` let MWCC cancel it against the later `+8` and dropped to 897.
colorConv left at the 18 pairwise wall. Not in this diff.
## colorConv (2026-10-02)
`cdj_c_colorConv` **77/77, 0 diffs, byte-identical** (308 bytes). Was 18, then 13, then 8.
- Drop `paddedWidth`. The row loop adds `paddedDimensions[0]`, which hoists `lhz r24` and `lis r23` / `addi r10, r23, 0`.
- Pad loop: `u16 remainder = dimensions[i] & 7`, then `(dimensions[i] + 8) - remainder`. Width stays r8, the indexed load stays r7, the mask stays r9. Naming both a dimension and a remainder swaps width off r8.
- Declare `sourceStride` after `rowIndex` (cb/cr stay above it). That assigns stride r29 and `cbPlane` r22. Computing stride before the planes shortens the function to 76 and shifts the callee-saves. huffmanDecoder and LineConv11 were not edited. `cdj_d_decompressLoop` stays 899/899.

View File

@@ -0,0 +1,96 @@
# BS2 update-thread publication recovery, 2026-10-02
Baseline b26e248b. Source-only candidate in src/BS2/BS2Update.c.
The assignment's .cpp spelling was checked; this unit is C.
## Retained target-proven declarations
- EntriesCount: original UpdateThread object offsets 0xC2C/0xC30 store the
selected count then immediately reload it, with no intervening call or store.
The old source tests the still-live local count and omits that reload.
Definition-level volatile restores the published global read.
- State: target writes the failure state at 0x4F4 and 0xB4C before joining
selection completion. The zero-selection exit writes State=5 again at 0xC44.
The old source loses the first two store sequences because MWCC sees a later
overwrite without an intervening function call. Definition-level volatile
restores both observable failure-state publications. State is also exposed
through BS2UpdateState for polling by the boot state machine.
These are real existing state objects. No use-site qualifier casts, added
storage, fabricated barriers, assembly, metadata, or linking changes.
## Measurements
| Source form | UpdateThread fuzzy | Instructions |
| --- | ---: | ---: |
| Baseline | 93.59803% | 904/913 |
| EntriesCount publication reread | 93.90471% | 905/913 |
| Also preserve State publications | 94.5575% | 909/913 |
Unit fuzzy improves 94.23001% -> 95.094765%. Exact code remains 400/4052,
exact functions 9/10, data 10488/10488. This is partial source reconstruction,
not an exact function or linking candidate.
Rejected independent source-structure experiments, based on the count-reread
candidate: explicit selected-entry byte progression (93.73275%, 905/913),
seatholder byte progression (93.47755%, 905/913), and separate disc-base
expressions in error logging (93.56955%, 905/913). All were restored. The
remaining four missing target instructions are a repeated entry.type read and
three address-materialization differences. Register allocation and scheduling
also differ. The type declaration requires separate shared-header review.
## Fresh verification
- Configured only 43U with ../toolchain/wibo-build/wibo
- WIBO_SJIS_MISSING_IMPORTS=1 ../.venv/bin/ninja all_source build/43U/report.json build/43U/ok
- Pool: 55/55 identical
- Exact-name report and fresh ctxdiff preserve all nine exact functions
- Literal audit: 5 arguments across 9 exact functions, no skips/candidates/errors
- Every other unit's complete report unchanged; no per-function regression
- All four data sections still report 100%
- git diff --check passes
- DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d
GATE: source-only nonregression/build/pool/DOL checks pass. Awaiting independent
parent review; no complete decompilation, matching, or linking claim.
## Separate shared entry-type declaration
Parent authorized a separate experiment on the actual shared type declaration,
without a translation-unit-specific qualifier. Changed BS2UpdateEntry.type to
vu32 in include/BS2/BS2Update.h for every consumer.
Original UpdateThread offsets 0xCE8 and 0xD00 read the same entry.type field.
Between them are only the type-zero branch and its skipped increment/continue
path: the nonzero path has no call or write that could require a normal reload.
The shared declaration restores that second observable read. No new guard or
use-site qualifier cast was introduced.
- UpdateThread: 94.5575% -> 94.66265%, 909 -> 910/913 instructions
- Overall from initial baseline: 93.59803% -> 94.66265%, 904 -> 910/913
- Unit fuzzy: 94.23001% -> 95.18954%
- Exact functions remain 9/10 and code remains 400/4052
- Data remains 10488/10488, with every allocated non-text byte unchanged
All generated source objects were deleted and rebuilt with the configured 43U
all_source/report/ok targets. The prior cache had 1028 objects, including an
obsolete keyboard/tiManager.o absent from build.ninja, objdiff.json, and
configure.py. The current build graph cleanly rebuilt all 1027 configured
objects. Hash comparison of those objects against the source-only checkpoint
found only BS2Update.o changed. All 1026 other unit reports are identical.
This includes every shared-header consumer; none needed source adjustment.
Fresh final pool: 55/55 identical. Literal audit: 5 arguments across 9 exact
functions, no skips/candidates/errors. Fresh ctxdiff preserves all 9 exact
functions. DOL SHA1 remains 26116613f624061ba99c8d1a299aaa6efa85670d.
git diff --check passes.
The final three missing target instructions are address materializations:
seatholder table construction uses separate load/add in the target, and both
error-log calls materialize their own disc-table base. These are not omitted
source operations; register and scheduling differences remain as well. No
register sweep or artificial materialization was retained.
GATE: clean all-source build, cross-unit/object nonregression, complete data,
pool, exact-function preservation, and DOL checks pass. Leaf frozen for
independent parent review. Both commits are partial reconstruction gains.

View File

@@ -0,0 +1,77 @@
# Card icon and move/copy reconstruction
Base: `13881c99`; branch `agent/bittle/card-icon-reconstruction`.
Owned source: `src/scene/cardSequence/iplCardSequence.cpp` only.
No headers, linking configuration, assembly, forced registers, volatile casts,
undefined values, or dummy storage were introduced.
## Retained: reset the temporary name on every move rename attempt
The target's rename-collision loop returns to the filename clearing call before
formatting the next temporary name. The reconstruction returned directly to the
formatting call, clearing the filename only on the first attempt.
Moved the existing filename `memset` into the `do` loop. This changes exactly one
compiled branch instruction word; every other allocated byte in the object is
unchanged from the baseline. It restores the target's per-attempt reset boundary.
It is not a claim that ordinary fixed-width temporary names previously produced
incorrect filenames; the SDK status routine also normalizes trailing name bytes.
- `runCardMoveOrCopy`: 97.804276 -> 97.8125 fuzzy
- Instructions: 608/608; ctxdiff differences: 186 -> 185
- Unit fuzzy: 97.198944 -> 97.20097
- Exact functions remain 27/30; matched code remains 4168/9852 bytes
- All 30 function scores preserved or improved
- All 27 exact functions checked individually: objdiff 100, ctxdiff zero
- Data remains 1496/1496 bytes exact
## Validation
- Full 43U build: PASS
- Pool before and after: identical, 43 strings
- Literal-reference advisory: 45 arguments in 29 functions; no candidates or
errors. The unequal-sized icon loader was skipped; it was not changed
- DOL SHA1: `26116613f624061ba99c8d1a299aaa6efa85670d`
- Base-relative `git diff --check 13881c99`: PASS
A focused compiled-PPC loop audit passed 192 cases covering both slots, file
numbers 0/63/126, collision counts 0/1/2/7/63/126/127/128, and final results
0/-3/-7/-10. Candidate instruction execution produced the target's memory state
and call trace in every case. The baseline omitted the repeated clear in 174
cases. `memset`, `sprintf`, and status results were modeled, so this is bounded
loop evidence, not execution of the complete copy/move operation or Wii runtime.
## Icon-loader audit and deferred boundary
The loader was inspected against the target and tested with a bounded integer
PPC interpreter using modeled CARD, memory-copy and cache-store calls.
- 841 valid-format, bounds and error cases agreed on return values, modeled
call traces and non-stack memory, including guard regions
- Both slots and file-table endpoints, banner modes, icon formats 0/1/2,
animation speeds, sector errors, image/comment read failures, close failures,
and offset boundaries were exercised
- Valid-case instruction coverage was 506/508 source and 511/512 target; this is
instruction-address coverage, not exhaustive inputs or paths
- All interpreted calls checked SP, LR and nonvolatile GPR restoration
Six reserved-format examples exposed a separate difference: after a preceding
valid icon, format 3 retains the preceding icon's byte size in the target, while
the current source resets it to zero. This affects later offsets and modeled
image-read lengths. Format 3 is not among the SDK's supported icon formats.
When the first icon has format 3, the target has no uniquely established initial
size; that unspecified boundary must not be reconstructed with an invented
initial value or an uninitialized C local.
An explicitly initialized carry trial agreed with the six later-format-3 cases
and all 841 earlier cases, but reduced loader fuzzy from 90.34375 to 90.14844.
It was restored. Its patch and bounded evidence are preserved privately for
possible later review. The retained source does not claim to correct this
reserved-input boundary or to establish general runtime correctness.
## Existing external branch
Read-only inspection of the already fetched `origin/agent/w1008/card2` at
`14b921b3` found a restructuring of the image-read success/error join. It has the
same effective error propagation as the current source. It was not copied,
merged, or used as a replacement implementation; no remote action was taken.

View File

@@ -0,0 +1,67 @@
# Data d16 attempts
HEAD and fetched origin/main are 6f49df32. Both owned units are unchanged on origin/main. Scope is data symbols only inside the two assigned split ranges; no source/code/configure/split changes.
Baseline: MyTiManager instruction-exact 91/91, code 20196/20196, data 148/1132; fa/pf_path instruction-exact 27/27, code 11872/11872, data 8/56. Pools identical, 7 and 0 strings. Initial pool commands with unit paths failed because this version of pool_diff accepts object paths; corrected commands passed before any mutation.
Fresh ELF audit: MyTiManager source .data now contains a genuine 36-byte weak Animation vtable at +0x3b0. Target +0x3b0..0x3d8 remains zero without outgoing relocations. Canonical retained Animation vtable is 0x8165D258, with seven real virtual slots. This improves the earlier evidence in data-d4, whose source ended at +0x3b0. The current source ends at +0x3d4; the last four target bytes are zero section alignment. Tail ownership will be tested only with this type/relocation evidence.
fa/pf_path: both .sdata byte arrays are identical for all 48 bytes. The target null literal at +4 is recorded as four bytes, compiler char[2] is two bytes. The target initializer at +40 is split into two single bytes, compiler emits one two-byte const array, used by lbz with addends 0 and 1. The final target space literal is recorded as two bytes, compiler emits a four-byte narrow char string with explicit trailing zero bytes. .sdata2 has two identical two-byte arrays similarly split into individual byte symbols; trailing two bytes are zero alignment. No initializer difference or non-exact function exists.
## pf_path literal extent proof
lbl_81698394 at unchanged .sdata:0x81698394 is char[4] literal `"\x20\0\0"`, not char[2]: PFPATH_CheckExtShortName loads it at .text+0x2b78 and +0x2bcc and passes it to PFSTR_StrNCmp; the compiled @2271 has size 4 and bytes 20000000 at the identical +0x2c offset. Extent 2 -> 4 recovers the complete real string including its explicit two zeros and implicit terminator. No address, section size, source object or total_data changes.
Minimal correction selected: other pf_path aliases and initializer sublabels already compare correctly through exact section bytes. Leave all names and other extents alone.
## MyTiManager tail extent proof
lbl_816681E8 at unchanged .data:0x816681E8 covers the discarded weak Animation vtable footprint, size 0x24 rather than 0x28: the compiler emits __vt__Q39textinput4util9Animation at identical .data+0x3b0 with two ABI header words and seven virtual slots, ending +0x3d4; include/keyboard/tiUtil.h declares exactly those seven methods, and the retained retail Animation vtable at 0x8165D258 also has size 0x24 and precisely the same seven relocation targets. Target createMemoInputForm .text+0x9de/+0x9fe and createLetterInputForm +0xb06/+0xb26 refer to the retained canonical table, while source equivalents refer to this weak copy; this demonstrates linker deduplication. The four unrelocated zero bytes at 0x8166820c..0x81668210 align the next unit to eight bytes and are not an eighth virtual method. Correct only the extent, keep the existing label, all addresses, all 984 section bytes and total_data 1132. No source vtable suppressed and no weak-pointer bytes fabricated.
The old log could not infer the tail when its source emitted no Animation table. The current source now supplies independent table-layout evidence. Every source tail relocation is an extra linker-discarded weak entry; no target relocation is removed or altered. The goal depends on correcting true object versus section-alignment ownership, not inventing a name for zero bytes.
## Iteration measurements
After pf_path extent correction, fresh objdiff report: matched_data 8 -> 56/56, .sdata and .sdata2 both 100%, code 11872/11872, functions 27/27. After MyTiManager correction, fresh objdiff report: matched_data 148 -> 1132/1132, all six non-text sections 100%, code 20196/20196, functions 91/91. Correct source-only Ninja targets subsequently report no work to do. Extracted object paths are outputs of SPLIT, not explicit Ninja targets; the two commands naming them reported unknown targets after the required split succeeded, and were corrected to source-only targets before final verification.
Objdiff v3.4.5 source inspection confirms diff_data_section uses the greatest owned-symbol endpoint, excluding physical section-end alignment, and accepts exact raw section bytes when every target relocation matches; extra source weak relocations do not veto this route. Both corrections describe actual object extents and preserve every physical section byte. Names need no correction for these units.
No open function exists in either unit: all 118 functions were exact before this data task. No compiler experiments, code changes, dummy objects, fake virtual slots, forced placement, symbol renames, configure changes, split changes, or remote mutations. The earlier broad requirement for new exact functions does not apply to these explicitly assigned already-code-100% units; preserve exact counts instead.
## Final clean gate and audit
Full non-quick two-unit gate rebuilt 43U from scratch and passed. Fresh post-build pool comparisons remain identical. All 91 MyTiManager and 27 pf_path functions were checked individually with ctxdiff.py: every one reports diffs 0 and identical instruction counts. Output is /tmp/data-d16.ctxdiff-all.txt.
Live progress and build/43U/report.json regenerated after the gate. Both units matched_data == unchanged total_data, code == unchanged total_code, and every section reports 100%. Source bodies and every symbol name/address/section are unchanged; an automated line-by-line config audit confirms exactly the two extent corrections proved above. No remaining non-exact functions or unresolved non-text sections.
```text
full build: ok
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
[src/keyboard/MyTiManager] pool: IDENTICAL
[src/keyboard/MyTiManager] objdiff: code 20196/20196 data 1132/1132 functions 91/91 fuzzy 100.0000 linked code 20196
[src/keyboard/MyTiManager] instruction-exact functions: 91/91
[src/keyboard/MyTiManager] section .bss size 72 match 100.0
[src/keyboard/MyTiManager] section .ctors size 4 match 100.0
[src/keyboard/MyTiManager] section .data size 984 match 100.0
[src/keyboard/MyTiManager] section .sbss size 16 match 100.0
[src/keyboard/MyTiManager] section .sdata size 24 match 100.0
[src/keyboard/MyTiManager] section .sdata2 size 32 match 100.0
[src/keyboard/MyTiManager] section .text size 20196 match 100.0
[src/keyboard/MyTiManager] baseline: code 20196/20196 data 148 functions 91 fuzzy 100.0000
[libs/RVL_SDK/src/fa/pf_path] pool: IDENTICAL
[libs/RVL_SDK/src/fa/pf_path] objdiff: code 11872/11872 data 56/56 functions 27/27 fuzzy 100.0000 linked code 11872
[libs/RVL_SDK/src/fa/pf_path] instruction-exact functions: 27/27
[libs/RVL_SDK/src/fa/pf_path] section .sdata size 48 match 100.0
[libs/RVL_SDK/src/fa/pf_path] section .sdata2 size 8 match 100.0
[libs/RVL_SDK/src/fa/pf_path] section .text size 11872 match 100.0
[libs/RVL_SDK/src/fa/pf_path] baseline: code 11872/11872 data 8 functions 27 fuzzy 100.0000
regressions vs baseline: 0
global matched_code_percent: 90.94304 -> 90.94304
global fuzzy_match_percent: 99.58742 -> 99.58742
global complete_code_percent: 73.73083 -> 73.73083
global matched_data_percent: 99.36639 -> 99.42271
forbidden patterns added (net, per file): 0
readability warnings (net, per file; must be 0 in the final result): 0
note: config touched: config/43U/symbols.txt (orchestrator reviews every config/symbols change)
GATE PASS
```

View File

@@ -1746,3 +1746,557 @@ Final authority lines:
[libs/RVL_SDK/src/kpad/KPAD] instruction-exact functions: 21/29
GATE PASS
```
# Round 9: MAX fresh branchf7b1b9b0
Initial owned objects rebuilt and fresh objdiff baseline generated directly; pools identical101/57/0. Fresh counts SD122/129,Address90/94,KPAD21/29, data100% in all3. New near-miss hypotheses use accessor references to stored pointer cells and postincrement-return inline boundaries; prior rounds did not change the original objects.
## src/scene/sdChannelSelect/iplSDChannelSelect flushSaveDataAndMountSD__Q33ipl5scene15SDChannelSelectFv
Fetch origin/main 6cb5ac9dedfbf99dc591e2cabc9d62d2c849a69d. Initial assembly diagnosis: (2, 2) structural/positional differences; instructions 35/35
Remote source equals freshly built baseline; still open 99.65714%. Structural diagnosis: 35/35,frame0x10; only heap/manager load order reversed. Target loads heap after flag store, then reloads manager. New accessor reference-return types describe read-only views of stored pointer cells; actual calls/field layout remain identical. Prior trials bound pointer values after loading them.
- save-manager getter returns a const reference to the stored pointer: (2, 2) structural/positional; instructions 35/35; restored.
- heap getter returns a const reference to the stored pointer: (2, 2) structural/positional; instructions 35/35; restored.
- both argument getters return read-only references to their pointer cells: (2, 2) structural/positional; instructions 35/35; restored.
## src/scene/sdChannelSelect/iplSDChannelSelect collectTitlesByUsage__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl
Fetch origin/main c7ceb3efe077dca7dd49508cf4e2bd1faab56b54. Initial assembly diagnosis: (2, 4) structural/positional differences; instructions 101/101
Remote source equals freshly built baseline; still open 97.81188%. Structural diagnosis: 101/101 or102/102,frame0x40; target preserves old count inr3 and computes increment inr0, blocking early threshold loading. New inline postincrement-return boundary and copy-plus-increment helper test this real result lifetime; no artificial uses or dummy objects.
- pointer postincrement-result inline boundary after collecting a title: (2, 4) structural/positional; instructions 101/101; restored.
- reference postincrement-result inline boundary after collecting a title: (2, 4) structural/positional; instructions 101/101; restored.
- append postincrement-result inline boundary after collecting a title: (2, 4) structural/positional; instructions 101/101; restored.
## src/scene/sdChannelSelect/iplSDChannelSelect collectTitlesFromNandUsage__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl
Fetch origin/main c7ceb3efe077dca7dd49508cf4e2bd1faab56b54. Initial assembly diagnosis: (2, 4) structural/positional differences; instructions 102/102
Remote source equals freshly built baseline; still open 97.833336%. Structural diagnosis: 101/101 or102/102,frame0x40; target preserves old count inr3 and computes increment inr0, blocking early threshold loading. New inline postincrement-return boundary and copy-plus-increment helper test this real result lifetime; no artificial uses or dummy objects.
- pointer postincrement-result inline boundary after collecting a title: (2, 4) structural/positional; instructions 102/102; restored.
- reference postincrement-result inline boundary after collecting a title: (2, 4) structural/positional; instructions 102/102; restored.
- append postincrement-result inline boundary after collecting a title: (2, 4) structural/positional; instructions 102/102; restored.
## src/scene/sdChannelSelect/iplSDChannelSelect flushSaveDataAndMountSD__Q33ipl5scene15SDChannelSelectFv
Fetch origin/main 7216fd527fee4db057af192c416f9d2fbe0e547a. Initial assembly diagnosis: (2, 2) structural/positional differences; instructions 35/35
Remote source equals freshly built baseline; still open 99.65714%. Structural diagnosis: Further structural lever: scalarized aggregate of the real heap/manager arguments, with read-only request/helper boundaries; target frame0x10 and35 instructions, only two argument loads inverted.
- read-only real flush argument aggregate: (2, 2) structural/positional; instructions 35/35; restored.
- mutable request fields assigned heap then manager: (2, 2) structural/positional; instructions 35/35; restored.
- mutable request with manager initialized last via constructor: (2, 2) structural/positional; instructions 35/35; restored.
## src/scene/address/iplAddressEdit update_friendinfo__Q33ipl5scene11AddressEditFv
Fetch origin/main 7216fd527fee4db057af192c416f9d2fbe0e547a. Initial assembly diagnosis: (2, 2) structural/positional differences; instructions 38/38
Remote source equals freshly built baseline; still open 99.42105%. Structural diagnosis: Structural diagnosis:38 instructions/frame0x10 equal; resolved wcsncpy source and destination LEAs inverted. No immediate store/reload pair or extent overlap; test scalarized copy request with source-first real fields before register-only work.
- read-only name-copy argument aggregate: (11, 32) structural/positional; instructions 40/38; restored.
- mutable name-copy source and destination field assignments: (2, 2) structural/positional; instructions 38/38; restored.
- read-only name-copy request constructor: (2, 2) structural/positional; instructions 38/38; restored.
## src/scene/sdChannelSelect/iplSDChannelSelect create__Q33ipl5scene15SDChannelSelectFv
Fetch origin/main 2da1c58f2c1b14de0754929ddbc23394a011d7a5. Initial assembly diagnosis: (4, 39) structural/positional differences; instructions 145/146
Remote source equals freshly built baseline; still open 97.73972%. Structural diagnosis: 145/146 frame0x20; missing BS2-manager body reload, global/string base colors reversed. New lexical scopes for manager acquisition and an actual abort-state for-loop; no added data or volatile without proof.
- poll using a switch and separate completed-state exit label: build failed i-ipl-workers\data- # d5\include\scene\iplSceneManager.h:14 # Z:\mnt\drive2\projects\wii-ipl-workers\data-d5\include\iplSceneUI.h:11 # Z:\mnt\drive2\projects\wii-ipl-workers\data- # d5\src\scene\sdChannelSelect\iplSDChannelSelect.cpp:6) ### mwcceppc.exe Compiler: # File: src\scene\sdChannelSelect\iplSDChannelSelect.cpp # --------------------------------------------------------- # 258: } # Error: ^ # (10159) undefined label 'abortFinished' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed. ; restored.
- bind the update receiver as a read-only reference in the loop body: (4, 39) structural/positional; instructions 145/146; restored.
- hold the observed abort state as a leading initialized for-loop variable: (7, 42) structural/positional; instructions 149/146; restored.
## src/scene/sdChannelSelect/iplSDChannelSelect collectTitlesByChannelOrder__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl
Fetch origin/main 02dbcc53bdf195d3b2aa22f56460ad2c2f913dd2. Initial assembly diagnosis: (2, 22) structural/positional differences; instructions 126/126
Remote source equals freshly built baseline; still open 97.29365%. Structural diagnosis: 126/126 frame0x60; title-ID inner scope changes index/add operand allocation; new pointer-to-row and explicit signed page offset views after hoisting the real ID, retaining safe typed entry access.
- hoist the title and index through a pointer to the selected channel page: (2, 7) structural/positional; instructions 126/126; restored.
- hoist the title and apply the row index before dereferencing its array: (2, 7) structural/positional; instructions 126/126; restored.
- hoist the title and use an explicitly unsigned native channel index: (2, 7) structural/positional; instructions 126/126; restored.
## src/scene/sdChannelSelect/iplSDChannelSelect collectTitlesBySpecialChannels__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl
Fetch origin/main ed2d5b30b46940f63b16670dd1f7b44b2ac06984. Initial assembly diagnosis: (8, 16) structural/positional differences; instructions 361/361
Remote source equals freshly built baseline; still open 97.55125%. Structural diagnosis: 361/361 frame0x80; four repeated counter/threshold schedules differ16. New count read-modify-write expression semantics and inline returning the original count; source paths and threshold signedness preserved.
- use a named previous count in each completed title increment: (8, 16) structural/positional; instructions 361/361; restored.
- sequence the postincrement result as a discarded comma-expression: (8, 16) structural/positional; instructions 361/361; restored.
- put postincrement behind a helper returning the original count: (8, 16) structural/positional; instructions 361/361; restored.
## src/scene/sdChannelSelect/iplSDChannelSelect setChannelScissor__Q33ipl5scene15SDChannelSelectCFPCQ33ipl5scene12SDChannelObj
Fetch origin/main 5a332eceba97b348917577a016edf49c8b2bd519. Initial assembly diagnosis: (23, 68) structural/positional differences; instructions 233/233
Remote source equals freshly built baseline; still open 93.4721%. Structural diagnosis: 233/233 frame0xe0; framebuffer-width/height conversions and projection/scissor lifetimes dominate68 differences; new real framebuffer-dimension and scissor-rectangle aggregate views before register-only tuning.
- declare framebuffer width before height then initialize both from named dimension references: (23, 68) structural/positional; instructions 233/233; restored.
- retain one named projection-width local shared by both scissor branches: (51, 195) structural/positional; instructions 230/233; restored.
- represent the four actual computed scissor bounds as fields of a local rectangle: (192, 247) structural/positional; instructions 251/233; restored.
## src/scene/sdChannelSelect/iplSDChannelSelect create__Q33ipl5scene15SDChannelSelectFv
Fetch origin/main a8ab2099cdf66a22205c6faec73834eb7f771168. Initial assembly diagnosis: (4, 39) structural/positional differences; instructions 145/146
Remote source equals freshly built baseline; still open 97.73972%. Structural diagnosis: Correct failed exit-label trial; elapsedTicks is the real statement after the poll. Failed compiler trial did not count toward the three successful variants.
- switch-based poll with a defined abort-finished label before the elapsed tick computation: (9, 40) structural/positional; instructions 145/146; restored.
## src/scene/address/iplAddressEdit get_friendinfo__Q33ipl5scene11AddressEditFv
Fetch origin/main a8ab2099cdf66a22205c6faec73834eb7f771168. Initial assembly diagnosis: (10, 68) structural/positional differences; instructions 82/84
Remote source equals freshly built baseline; still open 88.03571%. Structural diagnosis: 82/84 frame0x420; target keeps name/display addresses in one saved register across virtual pane lookups. New mutable input pointer/array/String views test MWCC rematerialization and alias assumptions without changing shared signatures.
- keep both text inputs in mutable character pointers before the virtual lookups: (10, 68) structural/positional; instructions 82/84; restored.
- bind actual mutable name and display arrays by their real extents: (10, 68) structural/positional; instructions 82/84; restored.
- read both text arrays through a mutable String reference shared across pane calls: (10, 68) structural/positional; instructions 82/84; restored.
## src/scene/address/iplAddressEdit create__Q33ipl5scene11AddressEditFv
Fetch origin/main a8ab2099cdf66a22205c6faec73834eb7f771168. Initial assembly diagnosis: (19, 323) structural/positional differences; instructions 820/820
Remote source equals freshly built baseline; still open 97.44634%. Structural diagnosis: 820/820 frame0x60; ordinary construction removes the doubled allocation guard but leaves two missing name/display LEAs. New mutable text input views paired with ordinary allocation preserve literal source order and avoid manual constructor calls.
- ordinary balloon allocation with a mutable name pointer before animator restart: (23, 331) structural/positional; instructions 818/820; restored.
- ordinary balloon allocation with mutable real name/display array references: (23, 331) structural/positional; instructions 818/820; restored.
- ordinary balloon allocation and a mutable String receiver for both mode-zero text inputs: (23, 331) structural/positional; instructions 818/820; restored.
## src/scene/address/iplAddressEdit set_err_msg__Q33ipl5scene11AddressEditFPwUl8NWC24Err
Fetch origin/main a8ab2099cdf66a22205c6faec73834eb7f771168. Initial assembly diagnosis: (1, 30) structural/positional differences; instructions 76/75
Remote source equals freshly built baseline; still open 98.666664%. Structural diagnosis: 76/75 frame0x60; target has undefined message ID for other errors, safe default cannot be removed. Try safe grouped valid errors with an explicit default and a truly initialized index object; unsupported input behavior remains defined.
- assign the safe fallback explicitly inside every switch case including default: (6, 28) structural/positional; instructions 73/75; restored.
- use an initialized message-selection aggregate holding the actual index: (1, 30) structural/positional; instructions 76/75; restored.
- use a safe if/else selection testing the original supported error groups: (18, 47) structural/positional; instructions 65/75; restored.
## libs/RVL_SDK/src/kpad/KPAD KPADGetProjectionPos
Fetch origin/main fd775c34dcac2c7110d7729ebd0bd6e3ee7bba62. Initial assembly diagnosis: (0, 9) structural/positional differences; instructions 19/19
Remote source equals freshly built baseline; still open 96.57895%. Structural diagnosis: Decoded19/19 leaf structure exact; target double scale usesf0 and half/aspectf4/f3. New actual scalar helper boundaries for correction, half-height, and complete coordinate projection; registers last.
- put the double calibration product behind a scalar-return inline helper: (0, 10) structural/positional; instructions 19/19; restored.
- put the half-height product behind a scalar-return inline helper: (0, 10) structural/positional; instructions 19/19; restored.
- use a complete projection helper with a const coordinate input and precomputed height: (0, 10) structural/positional; instructions 19/19; restored.
## libs/RVL_SDK/src/kpad/KPAD KPADSetSensorHeight
Fetch origin/main fd775c34dcac2c7110d7729ebd0bd6e3ee7bba62. Initial assembly diagnosis: (0, 7) structural/positional differences; instructions 52/52
Remote source equals freshly built baseline; still open 99.23077%. Structural diagnosis: Decoded52/52 frame0x30,7 colors; named-zero and squared-height order yield3 base-register colors. New sensor-center subobject view and channel-base lifetime forms keep actual indexed controller fields, without volatile or dummy state.
- name the actual sensor-center subobject pointer after controller indexing: (0, 3) structural/positional; instructions 52/52; restored.
- form the indexed controller pointer only after computing both real squared dimensions: (0, 3) structural/positional; instructions 52/52; restored.
- assign the squared-height contribution into the diagonal temporary before adding width: (0, 8) structural/positional; instructions 52/52; restored.
## libs/RVL_SDK/src/kpad/KPAD calc_acc_horizon
Fetch origin/main fd775c34dcac2c7110d7729ebd0bd6e3ee7bba62. Initial assembly diagnosis: (2, 35) structural/positional differences; instructions 101/101
Remote source equals freshly built baseline; still open 97.27723%. Structural diagnosis: Decoded101/101 frame0x30,35 pure floating-register colors. New in-place magnitude/normalization lifetimes and product subscopes before using declsearch on any surviving register-only candidate.
- reuse magnitude as the blend weight instead of retaining a second smoothing scalar: (2, 35) structural/positional; instructions 101/101; restored.
- normalize the interpolated horizon coordinates in place before updating the circle: (2, 37) structural/positional; instructions 101/101; restored.
- scope the smoothing weight inside its actual interpolation block: (2, 35) structural/positional; instructions 101/101; restored.
## libs/RVL_SDK/src/kpad/KPAD read_kpad_acc
Fetch origin/main fd775c34dcac2c7110d7729ebd0bd6e3ee7bba62. Initial assembly diagnosis: (16, 66) structural/positional differences; instructions 400/400
Remote source equals freshly built baseline; still open 98.15%. Structural diagnosis: Decoded400/400 frame0x50,5 CFG differences; real smoothing/guard reconstruction narrows to cmpwi5 instead ofcmplwi5. New boolean switch and nested primary/fallback switch boundaries preserve the complete unsupported-format path.
- switch on the unsigned equality predicate of the valid fallback format: (12, 197) structural/positional; instructions 403/400; restored.
- nest the fallback single-case switch inside the primary format switch default: (2, 2) structural/positional; instructions 400/400; restored.
- subtract the real fallback format before testing the zero switch case: (1, 1) structural/positional; instructions 400/400; restored.
## libs/RVL_SDK/src/kpad/KPAD select_1obj_first
Fetch origin/main 842c850c10099d9937f1e02f8625a2f0a985abf9. Initial assembly diagnosis: (2, 26) structural/positional differences; instructions 109/109
Remote source equals freshly built baseline; still open 98.348625%. Structural diagnosis: Decoded109/109 frame0x20; 26 float/base colors, direct candidate-end comparison reaches22. New real geometry operand/lifetime forms and shared output-candidate pointer before declaration search.
- use scale-first products for the two actual horizon offsets after direct-end comparison: (2, 22) structural/positional; instructions 109/109; restored.
- evaluate horizon dot-product axis operands first with direct candidate-end comparison: (4, 22) structural/positional; instructions 109/109; restored.
- bind the two actual output candidate records through one local pointer: (2, 22) structural/positional; instructions 109/109; restored.
## libs/RVL_SDK/src/kpad/KPAD calc_dpd_variable
Fetch origin/main 842c850c10099d9937f1e02f8625a2f0a985abf9. Initial assembly diagnosis: (14, 45) structural/positional differences; instructions 250/250
Remote source equals freshly built baseline; still open 94.82%. Structural diagnosis: Decoded250/250 frame0x20; filter magnitude register reuse and late geometry schedules differ. New explicit absolute-value branch, direction scalar components, and in-place distance filter weight; preserve FP precision and all writes.
- assign filter magnitude using explicit sign branches rather than a conditional expression: (14, 45) structural/positional; instructions 250/250; restored.
- reuse the filtered distance magnitude through its gain multiplication: (14, 43) structural/positional; instructions 250/250; restored.
- name both actual direction components within the final geometric projection scope: (12, 40) structural/positional; instructions 250/250; restored.
## libs/RVL_SDK/src/kpad/KPAD KPADRead
Fetch origin/main 842c850c10099d9937f1e02f8625a2f0a985abf9. Initial assembly diagnosis: (11, 89) structural/positional differences; instructions 459/459
Remote source equals freshly built baseline; still open 97.52723%. Structural diagnosis: Decoded459/459 frame0xc0; raw-copy endpoint grouping and gravity x/y signed halfword loads differ. New complete raw-copy inline boundary, typed three-factor gravity locals, and decrement loop form; no field type/width changes.
- move the complete raw-ring copy into an inline operation returning its final sample index: (46, 250) structural/positional; instructions 459/459; restored.
- use signed-int product temporaries for both complete gravity validation products: (7, 83) structural/positional; instructions 459/459; restored.
- express the raw-ring copy as a for-loop with the decrement in its update clause: (19, 377) structural/positional; instructions 458/459; restored.
## libs/RVL_SDK/src/kpad/KPAD KPADInit
Fetch origin/main 842c850c10099d9937f1e02f8625a2f0a985abf9. Initial assembly diagnosis: (9, 81) structural/positional differences; instructions 185/185
Remote source equals freshly built baseline; still open 96.51351%. Structural diagnosis: Decoded185/185 frame0x90; repeat-delay constant and saved float/matrix colors. New repeat initializer inline boundary, zero/one calibration scope, and real matrix reference pointer scope; arrays/stores unchanged.
- initialize all six real repeat state fields through a complete inline operation: (9, 81) structural/positional; instructions 185/185; restored.
- initialize zero before one while retaining the actual saved scalar locals: (9, 81) structural/positional; instructions 185/185; restored.
- bind the initialized rotation matrix pointer inside the controller loop instead of retaining it outside: (9, 65) structural/positional; instructions 185/185; restored.
## libs/RVL_SDK/src/kpad/KPAD calc_acc_horizon
Fetch origin/main 6f6f63cb81bdb8298e0270364f6b94dae2b36a6c. Initial assembly diagnosis: (2, 35) structural/positional differences; instructions 101/101
Remote source equals freshly built baseline; still open 97.27723%. Structural diagnosis: Register-only final search after this round three distinct successfully built lifetime/scope attempts. Reconstruct the best19-color seed from previous complete assignment order, then search the remaining swaps/moves with a substantially larger budget; decode paired loads and FP compares.
- Reproduced best declaration seed, decoded (0, 19); every assignment and computation order unchanged.
- Extended declsearch: declaration block: | f32 targetY; | f32 circleY; | f32 deltaX; | f32 oldX; | f32 projectedX; | f32 productX; | f32 targetX; | f32 oldY; | f32 smoothing; | f32 magnitude; | f32 normalizedX; | f32 normalizedY; | f32 nextX; | f32 nextY; | f32 normalized; | f32 circleX; | f32 deltaCircleX; | f32 deltaCircleY; | f32 oldCircleY; | f32 oldCircleX; | f32 unitY; | f32 unitX; | f32 blend; | start (0, 19) | improved (0, 17) | best (0, 17) after 852 builds; kept in source: | f32 targetY; | f32 circleY; | f32 deltaX; | f32 oldX; | f32 projectedX; | f32 productX; | f32 targetX; | f32 normalizedY; | f32 smoothing; | f32 magnitude; | f32 normalizedX; | f32 oldY; | f32 nextX; | f32 nextY; | f32 normalized; | f32 circleX; | f32 deltaCircleX; | f32 deltaCircleY; | f32 oldCircleY; | f32 oldCircleX; | f32 unitY; | f32 unitX; | f32 blend; |
Nonexact extended-search candidate restored; raw authority (0, 17).
## libs/RVL_SDK/src/kpad/KPAD KPADGetProjectionPos
Fetch origin/main a9a3f36cf03be45e012ddbb0b86cc689755c89c0. Initial assembly diagnosis: (0, 9) structural/positional differences; instructions 19/19
Remote source equals freshly built baseline; still open 96.57895%. Structural diagnosis: Register-only last after three new scalar/full projection helper attempts; no frame/CFG differences. Remove the independent named double result so its anonymous calibration temporary can coalesce, while naming only actual half/aspect factors. Search six real local declarations, preserving every assignment.
- Anonymous double-calibration seed: decoded (0, 9).
- Anonymous-calibration declsearch: declaration block: | f32 halfHeight; | f32 aspect; | f32 half; | f32 x; | f32 y; | f32 height; | start (0, 9) | improved (0, 5) | best (0, 5) after 36 builds; kept in source: | f32 aspect; | f32 halfHeight; | f32 half; | f32 x; | f32 y; | f32 height; |
Nonexact projection search candidate restored; raw authority (0, 5).
## libs/RVL_SDK/src/kpad/KPAD calc_dpd_variable
Fetch origin/main a9a3f36cf03be45e012ddbb0b86cc689755c89c0. Initial assembly diagnosis: (14, 45) structural/positional differences; instructions 250/250
Remote source equals freshly built baseline; still open 94.82%. Structural diagnosis: Further structural reconstruction of late geometry: target loads directionY/tangentY, negates directionY, then loads directionX/tangentX and multiplies in that order. Earlier direct const/scalar views retained12 differences; name the real dot/cross terms and test declaration/expression order.
- declare the cross-product rotation before the dot-product rotation: (22, 47) structural/positional; instructions 250/250; restored.
- name all four geometric input components in target operand-load order: (12, 41) structural/positional; instructions 250/250; restored.
- name the real dot/cross product component values in target multiplication order: (14, 41) structural/positional; instructions 250/250; restored.
## libs/RVL_SDK/src/kpad/KPAD KPADSetSensorHeight
Fetch origin/main a9a3f36cf03be45e012ddbb0b86cc689755c89c0. Initial assembly diagnosis: (0, 7) structural/positional differences; instructions 52/52
Remote source equals freshly built baseline; still open 99.23077%. Structural diagnosis: Remaining3 base-register colors after named-zero geometry reconstruction. New actual scalar-return scale helper takes only a read-only sensor-center input instead of the prior entire controller/height helper; this exposes a real inline/alias boundary.
- scalar sensor-scale helper with const center input: (1, 13) structural/positional; instructions 52/52; restored.
- scalar sensor-scale helper with mutable center input: (1, 13) structural/positional; instructions 52/52; restored.
- scalar sensor-scale helper with separated offset inputs: (32, 58) structural/positional; instructions 59/52; restored.
## src/scene/sdChannelSelect/iplSDChannelSelect collectTitlesByUsage__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl
Fetch origin/main a9a3f36cf03be45e012ddbb0b86cc689755c89c0. Initial assembly diagnosis: (2, 4) structural/positional differences; instructions 101/101
Remote source equals freshly built baseline; still open 97.81188%. Structural diagnosis: Four schedule-only differences remain after the new old-count helper attempts. Test immutable formal pointer variables without altering pointee types or mangled public signature, then copy the real incremented count through memcpy as a memory-write boundary.
- const only the count pointer formal: (2, 4) structural/positional; instructions 101/101; restored.
- const every real pointer formal: (2, 4) structural/positional; instructions 101/101; restored.
- write the actual incremented output count through the ordinary memory-copy primitive: (29, 53) structural/positional; instructions 105/101; restored.
## src/scene/sdChannelSelect/iplSDChannelSelect collectTitlesFromNandUsage__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl
Fetch origin/main a9a3f36cf03be45e012ddbb0b86cc689755c89c0. Initial assembly diagnosis: (2, 4) structural/positional differences; instructions 102/102
Remote source equals freshly built baseline; still open 97.833336%. Structural diagnosis: Four schedule-only differences remain after the new old-count helper attempts. Test immutable formal pointer variables without altering pointee types or mangled public signature, then copy the real incremented count through memcpy as a memory-write boundary.
- const only the count pointer formal: (2, 4) structural/positional; instructions 102/102; restored.
- const every real pointer formal: (2, 4) structural/positional; instructions 102/102; restored.
- write the actual incremented output count through the ordinary memory-copy primitive: (29, 52) structural/positional; instructions 106/102; restored.
## src/scene/address/iplAddressEdit update_friendinfo__Q33ipl5scene11AddressEditFv
Fetch origin/main a9a3f36cf03be45e012ddbb0b86cc689755c89c0. Initial assembly diagnosis: (2, 2) structural/positional differences; instructions 38/38
Remote source equals freshly built baseline; still open 99.42105%. Structural diagnosis: Two source/destination LEA schedule differences; test genuine array-element/array-object addresses and a read-only getter returning the actual name array reference, no raw offsets or pinned objects.
- pass explicit addresses of the real source and destination first elements: (2, 2) structural/positional; instructions 38/38; restored.
- cast the address of the actual destination name-array object: (2, 2) structural/positional; instructions 38/38; restored.
- read the actual source array through a const member getter returning its full array reference: (2, 2) structural/positional; instructions 38/38; restored.
- Anonymous double projection best5 diagnosis: [(11, ('fmuls', 'f4, f1, f4'), ('fmuls', 'f1, f1, f4')), (12, ('fmuls', 'f1, f3, f2'), ('fmuls', 'f2, f3, f2')), (13, ('fmuls', 'f2, f3, f4'), ('fmuls', 'f1, f3, f1')), (14, ('fmul', 'f0, f1, f0'), ('fmul', 'f0, f2, f0')), (15, ('stfs', 'f2, 4(r3)'), ('stfs', 'f1, 4(r3)'))]. Temporary diagnosis source restored.
## libs/RVL_SDK/src/kpad/KPAD KPADGetProjectionPos
Fetch origin/main a9a3f36cf03be45e012ddbb0b86cc689755c89c0. Initial assembly diagnosis: (0, 9) structural/positional differences; instructions 19/19
Remote source equals freshly built baseline; still open 96.57895%. Structural diagnosis: Anonymous-double calibration and named coefficient search reaches5 differences, all in y-half-height/X/Y-aspect colors. New actual coordinate-result lifetime boundaries; target19 instructions with self-coalesced Xf2/Yf1 and no stack.
- inline only the vertical coordinate product into its output assignment: (0, 0) structural/positional; instructions 19/19; candidate kept.
## Round9 exact KPAD projection candidate and gate
KPADGetProjectionPos: removing the named double scale result lets the correction product coalesce in f0; named real half/aspect locals put those coefficients in f4/f3; inlining only the vertical coordinate expression into dest->y removes its competing local lifetime and fixes the last5 colors. Final19/19 instructions, ctxdiff0, exact-name objdiff100.0%; pool identical0 strings. The existing horizontal local preserves source.x before either output write, including dest/src aliasing. No new volatile, asm, symbol/extent change or data object.
All-unit quick authority gate: full43U build passed; DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d; all3 pools identical;0 regressions/forbidden/readability warnings. SD122/129 unchanged, Address90/94 unchanged, KPAD21->22/29; code6756->6832/13056, data8032/8032 unchanged.
## libs/RVL_SDK/src/kpad/KPAD KPADSetSensorHeight
Fetch origin/main 8864436cde34e234c6853e021fe428b802033f4a. Initial assembly diagnosis: (0, 7) structural/positional differences; instructions 52/52
Remote source equals freshly built baseline; still open 99.23077%. Structural diagnosis: Register-only last after >=3 distinct successfully built new structural/alias/scope variants. Use declsearch on real subobject/scan locals with all assignments preserved; decode PPC paired operations and FP comparisons before scoring.
- New register-only seed decoded (0, 3).
- Register-only last declsearch: declaration block: | Vec2* center; | KPADInside* kpad; | f32 halfHeightSquared; | f32 halfHeight; | f32 barOffsetX; | f32 barDiagonal; | f32 halfWidthSquared; | f32 halfWidth; | f32 negativeSensorHeight; | f32 barDiagonalSquared; | f32 zero; | start (0, 3) | best (0, 3) after 146 builds; source restored; best order was: | Vec2* center; | KPADInside* kpad; | f32 halfHeightSquared; | f32 halfHeight; | f32 barOffsetX; | f32 barDiagonal; | f32 halfWidthSquared; | f32 halfWidth; | f32 negativeSensorHeight; | f32 barDiagonalSquared; | f32 zero; |
Nonexact declaration candidate restored; raw authority (0, 3).
## libs/RVL_SDK/src/kpad/KPAD select_1obj_first
Fetch origin/main 8864436cde34e234c6853e021fe428b802033f4a. Initial assembly diagnosis: (2, 26) structural/positional differences; instructions 109/109
Remote source equals freshly built baseline; still open 98.348625%. Structural diagnosis: Register-only last after >=3 distinct successfully built new structural/alias/scope variants. Use declsearch on real subobject/scan locals with all assignments preserved; decode PPC paired operations and FP comparisons before scoring.
- New register-only seed decoded (0, 22).
- Register-only last declsearch: declaration block: | KPADDPDObject* object; | f32 scale; | f32 productX; | f32 productY; | f32 offsetX; | f32 offsetY; | start (0, 22) | best (0, 22) after 36 builds; source restored; best order was: | KPADDPDObject* object; | f32 scale; | f32 productX; | f32 productY; | f32 offsetX; | f32 offsetY; |
Nonexact declaration candidate restored; raw authority (2, 22).
## libs/RVL_SDK/src/kpad/KPAD select_1obj_first
Fetch origin/main 6f49df32b3d1be83a41250c810670894ebe27efe. Initial assembly diagnosis: (2, 26) structural/positional differences; instructions 109/109
Remote source equals freshly built baseline; still open 98.348625%. Structural diagnosis: Apply the newly proven projection lifetime lever to the scan: target scale is an anonymousf0 load and each input coordinate coalesces through its use. Test removal of named real scale/product/component temporaries with exact typed field accesses, no arithmetic reassociation.
- inline the scale field into both real offset products: (2, 17) structural/positional; instructions 109/109; restored.
- inline the dot/cross component products into the two real offset initializers: (4, 22) structural/positional; instructions 109/109; restored.
- inline candidate input fields directly into both projected positions: (0, 13) structural/positional; instructions 109/109; restored.
- combine anonymous scale and candidate coordinate inputs: (0, 8) structural/positional; instructions 109/109; restored.
- combine anonymous product and candidate coordinate inputs: (2, 13) structural/positional; instructions 109/109; restored.
- inline all scale/product/coordinate inputs: (0, 0) structural/positional; instructions 109/109; candidate kept.
## Round9 exact single-object scan candidate and gate
select_1obj_first: after structural const/operand trials and declsearch, the projection lifetime finding led to removing named scale, dot/cross component and candidate x/y temporaries. Direct typed field expressions and direct candidate-array loop endpoint recover every target color. Final109/109 instructions/ctxdiff0, exact-name objdiff100.0%; projection remains19/19/ctxdiff0. No extra memory objects/volatile/asm or raw offset casts.
All-unit quick authority gate GATE PASS: correct DOL hash; pools identical;0 regressions/forbidden/readability warnings. SD122/129 and Address90/94 unchanged. KPAD22->23/29; round baseline21->23, code6756->7268/13056 (+512), all data8032/8032 unchanged.
Read-only origin dependency audit: KPAD dependencies and all owned function symbol definitions are unchanged from f7b1b9b0. Scene dependency changes only rename unrelated fields/getters at unchanged offsets or add IPL_CHANNEL_SELECT_CPP blocks (inactive in both owned scene TUs); owned source is unchanged remotely. No duplicated remote function match found. No symbols.txt changes made locally.
## libs/RVL_SDK/src/kpad/KPAD calc_acc_horizon
Fetch origin/main 6f49df32b3d1be83a41250c810670894ebe27efe. Initial assembly diagnosis: (2, 35) structural/positional differences; instructions 101/101
Remote source equals freshly built baseline; still open 97.27723%. Structural diagnosis: Apply two newly exact SDK lifetime reconstructions after the extended declaration search plateau17: remove real named field/product/interpolation temporaries so anonymous expressions can coalesce. Preserve the original floating multiplication/addition grouping, calls, guards and each object-field write.
- read normal components directly in their real products: (2, 35) structural/positional; instructions 101/101; restored.
- read the old horizon axis directly in its interpolation expressions: (2, 28) structural/positional; instructions 101/101; restored.
- inline the actual first dot-product component: (2, 35) structural/positional; instructions 101/101; restored.
- inline the blend and X-delta subexpressions: (2, 35) structural/positional; instructions 101/101; restored.
- read the old circle components directly in their interpolated results: (2, 33) structural/positional; instructions 101/101; restored.
- combine normal, axis and dot-product anonymous inputs: (0, 13) structural/positional; instructions 101/101; restored.
- combine normal, axis, dot, blend and delta anonymous inputs: (0, 21) structural/positional; instructions 101/101; restored.
- combine every actual field/product/interpolation input: (0, 19) structural/positional; instructions 101/101; restored.
- write circle interpolation results directly before deriving their true residuals: (2, 35) structural/positional; instructions 101/101; restored.
- combine all anonymous inputs with direct circle result stores: (0, 19) structural/positional; instructions 101/101; restored.
## libs/RVL_SDK/src/kpad/KPAD calc_acc_horizon
Fetch origin/main b33a493cec82cb6dbb068d07e1ad17c6d0204e32. Initial assembly diagnosis: (2, 35) structural/positional differences; instructions 101/101
Remote source equals freshly built baseline; still open 97.27723%. Structural diagnosis: New anonymous normal/axis/product inputs lower35 to13 exact positional differences with zero decoded structural difference; revisit register-only last declsearch only on this improved readable source, preserving all initialized assignments and rounding.
- Anonymous field/product declsearch: declaration block: | f32 magnitude; | f32 normalizedX; | f32 normalizedY; | f32 blend; | f32 projectedX; | f32 smoothing; | f32 deltaX; | f32 nextX; | f32 nextY; | f32 normalized; | f32 unitX; | f32 oldCircleX; | f32 oldCircleY; | f32 unitY; | f32 circleX; | f32 deltaCircleX; | f32 circleY; | f32 deltaCircleY; | start (0, 13) | improved (0, 11) | improved (0, 9) | improved (0, 3) | best (0, 3) after 650 builds; kept in source: | f32 magnitude; | f32 normalizedX; | f32 normalizedY; | f32 blend; | f32 projectedX; | f32 smoothing; | f32 deltaX; | f32 nextX; | f32 nextY; | f32 normalized; | f32 oldCircleY; | f32 circleX; | f32 oldCircleX; | f32 unitY; | f32 unitX; | f32 deltaCircleX; | f32 circleY; | f32 deltaCircleY; |
Nonexact anonymous-field/product declaration candidate restored; raw authority (0, 3).
## libs/RVL_SDK/src/kpad/KPAD KPADRead
Fetch origin/main b33a493cec82cb6dbb068d07e1ad17c6d0204e32. Initial assembly diagnosis: (11, 89) structural/positional differences; instructions 459/459
Remote source equals freshly built baseline; still open 97.52723%. Structural diagnosis: Raw-copy target computes the output cursor before loading the ring index, whereas prior pointer-first grouping retained index computation outside the cursor scope and enlarged the frame. New actual cursor/index scope ordering and fewer named count/index lifetimes preserve the complete copy and calibration logic.
- compute the copy cursor first and the actual ring index inside its scope: (40, 282) structural/positional; instructions 459/459; restored.
- combine cursor/index scope ordering with anonymous ring count loading: build failed libs/RVL_SDK/src/kpad/KPAD.c -o build/43U/src/libs/RVL_SDK/src/kpad && "/usr/bin/python3" tools/transform_dep.py build/43U/src/libs/RVL_SDK/src/kpad/KPAD.d build/43U/src/libs/RVL_SDK/src/kpad/KPAD.d ### mwcceppc.exe Compiler: # File: libs\RVL_SDK\src\kpad\KPAD.c # ------------------------------------- # 1454: calc_button_repeat(kpad, device, ringCount); # Error: ^^^^^^^^^ # (10140) undefined identifier 'ringCount' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed. ; restored.
- reuse the actual later sample-count variable in the raw-copy loop: (40, 282) structural/positional; instructions 459/459; restored.
- combine cursor/index scope with both anonymous and reused count values: build failed libs/RVL_SDK/src/kpad/KPAD.c -o build/43U/src/libs/RVL_SDK/src/kpad && "/usr/bin/python3" tools/transform_dep.py build/43U/src/libs/RVL_SDK/src/kpad/KPAD.d build/43U/src/libs/RVL_SDK/src/kpad/KPAD.d ### mwcceppc.exe Compiler: # File: libs\RVL_SDK\src\kpad\KPAD.c # ------------------------------------- # 1453: calc_button_repeat(kpad, device, ringCount); # Error: ^^^^^^^^^ # (10140) undefined identifier 'ringCount' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed. ; restored.
## libs/RVL_SDK/src/kpad/KPAD calc_dpd_variable
Fetch origin/main b33a493cec82cb6dbb068d07e1ad17c6d0204e32. Initial assembly diagnosis: (14, 45) structural/positional differences; instructions 250/250
Remote source equals freshly built baseline; still open 94.82%. Structural diagnosis: Distance filter target multiplies its weight in place in f2 then produces distance delta in f1. Remove the named next-value local and use the stored true dist_vec field before its speed/position updates; test direct geometric expressions without changing operation grouping.
- derive distance speed from the actual stored delta after an in-place gain product: (14, 43) structural/positional; instructions 250/250; restored.
- combine anonymous stored distance delta with the explicit magnitude sign branch: (14, 43) structural/positional; instructions 250/250; restored.
- combine anonymous distance delta with direction-first rotation products: (12, 38) structural/positional; instructions 250/250; restored.
- Anonymous-field/product horizon best3 diagnosis: [(44, ('fmuls', 'f5, f8, f6'), ('fmuls', 'f8, f8, f6')), (47, ('fmuls', 'f2, f5, f2'), ('fmuls', 'f2, f8, f2')), (48, ('fmuls', 'f0, f5, f0'), ('fmuls', 'f0, f8, f0'))]. Temporary diagnosis source restored.
## libs/RVL_SDK/src/kpad/KPAD calc_acc_horizon
Fetch origin/main e3457d11a22a9f0d8300daed615914fb230bea7d. Initial assembly diagnosis: (2, 35) structural/positional differences; instructions 101/101
Remote source equals freshly built baseline; still open 97.27723%. Structural diagnosis: Remaining3 instructions in the anonymous-field/product best declaration candidate all identify the same structural temporary boundary: target overwrites magnitudef8 with magnitude*blend, source creates independent smoothingf5. Reuse the real magnitude as the interpolation weight after its normalization work is finished.
- reuse magnitude in place for the true interpolation weight in the best3 real-local context: (0, 0) structural/positional; instructions 101/101; candidate kept.
## Round9 exact acceleration horizon candidate and gate
calc_acc_horizon: anonymous normal/old-axis/first-product inputs reduce35 colors to13; declaration search reduces13->3. All three remaining instructions prove the same temporary difference: target overwrites magnitude f8 with magnitude*blend, while source creates smoothing f5. Reusing magnitude as its interpolation weight recovers101/101 instructions and ctxdiff0/exact-name objdiff100.0%. No arithmetic reassociation or changed object writes/calls/guards. Projection and single-object scan remain exact.
All-unit quick gate GATE PASS, correct DOL hash, identical pools,0 regressions/forbidden/readability warnings. SDK23->24/29; round21->24, code6756->7672/13056 (+916), data8032/8032. SD122/129, Address90/94 and their code/data totals unchanged.
KPADRead failed anonymous-ring-count trials diagnosed: ringCount also supplies the full batch elapsed count to calc_button_repeat after available is capped by caller count. It must retain the original batch count; replacing it with available would change behavior and was not done. Failed compilations do not count toward the three successful source attempts.
## Round9 final full clean gate and remaining-function audit
Full non-quick gate across all3 units GATE PASS; DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d; all pools identical;0 regressions/forbidden/readability warnings; every owned data section100%. No data symbol rename or extent correction needed/made. All open target function extents end before/equal the next symbol; no adjacent same-slot word/single/double stack store/reload pair justified new volatile. No byte16/byte8 mask mismatch justified widening.
src/scene/sdChannelSelect/iplSDChannelSelect: exact 122 ->122/129; code 29412 ->29412/33828; data 2960 ->2960/2960.
src/scene/address/iplAddressEdit: exact 90 ->90/94; code 23044 ->23044/27112; data 2560 ->2560/2560.
libs/RVL_SDK/src/kpad/KPAD: exact 21 ->24/29; code 6756 ->7672/13056; data 8032 ->8032/8032.
MAX round produced 3 new exact functions; 98 logged successfully built distinct source variants plus1720 declaration-search builds (failed builds excluded). All16 remaining functions have >=3 distinct successfully built source variants in this round. Every nonexact source/header trial was restored; only the newly exact SDK function bodies and this log differ from f7b1b9b0. Unsupported NWC24-error input contract remains unproved; initialized fallback retained.
- src/scene/sdChannelSelect/iplSDChannelSelect create__Q33ipl5scene15SDChannelSelectFv 97.73972%; 3 successful distinct source trials; 145/146 frame0x20; missing BS2-manager body reload; switch/for-loop polling and update-reference scopes leave gap.
- src/scene/sdChannelSelect/iplSDChannelSelect collectTitlesByUsage__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl 97.81188%; 6 successful distinct source trials; 101/101 frame0x40; counter add/store and first threshold load schedule differ4; postincrement-result helpers and const formal pointer variables unchanged; copied count adds4 instructions.
- src/scene/sdChannelSelect/iplSDChannelSelect collectTitlesFromNandUsage__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl 97.833336%; 6 successful distinct source trials; 102/102 frame0x40; counter add/store and first threshold load schedule differ4; old-count helpers/const formals unchanged; copied count adds4 instructions.
- src/scene/sdChannelSelect/iplSDChannelSelect collectTitlesByChannelOrder__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl 97.29365%; 3 successful distinct source trials; 126/126 frame0x60; entry indexing and counter/threshold lifetimes; title-ID hoist plus pointer-row/unsigned channel index views leave7; nonexact restored.
- src/scene/sdChannelSelect/iplSDChannelSelect collectTitlesBySpecialChannels__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl 97.55125%; 3 successful distinct source trials; 361/361 frame0x80; four repeated counter/threshold schedules differ16; named previous counts, comma postincrement and old-count-return helper unchanged.
- src/scene/sdChannelSelect/iplSDChannelSelect flushSaveDataAndMountSD__Q33ipl5scene15SDChannelSelectFv 99.65714%; 6 successful distinct source trials; 35/35 frame0x10; heap/manager argument loads reversed; pointer-cell getter const references and real flush-request aggregates all retain2.
- src/scene/sdChannelSelect/iplSDChannelSelect setChannelScissor__Q33ipl5scene15SDChannelSelectCFPCQ33ipl5scene12SDChannelObj 93.4721%; 3 successful distinct source trials; 233/233 frame0xe0; framebuffer conversion and scissor/projection coordinate lifetimes; dimension references retain68, shared width230 instructions, bounds aggregate251.
- src/scene/address/iplAddressEdit create__Q33ipl5scene11AddressEditFv 97.44634%; 3 successful distinct source trials; 820/820 frame0x60; target keeps two text addresses across lookups and has one allocation guard; ordinary new with mutable pointer/array/String views remains818/820; restored.
- src/scene/address/iplAddressEdit get_friendinfo__Q33ipl5scene11AddressEditFv 88.03571%; 3 successful distinct source trials; 82/84 frame0x420; target saves both text pointers before virtual pane lookups; mutable pointer/array/String views still82/84; rematerialization gap remains.
- src/scene/address/iplAddressEdit update_friendinfo__Q33ipl5scene11AddressEditFv 99.42105%; 6 successful distinct source trials; 38/38 frame0x10; resolved wcsncpy source/destination LEAs reversed; mutable request fields/constructor, actual array addresses and const array-reference getter retain2.
- src/scene/address/iplAddressEdit set_err_msg__Q33ipl5scene11AddressEditFPwUl8NWC24Err 98.666664%; 3 successful distinct source trials; 76/75 frame0x60; target leaves message ID undefined on unsupported errors; initialized aggregate76, exhaustive safe switch73, grouped safe if65; safe fallback retained.
- libs/RVL_SDK/src/kpad/KPAD KPADSetSensorHeight 99.23077%; 6 successful distinct source trials; 52/52 frame0x30; named-zero and center-subobject view fixes floating colors but leaves3 array-base colors;146-build declsearch plateau3; const/mutable center scalar helpers13 differences.
- libs/RVL_SDK/src/kpad/KPAD read_kpad_acc 98.15%; 3 successful distinct source trials; 400/400 frame0x50; smoothing/guard reconstruction reaches one cmpwi5 instead of targetcmplwi5; unsigned predicate switch403, nested switch2 differences, format-relative switch1; restored.
- libs/RVL_SDK/src/kpad/KPAD calc_dpd_variable 94.82%; 9 successful distinct source trials; 250/250 frame0x20; distance-weight and late rotation geometry load/product schedules; anonymous stored distance delta/direction-first products lower to38; no exact candidate.
- libs/RVL_SDK/src/kpad/KPAD KPADRead 97.52723%; 5 successful distinct source trials; 459/459 frame0xc0; raw-copy cursor endpoint and ring-index/load schedules plus gravity x/y order; complete copy helper459 with250 differences, gravity product locals83, for-loop458; cursor/index scope459 instructions/282 differences; removing full batch count fails because repeat timing still uses it; nonexact restored.
- libs/RVL_SDK/src/kpad/KPAD KPADInit 96.51351%; 3 successful distinct source trials; 185/185 frame0x90; delay constant/saved-float/matrix colors; repeat initializer and zero/one order unchanged81, matrix pointer loop scope improves65; restored.
New exact names: KPADGetProjectionPos, calc_acc_horizon, select_1obj_first.
Final full-gate authority lines:
```
[src/scene/sdChannelSelect/iplSDChannelSelect] instruction-exact functions: 122/129
[src/scene/address/iplAddressEdit] instruction-exact functions: 90/94
[libs/RVL_SDK/src/kpad/KPAD] instruction-exact functions: 24/29
GATE PASS
```
Gate-passing source commits: 459cc944 (projection), 021a0466 (single-object scan), b7d4457c (acceleration horizon). Final clean build retains all3 exact matches and every previous exact function. Only libs/RVL_SDK/src/kpad/KPAD.c and this attempts log changed.
## Round10 MAX continuation baseline and acceptance gates
Fresh source baseline d78210528f882407ff363d4a112114670a216ce3. Read AGENTS.md; no subagents or remote writes. Pools first: SDK identical0 strings, SD identical101, Address identical57. Source trials must preserve pool and prior exact functions; only instruction-exact plus exact-name objdiff100 candidates may be retained/committed after all-unit quick gate. Final clean all-unit gate and three successfully built distinct source attempts per remaining function required. Failed compilations excluded.
libs/RVL_SDK/src/kpad/KPAD baseline {"fuzzy_match_percent": 98.81893, "total_code": "13056", "matched_code": "7672", "matched_code_percent": 58.762253, "total_data": "8032", "matched_data": "8032", "matched_data_percent": 100.0, "total_functions": 29, "matched_functions": 24, "matched_functions_percent": 82.75862, "total_units": 1}
src/scene/sdChannelSelect/iplSDChannelSelect baseline {"fuzzy_match_percent": 99.582596, "total_code": "33828", "matched_code": "29412", "matched_code_percent": 86.945724, "total_data": "2960", "matched_data": "2960", "matched_data_percent": 100.0, "total_functions": 129, "matched_functions": 122, "matched_functions_percent": 94.57364, "total_units": 1}
src/scene/address/iplAddressEdit baseline {"fuzzy_match_percent": 99.52479, "total_code": "27112", "matched_code": "23044", "matched_code_percent": 84.995575, "total_data": "2560", "matched_data": "2560", "matched_data_percent": 100.0, "total_functions": 94, "matched_functions": 90, "matched_functions_percent": 95.74468, "total_units": 1}
## libs/RVL_SDK/src/kpad/KPAD KPADSetSensorHeight
Fetch origin/main 26d7e1e052a80ea55d0591a82653370965ad5bb2. Initial assembly diagnosis: (0, 7) structural/positional differences; instructions 52/52
Remote source equals freshly built baseline; still open 99.23077%. Structural diagnosis: Target/ours 52 instructions and frame0x30; width/height squared and zero local lifetime differ in four floating colors and array-base uses r4 instead of target r3 in three instructions. No branch or arithmetic difference. Build genuine shorter squared/negative-height lifetimes and readonly pointer definitions before register-only search; original target PSQ decoded and ctxdiff recorded.
- compute the two real squared dimensions directly in the diagonal sum: (0, 3) structural/positional; instructions 52/52; restored.
- negate sensor height directly in its real center-field store: (1, 14) structural/positional; instructions 52/52; restored.
Trial harness diagonal-sum transform omitted its Python return; aborted before writing source, corrected, not counted as a source attempt. Remote dependency audit d7821052->26d7e1e0: only configure.py switches unrelated already-matched wprintf to Matching; owned source, headers and symbol definitions unchanged.
## libs/RVL_SDK/src/kpad/KPAD KPADSetSensorHeight
Fetch origin/main 26d7e1e052a80ea55d0591a82653370965ad5bb2. Initial assembly diagnosis: (0, 7) structural/positional differences; instructions 52/52
Remote source equals freshly built baseline; still open 99.23077%. Structural diagnosis: Target/ours 52 instructions and frame0x30; width/height squared and zero local lifetime differ in four floating colors and array-base uses r4 instead of target r3 in three instructions. No branch or arithmetic difference. Build genuine shorter squared/negative-height lifetimes and readonly pointer definitions before register-only search; original target PSQ decoded and ctxdiff recorded.
- inline only the real diagonal sum into sqrt: (0, 0) structural/positional; instructions 52/52; candidate kept.
## Round10 exact sensor-height candidate and gate
KPADSetSensorHeight: target has the diagonal sum as an anonymous sqrt input; named-zero/squared-height order plus removal of the real diagonal-sum local makes the array-base register reuse match as well. 52/52 instructions, frame0x30, ctxdiff0, exact-name objdiff100.0%; pool identical. All-unit quick gate GATE PASS, correct DOL SHA1,0 regressions/forbidden/readability warnings. SDK24->25/29; code7672->7880/13056; data8032/8032 unchanged. SD122/129 and Address90/94 unchanged. Only the exact SDK function and attempts log changed; no headers or data-symbol edits.
## libs/RVL_SDK/src/kpad/KPAD read_kpad_acc
Fetch origin/main 26d7e1e052a80ea55d0591a82653370965ad5bb2. Initial assembly diagnosis: (16, 66) structural/positional differences; instructions 400/400
Remote source equals freshly built baseline; still open 98.15%. Structural diagnosis: 400/400 frame0x50; smoothing magnitude/delta boundaries and split error/device guards reduce the old mismatch to a single final switch cmpwi5 versus target cmplwi5. Try unsigned relational guards and branch-to-accepted loop forms on that complete readable reconstruction, preserving all unsupported-format returns.
- bound the valid fallback format with unsigned relational guards: (10, 195) structural/positional; instructions 401/400; restored.
- dispatch each accepted format through a single-pass loop with two break arms: (10, 194) structural/positional; instructions 399/400; restored.
- use a looping fallback switch whose accepted arm exits the loop: (15, 198) structural/positional; instructions 401/400; restored.
- write the primary and fallback cases as exclusive unsigned bounds: (11, 200) structural/positional; instructions 402/400; restored.
- handle the fallback format in a one-case switch followed by a primary-format guard: (13, 196) structural/positional; instructions 399/400; restored.
## libs/RVL_SDK/src/kpad/KPAD calc_dpd_variable
Fetch origin/main 26d7e1e052a80ea55d0591a82653370965ad5bb2. Initial assembly diagnosis: (14, 45) structural/positional differences; instructions 250/250
Remote source equals freshly built baseline; still open 94.82%. Structural diagnosis: 250/250 frame0x20; target distance weight is updated in place and late geometry coalesces direction products through their sums. Test real Vec2 rotation/midpoint boundaries, anonymous rotation or midpoint values, and direct normal-component input lifetimes before declaration search. Retain original operation grouping and every object-field write.
- hold the true dot/cross rotation in a Vec2 local: build failed lang=c -MMD -c libs/RVL_SDK/src/kpad/KPAD.c -o build/43U/src/libs/RVL_SDK/src/kpad && "/usr/bin/python3" tools/transform_dep.py build/43U/src/libs/RVL_SDK/src/kpad/KPAD.d build/43U/src/libs/RVL_SDK/src/kpad/KPAD.d ### mwcceppc.exe Compiler: # File: libs\RVL_SDK\src\kpad\KPAD.c # ------------------------------------- # 963: f32 scaleX = 0.5f * (kpad->dpdState.candidates[0].x + kpad->dpdState.candidates[1].x); # Error: ^^^ # (10141) expression syntax error # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed. ; restored.
- evaluate the actual Vec2 cross coordinate before its dot coordinate: build failed lang=c -MMD -c libs/RVL_SDK/src/kpad/KPAD.c -o build/43U/src/libs/RVL_SDK/src/kpad && "/usr/bin/python3" tools/transform_dep.py build/43U/src/libs/RVL_SDK/src/kpad/KPAD.d build/43U/src/libs/RVL_SDK/src/kpad/KPAD.d ### mwcceppc.exe Compiler: # File: libs\RVL_SDK\src\kpad\KPAD.c # ------------------------------------- # 963: f32 scaleX = 0.5f * (kpad->dpdState.candidates[0].x + kpad->dpdState.candidates[1].x); # Error: ^^^ # (10141) expression syntax error # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed. ; restored.
- inline midpoint x and y into both actual geometric products: (16, 39) structural/positional; instructions 250/250; restored.
- inline the dot rotation expression into its actual geometric products: (19, 45) structural/positional; instructions 250/250; restored.
- inline both dot and cross rotation expressions into their geometric products: (10, 23) structural/positional; instructions 250/250; restored.
- inline all rotation and midpoint expressions: (12, 35) structural/positional; instructions 250/250; restored.
- read normal components through a const subobject view: (12, 38) structural/positional; instructions 250/250; restored.
- combine a readonly normal view with anonymous midpoint products: (16, 39) structural/positional; instructions 250/250; restored.
## libs/RVL_SDK/src/kpad/KPAD KPADRead
Fetch origin/main 26d7e1e052a80ea55d0591a82653370965ad5bb2. Initial assembly diagnosis: (11, 89) structural/positional differences; instructions 459/459
Remote source equals freshly built baseline; still open 97.52723%. Structural diagnosis: 459/459 frame0xc0; copy cursor uses target statuses+available then decrement, source (available-1) scale before pointer-add. Ring count is read from an actual u8 field, never changed and still supplies repeat elapsed count; test safe byte/halfword local widths, real cursor lifetime sharing, and the full copy cursor endpoint before declaration search.
- keep the actual full batch count in its byte-width local: (11, 89) structural/positional; instructions 459/459; restored.
- keep the actual full batch count widened to a halfword local: (11, 89) structural/positional; instructions 459/459; restored.
- preserve the nonnegative wrapping ring index as an unsigned local: (12, 89) structural/positional; instructions 459/459; restored.
- use an end cursor and copy into the preceding real status slot: (75, 284) structural/positional; instructions 459/459; restored.
- reuse the actual later output cursor for the initial raw-copy loop: (46, 276) structural/positional; instructions 459/459; restored.
- combine a byte batch count with the real end-cursor copy: (75, 284) structural/positional; instructions 459/459; restored.
- combine a halfword batch count and shared output cursor: (46, 276) structural/positional; instructions 459/459; restored.
## libs/RVL_SDK/src/kpad/KPAD calc_dpd_variable
Fetch origin/main 26d7e1e052a80ea55d0591a82653370965ad5bb2. Initial assembly diagnosis: (14, 45) structural/positional differences; instructions 250/250
Remote source equals freshly built baseline; still open 94.82%. Structural diagnosis: Anonymous rotation inputs improve45 to23 raw differences with unchanged250 instructions. Distance target coalesces the original quotient f2 into its absolute interpolation weight: reuse the real value local after deriving dx, preserving its original zero-validity store. Test combined anonymous-rotation and actual weight reuse before registers.
- reuse the distance quotient local for its actual absolute filtering weight: (14, 43) structural/positional; instructions 250/250; restored.
- combine distance-value reuse with anonymous dot/cross rotation inputs: (10, 23) structural/positional; instructions 250/250; restored.
- fix C89 leading declarations for a real Vec2 rotation local: build failed c -MMD -c libs/RVL_SDK/src/kpad/KPAD.c -o build/43U/src/libs/RVL_SDK/src/kpad && "/usr/bin/python3" tools/transform_dep.py build/43U/src/libs/RVL_SDK/src/kpad/KPAD.d build/43U/src/libs/RVL_SDK/src/kpad/KPAD.d ### mwcceppc.exe Compiler: # File: libs\RVL_SDK\src\kpad\KPAD.c # ------------------------------------- # 961: scaleX = 0.5f * (kpad->dpdState.candidates[0].x + kpad->dpdState.candidates[1].x); # Error: ^^^^^^ # (10140) undefined identifier 'scaleX' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed. ; restored.
- combine the real Vec2 rotation and distance weight reuse: build failed c -MMD -c libs/RVL_SDK/src/kpad/KPAD.c -o build/43U/src/libs/RVL_SDK/src/kpad && "/usr/bin/python3" tools/transform_dep.py build/43U/src/libs/RVL_SDK/src/kpad/KPAD.d build/43U/src/libs/RVL_SDK/src/kpad/KPAD.d ### mwcceppc.exe Compiler: # File: libs\RVL_SDK\src\kpad\KPAD.c # ------------------------------------- # 960: scaleX = 0.5f * (kpad->dpdState.candidates[0].x + kpad->dpdState.candidates[1].x); # Error: ^^^^^^ # (10140) undefined identifier 'scaleX' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed. ; restored.
- reuse distance weight and inline midpoint inputs as well: (12, 35) structural/positional; instructions 250/250; restored.
## libs/RVL_SDK/src/kpad/KPAD KPADInit
Fetch origin/main 26d7e1e052a80ea55d0591a82653370965ad5bb2. Initial assembly diagnosis: (9, 81) structural/positional differences; instructions 185/185
Remote source equals freshly built baseline; still open 96.51351%. Structural diagnosis: 185/185 frame0x90; target keeps zero/one and controller/matrix values in different saved registers and computes the repeat-delay constant earlier. Negative-sine narrowing coalesces to target f0 versus named rotation result f2. Test anonymous true trig result stores, matrix lifetime/representation, and loop-local calibration temporaries before register search.
- store each actual trig result directly into its matrix element: (13, 86) structural/positional; instructions 185/185; restored.
- combine direct trig stores with a controller-loop matrix pointer scope: (13, 70) structural/positional; instructions 185/185; restored.
- keep the actual width height and diagonal calibration locals inside their loop: (9, 81) structural/positional; instructions 185/185; restored.
- view the real rotation matrix through the SDK Mtx element layout: build failed contract off -lang=c -MMD -c libs/RVL_SDK/src/kpad/KPAD.c -o build/43U/src/libs/RVL_SDK/src/kpad && "/usr/bin/python3" tools/transform_dep.py build/43U/src/libs/RVL_SDK/src/kpad/KPAD.d build/43U/src/libs/RVL_SDK/src/kpad/KPAD.d ### mwcceppc.exe Compiler: # File: libs\RVL_SDK\src\kpad\KPAD.c # ------------------------------------- # 1530: initial_rotation_(*matrix)[0][0] = one; # Error: ^ # (10377) illegal operands 'int' [ 'int' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed. ; restored.
- combine local calibration and anonymous trig results: (13, 86) structural/positional; instructions 185/185; restored.
- combine typed matrix elements and anonymous trig results: build failed contract off -lang=c -MMD -c libs/RVL_SDK/src/kpad/KPAD.c -o build/43U/src/libs/RVL_SDK/src/kpad && "/usr/bin/python3" tools/transform_dep.py build/43U/src/libs/RVL_SDK/src/kpad/KPAD.d build/43U/src/libs/RVL_SDK/src/kpad/KPAD.d ### mwcceppc.exe Compiler: # File: libs\RVL_SDK\src\kpad\KPAD.c # ------------------------------------- # 1529: initial_rotation_(*matrix)[0][0] = one; # Error: ^ # (10377) illegal operands 'int' [ 'int' # Too many errors printed, aborting program User break, cancelled... ninja: build stopped: subcommand failed. ; restored.
## libs/RVL_SDK/src/kpad/KPAD calc_dpd_variable
Fetch origin/main 26d7e1e052a80ea55d0591a82653370965ad5bb2. Initial assembly diagnosis: (14, 45) structural/positional differences; instructions 250/250
Remote source equals freshly built baseline; still open 94.82%. Structural diagnosis: Anonymous rotation inputs improve45 to23 raw differences with unchanged250 instructions. Distance target coalesces the original quotient f2 into its absolute interpolation weight: reuse the real value local after deriving dx, preserving its original zero-validity store. Test combined anonymous-rotation and actual weight reuse before registers.
- fix C89 leading declarations for a real Vec2 rotation local: (62, 136) structural/positional; instructions 252/250; restored.
- combine the real Vec2 rotation and distance weight reuse: (62, 136) structural/positional; instructions 252/250; restored.
## libs/RVL_SDK/src/kpad/KPAD KPADInit
Fetch origin/main 26d7e1e052a80ea55d0591a82653370965ad5bb2. Initial assembly diagnosis: (9, 81) structural/positional differences; instructions 185/185
Remote source equals freshly built baseline; still open 96.51351%. Structural diagnosis: Trig and geometry structural trials preserve185 instructions but leave temporary rounding/register schedules. Target negative sine remains double until its actual field store. Test that real precision/lifetime boundary and the corrected exact SDK matrix layout before final declaration permutations. Failed C89/matrix harness transforms are excluded from successful trial counts.
- retain negative sine at math-library precision until its real float matrix store: (9, 80) structural/positional; instructions 185/185; restored.
- retain every true trig result at library precision until the float store: (9, 80) structural/positional; instructions 185/185; restored.
- combine a double negative-sine result and controller-loop matrix scope: (9, 64) structural/positional; instructions 185/185; restored.
- access actual matrix rows and columns through Mtx: (9, 81) structural/positional; instructions 185/185; restored.
- combine library-precision sine and SDK typed matrix elements: (9, 80) structural/positional; instructions 185/185; restored.
## src/scene/sdChannelSelect/iplSDChannelSelect create__Q33ipl5scene15SDChannelSelectFv
Fetch origin/main 26d7e1e052a80ea55d0591a82653370965ad5bb2. Initial assembly diagnosis: (4, 39) structural/positional differences; instructions 145/146
Remote source equals freshly built baseline; still open 97.73972%. Structural diagnosis: Target146 instructions/frame0x20 versus ours145; target reloads the BS2 manager in the polling body while ours reuses the condition pointer. Calls and literal pool already agree. Test actual polling pointer scope and loop exit boundaries before any register search; no unjustified volatile.
- retain the actual polling manager as a for-loop condition value: (6, 21) structural/positional; instructions 148/146; restored.
- use explicit polling and ready labels for the same loop condition: (9, 40) structural/positional; instructions 145/146; restored.
- bind the actual polling state reference in the loop condition: (9, 40) structural/positional; instructions 145/146; restored.
## src/scene/sdChannelSelect/iplSDChannelSelect collectTitlesByUsage__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl
Fetch origin/main 26d7e1e052a80ea55d0591a82653370965ad5bb2. Initial assembly diagnosis: (2, 4) structural/positional differences; instructions 101/101
Remote source equals freshly built baseline; still open 97.81188%. Structural diagnosis: Target and source have identical101/102 instruction counts and frame0x40; the only four differences are counter add/store and first threshold load scheduling. New source lifetime tests qualify the actual title-name input, give its output address a real cursor local, and group the escaped page/channel outputs in their true stack order. No widening, volatile or alias-type violations.
- use a const title-name input at the ordinary name-copy boundary: (2, 4) structural/positional; instructions 101/101; restored.
- give the real title-name output address its own local lifetime: (2, 4) structural/positional; instructions 101/101; restored.
- group the actual page and channel lookup outputs as a ChannelLocation: (16, 17) structural/positional; instructions 101/101; restored.
- combine readonly name input and named output cursor: (2, 4) structural/positional; instructions 101/101; restored.
- combine actual location outputs and readonly title-name input: (16, 17) structural/positional; instructions 101/101; restored.
## src/scene/sdChannelSelect/iplSDChannelSelect collectTitlesFromNandUsage__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl
Fetch origin/main 26d7e1e052a80ea55d0591a82653370965ad5bb2. Initial assembly diagnosis: (2, 4) structural/positional differences; instructions 102/102
Remote source equals freshly built baseline; still open 97.833336%. Structural diagnosis: Target and source have identical101/102 instruction counts and frame0x40; the only four differences are counter add/store and first threshold load scheduling. New source lifetime tests qualify the actual title-name input, give its output address a real cursor local, and group the escaped page/channel outputs in their true stack order. No widening, volatile or alias-type violations.
- use a const title-name input at the ordinary name-copy boundary: (2, 4) structural/positional; instructions 102/102; restored.
- give the real title-name output address its own local lifetime: (2, 4) structural/positional; instructions 102/102; restored.
- group the actual page and channel lookup outputs as a ChannelLocation: (16, 17) structural/positional; instructions 102/102; restored.
- combine readonly name input and named output cursor: (2, 4) structural/positional; instructions 102/102; restored.
- combine actual location outputs and readonly title-name input: (16, 17) structural/positional; instructions 102/102; restored.
## src/scene/sdChannelSelect/iplSDChannelSelect collectTitlesByChannelOrder__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl
Fetch origin/main 26d7e1e052a80ea55d0591a82653370965ad5bb2. Initial assembly diagnosis: (2, 22) structural/positional differences; instructions 126/126
Remote source equals freshly built baseline; still open 97.29365%. Structural diagnosis: 126/126 frame0x60; a real titleId hoist previously reduced22 to7 differences, with three channel-address operand differences and four postcopy counter/threshold schedules. New contiguous channel-row indexing order, real name input/output lifetimes, and title-state scope preserve the complete ordered scan.
- use index-first subscripting of the actual typed channel row: (2, 7) structural/positional; instructions 126/126; restored.
- use a readonly pointer to the complete channel row array: (2, 7) structural/positional; instructions 126/126; restored.
- combine the hoisted title value with readonly collected-name input: (2, 7) structural/positional; instructions 126/126; restored.
- combine index-first row addressing and a real name output cursor: (2, 7) structural/positional; instructions 126/126; restored.
## src/scene/sdChannelSelect/iplSDChannelSelect collectTitlesBySpecialChannels__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl
Fetch origin/main 26d7e1e052a80ea55d0591a82653370965ad5bb2. Initial assembly diagnosis: (8, 16) structural/positional differences; instructions 361/361
Remote source equals freshly built baseline; still open 97.55125%. Structural diagnosis: 361/361 frame0x80; four identical counter/threshold schedules differ16 total. Test the same real name-input/output lifetime boundaries, and anonymous cache/lookup title values preserving every special-channel ordering branch.
- make each actual special-channel collected-name input readonly: (8, 16) structural/positional; instructions 361/361; restored.
- name each real special-channel name output cursor before memcpy: (8, 16) structural/positional; instructions 361/361; restored.
- combine readonly collected-name inputs and named output cursors: (8, 16) structural/positional; instructions 361/361; restored.
## src/scene/sdChannelSelect/iplSDChannelSelect flushSaveDataAndMountSD__Q33ipl5scene15SDChannelSelectFv
Fetch origin/main 805e84045c82629c645e9ef1787c30d2bc33b5e7. Initial assembly diagnosis: (2, 2) structural/positional differences; instructions 35/35
Remote source equals freshly built baseline; still open 99.65714%. Structural diagnosis: 35/35 frame0x10; only heap r4 and save-manager r3 argument-load order differs. Test actual returned file/output-field lifetimes and readonly pointee reference getters scoped to this TU. Keep the flag setter before heap/manager loads, every following store/call unchanged, and no volatile.
- name the actual returned asynchronous save file before its field store: (2, 2) structural/positional; instructions 35/35; restored.
- bind the real asynchronous file output field by reference at the call: (2, 2) structural/positional; instructions 35/35; restored.
- call through actual manager and heap object references at the flush boundary: (2, 2) structural/positional; instructions 35/35; restored.
## src/scene/sdChannelSelect/iplSDChannelSelect setChannelScissor__Q33ipl5scene15SDChannelSelectCFPCQ33ipl5scene12SDChannelObj
Fetch origin/main 805e84045c82629c645e9ef1787c30d2bc33b5e7. Initial assembly diagnosis: (23, 68) structural/positional differences; instructions 233/233
Remote source equals freshly built baseline; still open 93.4721%. Structural diagnosis: 233/233 frame0xe0; target keeps projection width in saved f29, source retains widthScale there; framebuffer conversion scheduling and matrix temporary colors follow from those lifetimes. Test a projection-width local scoped only to the transformed branch, anonymous matrix bound quotients, and direct quotient use before register-only last.
- keep a branch-local projection width distinct from final scissor width: (23, 68) structural/positional; instructions 233/233; restored.
- combine branch-local projection width with direct horizontal quotient use: (36, 71) structural/positional; instructions 233/233; restored.
- inline the actual top projection quotient into its matrix bound: (23, 67) structural/positional; instructions 233/233; restored.
- inline all actual matrix bound quotients while retaining each final bound: (38, 71) structural/positional; instructions 233/233; restored.
- combine anonymous matrix quotients and branch-local projection width: (38, 71) structural/positional; instructions 233/233; restored.
## src/scene/address/iplAddressEdit create__Q33ipl5scene11AddressEditFv
Fetch origin/main 805e84045c82629c645e9ef1787c30d2bc33b5e7. Initial assembly diagnosis: (19, 323) structural/positional differences; instructions 820/820
Remote source equals freshly built baseline; still open 97.44634%. Structural diagnosis: 820/820 frame0x60; target has one balloon allocation guard and keeps both text input addresses across virtual pane lookups. Ordinary new recovers the real allocation boundary but leaves818/820 instructions. Test pointer-definition constness, a String pointer receiver reused across the real text reads, and an actual name/display input aggregate; keep literal token order.
- combine ordinary balloon allocation and a const name-pointer definition: (23, 331) structural/positional; instructions 818/820; restored.
- combine ordinary allocation and an actual String pointer used for both text inputs: (23, 331) structural/positional; instructions 818/820; restored.
- combine ordinary allocation and a real pair of readonly name/display input addresses: (23, 331) structural/positional; instructions 818/820; restored.
## src/scene/address/iplAddressEdit get_friendinfo__Q33ipl5scene11AddressEditFv
Fetch origin/main 805e84045c82629c645e9ef1787c30d2bc33b5e7. Initial assembly diagnosis: (10, 68) structural/positional differences; instructions 82/84
Remote source equals freshly built baseline; still open 88.03571%. Structural diagnosis: 82/84 frame0x420; target computes text LEAs before virtual lookups and retains them in r29, source rematerializes them afterwards. Test const pointer definitions and the real copied friend-info/String object view lifetimes; no extra buffers or dummy objects.
- give both existing readonly text pointers const definitions: (10, 68) structural/positional; instructions 82/84; restored.
- reuse a String pointer receiver for every real string operation: (10, 39) structural/positional; instructions 83/84; restored.
- read the actual copied friend-info object through a named const reference: (14, 71) structural/positional; instructions 80/84; restored.
## src/scene/address/iplAddressEdit update_friendinfo__Q33ipl5scene11AddressEditFv
Fetch origin/main 805e84045c82629c645e9ef1787c30d2bc33b5e7. Initial assembly diagnosis: (2, 2) structural/positional differences; instructions 38/38
Remote source equals freshly built baseline; still open 99.42105%. Structural diagnosis: 38/38 frame0x10; target builds readonly name-source r4 before global destination r3, source inverts those two LEAs. Source/destination fields and wcsncpy relocation are proven. Test a const String pointer receiver, actual typed name-array pointer, and a source-array reference with copy length derived from the true ten-character limit; no raw offsets or pinned data.
- read the copy source through a const String pointer definition: (2, 2) structural/positional; instructions 38/38; restored.
- read the source through a pointer to the actual complete name-array type: (2, 2) structural/positional; instructions 38/38; restored.
- bind the actual source array and derive the existing ten-character copy limit: (2, 2) structural/positional; instructions 38/38; restored.
## src/scene/address/iplAddressEdit set_err_msg__Q33ipl5scene11AddressEditFPwUl8NWC24Err
Fetch origin/main 805e84045c82629c645e9ef1787c30d2bc33b5e7. Initial assembly diagnosis: (1, 30) structural/positional differences; instructions 76/75
Remote source equals freshly built baseline; still open 98.666664%. Structural diagnosis: 76/75 frame0x60; the target message-ID register is undefined for unsupported errors. Retain the initialized server fallback. New readonly cache-object access, anonymous actual error-code formatting input, and a typed supported-message enum test legitimate source boundaries without uninitialized assumptions.
- read the actual cache error through a typed readonly FriendListCache pointer: (1, 30) structural/positional; instructions 76/75; restored.
- pass the actual cache error directly into its wide-format call: (1, 30) structural/positional; instructions 76/75; restored.
- select initialized supported message values through a real enum local: (1, 30) structural/positional; instructions 76/75; restored.
## libs/RVL_SDK/src/kpad/KPAD KPADInit
Fetch origin/main 805e84045c82629c645e9ef1787c30d2bc33b5e7. Initial assembly diagnosis: (9, 81) structural/positional differences; instructions 185/185
Remote source equals freshly built baseline; still open 96.51351%. Structural diagnosis: Register-only last after the logged structural/local-lifetime/operand trials. Search declaration permutations on the best newly tested readable context; keep every real initialized assignment, existing exact function and every field/call unchanged. Decode PSQ and FP comparisons; raw ctxdiff and objdiff remain authority.
- Declaration-search context /tmp/fz16r10.init.more.2.c: (9, 64) structural/positional differences; instructions 185/185; initialized real repeated-delay value is40000, with all field writes retained.
- KPADInit register-only last declsearch: declaration block: | KPADInside* kpad; | f32 distanceValue; | f32 sensorDistance; | f32 rotationElement; | f64 negativeSine; | f32 referenceWidth; | f32 referenceHeight; | f32 objectInterval; | f32 zero; | f32 degreesToRadians; | f32 one; | u32 i; | s32 chan; | BOOL enabled; | u16 repeatDelay; | start (6, 64) | improved (6, 53) | improved (6, 50) | best (6, 50) after 312 builds; kept in source: | f32 referenceHeight; | f32 objectInterval; | f32 sensorDistance; | f32 rotationElement; | f64 negativeSine; | f32 referenceWidth; | KPADInside* kpad; | f32 distanceValue; | f32 zero; | f32 degreesToRadians; | f32 one; | u32 i; | s32 chan; | BOOL enabled; | u16 repeatDelay; |
Nonexact declaration candidate restored; (8, 50) structural/positional differences; instructions 185/185.
## libs/RVL_SDK/src/kpad/KPAD KPADRead
Fetch origin/main 805e84045c82629c645e9ef1787c30d2bc33b5e7. Initial assembly diagnosis: (11, 89) structural/positional differences; instructions 459/459
Remote source equals freshly built baseline; still open 97.52723%. Structural diagnosis: New target instruction84 moves available into the real decrement counter before the ring-count clear; prior endpoint tests assigned it after that clear. Extend the real counter lifetime first, then combine statuses+available endpoint and ring-index scope. Preserve the full repeat batch count; test gravity y/x operand order only after the copy structure.
- initialize the actual raw-copy counter before clearing the batch field: (9, 86) structural/positional; instructions 459/459; restored.
- combine early decrement-count initialization and a statuses-plus-available endpoint: (44, 283) structural/positional; instructions 459/459; restored.
Read cursor-scope harness omitted the extracted constant defining the old index block; aborted before source write, corrected, not counted. Real early counter assignment improved89->86/459 before the field clear.
## libs/RVL_SDK/src/kpad/KPAD KPADRead
Fetch origin/main 805e84045c82629c645e9ef1787c30d2bc33b5e7. Initial assembly diagnosis: (11, 89) structural/positional differences; instructions 459/459
Remote source equals freshly built baseline; still open 97.52723%. Structural diagnosis: New target instruction84 moves available into the real decrement counter before the ring-count clear; prior endpoint tests assigned it after that clear. Extend the real counter lifetime first, then combine statuses+available endpoint and ring-index scope. Preserve the full repeat batch count; test gravity y/x operand order only after the copy structure.
- combine early counter initialization and pointer-before-ring-index scope: (40, 282) structural/positional; instructions 459/459; restored.
- give the real copy pointer a leading declaration with the early counter scope: (40, 282) structural/positional; instructions 459/459; restored.
- combine early counter and ring-index scope with target gravity operand order: (36, 282) structural/positional; instructions 459/459; restored.
## libs/RVL_SDK/src/kpad/KPAD read_kpad_acc
Fetch origin/main 805e84045c82629c645e9ef1787c30d2bc33b5e7. Initial assembly diagnosis: (16, 66) structural/positional differences; instructions 400/400
Remote source equals freshly built baseline; still open 98.15%. Structural diagnosis: Further actual inline boundary: the 400-instruction target accepts either FS format through two unsigned equality checks and a shared negative exit. A boolean support predicate may retain that positive-branch graph; compare real unsigned scalar, const sample-pointer and byte-pointer helpers after the smoothing/guard reconstruction, before registers.
- unsigned scalar format with explicit accepted returns: (15, 204) structural/positional; instructions 404/400; restored.
- readonly sample pointer with accepted positive returns: (15, 204) structural/positional; instructions 404/400; restored.
- readonly format-byte pointer with accepted positive returns: (15, 204) structural/positional; instructions 404/400; restored.
- unsigned scalar short-circuit accepted predicate: (13, 197) structural/positional; instructions 403/400; restored.
- unsigned scalar switch returning real format support: (20, 207) structural/positional; instructions 408/400; restored.
## libs/RVL_SDK/src/kpad/KPAD calc_dpd_variable
Fetch origin/main 805e84045c82629c645e9ef1787c30d2bc33b5e7. Initial assembly diagnosis: (14, 45) structural/positional differences; instructions 250/250
Remote source equals freshly built baseline; still open 94.82%. Structural diagnosis: Best anonymous rotation inputs lower45->23/250 while preserving0x20 frame. Target negates directionY before later rotation products and coalesces midpoint-X into the projected-Y expression. Test those actual sign/input/intermediate lifetimes, plus readonly normal inputs, on the anonymous rotation context before declaration search.
- give the real negative direction-Y input an independent lifetime before anonymous products: (13, 34) structural/positional; instructions 250/250; restored.
- name normal-Y then normal-X only at the late positional projection: (24, 45) structural/positional; instructions 250/250; restored.
- reuse the midpoint-X scalar for its actual projected-Y value after projected-X is computed: (12, 35) structural/positional; instructions 250/250; restored.
- use a readonly normal subobject view with anonymous rotation inputs: (10, 23) structural/positional; instructions 250/250; restored.
## Round10 final full clean gate and remaining-function audit
Full non-quick gate across all3 units GATE PASS; DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d; all pools identical;0 regressions/forbidden/readability warnings; every owned data section100%. No data symbol rename or extent correction needed/made. All open target function extents end before/equal the next symbol; no adjacent same-slot word/single/double stack store/reload pair justified new volatile. No byte16/byte8 mask mismatch justified widening.
libs/RVL_SDK/src/kpad/KPAD: exact 24 ->25/29; code 7672 ->7880/13056; data 8032 ->8032/8032.
src/scene/sdChannelSelect/iplSDChannelSelect: exact 122 ->122/129; code 29412 ->29412/33828; data 2960 ->2960/2960.
src/scene/address/iplAddressEdit: exact 90 ->90/94; code 23044 ->23044/27112; data 2560 ->2560/2560.
MAX round produced 1 new exact function; 89 logged successfully built distinct source variants plus312 declaration-search builds (failed builds excluded). All15 remaining functions have >=3 distinct successfully built source variants in this round. Every nonexact source/header trial was restored; only the newly exact SDK function bodies and this log differ from d7821052. Unsupported NWC24-error input contract remains unproved; initialized fallback retained.
- libs/RVL_SDK/src/kpad/KPAD read_kpad_acc 98.15%; 10 successful distinct source trials; 400/400 frame0x50; smoothing/guard reconstruction has only cmpwi5 versus cmplwi5; relational401, positive single-pass399, actual support-predicate helpers403-408; restored.
- libs/RVL_SDK/src/kpad/KPAD calc_dpd_variable 94.82%; 15 successful distinct source trials; 250/250 frame0x20; distance weight and rotation/product schedules; anonymous rotations reduce45->23, true rotation aggregate252, normal/sign/midpoint reuse do not close gap; restored.
- libs/RVL_SDK/src/kpad/KPAD KPADRead 97.52723%; 12 successful distinct source trials; 459/459 frame0xc0; cursor endpoint/index/counter scope and gravity operand schedules; safe u8/u16 full batch counts unchanged89, early real counter reduces86, endpoint scopes frame0xd0/282; restored.
- libs/RVL_SDK/src/kpad/KPAD KPADInit 96.51351%; 9 successful distinct source trials; 185/185 frame0x90; repeat constant/global base and saved FP/matrix colors; actual double sine and matrix scope64, 312-build declaration search50 with6 decoded structural differences; restored.
- src/scene/sdChannelSelect/iplSDChannelSelect create__Q33ipl5scene15SDChannelSelectFv 97.73972%; 3 successful distinct source trials; 145/146 frame0x20; polling condition pointer is reused instead of target body reload; pointer-for-loop148, labels/reference145; restored.
- src/scene/sdChannelSelect/iplSDChannelSelect collectTitlesByUsage__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl 97.81188%; 5 successful distinct source trials; 101/101 frame0x40; four counter/threshold schedules; const name/output cursor unchanged4, true location aggregate17; restored.
- src/scene/sdChannelSelect/iplSDChannelSelect collectTitlesFromNandUsage__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl 97.833336%; 5 successful distinct source trials; 102/102 frame0x40; four counter/threshold schedules; const name/output cursor unchanged4, location aggregate17; restored.
- src/scene/sdChannelSelect/iplSDChannelSelect collectTitlesByChannelOrder__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl 97.29365%; 4 successful distinct source trials; 126/126 frame0x60; entry-address operand order plus counter/threshold schedule; hoisted ID and new row-array/name views remain7; restored.
- src/scene/sdChannelSelect/iplSDChannelSelect collectTitlesBySpecialChannels__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl 97.55125%; 3 successful distinct source trials; 361/361 frame0x80; four repeated count/threshold schedules differ16; readonly name and real output-cursor lifetimes unchanged; restored.
- src/scene/sdChannelSelect/iplSDChannelSelect flushSaveDataAndMountSD__Q33ipl5scene15SDChannelSelectFv 99.65714%; 3 successful distinct source trials; 35/35 frame0x10; heap/manager argument load order differs2; real returned-file/output-field and manager/heap reference lifetimes unchanged; restored.
- src/scene/sdChannelSelect/iplSDChannelSelect setChannelScissor__Q33ipl5scene15SDChannelSelectCFPCQ33ipl5scene12SDChannelObj 93.4721%; 5 successful distinct source trials; 233/233 frame0xe0; framebuffer conversion/projection-width/output lifetimes; branch-local projection width68, anonymous top quotient67, anonymous four quotients71; restored.
- src/scene/address/iplAddressEdit create__Q33ipl5scene11AddressEditFv 97.44634%; 3 successful distinct source trials; 820/820 frame0x60; target one allocation guard and retained two text addresses; ordinary new plus const-pointer/String-pointer/actual text-input pair still818/820; restored.
- src/scene/address/iplAddressEdit get_friendinfo__Q33ipl5scene11AddressEditFv 88.03571%; 3 successful distinct source trials; 82/84 frame0x420; text pointers rematerialize after virtual lookups; const definitions82, complete String pointer83/84, copied friend reference80; restored.
- src/scene/address/iplAddressEdit update_friendinfo__Q33ipl5scene11AddressEditFv 99.42105%; 3 successful distinct source trials; 38/38 frame0x10; wcsncpy source/destination LEAs reversed; const String pointer, full source-array pointer/reference keep2; restored.
- src/scene/address/iplAddressEdit set_err_msg__Q33ipl5scene11AddressEditFPwUl8NWC24Err 98.666664%; 3 successful distinct source trials; 76/75 frame0x60; target leaves message ID undefined for unsupported errors; const cache, anonymous error format input and supported enum still76; initialized fallback retained.
New exact names: KPADSetSensorHeight.
Final full-gate authority lines:
```
[libs/RVL_SDK/src/kpad/KPAD] instruction-exact functions: 25/29
[src/scene/sdChannelSelect/iplSDChannelSelect] instruction-exact functions: 122/129
[src/scene/address/iplAddressEdit] instruction-exact functions: 90/94
GATE PASS
```
Final source-isolation/remote audit: origin/main 8a07484e8aea9bdb38db258f5a6eb16347197c86 has no owned source/header/symbol changes from d7821052. SDK source differs only inside newly exact KPADSetSensorHeight; scene sources, headers, symbol metadata and configure.py unchanged locally. Nonexact trials restored. Commit64bbfbba contains the exact height match and its quick all-unit gate; this final audit records the clean full gate and89 successfully built distinct source variants plus312 declaration builds.

View File

@@ -0,0 +1,244 @@
# EXIF parser reconstruction and aliasing audit
Base: `2a33684c` on `agent/bittle/allhands-jpeg-decompile`; EXIF source itself is
unchanged from baseline `449529d9`. This is a separate candidate from the prior
JPEG converter/IDCT commit. Those files and their logs were left unchanged.
## Retained reconstruction
1. The IFD0 entry parameter is `u8*`, with corresponding call-site casts from the
parser's read-only directory cursor. With the reconstructed `const u8*`
parameter, MWCC hoists all four version-byte loads before their stores.
Removing this unsupported qualifier reproduces the original interleaved
load/store sequence for tags 0x9000, 0x9101 and 0xA000.
2. IFD0's decoded field type is widened to `u32` and both entry fields use the
existing `readExifU16` reader. This reproduces the target's eager zero
extension and initial instruction order; it does not change TIFF field size.
3. IFD1 explicitly includes ignored 0x011C and 0xA000..0xA002 cases alongside
existing ignored tags. Target dispatch compares against 0x011C and 0xA004;
these case labels improve the recovered decision tree. The precise original
no-op case list cannot be proved uniquely, since unknown tags also return
unchanged. No new tag interpretation or payload write is introduced.
4. IFD1 rational denominators use `thumbnailData + (offset + 4)` without a
redundant same-type cast.
No new exact functions. Exact stays 3/6, matched code 1348/5088 bytes, allocated
data 0 bytes / 100%, and linking is unchanged. Unit fuzzy 96.50157 -> 98.94104.
| Function | Before | After | Source/target instructions |
| --- | ---: | ---: | ---: |
| TMCCJPEGDecGetOffsetEXIF | 100 | 100 | 155/155, ctxdiff 0 |
| TMCCJPEGDecGetInfoEXIF | 100 | 100 | 132/132, ctxdiff 0 |
| TMCJPEGDEC_exif_parse | 99.43396 | 99.43396 | 212/212 |
| TMCJPEGDEC_IFD0_tag_parse | 94.46986 | 99.386696 | 480/481 |
| TMCJPEGDEC_IFD1_tag_parse | 93.099174 | 96.14876 | 239/242 |
| TMCJPEGDEC_ThumbnailCheck | 100 | 100 | 50/50, ctxdiff 0 |
IFD0 still lacks the original low-tag `bltlr` leaf. Aligning that instruction and
its branch displacements leaves 32 GPR-operand differences in the two rational
field cases. IFD1 still has decision-tree and register differences. The parser
retains 21 GPR-operand differences. Nothing here claims exact completion.
## Concrete behavioral distinction
An internal IFD0 entry can be arranged with its four version bytes overlapping
the destination by one byte. Initial source bytes 01 02 03 04 produce:
- Baseline compiled code: destination 01 02 03 04
- Original object: destination 01 01 01 01
- Corrected compiled code: destination 01 01 01 01
This is evidence about the internal parser's byte-copy/aliasing behavior. It is
not a claim that ordinary nonoverlapping EXIF input was decoded incorrectly, or
that a public API vulnerability has been established. Both byte orders and all
three version fields were checked at offsets -3 through +3, giving 42 overlap
cases. The unchanged baseline object fails this regression test; the final
object passes all 42. Local destination casts, explicit loops and removal of
other const qualifiers did not fix the discrepancy and were restored.
## Validation
- Pool checked before tuning and after the final build: identical, zero strings
- No allocated non-code sections in either EXIF object
- Fresh official report: all six function scores compared with baseline,
zero regressions; all three exact functions retain ctxdiff zero differences
- Full 4.3U build: PASS
- DOL SHA1: `26116613f624061ba99c8d1a299aaa6efa85670d`
- `git diff --check 2a33684c`: PASS, including the committed candidate diff
- No header/configuration/linking edits, no changes to the separately owned
entropy decoder, no remote writes or original binary data committed
Build/report commands:
```sh
python3 configure.py --version 43U --wrapper ../toolchain/wibo-build/wibo
WIBO_SJIS_MISSING_IMPORTS=1 ../.venv/bin/ninja
build/tools/objdiff-cli report generate -p . -o build/43U/report.json -f json
PYTHONPATH=../local-tools ../.venv/bin/python tools/decomp-assist/pool_diff.py build/43U/src/libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse.o build/43U/obj/libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse.o
PYTHONPATH=../local-tools ../.venv/bin/python tools/decomp-assist/ctxdiff.py libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse <symbol>
../.venv/bin/python tools/decomp-assist/jpeg_exif_differential_audit.py
../.venv/bin/python tools/decomp-assist/jpeg_exif_differential_audit.py --overlap-only
```
## Differential test scope
`jpeg_exif_differential_audit.py` is a read-only bounded integer PPC interpreter
and deterministic test generator. It reads local ELF objects and never writes
original executable bytes to the repository. It is a separate test tool; the
previous converter/IDCT audit remains unchanged.
- 267,282 paired calls, seed 449529
- Every 16-bit tag selector in both byte orders for both IFD handlers
- Field types 0, 3, 4 and 0xFFFF; valid, boundary, out-of-range and wrapping
offsets for supported scalar/rational/byte-array tags
- Header sizes and offsets, valid/invalid byte order and TIFF magic, truncated
entry arrays, IFD0/IFD1/Exif-directory chains and directory-boundary lengths
- 42 overlapping version-byte cases that distinguish baseline from original
- Every non-stack byte compared, including guard regions; parser return values,
stack pointer, LR and GPR14..GPR31 preservation checked
- Complete instruction-address coverage of IFD0 and the central parser in both
objects; IFD1 covers every source instruction and 241/242 target instructions
(one unreachable return in the target dispatch is not visited)
Limitations: this is not formal equivalence or a Wii runtime test. Instruction
coverage is not exhaustive path/input coverage. The custom interpreter models
only the observed integer subset, condition comparisons and internal EXIF calls;
unsupported instructions/relocations/callees fail closed. FPU, XER overflow,
exceptions, timing, cache/MMIO and a full system ABI are not modeled. Relocations
use collision-checked symbol tokens; actual linked addresses are not tested.
Public JPEG I/O, thumbnail decoding, arbitrary pointer values and all possible
payload alias layouts are outside this test. The three exact wrappers are
checked by objdiff/ctxdiff rather than executing their external dependencies.
Run from the repository root with pyelftools and Capstone available, and without
Python's `-O` option. `--source-object` and `--target-object` can select separately
compiled objects, allowing the overlap regression to be reproduced on baseline
without changing the working tree. Final output is in
`jpeg-exif-allhands-differential-results.txt`.
## Existing external branch overlap
Read-only comparison used the already fetched ref
`origin/agent/w1009/tmc` at `cd90be696cb86258a1bc9fb9dc2b304f2bed318d`.
No fetch, author communication, branch checkout or merge was performed.
Its `1c7cf40c` independently removes const from both tag-entry parameters, so the
central IFD0 qualifier correction overlaps. Its `81440c32` then uses a u16 tag,
u16 type and explicit tag remask. Its no-op case ranges differ from this
candidate's explicit ignored tags. It also changes the shared 16-bit reader and
parser declaration order. This candidate does not contain those changes.
An isolated `/tmp` compile of that branch's EXIF source, using the current
checkout's original MWCC flags, produced:
| Measure/function | This candidate | cd90be69 EXIF object |
| --- | ---: | ---: |
| Unit fuzzy | 98.94104 | 99.01337 |
| Central parser | 99.43396 | 98.679245 |
| IFD0 | 99.386696 | 98.37838 |
| IFD1 | 96.14876 | 99.194214 |
| Exact functions | 3/6 | 3/6 |
Neither candidate wholly supersedes the other. This candidate has the better
IFD0 and preserves the current parser score; the external candidate has the
better IFD1. Integration must preserve the parser score and independently
revalidate any combined source. The isolated comparison is not a full gate of
the external branch or its other files.
Relative to baseline 449529d9, the external RGB565 edits concern its setter and
do not overlap the prior candidate's RGB444 body. Its RGBA420 edge edits overlap
that prior candidate's changed expression context. It does not change IDCT.
The previously committed JPEG candidate remains separate and unchanged.
## Attempts
All rejected/equal variants were restored. The lower-tag 0x0100 experiment had a
fuzzy improvement but was explicitly discarded after review: the original
branch shape does not establish that particular no-op label, and it changed
other lower dispatch comparisons. It is absent from the final source.
### trials
```text
TMCJPEGDEC_IFD0_tag_parse word-width-field-type: 94.469860 -> 95.122660; RETAIN
TMCJPEGDEC_IFD0_tag_parse explicit-ignored-compression-return: 95.122660 -> 94.914764; restore
TMCJPEGDEC_IFD0_tag_parse explicit-ignored-compression-break: 95.122660 -> 95.122660; restore
TMCJPEGDEC_IFD1_tag_parse recognized-ignored-planar-and-pixel-tags: 93.099174 -> 95.942150; RETAIN
TMCJPEGDEC_IFD1_tag_parse ignored-low-strip-offset-own-return: 95.942150 -> 95.342970; restore
TMCJPEGDEC_IFD1_tag_parse ignored-orientation-own-return: 95.942150 -> 95.533060; restore
TMCJPEGDEC_IFD1_tag_parse ignored-datetime-own-return: 95.942150 -> 95.528920; restore
```
### control-trials
```text
TMCJPEGDEC_IFD0_tag_parse explicit-unknown-tag-return: 95.122660 -> 94.498960; restore
TMCJPEGDEC_IFD0_tag_parse explicit-unknown-tag-break: 95.122660 -> 95.122660; restore
TMCJPEGDEC_IFD1_tag_parse explicit-unknown-tag-return: 95.942150 -> 95.876030; restore
TMCJPEGDEC_IFD1_tag_parse explicit-unknown-tag-break: 95.942150 -> 95.942150; restore
TMCJPEGDEC_IFD1_tag_parse ifd1-orientation-uses-unknown-exit: 95.942150 -> 95.756195; restore
TMCJPEGDEC_IFD1_tag_parse ifd1-planar-uses-unknown-exit: 95.942150 -> 91.694214; restore
```
### ignored-tag-trials
```text
TMCJPEGDEC_IFD0_tag_parse ignored-image-fields-before-compression: 95.122660 -> 95.110180; restore
TMCJPEGDEC_IFD1_tag_parse ignored-image-fields: 95.942150 -> 95.735535; restore
TMCJPEGDEC_IFD1_tag_parse ifd1-planar-logical-case-order: 95.942150 -> 95.942150; restore
```
### reader-trials
```text
TMCJPEGDEC_IFD0_tag_parse shared-exif-tag-reader: 95.122660 -> 95.195430; RETAIN
TMCJPEGDEC_IFD0_tag_parse shared-exif-type-reader: 95.195430 -> 95.517670; RETAIN
TMCJPEGDEC_IFD0_tag_parse shared-exif-short-reader: 95.517670 -> 95.517670; restore
TMCJPEGDEC_IFD1_tag_parse shared-exif-tag-reader: 95.942150 -> 95.942150; restore
TMCJPEGDEC_IFD1_tag_parse shared-exif-short-reader: 95.942150 -> 95.942150; restore
```
### lower-tag-trials
```text
TMCJPEGDEC_IFD0_tag_parse ignored-lower-tags-(256,): 95.517670 -> 93.004160; restore
TMCJPEGDEC_IFD0_tag_parse ignored-lower-tags-(257,): 95.517670 -> 93.004160; restore
TMCJPEGDEC_IFD0_tag_parse ignored-lower-tags-(258,): 95.517670 -> 95.505196; restore
TMCJPEGDEC_IFD0_tag_parse ignored-lower-tags-(256, 257): 95.517670 -> 93.004160; restore
TMCJPEGDEC_IFD0_tag_parse ignored-lower-tags-(256, 258): 95.517670 -> 93.004160; restore
TMCJPEGDEC_IFD0_tag_parse ignored-lower-tags-(257, 258): 95.517670 -> 95.505196; restore
TMCJPEGDEC_IFD0_tag_parse ignored-lower-tags-(256, 257, 258): 95.517670 -> 95.505196; restore
TMCJPEGDEC_IFD1_tag_parse ignored-lower-tags-(256,): 95.942150 -> 96.665290; RETAIN
TMCJPEGDEC_IFD1_tag_parse ignored-lower-tags-(257,): 96.665290 -> 96.665290; restore
TMCJPEGDEC_IFD1_tag_parse ignored-lower-tags-(258,): 96.665290 -> 95.735535; restore
TMCJPEGDEC_IFD1_tag_parse ignored-lower-tags-(256, 257): 96.665290 -> 96.644630; restore
TMCJPEGDEC_IFD1_tag_parse ignored-lower-tags-(256, 258): 96.665290 -> 96.256195; restore
TMCJPEGDEC_IFD1_tag_parse ignored-lower-tags-(257, 258): 96.665290 -> 95.735535; restore
TMCJPEGDEC_IFD1_tag_parse ignored-lower-tags-(256, 257, 258): 96.665290 -> 95.735535; restore
```
### byte-copy-trials
```text
TMCJPEGDEC_IFD0_tag_parse alias-preserving-version-byte-copy: 95.517670 -> 95.517670; restore
```
### version-loop-trials
```text
TMCJPEGDEC_IFD0_tag_parse forward-version-byte-loops: 95.517670 -> 95.517670; restore
```
### qualifier-trials
```text
TMCJPEGDEC_IFD0_tag_parse mutable-entry-view: 95.517670 -> 99.386696; RETAIN
TMCJPEGDEC_IFD1_tag_parse mutable-entry-view: 95.942150 -> 95.942150; restore
```
### pointer-trials
```text
TMCJPEGDEC_IFD1_tag_parse mutable-rational-byte-view: 95.942150 -> 95.942150; restore
TMCJPEGDEC_IFD1_tag_parse direct-denominator-byte-address: 95.942150 -> 96.148760; RETAIN
```

View File

@@ -0,0 +1,6 @@
TMCJPEGDEC_IFD0_tag_parse 131072 selector cases PASS
TMCJPEGDEC_IFD1_tag_parse 131072 selector cases PASS
TMCJPEGDEC_IFD0_tag_parse 132746 cases PASS; own-body instruction coverage 480 / 480 source; 481 / 481 original
TMCJPEGDEC_IFD1_tag_parse 132704 cases PASS; own-body instruction coverage 239 / 239 source; 241 / 242 original
TMCJPEGDEC_exif_parse 1832 cases PASS; own-body instruction coverage 212 / 212 source; 212 / 212 original
TOTAL 267282 paired EXIF calls PASS

Some files were not shown because too many files have changed in this diff Show More