Match address Mii helpers #29

Merged
coah80 merged 1 commits from codex/worker-address-miiobj-20260921 into main 2026-09-21 21:39:21 +00:00
coah80 commented 2026-09-21 21:39:03 +00:00 (Migrated from github.com)

Adds the remaining small exact functions recovered in src/scene/address/iplAddress.cpp: the VEC2 scalar multiply helper and the Address MiiObj destructor, init, set, reset, and callback.

Validation on current origin/main (27ce4969):

  • iplAddress: 21/101 -> 27/101 exact functions
  • unit fuzzy code: 2.6961815% -> 5.080707%
  • pool_diff.py and focused object build completed
  • ctxdiff.py: 0 instruction differences for all six added functions
  • full 43U build completed
  • build/43U/main.dol SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d

ReAgent material was not used.

Note

Add MiiObj lifecycle helpers and VEC2 scalar multiply in iplAddress

  • Implements the MiiObj destructor, init, reset, create-callback, and set methods in iplAddress.cpp. These manage an associated nigaoe object: creating it from RFL data, binding its texture to material texture unit zero, and tearing it down on reset or destructor.
  • The set method copies an eight-byte identifier, searches official RFL data, and either requests nigaoe manager creation or resets the MiiObj when no data is found.
  • Adds a scalar multiplication operator to ipl.math.VEC2 that multiplies both components by a float and returns the result vector.
  • Risk: MiiObj destructor now frees the MiiObj allocation when the deletion flag is positive and destroys any attached nigaoe object; callers must ensure the object is no longer referenced after destruction.
📊 Macroscope summarized 11a0fed. 1 file reviewed, 2 issues evaluated, 0 issues filtered, 2 comments posted

🗂️ Filtered Issues

Adds the remaining small exact functions recovered in `src/scene/address/iplAddress.cpp`: the VEC2 scalar multiply helper and the Address MiiObj destructor, init, set, reset, and callback. Validation on current `origin/main` (`27ce4969`): - `iplAddress`: 21/101 -> 27/101 exact functions - unit fuzzy code: 2.6961815% -> 5.080707% - `pool_diff.py` and focused object build completed - `ctxdiff.py`: 0 instruction differences for all six added functions - full 43U build completed - `build/43U/main.dol` SHA1: `26116613f624061ba99c8d1a299aaa6efa85670d` ReAgent material was not used. <!-- Macroscope's pull request summary starts here --> <!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. --> <!-- If you delete either of the start / end markers from your PR's description, Macroscope will append its summary at the bottom of the description. --> > [!NOTE] > ### Add `MiiObj` lifecycle helpers and `VEC2` scalar multiply in `iplAddress` > - Implements the `MiiObj` destructor, init, reset, create-callback, and set methods in [iplAddress.cpp](https://github.com/coah80/wii-ipl/pull/29/files#diff-b3414531de53b522b97ea93a663b4425148ead606a4c0ad87ef48ba0b28864c9). These manage an associated `nigaoe` object: creating it from RFL data, binding its texture to material texture unit zero, and tearing it down on reset or destructor. > - The `set` method copies an eight-byte identifier, searches official RFL data, and either requests `nigaoe` manager creation or resets the `MiiObj` when no data is found. > - Adds a scalar multiplication operator to `ipl.math.VEC2` that multiplies both components by a float and returns the result vector. > - Risk: `MiiObj` destructor now frees the `MiiObj` allocation when the deletion flag is positive and destroys any attached `nigaoe` object; callers must ensure the object is no longer referenced after destruction. > > <!-- Macroscope's review summary starts here --> > > <details> > <summary>📊 <a href="https://app.macroscope.com">Macroscope</a> summarized 11a0fed. 1 file reviewed, 2 issues evaluated, 0 issues filtered, 2 comments posted</summary> > > ### 🗂️ Filtered Issues > > </details><!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
macroscopeapp[bot] (Migrated from github.com) reviewed 2026-09-21 21:41:18 +00:00
macroscopeapp[bot] (Migrated from github.com) left a comment
No description provided.
<!-- macroscope-meta: {"kind":"code_review","variant":"195358a06841b2d4d03feb0d212d1ca7"} -->
@@ -212,0 +286,4 @@
li r0, 0
stw r0, 0x20(r31)
miio_reset_done:
lwz r0, 0x14(r1)
macroscopeapp[bot] (Migrated from github.com) commented 2026-09-21 21:41:17 +00:00

