Files
goldeneye-pc-port/port/include/fs.h
T
James Dansereau cd6cc158b6 Add PC port scaffolding (CMake build + port layer)
Initial scaffolding for a PC port of GoldenEye 007, modeled on the
Perfect Dark PC port (same Rare "Indy" engine). The N64 build
(Makefile + IDA) is untouched; the PC build is a parallel CMake build.

Build:
- CMakeLists.txt: SDL2 + zlib + OpenGL. Compiles src/game/*.c + curated
  engine files + libultra audio/gu + port/. Per-region macro sets
  (ROMID US/EU/JP) mirror the N64 Makefile's LCDEFS exactly.
- build-pc.sh, cmake/: configure+build helper and target/SDL2 modules.

Port layer (port/):
- video/audio/input/fs/romdata/config/system/mixer: stubs with
  TODO(Phase N) markers and correct interfaces.
- libultra.c: libultra OS shims (message queues, VI, PI, AI, EEPROM,
  controller, PFS/motor no-ops, region-gated osTvType).
- gesched.c: software-RSP scheduler replacing src/sched.c task submission.
- n64stubs.c: inert stubs for N64-boot + rmon symbols.
- random.c: PRNG ported verbatim from src/random.s (bit-exact).
- ucode.c: RSP/ASP/GSP microcode segment markers (dummies; Phase 3 TODO).

Docs:
- docs/PCPortResearch.md: architecture, GE-specific deltas, phased plan,
  and the scaffolding review (findings A1-A4/B1-B4/C1-C2 + resolutions).
- PORTING.md: top-level entry point.

See docs/PCPortResearch.md for the full plan.
2026-08-17 19:17:06 -04:00

47 lines
1.2 KiB
C

#ifndef PORT_FS_H
#define PORT_FS_H
/*
* Filesystem abstraction over the ROM + data dir.
* Modelled on the PD port's port/include/fs.h.
*
* Provides a small POSIX-ish file API so the port layer (and any game code
* that touches files) has a uniform interface across Windows/Linux/macOS.
*/
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#define FS_MAXPATH 512
typedef struct FSFile FSFile;
/* Open a file. mode is a fopen-style string ("rb", "wb", "r+b", ...). */
FSFile *fsOpen(const char *path, const char *mode);
void fsClose(FSFile *f);
/* Read up to size bytes into buf; returns bytes read (-1 on error/EOF). */
int32_t fsRead(FSFile *f, void *buf, int32_t size);
/* Write size bytes from buf; returns bytes written (-1 on error). */
int32_t fsWrite(FSFile *f, const void *buf, int32_t size);
/* Seek to offset (whence: SEEK_SET/CUR/END). Returns 0 on success. */
int fsSeek(FSFile *f, int32_t offset, int whence);
/* Current file position. */
int32_t fsTell(FSFile *f);
/* File size in bytes. */
int32_t fsSize(FSFile *f);
/* Does the file exist? */
int fsExists(const char *path);
#ifdef __cplusplus
}
#endif
#endif /* PORT_FS_H */