Skip to content

[DO NOT MERGE] C++ migration: Phase-0 plumbing through Wave D10 - #560

Closed
NathanNeurotic wants to merge 16 commits into
rebuild/mainfrom
CPLUSPLUS/ROUND1
Closed

[DO NOT MERGE] C++ migration: Phase-0 plumbing through Wave D10#560
NathanNeurotic wants to merge 16 commits into
rebuild/mainfrom
CPLUSPLUS/ROUND1

Conversation

@NathanNeurotic

@NathanNeurotic NathanNeurotic commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Replaces #543. GitHub could not reopen that draft after its head branch was repaired to remove an accidental CRLF-expanded publication. This PR points at the repaired branch.

What this draft contains

This PR carries the controlled Open PS2 Loader C-to-C++ parity migration through Wave D10.

  • Phase 0: shared C/C++ flags, C++ source selection, dependency tracking, truthful provenance, and the nbns.cpp linkage spike.
  • Wave A: 10 leaf/format translation units.
  • Wave B: 13 language/config/util/I/O/support/archive/VMC/cheat/application/favourites translation units.
  • Wave C1: bdmsupport, hddsupport, ethsupport, udpfssupport, mmcesupport, and vcdsupport, plus the typed ioPutSimpleAction bridge.
  • Wave D1: OSDHistory, fntsys, and renderman.
  • Wave D2: textures.
  • Wave D3: data-only dialogs.
  • Wave D4: pad and the public controller header's C-linkage guard.
  • Wave D5: asynchronous artwork-cache worker texcache.
  • Wave D6: per-game settings UI guigame, including the PADEMU import boundary and byte-preserved controller lookup table.
  • Wave D7: dialog runtime dia, including target-verified UIItem layout and preserved public C linkage.
  • Wave D8: theme renderer themes, with five C++-required type-recovery casts and target-verified theme ABI layouts.
  • Wave D9: no-reset ELF handoff elfldr_noreset, retaining the GNU VLA/argv lifetime and exact launch code while restoring explicit public C linkage.
  • Wave D10: launch/reset/VMC hub system, retaining public ABI and launch ordering while adding only strict-C++ compatibility at C-library, constness, byte-arithmetic, and legacy mutable-argv boundaries.

system.c passed its final high-risk source, ABI/layout, codegen, payload, clean-build, harness, and emulator-startup gates as Wave D10. Targeted real-console launch/reset validation remains outstanding.

Published checkpoints

  • Wave C1: 628366d1a5935b291ffb321290496dc092f559c4
  • Wave D1: f78d5b061129e9ecc36ef191610124dc538c5bc6
  • Wave D2: a36ff2cd828bf1846e3d630986de6eb108cb24bc
  • Wave D3: 54b741b52cc4ccdc730f64943345ee9450b9f87f
  • Wave D4: 1c9d9d1934980517d904e21f4efb87276ed519b4
  • Wave D5: 0bc05ed83fcbac344c50016e9f396f5aab6e15a6
  • Wave D6: 34c48da9f3fdb1419282bbf88c983c1773d7e89e
  • Wave D7: d4aab18f2f09fff80d5a446a5dfb86483f9cc14d
  • Wave D8: 3e89a0046aacb8c0763ded28c75a9714252c8aa2
  • Wave D9: cdedebab1f234011de137b4b6eb63d1af4d099b4
  • Wave D10: e1940efb8459bc829e223094f924f5f2d83f8c19

Each checkpoint was published as a non-forced fast-forward. Its remote Git tree exactly matches the independently validated local tree.

Validation

