Skip to content

Commit

Permalink
Add back JIT for fusion-related methods
Browse files Browse the repository at this point in the history
  • Loading branch information
HAHOOS committed Dec 7, 2024
1 parent c92b059 commit cca367f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 28 deletions.
26 changes: 0 additions & 26 deletions KeepInventory/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,6 @@ public override void OnInitializeMelon()
/// <summary>
/// Setup the Fusion Support Library
/// </summary>
[System.Runtime.CompilerServices.MethodImpl(
System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
private static void SetupFusionLibrary()
{
Logger.Msg("Setting up the library");
Expand All @@ -422,8 +420,6 @@ private static void SetupFusionLibrary()
/// Check if the player is connected to a Fusion server with the Fusion Support Library
/// </summary>
/// <returns>A boolean value indicating whether or not is the player connected to a server</returns>
[System.Runtime.CompilerServices.MethodImpl(
System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
private static bool FusionLibraryIsConnected()
{
return Fusion.FusionMethods.LocalNetworkPlayer != null;
Expand All @@ -434,8 +430,6 @@ private static bool FusionLibraryIsConnected()
/// Check if the player is connected to a Fusion server without the Fusion Support Library
/// </summary>
/// <returns>A boolean value indicating whether or not is the player connected to a server</returns>
[System.Runtime.CompilerServices.MethodImpl(
System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
private static bool FusionIsConnected()
{
return LabFusion.Player.LocalPlayer.GetNetworkPlayer() != null;
Expand All @@ -449,8 +443,6 @@ private static bool FusionIsConnected()
/// <param name="slotName">Name of the slot (debug purposes)</param>
/// <param name="slotColor">Color of the slot name (debug purposes)</param>
/// <param name="inBetween">The <see cref="Action{GameObject}"/> that will be run between spawning and putting the spawnable into the <see cref="InventorySlotReceiver"/></param>
[System.Runtime.CompilerServices.MethodImpl(
System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
private static void FusionSpawnInSlot(Barcode barcode, InventorySlotReceiver inventorySlotReceiver, string slotName, System.Drawing.Color slotColor, Action<GameObject> inBetween = null)
{
Fusion.FusionMethods.NetworkSpawnInSlotAsync(inventorySlotReceiver, barcode, slotColor, slotName, inBetween);
Expand All @@ -460,8 +452,6 @@ private static void FusionSpawnInSlot(Barcode barcode, InventorySlotReceiver inv
/// Find the <see cref="RigManager"/> for the local player that is connected to a server with the Fusion Support Library
/// </summary>
/// <returns>The <see cref="RigManager"/> of the local player</returns>
[System.Runtime.CompilerServices.MethodImpl(
System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
private static RigManager FusionFindRigManager_FSL()
{
return Fusion.FusionMethods.RigManager ?? Player.RigManager;
Expand All @@ -471,8 +461,6 @@ private static RigManager FusionFindRigManager_FSL()
/// Find the <see cref="RigManager"/> for the local player that is connected to a server
/// </summary>
/// <returns>The <see cref="RigManager"/> of the local player</returns>
[System.Runtime.CompilerServices.MethodImpl(
System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
private static RigManager FusionFindRigManager()
{
if (!IsConnected)
Expand All @@ -488,8 +476,6 @@ private static RigManager FusionFindRigManager()
/// <summary>
/// Removes the <see cref="SpawnSavedItems(RigManager)"/> method from the OnRigCreated event in the Fusion Support Library
/// </summary>
[System.Runtime.CompilerServices.MethodImpl(
System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
private void RemoveRigCreateEvent_FSL()
{
Fusion.FusionMethods.OnRigCreated -= SpawnSavedItems;
Expand All @@ -498,15 +484,11 @@ private void RemoveRigCreateEvent_FSL()
/// <summary>
/// Removes the <see cref="SpawnSavedItems(RigManager)"/> method from the OnRigCreated event in the Fusion Support Library
/// </summary>
[System.Runtime.CompilerServices.MethodImpl(
System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
private void RemoveRigCreateEvent()
{
if (HasFusion && IsConnected && IsFusionLibraryInitialized) RemoveRigCreateEvent_FSL();
}

[System.Runtime.CompilerServices.MethodImpl(
System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
private static AmmoInventory FusionGetAmmoInventory_FSL()
{
return Fusion.FusionMethods.FindAmmoInventory();
Expand All @@ -516,8 +498,6 @@ private static AmmoInventory FusionGetAmmoInventory_FSL()
/// Find the <see cref="AmmoInventory"/> of the local player
/// </summary>
/// <returns></returns>
[System.Runtime.CompilerServices.MethodImpl(
System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
private static AmmoInventory FusionGetAmmoInventory()
{
if (HasFusion) return IsFusionLibraryInitialized ? (FusionGetAmmoInventory_FSL() ?? AmmoInventory.Instance) : (LabFusion.Marrow.NetworkGunManager.NetworkAmmoInventory ?? AmmoInventory.Instance);
Expand All @@ -528,8 +508,6 @@ private static AmmoInventory FusionGetAmmoInventory()
/// Spawn the saved items, run when Fusion is detected
/// <para>This is separate to avoid errors if Fusion Support Library is not loaded</para>
/// </summary>
[System.Runtime.CompilerServices.MethodImpl(
System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
private void FusionSpawnSavedItems_FSL()
{
if (Fusion.FusionMethods.RigManager == null)
Expand All @@ -547,8 +525,6 @@ private void FusionSpawnSavedItems_FSL()
/// <summary>
/// Spawn the saved items, run when Fusion is detected
/// </summary>
[System.Runtime.CompilerServices.MethodImpl(
System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
private void FusionSpawnSavedItems()
{
if (IsConnected)
Expand All @@ -574,8 +550,6 @@ private void FusionSpawnSavedItems()
/// Check if a gamemode is currently running in the server
/// </summary>
/// <returns>A boolean value indicating whether or not is a gamemode running</returns>
[System.Runtime.CompilerServices.MethodImpl(
System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
internal static bool FusionGamemodeCheck()
{
if (!IsConnected) return false;
Expand Down
2 changes: 0 additions & 2 deletions KeepInventory/Helper/GunHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ public static class GunHelper
/// <param name="name">Name of the crate (debugging purposes)</param>
/// <param name="barcode">Barcode of the spawnable (debugging purposes)</param>
/// <param name="printMessages">If <see langword="true"/>, the method will print debug messages using <see cref="MelonLoader.MelonLogger.Instance"/></param>
[System.Runtime.CompilerServices.MethodImpl(
System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
public static void SendFusionMessage(Gun gun, GunInfo info, System.Drawing.Color slotColor, SaveSlot slot = null, string name = "N/A", string barcode = "N/A", bool printMessages = true)
{
if (Core.IsConnected)
Expand Down

0 comments on commit cca367f

Please sign in to comment.