Compare commits
4 Commits
a6e4e85470
...
8191d30b20
Author | SHA1 | Date |
---|---|---|
Jarrod Doyle | 8191d30b20 | |
Jarrod Doyle | 1aac751043 | |
Jarrod Doyle | ad08d373b7 | |
Jarrod Doyle | 7ae7407c2b |
|
@ -147,38 +147,40 @@ public class ResourcePathManager
|
||||||
throw new InvalidOperationException("Failed to find all installation config paths.");
|
throw new InvalidOperationException("Failed to find all installation config paths.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the paths of the base Fam and Obj resources so we can extract them.
|
// We need to know where all the texture and object resources are
|
||||||
var installCfgLines = File.ReadAllLines(configPaths[(int)ConfigFile.Install]);
|
var installCfgLines = File.ReadAllLines(configPaths[(int)ConfigFile.Install]);
|
||||||
FindConfigVar(installCfgLines, "resname_base", out var resPaths);
|
if (!FindConfigVar(installCfgLines, "resname_base", out var resPaths))
|
||||||
var baseFamPath = "";
|
{
|
||||||
var baseObjPath = "";
|
throw new InvalidOperationException("Failed to find resnames in install config");
|
||||||
|
}
|
||||||
|
|
||||||
|
var zipPaths = new List<string>();
|
||||||
foreach (var resPath in resPaths.Split('+'))
|
foreach (var resPath in resPaths.Split('+'))
|
||||||
{
|
{
|
||||||
var dir = Path.Join(installPath, ConvertSeparator(resPath));
|
var dir = Path.Join(installPath, ConvertSeparator(resPath));
|
||||||
|
if (!Directory.Exists(dir))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var path in Directory.GetFiles(dir))
|
foreach (var path in Directory.GetFiles(dir))
|
||||||
{
|
{
|
||||||
var name = Path.GetFileName(path).ToLower();
|
var name = Path.GetFileName(path).ToLower();
|
||||||
if (name == "fam.crf" && baseFamPath == "")
|
if (name is "fam.crf" or "obj.crf")
|
||||||
{
|
{
|
||||||
baseFamPath = path;
|
zipPaths.Add(path);
|
||||||
}
|
|
||||||
else if (name == "obj.crf" && baseObjPath == "")
|
|
||||||
{
|
|
||||||
baseObjPath = path;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do the extraction bro
|
// Do the extraction bro
|
||||||
(string, string)[] resources = [("fam", baseFamPath), ("obj", baseObjPath)];
|
// The path order is a priority order, so we don't want to overwrite any files when extracting
|
||||||
foreach (var (extractName, zipPath) in resources)
|
// TODO: Check if there's any problems caused by case sensitivity
|
||||||
|
foreach (var zipPath in zipPaths)
|
||||||
{
|
{
|
||||||
var extractPath = Path.Join(_extractionPath, extractName);
|
var resType = Path.GetFileNameWithoutExtension(zipPath);
|
||||||
if (Directory.Exists(extractPath))
|
var extractPath = Path.Join(_extractionPath, resType);
|
||||||
{
|
ZipFile.OpenRead(zipPath).ExtractToDirectory(extractPath, false);
|
||||||
Directory.Delete(extractPath, true);
|
|
||||||
}
|
|
||||||
ZipFile.OpenRead(zipPath).ExtractToDirectory(extractPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FindConfigVar(installCfgLines, "load_path", out var omsPath);
|
FindConfigVar(installCfgLines, "load_path", out var omsPath);
|
||||||
|
|
|
@ -92,7 +92,15 @@ public class LightMapper
|
||||||
Timing.TimeStage("Trace Scene", () => TraceScene(settings));
|
Timing.TimeStage("Trace Scene", () => TraceScene(settings));
|
||||||
Timing.TimeStage("Update AnimLight Cell Mapping", SetAnimLightCellMaps);
|
Timing.TimeStage("Update AnimLight Cell Mapping", SetAnimLightCellMaps);
|
||||||
|
|
||||||
// lmParams.ShadowType = LmParams.LightingMode.Raycast;
|
// We always do object casting, so it's nice to let dromed know that :)
|
||||||
|
lmParams.ShadowType = LmParams.LightingMode.Objcast;
|
||||||
|
if (rendParams is { useSunlight: true, sunlightMode: RendParams.SunlightMode.SingleUnshadowed })
|
||||||
|
{
|
||||||
|
rendParams.sunlightMode = RendParams.SunlightMode.SingleObjcastShadows;
|
||||||
|
} else if (rendParams is { useSunlight: true, sunlightMode: RendParams.SunlightMode.QuadUnshadowed })
|
||||||
|
{
|
||||||
|
rendParams.sunlightMode = RendParams.SunlightMode.QuadObjcastShadows;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save(string missionName)
|
public void Save(string missionName)
|
||||||
|
|
Loading…
Reference in New Issue