[DO NOT MERGE] C++ migration: Phase-0 plumbing through Wave D10 - #560
[DO NOT MERGE] C++ migration: Phase-0 plumbing through Wave D10#560NathanNeurotic wants to merge 16 commits into
Conversation
…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.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Wave C1 checkpoint is now pushed at Converted: Validation completed before publication:
This remains a draft checkpoint. No PS2 hardware validation is claimed, and |
|
Waves D1-D5 are now published as five separate non-forced fast-forward checkpoints. Remote commits and exact trees:
Validation summary:
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. |
|
Wave D6 is now published as a separate non-forced fast-forward checkpoint.
Validation completed before publication:
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. |
|
Wave D7 is now published as a separate non-forced fast-forward checkpoint.
Validation completed before publication:
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. |
|
Wave D8 is now published as a separate non-forced fast-forward checkpoint.
Validation completed before publication:
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. |
|
Wave D9 is now published as a separate non-forced fast-forward checkpoint.
Validation completed before publication:
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. |
|
Wave D10 is now published as the final high-risk source-conversion checkpoint.
Validation completed before publication:
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. |
…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
|
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. |
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.
nbns.cpplinkage spike.bdmsupport,hddsupport,ethsupport,udpfssupport,mmcesupport, andvcdsupport, plus the typedioPutSimpleActionbridge.OSDHistory,fntsys, andrenderman.textures.dialogs.padand the public controller header's C-linkage guard.texcache.guigame, including the PADEMU import boundary and byte-preserved controller lookup table.dia, including target-verifiedUIItemlayout and preserved public C linkage.themes, with five C++-required type-recovery casts and target-verified theme ABI layouts.elfldr_noreset, retaining the GNU VLA/argv lifetime and exact launch code while restoring explicit public C linkage.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.cpassed 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
628366d1a5935b291ffb321290496dc092f559c4f78d5b061129e9ecc36ef191610124dc538c5bc6a36ff2cd828bf1846e3d630986de6eb108cb24bc54b741b52cc4ccdc730f64943345ee9450b9f87f1c9d9d1934980517d904e21f4efb87276ed519b40bc05ed83fcbac344c50016e9f396f5aab6e15a634c48da9f3fdb1419282bbf88c983c1773d7e89ed4aab18f2f09fff80d5a446a5dfb86483f9cc14d3e89a0046aacb8c0763ded28c75a9714252c8aa2cdedebab1f234011de137b4b6eb63d1af4d099b4e1940efb8459bc829e223094f924f5f2d83f8c19Each 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.2ddf7312df54c925427f843b8f85d45ddf60a53dc9a97bfbb5376d22b65dcea6.77571c0512a95b0eb02f76ea6f5c3e7044165e04e671238bfdaea550db5542d5; exact artifact reached the RiptOPL menu in PCSX2.textures.o; D3's data-only rename leaves all 232 normalized objects exact.a2f8010ee48b19b7d417761bf34e5fffef3876f7c1e0ff4a7f49e03653f16474. Only normalizedpad.odiffers; 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.601a5c6d2cc6af50db85258413cbbfcec726689848b1e0cbd910a158db1e11ff. Only normalizedtexcache.odiffers; loadable data sizes, imports, and all 23 measured stack frames match, while final.textis eight bytes smaller. A deeper optimized-tree comparison found the same canonical semantic-operation multisets in all four codegen-different functions;cacheGetTextureExalso retains the same 128-block optimized CFG and call multiset. The exact artifact rendered the menu in PCSX2 and remained responsive.8246e8f20aecabf2c8097e9064b96b6df006c52c6bce65f223e5f331840b6539. Only normalizedguigame.odiffers. All 24 non-code data payloads (2,177 bytes), 70 imports, 18 global symbol names, and all 36 stack frames match; final.textgrows 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.e10e96ee874f5a7ea267d8ade457c4e39ece926488d37361c643cc03c263eb48. Only normalizeddia.odiffers; all eight non-code payloads (213 bytes), undefined symbols, and 18 public C names match. A target C/C++ probe produced an exact 120-byteUIItemlayout record (sizeof=88, alignment 4, all nested offsets equal). Nineteen of 20 stack frames match;diaRenderUIgrows 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.textshrinks 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.edb6bfcd7edf3b940a285815c064a6bb45e4acc806c5e8da49ff4a606c4c461c. Only normalizedthemes.odiffers; 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-recursivelinkItemsListCoverElemsgrows 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.textgrows 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.edb6bfcd7edf3b940a285815c064a6bb45e4acc806c5e8da49ff4a606c4c461c, strippedopl.elfSHA-256dc52485231e9c1cabb701167192a07035c033c1cd22768024bc8198f659c1eb7. All 232 normalized objects—includingelfldr_noreset.o—match.sysLoadELFKeepIOPretains 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.a6921e51c5f6773cb83c24e541b713f6e721f0d3df439b15bc3a4871a2bfc542; strippedopl.elfSHA-256 is229985e86182346e3ef97a08c6f6f726026a2a79d2cd94c79ec0f124551268a7. Only normalizedsystem.odiffers (231/232 objects exact); final undefined symbols and.data/.rodata/.bss/.ctors/.dtorssizes match, while.textis 88 bytes smaller. Fifteen of 20 opcode streams are exact, includingsysLaunchLoaderElf,sysLaunchDisc, andsysReset; 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.cblob was stored as CRLF because an embedded NUL made Git treat it as binary despitetext=auto. Replacing that byte with textual\0makes the renamed.cppnormalize 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,
UIItemABI, input flow, and the reviewed +16-bytediaRenderUIstack delta, plus D8 theme-pointer ownership, public C linkage, aggregate layouts, renderer/cache call flow, and the reviewed +16-bytelinkItemsListCoverElemsstack 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.