diff --git a/StardewModdingAPI/Program.cs b/StardewModdingAPI/Program.cs index 61770f8e..e72b23ba 100644 --- a/StardewModdingAPI/Program.cs +++ b/StardewModdingAPI/Program.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Mono.Cecil; using StardewModdingAPI.Events; using StardewModdingAPI.Inheritance; using StardewModdingAPI.Inheritance.Menus; @@ -49,10 +50,11 @@ namespace StardewModdingAPI { ConfigureUI(); ConfigurePaths(); + ConfigureMethodInjection(); ConfigureInjector(); ConfigureSDV(); - GameRunInvoker(); + //GameRunInvoker(); } catch (Exception e) { @@ -63,6 +65,20 @@ namespace StardewModdingAPI StardewModdingAPI.Log.Comment("The API will now terminate. Press any key to continue..."); Console.ReadKey(); } + + /// + /// Configures Mono.Cecil injections + /// + private static void ConfigureMethodInjection() + { + AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly(Constants.ExecutionPath + "\\Stardew Valley.exe"); + TypeDefinition type = assembly.MainModule.Types.FirstOrDefault(n => n.FullName == "StardewValley.FarmAnimal"); + //if (type != null) + //{ + MethodDefinition foundMethod = type.Methods.FirstOrDefault(m => m.Name == "eatGrass"); + Mono.Cecil.Cil.ILProcessor worker = foundMethod.Body.GetILProcessor(); + //} + } /// /// Set up the console properties diff --git a/StardewModdingAPI/StardewModdingAPI.csproj b/StardewModdingAPI/StardewModdingAPI.csproj index 523ab7bd..a4b0604e 100644 --- a/StardewModdingAPI/StardewModdingAPI.csproj +++ b/StardewModdingAPI/StardewModdingAPI.csproj @@ -37,16 +37,16 @@ - - - $(SteamInstallPath) + + + $(SteamInstallPath) - - - - ..\..\..\..\Games\SteamLibrary - - + + + + ..\..\..\..\Games\SteamLibrary + + x86 @@ -90,9 +90,25 @@ + + ..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.dll + True + + + ..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Mdb.dll + True + + + ..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Pdb.dll + True + + + ..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Rocks.dll + True + False - $(SteamPath)\steamapps\common\Stardew Valley\Stardew Valley.exe + D:\Games\steamapps\common\Stardew Valley\Stardew Valley.exe @@ -105,7 +121,7 @@ False - $(SteamPath)\steamapps\common\Stardew Valley\xTile.dll + D:\Games\steamapps\common\Stardew Valley\xTile.dll @@ -142,6 +158,7 @@ + @@ -159,6 +176,9 @@ false + + + diff --git a/StardewModdingAPI/packages.config b/StardewModdingAPI/packages.config new file mode 100644 index 00000000..bedba391 --- /dev/null +++ b/StardewModdingAPI/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/TrainerMod/TrainerMod.csproj b/TrainerMod/TrainerMod.csproj index ddf1b317..a1a7f740 100644 --- a/TrainerMod/TrainerMod.csproj +++ b/TrainerMod/TrainerMod.csproj @@ -34,16 +34,16 @@ false - - - $(SteamInstallPath) + + + $(SteamInstallPath) - - - - ..\..\..\..\Games\SteamLibrary - - + + + + ..\..\..\..\Games\SteamLibrary + + @@ -53,8 +53,7 @@ False - $(SteamPath)\steamapps\common\Stardew Valley\Stardew Valley.exe - False + D:\Games\steamapps\common\Stardew Valley\Stardew Valley.exe @@ -65,8 +64,7 @@ - $(SteamPath)\steamapps\common\Stardew Valley\xTile.dll - False + D:\Games\steamapps\common\Stardew Valley\xTile.dll