all repos — mgba @ 56722324efdf8d5c9675f7658a35b0d05e9f8594

mGBA Game Boy Advance Emulator

src/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 "util/common.h"
10
11#include "util/configuration.h"
12
13struct mCoreConfig {
14	struct Configuration configTable;
15	struct Configuration defaultsTable;
16	struct Configuration overridesTable;
17	char* port;
18};
19
20struct mCoreOptions {
21	char* bios;
22	bool skipBios;
23	bool useBios;
24	int logLevel;
25	int frameskip;
26	bool rewindEnable;
27	int rewindBufferCapacity;
28	float fpsTarget;
29	size_t audioBuffers;
30	unsigned sampleRate;
31
32	int fullscreen;
33	int width;
34	int height;
35	bool lockAspectRatio;
36	bool resampleVideo;
37	bool suspendScreensaver;
38	char* shader;
39
40	char* savegamePath;
41	char* savestatePath;
42	char* screenshotPath;
43	char* patchPath;
44
45	int volume;
46	bool mute;
47
48	bool videoSync;
49	bool audioSync;
50};
51
52void mCoreConfigInit(struct mCoreConfig*, const char* port);
53void mCoreConfigDeinit(struct mCoreConfig*);
54
55#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
56bool mCoreConfigLoad(struct mCoreConfig*);
57bool mCoreConfigSave(const struct mCoreConfig*);
58bool mCoreConfigLoadPath(struct mCoreConfig*, const char* path);
59bool mCoreConfigSavePath(const struct mCoreConfig*, const char* path);
60
61void mCoreConfigMakePortable(const struct mCoreConfig*);
62void mCoreConfigDirectory(char* out, size_t outLength);
63#endif
64
65const char* mCoreConfigGetValue(const struct mCoreConfig*, const char* key);
66bool mCoreConfigGetIntValue(const struct mCoreConfig*, const char* key, int* value);
67bool mCoreConfigGetUIntValue(const struct mCoreConfig*, const char* key, unsigned* value);
68bool mCoreConfigGetFloatValue(const struct mCoreConfig*, const char* key, float* value);
69
70void mCoreConfigSetValue(struct mCoreConfig*, const char* key, const char* value);
71void mCoreConfigSetIntValue(struct mCoreConfig*, const char* key, int value);
72void mCoreConfigSetUIntValue(struct mCoreConfig*, const char* key, unsigned value);
73void mCoreConfigSetFloatValue(struct mCoreConfig*, const char* key, float value);
74
75void mCoreConfigSetDefaultValue(struct mCoreConfig*, const char* key, const char* value);
76void mCoreConfigSetDefaultIntValue(struct mCoreConfig*, const char* key, int value);
77void mCoreConfigSetDefaultUIntValue(struct mCoreConfig*, const char* key, unsigned value);
78void mCoreConfigSetDefaultFloatValue(struct mCoreConfig*, const char* key, float value);
79
80void mCoreConfigSetOverrideValue(struct mCoreConfig*, const char* key, const char* value);
81void mCoreConfigSetOverrideIntValue(struct mCoreConfig*, const char* key, int value);
82void mCoreConfigSetOverrideUIntValue(struct mCoreConfig*, const char* key, unsigned value);
83void mCoreConfigSetOverrideFloatValue(struct mCoreConfig*, const char* key, float value);
84
85void mCoreConfigMap(const struct mCoreConfig* config, struct mCoreOptions* opts);
86void mCoreConfigLoadDefaults(struct mCoreConfig* config, const struct mCoreOptions* opts);
87
88struct Configuration* mCoreConfigGetInput(struct mCoreConfig*);
89struct Configuration* mCoreConfigGetOverrides(struct mCoreConfig*);
90const struct Configuration* mCoreConfigGetOverridesConst(const struct mCoreConfig*);
91
92void mCoreConfigFreeOpts(struct mCoreOptions* opts);
93
94#endif