diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs index f37f573d..f6c63851 100644 --- a/src/StardewModdingAPI/Program.cs +++ b/src/StardewModdingAPI/Program.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Globalization; using System.IO; using System.Linq; @@ -11,9 +10,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using StardewModdingAPI.Events; using StardewModdingAPI.Inheritance; -using StardewModdingAPI.Inheritance.Menus; using StardewValley; -using StardewValley.Menus; namespace StardewModdingAPI { @@ -32,7 +29,6 @@ namespace StardewModdingAPI public static Assembly StardewAssembly; public static Type StardewProgramType; public static FieldInfo StardewGameInfo; - public static Form StardewForm; public static Thread gameThread; public static Thread consoleInputThread; @@ -154,12 +150,9 @@ namespace StardewModdingAPI GameEvents.LoadContent += Events_LoadContent; Log.AsyncY("Applying Final SDV Tweaks..."); - StardewInvoke(() => - { - gamePtr.IsMouseVisible = false; - gamePtr.Window.Title = "Stardew Valley - Version " + Game1.version; - StardewForm.Resize += GraphicsEvents.InvokeResize; - }); + gamePtr.IsMouseVisible = false; + gamePtr.Window.Title = "Stardew Valley - Version " + Game1.version; + gamePtr.Window.ClientSizeChanged += GraphicsEvents.InvokeResize; } /// @@ -226,10 +219,8 @@ namespace StardewModdingAPI Game1.graphics.GraphicsProfile = GraphicsProfile.HiDef; LoadMods(); - StardewForm = Control.FromHandle(gamePtr.Window.Handle).FindForm(); - if (StardewForm != null) StardewForm.Closing += StardewForm_Closing; - ready = true; + gamePtr.Exiting += (sender, e) => ready = false; StardewGameInfo.SetValue(StardewProgramType, gamePtr); gamePtr.Run(); @@ -240,19 +231,6 @@ namespace StardewModdingAPI } } - private static void StardewForm_Closing(object sender, CancelEventArgs e) - { - e.Cancel = true; - - if (true || MessageBox.Show("Are you sure you would like to quit Stardew Valley?\nUnsaved progress will be lost!", "Confirm Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) - { - gamePtr.Exit(); - gamePtr.Dispose(); - StardewForm.Hide(); - ready = false; - } - } - public static void LoadMods() { Log.AsyncY("LOADING MODS"); @@ -374,11 +352,6 @@ namespace StardewModdingAPI { } - public static void StardewInvoke(Action a) - { - StardewForm.Invoke(a); - } - private static void help_CommandFired(object o, EventArgsCommand e) { if (e.Command.CalledArgs.Length > 0) diff --git a/src/TrainerMod/FodyWeavers.xml b/src/TrainerMod/FodyWeavers.xml deleted file mode 100644 index dc708fcb..00000000 --- a/src/TrainerMod/FodyWeavers.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/TrainerMod/TrainerMod.cs b/src/TrainerMod/TrainerMod.cs index 92de9796..94fd823b 100644 --- a/src/TrainerMod/TrainerMod.cs +++ b/src/TrainerMod/TrainerMod.cs @@ -50,9 +50,6 @@ namespace TrainerMod { Command.RegisterCommand("types", "Lists all value types | types").CommandFired += types_CommandFired; - Command.RegisterCommand("hide", "Hides the game form | hide").CommandFired += hide_CommandFired; - Command.RegisterCommand("show", "Shows the game form | show").CommandFired += show_CommandFired; - Command.RegisterCommand("save", "Saves the game? Doesn't seem to work. | save").CommandFired += save_CommandFired; Command.RegisterCommand("load", "Shows the load screen | load").CommandFired += load_CommandFired; @@ -94,16 +91,6 @@ namespace TrainerMod Log.AsyncY($"[Int32: {int.MinValue} - {int.MaxValue}], [Int64: {long.MinValue} - {long.MaxValue}], [String: \"raw text\"], [Colour: r,g,b (EG: 128, 32, 255)]"); } - private static void hide_CommandFired(object sender, EventArgsCommand e) - { - Program.StardewInvoke(() => { Program.StardewForm.Hide(); }); - } - - private static void show_CommandFired(object sender, EventArgsCommand e) - { - Program.StardewInvoke(() => { Program.StardewForm.Show(); }); - } - private static void save_CommandFired(object sender, EventArgsCommand e) { SaveGame.Save(); diff --git a/src/TrainerMod/TrainerMod.csproj b/src/TrainerMod/TrainerMod.csproj index 6844f1c1..e5002ba4 100644 --- a/src/TrainerMod/TrainerMod.csproj +++ b/src/TrainerMod/TrainerMod.csproj @@ -95,9 +95,7 @@ - - @@ -119,9 +117,6 @@ - - -