add OldFreeLook
This commit is contained in:
parent
df0945daf9
commit
2b575cf5b4
55
Projects/SamSWAT.OldFreelook/Plugin.cs
Normal file
55
Projects/SamSWAT.OldFreelook/Plugin.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using Aki.Reflection.Patching;
|
||||
using BepInEx;
|
||||
using EFT;
|
||||
using HarmonyLib;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace SamSWAT.OldFreelook
|
||||
{
|
||||
[BepInPlugin("com.samswat.oldfreelook", "SamSWAT.OldFreelook", "1.0.0")]
|
||||
public class Plugin : BaseUnityPlugin
|
||||
{
|
||||
void Awake()
|
||||
{
|
||||
new Transpiler().Enable();
|
||||
}
|
||||
}
|
||||
|
||||
public class Transpiler : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return typeof(Player).GetMethod("Look", BindingFlags.Instance | BindingFlags.Public);
|
||||
}
|
||||
|
||||
[PatchTranspiler]
|
||||
private static IEnumerable<CodeInstruction> PatchTranspile(IEnumerable<CodeInstruction> instructions)
|
||||
{
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
var searchCode = new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(EFTHardSettings), "get_Instance"));
|
||||
|
||||
int endIndex = -1;
|
||||
|
||||
for (int i = 0; i < codes.Count; i++)
|
||||
{
|
||||
if (codes[i].opcode == searchCode.opcode && codes[i].operand == searchCode.operand)
|
||||
{
|
||||
endIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (endIndex == -1)
|
||||
{
|
||||
Logger.LogError("Old Freelook patch failed: Could not find reference code.");
|
||||
return instructions;
|
||||
}
|
||||
|
||||
codes.RemoveRange(0, endIndex);
|
||||
|
||||
return codes;
|
||||
}
|
||||
}
|
||||
}
|
36
Projects/SamSWAT.OldFreelook/Properties/AssemblyInfo.cs
Normal file
36
Projects/SamSWAT.OldFreelook/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Общие сведения об этой сборке предоставляются следующим набором
|
||||
// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
|
||||
// связанные со сборкой.
|
||||
[assembly: AssemblyTitle("SamSWAT.OldFreelook")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("SamSWAT.OldFreelook")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2022")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
|
||||
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
|
||||
// COM, задайте атрибуту ComVisible значение TRUE для этого типа.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
|
||||
[assembly: Guid("3e58b01f-a6b6-4b6d-ab33-1b567c5b81ec")]
|
||||
|
||||
// Сведения о версии сборки состоят из указанных ниже четырех значений:
|
||||
//
|
||||
// Основной номер версии
|
||||
// Дополнительный номер версии
|
||||
// Номер сборки
|
||||
// Редакция
|
||||
//
|
||||
// Можно задать все значения или принять номера сборки и редакции по умолчанию
|
||||
// используя "*", как показано ниже:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
59
Projects/SamSWAT.OldFreelook/SamSWAT.OldFreelook.csproj
Normal file
59
Projects/SamSWAT.OldFreelook/SamSWAT.OldFreelook.csproj
Normal file
@ -0,0 +1,59 @@
|
||||
<?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>{3E58B01F-A6B6-4B6D-AB33-1B567C5B81EC}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SamSWAT.OldFreelook</RootNamespace>
|
||||
<AssemblyName>SamSWAT.OldFreelook</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</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">
|
||||
<HintPath>..\..\References\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Aki.Reflection">
|
||||
<HintPath>..\..\References\Aki.Reflection.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>..\..\References\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BepInEx">
|
||||
<HintPath>..\..\References\BepInEx.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>..\..\References\UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>..\..\References\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Plugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
25
Projects/SamSWAT.OldFreelook/SamSWAT.OldFreelook.sln
Normal file
25
Projects/SamSWAT.OldFreelook/SamSWAT.OldFreelook.sln
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.32002.261
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SamSWAT.OldFreelook", "SamSWAT.OldFreelook.csproj", "{3E58B01F-A6B6-4B6D-AB33-1B567C5B81EC}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3E58B01F-A6B6-4B6D-AB33-1B567C5B81EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3E58B01F-A6B6-4B6D-AB33-1B567C5B81EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3E58B01F-A6B6-4B6D-AB33-1B567C5B81EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3E58B01F-A6B6-4B6D-AB33-1B567C5B81EC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {15AEFD71-1D38-4868-8F6F-8D3ABB87B7DE}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Loading…
x
Reference in New Issue
Block a user