Compare commits

..

No commits in common. "8191d30b20c5f09d46913d640cc820b2848c94db" and "a6e4e8547080fc2a654cf9eae2cb21a646b68723" have entirely different histories.

2 changed files with 19 additions and 29 deletions

View File

@ -147,40 +147,38 @@ public class ResourcePathManager
throw new InvalidOperationException("Failed to find all installation config paths."); throw new InvalidOperationException("Failed to find all installation config paths.");
} }
// We need to know where all the texture and object resources are // Get the paths of the base Fam and Obj resources so we can extract them.
var installCfgLines = File.ReadAllLines(configPaths[(int)ConfigFile.Install]); var installCfgLines = File.ReadAllLines(configPaths[(int)ConfigFile.Install]);
if (!FindConfigVar(installCfgLines, "resname_base", out var resPaths)) FindConfigVar(installCfgLines, "resname_base", out var resPaths);
{ var baseFamPath = "";
throw new InvalidOperationException("Failed to find resnames in install config"); var baseObjPath = "";
}
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 is "fam.crf" or "obj.crf") if (name == "fam.crf" && baseFamPath == "")
{ {
zipPaths.Add(path); baseFamPath = path;
}
else if (name == "obj.crf" && baseObjPath == "")
{
baseObjPath = path;
} }
} }
} }
// Do the extraction bro // Do the extraction bro
// The path order is a priority order, so we don't want to overwrite any files when extracting (string, string)[] resources = [("fam", baseFamPath), ("obj", baseObjPath)];
// TODO: Check if there's any problems caused by case sensitivity foreach (var (extractName, zipPath) in resources)
foreach (var zipPath in zipPaths)
{ {
var resType = Path.GetFileNameWithoutExtension(zipPath); var extractPath = Path.Join(_extractionPath, extractName);
var extractPath = Path.Join(_extractionPath, resType); if (Directory.Exists(extractPath))
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);

View File

@ -92,15 +92,7 @@ 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);
// We always do object casting, so it's nice to let dromed know that :) // lmParams.ShadowType = LmParams.LightingMode.Raycast;
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)