Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 1.52 #3

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/Standalone/bin
/Standalone/obj
/Standalone/.vs
/.vs
bin/
obj/
.vs/
__pycache__/
/CodeGen/steam/lib/
4 changes: 0 additions & 4 deletions CodeGen/.gitignore

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Steamworks {
[System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.Cdecl)]
public delegate void SteamInputActionEventCallbackPointer(IntPtr /* SteamInputActionEvent_t* */ SteamInputActionEvent);
}

#endif // !DISABLESTEAMWORKS
49 changes: 49 additions & 0 deletions CodeGen/CustomTypes/SteamInput/SteamInputActionEvent_t.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
namespace Steamworks
{
//-----------------------------------------------------------------------------
// Purpose: when callbacks are enabled this fires each time a controller action
// state changes
//-----------------------------------------------------------------------------
[System.Serializable]
[StructLayout(LayoutKind.Sequential)]
public struct SteamInputActionEvent_t
{
public InputHandle_t controllerHandle;

public ESteamInputActionEventType eEventType;

/// Option value
public OptionValue m_val;

[System.Serializable]
[StructLayout(LayoutKind.Sequential)]
public struct SteamInputAnalogActionEvent_t
{
public InputAnalogActionHandle_t actionHandle;

public InputAnalogActionData_t analogActionData;
}

[System.Serializable]
[StructLayout(LayoutKind.Sequential)]
public struct SteamInputDigitalActionEvent_t
{
public InputDigitalActionHandle_t actionHandle;

public InputDigitalActionData_t digitalActionData;
}

[System.Serializable]
[StructLayout(LayoutKind.Explicit)]
public struct OptionValue
{
[FieldOffset(0)]
public SteamInputAnalogActionEvent_t analogAction;

[FieldOffset(0)]
public SteamInputDigitalActionEvent_t digitalAction;
}
}
}

