Resources/Master Level
Resource Type | Levels |
---|---|
File Extension | .mlevel |
Used In Games | |
Container Format | BINA |
Editing Tools | |
Reverse Engineering Status | Done |
Starting with Sonic Frontiers, HE2 includes the Levels system to automatically and dynamically load resources when they are needed. Master Level is a resource type that contains information on which resources should be loaded to load a level, and also describes the dependencies between different levels. Master Level is stored in a Binary File container.
Structure[edit | edit source]
struct DependencyData {
const char* name;
unsigned long long unk1;
};
struct ResourceData {
const char* path;
const char* resourceType;
unsigned long long unk1;
};
struct LevelData {
const char* name;
int resourceCount;
int dependencyCount;
ResourceData** resources;
DependencyData** dependencies;
bool isPublic;
bool hasResources;
};
struct MasterLevelData {
unsigned int magic;
unsigned int version;
int levelCount;
LevelData** levels;
};
LevelData[edit | edit source]
The structure of the Master Level resource is fairly simple. At the top level, it simply consists of a list of level definitions. Each of these definitions contains the following data within them:
- The level name. This name is a unique identifier that's used whenever the game refers to the level, e.g. when it submits a "LoadLevel" request.
- A list of resources that must be loaded to load this level.
- A list of dependency levels, which will automatically be loaded when this level is loaded.
- A boolean
isPublic
flag. If this flag is true, the level will be registered as a loadable level. If it is not, then the level can only be loaded as a dependency of other levels. - A boolean
hasResources
flag. If this flag is false, the game will not try to load the resources associated with this level. It is unclear what the purpose of this flag is.
DependencyData[edit | edit source]
Every dependency of a level is described by a DependencyData
structure. It contains a pointer to the name of the dependency level. It also contains a second 64 bit zero value unk1
. It is possible that the whole of name
+ unk1
is actually a csl::ut::VariableString
object.
ResourceData[edit | edit source]
Every resource associated with a level is described by a ResourceData
structure. This structure contains the following:
- The path to the resource. This is a standard ResourceManager URI.
- The resource type. This is an engine internal resource type name like
ResReflection
. If this property is a null pointer, the resource type is deduced from the filename extension. - A 64 bit zero value property
unk1
. It is possible that the whole ofresourceType
+unk1
is actually acsl::ut::VariableString
object.