This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using HarmonyLib;
|
||||
using Havok;
|
||||
using ParallelTasks;
|
||||
@@ -33,6 +34,30 @@ public class ThreadPoolScheduler : IWorkScheduler
|
||||
public int ThreadCount { get; } = ThreadPool.ThreadCount;
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
internal class KeenThreadingPatch
|
||||
{
|
||||
private static MethodBase TargetMethod()
|
||||
{
|
||||
var type = Type.GetType(
|
||||
"VRage.Render11.Resources.Textures.MyTextureStreamingManager+MyStreamedTextureBase, VRage.Render11");
|
||||
|
||||
return AccessTools.FirstConstructor(type, _ => true);
|
||||
}
|
||||
|
||||
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
|
||||
{
|
||||
var property = AccessTools.Property(typeof(Environment), nameof(Environment.ProcessorCount));
|
||||
|
||||
return instructions.Manipulator(i => i.Calls(property.GetMethod),
|
||||
i =>
|
||||
{
|
||||
i.opcode = OpCodes.Ldc_I4;
|
||||
i.operand = 1024;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
internal class ThreadPoolWorkItemTask(CringeTask task) : IThreadPoolWorkItem
|
||||
{
|
||||
|
Reference in New Issue
Block a user