Files
Performance-Fish/Source/PerformanceFish/Rendering/GraphicPatches.cs
T
bbradson d34bc77869 1.5, added stuff, fixed stuff
- mod icon
- fixes for new vanilla clipping issues
- GenClosest optimization improving repairing, wardening, tending jobs
- caching for new ListerBuildings methods
- DynamicDrawManager single threading
- Type.GetFields caching
- StatParts analyzer category
- removed duplicate steam warning and optionally window
- added exception handling for debug menu, incidentworker, Graphic_Multi, InitializeComps, making all those now log what mod broke and not cause black screens or whatever
2024-04-27 22:31:07 +02:00

41 lines
1.2 KiB
C#

// Copyright (c) 2023 bradson
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
using PerformanceFish.Prepatching;
namespace PerformanceFish.Rendering;
public sealed class GraphicPatches : ClassWithFishPrepatches
{
public sealed class MultiInitFix : FishPrepatch
{
public override string? Description { get; }
= "Fixes a bug in this type of Graphic that causes it to return with null material when failing to find a "
+ "texture, instead of the usual pink square seen in all other Graphics";
public override MethodBase TargetMethodBase { get; }
= AccessTools.DeclaredMethod(typeof(Graphic_Multi), nameof(Graphic_Multi.Init));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Postfix(Graphic_Multi __instance)
{
if (__instance.MatSingle != null)
return;
AssignBadMats(__instance);
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void AssignBadMats(Graphic_Multi instance)
{
var mats = instance.mats;
for (var i = mats.Length; i-- > 0;)
{
if (mats[i] == null)
mats[i] = BaseContent.BadMat;
}
}
}
}