ScummVM API documentation
registry.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef GRIM_REGISTRY_H
23#define GRIM_REGISTRY_H
24
25#include "common/str.h"
26
27namespace Grim {
28
29class Registry {
30public:
31 enum ValueType {
32 String,
33 Integer,
34 Boolean
35 };
36
37 const Common::String &getString(const Common::String &key) const;
38 int getInt(const Common::String &key) const;
39 bool getBool(const Common::String &key) const;
40
41 void setString(const Common::String &key, const Common::String &val);
42 void setInt(const Common::String &key, int val);
43 void setBool(const Common::String &key, bool val);
44
45 ValueType getValueType(const Common::String &key) const;
46
47 void save();
48
49 Registry();
50 ~Registry() { }
51
52private:
53 static Registry *_instance;
54
55 class Value {
56 public:
57 void setString(const Common::String &str);
58 void setInt(int num);
59 void setBool(bool val);
60
61 const Common::String &getString() const;
62 int getInt() const;
63 bool getBool() const;
64
65 ValueType getType() const;
66
67 private:
68 struct {
69 Common::String _str;
70 int _num;
71 bool _bool;
72 } _val;
73 ValueType _type;
74 };
75
76 const Value &value(const Common::String &key) const;
77 Value &value(const Common::String &key);
78
79 Value _develMode;
80 Value _dataPath;
81 Value _savePath;
82 Value _lastSet;
83 Value _musicVolume;
84 Value _sfxVolume;
85 Value _voiceVolume;
86 Value _lastSavedGame;
87 Value _gamma;
88 Value _voiceEffects;
89 Value _textSpeed;
90 Value _speechMode;
91 Value _movement;
92 Value _joystick;
93 Value _spewOnError;
94 Value _transcript;
95 Value _dummy;
96
97 // Remastered (TODO: Fix the type-handling), TODO: Disable for original
98 Value _directorsCommentary;
99 Value _widescreen;
100 Value _language;
101 Value _resolutionScaling;
102 Value _mouseSpeed;
103 Value _advancedLighting;
104 Value _directorsCommentaryVolume;
105 Value _renderingMode;
106 Value _fullScreen;
107
108 bool _dirty;
109
110 uint convertVolumeToMixer(uint volume);
111 uint convertVolumeFromMixer(uint volume);
112 uint convertTalkSpeedToGUI(uint talkspeed);
113 uint convertTalkSpeedFromGUI(uint talkspeed);
114 bool convertSubtitlesToGUI(uint speechmode);
115 bool convertSpeechMuteToGUI(uint speechmode);
116 uint convertSpeechModeFromGUI(bool subtitles, bool speechMute);
117};
118
119extern Registry *g_registry;
120
121} // end of namespace Grim
122
123#endif
Definition: str.h:59
Definition: registry.h:29