Files
goldeneye-pc-port/port/shim/string.h
T
James Dansereau 5ea46fabc1 PC port: full compile + link milestone (ge007.x86_64.exe builds clean)
All ~235 translation units now compile and the target links under MSYS2
GCC 16 + CMake/Ninja (ninja ge007 -k 0: 236/236, zero errors). N64 build
untouched; every src/ change is -DPORT-gated.

Portability fixes (findings D7-D17 in docs/PCPortResearch.md section 11):
- AI X-macro system: SWITCH() call sites activated to the author's
  hand-written byte-identical references under PORT; port/shim/
  bondaicommands.h + bondconstants.h + CPPLib.h re-emit the IDO paste
  tricks (isSubroutine, file-record macros, generated CALL) GCC-clean.
- 64-bit pointer-in-word initializers: monAnim jump targets now go
  through an index table resolved by the interpreter (chrai.h/propobj.c);
  UsetuplenZ.c credits pointer PORT-gated to 0.
- IDO printf engine compiled for PC (xprintf/xlitob/xldtob) with a
  shadow xstdio.h resolving the _Printf prototype clash.
- Host-libc gaps stubbed in port/: bcopy/bzero, __libm_qnan_f,
  tlbmanage*, g_ViXScales/YScales; chrObjRandom PRNG ported from .s.

Asset data strategy (D16): single-file assets compiled for real
(animation tables, fonts, textures, rareware logo); obseg per-file .c
excluded (colliding file-local globals the N64 build isolates via
per-ELF linking); 758 ROM-derived table symbols + ramrom_* + segment
markers stubbed in port/src/assetstubs.c / n64stubs.c.

fast3d is a no-op placeholder (port/src/gfxstub.c) until Phase 2 brings
in the real software RSP. Binary not yet runnable end-to-end: ROM
loading in romdata.c is still a TODO.
2026-08-20 20:27:06 -04:00

25 lines
1.1 KiB
C

/*
* PC port shim for include/string.h (see docs/PCPortResearch.md §11 D12).
*
* The N64 header declares:
*
* extern size_t strlen(const unsigned char *);
* extern unsigned char *strchr(const unsigned char *, int);
*
* GCC treats `const unsigned char *` and `const char *` as distinct types
* (even with -funsigned-char), so these conflict with the host declarations
* that SDL2/SDL_stdinc.h and intrin.h pull in via their own
* `#include <string.h>`. On the port the host libc provides memcpy/strlen/
* strchr, and every game call site passes `u8 *` (== `unsigned char *`),
* which compiles against the host prototypes with at most a pointer-type
* warning. So the shim simply maps `<string.h>` to the HOST header.
*
* The host header is included by absolute path through the generated
* hoststring.h (CMake derives it from the compiler location, since this
* file sits earlier on the include path than the toolchain's own string.h
* and #include_next would find the N64 header first).
*
* Inert in the N64 build (port/shim is not on its include path).
*/
#include "hoststring.h"