mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #273 from erri120/stardew-valley
Stardew Valley Support
This commit is contained in:
commit
5e22b78823
@ -24,6 +24,7 @@ Wabbajack is an automated ModList installer that can recreate contents of a fold
|
||||
| Darkest Dungeon | Steam, GOG| Vortex | |
|
||||
| Divinity Original Sin 2 | Steam, GOG| Vortex | Normal and Definitive Edition |
|
||||
| Starbound | Steam, GOG| Vortex | |
|
||||
| Stardew Valley | Steam, GOG| Vortex | |
|
||||
| SW: KotOR | Steam, GOG| Vortex | |
|
||||
| SW: KotOR 2 | Steam, GOG| Vortex | |
|
||||
| The Witcher | Steam, GOG| Vortex | Enhanced Edition |
|
||||
|
@ -20,7 +20,10 @@ namespace Wabbajack.Common
|
||||
|
||||
public static string MegaPrefix = "https://mega.nz/#!";
|
||||
|
||||
public static HashSet<string> SupportedArchives = new HashSet<string> {".zip", ".rar", ".7z", ".7zip", ".fomod", ".omod", ".exe"};
|
||||
public static HashSet<string> SupportedArchives = new HashSet<string> {".zip", ".rar", ".7z", ".7zip", ".fomod", ".omod", ".exe", ".dat"};
|
||||
|
||||
// HashSet with archive extensions that need to be tested before extraction
|
||||
public static HashSet<string> TestArchivesBeforeExtraction = new HashSet<string> {".dat"};
|
||||
|
||||
public static HashSet<string> SupportedBSAs = new HashSet<string> {".bsa", ".ba2", ".BA2"};
|
||||
|
||||
|
@ -220,13 +220,48 @@ namespace Wabbajack.Common
|
||||
public static bool CanExtract(string v)
|
||||
{
|
||||
var ext = Path.GetExtension(v.ToLower());
|
||||
if(ext != ".exe")
|
||||
if(ext != ".exe" && !Consts.TestArchivesBeforeExtraction.Contains(ext))
|
||||
return Consts.SupportedArchives.Contains(ext) || Consts.SupportedBSAs.Contains(ext);
|
||||
|
||||
var info = new ProcessStartInfo
|
||||
if (ext == ".exe")
|
||||
{
|
||||
FileName = "innounp.exe",
|
||||
Arguments = $"-t \"{v}\" ",
|
||||
var info = new ProcessStartInfo
|
||||
{
|
||||
FileName = "innounp.exe",
|
||||
Arguments = $"-t \"{v}\" ",
|
||||
RedirectStandardError = true,
|
||||
RedirectStandardInput = true,
|
||||
RedirectStandardOutput = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
var p = new Process {StartInfo = info};
|
||||
|
||||
p.Start();
|
||||
ChildProcessTracker.AddProcess(p);
|
||||
|
||||
var name = Path.GetFileName(v);
|
||||
while (!p.HasExited)
|
||||
{
|
||||
var line = p.StandardOutput.ReadLine();
|
||||
if (line == null)
|
||||
break;
|
||||
|
||||
if (line[0] != '#')
|
||||
continue;
|
||||
|
||||
Utils.Status($"Testing {name} - {line.Trim()}");
|
||||
}
|
||||
|
||||
p.WaitForExit();
|
||||
return p.ExitCode == 0;
|
||||
}
|
||||
|
||||
var testInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = "7z.exe",
|
||||
Arguments = $"t \"{v}\"",
|
||||
RedirectStandardError = true,
|
||||
RedirectStandardInput = true,
|
||||
RedirectStandardOutput = true,
|
||||
@ -234,26 +269,30 @@ namespace Wabbajack.Common
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
var p = new Process {StartInfo = info};
|
||||
var testP = new Process {StartInfo = testInfo};
|
||||
|
||||
p.Start();
|
||||
ChildProcessTracker.AddProcess(p);
|
||||
|
||||
var name = Path.GetFileName(v);
|
||||
while (!p.HasExited)
|
||||
testP.Start();
|
||||
ChildProcessTracker.AddProcess(testP);
|
||||
try
|
||||
{
|
||||
testP.PriorityClass = ProcessPriorityClass.BelowNormal;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
var line = p.StandardOutput.ReadLine();
|
||||
if (line == null)
|
||||
break;
|
||||
|
||||
if (line[0] != '#')
|
||||
continue;
|
||||
|
||||
Utils.Status($"Testing {name} - {line.Trim()}");
|
||||
}
|
||||
|
||||
p.WaitForExit();
|
||||
return p.ExitCode == 0;
|
||||
try
|
||||
{
|
||||
while (!testP.HasExited)
|
||||
{
|
||||
var line = testP.StandardOutput.ReadLine();
|
||||
if (line == null)
|
||||
break;
|
||||
}
|
||||
} catch (Exception){}
|
||||
|
||||
testP.WaitForExit();
|
||||
return testP.ExitCode == 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,9 @@ namespace Wabbajack.Common
|
||||
[Description("Witcher 2")]
|
||||
Witcher2,
|
||||
[Description("Witcher 3")]
|
||||
Witcher3
|
||||
Witcher3,
|
||||
[Description("Stardew Valley")]
|
||||
StardewValley
|
||||
}
|
||||
|
||||
public static class GameExtentions
|
||||
@ -369,6 +371,20 @@ namespace Wabbajack.Common
|
||||
"bin\\x64\\witcher2.exe"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
Game.StardewValley, new GameMetaData
|
||||
{
|
||||
SupportedModManager = ModManager.Vortex,
|
||||
Game = Game.StardewValley,
|
||||
NexusName = "stardewvalley",
|
||||
SteamIDs = new List<int>{413150},
|
||||
GOGIDs = new List<int>{1453375253},
|
||||
RequiredFiles = new List<string>
|
||||
{
|
||||
"StardewValley.exe"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ namespace Wabbajack.Lib
|
||||
continue;
|
||||
|
||||
IndexedArchive targetArchive = null;
|
||||
IndexedArchives.Where(a => a.File.Children.Contains(element)).Do(a => targetArchive = a);
|
||||
IndexedArchives.Where(a => a.File.ThisAndAllChildren.Contains(element)).Do(a => targetArchive = a);
|
||||
|
||||
if (targetArchive == null)
|
||||
continue;
|
||||
@ -192,7 +192,7 @@ namespace Wabbajack.Lib
|
||||
var replace = f;
|
||||
var name = replace.File.Name;
|
||||
var archiveName = targetArchive.Name;
|
||||
var elementPath = element.FullPath.Substring(element.FullPath.IndexOf('|')+1);
|
||||
var elementPath = element.FullPath.Substring(element.FullPath.LastIndexOf('|')+1);
|
||||
var gameToFile = name.Substring(GamePath.Length + 1).Replace(elementPath, "");
|
||||
if (gameToFile.EndsWith("\\"))
|
||||
gameToFile = gameToFile.Substring(0, gameToFile.Length - 1);
|
||||
@ -373,25 +373,24 @@ namespace Wabbajack.Lib
|
||||
|
||||
Utils.Log($"File {f} is not in ActiveArchives");
|
||||
var lines = File.ReadAllLines(f);
|
||||
if (lines.Length == 0 || !lines.Any(line => line.Contains("directURL=")))
|
||||
|
||||
if (lines.Length == 0)
|
||||
return;
|
||||
|
||||
lines.Do(line =>
|
||||
{
|
||||
if (lines.Length == 0)
|
||||
var tag = "";
|
||||
if (line.Contains("tag="))
|
||||
tag = line.Substring("tag=".Length);
|
||||
|
||||
if (tag != Consts.WABBAJACK_VORTEX_MANUAL)
|
||||
return;
|
||||
|
||||
lines.Do(line =>
|
||||
{
|
||||
var tag = "";
|
||||
if (line.Contains("tag="))
|
||||
tag = line.Substring("tag=".Length);
|
||||
Utils.Log($"File {f} contains the {Consts.WABBAJACK_VORTEX_MANUAL} tag, adding to ActiveArchives");
|
||||
ActiveArchives.Add(Path.GetFileNameWithoutExtension(f));
|
||||
});
|
||||
|
||||
if (tag != Consts.WABBAJACK_VORTEX_MANUAL)
|
||||
return;
|
||||
|
||||
Utils.Log($"File {f} contains the {Consts.WABBAJACK_VORTEX_MANUAL} tag, adding to ActiveArchives");
|
||||
ActiveArchives.Add(Path.GetFileNameWithoutExtension(f));
|
||||
});
|
||||
}
|
||||
else
|
||||
if (lines.Any(line => line.Contains("directURL=")) && !ActiveArchives.Contains(Path.GetFileNameWithoutExtension(f)))
|
||||
{
|
||||
Utils.Log($"File {f} appears to not come from the Nexus, adding to ActiveArchives");
|
||||
ActiveArchives.Add(Path.GetFileNameWithoutExtension(f));
|
||||
|
Loading…
Reference in New Issue
Block a user