Files
goldeneye-pc-port/port/include/system.h
T
James Dansereau ad3856892a v0.4.1 sync: build and CI fixes, settings presets D440-D447, outside PRs
build-pc.sh Windows temp-dir re-exec fixes; CI pin actions and no-cache ROM
handling; original-N64 and Deck presets; D440 preset labelling; D442 All
unlocked as a RAM/query-time override; D443 settings values (MSAA 16x,
Restart game); D444 front-end Previous/Next paging; D447 Original-aspect
pillarbox/letterbox. Outside contributions by dolent: PRs #120 and #121 (relabelled D445,
D446), merged as dolent's original commits.

Refs: D440 D441 D442 D443 D444 D445 D446 D447 D387 D283 #120 #121
2026-10-06 18:35:39 -04:00

90 lines
2.9 KiB
C

#ifndef PORT_SYSTEM_H
#define PORT_SYSTEM_H
/*
* Platform primitives: time, logging, paths, exit.
* Modelled on the PD port's port/include/system.h.
*/
#include <stdint.h>
#include "platform.h"
#ifdef __cplusplus
extern "C" {
#endif
/* --- Time --------------------------------------------------------------- */
/* Monotonic microseconds since an arbitrary origin. */
uint64_t sysGetMicroseconds(void);
/*
* Base address the executable was loaded at (for turning runtime addresses
* into file offsets for addr2line; ASLR moves the image on Windows).
*/
uintptr_t sysImageBase(void);
/* Wall-clock seconds since the epoch (for timestamps). */
int64_t sysGetTime(void);
/* Sleep for the given number of microseconds. */
void sysSleep(uint32_t micros);
/* --- Logging ------------------------------------------------------------ */
void sysLogPrintf(enum LogLevel level, const char *fmt, ...)
__attribute__((format(printf, 2, 3)));
/*
* Print a fatal error message and terminate the process. Used by fast3d for
* unrecoverable conditions (bad Gfx command, OOM in the texture cache, ...).
*/
void sysFatalError(const char *fmt, ...)
__attribute__((format(printf, 1, 2))) __attribute__((noreturn));
/* --- Paths -------------------------------------------------------------- */
/*
* Resolve a path relative to the data dir. "$S/" prefixes the data dir,
* "$E/" prefixes the executable dir. Returns a pointer to a static buffer.
*/
const char *sysResolvePath(const char *path);
/* Return the directory containing the executable. */
const char *sysGetExeDir(void);
/* --- Command line ------------------------------------------------------- */
/* Store the host argv (call once from main). */
void sysSetArgs(int argc, char **argv);
/* D443: relaunch this executable (same argv/cwd); atexit-time only. 0 = ok. */
int sysRelaunchSelf(void);
/* Nonzero if the given argument (e.g. "--debug-gl") was passed. */
int sysArgCheck(const char *arg);
/* Value following the given argument on the command line, or NULL. */
const char *sysArgGetString(const char *arg);
/* The host argv[1..] joined with spaces, as the game's "cartridge token
* string" (see token.c / osPiReadIo). Lets N64 debug args like "-level_09"
* work on PC. Never NULL; empty string if no args. */
const char *sysGetTokenString(void);
/* --- CPU ---------------------------------------------------------------- */
/* Briefly yield/relax the CPU (busy-wait hint). Used by fast3d's frame sync. */
void sysCpuRelax(void);
/* --- Lifecycle ---------------------------------------------------------- */
void sysExit(int code);
/*
* Start the cooperative thread kernel (green threads + vsync tick). Call
* once from main() before running any game code; after this, blocking
* osRecvMesg() calls in the game suspend/resume threads.
*/
void portKernelInit(void);
#ifdef __cplusplus
}
#endif
#endif /* PORT_SYSTEM_H */