all repos — mgba @ 29556f45a4a1753c5cab239c26b5b8c1cd4e1d78

mGBA Game Boy Advance Emulator

src/gba/context/config.h (view raw)

 1/* Copyright (c) 2013-2015 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#ifndef GBA_CONFIG_H
 7#define GBA_CONFIG_H
 8
 9#include "util/common.h"
10
11#include "gba/gba.h"
12
13#include "util/configuration.h"
14
15struct GBAConfig {
16	struct Configuration configTable;
17	struct Configuration defaultsTable;
18	struct Configuration overridesTable;
19	char* port;
20};
21
22struct GBAOptions {
23	char* bios;
24	bool skipBios;
25	bool useBios;
26	int logLevel;
27	int frameskip;
28	bool rewindEnable;
29	int rewindBufferCapacity;
30	int rewindBufferInterval;
31	float fpsTarget;
32	size_t audioBuffers;
33	unsigned sampleRate;
34
35	int fullscreen;
36	int width;
37	int height;
38	bool lockAspectRatio;
39	bool resampleVideo;
40	bool suspendScreensaver;
41	char* shader;
42
43	int volume;
44	bool mute;
45
46	bool videoSync;
47	bool audioSync;
48
49	enum GBAIdleLoopOptimization idleOptimization;
50};
51
52void GBAConfigInit(struct GBAConfig*, const char* port);
53void GBAConfigDeinit(struct GBAConfig*);
54
55#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
56bool GBAConfigLoad(struct GBAConfig*);
57bool GBAConfigSave(const struct GBAConfig*);
58bool GBAConfigLoadPath(struct GBAConfig*, const char* path);
59bool GBAConfigSavePath(const struct GBAConfig*, const char* path);
60
61void GBAConfigMakePortable(const struct GBAConfig*);
62void GBAConfigDirectory(char* out, size_t outLength);
63#endif
64
65const char* GBAConfigGetValue(const struct GBAConfig*, const char* key);
66bool GBAConfigGetIntValue(const struct GBAConfig*, const char* key, int* value);
67bool GBAConfigGetUIntValue(const struct GBAConfig*, const char* key, unsigned* value);
68bool GBAConfigGetFloatValue(const struct GBAConfig*, const char* key, float* value);
69
70void GBAConfigSetValue(struct GBAConfig*, const char* key, const char* value);
71void GBAConfigSetIntValue(struct GBAConfig*, const char* key, int value);
72void GBAConfigSetUIntValue(struct GBAConfig*, const char* key, unsigned value);
73void GBAConfigSetFloatValue(struct GBAConfig*, const char* key, float value);
74
75void GBAConfigSetDefaultValue(struct GBAConfig*, const char* key, const char* value);
76void GBAConfigSetDefaultIntValue(struct GBAConfig*, const char* key, int value);
77void GBAConfigSetDefaultUIntValue(struct GBAConfig*, const char* key, unsigned value);
78void GBAConfigSetDefaultFloatValue(struct GBAConfig*, const char* key, float value);
79
80void GBAConfigSetOverrideValue(struct GBAConfig*, const char* key, const char* value);
81void GBAConfigSetOverrideIntValue(struct GBAConfig*, const char* key, int value);
82void GBAConfigSetOverrideUIntValue(struct GBAConfig*, const char* key, unsigned value);
83void GBAConfigSetOverrideFloatValue(struct GBAConfig*, const char* key, float value);
84
85void GBAConfigMap(const struct GBAConfig* config, struct GBAOptions* opts);
86void GBAConfigLoadDefaults(struct GBAConfig* config, const struct GBAOptions* opts);
87
88struct Configuration* GBAConfigGetInput(struct GBAConfig*);
89struct Configuration* GBAConfigGetOverrides(struct GBAConfig*);
90
91void GBAConfigFreeOpts(struct GBAOptions* opts);
92
93#endif