mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-24 16:02:54 +08:00
Added basic DLC subpacks support
This commit is contained in:
parent
f2c2bba99d
commit
6e2c81675e
@ -21,6 +21,7 @@ namespace CodeWalker.GameFiles
|
|||||||
public bool isLevelPack { get; set; }
|
public bool isLevelPack { get; set; }
|
||||||
|
|
||||||
public RpfFile DlcFile { get; set; } //used by GameFileCache
|
public RpfFile DlcFile { get; set; } //used by GameFileCache
|
||||||
|
public List<RpfFile> DlcSubpacks { get; set; } //used by GameFileCache
|
||||||
public DlcContentFile ContentFile { get; set; }
|
public DlcContentFile ContentFile { get; set; }
|
||||||
|
|
||||||
public void Load(XmlDocument doc)
|
public void Load(XmlDocument doc)
|
||||||
|
@ -490,6 +490,21 @@ namespace CodeWalker.GameFiles
|
|||||||
|
|
||||||
DlcActiveRpfs.Add(dlcfile);
|
DlcActiveRpfs.Add(dlcfile);
|
||||||
|
|
||||||
|
for (int i = 1; i <= setupfile.subPackCount; i++)
|
||||||
|
{
|
||||||
|
var subpackPath = dlcfile.Path.Replace("\\dlc.rpf", "\\dlc" + i.ToString() + ".rpf");
|
||||||
|
var subpack = RpfMan.FindRpfFile(subpackPath);
|
||||||
|
if (subpack != null)
|
||||||
|
{
|
||||||
|
DlcActiveRpfs.Add(subpack);
|
||||||
|
|
||||||
|
if (setupfile.DlcSubpacks == null) setupfile.DlcSubpacks = new List<RpfFile>();
|
||||||
|
setupfile.DlcSubpacks.Add(subpack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
string dlcname = GetDlcNameFromPath(dlcfile.Path);
|
string dlcname = GetDlcNameFromPath(dlcfile.Path);
|
||||||
|
|
||||||
|
|
||||||
@ -502,7 +517,7 @@ namespace CodeWalker.GameFiles
|
|||||||
//if (rpfkvp.Value.overlay)
|
//if (rpfkvp.Value.overlay)
|
||||||
AddDlcOverlayRpf(rpfkvp.Key, umpath, setupfile, overlays);
|
AddDlcOverlayRpf(rpfkvp.Key, umpath, setupfile, overlays);
|
||||||
|
|
||||||
AddDlcActiveMapRpfFile(rpfkvp.Key, phpath);
|
AddDlcActiveMapRpfFile(rpfkvp.Key, phpath, setupfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -561,7 +576,7 @@ namespace CodeWalker.GameFiles
|
|||||||
//if (rpfdatafile.overlay)
|
//if (rpfdatafile.overlay)
|
||||||
AddDlcOverlayRpf(dfn, rpfdatafile.filename, setupfile, overlays);
|
AddDlcOverlayRpf(dfn, rpfdatafile.filename, setupfile, overlays);
|
||||||
|
|
||||||
AddDlcActiveMapRpfFile(dfn, phpath);
|
AddDlcActiveMapRpfFile(dfn, phpath, setupfile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -608,7 +623,7 @@ namespace CodeWalker.GameFiles
|
|||||||
|
|
||||||
AddDlcOverlayRpf(fpath, umpath, setupfile, overlays);
|
AddDlcOverlayRpf(fpath, umpath, setupfile, overlays);
|
||||||
|
|
||||||
AddDlcActiveMapRpfFile(fpath, phpath);
|
AddDlcActiveMapRpfFile(fpath, phpath, setupfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -627,7 +642,7 @@ namespace CodeWalker.GameFiles
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddDlcActiveMapRpfFile(string vpath, string phpath)
|
private void AddDlcActiveMapRpfFile(string vpath, string phpath, DlcSetupFile setupfile)
|
||||||
{
|
{
|
||||||
vpath = vpath.ToLowerInvariant();
|
vpath = vpath.ToLowerInvariant();
|
||||||
phpath = phpath.ToLowerInvariant();
|
phpath = phpath.ToLowerInvariant();
|
||||||
@ -684,10 +699,26 @@ namespace CodeWalker.GameFiles
|
|||||||
{
|
{
|
||||||
string devname = setupfile.deviceName.ToLowerInvariant();
|
string devname = setupfile.deviceName.ToLowerInvariant();
|
||||||
string fpath = GetDlcPlatformPath(path).ToLowerInvariant();
|
string fpath = GetDlcPlatformPath(path).ToLowerInvariant();
|
||||||
string kpath = fpath.Replace(devname + ":\\", "");
|
string kpath = fpath;//.Replace(devname + ":\\", "");
|
||||||
string dlcpath = setupfile.DlcFile.Path;
|
string dlcpath = setupfile.DlcFile.Path;
|
||||||
fpath = fpath.Replace(devname + ":", dlcpath);
|
fpath = fpath.Replace(devname + ":", dlcpath);
|
||||||
fpath = fpath.Replace("x64:", dlcpath + "\\x64").Replace('/', '\\');
|
fpath = fpath.Replace("x64:", dlcpath + "\\x64").Replace('/', '\\');
|
||||||
|
if (setupfile.DlcSubpacks != null)
|
||||||
|
{
|
||||||
|
if (RpfMan.FindRpfFile(fpath) == null)
|
||||||
|
{
|
||||||
|
foreach (var subpack in setupfile.DlcSubpacks)
|
||||||
|
{
|
||||||
|
dlcpath = subpack.Path;
|
||||||
|
var tpath = kpath.Replace(devname + ":", dlcpath);
|
||||||
|
tpath = tpath.Replace("x64:", dlcpath + "\\x64").Replace('/', '\\');
|
||||||
|
if (RpfMan.FindRpfFile(tpath) != null)
|
||||||
|
{
|
||||||
|
return GetDlcPatchedPath(tpath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return GetDlcPatchedPath(fpath);
|
return GetDlcPatchedPath(fpath);
|
||||||
}
|
}
|
||||||
private string GetDlcOverlayPath(string path, DlcSetupFile setupfile)
|
private string GetDlcOverlayPath(string path, DlcSetupFile setupfile)
|
||||||
|
@ -124,7 +124,7 @@ namespace CodeWalker.GameFiles
|
|||||||
|
|
||||||
private void AddRpfFile(RpfFile file, bool isdlc, bool ismod)
|
private void AddRpfFile(RpfFile file, bool isdlc, bool ismod)
|
||||||
{
|
{
|
||||||
isdlc = isdlc || (file.NameLower == "dlc.rpf") || (file.NameLower == "update.rpf");
|
isdlc = isdlc || (file.NameLower == "update.rpf") || (file.NameLower.StartsWith("dlc") && file.NameLower.EndsWith(".rpf"));
|
||||||
ismod = ismod || (file.Path.StartsWith("mods\\"));
|
ismod = ismod || (file.Path.StartsWith("mods\\"));
|
||||||
|
|
||||||
if (file.AllEntries != null)
|
if (file.AllEntries != null)
|
||||||
|
@ -420,19 +420,22 @@ namespace CodeWalker.World
|
|||||||
{
|
{
|
||||||
AddRpfYnds(rpffile, yndentries);
|
AddRpfYnds(rpffile, yndentries);
|
||||||
}
|
}
|
||||||
var updrpf = rpfman.FindRpfFile("update\\update.rpf"); //load nodes from patch area...
|
if (GameFileCache.EnableDlc)
|
||||||
if (updrpf != null)
|
|
||||||
{
|
{
|
||||||
foreach (var rpffile in updrpf.Children)
|
var updrpf = rpfman.FindRpfFile("update\\update.rpf"); //load nodes from patch area...
|
||||||
|
if (updrpf != null)
|
||||||
{
|
{
|
||||||
AddRpfYnds(rpffile, yndentries);
|
foreach (var rpffile in updrpf.Children)
|
||||||
|
{
|
||||||
|
AddRpfYnds(rpffile, yndentries);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
foreach (var dlcrpf in GameFileCache.DlcActiveRpfs) //load nodes from current dlc rpfs
|
||||||
foreach (var dlcrpf in GameFileCache.DlcActiveRpfs) //load nodes from current dlc rpfs
|
|
||||||
{
|
|
||||||
foreach (var rpffile in dlcrpf.Children)
|
|
||||||
{
|
{
|
||||||
AddRpfYnds(rpffile, yndentries);
|
foreach (var rpffile in dlcrpf.Children)
|
||||||
|
{
|
||||||
|
AddRpfYnds(rpffile, yndentries);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -721,19 +724,22 @@ namespace CodeWalker.World
|
|||||||
{
|
{
|
||||||
AddRpfYnvs(rpffile, ynventries);
|
AddRpfYnvs(rpffile, ynventries);
|
||||||
}
|
}
|
||||||
foreach (var dlcrpf in GameFileCache.DlcActiveRpfs) //load navmeshes from current dlc rpfs
|
if (GameFileCache.EnableDlc)
|
||||||
{
|
{
|
||||||
foreach (var rpffile in dlcrpf.Children)
|
var updrpf = rpfman.FindRpfFile("update\\update.rpf"); //load navmeshes from patch area...
|
||||||
|
if (updrpf != null)
|
||||||
{
|
{
|
||||||
AddRpfYnvs(rpffile, ynventries);
|
foreach (var rpffile in updrpf.Children)
|
||||||
|
{
|
||||||
|
AddRpfYnvs(rpffile, ynventries);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
foreach (var dlcrpf in GameFileCache.DlcActiveRpfs) //load navmeshes from current dlc rpfs
|
||||||
var updrpf = rpfman.FindRpfFile("update\\update.rpf"); //load navmeshes from patch area...
|
|
||||||
if (updrpf != null)
|
|
||||||
{
|
|
||||||
foreach (var rpffile in updrpf.Children)
|
|
||||||
{
|
{
|
||||||
AddRpfYnvs(rpffile, ynventries);
|
foreach (var rpffile in dlcrpf.Children)
|
||||||
|
{
|
||||||
|
AddRpfYnvs(rpffile, ynventries);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user