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
42 int volume;
43 bool mute;
44
45 bool videoSync;
46 bool audioSync;
47
48 enum GBAIdleLoopOptimization idleOptimization;
49};
50
51void GBAConfigInit(struct GBAConfig*, const char* port);
52void GBAConfigDeinit(struct GBAConfig*);
53
54bool GBAConfigLoad(struct GBAConfig*);
55bool GBAConfigSave(const struct GBAConfig*);
56bool GBAConfigLoadPath(struct GBAConfig*, const char* path);
57bool GBAConfigSavePath(const struct GBAConfig*, const char* path);
58
59void GBAConfigMakePortable(const struct GBAConfig*);
60void GBAConfigDirectory(char* out, size_t outLength);
61
62const char* GBAConfigGetValue(const struct GBAConfig*, const char* key);
63bool GBAConfigGetIntValue(const struct GBAConfig*, const char* key, int* value);
64bool GBAConfigGetUIntValue(const struct GBAConfig*, const char* key, unsigned* value);
65bool GBAConfigGetFloatValue(const struct GBAConfig*, const char* key, float* value);
66
67void GBAConfigSetValue(struct GBAConfig*, const char* key, const char* value);
68void GBAConfigSetIntValue(struct GBAConfig*, const char* key, int value);
69void GBAConfigSetUIntValue(struct GBAConfig*, const char* key, unsigned value);
70void GBAConfigSetFloatValue(struct GBAConfig*, const char* key, float value);
71
72void GBAConfigSetDefaultValue(struct GBAConfig*, const char* key, const char* value);
73void GBAConfigSetDefaultIntValue(struct GBAConfig*, const char* key, int value);
74void GBAConfigSetDefaultUIntValue(struct GBAConfig*, const char* key, unsigned value);
75void GBAConfigSetDefaultFloatValue(struct GBAConfig*, const char* key, float value);
76
77void GBAConfigSetOverrideValue(struct GBAConfig*, const char* key, const char* value);
78void GBAConfigSetOverrideIntValue(struct GBAConfig*, const char* key, int value);
79void GBAConfigSetOverrideUIntValue(struct GBAConfig*, const char* key, unsigned value);
80void GBAConfigSetOverrideFloatValue(struct GBAConfig*, const char* key, float value);
81
82void GBAConfigMap(const struct GBAConfig* config, struct GBAOptions* opts);
83void GBAConfigLoadDefaults(struct GBAConfig* config, const struct GBAOptions* opts);
84
85struct Configuration* GBAConfigGetInput(struct GBAConfig*);
86struct Configuration* GBAConfigGetOverrides(struct GBAConfig*);
87
88void GBAConfigFreeOpts(struct GBAOptions* opts);
89
90#endif