#endif // !DISABLESTEAMWORKS
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public bool IsLocalHost() {
/// See also SteamNetworkingIdentityRender
public void ToString(out string buf, bool bWithPort) {
IntPtr buf2 = Marshal.AllocHGlobal(k_cchMaxString);
NativeMethods.SteamNetworkingIPAddr_ToString(ref this, buf2, k_cchMaxString, bWithPort);
NativeMethods.SteamAPI_SteamNetworkingIPAddr_ToString(ref this, buf2, k_cchMaxString, bWithPort);
buf = InteropHelp.PtrToStringUTF8(buf2);
Marshal.FreeHGlobal(buf2);
}
Expand All @@ -73,7 +73,7 @@ public void ToString(out string buf, bool bWithPort) {
/// (This means that you cannot tell if a zero port was explicitly specified.)
public bool ParseString(string pszStr) {
using (var pszStr2 = new InteropHelp.UTF8StringHandle(pszStr)) {
return NativeMethods.SteamNetworkingIPAddr_ParseString(ref this, pszStr2);
return NativeMethods.SteamAPI_SteamNetworkingIPAddr_ParseString(ref this, pszStr2);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public bool Equals(SteamNetworkingIdentity x) {
/// See also SteamNetworkingIPAddrRender
public void ToString(out string buf) {
IntPtr buf2 = Marshal.AllocHGlobal(k_cchMaxString);
NativeMethods.SteamNetworkingIdentity_ToString(ref this, buf2, k_cchMaxString);
NativeMethods.SteamAPI_SteamNetworkingIdentity_ToString(ref this, buf2, k_cchMaxString);
buf = InteropHelp.PtrToStringUTF8(buf2);
Marshal.FreeHGlobal(buf2);
}
Expand All @@ -131,7 +131,7 @@ public void ToString(out string buf) {
/// looks invalid.
public bool ParseString(string pszStr) {
using (var pszStr2 = new InteropHelp.UTF8StringHandle(pszStr)) {
return NativeMethods.SteamNetworkingIdentity_ParseString(ref this, pszStr2);
return NativeMethods.SteamAPI_SteamNetworkingIdentity_ParseString(ref this, pszStr2);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public struct SteamNetworkingMessage_t
/// usually be something like:
///
/// free( pMsg->m_pData );
internal IntPtr m_pfnFreeData;
public IntPtr m_pfnFreeData;

/// Function to used to decrement the internal reference count and, if
/// it's zero, release the message. You should not set this function pointer,
Expand All @@ -79,7 +79,20 @@ public struct SteamNetworkingMessage_t
/// You MUST call this when you're done with the object,
/// to free up memory, etc.
public void Release() {
NativeMethods.SteamAPI_SteamNetworkingMessage_t_Release(m_pfnRelease);
throw new System.NotImplementedException("Please use the static Release function instead which takes an IntPtr.");
}

/// You MUST call this when you're done with the object,
/// to free up memory, etc.
/// This is a Steamworks.NET extension.
public static void Release(IntPtr pointer) {
NativeMethods.SteamAPI_SteamNetworkingMessage_t_Release(pointer);
}

/// Convert an IntPtr received from ISteamNetworkingSockets.ReceiveMessagesOnPollGroup into our structure.
/// This is a Steamworks.NET extension.
public static SteamNetworkingMessage_t FromIntPtr(IntPtr pointer) {
return (SteamNetworkingMessage_t)Marshal.PtrToStructure(pointer, typeof(SteamNetworkingMessage_t));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion CodeGen/SteamworksParser
21 changes: 5 additions & 16 deletions CodeGen/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def __init__(self, name, value, type_, precomments, comment, spacing):
g_TypeDict = {
# Not a bug... But, it's a giant hack.
# The issue is that most of these are used as the MarshalAs SizeConst in C# amongst other things and C# wont auto convert them.
"uint16": "ushort",

"uint32": "int",
"unsigned int": "int",

Expand Down Expand Up @@ -48,7 +50,6 @@ def __init__(self, name, value, type_, precomments, comment, spacing):
"k_steamIDLanModeGS",
"k_steamIDNotInitYetGS",
"k_steamIDNonSteamGS",
"BREAKPAD_INVALID_HANDLE",
"STEAM_PS3_PATH_MAX",
"STEAM_PS3_SERVICE_ID_MAX",
"STEAM_PS3_COMMUNICATION_ID_MAX",
Expand Down Expand Up @@ -101,35 +102,24 @@ def __init__(self, name, value, type_, precomments, comment, spacing):
"k_HAuthTicketInvalid",

# SteamTypes
"k_JobIDNil",
"k_uBundleIdInvalid",
"k_uAppIdInvalid",
"k_uDepotIdInvalid",
"k_uAPICallInvalid",
"k_uManifestIdInvalid",
"k_ulSiteIdInvalid",

# steamnetworkingtypes.h
"k_HSteamNetConnection_Invalid",
"k_HSteamListenSocket_Invalid",
"k_HSteamNetPollGroup_Invalid",
"k_SteamDatagramPOPID_dev",

#TODO: Skip all these once we have typedef autogen hooked up.
#public const ulong k_GIDNil = 0xffffffffffffffffull;
#public const ulong k_TxnIDNil = k_GIDNil;
#public const ulong k_TxnIDUnknown = 0;
#public const int k_uPackageIdFreeSub = 0x0;
#public const int k_uPackageIdInvalid = 0xFFFFFFFF;
#public const ulong k_ulAssetClassIdInvalid = 0x0;
#public const int k_uPhysicalItemIdInvalid = 0x0;
#public const int k_uCellIDInvalid = 0xFFFFFFFF;
#public const int k_uPartnerIdInvalid = 0;
# steam_gameserver.h
"MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE",
)

g_SkippedTypedefs = (
"uint8",
"int8",
"uint16",
"int32",
"uint32",
"int64",
Expand All @@ -138,7 +128,6 @@ def __init__(self, name, value, type_, precomments, comment, spacing):

g_CustomDefines = {
# "Name": ("Type", "Value"),
"MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE": ("ushort", "0xFFFF"),
"k_nMaxLobbyKeyLength": ("byte", None),
"STEAM_CONTROLLER_HANDLE_ALL_CONTROLLERS": ("ulong", "0xFFFFFFFFFFFFFFFF"),
"STEAM_CONTROLLER_MIN_ANALOG_ACTION_DATA": ("float", "-1.0f"),
Expand Down
7 changes: 3 additions & 4 deletions CodeGen/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
"EItemState",

# SteamClientPublic
"EAppOwnershipFlags",
"EAppType",
"EChatSteamIDInstanceFlags",
"EMarketingMessageFlags",
"EMarketNotAllowedReasonFlags",
)

Expand All @@ -37,7 +34,6 @@
# Valve redefined these twice, and ifdef decided which one to use. :(
# We use the newer ones from isteaminput.h and skip the ones in
# isteamcontroller.h because it is deprecated.
"ESteamControllerPad": "isteamcontroller.h",
"EXboxOrigin": "isteamcontroller.h",
"ESteamInputType": "isteamcontroller.h",
}
Expand All @@ -46,6 +42,9 @@
"0xffffffff": "-1",
"0x80000000": "-2147483647",
"k_unSteamAccountInstanceMask": "Constants.k_unSteamAccountInstanceMask",
"( 1 << k_ESteamControllerPad_Left )": "( 1 << ESteamControllerPad.k_ESteamControllerPad_Left )",
"( 1 << k_ESteamControllerPad_Right )": "( 1 << ESteamControllerPad.k_ESteamControllerPad_Right )",
"( 1 << k_ESteamControllerPad_Left | 1 << k_ESteamControllerPad_Right )": "( 1 << ESteamControllerPad.k_ESteamControllerPad_Left | 1 << ESteamControllerPad.k_ESteamControllerPad_Right )",
}

def main(parser):
Expand Down
18 changes: 13 additions & 5 deletions CodeGen/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
"SteamNetworkingErrMsg &": "out SteamNetworkingErrMsg",
"const SteamNetConnectionInfo_t &": "ref SteamNetConnectionInfo_t",
"SteamNetworkingMessage_t **": "IntPtr[]",

# SteamNetworkingTypes which are stubbed
"SteamDatagramGameCoordinatorServerLogin *": "IntPtr",

}

g_WrapperArgsTypeDict = {
Expand Down Expand Up @@ -142,7 +146,7 @@
"ISteamApps_GetInstalledDepots": {
"pvecDepots": "DepotId_t[]",
},
"ISteamGameServer_SendUserConnectAndAuthenticate": {
"ISteamGameServer_SendUserConnectAndAuthenticate_DEPRECATED": {
"pvAuthBlob": "byte[]",
},
"ISteamGameServer_GetAuthSessionTicket": {
Expand Down Expand Up @@ -238,7 +242,7 @@
"ISteamUGC_StopPlaytimeTracking": {
"pvecPublishedFileID": "PublishedFileId_t[]",
},
"ISteamUser_InitiateGameConnection": {
"ISteamUser_InitiateGameConnection_DEPRECATED": {
"pAuthBlob": "byte[]",
},
"ISteamUser_GetAvailableVoice": {
Expand Down Expand Up @@ -276,9 +280,6 @@
},

# GameServer Copies
"ISteamGameServerApps_GetInstalledDepots": {
"pvecDepots": "DepotId_t[]",
},
"ISteamGameServerHTTP_GetHTTPResponseHeaderValue": {
"pHeaderValueBuffer": "byte[]",
},
Expand Down Expand Up @@ -409,6 +410,13 @@
"cbBuf": "uint",
},

"ISteamNetworkingUtils_GetConfigValue": {
"cbResult": "ref ulong",
},
"ISteamGameServerNetworkingUtils_GetConfigValue": {
"cbResult": "ref ulong",
},

"ISteamNetworkingSockets_SendMessages": {
"pMessages": "SteamNetworkingMessage_t[]",
"pOutMessageNumberOrResult": "long[]",
Expand Down
Loading