All accepted waves pass strict GNU++17 pinned PS2DEV compilation and a clean full release link without -fpermissive.

  • Wave C1 packed ELF: 2ddf7312df54c925427f843b8f85d45ddf60a53dc9a97bfbb5376d22b65dcea6.
  • Wave D1 packed ELF: 77571c0512a95b0eb02f76ea6f5c3e7044165e04e671238bfdaea550db5542d5; exact artifact reached the RiptOPL menu in PCSX2.
  • Waves D2 and D3 are byte-identical to D1 at both packed and stripped ELF levels. D2 changes only normalized textures.o; D3's data-only rename leaves all 232 normalized objects exact.
  • Wave D4 packed ELF: a2f8010ee48b19b7d417761bf34e5fffef3876f7c1e0ff4a7f49e03653f16474. Only normalized pad.o differs; final loadable section sizes, imports, global symbols, and all 20 measured stack frames match. The 12 changed opcodes are confined to equivalent boolean scheduling and symmetric inequality operand order. The exact artifact rendered the menu in PCSX2 and remained responsive.
  • Wave D5 packed ELF: 601a5c6d2cc6af50db85258413cbbfcec726689848b1e0cbd910a158db1e11ff. Only normalized texcache.o differs; loadable data sizes, imports, and all 23 measured stack frames match, while final .text is eight bytes smaller. A deeper optimized-tree comparison found the same canonical semantic-operation multisets in all four codegen-different functions; cacheGetTextureEx also retains the same 128-block optimized CFG and call multiset. The exact artifact rendered the menu in PCSX2 and remained responsive.
  • Wave D6 packed ELF: 8246e8f20aecabf2c8097e9064b96b6df006c52c6bce65f223e5f331840b6539. Only normalized guigame.o differs. All 24 non-code data payloads (2,177 bytes), 70 imports, 18 global symbol names, and all 36 stack frames match; final .text grows by 88 bytes. All 36 optimized functions retain exact block counts, call multisets, field-reference multisets, return counts, and switch counts; 23 opcode streams are exact and the other 13 are bounded to boolean lowering, zero-initialization, invariant-load scheduling, and register scheduling. The exact artifact rendered the menu in PCSX2 2.7.525 at 59.95 FPS and remained responsive.
  • Wave D7 packed ELF: e10e96ee874f5a7ea267d8ade457c4e39ece926488d37361c643cc03c263eb48. Only normalized dia.o differs; all eight non-code payloads (213 bytes), undefined symbols, and 18 public C names match. A target C/C++ probe produced an exact 120-byte UIItem layout record (sizeof=88, alignment 4, all nested offsets equal). Nineteen of 20 stack frames match; diaRenderUI grows 192 to 208 bytes while its code shrinks. Fifteen of 20 opcode streams are exact; all 20 optimized functions retain exact call, field, return, and switch summaries, with 18/20 exact block counts. Final .text shrinks by 72 bytes. The exact artifact rendered the menu in PCSX2 2.7.525 and remained responsive; the captured 119.84 FPS was turbo mode, not a performance baseline.
  • Wave D8 packed ELF: edb6bfcd7edf3b940a285815c064a6bb45e4acc806c5e8da49ff4a606c4c461c. Only normalized themes.o differs; all 28 non-code payloads (1,607 bytes), undefined-symbol sets, and 15 public C names match. A target C/C++ probe produced an exact 364-byte theme-layout record across 91 size/alignment/offset values. Fifty-nine of 60 stack frames match; non-recursive linkItemsListCoverElems grows from 32 to 48 bytes while its opcode stream shrinks. Forty-six of 60 opcode streams are exact; all 60 optimized functions retain exact blocks, calls, fields, assignments, conditions, returns, and switches. Final .text grows by 16 bytes. The exact artifact rendered the menu in PCSX2 v2.7.525 and remained live across two observations; the displayed 20-30 FPS / 35-50% speed was emulator mode, not a performance baseline.
  • Wave D9 packed and stripped artifacts are byte-identical to D8: packed SHA-256 edb6bfcd7edf3b940a285815c064a6bb45e4acc806c5e8da49ff4a606c4c461c, stripped opl.elf SHA-256 dc52485231e9c1cabb701167192a07035c033c1cd22768024bc8198f659c1eb7. All 232 normalized objects—including elfldr_noreset.o—match. sysLoadELFKeepIOP retains its exact unmangled 672-byte/168-word body and 64-byte dynamic stack record; all optimized IR summaries and a 116-byte target layout record are exact. The prior D8 PCSX2 menu smoke applies to these same bytes but did not invoke the keep-IOP handoff.
  • Wave D10 packed ELF SHA-256 is a6921e51c5f6773cb83c24e541b713f6e721f0d3df439b15bc3a4871a2bfc542; stripped opl.elf SHA-256 is 229985e86182346e3ef97a08c6f6f726026a2a79d2cd94c79ec0f124551268a7. Only normalized system.o differs (231/232 objects exact); final undefined symbols and .data/.rodata/.bss/.ctors/.dtors sizes match, while .text is 88 bytes smaller. Fifteen of 20 opcode streams are exact, including sysLaunchLoaderElf, sysLaunchDisc, and sysReset; all 20 retain exact call, field, return, and switch summaries, with only the flag helper structurally folded. Nineteen of 20 stack frames match, and critical launch/reset frames are exact. A target C/C++ layout record is byte-exact; 20/20 payload sections are semantically exact; and the flag helper passed 12 known plus 1,000,000 deterministic differential cases. The exact ELF reached and continued rendering the RiptOPL menu in PCSX2 v2.7.525, but no migrated launch/reset path was exercised.

