Changed SMAPI to load the modified assembly, but it doesn't work yet.

This commit is contained in:
ClxS 2016-03-09 19:04:33 +00:00
parent 8201b96034
commit 608a5cb257
2 changed files with 10 additions and 10 deletions

View File

@ -23,7 +23,7 @@ namespace StardewModdingAPI.Helpers
private bool _isMemoryStreamDirty { get; set; } private bool _isMemoryStreamDirty { get; set; }
private MemoryStream _modifiedAssembly; private MemoryStream _modifiedAssembly;
private MemoryStream ModifiedAssembly public MemoryStream ModifiedAssembly
{ {
get get
{ {

View File

@ -53,9 +53,8 @@ namespace StardewModdingAPI
ConfigureUI(); ConfigureUI();
ConfigurePaths(); ConfigurePaths();
ConfigureMethodInjection(); ConfigureMethodInjection();
//ConfigureSDV(); ConfigureSDV();
GameRunInvoker();
//GameRunInvoker();
} }
catch (Exception e) catch (Exception e)
{ {
@ -73,7 +72,7 @@ namespace StardewModdingAPI
private static void ConfigureMethodInjection() private static void ConfigureMethodInjection()
{ {
StardewContext = new CecilContext(CecilContextType.Stardew); StardewContext = new CecilContext(CecilContextType.Stardew);
SmapiContext = new CecilContext(CecilContextType.SMAPI); //SmapiContext = new CecilContext(CecilContextType.SMAPI);
} }
private static void WeaveOnEnterMethod(Mono.Cecil.Cil.ILProcessor ilProcessor, Instruction target, MethodReference callback) private static void WeaveOnEnterMethod(Mono.Cecil.Cil.ILProcessor ilProcessor, Instruction target, MethodReference callback)
@ -144,7 +143,8 @@ namespace StardewModdingAPI
StardewModdingAPI.Log.Info("Initializing SDV Assembly..."); StardewModdingAPI.Log.Info("Initializing SDV Assembly...");
// Load in the assembly - ignores security // Load in the assembly - ignores security
StardewAssembly = Assembly.UnsafeLoadFrom(Constants.ExecutionPath + "\\Stardew Valley.exe"); //StardewAssembly = Assembly.UnsafeLoadFrom(Constants.ExecutionPath + "\\Stardew Valley.exe");
StardewAssembly = Assembly.Load(StardewContext.ModifiedAssembly.GetBuffer());
StardewProgramType = StardewAssembly.GetType("StardewValley.Program", true); StardewProgramType = StardewAssembly.GetType("StardewValley.Program", true);
StardewGameInfo = StardewProgramType.GetField("gamePtr"); StardewGameInfo = StardewProgramType.GetField("gamePtr");