Files
neoLegacy-mac/update.md

113 lines
5.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Iggy 1.2.30 Reconstruction — Status Update
_Generated 2026-07-19_
## Short answers to your questions
- **Is it normal source code yet? Have you gone from pseudocode → normal C?**
**Yes.** The deliverable in `iggy-decompiled/src/reconstructed/` is clean, human-readable,
buildable **C11** — named functions, real control flow, `#if`-gated per-platform layouts,
provenance headers. It is **not** Ghidra pseudocode. The Ghidra pseudocode lives in
`iggy-decompiled/raw/<platform>/` and is the *input* (ground truth), not the output.
- **Where am I?** ~62 of the ~70 substantive translation units are reconstructed and
committed; 9 empty/stub TUs are conclusively classified. What remains is the long tail:
the ~8 **largest** files (the SWF loader + the AVM2 flash display list).
- **When done?** The remaining 8 are the biggest and hardest in the whole codebase
(`swf_as3vm_flash_display` alone is 16,440 lines — larger than everything else combined).
No firm date: this is a marathon tail, each of those is a multi-round effort. By *count*
we're ~88% done; by *code weight* closer to ~60–65%.
## Pseudocode → normal C, concretely
**Before** (Ghidra `raw/durango/…`, machine-recovered pseudocode):
```c
void as3vm_ByteArray__construct(longlong *param_1) {
if (*(longlong *)(as3vm_Capabilities_get_version + *param_1) != 0) {
*(longlong *)(*(longlong *)param_1[3] + 0x27) =
*(longlong *)(as3vm_Capabilities_get_version + *param_1);
...
```
**After** (`src/reconstructed/…`, source-equivalent C):
```c
void as3vm_ByteArray__construct(void *frame) {
void *obj = THISOBJ(frame);
/* pending buffer is a VM-struct field (single-deref), adopted into the object. */
void **pending = (void **)AT(VM(frame), E_PENDBUF);
if (*pending != NULL) {
*(void **)AT(obj, OB_BA_BUFOBJ) = *pending;
...
```
Every reconstructed unit:
- compiles **clean under `-std=c11 -O2 -Wall -Wextra -Werror`** for all four platforms
(durango x64 / orbis x64 / ps3 PPC big-endian / vita ARM);
- exports **exactly** the retail symbol set and imports **exactly** the retail import set
(verified with `llvm-nm` per platform);
- reproduces the retail struct offsets, constant tables, and byte-level data
(verified with `llvm-objdump -s` against the shipped objects);
- has a behavioral test suite (currently ~880 tests, green) **and** an independent
fidelity review against all four platform decompiles before it's committed.
This is a *faithful reconstruction*, not the literal lost original source: it matches
behavior, ABI, and data layout, and the deep/rare code paths are reconstructed to the
recovered structure and reviewed, not stubbed.
## Done so far (this stretch: 34 modules + 9 empty classifications)
**AVM2 / AS3 virtual-machine core (complete):**
as3vm_names, as3vm_create, as3vm_gc, as3vm_class, as3vm_convert, as3vm_property,
as3vm_interpreter (the bytecode dispatch loop), as3vm (pool + public ValueRef API),
as3vm_verifier, as3vm_abc_decode (the ABC file parser), as3_component_helpers.
**AS3 builtin classes:**
imp_array (Array/Vector), imp_math (Math), imp_string (String), classes_base_dummy
(E4X XML stubs), classes_flash_dummy (flash.* stubs), swf_as3_bitmap_data (BitmapData),
swf_as3_misc (Capabilities/Sound/Security/ByteArray/…).
**Utility libraries:** zlib (DEFLATE inflate), dtoa (David Gay float↔string).
**SWF / runtime path:** swf_playhead (timeline), iggy_api_functions (public C API),
and **iggy_main** (the central init/runtime/error/RNG/translation keystone — in its
final review-and-fix round right now).
(Plus the earlier foundation: rrMath, rrstring, arena allocator, unicode, fonts,
sound/mixer, the whole swf_draw / triangulation / stroke render cluster, platform
threads/atomics/time, etc.)
## What's left — the hard tail (~8 units)
| lines | unit | what it is |
|------:|------|------------|
| 16,440 | `swf_as3vm_flash_display` | the AVM2 flash.display list (DisplayObject/Sprite/MovieClip…) — **the giant** |
| 6,635 | `swf_decode` | SWF/`.iggy` tag decoder |
| 6,323 | `swf_play` | movie playback + display-list execution |
| 5,983 | `swf_as3vm` | AS3↔display-object glue |
| 4,341 | `as3vm_imp_misc` | remaining AS3 builtins |
| 3,728 | `swf_as3vm_flash_events` | flash.events (EventDispatcher…) |
| 3,487 | `swf_as3_textfield` | TextField |
| 3,144 | `swf_jpeg` | JPEG decoder |
These are the pieces that turn "the VM and runtime exist" into "a SWF loads, ticks, and
renders through the reconstructed runtime." They're being taken in import-closure order.
## How each module is built (the pipeline, so you know the bar)
1. **RED tests** authored from the four platform objects (exports, imports, owned data
bytes, provenance, ABI) — fails until the source exists.
2. **Implement** to green, faithfully from the raw, reconciled across all 4 platforms.
3. **Independent fidelity review** vs all four decompiles — catches the harness-invisible
defects (32-bit offset bugs, big-endian bitfields, skeleton pipelines).
4. **Fix** the findings; re-review if the change was substantial.
5. Commit only when 4-platform clean + reviewed.
That review step keeps catching real, otherwise-silent bugs — a skeleton verifier, an
offset-broken parser, a swapped GC write-barrier, ungated 32-bit offsets, and (just now)
a phantom struct field in iggy_main. Nothing ships on "the tests pass" alone.
## One tracked follow-up
A narrow, ps3-only, test-invisible residual in `iggy_api_functions` (big-endian
resource-flag bit positions) is documented in-source and captured as a background task
chip; everything else on that module is source-equivalent on all four platforms.