@@ -0,0 +1,25 @@ | |||
| |||
Microsoft Visual Studio Solution File, Format Version 12.00 | |||
# Visual Studio Version 16 | |||
VisualStudioVersion = 16.0.29411.108 | |||
MinimumVisualStudioVersion = 10.0.40219.1 | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExtraCommands", "extracommands\ExtraCommands.csproj", "{7FD5A7D8-4F3E-426A-B07D-7DC70442A4DF}" | |||
EndProject | |||
Global | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
Debug|Any CPU = Debug|Any CPU | |||
Release|Any CPU = Release|Any CPU | |||
EndGlobalSection | |||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | |||
{7FD5A7D8-4F3E-426A-B07D-7DC70442A4DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{7FD5A7D8-4F3E-426A-B07D-7DC70442A4DF}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{7FD5A7D8-4F3E-426A-B07D-7DC70442A4DF}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{7FD5A7D8-4F3E-426A-B07D-7DC70442A4DF}.Release|Any CPU.Build.0 = Release|Any CPU | |||
EndGlobalSection | |||
GlobalSection(SolutionProperties) = preSolution | |||
HideSolutionNode = FALSE | |||
EndGlobalSection | |||
GlobalSection(ExtensibilityGlobals) = postSolution | |||
SolutionGuid = {72FB94D0-6C50-475B-81E0-C94C7D7A2A17} | |||
EndGlobalSection | |||
EndGlobal |
@@ -1,2 +1,24 @@ | |||
# extracommands | |||
# ExtraCommands | |||
Proof of concept mod and reference implementation | |||
## Installation | |||
1. Patch Gamecraft with [GCIPA](https://git.exmods.org/modtainers/GCIPA). | |||
You should download the latest release and extract it to the Gamecraft folder. | |||
To patch, drag `Gamecraft.exe` onto `IPA.exe`. You will need to redo this step whenever Gamecraft is updated. | |||
2. Extract the TestMod zip into Gamecraft's `Plugins\` folder (GCIPA should have created this automatically in the previous step). You should see `0Harmony.dll` and `ExtraCommands.dll` in the `Plugins\` folder. If those files are in another folder in `Plugins\` it will not work. | |||
3. Launch Gamecraft. | |||
You can check the log file `%APPDATA%\..\LocalLow\FreeJam\RobocraftX\Player.log` to confirm. | |||
You should be able to see a message near the top showing how many plugins have been loaded and their names. | |||
## Development | |||
Interested in making your own mod? | |||
Clone this repository and modify the C# classes in `extracommands\`. | |||
Patch Gamecraft with [GCIPA](#installation) | |||
Build the solution and copy `bin\Debug\net45\extracommands.dll` and `bin\Debug\net45\0Harmony.dll` into Gamecraft's `Plugins\` folder. | |||
More information about the IPlugin and IEnhancedPlugin interface can be found [on the IPA repository](https://github.com/Eusth/IPA). | |||
More information about Harmony can be found [on the Harmony wiki](https://github.com/pardeike/Harmony/wiki). |
@@ -0,0 +1,23 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net45</TargetFramework> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="Lib.Harmony" Version="1.2.0.1" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Reference Include="IllusionPlugin"> | |||
<HintPath>..\..\..\IPA\IPA\bin\Debug\IPA\Data\Managed\IllusionPlugin.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEngine"> | |||
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Gamecraft\RobocraftX_Data\Managed\UnityEngine.dll</HintPath> | |||
</Reference> | |||
<Reference Include="UnityEngine.CoreModule"> | |||
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Gamecraft\RobocraftX_Data\Managed\UnityEngine.CoreModule.dll</HintPath> | |||
</Reference> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,22 @@ | |||
using System; | |||
using System.Reflection; | |||
using Harmony; | |||
using UnityEngine; | |||
namespace TestMod | |||
{ | |||
[HarmonyPatch] | |||
class TestPatch | |||
{ | |||
static void Prefix() | |||
{ | |||
Debug.Log("Test Patch Prefix"); | |||
} | |||
[HarmonyTargetMethod] | |||
static MethodBase HTargetMethod(HarmonyInstance instance) | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,62 @@ | |||
using System; | |||
using IllusionPlugin; | |||
using UnityEngine; | |||
using Harmony; | |||
using System.Reflection; | |||
namespace TestMod | |||
{ | |||
public class Plugin : IllusionPlugin.IEnhancedPlugin | |||
{ | |||
public static HarmonyInstance harmony { get; protected set; } | |||
public string[] Filter { get; } = new string[] { "RobocraftX", "Gamecraft" }; | |||
public string Name { get; } = "TestPlugin"; | |||
public string Version { get; } = "v0.0.0a"; | |||
public string HarmonyID { get; } = "org.git.exmods.base.testmod.testplugin"; | |||
public void OnApplicationQuit() | |||
{ | |||
harmony.UnpatchAll(HarmonyID); | |||
Debug.Log("TestPlugin shutdown complete"); | |||
} | |||
public void OnApplicationStart() | |||
{ | |||
if (harmony == null) | |||
{ | |||
harmony = HarmonyInstance.Create(HarmonyID); | |||
harmony.PatchAll(Assembly.GetExecutingAssembly()); | |||
} | |||
Debug.Log("TestPlugin start & patch complete"); | |||
} | |||
public void OnFixedUpdate() | |||
{ | |||
//throw new NotImplementedException(); | |||
} | |||
public void OnLateUpdate() | |||
{ | |||
//throw new NotImplementedException(); | |||
} | |||
public void OnLevelWasInitialized(int level) | |||
{ | |||
//throw new NotImplementedException(); | |||
} | |||
public void OnLevelWasLoaded(int level) | |||
{ | |||
//throw new NotImplementedException(); | |||
} | |||
public void OnUpdate() | |||
{ | |||
//throw new NotImplementedException(); | |||
} | |||
} | |||
} |