Skip to content

Commit 93a3fe8

Browse files
committed
PDB Generation.
1 parent 416abdb commit 93a3fe8

3 files changed

Lines changed: 20 additions & 40 deletions

File tree

ILSpyAutomation/ILSpyAutomation.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace ILSpyAutomation
1111
{
1212
public static class ILSpyAutomation
1313
{
14-
public static ProjectItem Decompile(string inputFile, string outputDirectory, IDecompileLogger logger, IProgress<DecompilationProgress> progress /*, bool generatePDB = true*/)
14+
public static ProjectItem Decompile(string inputFile, string outputDirectory, IDecompileLogger logger, IProgress<DecompilationProgress> progress, bool generatePDB = true)
1515
{
1616
Directory.CreateDirectory(outputDirectory);
1717

@@ -21,12 +21,12 @@ public static ProjectItem Decompile(string inputFile, string outputDirectory, ID
2121

2222
var pid = DecompileAsProject(inputFile, projectFileName, progress);
2323

24-
//if (generatePDB)
25-
//{
26-
// logger.Log($"Generating PDB");
24+
if (generatePDB)
25+
{
26+
logger.Log($"Generating PDB");
2727

28-
// GeneratePdbForAssembly(inputFile, Path.Combine(outputDirectory, Path.GetFileNameWithoutExtension(inputFile) + ".pdb"), progress, outputDirectory);
29-
//}
28+
GeneratePdbForAssembly(inputFile, Path.Combine(outputDirectory, Path.GetFileNameWithoutExtension(inputFile) + ".pdb"), progress, outputDirectory);
29+
}
3030

3131
return new ProjectItem(projectFileName, pid.PlatformName, pid.Guid, pid.TypeGuid);
3232
}
@@ -75,7 +75,7 @@ private static int GeneratePdbForAssembly(string assemblyFileName, string pdbFil
7575
var decompiler = GetDecompiler(assemblyFileName);
7676
var progess = progress;
7777

78-
PortablePdbWriter.WritePdb(module, decompiler, GetSettings(module), stream, namePrefix: namePrefix, progress: progess);
78+
PortablePdbWriter.WritePdb(module, decompiler, GetSettings(module), stream, namePrefix: namePrefix, progress: progess, noLogo: true);
7979
}
8080

8181
return 0;

Unity2Debug.Common/Automation/Automator.cs

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,7 @@ public void Start()
3737
if (_debugSettings.CreateDebugCopy)
3838
{
3939
CreateDebug();
40-
41-
//var paths = _debugSettings.ToDebugAssemblyPaths(_decompileSettings.AssemblyPaths);
42-
//if (paths == null)
43-
//{
44-
// _logger.Error("Could not generate debug assembly paths.");
45-
// throw new NullReferenceException();
46-
//}
47-
48-
//Task.Run(() => DecompileAsync(paths)).Wait();
49-
40+
5041
Task.Run(() => DecompileAsync(_decompileSettings.AssemblyPaths)).Wait();
5142

5243
UnityAutomator unityAutomator = new(_debugSettings, _logger);
@@ -119,23 +110,23 @@ private async Task DecompileAsync(List<string> assemblyPaths)
119110
assembly,
120111
outputDir,
121112
new DecompileLogger(_logger),
122-
_decompilationProgress
123-
/*_debugSettings.CreateDebugCopy*/));
113+
_decompilationProgress,
114+
_debugSettings.CreateDebugCopy));
124115

125116
if (project != null)
126117
{
127118
projects.Add(project);
128119

129-
//if (_debugSettings.CreateDebugCopy)
130-
//{
131-
// _logger.Log("Copying PDB to Debug Directory...");
120+
if (_debugSettings.CreateDebugCopy)
121+
{
122+
_logger.Log("Copying PDB to Debug Directory...");
132123

133-
// var pdb = Path.ChangeExtension(project.FilePath, ".pdb");
134-
// var name = Path.GetFileNameWithoutExtension(_debugSettings.RetailGameExe);
135-
// var path = Path.Combine(_debugSettings.DebugOutputPath, $@"{name}_Data\Managed", Path.GetFileName(pdb));
124+
var pdb = Path.ChangeExtension(project.FilePath, ".pdb");
125+
var name = Path.GetFileNameWithoutExtension(_debugSettings.RetailGameExe);
126+
var path = Path.Combine(_debugSettings.DebugOutputPath, $@"{name}_Data\Managed", Path.GetFileName(pdb));
136127

137-
// File.Copy(pdb, path, true);
138-
//}
128+
File.Copy(pdb, path, true);
129+
}
139130
}
140131

141132
ResetProgress();

Unity2Debug.Common/Automation/PatchingAutomator.cs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,9 @@ public PatchingAutomator(DebugSettings debugSettings, DecompileSettings decompil
2020
public void Start()
2121
{
2222
DoCreateSteamAppIdTxt();
23-
24-
foreach (var assembly in _decompileSettings.AssemblyPaths)
25-
{
26-
if (string.IsNullOrEmpty(assembly) || !File.Exists(assembly))
27-
{
28-
_logger.Error($"Could not patch {assembly}, file not found. Skipping...");
29-
continue;
30-
}
31-
32-
var outputFile = _debugSettings.ToDebugAssemblyPath(assembly);
33-
//DoDe4Dot(assembly, outputFile);
34-
DoCreateINI(assembly, outputFile);
35-
}
23+
//Saved incase De4Dot or debug INI's are needed later. Owlcat games do not require it.
3624
}
25+
3726
private void DoDe4Dot(string assembly, string outputFile)
3827
{
3928
_logger.Log($"Patching {assembly} to point at proper PDB");

0 commit comments

Comments
 (0)