Make SteamNative completely internal

This commit is contained in:
Garry Newman 2016-11-02 21:00:25 +00:00
parent 0b11025afe
commit d5eca996cd
8 changed files with 318 additions and 192 deletions

View File

@ -14,16 +14,6 @@
Called with a message from Steam
</summary>
</member>
<member name="M:Facepunch.Steamworks.BaseSteamworks.AddCallback``2(System.Action{``0},System.Int32)">
<summary>
Global callback type
</summary>
</member>
<member name="M:Facepunch.Steamworks.BaseSteamworks.AddCallResult(Facepunch.Steamworks.Interop.CallResult)">
<summary>
Call results are results to specific actions
</summary>
</member>
<member name="T:Facepunch.Steamworks.Inventory.Item">
<summary>
An item in your inventory.
@ -341,13 +331,62 @@
</summary>
</member>
<member name="M:Facepunch.Steamworks.Config.ForcePlatform(SteamNative.OperatingSystem,SteamNative.Architecture)">
<member name="M:Facepunch.Steamworks.Config.ForcePlatform(Facepunch.Steamworks.OperatingSystem,Facepunch.Steamworks.Architecture)">
<summary>
You can force the platform to a particular one here.
This is useful if you're on OSX because some versions of mono don't have a way
to tell which platform we're running
</summary>
</member>
<member name="T:Facepunch.Steamworks.Workshop">
<summary>
Allows you to interact with Steam's UGC stuff (User Generated Content).
To put simply, this allows you to upload a folder of files to Steam.
To upload a new file use CreateItem. This returns an Editor object.
This object is also used to edit existing items.
To get a list of items you can call CreateQuery. From there you can download
an item and retrieve the folder that it's downloaded to.
Generally there's no need to compress and decompress your uploads, so you should
usually be able to use the content straight from the destination folder.
</summary>
</member>
<member name="E:Facepunch.Steamworks.Workshop.OnFileDownloaded">
<summary>
Called when an item has been downloaded. This could have been
because of a call to Download or because of a subscription triggered
via the browser/app.
</summary>
</member>
<member name="E:Facepunch.Steamworks.Workshop.OnItemInstalled">
<summary>
Called when an item has been installed. This could have been
because of a call to Download or because of a subscription triggered
via the browser/app.
</summary>
</member>
<member name="M:Facepunch.Steamworks.Workshop.Dispose">
<summary>
You should never have to call this manually
</summary>
</member>
<member name="M:Facepunch.Steamworks.Workshop.CreateQuery">
<summary>
Creates a query object, which is used to get a list of items.
This could be a list of the most popular items, or a search,
or just getting a list of the items you've uploaded.
</summary>
</member>
<member name="M:Facepunch.Steamworks.Workshop.CreateItem(Facepunch.Steamworks.Workshop.ItemType)">
<summary>
Create a new Editor object with the intention of creating a new item.
Your item won't actually be created until you call Publish() on the object.
</summary>
</member>
<member name="M:Facepunch.Steamworks.Workshop.EditItem(System.UInt64)">
<summary>
Returns a class representing this ItemId. We don't query
@ -355,6 +394,24 @@
We don't verify that this item belongs to your app.
</summary>
</member>
<member name="M:Facepunch.Steamworks.Workshop.GetItem(System.UInt64)">
<summary>
Gets an Item object for a specific item. This doesn't currently
query the item's name and description. It's only really useful
if you know an item's ID and want to download it, or check its
current download status.
</summary>
</member>
<member name="T:Facepunch.Steamworks.Workshop.Order">
<summary>
How a query should be ordered.
</summary>
</member>
<member name="T:Facepunch.Steamworks.Workshop.QueryType">
<summary>
The type of item you are querying for
</summary>
</member>
<member name="F:Facepunch.Steamworks.Workshop.QueryType.Items">
<summary>
Both MicrotransactionItems and subscriptionItems
@ -370,6 +427,17 @@
normal Workshop item that can be subscribed to
</summary>
</member>
<member name="T:Facepunch.Steamworks.Workshop.ItemType">
<summary>
Used to define the item type when creating
</summary>
</member>
<member name="T:Facepunch.Steamworks.Workshop.UserQueryType">
<summary>
When querying a specific user's items this defines what
type of items you're looking for.
</summary>
</member>
<member name="P:Facepunch.Steamworks.Workshop.Item.Url">
<summary>
Return a URL to view this item online
@ -504,11 +572,6 @@
Steam authetication statuses
</summary>
</member>
<member name="F:Facepunch.Steamworks.ServerAuth.Status.OK">
<summary>
Steam has verified the user is online, the ticket is valid and ticket has not been reused.
</summary>
</member>
<member name="M:Facepunch.Steamworks.ServerAuth.StartSession(System.Byte[],System.UInt64)">
<summary>
Start authorizing a ticket. This user isn't authorized yet. Wait for a call to OnAuthChange.

View File

