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 steamworks.net sdk #6

Draft
wants to merge 47 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
5375850
Don't copy Steamworks.NET.txt on OSX - Fixes #397
rlabrecque May 29, 2021
9416761
Run dos2unix on CodeGen/steam for consistency
rlabrecque May 30, 2021
1f60545
SteamNetworkingMessage_t: Implement a Release function which takes an…
rlabrecque Jun 5, 2021
353de9d
SteamNetworkingMessage_t: Convert p_pfnFreeData from internal to public
rlabrecque Jun 5, 2021
42aebda
Merge pull request #425 from rlabrecque/steamnetworkingmessage-release
rlabrecque Jun 6, 2021
b4dbd7f
Update .gitignore
rlabrecque May 30, 2021
956d303
Fixup entrypoints for some SteamNetworkingSockets functions (Fixes #430)
rlabrecque Jul 12, 2021
8446a22
Add if statement to SteamParamStringArray deconstructor
theace0296 Aug 18, 2021
248c663
Merge pull request #440 from theace0296/TheAce0296/SteamParamStringAr…
rlabrecque Aug 19, 2021
9ab9230
Fix ISteamNetworkingUtils_GetConfigValue parameter from out -> ref (#…
rlabrecque Aug 31, 2021
e8db6e2
Merge pull request #443 from rlabrecque/fix-get-config-value
rlabrecque Sep 12, 2021
83b0d36
Update to Steamworks SDK 1.52
rlabrecque Oct 8, 2021
f5c8f33
Merge pull request #452 from rlabrecque/v1.52
rlabrecque Oct 10, 2021
ff36f26
Cleaned metadata
JamesMcGhee Oct 10, 2021
ea7d0bb
Merge pull request #455 from JamesMcGhee/Heathen-Steamworks.NET
rlabrecque Oct 10, 2021
ec8e556
Update Copyright
rlabrecque Nov 7, 2021
96da919
CodeGen: Generate directly into com.rlabrecque.steamworks.net/Runtime
rlabrecque Nov 7, 2021
fec45d6
CodeGen: Remove output_dummy_files.py
rlabrecque Nov 7, 2021
ef90d16
CodeGen: Clean up the directory and README a bit
rlabrecque Nov 7, 2021
8dc3a97
CodeGen: Move CustomTypes to templates/custom_types
rlabrecque Nov 7, 2021
4dafa26
Bump version to 20.0.0
rlabrecque Nov 8, 2021
deb9eb3
Remove unused SteamUnifiedMessages.meta (Fixes #464)
rlabrecque Dec 12, 2021
0461aa7
CodeGen: Remove extra "import sys"
rlabrecque Dec 12, 2021
27b1a15
Update to Steamworks SDK 1.53
rlabrecque Dec 23, 2021
6cbf1c2
Remove old Steam dlls in the root of the project
rlabrecque Jan 24, 2022
21f8427
Added a nuspec for all-in-one package
Akarinnnnn Jan 25, 2022
5c57195
Merge pull request #481 from Akarinnnnn/nuget2
rlabrecque Jan 26, 2022
81acd1c
Remove old Unity Package Manager instructions from the README
rlabrecque Feb 6, 2022
a265d4e
Merge pull request #479 from rlabrecque/clear-old-dlls
rlabrecque Feb 6, 2022
8569c8f
Added STEAMWORKS_NET define
JamesMcGhee Nov 19, 2021
69a81da
Merge pull request #484 from rlabrecque/add-steamworks-define
rlabrecque Feb 6, 2022
3e77be7
Bump copyright to 2022
rlabrecque Feb 6, 2022
53d1718
Bump Unity Package version to 20.1.0
rlabrecque Feb 6, 2022
4d3e125
Update Standalone\Steamworks.NET.csproj to automatically grab all fil…
rlabrecque Feb 15, 2022
de22589
Add UNITY_EDITOR_LINUX check in Packsize
tilderain May 11, 2022
cea16ef
Merge pull request #508 from tilderain/master
rlabrecque May 11, 2022
8e5c46a
Update to Steamworks SDK 1.54
rlabrecque Oct 30, 2022
6c169a9
Update to Steamworks SDK 1.55
rlabrecque Nov 21, 2022
0936aa8
Updated headers and binaries from SteamSDK 1.57
TwoPoint-AndyChappell May 16, 2023
a71a187
Mark EControllerHapticLocation as a flag
TwoPoint-AndyChappell May 16, 2023
00e98bc
Updated autogenerated source for SDK to 1.57
TwoPoint-AndyChappell May 16, 2023
1181f35
Updated version information and filesizes including Mac OS bundle ver…
TwoPoint-AndyChappell May 16, 2023
1213998
Updated SteamworksParser to version which can parse 1.57 headers
TwoPoint-AndyChappell May 18, 2023
1fd501e
Merge pull request #553 from TwoPoint-AndyChappell/1.57
rlabrecque May 19, 2023
49ff8f9
Update Version in README to 1.57
rlabrecque Jun 3, 2023
a3fe809
Bump version to 20.2.0
rlabrecque Jun 3, 2023
5e21d76
Merge remote-tracking branch 'original/master'
FabioStatespace Jul 25, 2023
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.

2 changes: 1 addition & 1 deletion CodeGen/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2013-2019 Riley Labrecque
Copyright (c) 2013-2022 Riley Labrecque

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
15 changes: 12 additions & 3 deletions CodeGen/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
Steamworks.NET
=======
Steamworks.NET CodeGen
======================

The special sauce that generates the autogen/ folder of [Steamworks.NET](https://github.com/rlabrecque/Steamworks.NET)
This is special sauce that generates the autogen/ and types/ directories.

It uses [SteamworksParser](https://github.com/rlabrecque/SteamworksParser) to parse the Steamworks C++ header files, then converts them to C#.

Usage
-----

1. If necessary update the files in `steam/`
2. Open a command prompt to the CodeGen directory. (The script must be run from this directory or the relative paths will be broken.)
3. Run `python3 Steamworks.NET_CodeGen.py`, preferably on a linux based OS to generate proper line endings. (I use WSL for this.)
24 changes: 7 additions & 17 deletions CodeGen/Steamworks.NET_CodeGen.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,21 @@
import sys
from SteamworksParser import steamworksparser
import interfaces
import constants
import enums
import structs
import typedefs
import output_dummy_files
from src import interfaces
from src import constants
from src import enums
from src import structs
from src import typedefs

def main():
if len(sys.argv) == 2:
path = sys.argv[1]
elif len(sys.argv) == 1:
path = "steam"
else:
print("Usage: Steamworks.NET_CodeGen.py [path/to/sdk/public/steam]")
print(" If a path is not included then a steam/ folder must exist within the cwd.")
return
steam_path = "steam/"

steamworksparser.Settings.fake_gameserver_interfaces = True
___parser = steamworksparser.parse(path)
___parser = steamworksparser.parse(steam_path)

interfaces.main(___parser)
constants.main(___parser)
enums.main(___parser)
structs.main(___parser)
typedefs.main(___parser)
output_dummy_files.main()

if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion CodeGen/SteamworksParser
29 changes: 0 additions & 29 deletions CodeGen/output_dummy_files.py

This file was deleted.

Empty file added CodeGen/src/__init__.py
Empty file.
25 changes: 7 additions & 18 deletions CodeGen/constants.py → CodeGen/src/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 All @@ -150,7 +139,7 @@ def __init__(self, name, value, type_, precomments, comment, spacing):

def main(parser):
try:
os.makedirs("autogen/")
os.makedirs("../com.rlabrecque.steamworks.net/Runtime/autogen/")
except OSError:
pass

Expand All @@ -161,7 +150,7 @@ def main(parser):
lines.append("//" + precomment)
lines.append("public const " + constant.type + " " + constant.name + constant.spacing + "= " + constant.value + ";" + constant.comment)

with open("autogen/SteamConstants.cs", "wb") as out:
with open("../com.rlabrecque.steamworks.net/Runtime/autogen/SteamConstants.cs", "wb") as out:
with open("templates/header.txt", "r") as f:
out.write(bytes(f.read(), "utf-8"))
out.write(bytes("namespace Steamworks {\n", "utf-8"))
Expand Down
14 changes: 8 additions & 6 deletions CodeGen/enums.py → CodeGen/src/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#ISteamHTMLSurface
"EHTMLKeyModifiers",

#ISteamInput
"EControllerHapticLocation",

#ISteamInventory
"ESteamItemFlags",

Expand All @@ -23,10 +26,7 @@
"EItemState",

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

Expand All @@ -37,7 +37,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,11 +45,14 @@
"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):
try:
os.makedirs("autogen/")
os.makedirs("../com.rlabrecque.steamworks.net/Runtime/autogen/")
except OSError:
pass

Expand Down Expand Up @@ -106,7 +108,7 @@ def main(parser):
lines.append("\t}")
lines.append("")

with open("autogen/SteamEnums.cs", "wb") as out:
with open("../com.rlabrecque.steamworks.net/Runtime/autogen/SteamEnums.cs", "wb") as out:
with open("templates/header.txt", "r") as f:
out.write(bytes(f.read(), "utf-8"))
out.write(bytes("using Flags = System.FlagsAttribute;\n\n", "utf-8"))
Expand Down
39 changes: 30 additions & 9 deletions CodeGen/interfaces.py → CodeGen/src/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"ISteamGameServerNetworkingConnectionCustomSignaling",
"ISteamNetworkingCustomSignalingRecvContext",
"ISteamGameServerNetworkingCustomSignalingRecvContext",
"ISteamNetworkingFakeUDPPort",
)

g_TypeDict = {
Expand Down Expand Up @@ -77,6 +78,13 @@
"SteamNetworkingErrMsg &": "out SteamNetworkingErrMsg",
"const SteamNetConnectionInfo_t &": "ref SteamNetConnectionInfo_t",
"SteamNetworkingMessage_t **": "IntPtr[]",

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

# External type that we don't currently support.
"const ScePadTriggerEffectParam *": "IntPtr"
}

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

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

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

"ISteamNetworkingSockets_SendMessages": {
"pMessages": "SteamNetworkingMessage_t[]",
"pOutMessageNumberOrResult": "long[]",
Expand All @@ -417,6 +429,15 @@
"pMessages": "SteamNetworkingMessage_t[]",
"pOutMessageNumberOrResult": "long[]",
},

"ISteamNetworkingSockets_GetConnectionRealTimeStatus": {
"pStatus": "ref SteamNetConnectionRealTimeStatus_t",
"pLanes": "ref SteamNetConnectionRealTimeLaneStatus_t",
},
"ISteamGameServerNetworkingSockets_GetConnectionRealTimeStatus": {
"pStatus": "ref SteamNetConnectionRealTimeStatus_t",
"pLanes": "ref SteamNetConnectionRealTimeLaneStatus_t",
},
}

g_SpecialWrapperArgsDict = {
Expand Down Expand Up @@ -491,7 +512,7 @@

def main(parser):
try:
os.makedirs("autogen/")
os.makedirs("../com.rlabrecque.steamworks.net/Runtime/autogen/")
except OSError:
pass

Expand All @@ -504,7 +525,7 @@ def main(parser):
for f in parser.files:
parse(f)

with open("autogen/NativeMethods.cs", "wb") as out:
with open("../com.rlabrecque.steamworks.net/Runtime/autogen/NativeMethods.cs", "wb") as out:
#out.write(bytes(HEADER, "utf-8"))
with open("templates/nativemethods.txt", "r") as f:
out.write(bytes(f.read(), "utf-8"))
Expand All @@ -526,7 +547,7 @@ def parse(f):
parse_interface(f, interface)

if g_Output:
with open('autogen/' + os.path.splitext(f.name)[0] + '.cs', 'wb') as out:
with open('../com.rlabrecque.steamworks.net/Runtime/autogen/' + os.path.splitext(f.name)[0] + '.cs', 'wb') as out:
if f.name in ["isteamnetworkingutils.h", "isteamnetworkingsockets.h", "isteamgameservernetworkingutils.h", "isteamgameservernetworkingsockets.h"]:
out.write(bytes("#define STEAMNETWORKINGSOCKETS_ENABLE_SDR\n", "utf-8"))
out.write(bytes(HEADER, "utf-8"))
Expand Down Expand Up @@ -771,7 +792,7 @@ def parse_args(strEntryPoint, args):
for arg in args:
argtype = g_TypeDict.get(arg.type, arg.type)
if argtype.endswith("*"):
potentialtype = arg.type.rstrip("*").rstrip()
potentialtype = arg.type.rstrip("*").lstrip("const ").rstrip()
argtype = "out " + g_TypeDict.get(potentialtype, potentialtype)
argtype = g_SpecialArgsDict.get(strEntryPoint, dict()).get(arg.name, argtype)

Expand Down
Loading