The compiler-IR classifications are supporting evidence, not formal equivalence proofs. Generated evidence and binaries remain local under _audit/ and are intentionally not committed.

Hardware status

No PS2 hardware validation is claimed for these new checkpoints.

D4 still needs native DualShock input/rumble, both ports, reconnect, screen-transition edge handling, DS3/DS4 USB/Bluetooth PADEMU, and MX4SIO/MMCE SIO2-contention tests.

D5 still needs storage-backed successful/missing artwork, queue cancellation, rapid scrolling, theme-switch destruction, BGM contention, launch drain, and USB/HDD/SMB/MMCE/MX4SIO tests on real hardware.

D6 still needs per-game configuration round-trips, PADEMU pages, DS3/DS4 USB/Bluetooth behavior, PadMacro bitfield persistence, VMC creation, GSM/cheat settings, game launch, and MMCE/MX4SIO testing on real hardware.

D7 still needs actual dialog entry/navigation, keyboard and colour editors, Settings L1/R1 traversal, value save/reload, and real-PS2 controller/storage coverage.
D8 still needs built-in/custom theme load/reload, sparse fonts, custom assets, coverflow, per-device filtering, artwork/attribute-glyph/cache paths, settings background, device hotplug, theme switching, BGM/art contention, MMCE/MX4SIO, and real-PS2 testing.
D9 still needs real-PS2 Neutrino and POPSTARTER keep-IOP launches across applicable USB/HDD/BDM/SMB/UDPFS/MMCE/MX4SIO mounts, argv/path rejection cases, delayed teardown, child-loader rejection, target takeover, and return behavior.

D10 still needs real-PS2 standard, Neutrino, POPSTARTER, and keep-IOP launches; IOP reset/module reload; VMC validation/creation; PADEMU/DS34 operation; representative HDD/SMB/USB/MMCE/MX4SIO paths; failure/return behavior; and cold-boot timing.

Review note

The old src/bdmsupport.c blob was stored as CRLF because an embedded NUL made Git treat it as binary despite text=auto. Replacing that byte with textual \0 makes the renamed .cpp normalize to LF, so the aggregate diff shows line-ending churn. Review that file with whitespace ignored to see the substantive edits.

Current status

This PR remains a draft and must not be merged. The controlled source-conversion checkpoints through D10 are published, but the hardware-sensitive paths above are not hardware-proven and validation remains incomplete.

Review focus

Please review C/C++ linkage and ABI preservation, the typed function-pointer queue bridge, Bin2C pointer types, moved device-list initializers, const/signedness compatibility edits, D4 controller codegen classification, D5 artwork-worker ownership/codegen classification, D6 PADEMU linkage/controller-table/bitfield preservation, D7 dialog linkage, UIItem ABI, input flow, and the reviewed +16-byte diaRenderUI stack delta, plus D8 theme-pointer ownership, public C linkage, aggregate layouts, renderer/cache call flow, and the reviewed +16-byte linkItemsListCoverElems stack delta, plus D9 public C linkage, retained VLA/argv lifetime, exact inline-assembly/call sequence, embedded-ELF layouts, and byte-identical release proof, plus D10 DS34 C linkage, cheat-list read-only ABI boundary, launch/reset ordering, target layouts, payload parity, bounded compiler codegen, and explicit hardware-test gaps.

NathanNeurotic and others added 5 commits August 27, 2026 09:03
…e exception)

Four changes, no source touched, C output byte-identical to baseline:

- Shared C/C++ flag set: EE_CXXFLAGS := $(EE_CFLAGS) snapshot taken before
  Makefile.eeglobal folds both into the SDK defaults identically, plus the
  strict freestanding C++ set (-std=gnu++17 -fno-exceptions -fno-rtti
  -fno-threadsafe-statics -fno-use-cxa-atexit). No -fpermissive.
