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 float fpsTarget;
31 size_t audioBuffers;
32 unsigned sampleRate;
33
34 int fullscreen;
35 int width;
36 int height;
37 bool lockAspectRatio;
38 bool resampleVideo;
39 bool suspendScreensaver;
40 char* shader;
41
42 char* savegamePath;
43 char* savestatePath;
44 char* screenshotPath;
45 char* patchPath;
46
47 int volume;
48 bool mute;
49
50 bool videoSync;
51 bool audioSync;
52};
53
54void mCoreConfigInit(struct mCoreConfig*, const char* port);
55void mCoreConfigDeinit(struct mCoreConfig*);
56
57#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
58bool mCoreConfigLoad(struct mCoreConfig*);
59bool mCoreConfigSave(const struct mCoreConfig*);
60bool mCoreConfigLoadPath(struct mCoreConfig*, const char* path);
61bool mCoreConfigSavePath(const struct mCoreConfig*, const char* path);
62
63void mCoreConfigMakePortable(const struct mCoreConfig*);
64void mCoreConfigDirectory(char* out, size_t outLength);
65#endif
66
67const char* mCoreConfigGetValue(const struct mCoreConfig*, const char* key);
68bool mCoreConfigGetIntValue(const struct mCoreConfig*, const char* key, int* value);
69bool mCoreConfigGetUIntValue(const struct mCoreConfig*, const char* key, unsigned* value);
70bool mCoreConfigGetFloatValue(const struct mCoreConfig*, const char* key, float* value);
71
72void mCoreConfigSetValue(struct mCoreConfig*, const char* key, const char* value);
73void mCoreConfigSetIntValue(struct mCoreConfig*, const char* key, int value);
74void mCoreConfigSetUIntValue(struct mCoreConfig*, const char* key, unsigned value);
75void mCoreConfigSetFloatValue(struct mCoreConfig*, const char* key, float value);
76
77void mCoreConfigSetDefaultValue(struct mCoreConfig*, const char* key, const char* value);
78void mCoreConfigSetDefaultIntValue(struct mCoreConfig*, const char* key, int value);
79void mCoreConfigSetDefaultUIntValue(struct mCoreConfig*, const char* key, unsigned value);
80void mCoreConfigSetDefaultFloatValue(struct mCoreConfig*, const char* key, float value);
81
82void mCoreConfigSetOverrideValue(struct mCoreConfig*, const char* key, const char* value);
83void mCoreConfigSetOverrideIntValue(struct mCoreConfig*, const char* key, int value);
84void mCoreConfigSetOverrideUIntValue(struct mCoreConfig*, const char* key, unsigned value);
85void mCoreConfigSetOverrideFloatValue(struct mCoreConfig*, const char* key, float value);
86
87void mCoreConfigCopyValue(struct mCoreConfig* config, const struct mCoreConfig* src, const char* key);
88
89void mCoreConfigMap(const struct mCoreConfig* config, struct mCoreOptions* opts);
90void mCoreConfigLoadDefaults(struct mCoreConfig* config, const struct mCoreOptions* opts);
91
92struct Configuration* mCoreConfigGetInput(struct mCoreConfig*);
93struct Configuration* mCoreConfigGetOverrides(struct mCoreConfig*);
94const struct Configuration* mCoreConfigGetOverridesConst(const struct mCoreConfig*);
95
96void mCoreConfigFreeOpts(struct mCoreOptions* opts);
97
98CXX_GUARD_END
99
100#endif