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