Files
goldeneye-pc-port/port/include/romdata.h
T
James Dansereau 2aad171344 PC port: Phase 1 boot-to-window (ROM load + map + SDL2 clear loop)
- scripts/gen_romassets.py: emit absolute cart-address asset symbols
  (0x10000000 + rom_offset) from filelist.<r>.csv + the asset .s files,
  in file_resource_table.inc.c order. US region (romassets_u.s).
- romdata.c: load/validate the GE-specific header (magic, name @0x20,
  cart ID @0x3C, country @0x3E) and map the .z64 at cart base 0x10000000
  so every &asset-symbol is a live host pointer.
- libultra.c: osPiStartDma/osPiRawStartDma now service reads as
  bounds-checked memcpys from the mapped ROM (synchronous completion).
- system.c: implement sysResolvePath ($S data dir, $E exe dir).
- video.c: real SDL2 window + GL context + clear/swap frame loop with
  FPS accounting; main.c runs a Phase 1 demo loop (ESC quits) until the
  software RSP/scheduler can drive mainproc().
- CMakeLists: project(... ASM), wire romassets_<region>.s, drop
  assetstubs.c (replaced by generated symbols); n64stubs.c keeps only
  pure-RAM segment markers.
- docs: findings D18-D23 (header offsets, BE music table, .rz tracks,
  scanner-prefixed manifest names, CMake ASM gotcha, absolute-symbol
  approach).

Verified: baserom.u.z64 (12MB) passes validation and maps at 0x10000000;
window opens and renders until killed; asset offsets spot-checked against
ROM bytes (music bank seqCount=63 BE, first track offset 508).
2026-08-20 22:19:45 -04:00

50 lines
1.4 KiB
C

#ifndef PORT_ROMDATA_H
#define PORT_ROMDATA_H
/*
* ROM loading: reads the .z64 ROM from the data dir and exposes its segments.
* Modelled on the PD port's port/include/romdata.h.
*
* The N64 build links assets in from the ROM at fixed addresses. The PC port
* instead loads the ROM file and maps the game's data segments (code, data,
* assets) into a heap-allocated image, then patches the segment table so the
* game's IMAGESEG / asset references resolve into that image.
*/
#include <PR/ultratypes.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Load the ROM for the configured ROMID from the data dir.
* Returns 0 on success, non-zero on failure.
*/
int romdataInit(void);
void romdataDestroy(void);
/* Pointer to the loaded ROM image (start of the .z64). When the image is
* mapped at the N64 cart base this is 0x10000000 itself. */
const u8 *romdataGetRom(void);
/* Size of the loaded ROM in bytes. */
u32 romdataGetRomSize(void);
/*
* True if [addr, addr+size) is a valid cart address (0x10000000+) inside the
* mapped image. The PI shims call this before servicing DMA.
*/
int romdataCartAddrValid(u32 addr, u32 size);
/*
* Map an N64 virtual address (0xA0000000 RDRAM space) to the corresponding
* pointer in the loaded image. Used to resolve asset/segment references.
*/
const void *romdataMapVa(u32 va);
#ifdef __cplusplus
}
#endif
#endif /* PORT_ROMDATA_H */