Merge pull request #3917 from Mailaender/map-folders
Removed hard-coded map folders
This commit is contained in:
@@ -89,7 +89,8 @@ namespace OpenRA.FileFormats
|
|||||||
public static void Mount(string name, string annotation)
|
public static void Mount(string name, string annotation)
|
||||||
{
|
{
|
||||||
var optional = name.StartsWith("~");
|
var optional = name.StartsWith("~");
|
||||||
if (optional) name = name.Substring(1);
|
if (optional)
|
||||||
|
name = name.Substring(1);
|
||||||
|
|
||||||
// paths starting with ^ are relative to the support dir
|
// paths starting with ^ are relative to the support dir
|
||||||
if (name.StartsWith("^"))
|
if (name.StartsWith("^"))
|
||||||
@@ -115,7 +116,7 @@ namespace OpenRA.FileFormats
|
|||||||
|
|
||||||
public static bool Unmount(IFolder mount)
|
public static bool Unmount(IFolder mount)
|
||||||
{
|
{
|
||||||
return (MountedFolders.RemoveAll(f => f == mount) > 0);
|
return MountedFolders.RemoveAll(f => f == mount) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Mount(IFolder mount)
|
public static void Mount(IFolder mount)
|
||||||
@@ -19,7 +19,7 @@ namespace OpenRA.FileFormats
|
|||||||
public class Manifest
|
public class Manifest
|
||||||
{
|
{
|
||||||
public readonly string[]
|
public readonly string[]
|
||||||
Mods, Folders, Rules, ServerTraits,
|
Mods, Folders, MapFolders, Rules, ServerTraits,
|
||||||
Sequences, VoxelSequences, Cursors, Chrome, Assemblies, ChromeLayout,
|
Sequences, VoxelSequences, Cursors, Chrome, Assemblies, ChromeLayout,
|
||||||
Weapons, Voices, Notifications, Music, Movies, Translations, TileSets,
|
Weapons, Voices, Notifications, Music, Movies, Translations, TileSets,
|
||||||
ChromeMetrics, PackageContents;
|
ChromeMetrics, PackageContents;
|
||||||
@@ -39,6 +39,7 @@ namespace OpenRA.FileFormats
|
|||||||
|
|
||||||
// TODO: Use fieldloader
|
// TODO: Use fieldloader
|
||||||
Folders = YamlList(yaml, "Folders");
|
Folders = YamlList(yaml, "Folders");
|
||||||
|
MapFolders = YamlList(yaml, "MapFolders");
|
||||||
Packages = yaml["Packages"].NodesDict.ToDictionary(x => x.Key, x => x.Value.Value);
|
Packages = yaml["Packages"].NodesDict.ToDictionary(x => x.Key, x => x.Value.Value);
|
||||||
Rules = YamlList(yaml, "Rules");
|
Rules = YamlList(yaml, "Rules");
|
||||||
ServerTraits = YamlList(yaml, "ServerTraits");
|
ServerTraits = YamlList(yaml, "ServerTraits");
|
||||||
|
|||||||
@@ -90,11 +90,6 @@
|
|||||||
<Compile Include="FileFormats\Format40.cs" />
|
<Compile Include="FileFormats\Format40.cs" />
|
||||||
<Compile Include="FileFormats\Format80.cs" />
|
<Compile Include="FileFormats\Format80.cs" />
|
||||||
<Compile Include="FileFormats\IniFile.cs" />
|
<Compile Include="FileFormats\IniFile.cs" />
|
||||||
<Compile Include="Filesystem\FileSystem.cs" />
|
|
||||||
<Compile Include="Filesystem\Folder.cs" />
|
|
||||||
<Compile Include="Filesystem\InstallShieldPackage.cs" />
|
|
||||||
<Compile Include="Filesystem\MixFile.cs" />
|
|
||||||
<Compile Include="Filesystem\ZipFile.cs" />
|
|
||||||
<Compile Include="Graphics\Dune2ShpReader.cs" />
|
<Compile Include="Graphics\Dune2ShpReader.cs" />
|
||||||
<Compile Include="Graphics\IGraphicsDevice.cs" />
|
<Compile Include="Graphics\IGraphicsDevice.cs" />
|
||||||
<Compile Include="Graphics\IInputHandler.cs" />
|
<Compile Include="Graphics\IInputHandler.cs" />
|
||||||
@@ -148,11 +143,16 @@
|
|||||||
<Compile Include="Graphics\HvaReader.cs" />
|
<Compile Include="Graphics\HvaReader.cs" />
|
||||||
<Compile Include="StreamExts.cs" />
|
<Compile Include="StreamExts.cs" />
|
||||||
<Compile Include="FileFormats\WavLoader.cs" />
|
<Compile Include="FileFormats\WavLoader.cs" />
|
||||||
<Compile Include="Filesystem\D2kSoundResources.cs" />
|
|
||||||
<Compile Include="Graphics\R8Reader.cs" />
|
<Compile Include="Graphics\R8Reader.cs" />
|
||||||
<Compile Include="Graphics\TileSetRenderer.cs" />
|
<Compile Include="Graphics\TileSetRenderer.cs" />
|
||||||
<Compile Include="Keycode.cs" />
|
<Compile Include="Keycode.cs" />
|
||||||
<Compile Include="Hotkey.cs" />
|
<Compile Include="Hotkey.cs" />
|
||||||
|
<Compile Include="FileSystem\FileSystem.cs" />
|
||||||
|
<Compile Include="FileSystem\Folder.cs" />
|
||||||
|
<Compile Include="FileSystem\InstallShieldPackage.cs" />
|
||||||
|
<Compile Include="FileSystem\MixFile.cs" />
|
||||||
|
<Compile Include="FileSystem\ZipFile.cs" />
|
||||||
|
<Compile Include="FileSystem\D2kSoundResources.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||||
|
|||||||
@@ -34,12 +34,21 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
string[] noMaps = { };
|
string[] noMaps = { };
|
||||||
|
|
||||||
|
// ignore optional flag
|
||||||
|
if (dir.StartsWith("~"))
|
||||||
|
dir = dir.Substring(1);
|
||||||
|
|
||||||
|
// paths starting with ^ are relative to the user directory
|
||||||
|
if (dir.StartsWith("^"))
|
||||||
|
dir = Platform.SupportDir + dir.Substring(1);
|
||||||
|
|
||||||
if (!Directory.Exists(dir))
|
if (!Directory.Exists(dir))
|
||||||
return noMaps;
|
return noMaps;
|
||||||
|
|
||||||
return Directory.GetDirectories(dir)
|
var dirsWithMaps = Directory.GetDirectories(dir)
|
||||||
.Concat(Directory.GetFiles(dir, "*.zip"))
|
.Where(d => Directory.GetFiles(d, "map.yaml").Any() && Directory.GetFiles(d, "map.bin").Any());
|
||||||
.Concat(Directory.GetFiles(dir, "*.oramap"));
|
|
||||||
|
return dirsWithMaps.Concat(Directory.GetFiles(dir, "*.oramap"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModData(params string[] mods)
|
public ModData(params string[] mods)
|
||||||
@@ -52,7 +61,7 @@ namespace OpenRA
|
|||||||
LoadScreen.Display();
|
LoadScreen.Display();
|
||||||
WidgetLoader = new WidgetLoader(this);
|
WidgetLoader = new WidgetLoader(this);
|
||||||
|
|
||||||
AvailableMaps = FindMaps(Manifest.Mods);
|
AvailableMaps = FindMaps();
|
||||||
|
|
||||||
// HACK: Mount only local folders so we have a half-working environment for the asset installer
|
// HACK: Mount only local folders so we have a half-working environment for the asset installer
|
||||||
FileSystem.UnmountAll();
|
FileSystem.UnmountAll();
|
||||||
@@ -138,10 +147,9 @@ namespace OpenRA
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<string, Map> FindMaps(string[] mods)
|
Dictionary<string, Map> FindMaps()
|
||||||
{
|
{
|
||||||
var paths = mods.SelectMany(p => FindMapsIn("mods{0}{1}{0}maps{0}".F(Path.DirectorySeparatorChar, p)))
|
var paths = Manifest.MapFolders.SelectMany(f => FindMapsIn(f));
|
||||||
.Concat(mods.SelectMany(p => FindMapsIn("{1}maps{0}{2}{0}".F(Path.DirectorySeparatorChar, Platform.SupportDir, p))));
|
|
||||||
|
|
||||||
var ret = new Dictionary<string, Map>();
|
var ret = new Dictionary<string, Map>();
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ Folders:
|
|||||||
./mods/cnc/uibits
|
./mods/cnc/uibits
|
||||||
~^/Content/cnc
|
~^/Content/cnc
|
||||||
|
|
||||||
|
MapFolders:
|
||||||
|
./mods/cnc/maps
|
||||||
|
~^/maps/cnc
|
||||||
|
|
||||||
Packages:
|
Packages:
|
||||||
overrides.mix
|
overrides.mix
|
||||||
bluetib.mix
|
bluetib.mix
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ Folders:
|
|||||||
~^/Content/d2k/GAMESFX
|
~^/Content/d2k/GAMESFX
|
||||||
~^/Content/d2k/Music
|
~^/Content/d2k/Music
|
||||||
|
|
||||||
|
MapFolders:
|
||||||
|
./mods/d2k/maps
|
||||||
|
~^/maps/d2k
|
||||||
|
|
||||||
Packages:
|
Packages:
|
||||||
SOUND.RS
|
SOUND.RS
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
crate:
|
|
||||||
idle: DATA.R8
|
|
||||||
Start: 102
|
|
||||||
ZOffset: -511
|
|
||||||
Offset: -16,-16
|
|
||||||
land: DATA.R8
|
|
||||||
Start: 102
|
|
||||||
ZOffset: -511
|
|
||||||
Offset: -16,-16
|
|
||||||
|
|
||||||
spicebloom:
|
|
||||||
make: DATA.R8
|
|
||||||
Start: 107
|
|
||||||
Length: 3
|
|
||||||
Offset: -16,-16
|
|
||||||
active: DATA.R8
|
|
||||||
Start: 109
|
|
||||||
Length: 1
|
|
||||||
ZOffset: -511
|
|
||||||
Offset: -16,-16
|
|
||||||
idle: DATA.R8
|
|
||||||
Start: 109
|
|
||||||
ZOffset: -511
|
|
||||||
Offset: -16,-16
|
|
||||||
@@ -12,6 +12,10 @@ Folders:
|
|||||||
./mods/ra/uibits
|
./mods/ra/uibits
|
||||||
~^/Content/ra
|
~^/Content/ra
|
||||||
|
|
||||||
|
MapFolders:
|
||||||
|
./mods/ra/maps
|
||||||
|
~^/maps/ra
|
||||||
|
|
||||||
Packages:
|
Packages:
|
||||||
~main.mix
|
~main.mix
|
||||||
redalert.mix
|
redalert.mix
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ Folders:
|
|||||||
# Red Alert
|
# Red Alert
|
||||||
./mods/ra/uibits
|
./mods/ra/uibits
|
||||||
|
|
||||||
|
MapFolders:
|
||||||
|
./mods/ts/maps
|
||||||
|
~^/maps/ts
|
||||||
|
|
||||||
Packages:
|
Packages:
|
||||||
# Red Alert
|
# Red Alert
|
||||||
interior.mix
|
interior.mix
|
||||||
|
|||||||
Reference in New Issue
Block a user