Changed SMAPI to load the modified assembly, but it doesn't work yet.
This commit is contained in:
parent
8201b96034
commit
608a5cb257
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
|
@ -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)
|
||||||
|
@ -141,10 +140,11 @@ namespace StardewModdingAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static void ConfigureSDV()
|
private static void ConfigureSDV()
|
||||||
{
|
{
|
||||||
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");
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ namespace StardewModdingAPI
|
||||||
StardewForm.Closing += StardewForm_Closing;
|
StardewForm.Closing += StardewForm_Closing;
|
||||||
|
|
||||||
ready = true;
|
ready = true;
|
||||||
|
|
||||||
StardewGameInfo.SetValue(StardewProgramType, gamePtr);
|
StardewGameInfo.SetValue(StardewProgramType, gamePtr);
|
||||||
gamePtr.Run();
|
gamePtr.Run();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue