mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-27 23:25:55 +03:00
Trying PreserveAttribute instead
This commit is contained in:
parent
1a02a9c363
commit
4f6e8bf8d1
@ -73,4 +73,10 @@ internal class MonoPInvokeCallbackAttribute : Attribute
|
|||||||
{
|
{
|
||||||
public MonoPInvokeCallbackAttribute() { }
|
public MonoPInvokeCallbackAttribute() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prevent unity from stripping shit we depend on
|
||||||
|
/// https://docs.unity3d.com/Manual/ManagedCodeStripping.html
|
||||||
|
/// </summary>
|
||||||
|
internal class PreserveAttribute : System.Attribute { }
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@ public void Init()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PreservationHack();
|
|
||||||
throw new System.Exception( "Trying to initialize Steam Interface but Steam not initialized" );
|
throw new System.Exception( "Trying to initialize Steam Interface but Steam not initialized" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,15 +109,5 @@ internal virtual void Shutdown()
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract void InitInternals();
|
public abstract void InitInternals();
|
||||||
|
|
||||||
internal void PreservationHack()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Stop Utf8StringToNative.GetInstance getting culled by stuff like Unity's
|
|
||||||
// asselmbly optimization stuff. Here we just call it so it can't not exist.
|
|
||||||
//
|
|
||||||
var i = Utf8StringToNative.GetInstance( "don't cull this function" );
|
|
||||||
i.GetNativeDataSize();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -38,6 +38,7 @@ public IntPtr MarshalManagedToNative(object managedObj)
|
|||||||
public void CleanUpManagedData(object managedObj) => throw new System.NotImplementedException();
|
public void CleanUpManagedData(object managedObj) => throw new System.NotImplementedException();
|
||||||
public int GetNativeDataSize() => -1;
|
public int GetNativeDataSize() => -1;
|
||||||
|
|
||||||
|
[Preserve]
|
||||||
public static ICustomMarshaler GetInstance(string cookie) => new Utf8StringToNative();
|
public static ICustomMarshaler GetInstance(string cookie) => new Utf8StringToNative();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user