Handle mods specified on the command line when using the archive builder.

This was SVN commit r15372.
This commit is contained in:
leper
2014-06-15 16:43:08 +00:00
parent bec1e1edfd
commit f115759901
4 changed files with 20 additions and 7 deletions
+2 -1
View File
@@ -3,7 +3,7 @@ COMMAND LINE OPTIONS
Basic gameplay:
-autostart=... load a map instead of showing main menu (see below)
-editor launch the Atlas scenario editor
-mod NAME start the game using NAME mod
-mod=NAME start the game using NAME mod
-quickstart load faster (disables audio and some system info logging)
Autostart:
@@ -67,6 +67,7 @@ Windows-specific:
Archive builder:
-archivebuild=PATH system PATH of the base directory containing mod data to be archived/precached
specify all mods it depends on with -mod=NAME
-archivebuild-output=PATH system PATH to output of the resulting .zip archive (use with archivebuild)
-archivebuild-compress enable deflate compression in the .zip
(no zip compression by default since it hurts compression of release packages)
+8 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2013 Wildfire Games.
/* Copyright (C) 2014 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -461,6 +461,13 @@ static void RunGameOrAtlas(int argc, const char* argv[])
zip = mod.Filename().ChangeExtension(L".zip");
CArchiveBuilder builder(mod, paths.Cache());
// Add mods provided on the command line
// NOTE: We do not handle mods in the user mod path here
std::vector<CStr> mods = args.GetMultiple("mod");
for (size_t i = 0; i < mods.size(); ++i)
builder.AddBaseMod(paths.RData()/"mods"/mods[i]);
builder.Build(zip, args.Has("archivebuild-compress"));
CXeromyces::Terminate();
+7 -4
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2012 Wildfire Games.
/* Copyright (C) 2014 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -34,7 +34,7 @@
#include <boost/algorithm/string.hpp>
CArchiveBuilder::CArchiveBuilder(const OsPath& mod, const OsPath& tempdir) :
m_TempDir(tempdir)
m_TempDir(tempdir), m_NumBaseMods(0)
{
m_VFS = CreateVfs(20*MiB);
@@ -42,7 +42,8 @@ CArchiveBuilder::CArchiveBuilder(const OsPath& mod, const OsPath& tempdir) :
m_VFS->Mount(L"cache/", m_TempDir/"_archivecache"/"");
m_VFS->Mount(L"", mod/"", VFS_MOUNT_MUST_EXIST | VFS_MOUNT_KEEP_DELETED);
// Mount with highest priority so base mods do not overwrite files in this mod
m_VFS->Mount(L"", mod/"", VFS_MOUNT_MUST_EXIST | VFS_MOUNT_KEEP_DELETED, (size_t)-1);
// Collect the list of files before loading any base mods
vfs::ForEachFile(m_VFS, L"", &CollectFileCB, (uintptr_t)static_cast<void*>(this), 0, vfs::DIR_RECURSIVE);
@@ -57,7 +58,9 @@ CArchiveBuilder::~CArchiveBuilder()
void CArchiveBuilder::AddBaseMod(const OsPath& mod)
{
m_VFS->Mount(L"", mod/"", VFS_MOUNT_MUST_EXIST);
// Increase priority for each additional base mod, so that the
// mods are mounted in the same way as when starting the game.
m_VFS->Mount(L"", mod/"", VFS_MOUNT_MUST_EXIST, ++m_NumBaseMods);
}
void CArchiveBuilder::Build(const OsPath& archive, bool compress)
+3 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2014 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -43,6 +43,7 @@ public:
/**
* Add a mod which will be loaded but not archived, to provide
* files like textures.xml needed for the conversion.
* Added mods will be mounted with increasing priority.
* Typically this will be called with 'public', when packaging
* a user's mod.
* @param mod path to data/mods/foo directory, containing files for loading
@@ -62,6 +63,7 @@ private:
PIVFS m_VFS;
std::vector<VfsPath> m_Files;
OsPath m_TempDir;
size_t m_NumBaseMods;
};
#endif // INCLUDED_ARCHIVEBUILDER