[DO NOT MERGE] C++ migration (waves through D10) + ps2build port - #602
Draft
NathanNeurotic wants to merge 28 commits into
Draft
[DO NOT MERGE] C++ migration (waves through D10) + ps2build port#602NathanNeurotic wants to merge 28 commits into
NathanNeurotic wants to merge 28 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.
…-layout SDK <ps2ipee.h> is unusable (const-conflicting ps2ip_setconfig declaration, macro-expanded to libcglue_); use <ps2ip.h> + real lwip headers under __has_include so the classic flat-sdk build is untouched. See _ps2build_compat/GAPS.md #14c.
|
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 |
Both were workarounds for real ps2build/sdk-core gaps that are now
fixed upstream - see CONTEXT.md for the full writeup and exact commits/
releases. Summary:
- ps2.yaml no longer hardcodes C:/Users/natha/... anywhere (was 1218
occurrences in the generated IOP section alone, plus ~40 more in the
hand-authored EE targets). Everything now resolves via libs:/headers:
against installed package names, same mechanism the EE side already
used correctly - ps2build's libs:/headers: resolution now falls back
to a package's driver artifact (most real IOP kernel modules are
kind: driver, never kind: library) instead of silently resolving
nothing for them.
- gen_iop_yaml.py's PKG constant/BASE_INCS are gone - no host-specific
substitution needed anymore. The two BDM cdvdman variants now link
the real bdm package's libbdm.a (libs: ["bdm"]) instead of compiling
a vendored bd_cache.c/bd_defrag.c copy.
- _ps2build_compat/{include,include_iop,libbdm}/ removed entirely -
irx.h/types.h/defs.h/fcntl.h/sys-*.h were always real, already-shipped
loadcore files (just unreachable by package name before); atad.h/
aifdev9.h/ps2ip.h/bdm.h now resolve the same way, with 4 small
sdk-core package.yaml fixes (they'd always shipped these headers, just
never declared include_dirs: for them).
_ps2build_compat/gen_assets.py (+ its generated gen/*.c output) is
untouched - the one piece ps2build still has no replacement for.
Verified: full clean ps2build build (0 errors), opl.elf boots
identically under PCSX2 before and after this change.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The cleanup patch's ROOT-based -include baked the generator-runner's absolute checkout path (D:/_PLATFORMS/... on tech's machine) into the committed ps2.yaml. Emit the bare filename instead - ports/playstation2 is already on the include path and -include searches -I dirs. Also normalize CRLF when reading ps2.yaml: on a CRLF working copy the strip marker missed and the IOP section got appended twice.
Replaces _ps2build_compat/ with tools/ - gen_assets.py stays (still the only way to embed arbitrary files, see the wider ps2build feature discussion this maps to), gen_iop_yaml.py is gone entirely, and the two report docs (GAPS.md, UPSTREAM-REPORT.md) are gone too - their content is superseded by the fixes now landed upstream. - ps2.yaml's 38 IOP module headers: lists (identical, ~35 entries each) collapse to one YAML anchor + 37 aliases - native to the format, no generator needed to keep them in sync. - 25 of those same modules' sources: converted from hand-listed files to a glob (*.c/*.S) - every one verified against the real directory first; the handful that share a directory with another variant, or span multiple subdirectories, keep an explicit list since a glob there would silently pull in the wrong files. - gen_assets.py: ADP_ASSETS is now glob-derived (audio/*.adp matched the hand list exactly). PNG_ASSETS stays hand-listed - gfx/*.png has 13 files with zero references anywhere in the source, so globbing it would have embedded dead weight. Also drops the two remaining machine-specific absolute-path fallbacks (bin2c, PS2DEV default). - Output moves to tools/generated/, gitignored alongside build/. Verified for real: full clean rebuild (722 steps, 0 errors), opl.elf boots identically under PCSX2 to every earlier pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> [conflict resolution on apply: accepted upstream deletion of GAPS.md/UPSTREAM-REPORT.md/gen_iop_yaml.py over local doc/generator updates (kept in history); retained the hermetic bare-filename -include fix for lwnbdsvr in ps2.yaml]
tools/generated/*.c via ps2build v2026.09.04.2 sources: globbing; ps2.yaml is now 910 lines, ~1/3 of the pre-anchor/pre-glob size. Errors loud at generate time if tools/gen_assets.py hasn't run.
With PS2DEV unset the script silently stubbed all 30 package IRXs and still linked a broken opl.elf. Fall back to 'ps2build config get ps2dev' (ps2build's own fallback chain) and exit loudly if neither yields a valid packages/ dir. Also refresh the handoff doc for the tools/ layout, pack: true, and the upstream sweep.
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of the 1034-line Makefile build to
ps2build+ the $PS2DEV/packages/{core,world} layout.Status: GREEN -
ps2build build -c ps2.yamlproduces a workingopl.elf(boots in PCSX2; real-hardware test pending), all 38 IOP modules, ee_core, elfldr, 148/148 embedded assets real.Changeset (3 commits):
build: ps2build port- ps2.yaml (all EE + IOP targets incl. multi-variant cdvdman/mcemu/pademu families), _ps2build_compat/ generators + compat headers + vendored libbdm pieces, GAPS.md gap log, UPSTREAM-REPORT.mdfix(ethsupport)- the only EE source edit (ps2ip/lwip includes; works around the ps2ipee.h const bug)fix(cdvdman)- one added sysmem import (FreeSysMemory)For upstream (ps2dev/ps2build): see
_ps2build_compat/UPSTREAM-REPORT.md- broken ogg/vorbis/jpeg release zips (host-compiled), ps2ipee.h const conflict, missing packaged headers, MSVC-debug tool zips, bin2c missing, ps2build feature requests (file embedding, codegen hooks, ps2pack step).Relationship to #560: branched from the wave-(b) checkpoint of the C++ migration; does NOT contain ROUND1's 11 later Convert-to-C++ commits - those are still needed and this PR must not be rebased over them. Reconciling ps2.yaml source lists with the .cpp renames is follow-up work.
Do not merge.