Skip to content

Commit 5eb27a5

Browse files
committed
Implement Mod.Load() adding
1 parent 532a5b0 commit 5eb27a5

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

ModLocalizer/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414

1515
[assembly: Guid("613f981d-c5dd-43d1-b0ff-057169a647c4")]
1616

17-
[assembly: AssemblyVersion("0.10.1.0")]
18-
[assembly: AssemblyFileVersion("0.10.1.0")]
17+
[assembly: AssemblyVersion("0.10.2.0")]
18+
[assembly: AssemblyFileVersion("0.10.2.0")]

ModLocalizer/TranslationEmitter.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,17 @@ public TranslationEmitter(ModuleDef module, string gameCulture, string modName)
6262
var loadMethod = type.FindMethod("Load", MethodSig.CreateInstance(Module.CorLibTypes.Void));
6363
if (loadMethod?.HasBody != true)
6464
{
65-
Console.WriteLine("Could not find Mod.Load() method; miscs translations will not be added.");
66-
return;
65+
Console.WriteLine("Could not find Mod.Load() method; trying to add one.");
66+
67+
loadMethod = new MethodDefUser("Load", MethodSig.CreateInstance(Module.CorLibTypes.Void), MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.Virtual)
68+
{
69+
Body = new CilBody
70+
{
71+
Instructions = { OpCodes.Ret.ToInstruction() },
72+
}
73+
};
74+
75+
type.Methods.Add(loadMethod);
6776
}
6877

6978
var instructions = loadMethod.Body.Instructions;

0 commit comments

Comments
 (0)