-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ive got a bad feeling about this * worst mistakes * network settings and IL fix * hashing and clean up * memorize tests and optimization * basic documentation and get modded mask overload * add stripped patch * update hash function * basic readme * doktor, turn off my memory inhibitors switch underlying data from bool[] to byte[], add GetRaw versions of public mask access * some internal documentation * documentation and ts updates * fix patcher encapsulation * Improvements to ProcTypeAPI --------- Co-authored-by: KingEnderBrine <kingenderbrin@gmail.com>
- Loading branch information
1 parent
4133383
commit c5f864e
Showing
14 changed files
with
704 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using RoR2; | ||
using System.Runtime.CompilerServices; | ||
|
||
[assembly:InternalsVisibleTo("R2API.ProcType")] | ||
|
||
namespace R2API; | ||
|
||
internal static class ProcTypeInterop | ||
{ | ||
public static byte[] GetModdedMask(ProcChainMask procChainMask) => procChainMask.r2api_moddedMask; | ||
|
||
public static void SetModdedMask(ref ProcChainMask procChainMask, byte[] value) => procChainMask.r2api_moddedMask = value; | ||
} |
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,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>netstandard2.1</TargetFramework> | ||
<LangVersion>preview</LangVersion> | ||
<Nullable>annotations</Nullable> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<NoWarn>$(NoWarn);NU5104</NoWarn> | ||
<RootNamespace>R2API</RootNamespace> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\RoR2.Patched\RoR2.Patched.csproj" Private="false" PrivateAssets="all"/> | ||
</ItemGroup> | ||
</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,23 @@ | ||
using BepInEx; | ||
using BepInEx.Logging; | ||
using Mono.Cecil; | ||
using System.Collections.Generic; | ||
|
||
namespace R2API; | ||
|
||
internal static class ProcTypePatcher | ||
{ | ||
public static IEnumerable<string> TargetDLLs | ||
{ | ||
get | ||
{ | ||
yield return "RoR2.dll"; | ||
} | ||
} | ||
|
||
public static void Patch(AssemblyDefinition assembly) | ||
{ | ||
TypeDefinition procChainMask = assembly.MainModule.GetType("RoR2", "ProcChainMask"); | ||
procChainMask?.Fields.Add(new FieldDefinition("r2api_moddedMask", FieldAttributes.Public, assembly.MainModule.ImportReference(typeof(byte[])))); | ||
} | ||
} |
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,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>netstandard2.1</TargetFramework> | ||
<LangVersion>preview</LangVersion> | ||
<Nullable>annotations</Nullable> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<NoWarn>$(NoWarn);NU5104</NoWarn> | ||
<RootNamespace>R2API</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="BepInEx.Core" Version="5.4.19" /> | ||
</ItemGroup> | ||
</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,19 @@ | ||
using RoR2; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using UnityEngine; | ||
|
||
namespace R2API; | ||
|
||
/// <summary> | ||
/// A modded equivalent of <see cref="ProcType"/> for use with <see cref="ProcTypeAPI"/>. | ||
/// </summary> | ||
public enum ModdedProcType : int | ||
{ | ||
/// <summary> | ||
/// Represents an invalid value of <see cref="ModdedProcType"/>. | ||
/// </summary> | ||
/// <remarks>All negative values of <see cref="ModdedProcType"/> are considered invalid.</remarks> | ||
Invalid = -1 | ||
} |
Oops, something went wrong.