include/mgba/core/config.h (view raw)
1/* Copyright (c) 2013-2016 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 M_CORE_CONFIG_H
7#define M_CORE_CONFIG_H
8
9#include <mgba-util/common.h>
10
11CXX_GUARD_START
12
13#include <mgba-util/configuration.h>
14
15struct mCoreConfig {
16 struct Configuration configTable;
17 struct Configuration defaultsTable;
18 struct Configuration overridesTable;
19 char* port;
20};
21
22struct mCoreOptions {
23 char* bios;
24 bool skipBios;
25 bool useBios;
26 int logLevel;
27 int frameskip;
28 bool rewindEnable;
29 int rewindBufferCapacity;
30 bool rewindSave;
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
55void mCoreConfigInit(struct mCoreConfig*, const char* port);
56void mCoreConfigDeinit(struct mCoreConfig*);
57
58#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
59bool mCoreConfigLoad(struct mCoreConfig*);
60bool mCoreConfigSave(const struct mCoreConfig*);
61bool mCoreConfigLoadPath(struct mCoreConfig*, const char* path);
62bool mCoreConfigSavePath(const struct mCoreConfig*, const char* path);
63
64void mCoreConfigMakePortable(const struct mCoreConfig*);
65void mCoreConfigDirectory(char* out, size_t outLength);
66#endif
67
68const char* mCoreConfigGetValue(const struct mCoreConfig*, const char* key);
69bool mCoreConfigGetIntValue(const struct mCoreConfig*, const char* key, int* value);
70bool mCoreConfigGetUIntValue(const struct mCoreConfig*, const char* key, unsigned* value);
71bool mCoreConfigGetFloatValue(const struct mCoreConfig*, const char* key, float* value);
72
73void mCoreConfigSetValue(struct mCoreConfig*, const char* key, const char* value);
74void mCoreConfigSetIntValue(struct mCoreConfig*, const char* key, int value);
75void mCoreConfigSetUIntValue(struct mCoreConfig*, const char* key, unsigned value);
76void mCoreConfigSetFloatValue(struct mCoreConfig*, const char* key, float value);
77
78void mCoreConfigSetDefaultValue(struct mCoreConfig*, const char* key, const char* value);
79void mCoreConfigSetDefaultIntValue(struct mCoreConfig*, const char* key, int value);
80void mCoreConfigSetDefaultUIntValue(struct mCoreConfig*, const char* key, unsigned value);
81void mCoreConfigSetDefaultFloatValue(struct mCoreConfig*, const char* key, float value);
82
83void mCoreConfigSetOverrideValue(struct mCoreConfig*, const char* key, const char* value);
84void mCoreConfigSetOverrideIntValue(struct mCoreConfig*, const char* key, int value);
85void mCoreConfigSetOverrideUIntValue(struct mCoreConfig*, const char* key, unsigned value);
86void mCoreConfigSetOverrideFloatValue(struct mCoreConfig*, const char* key, float value);
87
88void mCoreConfigCopyValue(struct mCoreConfig* config, const struct mCoreConfig* src, const char* key);
89
90void mCoreConfigMap(const struct mCoreConfig* config, struct mCoreOptions* opts);
91void mCoreConfigLoadDefaults(struct mCoreConfig* config, const struct mCoreOptions* opts);
92
93struct Configuration* mCoreConfigGetInput(struct mCoreConfig*);
94struct Configuration* mCoreConfigGetOverrides(struct mCoreConfig*);
95const struct Configuration* mCoreConfigGetOverridesConst(const struct mCoreConfig*);
96
97void mCoreConfigFreeOpts(struct mCoreOptions* opts);
98
99CXX_GUARD_END
100
101#endif