i can't find a way to support #14
This commit is contained in:
parent
7fa375ea66
commit
a2e3039c27
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -20,3 +20,23 @@ C:\Users\zoryn\Documents\GitHub\SMAPI\StardewInjector\bin\Debug\Microsoft.Xna.Fr
|
|||
C:\Users\zoryn\Documents\GitHub\SMAPI\StardewInjector\bin\Debug\Microsoft.Xna.Framework.Xact.xml
|
||||
C:\Users\zoryn\Documents\GitHub\SMAPI\StardewInjector\obj\Debug\StardewInjector.dll
|
||||
C:\Users\zoryn\Documents\GitHub\SMAPI\StardewInjector\obj\Debug\StardewInjector.pdb
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\StardewInjector\bin\Debug\StardewInjector.dll.config
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\StardewInjector\bin\Debug\StardewInjector.dll
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\StardewInjector\bin\Debug\StardewInjector.pdb
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\StardewInjector\bin\Debug\Microsoft.Xna.Framework.dll
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\StardewInjector\bin\Debug\Microsoft.Xna.Framework.Game.dll
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\StardewInjector\bin\Debug\StardewModdingAPI.exe
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\StardewInjector\bin\Debug\Stardew Valley.exe
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\StardewInjector\bin\Debug\Microsoft.Xna.Framework.Graphics.dll
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\StardewInjector\bin\Debug\xTile.dll
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\StardewInjector\bin\Debug\Lidgren.Network.dll
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\StardewInjector\bin\Debug\Microsoft.Xna.Framework.Xact.dll
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\StardewInjector\bin\Debug\Steamworks.NET.dll
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\StardewInjector\bin\Debug\StardewModdingAPI.pdb
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\StardewInjector\bin\Debug\Microsoft.Xna.Framework.xml
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\StardewInjector\bin\Debug\Microsoft.Xna.Framework.Game.xml
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\StardewInjector\bin\Debug\Microsoft.Xna.Framework.Graphics.xml
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\StardewInjector\bin\Debug\Microsoft.Xna.Framework.Xact.xml
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\StardewInjector\obj\Debug\StardewInjector.csprojResolveAssemblyReference.cache
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\StardewInjector\obj\Debug\StardewInjector.dll
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\StardewInjector\obj\Debug\StardewInjector.pdb
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -144,6 +144,10 @@ namespace StardewModdingAPI
|
|||
//Load in that assembly. Also, ignore security :D
|
||||
StardewAssembly = Assembly.UnsafeLoadFrom(ExecutionPath + "\\Stardew Valley.exe");
|
||||
|
||||
//This will load the injector before anything else if it sees it
|
||||
//It doesn't matter though
|
||||
//I'll leave it as a feature in case anyone in the community wants to tinker with it
|
||||
//All you need is a DLL that inherits from mod and is called StardewInjector.dll with an Entry() method
|
||||
foreach (string ModPath in ModPaths)
|
||||
{
|
||||
foreach (String s in Directory.GetFiles(ModPath, "StardewInjector.dll"))
|
||||
|
@ -153,11 +157,11 @@ namespace StardewModdingAPI
|
|||
{
|
||||
Assembly mod = Assembly.UnsafeLoadFrom(s); //to combat internet-downloaded DLLs
|
||||
|
||||
if (mod.DefinedTypes.Count(x => x.BaseType == typeof(Mod)) > 0)
|
||||
if (mod.DefinedTypes.Count(x => x.BaseType == typeof (Mod)) > 0)
|
||||
{
|
||||
LogColour(ConsoleColor.Green, "Loading Injector DLL...");
|
||||
TypeInfo tar = mod.DefinedTypes.First(x => x.BaseType == typeof(Mod));
|
||||
Mod m = (Mod)mod.CreateInstance(tar.ToString());
|
||||
TypeInfo tar = mod.DefinedTypes.First(x => x.BaseType == typeof (Mod));
|
||||
Mod m = (Mod) mod.CreateInstance(tar.ToString());
|
||||
Console.WriteLine("LOADED: {0} by {1} - Version {2} | Description: {3}", m.Name, m.Authour, m.Version, m.Description);
|
||||
m.Entry(false);
|
||||
StardewInjectorLoaded = true;
|
||||
|
@ -178,7 +182,9 @@ namespace StardewModdingAPI
|
|||
StardewProgramType = StardewAssembly.GetType("StardewValley.Program", true);
|
||||
StardewGameInfo = StardewProgramType.GetField("gamePtr");
|
||||
|
||||
#region deprecated
|
||||
/*
|
||||
* Lol no. I tried though.
|
||||
if (File.Exists(ExecutionPath + "\\Stardew_Injector.exe"))
|
||||
{
|
||||
//Stardew_Injector Mode
|
||||
|
@ -211,6 +217,7 @@ namespace StardewModdingAPI
|
|||
//Now go back and load Stardew through SMAPI
|
||||
}
|
||||
*/
|
||||
#endregion
|
||||
|
||||
//Change the game's version
|
||||
LogInfo("Injecting New SDV Version...");
|
||||
|
@ -327,17 +334,24 @@ namespace StardewModdingAPI
|
|||
|
||||
ready = true;
|
||||
|
||||
if (StardewInjectorLoaded)
|
||||
StardewGameInfo.SetValue(StardewProgramType, gamePtr);
|
||||
gamePtr.Run();
|
||||
|
||||
#region deprecated
|
||||
if (false)
|
||||
{
|
||||
//Nope, I can't get it to work. I depend on Game1 being an SGame, and can't cast a parent to a child
|
||||
//I'm leaving this here in case the community is interested
|
||||
//StardewInjectorMod.Entry(true);
|
||||
StardewAssembly.EntryPoint.Invoke(null, new object[] {new string[0]});
|
||||
StardewGameInfo.SetValue(StardewProgramType, gamePtr);
|
||||
}
|
||||
else
|
||||
{
|
||||
Type gt = StardewAssembly.GetType("StardewValley.Game1", true);
|
||||
gamePtr = (SGame)Activator.CreateInstance(gt);
|
||||
|
||||
ready = true;
|
||||
|
||||
StardewGameInfo.SetValue(StardewProgramType, gamePtr);
|
||||
gamePtr.Run();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -348,10 +362,14 @@ namespace StardewModdingAPI
|
|||
static void StardewForm_Closing(object sender, CancelEventArgs e)
|
||||
{
|
||||
e.Cancel = true;
|
||||
gamePtr.Exit();
|
||||
gamePtr.Dispose();
|
||||
StardewForm.Hide();
|
||||
ready = false;
|
||||
|
||||
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()
|
||||
|
|
|
@ -94,9 +94,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="icon.ico" />
|
||||
<Content Include="steam_appid.txt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="steam_appid.txt" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -17,3 +17,10 @@ C:\Users\zoryn\Documents\GitHub\SMAPI\TrainerMod\bin\Debug\Microsoft.Xna.Framewo
|
|||
C:\Users\zoryn\Documents\GitHub\SMAPI\TrainerMod\bin\Debug\Steamworks.NET.dll
|
||||
C:\Users\zoryn\Documents\GitHub\SMAPI\TrainerMod\bin\Debug\StardewModdingAPI.pdb
|
||||
C:\Users\zoryn\Documents\GitHub\SMAPI\TrainerMod\bin\Debug\Microsoft.Xna.Framework.Xact.xml
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\TrainerMod\bin\Debug\StardewModdingAPI.exe
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\TrainerMod\bin\Debug\xTile.dll
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\TrainerMod\bin\Debug\Lidgren.Network.dll
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\TrainerMod\bin\Debug\Microsoft.Xna.Framework.Xact.dll
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\TrainerMod\bin\Debug\Steamworks.NET.dll
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\TrainerMod\bin\Debug\StardewModdingAPI.pdb
|
||||
C:\TFSource\Master-Collection\StardewModdingAPI\TrainerMod\bin\Debug\Microsoft.Xna.Framework.Xact.xml
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue