(f0d812055) v0.9.9.0
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="4.6.7" />
|
||||
<PackageReference Include="NLog" Version="4.7.0" />
|
||||
<PackageReference Include="System.Data.SQLite" Version="1.0.111" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -10,6 +10,22 @@
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<NoWarn>1701;1702;3021</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<NoWarn>1701;1702;3021</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<NoWarn>1701;1702;3021</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<NoWarn>1701;1702;3021</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Lidgren.Network
|
||||
MethodInfo[] methods = typeof(NetIncomingMessage).GetMethods(BindingFlags.Instance | BindingFlags.Public);
|
||||
foreach (MethodInfo mi in methods)
|
||||
{
|
||||
if (mi.GetParameters().Length == 0 && mi.Name.StartsWith("Read", StringComparison.InvariantCulture) && mi.Name.Substring(4) == mi.ReturnType.Name)
|
||||
if (mi.GetParameters().Length == 0 && mi.Name.StartsWith("Read", StringComparison.OrdinalIgnoreCase) && mi.Name.Substring(4) == mi.ReturnType.Name)
|
||||
{
|
||||
s_readMethods[mi.ReturnType] = mi;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ namespace Lidgren.Network
|
||||
methods = typeof(NetOutgoingMessage).GetMethods(BindingFlags.Instance | BindingFlags.Public);
|
||||
foreach (MethodInfo mi in methods)
|
||||
{
|
||||
if (mi.Name.Equals("Write", StringComparison.InvariantCulture))
|
||||
if (mi.Name.Equals("Write", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
ParameterInfo[] pis = mi.GetParameters();
|
||||
if (pis.Length == 1)
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace Lidgren.Network
|
||||
m_socket.ReceiveBufferSize = m_configuration.ReceiveBufferSize;
|
||||
m_socket.SendBufferSize = m_configuration.SendBufferSize;
|
||||
m_socket.Blocking = false;
|
||||
m_socket.DualMode = true;
|
||||
m_socket.DualMode = m_configuration.UseDualModeSockets;
|
||||
|
||||
var ep = (EndPoint)new NetEndPoint(m_configuration.LocalAddress.MapToIPv6(), reBind ? m_listenPort : m_configuration.Port);
|
||||
m_socket.Bind(ep);
|
||||
|
||||
@@ -142,6 +142,12 @@ namespace Lidgren.Network
|
||||
get { return m_appIdentifier; }
|
||||
}
|
||||
|
||||
public bool UseDualModeSockets
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = true;
|
||||
|
||||
/// <summary>
|
||||
/// Enables receiving of the specified type of message
|
||||
/// </summary>
|
||||
|
||||
@@ -401,7 +401,7 @@ namespace Lidgren.Network
|
||||
{
|
||||
if (j >= h)
|
||||
{
|
||||
if (string.Compare(list[j - h].Name, tmp.Name, StringComparison.InvariantCulture) > 0)
|
||||
if (string.Compare(list[j - h].Name, tmp.Name, StringComparison.OrdinalIgnoreCase) > 0)
|
||||
{
|
||||
list[j] = list[j - h];
|
||||
j -= h;
|
||||
|
||||
@@ -238,6 +238,44 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
}
|
||||
}
|
||||
|
||||
public void Draw(Texture2D texture, VertexPositionColorTexture[] vertices, float layerDepth)
|
||||
{
|
||||
CheckValid(texture);
|
||||
|
||||
float sortKey = 0f;
|
||||
|
||||
// set SortKey based on SpriteSortMode.
|
||||
switch (_sortMode)
|
||||
{
|
||||
// Comparison of Texture objects.
|
||||
case SpriteSortMode.Texture:
|
||||
sortKey = texture.SortingKey;
|
||||
break;
|
||||
// Comparison of Depth
|
||||
case SpriteSortMode.FrontToBack:
|
||||
sortKey = layerDepth;
|
||||
break;
|
||||
// Comparison of Depth in reverse
|
||||
case SpriteSortMode.BackToFront:
|
||||
sortKey = -layerDepth;
|
||||
break;
|
||||
}
|
||||
|
||||
int iters = vertices.Length / 4;
|
||||
for (int i=0;i<iters;i++)
|
||||
{
|
||||
var item = _batcher.CreateBatchItem();
|
||||
item.Texture = texture;
|
||||
|
||||
item.SortKey = sortKey;
|
||||
|
||||
item.vertexTL = vertices[(i * 4) + 0];
|
||||
item.vertexTR = vertices[(i * 4) + 1];
|
||||
item.vertexBL = vertices[(i * 4) + 2];
|
||||
item.vertexBR = vertices[(i * 4) + 3];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Submit a sprite for drawing in the current batch.
|
||||
/// </summary>
|
||||
@@ -1220,6 +1258,7 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
}
|
||||
}
|
||||
}
|
||||
_batcher.Dispose();
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
vertexBL = new VertexPositionColorTexture();
|
||||
vertexBR = new VertexPositionColorTexture();
|
||||
}
|
||||
|
||||
|
||||
public void Set ( float x, float y, float dx, float dy, float w, float h, float sin, float cos, Color color, Vector2 texCoordTL, Vector2 texCoordBR, float depth )
|
||||
{
|
||||
// TODO, Should we be just assigning the Depth Value to Z?
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
/// batched and will process them into short.MaxValue groups (strided by 6 for the number of vertices
|
||||
/// sent to the GPU).
|
||||
/// </summary>
|
||||
internal class SpriteBatcher
|
||||
internal class SpriteBatcher : IDisposable
|
||||
{
|
||||
/*
|
||||
* Note that this class is fundamental to high performance for SpriteBatch games. Please exercise
|
||||
@@ -54,6 +54,9 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
|
||||
private VertexPositionColorTexture[] _vertexArray;
|
||||
|
||||
private VertexBuffer vertexBuffer;
|
||||
private IndexBuffer indexBuffer;
|
||||
|
||||
public SpriteBatcher (GraphicsDevice device)
|
||||
{
|
||||
_device = device;
|
||||
@@ -136,6 +139,12 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
_index = newIndex;
|
||||
|
||||
_vertexArray = new VertexPositionColorTexture[4 * numBatchItems];
|
||||
|
||||
indexBuffer?.Dispose();
|
||||
vertexBuffer?.Dispose();
|
||||
indexBuffer = new IndexBuffer(_device, IndexElementSize.SixteenBits, _index.Length, BufferUsage.WriteOnly);
|
||||
indexBuffer.SetData(_index);
|
||||
vertexBuffer = new VertexBuffer(_device, VertexPositionColorTexture.VertexDeclaration, _vertexArray.Length, BufferUsage.WriteOnly);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -225,7 +234,8 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
}
|
||||
// return items to the pool.
|
||||
_batchItemCount = 0;
|
||||
}
|
||||
_device.Textures[0] = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends the triangle list to the graphics device. Here is where the actual drawing starts.
|
||||
@@ -241,6 +251,7 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
|
||||
var vertexCount = end - start;
|
||||
|
||||
_device.Indices = indexBuffer;
|
||||
// If the effect is not null, then apply each pass and render the geometry
|
||||
if (effect != null)
|
||||
{
|
||||
@@ -252,31 +263,26 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
// Whatever happens in pass.Apply, make sure the texture being drawn
|
||||
// ends up in Textures[0].
|
||||
_device.Textures[0] = texture;
|
||||
|
||||
_device.DrawUserIndexedPrimitives(
|
||||
PrimitiveType.TriangleList,
|
||||
_vertexArray,
|
||||
0,
|
||||
vertexCount,
|
||||
_index,
|
||||
0,
|
||||
(vertexCount / 4) * 2,
|
||||
VertexPositionColorTexture.VertexDeclaration);
|
||||
vertexBuffer.SetData(_vertexArray, start, vertexCount);
|
||||
_device.SetVertexBuffer(vertexBuffer);
|
||||
_device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, (vertexCount / 4) * 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If no custom effect is defined, then simply render.
|
||||
_device.DrawUserIndexedPrimitives(
|
||||
PrimitiveType.TriangleList,
|
||||
_vertexArray,
|
||||
0,
|
||||
vertexCount,
|
||||
_index,
|
||||
0,
|
||||
(vertexCount / 4) * 2,
|
||||
VertexPositionColorTexture.VertexDeclaration);
|
||||
vertexBuffer.SetData(_vertexArray, start, vertexCount);
|
||||
_device.SetVertexBuffer(vertexBuffer);
|
||||
_device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, (vertexCount / 4) * 2);
|
||||
}
|
||||
|
||||
_device.Indices = null;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
indexBuffer?.Dispose();
|
||||
vertexBuffer?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,10 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
lock (d3dContext)
|
||||
{
|
||||
d3dContext.UpdateSubresource(GetTexture(), subresourceIndex, region, dataPtr, GetPitch(w), 0);
|
||||
d3dContext.GenerateMips(GetShaderResourceView());
|
||||
if (_mipmap)
|
||||
{
|
||||
d3dContext.GenerateMips(GetShaderResourceView());
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
||||
+4
-5
@@ -500,19 +500,18 @@
|
||||
<EmbeddedResource Include="Graphics\Effect\Resources\SpriteEffect.dx11.mgfxo" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SharpDX" Version="4.2.0" />
|
||||
<PackageReference Include="SharpDX.Direct2D1" Version="4.2.0" />
|
||||
<PackageReference Include="SharpDX.Direct3D11" Version="4.2.0" />
|
||||
<PackageReference Include="SharpDX.DXGI" Version="4.2.0" />
|
||||
<PackageReference Include="SharpDX.MediaFoundation" Version="4.2.0" />
|
||||
<PackageReference Include="SharpDX.XInput" Version="4.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\XNATypes\XNATypes.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"profiles": {
|
||||
"MonoGame.Framework.Windows.NetStandard": {
|
||||
"commandName": "Project",
|
||||
"nativeDebugging": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<DefineConstants>TRACE;DEBUG;SHARPFONT_PORTABLE</DefineConstants>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<NoWarn>1701;1702;3021</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
@@ -30,6 +31,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<DefineConstants>TRACE;SHARPFONT_PORTABLE</DefineConstants>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<NoWarn>1701;1702;3021</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user