mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-13 11:39:47 +00:00
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
BSAFile.FileStruct[] files = f.getFiles();
|
||||
|
@ -69,6 +89,7 @@ int main(char[][] args)
|
|||
writefln("%s", msg);
|
||||
writefln("Format: bsatool archive.bsa [-x filename] [-l] [-n]");
|
||||
writefln(" -x filename extract file");
|
||||
writefln(" -xa extract everything");
|
||||
writefln(" -l list all files");
|
||||
writefln(" -n scan through all nifs");
|
||||
return 1;
|
||||
|
@ -79,11 +100,12 @@ int main(char[][] args)
|
|||
initializeMemoryRegions();
|
||||
|
||||
char[] filename, ext;
|
||||
bool list, nifs, extract;
|
||||
bool list, nifs, extract, dumpAll;
|
||||
foreach(char[] a; args[1..$])
|
||||
if(a == "-l") list = true;
|
||||
else if(a == "-n") nifs = true;
|
||||
else if(a == "-x") extract = true;
|
||||
else if(a == "-xa") dumpAll = true;
|
||||
else if(extract && ext == "") ext = a;
|
||||
else if(filename == "") filename = a;
|
||||
else return help("Unknown option " ~ a);
|
||||
|
@ -94,6 +116,7 @@ int main(char[][] args)
|
|||
|
||||
if(list) listFiles(f);
|
||||
if(nifs) scanAllNifs(f);
|
||||
if(dumpAll) dumpAllFiles(f);
|
||||
if(extract)
|
||||
{
|
||||
if(ext == "") return help("No file to extract");
|
||||
|
|
8
openmw.d
8
openmw.d
|
@ -127,6 +127,8 @@ void main(char[][] args)
|
|||
return;
|
||||
}
|
||||
|
||||
writefln("At: ", __FILE__, ":", __LINE__);
|
||||
|
||||
initializeMemoryRegions();
|
||||
initMonsterScripts();
|
||||
|
||||
|
@ -136,6 +138,8 @@ void main(char[][] args)
|
|||
return;
|
||||
*/
|
||||
|
||||
writefln("At: ", __FILE__, ":", __LINE__);
|
||||
|
||||
config.initialize(resetKeys);
|
||||
scope(exit) config.writeConfig();
|
||||
|
||||
|
@ -164,9 +168,13 @@ void main(char[][] args)
|
|||
return;
|
||||
}
|
||||
|
||||
writefln("At: ", __FILE__, ":", __LINE__);
|
||||
|
||||
if(!noSound) initializeSound();
|
||||
resources.initResources();
|
||||
|
||||
writefln("At: ", __FILE__, ":", __LINE__);
|
||||
|
||||
// Load all ESM and ESP files
|
||||
loadTESFiles(config.gameFiles);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Defines plugins to load
|
||||
|
||||
# Define plugin folder
|
||||
PluginFolder=/usr/lib/OGRE
|
||||
PluginFolder=/usr/local/lib/OGRE
|
||||
|
||||
# Define plugins
|
||||
Plugin=RenderSystem_GL
|
||||
|
|
Loading…
Reference in a new issue