From 9e2c1eb637fdb8b72773b5b03037ad9642e4ae53 Mon Sep 17 00:00:00 2001 From: nkorslund Date: Wed, 29 Apr 2009 16:22:10 +0000 Subject: [PATCH] Added -xa (extract all) switch to bsatool git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@98 ea6a568a-9f4f-0410-981a-c910a81bb256 --- bsatool.d | 25 ++++++++++++++++++++++++- openmw.d | 8 ++++++++ plugins.cfg.linux | 2 +- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/bsatool.d b/bsatool.d index 956883941..3769d3f0a 100644 --- a/bsatool.d +++ b/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"); diff --git a/openmw.d b/openmw.d index a34976092..f8107bdf4 100644 --- a/openmw.d +++ b/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); diff --git a/plugins.cfg.linux b/plugins.cfg.linux index 31deb6ef6..51b57b1e5 100644 --- a/plugins.cfg.linux +++ b/plugins.cfg.linux @@ -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