forked from MattRix/UnityDecompiled
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPostProcessUAPIl2Cpp.cs
More file actions
169 lines (149 loc) · 5.96 KB
/
PostProcessUAPIl2Cpp.cs
File metadata and controls
169 lines (149 loc) · 5.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using UnityEditor;
using UnityEditor.Modules;
using UnityEditor.Utils;
using UnityEditorInternal;
using UnityEngine;
internal class PostProcessUAPIl2Cpp : PostProcessUAP
{
[CompilerGenerated]
private static Action<string> <>f__am$cache0;
private List<string> CppPlugins;
private RuntimeClassRegistry usedClassRegistry;
public PostProcessUAPIl2Cpp(BuildPostProcessArgs args, string stagingArea = null) : base(args, stagingArea)
{
this.CppPlugins = new List<string>();
this.usedClassRegistry = args.usedClassRegistry;
}
public override void CheckSDK()
{
if (this.GetPlatformAssemblyPath() == null)
{
throw new UnityException($"{"Platform assembly not found."}{Environment.NewLine}{this.GetSDKNotFoundErrorMessage()}");
}
}
private void CopyClassLibraries()
{
foreach (string str in Directory.GetFiles(BuildPipeline.GetMonoLibDirectory(BuildTarget.WSAPlayer), "*.dll"))
{
string path = Path.Combine(base.StagingAreaDataManaged, Path.GetFileName(str));
if (!File.Exists(path))
{
File.Copy(str, path);
}
}
}
public override void CopyPlugins()
{
string[] strArray = new string[] { ".cpp", ".c", ".h" };
foreach (PluginImporter importer in PluginImporter.GetImporters(base.Target))
{
<CopyPlugins>c__AnonStorey0 storey = new <CopyPlugins>c__AnonStorey0();
string assetPath = importer.assetPath;
storey.pluginExtension = Path.GetExtension(assetPath);
if (Enumerable.Any<string>(strArray, new Func<string, bool>(storey.<>m__0)))
{
this.CppPlugins.Add(assetPath);
}
}
base.CopyPlugins();
foreach (Library library in base.Libraries)
{
if (library.Native && library.WinMd)
{
File.Copy(Path.Combine(base.StagingAreaDataManaged, library.Reference), Path.Combine(base.StagingArea, library.Reference), true);
}
}
}
public override void CopyTemplate()
{
base.CopyTemplate();
string templateDirectoryTarget = this.GetTemplateDirectoryTarget();
foreach (string str2 in Directory.GetFiles(templateDirectoryTarget))
{
MetroVisualStudioSolutionHelper.PatchVisualStudioFile(str2);
}
}
protected override void CreateManagedRegistryTxtFile()
{
}
public override void CreateVisualStudioSolution()
{
MetroIl2CppVisualStudioSolutionCreator.CreateSolution(base.InstallPath, base.VisualStudioName, base.StagingArea, base.SourceBuild, this.CppPlugins, base.Libraries);
MetroVisualStudioSolutionHelper.WriteUnityCommonProps(Path.Combine(base.InstallPath, "UnityCommon.props"), base.PlayerPackage, base.InstallPath, base.SourceBuild);
}
protected override string GetAssemblyConverterPlatform()
{
throw new NotSupportedException();
}
protected override IEnumerable<string> GetLangAssemblies() =>
new string[0];
protected override string GetPlayerFilesSourceDirectory() =>
base.GetPlayerFilesSourceDirectory(Path.Combine("UAP", "il2cpp"));
protected override string GetReferenceAssembliesDirectory()
{
throw new NotSupportedException();
}
protected override string GetTemplateDirectorySource()
{
string str = (EditorUserBuildSettings.wsaUWPBuildType != WSAUWPBuildType.XAML) ? "UWP_IL2CPP_D3D" : "UWP_IL2CPP_XAML";
string[] paths = new string[] { base.PlayerPackage, "Templates", str };
return Utility.CombinePath(paths);
}
protected override IEnumerable<string> GetUnityAssemblies() =>
new string[] { @"il2cpp\UnityEngine.dll" };
protected override IEnumerable<string> GetUnityPluginOverwrites() =>
new string[0];
protected override void RunIL2CPP()
{
string path = Utility.CombinePath(base.StagingArea, "Il2CppOutputProject");
if (EditorUtility.DisplayCancelableProgressBar("Building Player", "Cleaning up old IL2CPP generated files", 0.1f))
{
throw new OperationCanceledException();
}
if (Directory.Exists(path))
{
foreach (string str2 in Directory.GetFiles(path, "*.*", SearchOption.AllDirectories))
{
File.Delete(str2);
}
}
this.CopyClassLibraries();
WinRTIl2CppPlatformProvider platformProvider = new WinRTIl2CppPlatformProvider();
if (<>f__am$cache0 == null)
{
<>f__am$cache0 = delegate (string s) {
};
}
IL2CPPUtils.RunIl2Cpp(path, base.StagingAreaData, platformProvider, <>f__am$cache0, this.usedClassRegistry, false);
if (EditorUtility.DisplayCancelableProgressBar("Building Player", "Copying IL2CPP related files", 0.1f))
{
throw new OperationCanceledException();
}
string cppOutputPath = IL2CPPBuilder.GetCppOutputPath(path);
string[] components = new string[] { cppOutputPath, "Data" };
string source = Paths.Combine(components);
string str5 = Utility.CombinePath(base.StagingAreaData, "il2cpp_data");
if (Directory.Exists(str5))
{
Directory.Delete(str5, true);
}
Directory.CreateDirectory(str5);
Utility.MoveDirectory(source, str5, null);
Utility.CopyDirectoryContents(platformProvider.il2CppFolder, Path.Combine(path, "IL2CPP"), true);
}
protected override bool UseIL2CPP() =>
true;
[CompilerGenerated]
private sealed class <CopyPlugins>c__AnonStorey0
{
internal string pluginExtension;
internal bool <>m__0(string e) =>
string.Equals(e, this.pluginExtension, StringComparison.InvariantCultureIgnoreCase);
}
}