ESM files can be specified in the config file

git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@22 ea6a568a-9f4f-0410-981a-c910a81bb256
actorid
nkorslund 16 years ago
parent d3666aac17
commit d5e60a32ed

@ -37,10 +37,10 @@ all: makedirs openmw esmtool niftool bsatool bored
cpp_ogre.o: $(ogre_cpp_files)
$(OGCC) -c $<
objs/%.o: %.d
objs/%.o: %.d makedirs
$(DMD) -c $< -of$@
nifobjs/%.o: %.d
nifobjs/%.o: %.d makedirs
$(DMD) -debug=warnstd -debug=check -debug=statecheck -debug=strict -debug=verbose -c $< -of$@
# This is a hack for gdmd (dmd-like frontend to gdc), since it does
@ -78,6 +78,6 @@ bored: bored.d
$(DMD) $^
clean:
-rm cpp_ogre.o
-rm openmw esmtool niftool bsatool bored
-rm -r objs/ nifobjs/ dsss_objs/
-rm -f cpp_ogre.o
-rm -f openmw esmtool niftool bsatool bored
-rm -rf objs/ nifobjs/ dsss_objs/

@ -31,6 +31,7 @@ import std.stdio;
import monster.util.string;
import core.inifile;
import core.filefinder;
import sound.audio;
@ -79,6 +80,9 @@ struct ConfigManager
// from separate sessions don't overwrite each other.
int screenShotNum;
// Game files to load (max 255)
char[][] gameFiles;
// Directories
char[] dataDir;
char[] esmDir;
@ -267,6 +271,47 @@ struct ConfigManager
musDir = dataDir ~ "Music/Explore/";
musDir2 = dataDir ~ "Music/Battle/";
// A maximum of 255 game files are allowed. Search the whole range
// in case some holes developed in the number sequence. This isn't
// a great way of specifying files (it's just a copy of the flawed
// model that Morrowind uses), but it will do for the time being.
FileFinder srch = new FileFinder(esmDir, null, Recurse.No);
for(int i = 0;i < 255;i++)
{
char[] s = ini.getString("Game Files", format("GameFile[%d]",i), null);
if(s != null && srch.has(s))
{
writefln("Adding game file %s", s);
gameFiles ~= esmDir ~ s;
}
}
delete srch;
if(gameFiles.length == 0)
{
// No game files set. Look in the esmDir for Morrowind.esm.
// We can add Tribunal.esm, and Bloodmoon.esm as defaults too
// later, when we're out of testing mode.
char[][] baseFiles = ["Morrowind.esm"];
//char[][] baseFiles = ["Morrowind.esm","Tribunal.esm","Bloodmoon.esm"];
srch = new FileFinder(esmDir, "esm", Recurse.No);
foreach(ref s; baseFiles)
{
if(srch.has(s))
{
writefln("Adding game file %s", s);
gameFiles ~= esmDir ~ s;
}
}
delete srch;
}
// FIXME: Must sort gameFiles so that ESMs come first, then ESPs.
// I don't know if this needs to be done by filename, or by the
// actual file type..
// Further sort the two groups by file date (oldest first).
/* Don't bother reading every directory seperately
bsaDir = ini.getString("General", "BSA Directory", "data/");
esmDir = ini.getString("General", "ESM Directory", "data/");
@ -326,6 +371,10 @@ struct ConfigManager
writeFloat("SFX Volume", sfxVolume);
writeBool("Enable Music", useMusic);
section("Game Files");
foreach(int i, ref s; gameFiles)
writeString(format("GameFile[%d]",i), s[esmDir.length..$]);
close();
}
}

@ -153,6 +153,11 @@ class FileFinder
return 0;
}
bool has(char[] file)
{
return lookup.inList(file);
}
int opApply(int delegate(ref char[]) del)
{
int res = 0;

@ -140,25 +140,8 @@ void main(char[][] args)
initializeSound();
resources.initResources();
// Files to load
/*
const char[][] files = ["Morrowind.esm",
"Tribunal.esm",
"Bloodmoon.esm"];
/*/
const char[][] files = ["Morrowind.esm"];
//*/
// Add the path to the file name. The path is read from the config
// file.
char[][] esmFiles;
esmFiles.length = files.length;
foreach(int i, char[] ef; files)
// TODO: Quick hack, use FileFinder instead.
esmFiles[i] = config.esmDir ~ ef;
// Load all data from the ESM files
loadTESFiles(esmFiles);
// Load all ESM and ESP files
loadTESFiles(config.gameFiles);
CellData cd = cellList.get();

Loading…
Cancel
Save