Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
LoganDark committed Oct 4, 2022
0 parents commit fd950de
Show file tree
Hide file tree
Showing 8 changed files with 272 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/.vs/
/bin/
/obj/
/dist/
/*.zip
9 changes: 9 additions & 0 deletions Info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Id": "UnlimitedSketchZoom",
"DisplayName": "Unlimited Sketch Zoom",
"Author": "LoganDark",
"GameVersion": "0.1.75",
"Version": "1.0.0",
"ManagerVersion": "0.23.5.0",
"EntryMethod": "UnlimitedSketchZoom.Main.Load"
}
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Plasma Demo Mod Template
Copyright 2022 LoganDark

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
76 changes: 76 additions & 0 deletions Main.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
using System.Collections;
using System.Reflection;

using UnityModManagerNet;
using HarmonyLib;

namespace UnlimitedSketchZoom {
#if DEBUG
[EnableReloading]
#endif
public static class Main {
static Harmony harmony;
static UnityModManager.ModEntry lastEntry;

public static bool Load(UnityModManager.ModEntry entry) {
harmony = new Harmony(entry.Info.Id);

entry.OnToggle = OnToggle;
#if DEBUG
entry.OnUnload = OnUnload;
#endif
lastEntry = entry;

return true;
}

static bool OnToggle(UnityModManager.ModEntry entry, bool active) {
if (active) {
harmony.PatchAll(Assembly.GetExecutingAssembly());
} else {
harmony.UnpatchAll(entry.Info.Id);
}

return true;
}

#if DEBUG
static bool OnUnload(UnityModManager.ModEntry entry) {
lastEntry = null;
return true;
}
#endif

[HarmonyPatch(typeof(Visor.ProcessorUI), nameof(Visor.ProcessorUI.EnterZoomView))]
class Patch {
static MethodInfo rewired_getAxis = AccessTools.Method(typeof(Rewired.Player), nameof(Rewired.Player.GetAxis), new[] { typeof(string) });

static FieldInfo _canClose = AccessTools.Field(typeof(Visor.ProcessorUI), "_canClose");
static FieldInfo _input = AccessTools.Field(typeof(Visor.ProcessorUI), "_input");
static FieldInfo _sketchView = AccessTools.Field(typeof(Visor.ProcessorUI), "_sketchView");

static IEnumerator EnterZoomView(Visor.ProcessorUI instance) {
_canClose.SetValue(instance, false);

try {
float delta = ((Rewired.Player) _input.GetValue(instance)).GetAxis("ScaleComponent");

if (delta > 0f) {
((Visor.SketchView) _sketchView.GetValue(instance)).zoomFactor /= 2f;
} else if (delta < 0f) {
((Visor.SketchView) _sketchView.GetValue(instance)).zoomFactor *= 2f;
}
} finally {
_canClose.SetValue(instance, true);
}

yield break;
}

public static bool Prefix(Visor.ProcessorUI __instance, ref IEnumerator __result) {
__result = EnterZoomView(__instance);
return false;
}
}
}
}
38 changes: 38 additions & 0 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Unlimited Sketch Zoom")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Unlimited Sketch Zoom")]
[assembly: AssemblyCopyright("Copyright © LoganDark 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ea956769-2d60-43f6-a3ef-e9b37505dd94")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguage("en-US")]
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# UnlimitedSketchZoom

A mod for Plasma Demo that lets you zoom however far you want in a sketch.

## Installation

1. Grab a zip from
[GitHub Releases](https://github.com/LoganDark/UnlimitedSketchZoom/releases)

2. Install UnityModManager on Plasma Demo as instructed
[here](https://github.com/LoganDark/PlasmaDemoModTemplate)

3. Go to the 'Mods' tab of UnityModManager, and drag the zip into the "Drop zip
files here" area
85 changes: 85 additions & 0 deletions UnlimitedSketchZoom.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{EA956769-2D60-43F6-A3EF-E9B37505DD94}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UnlimitedSketchZoom</RootNamespace>
<AssemblyName>UnlimitedSketchZoom</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>false</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony, Version=2.0.2.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Plasma Demo\Plasma_Data\Managed\UnityModManager\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Plasma Demo\Plasma_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Plasma Demo\Plasma_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="Rewired_Core, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Plasma Demo\Plasma_Data\Managed\Rewired_Core.dll</HintPath>
</Reference>
<Reference Include="Sirenix.Serialization">
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Plasma Demo\Plasma_Data\Managed\Sirenix.Serialization.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Plasma Demo\Plasma_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Plasma Demo\Plasma_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityModManager, Version=0.23.5.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Plasma Demo\Plasma_Data\Managed\UnityModManager\UnityModManager.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Info.json" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>RD /S /Q "$(ProjectDir)dist"
MD "$(ProjectDir)dist"
XCOPY /Y /D "$(ProjectDir)$(OutDir)$(TargetFileName)" "$(ProjectDir)dist\"
XCOPY /Y /D "$(ProjectDir)Info.json" "$(ProjectDir)dist\"
powershell Compress-Archive -DestinationPath "$(ProjectDir)$(ProjectName)-$(ConfigurationName).zip" -Path "$(ProjectDir)dist\*" -CompressionLevel "Optimal" -Force
XCOPY /Y /D /S "$(ProjectDir)dist\*" "%25ProgramFiles(x86)%25\Steam\SteamApps\common\Plasma Demo\Mods\$(ProjectName)\"</PostBuildEvent>
</PropertyGroup>
</Project>
25 changes: 25 additions & 0 deletions UnlimitedSketchZoom.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31424.327
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnlimitedSketchZoom", "UnlimitedSketchZoom.csproj", "{EA956769-2D60-43F6-A3EF-E9B37505DD94}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EA956769-2D60-43F6-A3EF-E9B37505DD94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EA956769-2D60-43F6-A3EF-E9B37505DD94}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA956769-2D60-43F6-A3EF-E9B37505DD94}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA956769-2D60-43F6-A3EF-E9B37505DD94}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A2C74FF5-23E1-40F0-AE3F-BED1F11EB618}
EndGlobalSection
EndGlobal

0 comments on commit fd950de

Please sign in to comment.