Oolite 1.91.0.7646-241128-10e222e
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+ (NSString *)useAddOns;
67+ (NSArray *)OXPsWithMessagesFound;
68+ (void)setUseAddOns:(NSString *)useAddOns;
69+ (void)addExternalPath:(NSString *)fileName;
70+ (NSEnumerator *)pathEnumerator;
71+ (NSEnumerator *)reversePathEnumerator;
72
73// get manifest data for identifier
74+ (NSDictionary *)manifestForIdentifier:(NSString *)identifier;
75// compatibility checks
76+ (BOOL) checkVersionCompatibility:(NSDictionary *)manifest forOXP:(NSString *)title;
77+ (BOOL) manifestHasConflicts:(NSDictionary *)manifest logErrors:(BOOL)logErrors;
78+ (BOOL) manifestHasMissingDependencies:(NSDictionary *)manifest logErrors:(BOOL)logErrors;
79+ (BOOL) manifest:(NSDictionary *)manifest HasUnmetDependency:(NSDictionary *)required logErrors:(BOOL)logErrors;
80+ (BOOL) matchVersions:(NSDictionary *)rangeDict withVersion:(NSString *)version;
81
82
83
84+ (void)handleEquipmentListMerging: (NSMutableArray *)arrayToProcess forLookupIndex:(unsigned)lookupIndex;
85+ (void)handleEquipmentOverrides: (NSMutableArray *)arrayToProcess;
86+ (void)handleStarNebulaListMerging: (NSMutableArray *)arrayToProcess;
87
88+ (NSString *)errors; // Errors which occurred during path scanning - essentially a list of OXPs whose requires.plist is bad.
89
90+ (NSString *) pathForFileNamed:(NSString *)fileName inFolder:(NSString *)folderName;
91+ (NSString *) pathForFileNamed:(NSString *)fileName inFolder:(NSString *)folderName cache:(BOOL)useCache;
92
93+ (BOOL) corePlist:(NSString *)fileName excludedAt:(NSString *)path;
94
95+ (NSDictionary *)dictionaryFromFilesNamed:(NSString *)fileName
96 inFolder:(NSString *)folderName
97 andMerge:(BOOL) mergeFiles;
98+ (NSDictionary *)dictionaryFromFilesNamed:(NSString *)fileName
99 inFolder:(NSString *)folderName
100 mergeMode:(OOResourceMergeMode)mergeMode
101 cache:(BOOL)useCache;
102
103+ (NSArray *)arrayFromFilesNamed:(NSString *)fileName
104 inFolder:(NSString *)folderName
105 andMerge:(BOOL) mergeFiles;
106+ (NSArray *)arrayFromFilesNamed:(NSString *)fileName
107 inFolder:(NSString *)folderName
108 andMerge:(BOOL) mergeFiles
109 cache:(BOOL)useCache;
110
111// These are deliberately not merged like normal plists for security reasons.
112+ (NSDictionary *) whitelistDictionary;
113+ (NSDictionary *) shaderBindingTypesDictionary;
114
115// These have special merging rules.
116+ (NSDictionary *) logControlDictionary;
117+ (NSDictionary *) roleCategoriesDictionary;
119
120+ (OOSound *)ooSoundNamed:(NSString *)fileName inFolder:(NSString *)folderName;
121+ (OOMusic *)ooMusicNamed:(NSString *)fileName inFolder:(NSString *)folderName;
122
123+ (NSString *) stringFromFilesNamed:(NSString *)fileName inFolder:(NSString *)folderName;
124+ (NSString *) stringFromFilesNamed:(NSString *)fileName inFolder:(NSString *)folderName cache:(BOOL)useCache;
125
126+ (NSDictionary *)loadScripts;
127
128/* +writeDiagnosticData:toFileNamed:
129 +writeDiagnosticString:toFileNamed:
130 +writeDiagnosticPList:toFileNamed:
131
132 Write data to the specified path within the log directory. Slashes may be
133 used as path separators in name.
134 */
135+ (BOOL) writeDiagnosticData:(NSData *)data toFileNamed:(NSString *)name;
136+ (BOOL) writeDiagnosticString:(NSString *)string toFileNamed:(NSString *)name;
137+ (BOOL) writeDiagnosticPList:(id)plist toFileNamed:(NSString *)name;
138
139+ (NSString *) diagnosticFileLocation;
140
141+ (NSDictionary *) materialDefaults;
142
143// Clear ResourceManager-internal caches (not those handled by OOCacheManager)
144+ (void) clearCaches;
145
146@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()