🟡 Medium address/iplAddress.cpp:276

Calling set with an unresolvable ID does not actually reset a prior queued request: reset only clears the object at 0x20, while nigaoe::Manager still owns the queued request until its callback runs. The earlier callback then installs the stale Mii texture after the reset. Cancel or invalidate the pending request when entering the reset path.

🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @src/scene/address/iplAddress.cpp around line 276:

Calling `set` with an unresolvable ID does not actually reset a prior queued request: `reset` only clears the object at `0x20`, while `nigaoe::Manager` still owns the queued request until its callback runs. The earlier callback then installs the stale Mii texture after the reset. Cancel or invalidate the pending request when entering the reset path.
🟡 **Medium** `address/iplAddress.cpp:276` Calling `set` with an unresolvable ID does not actually reset a prior queued request: `reset` only clears the object at `0x20`, while `nigaoe::Manager` still owns the queued request until its callback runs. The earlier callback then installs the stale Mii texture after the reset. Cancel or invalidate the pending request when entering the reset path. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary> ```text In file @src/scene/address/iplAddress.cpp around line 276: Calling `set` with an unresolvable ID does not actually reset a prior queued request: `reset` only clears the object at `0x20`, while `nigaoe::Manager` still owns the queued request until its callback runs. The earlier callback then installs the stale Mii texture after the reset. Cancel or invalidate the pending request when entering the reset path. ``` </details> <!-- macroscope-meta: {"kind":"code_review","variant":"195358a06841b2d4d03feb0d212d1ca7"} -->
@@ -212,0 +361,4 @@
blr
}
extern "C" asm void __ml__Q33ipl4math4VEC2CFf() {
macroscopeapp[bot] (Migrated from github.com) commented 2026-09-21 21:41:17 +00:00

🟠 High address/iplAddress.cpp:351

Destroying MiiObj while the RFL queue is delayed leaves a queued callback that later dereferences freed memory, causing use-after-free or a crash. set discards the Manager::create return value, so 0x20 remains null until create_callback runs and __dt__ cannot detach the queued object. Store the returned nigaoe::Object* in 0x20 immediately.

     bl create__Q33ipl6nigaoe7ManagerFPQ23EGG4HeapiiiPFPQ33ipl6nigaoe6ObjectPv
+    stw r3, 0x20(r31)
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @src/scene/address/iplAddress.cpp around line 351:

Destroying `MiiObj` while the RFL queue is delayed leaves a queued callback that later dereferences freed memory, causing use-after-free or a crash. `set` discards the `Manager::create` return value, so `0x20` remains null until `create_callback` runs and `__dt__` cannot detach the queued object. Store the returned `nigaoe::Object*` in `0x20` immediately.
🟠 **High** `address/iplAddress.cpp:351` Destroying `MiiObj` while the RFL queue is delayed leaves a queued callback that later dereferences freed memory, causing use-after-free or a crash. `set` discards the `Manager::create` return value, so `0x20` remains null until `create_callback` runs and `__dt__` cannot detach the queued object. Store the returned `nigaoe::Object*` in `0x20` immediately. ```diff bl create__Q33ipl6nigaoe7ManagerFPQ23EGG4HeapiiiPFPQ33ipl6nigaoe6ObjectPv + stw r3, 0x20(r31) ``` <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary> ```text In file @src/scene/address/iplAddress.cpp around line 351: Destroying `MiiObj` while the RFL queue is delayed leaves a queued callback that later dereferences freed memory, causing use-after-free or a crash. `set` discards the `Manager::create` return value, so `0x20` remains null until `create_callback` runs and `__dt__` cannot detach the queued object. Store the returned `nigaoe::Object*` in `0x20` immediately. ``` </details> <!-- macroscope-meta: {"kind":"code_review","variant":"195358a06841b2d4d03feb0d212d1ca7"} -->
Sign in to join this conversation.