@ -24,7 +24,7 @@ public static class Config
/// This is useful if you're on OSX because some versions of mono don't have a way
/// to tell which platform we're running
/// </summary>
public static void ForcePlatform( SteamNative.OperatingSystem os, SteamNative.Architecture arch )
public static void ForcePlatform( Facepunch.Steamworks.OperatingSystem os, Facepunch.Steamworks.Architecture arch )
{
SteamNative.Platform.Os = os;
SteamNative.Platform.Arch = arch;

View File

@ -22,6 +22,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DocumentationFile>..\..\..\Work\Rust\Main\Assets\Plugins\Facepunch.Steamworks\Facepunch.Steamworks.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>

View File

@ -4,6 +4,20 @@
namespace Facepunch.Steamworks
{
/// <summary>
/// Allows you to interact with Steam's UGC stuff (User Generated Content).
/// To put simply, this allows you to upload a folder of files to Steam.
///
/// To upload a new file use CreateItem. This returns an Editor object.
/// This object is also used to edit existing items.
///
/// To get a list of items you can call CreateQuery. From there you can download
/// an item and retrieve the folder that it's downloaded to.
///
/// Generally there's no need to compress and decompress your uploads, so you should
/// usually be able to use the content straight from the destination folder.
///
/// </summary>
public partial class Workshop : IDisposable
{
internal const ulong InvalidHandle = 0xffffffffffffffff;
@ -13,7 +27,18 @@ public partial class Workshop : IDisposable
internal BaseSteamworks steamworks;
internal SteamNative.SteamRemoteStorage remoteStorage;
internal event Action<ulong, Callbacks.Result> OnFileDownloaded;
/// <summary>
/// Called when an item has been downloaded. This could have been
/// because of a call to Download or because of a subscription triggered
/// via the browser/app.
/// </summary>
public event Action<ulong, Callbacks.Result> OnFileDownloaded;
/// <summary>
/// Called when an item has been installed. This could have been
/// because of a call to Download or because of a subscription triggered
/// via the browser/app.
/// </summary>
internal event Action<ulong> OnItemInstalled;
internal Workshop( BaseSteamworks steamworks, SteamNative.SteamUGC ugc, SteamNative.SteamRemoteStorage remoteStorage )
@ -29,6 +54,9 @@ internal Workshop( BaseSteamworks steamworks, SteamNative.SteamUGC ugc, SteamNat
// steamworks.AddCallback<ItemInstalled, ItemInstalled.Small>( onItemInstalled, ItemInstalled.CallbackId );
}
/// <summary>
/// You should never have to call this manually
/// </summary>
public void Dispose()
{
ugc = null;
@ -52,6 +80,12 @@ private void onDownloadResult( SteamNative.DownloadItemResult_t obj, bool failed
OnFileDownloaded( obj.PublishedFileId, (Callbacks.Result) obj.Result );
}
/// <summary>
/// Creates a query object, which is used to get a list of items.
///
/// This could be a list of the most popular items, or a search,
/// or just getting a list of the items you've uploaded.
/// </summary>
public Query CreateQuery()
{
return new Query()
@ -62,6 +96,10 @@ public Query CreateQuery()
};
}
/// <summary>
/// Create a new Editor object with the intention of creating a new item.
/// Your item won't actually be created until you call Publish() on the object.
/// </summary>
public Editor CreateItem( ItemType type )
{
return new Editor() { workshop = this, Type = type };
@ -77,11 +115,21 @@ public Editor EditItem( ulong itemId )
return new Editor() { workshop = this, Id = itemId };
}
/// <summary>
/// Gets an Item object for a specific item. This doesn't currently
/// query the item's name and description. It's only really useful
/// if you know an item's ID and want to download it, or check its
/// current download status.
/// </summary>
public Item GetItem( ulong itemid )
{
return new Item( itemid, this );
}
/// <summary>
/// How a query should be ordered.
/// </summary>
public enum Order
{
RankedByVote = 0,
@ -99,6 +147,9 @@ public enum Order
RankedByTotalUniqueSubscriptions = 12,
};
/// <summary>
/// The type of item you are querying for
/// </summary>
public enum QueryType
{
/// <summary>
@ -125,6 +176,9 @@ public enum QueryType
GameManagedItems = 12, // game managed items (not managed by users)
};
/// <summary>
/// Used to define the item type when creating
/// </summary>
public enum ItemType
{
Community = 0, // normal Workshop item that can be subscribed to
@ -145,6 +199,10 @@ public enum ItemType
GameManagedItem = 15, // managed completely by the game, not the user, and not shown on the web
};
/// <summary>
/// When querying a specific user's items this defines what
/// type of items you're looking for.
/// </summary>
public enum UserQueryType : uint
{
Published = 0,

View File

@ -37,7 +37,7 @@ public class VTable
//
// Created on registration of a callback
//
public class CallbackHandle : IDisposable
internal class CallbackHandle : IDisposable
{
internal BaseSteamworks steamworks;
internal SteamAPICall_t CallResultHandle;

View File

@ -1,7 +1,7 @@
using System;
using System.Runtime.InteropServices;
namespace SteamNative
namespace Facepunch.Steamworks
{
public enum OperatingSystem
{
@ -17,34 +17,37 @@ public enum Architecture
x86,
x64
}
}
namespace SteamNative
{
internal static partial class Platform
{
private static OperatingSystem _os;
private static Architecture _arch;
private static Facepunch.Steamworks.OperatingSystem _os;
private static Facepunch.Steamworks.Architecture _arch;
internal static OperatingSystem Os
internal static Facepunch.Steamworks.OperatingSystem Os
{
get
{
//
// Work out our platform
//
if ( _os == OperatingSystem.Unset )
if ( _os == Facepunch.Steamworks.OperatingSystem.Unset )
{
_os = OperatingSystem.Windows;
_os = Facepunch.Steamworks.OperatingSystem.Windows;
//
// These checks aren't so accurate on older versions of mono
//
if ( Environment.OSVersion.Platform == PlatformID.MacOSX ) _os = OperatingSystem.Osx;
if ( Environment.OSVersion.Platform == PlatformID.Unix ) _os = OperatingSystem.Linux;
if ( Environment.OSVersion.Platform == PlatformID.MacOSX ) _os = Facepunch.Steamworks.OperatingSystem.Osx;
if ( Environment.OSVersion.Platform == PlatformID.Unix ) _os = Facepunch.Steamworks.OperatingSystem.Linux;
//
// Edging our bets
//
if ( Environment.OSVersion.VersionString.ToLower().Contains( "unix" ) ) _os = OperatingSystem.Linux;
if ( Environment.OSVersion.VersionString.ToLower().Contains( "osx" ) ) _os = OperatingSystem.Osx;
if ( Environment.OSVersion.VersionString.ToLower().Contains( "unix" ) ) _os = Facepunch.Steamworks.OperatingSystem.Linux;
if ( Environment.OSVersion.VersionString.ToLower().Contains( "osx" ) ) _os = Facepunch.Steamworks.OperatingSystem.Osx;
}
return _os;
@ -56,19 +59,19 @@ internal static OperatingSystem Os
}
}
internal static Architecture Arch
internal static Facepunch.Steamworks.Architecture Arch
{
get
{
//
// Work out whether we're 64bit or 32bit
//
if ( _arch == Architecture.Unset )
if ( _arch == Facepunch.Steamworks.Architecture.Unset )
{
if ( IntPtr.Size == 8 )
_arch = Architecture.x64;
_arch = Facepunch.Steamworks.Architecture.x64;
else if ( IntPtr.Size == 4 )
_arch = Architecture.x86;
_arch = Facepunch.Steamworks.Architecture.x86;
else
throw new System.Exception( "Unsupported Architecture!" );
}
@ -82,16 +85,17 @@ internal static Architecture Arch
}
}
public static bool IsWindows64 { get { return Arch == Architecture.x64 && Os == OperatingSystem.Windows; } }
public static bool IsWindows32 { get { return Arch == Architecture.x86 && Os == OperatingSystem.Windows; } }
public static bool IsLinux64 { get { return Arch == Architecture.x64 && Os == OperatingSystem.Linux; } }
public static bool IsLinux32 { get { return Arch == Architecture.x86 && Os == OperatingSystem.Linux; } }
public static bool IsOsx { get { return Os == OperatingSystem.Osx; } }
public static bool IsWindows { get { return Os == Facepunch.Steamworks.OperatingSystem.Windows; } }
public static bool IsWindows64 { get { return Arch == Facepunch.Steamworks.Architecture.x64 && IsWindows; } }
public static bool IsWindows32 { get { return Arch == Facepunch.Steamworks.Architecture.x86 && IsWindows; } }
public static bool IsLinux64 { get { return Arch == Facepunch.Steamworks.Architecture.x64 && Os == Facepunch.Steamworks.OperatingSystem.Linux; } }
public static bool IsLinux32 { get { return Arch == Facepunch.Steamworks.Architecture.x86 && Os == Facepunch.Steamworks.OperatingSystem.Linux; } }
public static bool IsOsx { get { return Os == Facepunch.Steamworks.OperatingSystem.Osx; } }
/// <summary>
/// We're only Pack = 8 on Windows
/// </summary>
public static bool PackSmall { get { return Os != OperatingSystem.Windows; } }
public static bool PackSmall { get { return Os != Facepunch.Steamworks.OperatingSystem.Windows; } }
}
}

File diff suppressed because it is too large Load Diff

View File

@ -301,7 +301,7 @@ private void CallbackCallresultShared( SteamApiDefinition.StructDef c, bool Resu
WriteLine( "//" );
WriteLine( "// The order of these functions are swapped on Windows" );
WriteLine( "//" );
StartBlock( "if ( Platform.Os == OperatingSystem.Windows )" );
StartBlock( "if ( Platform.IsWindows )" );
{
WriteLine( "vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB );" );
WriteLine( "vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA );" );