all repos — mgba @ 3a7350c8d2d7332713630b7b4cf47f6f11a74b8e

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
55bool GBAConfigLoad(struct GBAConfig*);
56bool GBAConfigSave(const struct GBAConfig*);
57bool GBAConfigLoadPath(struct GBAConfig*, const char* path);
58bool GBAConfigSavePath(const struct GBAConfig*, const char* path);
59
60void GBAConfigMakePortable(const struct GBAConfig*);
61void GBAConfigDirectory(char* out, size_t outLength);
62
63const char* GBAConfigGetValue(const struct GBAConfig*, const char* key);
64bool GBAConfigGetIntValue(const struct GBAConfig*, const char* key, int* value);
65bool GBAConfigGetUIntValue(const struct GBAConfig*, const char* key, unsigned* value);
66bool GBAConfigGetFloatValue(const struct GBAConfig*, const char* key, float* value);
67
68void GBAConfigSetValue(struct GBAConfig*, const char* key, const char* value);
69void GBAConfigSetIntValue(struct GBAConfig*, const char* key, int value);
70void GBAConfigSetUIntValue(struct GBAConfig*, const char* key, unsigned value);
71void GBAConfigSetFloatValue(struct GBAConfig*, const char* key, float value);
72
73void GBAConfigSetDefaultValue(struct GBAConfig*, const char* key, const char* value);
74void GBAConfigSetDefaultIntValue(struct GBAConfig*, const char* key, int value);
75void GBAConfigSetDefaultUIntValue(struct GBAConfig*, const char* key, unsigned value);
76void GBAConfigSetDefaultFloatValue(struct GBAConfig*, const char* key, float value);
77
78void GBAConfigSetOverrideValue(struct GBAConfig*, const char* key, const char* value);
79void GBAConfigSetOverrideIntValue(struct GBAConfig*, const char* key, int value);
80void GBAConfigSetOverrideUIntValue(struct GBAConfig*, const char* key, unsigned value);
81void GBAConfigSetOverrideFloatValue(struct GBAConfig*, const char* key, float value);
82
83void GBAConfigMap(const struct GBAConfig* config, struct GBAOptions* opts);
84void GBAConfigLoadDefaults(struct GBAConfig* config, const struct GBAOptions* opts);
85
86struct Configuration* GBAConfigGetInput(struct GBAConfig*);
87struct Configuration* GBAConfigGetOverrides(struct GBAConfig*);
88
89void GBAConfigFreeOpts(struct GBAOptions* opts);
90
91#endif