src/gba/gba-config.h (view raw)
1/* Copyright (c) 2013-2014 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.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 int logLevel;
25 int frameskip;
26 bool rewindEnable;
27 int rewindBufferCapacity;
28 int rewindBufferInterval;
29 float fpsTarget;
30 size_t audioBuffers;
31
32 int fullscreen;
33 int width;
34 int height;
35 bool lockAspectRatio;
36 bool resampleVideo;
37
38 bool videoSync;
39 bool audioSync;
40
41 enum GBAIdleLoopOptimization idleOptimization;
42};
43
44void GBAConfigInit(struct GBAConfig*, const char* port);
45void GBAConfigDeinit(struct GBAConfig*);
46
47bool GBAConfigLoad(struct GBAConfig*);
48bool GBAConfigSave(const struct GBAConfig*);
49
50void GBAConfigDirectory(char* out, size_t outLength);
51
52const char* GBAConfigGetValue(const struct GBAConfig*, const char* key);
53
54void GBAConfigSetValue(struct GBAConfig*, const char* key, const char* value);
55void GBAConfigSetIntValue(struct GBAConfig*, const char* key, int value);
56void GBAConfigSetUIntValue(struct GBAConfig*, const char* key, unsigned value);
57void GBAConfigSetFloatValue(struct GBAConfig*, const char* key, float value);
58
59void GBAConfigSetDefaultValue(struct GBAConfig*, const char* key, const char* value);
60void GBAConfigSetDefaultIntValue(struct GBAConfig*, const char* key, int value);
61void GBAConfigSetDefaultUIntValue(struct GBAConfig*, const char* key, unsigned value);
62void GBAConfigSetDefaultFloatValue(struct GBAConfig*, const char* key, float value);
63
64void GBAConfigMap(const struct GBAConfig* config, struct GBAOptions* opts);
65void GBAConfigLoadDefaults(struct GBAConfig* config, const struct GBAOptions* opts);
66
67void GBAConfigFreeOpts(struct GBAOptions* opts);
68
69#endif