ScummVM API documentation
profile.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 MEDIASTATION_PROFILE_H
23 #define MEDIASTATION_PROFILE_H
24 
25 #include "common/str.h"
26 #include "common/array.h"
27 #include "common/hashmap.h"
28 #include "common/file.h"
29 
30 namespace MediaStation {
31 
32 class Actor;
33 
35  // This is usually "Document", "Context", or "Screen".
36  Common::String type;
37  Common::String name;
38  uint unk1 = 0;
39 };
40 
41 // These can be actors or functions, hence using the generic term "asset" here.
43  Common::String name;
44  uint id = 0;
45  Common::Array<uint16> channelIdents;
46 };
47 
49  Common::String name;
50  uint id = 0;
51 };
52 
54  Common::String name;
55  uint id = 0;
56 };
57 
59  Common::String name;
60  uint id = 0;
61 };
62 
64  Common::String name;
65  Common::String value;
66 };
67 
68 // Profiles (PROFILE._ST) contain mappings between names and IDs for assets,
69 // functions, variables, and other entities. Some titles do not have this mapping,
70 // but when it exists it is very helpful for debugging. It is not required for actually
71 // running any games.
72 class Profile {
73 public:
74  void load(const Common::Path &filename);
75 
76  Common::String formatActorName(uint actorId, bool attemptToGetType = false);
77  Common::String formatActorName(const Actor *actor);
78 
79  Common::String formatFunctionName(uint assetId);
80  Common::String formatFileName(uint fileId);
81  Common::String formatVariableName(uint variableId);
82  Common::String formatParamTokenName(uint paramToken);
83  Common::String formatAssetNameForChannelIdent(uint channelIdent);
84 
85  const Common::String &getFileName(uint16 fileId) const { return _files.getValOrDefault(fileId).name; }
86  const Common::String &getResourceName(uint16 resourceId) const { return _paramTokens.getValOrDefault(resourceId).name; }
87 
88 private:
89  Common::String _versionNumber;
90  Common::String _platform;
91  Common::Array<ProfileContextInfo> _contexts; // It isn't clear what the key would be.
93  Common::HashMap<uint, uint> _channelIdentsAsIntToAssetId;
98 
99  void parseVersionInfo(const Common::String &line);
100  void parseContextInfo(const Common::String &line);
101  void parseAssetInfo(const Common::String &line);
102  void parseFileInfo(const Common::String &line);
103  void parseVariableInfo(const Common::String &line);
104  void parseParamTokenInfo(const Common::String &line);
105  void parseScriptConstantInfo(const Common::String &line);
106 
107  void readSection(Common::File &file, void (Profile::*parser)(const Common::String &));
108 };
109 
110 } // End of namespace MediaStation
111 
112 #endif
Definition: profile.h:34
Definition: str.h:59
Definition: actor.h:33
Definition: profile.h:72
Definition: profile.h:42
Definition: profile.h:53
Definition: path.h:52
Definition: profile.h:48
Definition: profile.h:58
Definition: hashmap.h:85
Definition: file.h:47
Definition: actor.h:187