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