all repos — mgba @ 2d930cbc610b28d82746bbcd121efcd47be47592

mGBA Game Boy Advance Emulator

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