forked from mirror/openmw-tes3mp
Added -xa (extract all) switch to bsatool
git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@98 ea6a568a-9f4f-0410-981a-c910a81bb256
This commit is contained in:
parent
600583cb89
commit
9e2c1eb637
3 changed files with 33 additions and 2 deletions
25
bsatool.d
25
bsatool.d
|
@ -53,6 +53,26 @@ void scanAllNifs(BSAFile f)
|
||||||
writefln("Total NIF/KF size in this archive: ", totSize);
|
writefln("Total NIF/KF size in this archive: ", totSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dumpAllFiles(BSAFile f)
|
||||||
|
{
|
||||||
|
File o = new File();
|
||||||
|
|
||||||
|
auto files = f.getFiles();
|
||||||
|
|
||||||
|
foreach(int ind, file; files)
|
||||||
|
{
|
||||||
|
void[] s = cast(ubyte[]) f.findSlice(ind);
|
||||||
|
char[] name = file.name;
|
||||||
|
assert(s !is null);
|
||||||
|
name = getWinBaseName(name);
|
||||||
|
|
||||||
|
o.open(name, FileMode.OutNew);
|
||||||
|
o.writeExact(s.ptr, s.length);
|
||||||
|
o.close();
|
||||||
|
writefln("Wrote '%s'", name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void listFiles(BSAFile f)
|
void listFiles(BSAFile f)
|
||||||
{
|
{
|
||||||
BSAFile.FileStruct[] files = f.getFiles();
|
BSAFile.FileStruct[] files = f.getFiles();
|
||||||
|
@ -69,6 +89,7 @@ int main(char[][] args)
|
||||||
writefln("%s", msg);
|
writefln("%s", msg);
|
||||||
writefln("Format: bsatool archive.bsa [-x filename] [-l] [-n]");
|
writefln("Format: bsatool archive.bsa [-x filename] [-l] [-n]");
|
||||||
writefln(" -x filename extract file");
|
writefln(" -x filename extract file");
|
||||||
|
writefln(" -xa extract everything");
|
||||||
writefln(" -l list all files");
|
writefln(" -l list all files");
|
||||||
writefln(" -n scan through all nifs");
|
writefln(" -n scan through all nifs");
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -79,11 +100,12 @@ int main(char[][] args)
|
||||||
initializeMemoryRegions();
|
initializeMemoryRegions();
|
||||||
|
|
||||||
char[] filename, ext;
|
char[] filename, ext;
|
||||||
bool list, nifs, extract;
|
bool list, nifs, extract, dumpAll;
|
||||||
foreach(char[] a; args[1..$])
|
foreach(char[] a; args[1..$])
|
||||||
if(a == "-l") list = true;
|
if(a == "-l") list = true;
|
||||||
else if(a == "-n") nifs = true;
|
else if(a == "-n") nifs = true;
|
||||||
else if(a == "-x") extract = true;
|
else if(a == "-x") extract = true;
|
||||||
|
else if(a == "-xa") dumpAll = true;
|
||||||
else if(extract && ext == "") ext = a;
|
else if(extract && ext == "") ext = a;
|
||||||
else if(filename == "") filename = a;
|
else if(filename == "") filename = a;
|
||||||
else return help("Unknown option " ~ a);
|
else return help("Unknown option " ~ a);
|
||||||
|
@ -94,6 +116,7 @@ int main(char[][] args)
|
||||||
|
|
||||||
if(list) listFiles(f);
|
if(list) listFiles(f);
|
||||||
if(nifs) scanAllNifs(f);
|
if(nifs) scanAllNifs(f);
|
||||||
|
if(dumpAll) dumpAllFiles(f);
|
||||||
if(extract)
|
if(extract)
|
||||||
{
|
{
|
||||||
if(ext == "") return help("No file to extract");
|
if(ext == "") return help("No file to extract");
|
||||||
|
|
8
openmw.d
8
openmw.d
|
@ -127,6 +127,8 @@ void main(char[][] args)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
writefln("At: ", __FILE__, ":", __LINE__);
|
||||||
|
|
||||||
initializeMemoryRegions();
|
initializeMemoryRegions();
|
||||||
initMonsterScripts();
|
initMonsterScripts();
|
||||||
|
|
||||||
|
@ -136,6 +138,8 @@ void main(char[][] args)
|
||||||
return;
|
return;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
writefln("At: ", __FILE__, ":", __LINE__);
|
||||||
|
|
||||||
config.initialize(resetKeys);
|
config.initialize(resetKeys);
|
||||||
scope(exit) config.writeConfig();
|
scope(exit) config.writeConfig();
|
||||||
|
|
||||||
|
@ -164,9 +168,13 @@ void main(char[][] args)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
writefln("At: ", __FILE__, ":", __LINE__);
|
||||||
|
|
||||||
if(!noSound) initializeSound();
|
if(!noSound) initializeSound();
|
||||||
resources.initResources();
|
resources.initResources();
|
||||||
|
|
||||||
|
writefln("At: ", __FILE__, ":", __LINE__);
|
||||||
|
|
||||||
// Load all ESM and ESP files
|
// Load all ESM and ESP files
|
||||||
loadTESFiles(config.gameFiles);
|
loadTESFiles(config.gameFiles);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Defines plugins to load
|
# Defines plugins to load
|
||||||
|
|
||||||
# Define plugin folder
|
# Define plugin folder
|
||||||
PluginFolder=/usr/lib/OGRE
|
PluginFolder=/usr/local/lib/OGRE
|
||||||
|
|
||||||
# Define plugins
|
# Define plugins
|
||||||
Plugin=RenderSystem_GL
|
Plugin=RenderSystem_GL
|
||||||
|
|
Loading…
Reference in a new issue