src/gba/context/config.h (view raw)
1/* Copyright (c) 2013-2015 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 GBA_CONFIG_H
7#define GBA_CONFIG_H
8
9#include "util/common.h"
10
11#include "gba/gba.h"
12
13#include "util/configuration.h"
14
15struct GBAConfig {
16 struct Configuration configTable;
17 struct Configuration defaultsTable;
18 char* port;
19};
20
21struct GBAOptions {
22 char* bios;
23 bool skipBios;
24 bool useBios;
25 int logLevel;
26 int frameskip;
27 bool rewindEnable;
28 int rewindBufferCapacity;
29 int rewindBufferInterval;
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
41 int volume;
42 bool mute;
43
44 bool videoSync;
45 bool audioSync;
46
47 enum GBAIdleLoopOptimization idleOptimization;
48};
49
50void GBAConfigInit(struct GBAConfig*, const char* port);
51void GBAConfigDeinit(struct GBAConfig*);
52
53bool GBAConfigLoad(struct GBAConfig*);
54bool GBAConfigSave(const struct GBAConfig*);
55bool GBAConfigLoadPath(struct GBAConfig*, const char* path);
56bool GBAConfigSavePath(const struct GBAConfig*, const char* path);
57
58void GBAConfigMakePortable(const struct GBAConfig*);
59void GBAConfigDirectory(char* out, size_t outLength);
60
61const char* GBAConfigGetValue(const struct GBAConfig*, const char* key);
62bool GBAConfigGetIntValue(const struct GBAConfig*, const char* key, int* value);
63bool GBAConfigGetUIntValue(const struct GBAConfig*, const char* key, unsigned* value);
64bool GBAConfigGetFloatValue(const struct GBAConfig*, const char* key, float* value);
65
66void GBAConfigSetValue(struct GBAConfig*, const char* key, const char* value);
67void GBAConfigSetIntValue(struct GBAConfig*, const char* key, int value);
68void GBAConfigSetUIntValue(struct GBAConfig*, const char* key, unsigned value);
69void GBAConfigSetFloatValue(struct GBAConfig*, const char* key, float value);
70
71void GBAConfigSetDefaultValue(struct GBAConfig*, const char* key, const char* value);
72void GBAConfigSetDefaultIntValue(struct GBAConfig*, const char* key, int value);
73void GBAConfigSetDefaultUIntValue(struct GBAConfig*, const char* key, unsigned value);
74void GBAConfigSetDefaultFloatValue(struct GBAConfig*, const char* key, float value);
75
76void GBAConfigMap(const struct GBAConfig* config, struct GBAOptions* opts);
77void GBAConfigLoadDefaults(struct GBAConfig* config, const struct GBAOptions* opts);
78
79struct Configuration* GBAConfigGetInput(struct GBAConfig*);
80struct Configuration* GBAConfigGetOverrides(struct GBAConfig*);
81
82void GBAConfigFreeOpts(struct GBAOptions* opts);
83
84#endif