Files
goldeneye-pc-port/port/include/config.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

79 lines
3.0 KiB
C

#ifndef PORT_CONFIG_H
#define PORT_CONFIG_H
/*
* INI configuration (ge007.ini).
* Modelled on the PD port's port/include/config.h.
*
* A tiny key=value store. Options register themselves (usually via a
* PD_CONSTRUCTOR) and are loaded from / saved to the ini in the data dir.
*/
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Load the config file (no-op if it doesn't exist yet). */
void configLoad(void);
/* Save the current values back to the config file. */
void configSave(void);
/* Register an integer option. min==max disables clamping. */
void configRegisterInt(const char *key, int *value, int min, int max);
/* Register an unsigned option. min==max disables clamping. */
void configRegisterUInt(const char *key, unsigned int *value, unsigned int min, unsigned int max);
/* Register a float option. min==max disables clamping. */
void configRegisterFloat(const char *key, float *value, float min, float max);
/* Register a string option (buf must live for the program's lifetime). */
void configRegisterString(const char *key, char *value, int bufSize);
/* Set / read a registered int/uint/float option by dotted key (clamped like
* a file load). Return 1 if the key exists. Used by the settings presets. */
int configSetValue(const char *key, double v);
int configGetValue(const char *key, double *out);
/* [Debug] knobs, env-var-or-ini. GE_PCDUMP / GE_INPUTLOG override the ini. */
const char *configGetFrameDump(void); /* "lo-hi[:step]" or NULL if unset */
int configGetInputLog(void);
/* ------------------------------------------------------------------------
* Option enumeration (for the F10 port-layer options overlay).
*
* configForEachOption() walks every registered option; configSetOptionMeta()
* attaches display metadata (label / adjust step / enum-value names) keyed by
* the dotted key. Meta is an optional side table -- config.c stays ignorant of
* which specific keys exist; the overlay populates it at init time.
* ---------------------------------------------------------------------- */
enum {
CONFIG_OPT_INT = 0,
CONFIG_OPT_UINT,
CONFIG_OPT_FLOAT,
CONFIG_OPT_STR,
};
/* key : dotted option key
* type : CONFIG_OPT_*
* ptr : &int / &unsigned / &float / char* (the live variable)
* min,max : registered clamp bounds (min==max -> unclamped)
* step : adjust step from the meta side table (0 if none)
* label : display label from the meta side table (NULL if none)
* enumNames: NULL-terminated value-name list from the meta side table (or NULL)
* ctx : opaque pointer passed straight through
*/
typedef void (*ConfigOptionCb)(const char *key, int type, void *ptr,
double min, double max, double step,
const char *label, const char *const *enumNames,
void *ctx);
void configForEachOption(ConfigOptionCb cb, void *ctx);
void configSetOptionMeta(const char *key, const char *label, double step,
const char *const *enumNames);
#ifdef __cplusplus
}
#endif
#endif /* PORT_CONFIG_H */