all repos — mgba @ 811d8281c3f285e9e7421cf290ecefaefb46069d

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 "gba/gba.h"
12
13#include "util/configuration.h"
14
15struct mCoreConfig {
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 mCoreConfigInit(struct mCoreConfig*, const char* port);
58void mCoreConfigDeinit(struct mCoreConfig*);
59
60#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
61bool mCoreConfigLoad(struct mCoreConfig*);
62bool mCoreConfigSave(const struct mCoreConfig*);
63bool mCoreConfigLoadPath(struct mCoreConfig*, const char* path);
64bool mCoreConfigSavePath(const struct mCoreConfig*, const char* path);
65
66void mCoreConfigMakePortable(const struct mCoreConfig*);
67void mCoreConfigDirectory(char* out, size_t outLength);
68#endif
69
70const char* mCoreConfigGetValue(const struct mCoreConfig*, const char* key);
71bool mCoreConfigGetIntValue(const struct mCoreConfig*, const char* key, int* value);
72bool mCoreConfigGetUIntValue(const struct mCoreConfig*, const char* key, unsigned* value);
73bool mCoreConfigGetFloatValue(const struct mCoreConfig*, const char* key, float* value);
74
75void mCoreConfigSetValue(struct mCoreConfig*, const char* key, const char* value);
76void mCoreConfigSetIntValue(struct mCoreConfig*, const char* key, int value);
77void mCoreConfigSetUIntValue(struct mCoreConfig*, const char* key, unsigned value);
78void mCoreConfigSetFloatValue(struct mCoreConfig*, const char* key, float value);
79
80void mCoreConfigSetDefaultValue(struct mCoreConfig*, const char* key, const char* value);
81void mCoreConfigSetDefaultIntValue(struct mCoreConfig*, const char* key, int value);
82void mCoreConfigSetDefaultUIntValue(struct mCoreConfig*, const char* key, unsigned value);
83void mCoreConfigSetDefaultFloatValue(struct mCoreConfig*, const char* key, float value);
84
85void mCoreConfigSetOverrideValue(struct mCoreConfig*, const char* key, const char* value);
86void mCoreConfigSetOverrideIntValue(struct mCoreConfig*, const char* key, int value);
87void mCoreConfigSetOverrideUIntValue(struct mCoreConfig*, const char* key, unsigned value);
88void mCoreConfigSetOverrideFloatValue(struct mCoreConfig*, const char* key, float value);
89
90void mCoreConfigMap(const struct mCoreConfig* config, struct GBAOptions* opts);
91void mCoreConfigLoadDefaults(struct mCoreConfig* config, const struct GBAOptions* opts);
92
93struct Configuration* mCoreConfigGetInput(struct mCoreConfig*);
94struct Configuration* mCoreConfigGetOverrides(struct mCoreConfig*);
95
96void mCoreConfigFreeOpts(struct GBAOptions* opts);
97
98#endif