(f0d812055) v0.9.9.0

This commit is contained in:
Joonas Rikkonen
2020-04-23 19:19:37 +03:00
parent b647059b93
commit ac37a3b0e4
391 changed files with 15054 additions and 5420 deletions
@@ -1,6 +1,6 @@
namespace Steamworks.Data
{
enum DebugOutputType : int
public enum DebugOutputType : int
{
None = 0,
Bug = 1, // You used the API incorrectly, or an internal error happened
@@ -31,6 +31,22 @@
<RepositoryType>git</RepositoryType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard2.1|x64'">
<NoWarn>1701;1702;1591;1587</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.1|x64'">
<NoWarn>1701;1702;1591;1587</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard2.1|AnyCPU'">
<NoWarn>1701;1702;1591;1587</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.1|AnyCPU'">
<NoWarn>1701;1702;1591;1587</NoWarn>
</PropertyGroup>
<Import Project="Facepunch.Steamworks.targets" />
</Project>
@@ -204,11 +204,11 @@ namespace Steamworks
#region FunctionMeta
[UnmanagedFunctionPointer( Platform.MemberConvention )]
private delegate void FSetDebugOutputFunction( IntPtr self, DebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc );
private delegate void FSetDebugOutputFunction( IntPtr self, DebugOutputType eDetailLevel, IntPtr pfnFunc );
private FSetDebugOutputFunction _SetDebugOutputFunction;
#endregion
internal void SetDebugOutputFunction( DebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc )
internal void SetDebugOutputFunction( DebugOutputType eDetailLevel, IntPtr pfnFunc )
{
_SetDebugOutputFunction( Self, eDetailLevel, pfnFunc );
}
@@ -81,6 +81,11 @@ namespace Steamworks
public static long LocalTimestamp => Internal.GetLocalTimestamp();
public static void SetDebugOutputFunction(DebugOutputType eDetailLevel, IntPtr pfnFunc)
{
Internal.SetDebugOutputFunction(eDetailLevel, pfnFunc);
}
/// <summary>
/// [0 - 100] - Randomly discard N pct of packets
@@ -39,6 +39,7 @@ namespace Steamworks
ItemInstalled_t.Install(x => {
if (x.AppID == SteamClient.AppId)
{
GlobalOnItemInstalled?.Invoke(x.PublishedFileId);
if (onItemInstalled?.ContainsKey(x.PublishedFileId) ?? false)
{
onItemInstalled[x.PublishedFileId]?.Invoke();
@@ -92,5 +93,9 @@ namespace Steamworks
}
private static Dictionary<PublishedFileId, Action> onItemInstalled;
public static event Action<ulong> GlobalOnItemInstalled;
public static uint NumSubscribedItems { get { return Internal.GetNumSubscribedItems(); } }
}
}
@@ -5,7 +5,8 @@ using System.Text;
namespace Steamworks.Data
{
delegate void FSteamNetworkingSocketsDebugOutput (DebugOutputType nType, string pszMsg );
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void FSteamNetworkingSocketsDebugOutput (DebugOutputType nType, string pszMsg );
public struct SteamNetworkingPOPID
{
@@ -9,31 +9,36 @@ namespace Steamworks
{
public const int MaxStringSize = 1024 * 32;
private static object mutex = new object();
private static IntPtr[] MemoryPool;
private static int MemoryPoolIndex;
public static unsafe IntPtr TakeMemory()
{
if ( MemoryPool == null )
IntPtr take = IntPtr.Zero;
lock (mutex)
{
//
// The pool has 5 items. This should be safe because we shouldn't really
// ever be using more than 2 memory pools
//
MemoryPool = new IntPtr[5];
if (MemoryPool == null)
{
//
// The pool has 5 items. This should be safe because we shouldn't really
// ever be using more than 2 memory pools
//
MemoryPool = new IntPtr[5];
for ( int i = 0; i < MemoryPool.Length; i++ )
MemoryPool[i] = Marshal.AllocHGlobal( MaxStringSize );
for (int i = 0; i < MemoryPool.Length; i++)
MemoryPool[i] = Marshal.AllocHGlobal(MaxStringSize);
}
MemoryPoolIndex++;
if (MemoryPoolIndex >= MemoryPool.Length)
MemoryPoolIndex = 0;
take = MemoryPool[MemoryPoolIndex];
((byte*)take)[0] = 0;
}
MemoryPoolIndex++;
if ( MemoryPoolIndex >= MemoryPool.Length )
MemoryPoolIndex = 0;
var take = MemoryPool[MemoryPoolIndex];
((byte*)take)[0] = 0;
return take;
}