@@ -24,20 +24,21 @@ internal class Options
24
24
{
25
25
[ Option ( "game-path" , Required = true , HelpText = "Specify path to the game folder (containing the exe)" ) ]
26
26
public string GamePath { get ; set ; }
27
-
27
+
28
28
[ Option ( "exe-name" , Required = false , HelpText = "Specify an override for the unity executable name in case the auto-detection doesn't work." ) ]
29
29
public string ExeName { get ; set ; }
30
-
30
+
31
31
[ Option ( "skip-analysis" , Required = false , HelpText = "Skip the analysis section and stop once DummyDLLs have been generated." ) ]
32
32
public bool SkipAnalysis { get ; set ; }
33
-
33
+
34
34
[ Option ( "skip-metadata-txts" , Required = false , HelpText = "Skip the generation of [classname]_metadata.txt files." ) ]
35
35
public bool SkipMetadataTextFiles { get ; set ; }
36
36
}
37
-
37
+
38
38
public static float MetadataVersion = 24f ;
39
39
40
- private static readonly string [ ] blacklistedExecutableFilenames = {
40
+ private static readonly string [ ] blacklistedExecutableFilenames =
41
+ {
41
42
"UnityCrashHandler.exe" ,
42
43
"UnityCrashHandler64.exe" ,
43
44
"install.exe"
@@ -60,10 +61,7 @@ public static void Main(string[] args)
60
61
Console . WriteLine ( "Running on " + Environment . OSVersion . Platform ) ;
61
62
62
63
CommandLineOptions = null ;
63
- Parser . Default . ParseArguments < Options > ( args ) . WithParsed ( options =>
64
- {
65
- CommandLineOptions = options ;
66
- } ) ;
64
+ Parser . Default . ParseArguments < Options > ( args ) . WithParsed ( options => { CommandLineOptions = options ; } ) ;
67
65
68
66
if ( CommandLineOptions == null )
69
67
{
@@ -72,7 +70,7 @@ public static void Main(string[] args)
72
70
}
73
71
74
72
string loc ;
75
-
73
+
76
74
//TODO: No longer needed
77
75
// if (Environment.OSVersion.Platform == PlatformID.Win32Windows || Environment.OSVersion.Platform == PlatformID.Win32NT)
78
76
// {
@@ -112,7 +110,7 @@ public static void Main(string[] args)
112
110
var assemblyPath = Path . Combine ( baseGamePath , "GameAssembly.dll" ) ;
113
111
var exeName = Path . GetFileNameWithoutExtension ( Directory . GetFiles ( baseGamePath )
114
112
. First ( f => f . EndsWith ( ".exe" ) && ! blacklistedExecutableFilenames . Any ( bl => f . EndsWith ( bl ) ) ) ) ;
115
-
113
+
116
114
if ( CommandLineOptions . ExeName != null )
117
115
{
118
116
exeName = CommandLineOptions . ExeName ;
@@ -122,7 +120,7 @@ public static void Main(string[] args)
122
120
{
123
121
Console . WriteLine ( $ "Auto-detected game name: { exeName } ") ;
124
122
}
125
-
123
+
126
124
var unityPlayerPath = Path . Combine ( baseGamePath , $ "{ exeName } .exe") ;
127
125
var metadataPath = Path . Combine ( baseGamePath , $ "{ exeName } _Data", "il2cpp_data" , "Metadata" ,
128
126
"global-metadata.dat" ) ;
@@ -136,10 +134,10 @@ public static void Main(string[] args)
136
134
PrintUsage ( ) ;
137
135
return ;
138
136
}
139
-
137
+
140
138
Console . WriteLine ( $ "Located game EXE: { unityPlayerPath } ") ;
141
139
Console . WriteLine ( $ "Located global-metadata: { metadataPath } ") ;
142
-
140
+
143
141
Console . WriteLine ( "\n Attempting to determine Unity version..." ) ;
144
142
145
143
int [ ] unityVerUseful ;
@@ -161,7 +159,7 @@ public static void Main(string[] args)
161
159
verString . Append ( Convert . ToChar ( ggmBytes [ idx ] ) ) ;
162
160
idx ++ ;
163
161
}
164
-
162
+
165
163
var unityVer = verString . ToString ( ) ;
166
164
unityVer = unityVer . Substring ( 0 , unityVer . IndexOf ( "f" , StringComparison . Ordinal ) ) ;
167
165
Console . WriteLine ( "Read version string from globalgamemanagers: " + unityVer ) ;
@@ -217,9 +215,16 @@ public static void Main(string[] args)
217
215
Console . WriteLine ( "\t Pass 3: Handling Fields, methods, and properties (THIS MAY TAKE A WHILE)..." ) ;
218
216
219
217
var methods = new List < ( TypeDefinition type , List < CppMethodData > methods ) > ( ) ;
218
+
220
219
for ( var imageIndex = 0 ; imageIndex < Metadata . assemblyDefinitions . Length ; imageIndex ++ )
221
220
{
222
- Console . WriteLine ( $ "\t \t Processing DLL { imageIndex + 1 } of { Metadata . assemblyDefinitions . Length } ...") ;
221
+ var imageDef = Metadata . assemblyDefinitions [ imageIndex ] ;
222
+ var firstTypeDefinition = SharedState . TypeDefsByIndex [ imageDef . firstTypeIndex ] ;
223
+ var currentAssembly = firstTypeDefinition . Module . Assembly ;
224
+
225
+ Console . WriteLine ( $ "\t \t Processing DLL { imageIndex + 1 } of { Metadata . assemblyDefinitions . Length } : { currentAssembly . Name } ...") ;
226
+
227
+
223
228
methods . AddRange ( AssemblyBuilder . ProcessAssemblyTypes ( Metadata , ThePE , Metadata . assemblyDefinitions [ imageIndex ] ) ) ;
224
229
}
225
230
0 commit comments