commit
280d77c975
|
@ -35,7 +35,7 @@ namespace StardewModdingAPI
|
||||||
|
|
||||||
public const int MinorVersion = 38;
|
public const int MinorVersion = 38;
|
||||||
|
|
||||||
public const int PatchVersion = 0;
|
public const int PatchVersion = 1;
|
||||||
|
|
||||||
public const string Build = "Alpha";
|
public const string Build = "Alpha";
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Weavers>
|
||||||
|
<Costura/>
|
||||||
|
|
||||||
|
</Weavers>
|
|
@ -8,6 +8,31 @@ namespace StardewModdingAPI
|
||||||
{
|
{
|
||||||
public class Mod
|
public class Mod
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The name of your mod.
|
||||||
|
/// NOTE: THIS IS DEPRECATED AND WILL BE REMOVED IN THE NEXT VERSION OF SMAPI
|
||||||
|
/// </summary>
|
||||||
|
public virtual string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the mod's authour.
|
||||||
|
/// NOTE: THIS IS DEPRECATED AND WILL BE REMOVED IN THE NEXT VERSION OF SMAPI
|
||||||
|
/// </summary>
|
||||||
|
public virtual string Authour { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The version of the mod.
|
||||||
|
/// NOTE: THIS IS DEPRECATED AND WILL BE REMOVED IN THE NEXT VERSION OF SMAPI
|
||||||
|
/// </summary>
|
||||||
|
public virtual string Version { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A description of the mod.
|
||||||
|
/// NOTE: THIS IS DEPRECATED AND WILL BE REMOVED IN THE NEXT VERSION OF SMAPI
|
||||||
|
/// </summary>
|
||||||
|
public virtual string Description { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The mod's manifest
|
/// The mod's manifest
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace StardewModdingAPI
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
private static List<string> _modPaths;
|
private static List<string> _modPaths;
|
||||||
private static List<string> _modContentPaths;
|
//private static List<string> _modContentPaths;
|
||||||
|
|
||||||
public static Texture2D DebugPixel { get; private set; }
|
public static Texture2D DebugPixel { get; private set; }
|
||||||
|
|
||||||
|
@ -50,7 +50,6 @@ namespace StardewModdingAPI
|
||||||
{
|
{
|
||||||
ConfigureUI();
|
ConfigureUI();
|
||||||
ConfigurePaths();
|
ConfigurePaths();
|
||||||
ConfigureInjector();
|
|
||||||
ConfigureSDV();
|
ConfigureSDV();
|
||||||
|
|
||||||
GameRunInvoker();
|
GameRunInvoker();
|
||||||
|
@ -85,17 +84,19 @@ namespace StardewModdingAPI
|
||||||
StardewModdingAPI.Log.Info("Validating api paths...");
|
StardewModdingAPI.Log.Info("Validating api paths...");
|
||||||
|
|
||||||
_modPaths = new List<string>();
|
_modPaths = new List<string>();
|
||||||
_modContentPaths = new List<string>();
|
//_modContentPaths = new List<string>();
|
||||||
|
|
||||||
//TODO: Have an app.config and put the paths inside it so users can define locations to load mods from
|
//TODO: Have an app.config and put the paths inside it so users can define locations to load mods from
|
||||||
_modPaths.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley", "Mods"));
|
_modPaths.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley", "Mods"));
|
||||||
_modPaths.Add(Path.Combine(Constants.ExecutionPath, "Mods"));
|
_modPaths.Add(Path.Combine(Constants.ExecutionPath, "Mods"));
|
||||||
_modContentPaths.Add(Path.Combine(Constants.ExecutionPath, "Mods", "Content"));
|
|
||||||
_modContentPaths.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley", "Mods", "Content"));
|
//Mods need to make their own content paths, since we're doing a different, manifest-driven, approach.
|
||||||
|
//_modContentPaths.Add(Path.Combine(Constants.ExecutionPath, "Mods", "Content"));
|
||||||
|
//_modContentPaths.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley", "Mods", "Content"));
|
||||||
|
|
||||||
//Checks that all defined modpaths exist as directories
|
//Checks that all defined modpaths exist as directories
|
||||||
_modPaths.ForEach(path => VerifyPath(path));
|
_modPaths.ForEach(path => VerifyPath(path));
|
||||||
_modContentPaths.ForEach(path => VerifyPath(path));
|
//_modContentPaths.ForEach(path => VerifyPath(path));
|
||||||
VerifyPath(Constants.LogPath);
|
VerifyPath(Constants.LogPath);
|
||||||
|
|
||||||
StardewModdingAPI.Log.Initialize(Constants.LogPath);
|
StardewModdingAPI.Log.Initialize(Constants.LogPath);
|
||||||
|
@ -106,51 +107,6 @@ namespace StardewModdingAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Load the injector.
|
|
||||||
/// Is this deprecated? Why is there a LoadMods?
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// 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
|
|
||||||
/// </remarks>
|
|
||||||
private static void ConfigureInjector()
|
|
||||||
{
|
|
||||||
foreach (string ModPath in _modPaths)
|
|
||||||
{
|
|
||||||
foreach (String s in Directory.GetFiles(ModPath, "StardewInjector.dll"))
|
|
||||||
{
|
|
||||||
StardewModdingAPI.Log.Success(ConsoleColor.Green, "Found Stardew Injector DLL: " + s);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Assembly mod = Assembly.UnsafeLoadFrom(s); //to combat internet-downloaded DLLs
|
|
||||||
|
|
||||||
if (mod.DefinedTypes.Count(x => x.BaseType == typeof(Mod)) > 0)
|
|
||||||
{
|
|
||||||
StardewModdingAPI.Log.Success("Loading Injector DLL...");
|
|
||||||
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} (@:{4})", m.Manifest.Name, m.Manifest.Authour, m.Manifest.Version, m.Manifest.Description, s);
|
|
||||||
m.PathOnDisk = Path.GetDirectoryName(s);
|
|
||||||
m.Entry(false);
|
|
||||||
StardewInjectorLoaded = true;
|
|
||||||
StardewInjectorMod = m;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
StardewModdingAPI.Log.Error("Invalid Mod DLL");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
StardewModdingAPI.Log.Error("Failed to load mod '{0}'. Exception details:\n" + ex, s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load Stardev Valley and control features
|
/// Load Stardev Valley and control features
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -263,6 +219,8 @@ namespace StardewModdingAPI
|
||||||
StardewModdingAPI.Log.Verbose("Patching SDV Graphics Profile...");
|
StardewModdingAPI.Log.Verbose("Patching SDV Graphics Profile...");
|
||||||
Game1.graphics.GraphicsProfile = GraphicsProfile.HiDef;
|
Game1.graphics.GraphicsProfile = GraphicsProfile.HiDef;
|
||||||
LoadMods();
|
LoadMods();
|
||||||
|
//DEPRECATED WAY
|
||||||
|
LoadMods_OldWay();
|
||||||
|
|
||||||
StardewForm = Control.FromHandle(Program.gamePtr.Window.Handle).FindForm();
|
StardewForm = Control.FromHandle(Program.gamePtr.Window.Handle).FindForm();
|
||||||
StardewForm.Closing += StardewForm_Closing;
|
StardewForm.Closing += StardewForm_Closing;
|
||||||
|
@ -379,6 +337,50 @@ namespace StardewModdingAPI
|
||||||
StardewModdingAPI.Log.Success("LOADED {0} MODS", loadedMods);
|
StardewModdingAPI.Log.Success("LOADED {0} MODS", loadedMods);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// DEPRECATED. REMOVE
|
||||||
|
/// </summary>
|
||||||
|
public static void LoadMods_OldWay()
|
||||||
|
{
|
||||||
|
StardewModdingAPI.Log.Verbose("LOADING MODS (OLD WAY - DEPRECATED. ANY MODS LOADED THIS WAY NEED TO UPDATE)");
|
||||||
|
int loadedMods = 0;
|
||||||
|
foreach (string ModPath in _modPaths)
|
||||||
|
{
|
||||||
|
foreach (String s in Directory.GetFiles(ModPath, "*.dll"))
|
||||||
|
{
|
||||||
|
if (s.Contains("StardewInjector"))
|
||||||
|
continue;
|
||||||
|
StardewModdingAPI.Log.Success("Found DLL: " + s);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Assembly mod = Assembly.UnsafeLoadFrom(s); //to combat internet-downloaded DLLs
|
||||||
|
|
||||||
|
if (mod.DefinedTypes.Count(x => x.BaseType == typeof(Mod)) > 0)
|
||||||
|
{
|
||||||
|
StardewModdingAPI.Log.Verbose("Loading Mod DLL...");
|
||||||
|
TypeInfo tar = mod.DefinedTypes.First(x => x.BaseType == typeof(Mod));
|
||||||
|
Mod m = (Mod)mod.CreateInstance(tar.ToString());
|
||||||
|
m.Manifest = null;
|
||||||
|
m.PathOnDisk = Path.GetDirectoryName(s);
|
||||||
|
Console.WriteLine("LOADED MOD: {0} by {1} - Version {2} | Description: {3}", m.Name, m.Authour, m.Version, m.Description);
|
||||||
|
loadedMods += 1;
|
||||||
|
m.Entry();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StardewModdingAPI.Log.Error("Invalid Mod DLL");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
StardewModdingAPI.Log.Error("Failed to load mod '{0}'. Exception details:\n" + ex, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
StardewModdingAPI.Log.Success("LOADED {0} MODS THAT NEED TO UPDATE", loadedMods);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void ConsoleInputThread()
|
public static void ConsoleInputThread()
|
||||||
{
|
{
|
||||||
string input = string.Empty;
|
string input = string.Empty;
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
</SccAuxPath>
|
</SccAuxPath>
|
||||||
<SccProvider>
|
<SccProvider>
|
||||||
</SccProvider>
|
</SccProvider>
|
||||||
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
<PublishUrl>publish\</PublishUrl>
|
<PublishUrl>publish\</PublishUrl>
|
||||||
<Install>true</Install>
|
<Install>true</Install>
|
||||||
<InstallFrom>Disk</InstallFrom>
|
<InstallFrom>Disk</InstallFrom>
|
||||||
|
@ -31,10 +33,10 @@
|
||||||
<MapFileExtensions>true</MapFileExtensions>
|
<MapFileExtensions>true</MapFileExtensions>
|
||||||
<ApplicationRevision>0</ApplicationRevision>
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
<TargetFrameworkProfile />
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Choose>
|
<Choose>
|
||||||
<When Condition="'$(SteamInstallPath)' != ''">
|
<When Condition="'$(SteamInstallPath)' != ''">
|
||||||
|
@ -162,6 +164,7 @@
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Content Include="FodyWeavers.xml" />
|
||||||
<Content Include="icon.ico" />
|
<Content Include="icon.ico" />
|
||||||
<Content Include="steam_appid.txt" />
|
<Content Include="steam_appid.txt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -182,6 +185,13 @@
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<Import Project="..\packages\Fody.1.28.3\build\Fody.targets" Condition="Exists('..\packages\Fody.1.28.3\build\Fody.targets')" />
|
||||||
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Error Condition="!Exists('..\packages\Fody.1.28.3\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.28.3\build\Fody.targets'))" />
|
||||||
|
</Target>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<Target Name="BeforeBuild">
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
|
<package id="Costura.Fody" version="1.3.3.0" targetFramework="net45" developmentDependency="true" />
|
||||||
|
<package id="Fody" version="1.28.3" targetFramework="net45" developmentDependency="true" />
|
||||||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
|
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Weavers>
|
||||||
|
|
||||||
|
</Weavers>
|
|
@ -12,12 +12,14 @@
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<TargetFrameworkProfile />
|
<TargetFrameworkProfile />
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>..\StardewModdingAPI\bin\x86\Debug\Mods\</OutputPath>
|
<OutputPath>..\StardewModdingAPI\bin\x86\Debug\Mods\TrainerMod\</OutputPath>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
@ -52,10 +54,6 @@
|
||||||
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
|
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Stardew Valley">
|
<Reference Include="Stardew Valley">
|
||||||
<HintPath>$(SteamPath)\steamapps\common\Stardew Valley\Stardew Valley.exe</HintPath>
|
<HintPath>$(SteamPath)\steamapps\common\Stardew Valley\Stardew Valley.exe</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
|
@ -85,9 +83,14 @@
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="manifest.json" />
|
<None Include="manifest.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="FodyWeavers.xml" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
|
|
Loading…
Reference in New Issue