- C++ source rule: src/*.cpp compiles with $(EE_CXX) $(EE_CXXFLAGS);
  generated asm/*.c stays on the C rule (generated sources out of scope).
- EE_DEPS: fix broken substitution reference ($(patsubst %.o,%.d,...));
  -include now actually pulls 232 .d files.
- Truthful provenance: dirty check uses git status --porcelain (catches
  staged and untracked files, not just unstaged).

Gate results (PS2DEVPINNED, fixed /work container path):
- Rebuilt C objects 232/232 byte-identical to archived baseline;
  opl.elf/opl_stripped.elf/RIPTOPL.ELF hashes unchanged.
- Null rebuild = 0 compiles; touching include/config.h recompiles exactly
  the 36 dependent TUs.
- Macro parity: 13-flavour -dM matrix, per-flavour C/C++ diffs limited to
  language-inherent predefined macros; all feature macros (OPL_VERSION,
  PADEMU, RTL/IGS, GSM_1080P, DTL_T10000, OPLDIAG, debug/TTY) identical.
- Dirty tree now versions -dirty correctly; DIRTY= override reproduces the
  baseline version string exactly.
First src/ translation unit compiled as strict GNU++17 under the Phase-0
plumbing. nbns.c renamed to nbns.cpp with zero content change; include/nbns.h
gains the minimal extern "C" guard (owner-approved header exception) so the
three public symbols keep C linkage for the untouched C caller ethsupport.c.

Spike gate evidence (_audit/phase1/, PS2DEVPINNED, version string pinned to
baseline):
- Control reproduced: unchanged C++ compile mangles all three symbols and
  grows nbnsFindName's stack frame 48->64 bytes at identical 136/32/160-byte
  function sizes.
- After conversion: nm shows unmangled nbnsInit/nbnsDeinit/nbnsFindName in
  both obj/nbns.o and linked opl.elf, at the SAME addresses as baseline.
- The 64-byte frame persists post-fix and is explained by disassembly: C++
  object-lifetime rules for the (struct nbnsFindNameResult *)RpcBuffer cast
  force a pointer spill across SifCallRpc. Same instruction count, same
  semantics; documented, not a defect.
- 230/232 objects byte-identical to baseline; obj/ethsupport.o delta is
  debug-info only (nbns.h line shift) - disassembly and all data sections
  byte-identical.
- opl.elf loadable section sizes identical to baseline; zero __cxa_*/_ZN/
  _ZSt runtime symbols.
- Wire protocol probe passes in both languages: sizeof(nbnsFindNameResult)=8,
  offsets 0/4; C++ probe references resolve to the unmangled C names.
