mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-13 16:36:43 +00:00
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
This commit is contained in:
parent
d3666aac17
commit
d5e60a32ed
4 changed files with 61 additions and 24 deletions
10
Makefile
10
Makefile
|
@ -37,10 +37,10 @@ all: makedirs openmw esmtool niftool bsatool bored
|
||||||
cpp_ogre.o: $(ogre_cpp_files)
|
cpp_ogre.o: $(ogre_cpp_files)
|
||||||
$(OGCC) -c $<
|
$(OGCC) -c $<
|
||||||
|
|
||||||
objs/%.o: %.d
|
objs/%.o: %.d makedirs
|
||||||
$(DMD) -c $< -of$@
|
$(DMD) -c $< -of$@
|
||||||
|
|
||||||
nifobjs/%.o: %.d
|
nifobjs/%.o: %.d makedirs
|
||||||
$(DMD) -debug=warnstd -debug=check -debug=statecheck -debug=strict -debug=verbose -c $< -of$@
|
$(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
|
# This is a hack for gdmd (dmd-like frontend to gdc), since it does
|
||||||
|
@ -78,6 +78,6 @@ bored: bored.d
|
||||||
$(DMD) $^
|
$(DMD) $^
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm cpp_ogre.o
|
-rm -f cpp_ogre.o
|
||||||
-rm openmw esmtool niftool bsatool bored
|
-rm -f openmw esmtool niftool bsatool bored
|
||||||
-rm -r objs/ nifobjs/ dsss_objs/
|
-rm -rf objs/ nifobjs/ dsss_objs/
|
||||||
|
|
|
@ -31,6 +31,7 @@ import std.stdio;
|
||||||
import monster.util.string;
|
import monster.util.string;
|
||||||
|
|
||||||
import core.inifile;
|
import core.inifile;
|
||||||
|
import core.filefinder;
|
||||||
|
|
||||||
import sound.audio;
|
import sound.audio;
|
||||||
|
|
||||||
|
@ -79,6 +80,9 @@ struct ConfigManager
|
||||||
// from separate sessions don't overwrite each other.
|
// from separate sessions don't overwrite each other.
|
||||||
int screenShotNum;
|
int screenShotNum;
|
||||||
|
|
||||||
|
// Game files to load (max 255)
|
||||||
|
char[][] gameFiles;
|
||||||
|
|
||||||
// Directories
|
// Directories
|
||||||
char[] dataDir;
|
char[] dataDir;
|
||||||
char[] esmDir;
|
char[] esmDir;
|
||||||
|
@ -267,6 +271,47 @@ struct ConfigManager
|
||||||
musDir = dataDir ~ "Music/Explore/";
|
musDir = dataDir ~ "Music/Explore/";
|
||||||
musDir2 = dataDir ~ "Music/Battle/";
|
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
|
/* Don't bother reading every directory seperately
|
||||||
bsaDir = ini.getString("General", "BSA Directory", "data/");
|
bsaDir = ini.getString("General", "BSA Directory", "data/");
|
||||||
esmDir = ini.getString("General", "ESM Directory", "data/");
|
esmDir = ini.getString("General", "ESM Directory", "data/");
|
||||||
|
@ -326,6 +371,10 @@ struct ConfigManager
|
||||||
writeFloat("SFX Volume", sfxVolume);
|
writeFloat("SFX Volume", sfxVolume);
|
||||||
writeBool("Enable Music", useMusic);
|
writeBool("Enable Music", useMusic);
|
||||||
|
|
||||||
|
section("Game Files");
|
||||||
|
foreach(int i, ref s; gameFiles)
|
||||||
|
writeString(format("GameFile[%d]",i), s[esmDir.length..$]);
|
||||||
|
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,6 +153,11 @@ class FileFinder
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool has(char[] file)
|
||||||
|
{
|
||||||
|
return lookup.inList(file);
|
||||||
|
}
|
||||||
|
|
||||||
int opApply(int delegate(ref char[]) del)
|
int opApply(int delegate(ref char[]) del)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
21
openmw.d
21
openmw.d
|
@ -140,25 +140,8 @@ void main(char[][] args)
|
||||||
initializeSound();
|
initializeSound();
|
||||||
resources.initResources();
|
resources.initResources();
|
||||||
|
|
||||||
// Files to load
|
// Load all ESM and ESP files
|
||||||
/*
|
loadTESFiles(config.gameFiles);
|
||||||
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);
|
|
||||||
|
|
||||||
CellData cd = cellList.get();
|
CellData cd = cellList.get();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue