Oolite 1.91.0.7745-260117-205bce7
Loading...
Searching...
No Matches
ResourceManager.h
Go to the documentation of this file.
1/*
2
3ResourceManager.h
4
5Singleton class responsible for loading various data files.
6
7Oolite
8Copyright (C) 2004-2013 Giles C Williams and contributors
9
10This program is free software; you can redistribute it and/or
11modify it under the terms of the GNU General Public License
12as published by the Free Software Foundation; either version 2
13of the License, or (at your option) any later version.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23MA 02110-1301, USA.
24
25*/
26
27#import "OOCocoa.h"
28#import "OOOpenGL.h"
30
32
33
34typedef enum
35{
36 MERGE_NONE, // Just use the last file in search order.
37 MERGE_BASIC, // Merge files by adding the top-level items of each file.
38 MERGE_SMART // Merge files by merging the top-level elements of each file (second-order merge, but not recursive)
40
41/* 'All' doesn't quite mean 'all' - OXPs with the tag
42 * "oolite-scenario-only" will only be loaded if required by a
43 * scenario.
44 *
45 * Note that this means that the scenario itself must be in a
46 * different OXP, or it'll never be loaded when on the start-game
47 * screen.
48 */
49#define SCENARIO_OXP_DEFINITION_ALL @""
50#define SCENARIO_OXP_DEFINITION_NONE @"strict"
51#define SCENARIO_OXP_DEFINITION_BYID @"id:"
52#define SCENARIO_OXP_DEFINITION_BYTAG @"tag:"
53#define SCENARIO_OXP_DEFINITION_NOPLIST @"exc:"
54
55@interface ResourceManager : NSObject
56
57+ (void) reset;
59
60
61+ (NSArray *)rootPaths; // Places add-ons are searched for, not including add-on paths.
62+ (NSArray *)userRootPaths; // Places users are expected to place add-ons, not including built-in data or managed add-ons directory.
63+ (NSString *)builtInPath; // Path for built-in data only.
64+ (NSArray *)pathsWithAddOns; // Root paths + add-on paths.
65+ (NSArray *)paths; // builtInPath or pathsWithAddOns, depending on useAddOns state.
66+ (NSArray *)maskUserNameInPathArray:(NSArray *)inputPathArray; // potential privacy concerns
67+ (NSString *)maskUserName:(NSString *)name inPath:(NSString *)path;
68+ (NSString *)useAddOns;
69+ (NSArray *)OXPsWithMessagesFound;
70+ (void)setUseAddOns:(NSString *)useAddOns;
71+ (void)addExternalPath:(NSString *)fileName;
72+ (NSEnumerator *)pathEnumerator;
73+ (NSEnumerator *)reversePathEnumerator;
74
75// get manifest data for identifier
76+ (NSDictionary *)manifestForIdentifier:(NSString *)identifier;
77// compatibility checks
78+ (BOOL) checkVersionCompatibility:(NSDictionary *)manifest forOXP:(NSString *)title;
79+ (BOOL) manifestHasConflicts:(NSDictionary *)manifest logErrors:(BOOL)logErrors;
80+ (BOOL) manifestHasMissingDependencies:(NSDictionary *)manifest logErrors:(BOOL)logErrors;
81+ (BOOL) manifest:(NSDictionary *)manifest HasUnmetDependency:(NSDictionary *)required logErrors:(BOOL)logErrors;
82+ (BOOL) matchVersions:(NSDictionary *)rangeDict withVersion:(NSString *)version;
83
84
85
86+ (void)handleEquipmentListMerging: (NSMutableArray *)arrayToProcess forLookupIndex:(unsigned)lookupIndex;
87+ (void)handleEquipmentOverrides: (NSMutableArray *)arrayToProcess;
88+ (void)handleStarNebulaListMerging: (NSMutableArray *)arrayToProcess;
89
90+ (NSString *)errors; // Errors which occurred during path scanning - essentially a list of OXPs whose requires.plist is bad.
91
92+ (NSString *) pathForFileNamed:(NSString *)fileName inFolder:(NSString *)folderName;
93+ (NSString *) pathForFileNamed:(NSString *)fileName inFolder:(NSString *)folderName cache:(BOOL)useCache;
94
95+ (BOOL) corePlist:(NSString *)fileName excludedAt:(NSString *)path;
96
97+ (NSDictionary *)dictionaryFromFilesNamed:(NSString *)fileName
98 inFolder:(NSString *)folderName
99 andMerge:(BOOL) mergeFiles;
100+ (NSDictionary *)dictionaryFromFilesNamed:(NSString *)fileName
101 inFolder:(NSString *)folderName
102 mergeMode:(OOResourceMergeMode)mergeMode
103 cache:(BOOL)useCache;
104
105+ (NSArray *)arrayFromFilesNamed:(NSString *)fileName
106 inFolder:(NSString *)folderName
107 andMerge:(BOOL) mergeFiles;
108+ (NSArray *)arrayFromFilesNamed:(NSString *)fileName
109 inFolder:(NSString *)folderName
110 andMerge:(BOOL) mergeFiles
111 cache:(BOOL)useCache;
112
113// These are deliberately not merged like normal plists for security reasons.
114+ (NSDictionary *) whitelistDictionary;
115+ (NSDictionary *) shaderBindingTypesDictionary;
116
117// These have special merging rules.
118+ (NSDictionary *) logControlDictionary;
119+ (NSDictionary *) roleCategoriesDictionary;
121
122+ (OOSound *)ooSoundNamed:(NSString *)fileName inFolder:(NSString *)folderName;
123+ (OOMusic *)ooMusicNamed:(NSString *)fileName inFolder:(NSString *)folderName;
124
125+ (NSString *) stringFromFilesNamed:(NSString *)fileName inFolder:(NSString *)folderName;
126+ (NSString *) stringFromFilesNamed:(NSString *)fileName inFolder:(NSString *)folderName cache:(BOOL)useCache;
127
128+ (NSDictionary *)loadScripts;
129
130/* +writeDiagnosticData:toFileNamed:
131 +writeDiagnosticString:toFileNamed:
132 +writeDiagnosticPList:toFileNamed:
133
134 Write data to the specified path within the log directory. Slashes may be
135 used as path separators in name.
136 */
137+ (BOOL) writeDiagnosticData:(NSData *)data toFileNamed:(NSString *)name;
138+ (BOOL) writeDiagnosticString:(NSString *)string toFileNamed:(NSString *)name;
139+ (BOOL) writeDiagnosticPList:(id)plist toFileNamed:(NSString *)name;
140
141+ (NSString *) diagnosticFileLocation;
142
143+ (NSDictionary *) materialDefaults;
144
145// Clear ResourceManager-internal caches (not those handled by OOCacheManager)
146+ (void) clearCaches;
147
148@end
OOResourceMergeMode
@ MERGE_SMART
@ MERGE_NONE
@ MERGE_BASIC
NSDictionary * materialDefaults()
NSArray * pathsWithAddOns()
void resetManifestKnowledgeForOXZManager()
NSDictionary * loadScripts()
NSString * builtInPath()
NSDictionary * whitelistDictionary()
NSEnumerator * reversePathEnumerator()
NSArray * OXPsWithMessagesFound()
NSDictionary * logControlDictionary()
NSEnumerator * pathEnumerator()
NSString * diagnosticFileLocation()
NSString * useAddOns()
NSArray * userRootPaths()
NSDictionary * shaderBindingTypesDictionary()
OOSystemDescriptionManager * systemDescriptionManager()
NSDictionary * roleCategoriesDictionary()