- Macro parity extended to PADEMU=0/GSM1080P=0 off-states: unchanged.
Converted under the Phase-0 plumbing, strict GNU++17, no -fpermissive:
httpclient, ps2cnf, ioprp, xparam, gsm, atlas, artindex, folderbrowse,
lz4, zso (src/*.c -> src/*.cpp, EE_OBJS stems unchanged).

Edits beyond the rename, all linkage-preserving or cast-only:
- Minimal extern "C" guards (nbns.h pattern) on 16 include/ headers the
  converted TUs consume: opl, ioman, xparam, ps2cnf, ioprp, config, util,
  system, renderman, pggsm, guigame, atlas, artindex, folderbrowse, hdd,
  hddsupport. Invisible to C compilation.
- Source-local extern "C" wrappers (modules/ headers stay untouched per
  owner rule): httpclient.cpp wraps modules/network/common/httpclient.h;
  gsm.cpp wraps ee_core/include/coreconfig.h; lz4.cpp and zso.cpp wrap
  their text-included modules/isofs bodies so LZ4_*/ziso_* and the
  ziso_alloc/read_raw_data backends keep C linkage for the C callers
  (hddsupport.c, supportbase.c, util.c).
- atlas.cpp: explicit (const char *) cast in atlasCopyData (C++ forbids
  the implicit const void* -> const char* conversion). No const drop.
- modules/isofs/zso.c: two explicit (u8 *) casts in ziso_init (void* ->
  u8*). Valid C; IOP isofs.irx object byte-identical.
- xparam.cpp: extern "C" on the two TU-local globals
  CheckSpecialDiscXParamTitle/ApplyExtraXParamTitle (not declared in
  xparam.h) so no mangled global symbols exist at all.

Wave gate evidence (_audit/phase1/wave-a/, PS2DEVPINNED image, version
string pinned to baseline REVISION=2657 CODE_ANCHOR=679dc31e):
- Full pinned release build passes; per-TU C++ strict compiles pass.
- Debug-stripped object hashes vs 679dc31 baseline: 224/232 identical;
  deltas exactly {nbns (spike), artindex, atlas, folderbrowse, gsm,
  httpclient, ps2cnf, zso}. ioprp/lz4/xparam byte-identical after strip.
- gsm/folderbrowse stripped deltas are symbol-table/section-name only
  (mangled internal-linkage statics); code+rodata bytes identical.
- Real codegen deltas are small register-allocation/scheduling/addressing
  drifts (atlasPlace walk, artIndexMayExist +8B, read_raw_data +16B,
  HttpSendGetRequest -8B, ps2cnfGetBootFile -16B, folderbrowse spill-order
  swaps). .su: every function's stack frame identical C vs C++.
- ps2cnf: C++ lowers isgraph/isspace to newlib calls instead of the
  _ctype_ table; same semantics, link verified.
- opl.elf: zero mangled global symbols, zero __cxa_/_ZN/_ZSt/_ZTI/_ZTV;
  .text +48 bytes total (includes the nbns spike delta); all other
  loadable section sizes identical.
- Raw object hashes of untouched C TUs that include guarded headers move
  by DWARF line shift only (-gdwarf-2 -gz); debug-stripped comparison is
  the parity proof.
- PCSX2 smoke: wave RIPTOPL.ELF boots to the menu at ~60fps/100% speed.
@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@NathanNeurotic

Copy link
Copy Markdown
Owner Author

@techwritescode

@NathanNeurotic NathanNeurotic changed the title C++ migration: Phase-0 plumbing, nbns spike, waves (a)-(b) C++ migration: Phase-0 plumbing through Wave C1 Aug 29, 2026

Copy link
Copy Markdown
Owner Author

Wave C1 checkpoint is now pushed at 628366d1a5935b291ffb321290496dc092f559c4.

Converted: bdmsupport, hddsupport, ethsupport, udpfssupport, mmcesupport, and vcdsupport.

Validation completed before publication:

  • strict GNU++17 pinned release build and final link passed;
  • 232-vs-232 whole-tree stripped-object comparison changed only the six converted objects plus the intentional ioman.o bridge;
  • all original global C symbols were preserved;
  • moved 112-byte device-list initializers and callback relocations match their C controls;
  • converted-unit stack frames are unchanged;
  • exact packed ELF SHA-256 is 2ddf7312df54c925427f843b8f85d45ddf60a53dc9a97bfbb5376d22b65dcea6;
  • the exact artifact reaches the RiptOPL main menu in PCSX2 2.7.525.

This remains a draft checkpoint. No PS2 hardware validation is claimed, and elfldr_noreset.c / system.c are not included. For bdmsupport, use whitespace-ignored review because removing its historical embedded NUL also lets Git normalize the old CRLF blob to LF.

@NathanNeurotic NathanNeurotic changed the title C++ migration: Phase-0 plumbing through Wave C1 [DO NOT MERGE] C++ migration: Phase-0 plumbing through Wave C1 Aug 29, 2026
@NathanNeurotic NathanNeurotic changed the title [DO NOT MERGE] C++ migration: Phase-0 plumbing through Wave C1 [DO NOT MERGE] C++ migration: Phase-0 plumbing through Wave D5 Aug 30, 2026

Copy link
Copy Markdown
Owner Author

Waves D1-D5 are now published as five separate non-forced fast-forward checkpoints.

Remote commits and exact trees:

  • D1 f78d5b061129e9ecc36ef191610124dc538c5bc6 — tree 957a50ada4d49c35cbc1969c2c2db60459e6bbd6
  • D2 a36ff2cd828bf1846e3d630986de6eb108cb24bc — tree 23da1fb0541c07613a68d601a49f587b0592a7a9
  • D3 54b741b52cc4ccdc730f64943345ee9450b9f87f — tree 85d32f205016dea77c6bc167aecd7144cfa8af36
  • D4 1c9d9d1934980517d904e21f4efb87276ed519b4 — tree 012559b9804028769a1fe2d940c0a40f8f589a44
  • D5 0bc05ed83fcbac344c50016e9f396f5aab6e15a6 — tree 5b6ad012232bc12a2ab95b2a1b5868d7c5d2bf33

Validation summary:

  • every wave passes strict GNU++17 clean pinned release build/link;
  • D2 and D3 packed/stripped ELFs are byte-identical to D1 (77571c0512a95b0eb02f76ea6f5c3e7044165e04e671238bfdaea550db5542d5);
  • D4 changes only normalized pad.o, preserves sections/imports/symbols/stack frames, and its exact ELF (a2f8010e…6474) reaches the PCSX2 menu;
  • D5 changes only normalized texcache.o, preserves loadable data/imports/stack frames, has an eight-byte-smaller .text, and its exact ELF (601a5c6d…e11ff) reaches the PCSX2 menu;
  • D5's four codegen-different functions have exact canonical optimized semantic-operation multisets; this is supporting evidence, not formal proof.

This PR remains draft / DO NOT MERGE. No PS2 hardware validation is claimed. D4 controller/PADEMU/SIO2 behavior and D5 storage-backed art/cancellation/theme-switch/launch-drain behavior still require targeted console testing. elfldr_noreset.c and system.c remain excluded.

@NathanNeurotic NathanNeurotic changed the title [DO NOT MERGE] C++ migration: Phase-0 plumbing through Wave D5 [DO NOT MERGE] C++ migration: Phase-0 plumbing through Wave D6 Aug 30, 2026

Copy link
Copy Markdown
Owner Author

Wave D6 is now published as a separate non-forced fast-forward checkpoint.

  • Remote commit: 34c48da9f3fdb1419282bbf88c983c1773d7e89e
  • Exact remote/local tree: 79de42b4a24e521a8a152b1788030e69f9bca194
  • Scope: 99% rename of src/guigame.c to src/guigame.cpp, C linkage around DS3/DS4 imports, const-correct Bluetooth-version strings, and a byte-preserved C++17 rewrite of the indexed controller lookup initializer.

Validation completed before publication:

  • strict GNU++17 per-TU compile and clean pinned full release build/link passed;
  • 231/232 normalized objects are exact; only guigame.o differs;
  • all 24 non-code data payloads (2,177 bytes), both 17-byte controller tables, 70 imports, 18 global symbol names, and all 36 stack frames match;
  • final .text grows by 88 bytes; 23/36 opcode streams are exact, and optimized block/call/field/return/switch summaries match for all 36 functions;
  • the remaining codegen is bounded to C-vs-C++ boolean lowering, local zero-initialization, invariant-load scheduling, and register scheduling;
  • exact packed ELF SHA-256 is 8246e8f20aecabf2c8097e9064b96b6df006c52c6bce65f223e5f331840b6539;
  • that exact artifact rendered the RiptOPL menu in PCSX2 2.7.525 at 59.95 FPS and remained responsive.

This remains draft / DO NOT MERGE. No PS2 hardware validation is claimed. Per-game config round-trips, PADEMU/DS3/DS4, PadMacro persistence, VMC, GSM/cheats, launch, MMCE, and MX4SIO still require targeted console testing. elfldr_noreset.c and system.c remain excluded.

@NathanNeurotic NathanNeurotic changed the title [DO NOT MERGE] C++ migration: Phase-0 plumbing through Wave D6 [DO NOT MERGE] C++ migration: Phase-0 plumbing through Wave D7 Aug 30, 2026

Copy link
Copy Markdown
Owner Author

Wave D7 is now published as a separate non-forced fast-forward checkpoint.

  • Remote commit: d4aab18f2f09fff80d5a446a5dfb86483f9cc14d
  • Exact remote/local tree: ffa7b1cb154b036031bf3adb474ca5d1e53879db
  • Scope: 99% rename of src/dia.c to src/dia.cpp, with only the C++-required exact two-byte null initializer and malloc result cast.

Validation completed before publication:

  • strict target C/C++ per-TU probe and clean pinned full release build/link passed;
  • 231/232 normalized objects are exact; only dia.o differs;
  • all eight non-code data payloads (213 bytes), undefined-symbol sets, and 18 public C symbol names match;
  • a target-compiled 120-byte UIItem layout record is byte-exact between C and C++ (sizeof=88, alignment 4, all nested union/callback/trailing-field offsets equal);
  • final .text shrinks by 72 bytes;
  • 15/20 opcode streams are exact; all 20 optimized functions retain exact call, field-reference, return, and switch summaries, with 18/20 exact block counts;
  • 19/20 stack frames match; diaRenderUI grows from 192 to 208 bytes (+16), explicitly reviewed and retained while its emitted code shrinks;
  • exact packed ELF SHA-256 is e10e96ee874f5a7ea267d8ade457c4e39ece926488d37361c643cc03c263eb48;
  • that exact artifact rendered the RiptOPL menu in PCSX2 2.7.525 and remained responsive. The captured 119.84 FPS was turbo mode, not a performance baseline.

This remains draft / DO NOT MERGE. The emulator smoke did not enter a dialog. Dialog navigation, keyboard/colour editors, Settings L1/R1 traversal, value save/reload, and real-PS2 controller/storage coverage still require targeted testing. elfldr_noreset.c and system.c remain excluded.

@NathanNeurotic NathanNeurotic changed the title [DO NOT MERGE] C++ migration: Phase-0 plumbing through Wave D7 [DO NOT MERGE] C++ migration: Phase-0 plumbing through Wave D8 Aug 30, 2026

Copy link
Copy Markdown
Owner Author

Wave D8 is now published as a separate non-forced fast-forward checkpoint.

  • Remote commit: 3e89a0046aacb8c0763ded28c75a9714252c8aa2
  • Exact remote/local tree: 6a25a27d84f45c28e2feeaca5c29014186e07e7e
  • Scope: 99% rename of src/themes.c to src/themes.cpp, with one C++-required malloc result cast and four explicit void * to item_list_t * ownership-recovery casts.

Validation completed before publication:

  • strict target C/C++ per-TU probes and clean pinned full release build/link passed;
  • 231/232 normalized objects are exact; only themes.o differs;
  • all 28 non-code payloads (1,607 bytes), undefined-symbol sets, and 15 public C symbol names match;
  • a target-compiled 364-byte theme-layout record is byte-exact between C and C++ across 91 size/alignment/offset values;
  • 46/60 opcode streams are exact, while all 60 optimized functions retain exact block, call, field, assignment, condition, return, and switch summaries;
  • 59/60 stack frames match; non-recursive linkItemsListCoverElems grows from 32 to 48 bytes (+16) while its emitted opcode stream shrinks;
  • final .text grows by 16 bytes;
  • exact packed ELF SHA-256 is edb6bfcd7edf3b940a285815c064a6bb45e4acc806c5e8da49ff4a606c4c461c;
  • that exact artifact rendered the RiptOPL main menu in PCSX2 v2.7.525 and remained live across two observations. The displayed 20-30 FPS / 35-50% speed was emulator mode, not a performance baseline.

This remains draft / DO NOT MERGE. No PS2 hardware validation is claimed. Built-in/custom themes, sparse fonts/assets, coverflow, per-device filtering, artwork/glyph/cache behavior, settings background, hotplug/theme switching, BGM contention, MMCE/MX4SIO, and real-PS2 behavior still require targeted testing. elfldr_noreset.c and system.c remain separately gated and excluded.

@NathanNeurotic NathanNeurotic changed the title [DO NOT MERGE] C++ migration: Phase-0 plumbing through Wave D8 [DO NOT MERGE] C++ migration: Phase-0 plumbing through Wave D9 Aug 30, 2026

Copy link
Copy Markdown
Owner Author

Wave D9 is now published as a separate non-forced fast-forward checkpoint.

  • Remote commit: cdedebab1f234011de137b4b6eb63d1af4d099b4
  • Exact remote/local tree: 46aa35c890e3d4d0e672e88f9e03cf4c91802b7a
  • Scope: 98% rename of src/elfldr_noreset.c to src/elfldr_noreset.cpp, plus inclusion of system.h so sysLoadELFKeepIOP retains and type-checks its public C linkage. The GNU VLA and every handoff operation remain source-identical.

Validation completed before publication:

  • strict target C/C++ probes and clean pinned full release build/link passed without diagnostics;
  • all 232 normalized objects are byte-identical, including elfldr_noreset.o;
  • packed ELF SHA-256 remains edb6bfcd7edf3b940a285815c064a6bb45e4acc806c5e8da49ff4a606c4c461c;
  • stripped opl.elf SHA-256 remains dc52485231e9c1cabb701167192a07035c033c1cd22768024bc8198f659c1eb7;
  • sysLoadELFKeepIOP retains its exact unmangled 672-byte / 168-word body and exact 64-byte dynamic stack record;
  • optimized blocks, calls, fields, assignments, conditions, PHIs, returns, and switches are all exact;
  • a PS2-target 116-byte C/C++ layout record for pointer widths and both embedded-ELF structs is byte-exact.

The D9 packed ELF is literally the D8 ELF already observed at the PCSX2 menu, so a separate menu boot cannot distinguish this checkpoint. That smoke did not invoke the no-reset handoff.

This remains draft / DO NOT MERGE. No real-PS2 keep-IOP validation is claimed. Neutrino/POPSTARTER launches across live device mounts, argv/path rejection, delayed teardown, child-loader rejection, target takeover, and return behavior still require targeted hardware tests. system.c remains separately gated and excluded.

@NathanNeurotic NathanNeurotic changed the title [DO NOT MERGE] C++ migration: Phase-0 plumbing through Wave D9 [DO NOT MERGE] C++ migration: Phase-0 plumbing through Wave D10 Aug 31, 2026

Copy link
Copy Markdown
Owner Author

Wave D10 is now published as the final high-risk source-conversion checkpoint.

  • Remote commit: e1940efb8459bc829e223094f924f5f2d83f8c19
  • Exact remote/validated-local tree: 60bb4419d522b517f3c8f9714724c4284950af0c
  • Scope: 99% rename of src/system.c to src/system.cpp, with only strict-C++ compatibility edits for DS34 C linkage, private table constness, legacy mutable argv boundaries, signedness, the source-audited read-only cheat-list ABI boundary, and explicit byte arithmetic.

Validation completed before publication:

  • strict target C/C++ probe and clean pinned full release build/link passed without candidate diagnostics or new C++ runtime symbols;
  • 231/232 normalized objects are exact; only system.o differs;
  • final undefined-symbol sets and .data/.rodata/.bss/.ctors/.dtors sizes match; final .text is 88 bytes smaller;
  • 15/20 function opcode streams are exact, including sysLaunchLoaderElf, sysLaunchDisc, and sysReset; all 20 retain exact call, field, return, and switch summaries;
  • 19/20 stack frames match, with every critical launch/reset frame exact;
  • target C/C++ layouts are byte-exact; all 20 payload sections are semantically exact; the sole raw payload difference is literal ordering with the same string set;
  • the flag helper passed 12 known plus 1,000,000 deterministic differential cases;
  • exact packed ELF SHA-256: a6921e51c5f6773cb83c24e541b713f6e721f0d3df439b15bc3a4871a2bfc542;
  • that exact ELF reached and continued rendering the RiptOPL menu in PCSX2 v2.7.525.

This PR remains a draft and is not ready for review or merge. No reviewers were requested. No PS2 hardware validation is claimed. Standard, Neutrino, POPSTARTER, and keep-IOP launches; IOP reset/module reload; VMC; PADEMU/DS34; storage backends; failure/return behavior; and cold-boot timing still require targeted real-console testing.

NathanNeurotic added a commit that referenced this pull request Sep 4, 2026
…to phaseDout

Brings PR #560's 12 commits into the ps2build-port branch so #560 can
be closed: 18 src/*.c -> .cpp conversions (auto-merged; the ethsupport
ps2ip/lwip include fix carried into ethsupport.cpp), header extern-C
guards, wave-b strict cleanup.

Merge fixups for the ps2build side:
- ps2.yaml opl sources: 18 .c -> .cpp renames
- opl cflags: add the Makefile EE_CXXFLAGS freestanding set
  (-std=gnu++17 -fno-exceptions -fno-rtti -fno-threadsafe-statics
  -fno-use-cxa-atexit) now that opl compiles C++ TUs
@NathanNeurotic

Copy link
Copy Markdown
Owner Author

Superseded by #602: all 13 commits from CPLUSPLUS/ROUND1 (wave-b strict cleanup + 11 Convert-to-C++ waves through D10) were merged into phaseDout as 2c65d5e. Nothing is lost - the full history is reachable from #602, which also carries the ps2build port on top. Post-merge build verified green: clean two-pass ps2build build, 722 steps, opl.elf 4,068,032 B + opl-packed.elf, 148/148 assets real.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant