mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 05:10:45 -05:00
Add EnablePrestigeTabPatch (#23)
* Add new transpilers * Cleanup * Fix transpiler * Fix incorrect code instruction * Add EnablePrestigeTabPatch --------- Co-authored-by: Chomp <27521899+chompDev@users.noreply.github.com>
This commit is contained in:
parent
77aa9496a0
commit
3abd27423b
40
project/SPT.Custom/Patches/EnablePrestigeTabPatch.cs
Normal file
40
project/SPT.Custom/Patches/EnablePrestigeTabPatch.cs
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
using EFT.UI;
|
||||||
|
using HarmonyLib;
|
||||||
|
using SPT.Reflection.Patching;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Reflection.Emit;
|
||||||
|
|
||||||
|
namespace SPT.Custom.Patches
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This transpiler removes the call to <see cref="IBackEndSession.SessionMode"/> to determine if it's <see cref="ESessionMode.Regular"/> <br/>
|
||||||
|
/// and forces a true instead
|
||||||
|
/// </summary>
|
||||||
|
internal class EnablePrestigeTabPatch : ModulePatch
|
||||||
|
{
|
||||||
|
protected override MethodBase GetTargetMethod()
|
||||||
|
{
|
||||||
|
return AccessTools.Method(typeof(InventoryScreen.Class2754), nameof(InventoryScreen.Class2754.MoveNext));
|
||||||
|
}
|
||||||
|
|
||||||
|
[PatchTranspiler]
|
||||||
|
public static IEnumerable<CodeInstruction> Transpile(IEnumerable<CodeInstruction> instructions)
|
||||||
|
{
|
||||||
|
CodeInstruction[] codeInstructions = instructions.ToArray();
|
||||||
|
|
||||||
|
// Remove all instructions that gets the gamemode from iSession
|
||||||
|
codeInstructions[259] = new(OpCodes.Nop);
|
||||||
|
codeInstructions[260] = new(OpCodes.Nop);
|
||||||
|
codeInstructions[261] = new(OpCodes.Nop);
|
||||||
|
codeInstructions[262] = new(OpCodes.Nop);
|
||||||
|
codeInstructions[263] = new(OpCodes.Nop);
|
||||||
|
|
||||||
|
// Force a true on the stack instead
|
||||||
|
codeInstructions[264] = new(OpCodes.Ldc_I4_1);
|
||||||
|
|
||||||
|
return codeInstructions;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -48,6 +48,9 @@ namespace SPT.Custom
|
|||||||
new AllowAirdropsInPvEPatch().Enable();
|
new AllowAirdropsInPvEPatch().Enable();
|
||||||
new MemoryCollectionPatch().Enable();
|
new MemoryCollectionPatch().Enable();
|
||||||
|
|
||||||
|
// 4.0
|
||||||
|
new EnablePrestigeTabPatch().Enable();
|
||||||
|
|
||||||
HookObject.AddComponent<MenuNotificationManager>();
|
HookObject.AddComponent<MenuNotificationManager>();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user