From 0b5a05ba9120f7acee961ed75e62eff4fd68a821 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 3 Nov 2016 21:03:03 -0400 Subject: add crossplatform installer (#155) --- README.md | 85 +++--- release-notes.md | 4 +- src/StardewModdingAPI.Installer/Enums/Platform.cs | 12 + .../Enums/ScriptAction.cs | 12 + .../InteractiveInstaller.cs | 325 +++++++++++++++++++++ src/StardewModdingAPI.Installer/Program.cs | 17 ++ .../Properties/AssemblyInfo.cs | 9 + .../StardewModdingAPI.Installer.csproj | 80 +++++ src/StardewModdingAPI.Installer/readme.txt | 1 + src/StardewModdingAPI.sln | 18 ++ src/StardewModdingAPI/StardewModdingAPI | 42 --- src/StardewModdingAPI/StardewModdingAPI.csproj | 20 +- src/StardewModdingAPI/unix-launcher.sh | 42 +++ src/TrainerMod/TrainerMod.csproj | 9 +- 14 files changed, 586 insertions(+), 90 deletions(-) create mode 100644 src/StardewModdingAPI.Installer/Enums/Platform.cs create mode 100644 src/StardewModdingAPI.Installer/Enums/ScriptAction.cs create mode 100644 src/StardewModdingAPI.Installer/InteractiveInstaller.cs create mode 100644 src/StardewModdingAPI.Installer/Program.cs create mode 100644 src/StardewModdingAPI.Installer/Properties/AssemblyInfo.cs create mode 100644 src/StardewModdingAPI.Installer/StardewModdingAPI.Installer.csproj create mode 100644 src/StardewModdingAPI.Installer/readme.txt delete mode 100644 src/StardewModdingAPI/StardewModdingAPI create mode 100644 src/StardewModdingAPI/unix-launcher.sh diff --git a/README.md b/README.md index dcb9e04b..1300da96 100644 --- a/README.md +++ b/README.md @@ -18,46 +18,65 @@ your game files. * [SMAPI/Farmhand Discord](https://discordapp.com/invite/0t3fh2xhHVc6Vdyx) (chat with SMAPI developers) ## For SMAPI developers +_This section is about compiling SMAPI itself from source. If you don't know what that means, this +section isn't relevant to you; see the previous sections to use or create mods._ ### Compiling from source -Using one of the SMAPI releases is recommended for most users. +Using an official SMAPI release is recommended for most users. -If you'd like to compile SMAPI from source, you can do that on any platform. SMAPI uses build -configuration derived from the [crosswiki mod config](https://github.com/Pathoschild/Stardew.ModBuildConfig#readme) -to detect your current OS automatically and load the correct references. +If you'd like to compile SMAPI from source, you can do that on any platform using +[Visual Studio](https://www.visualstudio.com/vs/community/) or [MonoDevelop](http://www.monodevelop.com/). +SMAPI uses build configuration derived from the [crosswiki mod config](https://github.com/Pathoschild/Stardew.ModBuildConfig#readme) +to detect your current OS automatically and load the correct references. Compile output will be +placed in a `bin` directory at the root of the git repository. ### Preparing a release +To prepare a crossplatform SMAPI release, you'll need to compile it on two platforms. See +_[crossplatforming a SMAPI mod](http://canimod.com/guides/crossplatforming-a-smapi-mod#preparing-a-mod-release)_ +for the first-time setup. -1. Open the project in [Visual Studio](https://www.visualstudio.com/vs/community/) or [MonoDevelop](http://www.monodevelop.com/). -2. Switch to _Release_ build mode. -3. Update the version number in `AssemblyInfo.cs`. -4. Update the version number in `Constants::Version`. Add the minimum game version and target - platform at the end of the version number (like `0.41.0 1.1 for Windows`). -5. Build the solution. -6. Copy the files for the target platform into the archive structure below. -7. Repeat for each platform. +For simplicity, all paths are relative to the root of the repository (the directory containing `src`). -The release should consist of three files like this: +1. Update the version number in `AssemblyInfo.cs` and `Constants::Version`. Make sure you use a + [semantic version](http://semver.org). Recommended format: + + build type | format | example + :--------- | :-------------------------------- | :------ + dev build | `-alpha-` | `1.0.0-alpha-201611300500` + beta | `-beta` | `1.0.0-beta2` + release | `` | `1.0.0` + +2. In Windows: + 1. Rebuild the solution in _Release_ mode. + 2. Transfer the `bin/Release/~Package` directory to Linux or Mac. + _This adds the installer executable and Windows files. We'll do the rest in Linux or Mac, + since we need to set Unix file permissions that Windows won't save._ + +2. In Linux or Mac: + 1. Rebuild the solution in _Release_ mode. + 2. Copy `bin/Release/~Package/Mono` into the package directory you transferred from Windows. + 3. Open a terminal in your package directory and run `chmod 755 Mono/StardewModdingAPI`. + 4. Rename your package directory to `SMAPI--installer`. + 5. Compress it into a `SMAPI-.zip` file. + +If you did everything right, you should have a release file like this: ``` -SMAPI-1.0-Linux.tar.gz - Mods/* - Newtonsoft.Json.dll - StardewModdingAPI - StardewModdingAPI.exe - StardewModdingAPI.mdb - System.Numerics.dll - -SMAPI-1.0-Mac.tar.gz - Mods/* - Newtonsoft.Json.dll - StardewModdingAPI - StardewModdingAPI.exe - StardewModdingAPI.mdb - System.Numerics.dll - -SMAPI-1.0-Windows.zip - Mods/* - StardewModdingAPI.exe - StardewModdingAPI.pdb +SMAPI-1.0.zip + SMAPI-1.0-installer/ + Mono/ + Mods/* + Newtonsoft.Json.dll + StardewModdingAPI + StardewModdingAPI.exe + StardewModdingAPI.exe.mdb + System.Numerics.dll + steam_appid.txt + Windows/ + Mods/* + StardewModdingAPI.exe + StardewModdingAPI.pdb + steam_appid.txt + install.exe + readme.txt ``` diff --git a/release-notes.md b/release-notes.md index 8b5a87d3..8299300e 100644 --- a/release-notes.md +++ b/release-notes.md @@ -3,10 +3,12 @@ ## 1.x * 1.0 (upcoming, [log](https://github.com/CLxS/SMAPI/compare/0.40.1.1-3...master)) * Added support for Linux and Mac. + * Added installer. * Added background update check on launch. * Added OS version to log. * Added zoom-adjusted mouse position to mouse-changed event arguments. * Switched to [semantic versioning](http://semver.org). + * Fixed missing `steam_appid.txt` file. * Fixed mod versions not being displayed correctly on log. * Fixed misspelled field in `manifest.json` schema. * Fixed several events not correctly propagating state. @@ -15,8 +17,8 @@ * Internal cleanup: * Simplified compiling from source. * Added code documentation. - * Internal cleanup & refactoring. * Removed obsolete and unfinished code. + * Internal cleanup & refactoring. ## 0.x * 0.40.1.1 (2016-09-30, [log](https://github.com/CLxS/SMAPI/compare/0.40.0...0.40.1.1-3)) diff --git a/src/StardewModdingAPI.Installer/Enums/Platform.cs b/src/StardewModdingAPI.Installer/Enums/Platform.cs new file mode 100644 index 00000000..9bcaa3c3 --- /dev/null +++ b/src/StardewModdingAPI.Installer/Enums/Platform.cs @@ -0,0 +1,12 @@ +namespace StardewModdingApi.Installer.Enums +{ + /// The game's platform version. + internal enum Platform + { + /// The Linux/Mac version of the game. + Mono, + + /// The Windows version of the game. + Windows + } +} \ No newline at end of file diff --git a/src/StardewModdingAPI.Installer/Enums/ScriptAction.cs b/src/StardewModdingAPI.Installer/Enums/ScriptAction.cs new file mode 100644 index 00000000..e62b2a7c --- /dev/null +++ b/src/StardewModdingAPI.Installer/Enums/ScriptAction.cs @@ -0,0 +1,12 @@ +namespace StardewModdingApi.Installer.Enums +{ + /// The action to perform. + internal enum ScriptAction + { + /// Install SMAPI to the game directory. + Install, + + /// Remove SMAPI from the game directory. + Uninstall + } +} \ No newline at end of file diff --git a/src/StardewModdingAPI.Installer/InteractiveInstaller.cs b/src/StardewModdingAPI.Installer/InteractiveInstaller.cs new file mode 100644 index 00000000..022ac4e6 --- /dev/null +++ b/src/StardewModdingAPI.Installer/InteractiveInstaller.cs @@ -0,0 +1,325 @@ +using System; +using System.IO; +using System.Linq; +using System.Reflection; +using StardewModdingApi.Installer.Enums; + +namespace StardewModdingApi.Installer +{ + /// Interactively performs the install and uninstall logic. + internal class InteractiveInstaller + { + /********* + ** Properties + *********/ + /// The default file paths where Stardew Valley can be installed. + /// Derived from the crossplatform mod config: https://github.com/Pathoschild/Stardew.ModBuildConfig. + private readonly string[] DefaultInstallPaths = { + // Linux + $"{Environment.GetEnvironmentVariable("HOME")}/GOG Games/Stardew Valley/game", + $"{Environment.GetEnvironmentVariable("HOME")}/.local/share/Steam/steamapps/common/Stardew Valley", + + // Mac + $"{Environment.GetEnvironmentVariable("HOME")}/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS", + + // Windows + @"C:\Program Files (x86)\GalaxyClient\Games\Stardew Valley", + @"C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley" + }; + + + /********* + ** Public methods + *********/ + /// Run the install or uninstall script. + /// The command line arguments. + /// + /// Initialisation flow: + /// 1. Collect information (mainly OS and install path) and validate it. + /// 2. Ask the user whether to install or uninstall. + /// + /// Install flow: + /// 1. Copy the SMAPI files from package/Windows or package/Mono into the game directory. + /// 2. On Linux/Mac: back up the game launcher and replace it with the SMAPI launcher. (This isn't possible on Windows, so the user needs to configure it manually.) + /// 3. Create the 'Mods' directory. + /// 4. Copy the bundled mods into the 'Mods' directory (deleting any existing versions). + /// + /// Uninstall logic: + /// 1. On Linux/Mac: if a backup of the launcher exists, delete the launcher and restore the backup. + /// 2. Delete all files in the game directory matching a file under package/Windows or package/Mono. + /// + public void Run(string[] args) + { + /**** + ** collect details + ****/ + this.PrintDebug("Collecting information..."); + Platform platform = this.DetectPlatform(); + DirectoryInfo packageDir = new DirectoryInfo(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), platform.ToString())); + DirectoryInfo installDir = this.InteractivelyGetInstallPath(); + string executablePath = Path.Combine(installDir.FullName, platform == Platform.Mono ? "StardewValley.exe" : "Stardew Valley.exe"); + string unixGameLauncherPath = Path.Combine(installDir.FullName, "StardewValley"); + string unixGameLauncherBackupPath = Path.Combine(installDir.FullName, "StardewValley-original"); + string unixSmapiLauncherPath = Path.Combine(installDir.FullName, "StardewModdingAPI"); + + this.PrintDebug($"Detected {(platform == Platform.Windows ? "Windows" : "Linux or Mac")}."); + this.PrintDebug($"Detected game in {installDir}."); + + /**** + ** validate assumptions + ****/ + this.PrintDebug("Verifying..."); + if (!packageDir.Exists) + { + this.ExitError($"The '{platform}' package directory is missing (should be at {packageDir})."); + return; + } + if (!File.Exists(executablePath)) + { + this.ExitError("The detected game install path doesn't contain a Stardew Valley executable."); + return; + } + Console.WriteLine(); + + /**** + ** ask user what to do + ****/ + Console.WriteLine("You can...."); + Console.ForegroundColor = ConsoleColor.DarkGreen; + if (platform == Platform.Mono) + Console.WriteLine("[1] Install SMAPI. This will safely update the files so you can launch the game the same way as before."); + else + Console.WriteLine("[1] Install SMAPI. You'll need to launch StardewModdingAPI.exe instead afterwards; see the readme.txt for details."); + Console.ForegroundColor = ConsoleColor.DarkRed; + Console.WriteLine("[2] Uninstall SMAPI."); + Console.ResetColor(); + + ScriptAction action; + { + string choice = this.InteractivelyChoose("What do you want to do?", "1", "2"); + switch (choice) + { + case "1": + action = ScriptAction.Install; + break; + case "2": + action = ScriptAction.Uninstall; + break; + default: + throw new InvalidOperationException($"Unexpected action key '{choice}'."); + } + } + Console.WriteLine(); + + /**** + ** Perform action + ****/ + switch (action) + { + case ScriptAction.Uninstall: + { + // restore game launcher + if (platform == Platform.Mono && File.Exists(unixGameLauncherBackupPath)) + { + this.PrintDebug("Restoring game launcher..."); + if (File.Exists(unixGameLauncherPath)) + File.Delete(unixGameLauncherPath); + File.Move(unixGameLauncherBackupPath, unixGameLauncherPath); + } + + // remove SMAPI files + this.PrintDebug("Removing SMAPI files..."); + foreach (FileInfo sourceFile in packageDir.EnumerateFiles()) + { + string targetPath = Path.Combine(installDir.FullName, sourceFile.Name); + if (File.Exists(targetPath)) + File.Delete(targetPath); + } + } + break; + + case ScriptAction.Install: + { + // copy SMAPI files to game dir + this.PrintDebug("Copying SMAPI files to game directory..."); + foreach (FileInfo sourceFile in packageDir.EnumerateFiles()) + { + string targetPath = Path.Combine(installDir.FullName, sourceFile.Name); + if (File.Exists(targetPath)) + File.Delete(targetPath); + sourceFile.CopyTo(targetPath); + } + + // replace mod launcher (if possible) + if (platform == Platform.Mono) + { + this.PrintDebug("Safely replacing game launcher..."); + if (!File.Exists(unixGameLauncherBackupPath)) + File.Move(unixGameLauncherPath, unixGameLauncherBackupPath); + else if (File.Exists(unixGameLauncherPath)) + File.Delete(unixGameLauncherPath); + + File.Move(unixSmapiLauncherPath, unixGameLauncherPath); + } + + // create mods directory (if needed) + DirectoryInfo modsDir = new DirectoryInfo(Path.Combine(installDir.FullName, "Mods")); + if (!modsDir.Exists) + { + this.PrintDebug("Creating mods directory..."); + modsDir.Create(); + } + + // add or replace bundled mods + Directory.CreateDirectory(Path.Combine(installDir.FullName, "Mods")); + DirectoryInfo packagedModsDir = new DirectoryInfo(Path.Combine(packageDir.FullName, "Mods")); + if (packagedModsDir.Exists && packagedModsDir.EnumerateDirectories().Any()) + { + this.PrintDebug("Adding bundled mods..."); + foreach (DirectoryInfo sourceDir in packagedModsDir.EnumerateDirectories()) + { + this.PrintDebug($" adding {sourceDir.Name}..."); + + // initialise target dir + DirectoryInfo targetDir = new DirectoryInfo(Path.Combine(modsDir.FullName, sourceDir.Name)); + if (targetDir.Exists) + targetDir.Delete(recursive: true); + targetDir.Create(); + + // copy files + foreach (FileInfo sourceFile in sourceDir.EnumerateFiles()) + sourceFile.CopyTo(Path.Combine(targetDir.FullName, sourceFile.Name)); + } + } + } + break; + } + Console.WriteLine(); + + /**** + ** exit + ****/ + Console.WriteLine("Done!"); + if (platform == Platform.Windows) + { + if(action == ScriptAction.Install) + Console.WriteLine("Don't forget to launch StardewModdingAPI.exe instead of the normal game executable. See the readme.txt for details."); + else + Console.WriteLine("If you manually changed shortcuts or Steam to launch SMAPI, don't forget to change those back."); + } + Console.ReadKey(); + } + + + /********* + ** Private methods + *********/ + /// Detect the game's platform. + /// The platform is not supported. + private Platform DetectPlatform() + { + switch (Environment.OSVersion.Platform) + { + case PlatformID.MacOSX: + case PlatformID.Unix: + return Platform.Mono; + + default: + return Platform.Windows; + } + } + + /// Print a debug message. + /// The text to print. + private void PrintDebug(string text) + { + Console.ForegroundColor = ConsoleColor.DarkGray; + Console.WriteLine(text); + Console.ResetColor(); + } + + /// Print a warning message. + /// The text to print. + private void PrintWarning(string text) + { + Console.ForegroundColor = ConsoleColor.DarkYellow; + Console.WriteLine(text); + Console.ResetColor(); + } + + /// Print an error and pause the console if needed. + /// The error text. + private void ExitError(string error) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine(error); + Console.ResetColor(); + Console.ReadLine(); + } + + /// Interactively ask the user to choose a value. + /// The message to print. + /// The allowed options (not case sensitive). + private string InteractivelyChoose(string message, params string[] options) + { + while (true) + { + Console.WriteLine(message); + string input = Console.ReadLine()?.Trim().ToLowerInvariant(); + if (!options.Contains(input)) + { + Console.WriteLine("That's not a valid option."); + continue; + } + return input; + } + } + + /// Interactively locate the game's install path. + private DirectoryInfo InteractivelyGetInstallPath() + { + // try default paths + foreach (string defaultPath in this.DefaultInstallPaths) + { + if (Directory.Exists(defaultPath)) + return new DirectoryInfo(defaultPath); + } + + // ask user + Console.WriteLine("Oops, couldn't find your Stardew Valley install path automatically. You'll need to specify where the game is installed (or install SMAPI manually)."); + while (true) + { + // get path from user + Console.WriteLine(" Enter the game's full directory path (the one containing 'StardewValley.exe' or 'Stardew Valley.exe')."); + Console.Write(" > "); + string path = Console.ReadLine(); + if (string.IsNullOrWhiteSpace(path)) + { + Console.WriteLine(" You must specify a directory path to continue."); + continue; + } + + // get directory + if (File.Exists(path)) + path = Path.GetDirectoryName(path); + DirectoryInfo directory = new DirectoryInfo(path); + + // validate path + if (!directory.Exists) + { + Console.WriteLine(" That directory doesn't seem to exist."); + continue; + } + if (!directory.EnumerateFiles("*.exe").Any(p => p.Name == "StardewValley.exe" || p.Name == "Stardew Valley.exe")) + { + Console.WriteLine(" That directory doesn't contain a Stardew Valley executable."); + continue; + } + + // looks OK + Console.WriteLine(" OK!"); + return directory; + } + } + } +} diff --git a/src/StardewModdingAPI.Installer/Program.cs b/src/StardewModdingAPI.Installer/Program.cs new file mode 100644 index 00000000..8f328ecf --- /dev/null +++ b/src/StardewModdingAPI.Installer/Program.cs @@ -0,0 +1,17 @@ +namespace StardewModdingApi.Installer +{ + /// The entry point for SMAPI's install and uninstall console app. + internal class Program + { + /********* + ** Public methods + *********/ + /// Run the install or uninstall script. + /// The command line arguments. + public static void Main(string[] args) + { + var installer = new InteractiveInstaller(); + installer.Run(args); + } + } +} diff --git a/src/StardewModdingAPI.Installer/Properties/AssemblyInfo.cs b/src/StardewModdingAPI.Installer/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..5d2b0dcc --- /dev/null +++ b/src/StardewModdingAPI.Installer/Properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("StardewModdingAPI.Installer")] +[assembly: AssemblyProduct("StardewModdingAPI.Installer")] +[assembly: ComVisible(false)] +[assembly: Guid("443ddf81-6aaf-420a-a610-3459f37e5575")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/StardewModdingAPI.Installer/StardewModdingAPI.Installer.csproj b/src/StardewModdingAPI.Installer/StardewModdingAPI.Installer.csproj new file mode 100644 index 00000000..e5271e96 --- /dev/null +++ b/src/StardewModdingAPI.Installer/StardewModdingAPI.Installer.csproj @@ -0,0 +1,80 @@ + + + + + Debug + AnyCPU + {443DDF81-6AAF-420A-A610-3459F37E5575} + Exe + Properties + StardewModdingAPI.Installer + StardewModdingAPI.Installer + v4.5 + 512 + true + + + AnyCPU + true + full + false + $(SolutionDir)\..\bin\Debug\Installer + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + $(SolutionDir)\..\bin\Release\Installer + TRACE + prompt + 4 + + + + + + + + + + + + + + Always + + + + + + + $(SolutionDir)\..\bin\$(Configuration)\~Package + $(SolutionDir)\..\bin\$(Configuration)\SMAPI + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/StardewModdingAPI.Installer/readme.txt b/src/StardewModdingAPI.Installer/readme.txt new file mode 100644 index 00000000..3865c768 --- /dev/null +++ b/src/StardewModdingAPI.Installer/readme.txt @@ -0,0 +1 @@ +See instructions at http://canimod.com/guides/using-mods#installing-smapi. \ No newline at end of file diff --git a/src/StardewModdingAPI.sln b/src/StardewModdingAPI.sln index 4d11c88d..9c999731 100644 --- a/src/StardewModdingAPI.sln +++ b/src/StardewModdingAPI.sln @@ -15,6 +15,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "metadata", "metadata", "{86 ..\release-notes.md = ..\release-notes.md EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StardewModdingAPI.Installer", "StardewModdingAPI.Installer\StardewModdingAPI.Installer.csproj", "{443DDF81-6AAF-420A-A610-3459F37E5575}" + ProjectSection(ProjectDependencies) = postProject + {28480467-1A48-46A7-99F8-236D95225359} = {28480467-1A48-46A7-99F8-236D95225359} + {F1A573B0-F436-472C-AE29-0B91EA6B9F8F} = {F1A573B0-F436-472C-AE29-0B91EA6B9F8F} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -47,6 +53,18 @@ Global {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Release|Mixed Platforms.Build.0 = Release|x86 {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Release|x86.ActiveCfg = Release|x86 {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Release|x86.Build.0 = Release|x86 + {443DDF81-6AAF-420A-A610-3459F37E5575}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {443DDF81-6AAF-420A-A610-3459F37E5575}.Debug|Any CPU.Build.0 = Debug|Any CPU + {443DDF81-6AAF-420A-A610-3459F37E5575}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {443DDF81-6AAF-420A-A610-3459F37E5575}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {443DDF81-6AAF-420A-A610-3459F37E5575}.Debug|x86.ActiveCfg = Debug|Any CPU + {443DDF81-6AAF-420A-A610-3459F37E5575}.Debug|x86.Build.0 = Debug|Any CPU + {443DDF81-6AAF-420A-A610-3459F37E5575}.Release|Any CPU.ActiveCfg = Release|Any CPU + {443DDF81-6AAF-420A-A610-3459F37E5575}.Release|Any CPU.Build.0 = Release|Any CPU + {443DDF81-6AAF-420A-A610-3459F37E5575}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {443DDF81-6AAF-420A-A610-3459F37E5575}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {443DDF81-6AAF-420A-A610-3459F37E5575}.Release|x86.ActiveCfg = Release|Any CPU + {443DDF81-6AAF-420A-A610-3459F37E5575}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/StardewModdingAPI/StardewModdingAPI b/src/StardewModdingAPI/StardewModdingAPI deleted file mode 100644 index 0bfe0d5c..00000000 --- a/src/StardewModdingAPI/StardewModdingAPI +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# MonoKickstart Shell Script -# Written by Ethan "flibitijibibo" Lee -# Modified for StardewModdingAPI by Viz - -# Move to script's directory -cd "`dirname "$0"`" - -# Get the system architecture -UNAME=`uname` -ARCH=`uname -m` - -# MonoKickstart picks the right libfolder, so just execute the right binary. -if [ "$UNAME" == "Darwin" ]; then - # ... Except on OSX. - export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:./osx/ - - # El Capitan is a total idiot and wipes this variable out, making the - # Steam overlay disappear. This sidesteps "System Integrity Protection" - # and resets the variable with Valve's own variable (they provided this - # fix by the way, thanks Valve!). Note that you will need to update your - # launch configuration to the script location, NOT just the app location - # (i.e. Kick.app/Contents/MacOS/Kick, not just Kick.app). - # -flibit - if [ "$STEAM_DYLD_INSERT_LIBRARIES" != "" ] && [ "$DYLD_INSERT_LIBRARIES" == "" ]; then - export DYLD_INSERT_LIBRARIES="$STEAM_DYLD_INSERT_LIBRARIES" - fi - - ln -sf mcs.bin.osx mcs - cp StardewValley.bin.osx StardewModdingAPI.bin.osx - ./StardewModdingAPI.bin.osx $@ -else - if [ "$ARCH" == "x86_64" ]; then - ln -sf mcs.bin.x86_64 mcs - cp StardewValley.bin.x86_64 StardewModdingAPI.bin.x86_64 - ./StardewModdingAPI.bin.x86_64 $@ - else - ln -sf mcs.bin.x86 mcs - cp StardewValley.bin.x86 StardewModdingAPI.bin.x86 - ./StardewModdingAPI.bin.x86 $@ - fi -fi diff --git a/src/StardewModdingAPI/StardewModdingAPI.csproj b/src/StardewModdingAPI/StardewModdingAPI.csproj index e79cabf4..b182bf4a 100644 --- a/src/StardewModdingAPI/StardewModdingAPI.csproj +++ b/src/StardewModdingAPI/StardewModdingAPI.csproj @@ -33,7 +33,7 @@ true full true - bin\Debug\ + $(SolutionDir)\..\bin\Debug\SMAPI TRACE;DEBUG prompt 4 @@ -44,7 +44,7 @@ AnyCPU pdbonly true - bin\Release\ + $(SolutionDir)\..\bin\Release\SMAPI TRACE prompt 4 @@ -58,7 +58,8 @@ DEBUG;TRACE true false - bin\Debug\StardewModdingAPI.XML + $(SolutionDir)\..\bin\Debug\SMAPI + bin\Debug\StardewModdingAPI.xml true 6 @@ -66,7 +67,8 @@ x86 bin\Release\ false - bin\Release\StardewModdingAPI.XML + $(SolutionDir)\..\bin\Release\SMAPI + bin\Release\StardewModdingAPI.xml TRACE true true @@ -148,7 +150,7 @@ - + True @@ -213,14 +215,16 @@ Designer - + Always - + - + + Always + diff --git a/src/StardewModdingAPI/unix-launcher.sh b/src/StardewModdingAPI/unix-launcher.sh new file mode 100644 index 00000000..0bfe0d5c --- /dev/null +++ b/src/StardewModdingAPI/unix-launcher.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# MonoKickstart Shell Script +# Written by Ethan "flibitijibibo" Lee +# Modified for StardewModdingAPI by Viz + +# Move to script's directory +cd "`dirname "$0"`" + +# Get the system architecture +UNAME=`uname` +ARCH=`uname -m` + +# MonoKickstart picks the right libfolder, so just execute the right binary. +if [ "$UNAME" == "Darwin" ]; then + # ... Except on OSX. + export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:./osx/ + + # El Capitan is a total idiot and wipes this variable out, making the + # Steam overlay disappear. This sidesteps "System Integrity Protection" + # and resets the variable with Valve's own variable (they provided this + # fix by the way, thanks Valve!). Note that you will need to update your + # launch configuration to the script location, NOT just the app location + # (i.e. Kick.app/Contents/MacOS/Kick, not just Kick.app). + # -flibit + if [ "$STEAM_DYLD_INSERT_LIBRARIES" != "" ] && [ "$DYLD_INSERT_LIBRARIES" == "" ]; then + export DYLD_INSERT_LIBRARIES="$STEAM_DYLD_INSERT_LIBRARIES" + fi + + ln -sf mcs.bin.osx mcs + cp StardewValley.bin.osx StardewModdingAPI.bin.osx + ./StardewModdingAPI.bin.osx $@ +else + if [ "$ARCH" == "x86_64" ]; then + ln -sf mcs.bin.x86_64 mcs + cp StardewValley.bin.x86_64 StardewModdingAPI.bin.x86_64 + ./StardewModdingAPI.bin.x86_64 $@ + else + ln -sf mcs.bin.x86 mcs + cp StardewValley.bin.x86 StardewModdingAPI.bin.x86 + ./StardewModdingAPI.bin.x86 $@ + fi +fi diff --git a/src/TrainerMod/TrainerMod.csproj b/src/TrainerMod/TrainerMod.csproj index e5002ba4..2bb92768 100644 --- a/src/TrainerMod/TrainerMod.csproj +++ b/src/TrainerMod/TrainerMod.csproj @@ -1,4 +1,4 @@ - + @@ -11,15 +11,12 @@ TrainerMod v4.5 512 - - - true full true - ..\StardewModdingAPI\bin\Debug\Mods\TrainerMod\ + $(SolutionDir)\..\bin\Debug\Mods\TrainerMod\ DEBUG;TRACE prompt 4 @@ -31,7 +28,7 @@ pdbonly true - ..\StardewModdingAPI\bin\Release\Mods\TrainerMod\ + $(SolutionDir)\..\bin\Release\Mods\TrainerMod\ TRACE prompt 4 -- cgit