-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added KKS_Fix_CameraMaskResize - Fix lut color mask in maker not resi…
…zing when resolution changes
- Loading branch information
1 parent
36413b0
commit cda670c
Showing
5 changed files
with
160 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using BepInEx; | ||
using BepInEx.Logging; | ||
using Common; | ||
using HarmonyLib; | ||
using UnityEngine; | ||
|
||
namespace IllusionFixes | ||
{ | ||
[BepInProcess(Constants.GameProcessName)] | ||
[BepInPlugin(GUID, PluginName, Constants.PluginsVersion)] | ||
public class CameraMaskResizeFix : BaseUnityPlugin //todo add an EC version | ||
{ | ||
public const string GUID = "Fix_CameraMaskResize"; | ||
public const string PluginName = "Fix camera color mask not resizing"; | ||
internal static new ManualLogSource Logger; | ||
|
||
private void Awake() | ||
{ | ||
Logger = base.Logger; | ||
|
||
Harmony.CreateAndPatchAll(typeof(Hooks), GUID); | ||
} | ||
|
||
internal static class Hooks | ||
{ | ||
private static int _lastWidth; | ||
|
||
[HarmonyPrefix] | ||
[HarmonyPatch(typeof(CameraEffectorColorMask), nameof(CameraEffectorColorMask.Update))] | ||
internal static void LoadCharaFbxDataAsync(CameraEffectorColorMask __instance) | ||
{ | ||
var width = Screen.width; | ||
if (_lastWidth != width) | ||
{ | ||
if (_lastWidth != 0) // First run assume the size is correct | ||
{ | ||
Logger.LogDebug($"Adjusting CameraEffectorColorMask targetTexture size because screen width changed from {_lastWidth} to {width}"); | ||
var newRt = new RenderTexture(width, Screen.height, 24, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default); | ||
Destroy(__instance.myCamera.targetTexture); | ||
__instance.myCamera.targetTexture = newRt; | ||
__instance.amplifyColorEffect.MaskTexture = newRt; | ||
} | ||
_lastWidth = width; | ||
} | ||
} | ||
} | ||
} | ||
} |
89 changes: 89 additions & 0 deletions
89
src/KKS_Fix_CameraMaskResize/KKS_Fix_CameraMaskResize.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?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>{00E09FD0-9862-41B3-BD2C-7094A16C97F7}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>IllusionFixes</RootNamespace> | ||
<AssemblyName>KKS_Fix_CameraMaskResize</AssemblyName> | ||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<Deterministic>true</Deterministic> | ||
<NuGetPackageImportStamp> | ||
</NuGetPackageImportStamp> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>embedded</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>..\..\bin\BepInEx\plugins\IllusionFixes\</OutputPath> | ||
<DefineConstants>TRACE;DEBUG;KKS</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>embedded</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>..\..\bin\BepInEx\plugins\IllusionFixes\</OutputPath> | ||
<DefineConstants>TRACE;KKS</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<DebugSymbols>true</DebugSymbols> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="0Harmony, Version=2.3.2.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\..\packages\IllusionLibs.BepInEx.Harmony.2.3.2\lib\net35\0Harmony.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\..\packages\IllusionLibs.KoikatsuSunshine.Assembly-CSharp.2021.5.28\lib\net46\Assembly-CSharp.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="BepInEx, Version=5.4.8.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\..\packages\IllusionLibs.BepInEx.5.4.8\lib\net35\BepInEx.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="BepInEx.Harmony, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\..\packages\IllusionLibs.BepInEx.Harmony.2.3.2\lib\net35\BepInEx.Harmony.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Sirenix.Serialization, Version=2.1.13.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\..\packages\IllusionLibs.KoikatsuSunshine.UnityEngine.CoreModule.2019.4.9\lib\net46\Sirenix.Serialization.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\..\packages\IllusionLibs.KoikatsuSunshine.UnityEngine.CoreModule.2019.4.9\lib\net46\UnityEngine.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\..\packages\IllusionLibs.KoikatsuSunshine.UnityEngine.CoreModule.2019.4.9\lib\net46\UnityEngine.CoreModule.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="CameraMaskResizeFix.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<Import Project="..\Common\Common.projitems" Label="Shared" /> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<Import Project="..\..\packages\IllusionLibs.BepInEx.Harmony.2.3.2\build\IllusionLibs.BepInEx.Harmony.targets" Condition="Exists('..\..\packages\IllusionLibs.BepInEx.Harmony.2.3.2\build\IllusionLibs.BepInEx.Harmony.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\IllusionLibs.BepInEx.Harmony.2.3.2\build\IllusionLibs.BepInEx.Harmony.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\IllusionLibs.BepInEx.Harmony.2.3.2\build\IllusionLibs.BepInEx.Harmony.targets'))" /> | ||
<Error Condition="!Exists('..\..\packages\IllusionLibs.KoikatsuSunshine.UnityEngine.CoreModule.2019.4.9\build\IllusionLibs.KoikatsuSunshine.UnityEngine.CoreModule.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\IllusionLibs.KoikatsuSunshine.UnityEngine.CoreModule.2019.4.9\build\IllusionLibs.KoikatsuSunshine.UnityEngine.CoreModule.targets'))" /> | ||
<Error Condition="!Exists('..\..\packages\IllusionLibs.KoikatsuSunshine.Assembly-CSharp.2021.5.28\build\IllusionLibs.KoikatsuSunshine.Assembly-CSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\IllusionLibs.KoikatsuSunshine.Assembly-CSharp.2021.5.28\build\IllusionLibs.KoikatsuSunshine.Assembly-CSharp.targets'))" /> | ||
</Target> | ||
<Import Project="..\..\packages\IllusionLibs.KoikatsuSunshine.UnityEngine.CoreModule.2019.4.9\build\IllusionLibs.KoikatsuSunshine.UnityEngine.CoreModule.targets" Condition="Exists('..\..\packages\IllusionLibs.KoikatsuSunshine.UnityEngine.CoreModule.2019.4.9\build\IllusionLibs.KoikatsuSunshine.UnityEngine.CoreModule.targets')" /> | ||
<Import Project="..\..\packages\IllusionLibs.KoikatsuSunshine.Assembly-CSharp.2021.5.28\build\IllusionLibs.KoikatsuSunshine.Assembly-CSharp.targets" Condition="Exists('..\..\packages\IllusionLibs.KoikatsuSunshine.Assembly-CSharp.2021.5.28\build\IllusionLibs.KoikatsuSunshine.Assembly-CSharp.targets')" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
using System.Reflection; | ||
|
||
[assembly: AssemblyTitle(IllusionFixes.CameraMaskResizeFix.GUID)] | ||
[assembly: AssemblyProduct(IllusionFixes.CameraMaskResizeFix.GUID)] | ||
[assembly: AssemblyDescription(IllusionFixes.CameraMaskResizeFix.PluginName)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="IllusionLibs.BepInEx" version="5.4.8" targetFramework="net46" /> | ||
<package id="IllusionLibs.BepInEx.Harmony" version="2.3.2" targetFramework="net46" /> | ||
<package id="IllusionLibs.KoikatsuSunshine.Assembly-CSharp" version="2021.5.28" targetFramework="net46" /> | ||
<package id="IllusionLibs.KoikatsuSunshine.UnityEngine.CoreModule" version="2019.4.9" targetFramework="net46" /> | ||
<package id="ScreenshotManager.KoikatsuSunshine" version="16.3.1" targetFramework="net46" developmentDependency="true" /> | ||
</packages> |