Skip to content

Commit 499f391

Browse files
committed
update(steamworks): Remove Client
1 parent bef0b24 commit 499f391

29 files changed

+1334
-10205
lines changed

generator/steamworks_generator/src/interfaces.py

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,14 @@ def parse_interface(f, interface):
567567
else:
568568
bGameServerVersion = False
569569

570-
print(" - " + interface.name)
571-
g_Output.append('\tpublic static class ' + interface.name[1:] + ' {')
570+
# Check if this is a client interface (not GameServer)
571+
isClientInterface = not ('GameServer' in interface.name)
572572

573+
print(" - " + interface.name)
573574

575+
# Only create wrapper class for GameServer interfaces
576+
if not isClientInterface:
577+
g_Output.append('\tpublic static class ' + interface.name[1:] + ' {')
574578

575579
if not bGameServerVersion:
576580
g_NativeMethods.append("#region " + interface.name[1:])
@@ -582,50 +586,58 @@ def parse_interface(f, interface):
582586
if not bGameServerVersion:
583587
g_NativeMethods[-1] = "#endif"
584588

585-
g_Output[-1] = "#endif"
589+
if not isClientInterface:
590+
g_Output[-1] = "#endif"
586591
lastIfStatement = None
587592

588593
if func.ifstatements:
589594
g_NativeMethods.append("#if " + func.ifstatements.replace("defined(", "").replace(")", ""))
590-
g_Output.append("#if " + func.ifstatements.replace("defined(", "").replace(")", ""))
595+
if not isClientInterface:
596+
g_Output.append("#if " + func.ifstatements.replace("defined(", "").replace(")", ""))
591597
lastIfStatement = func.ifstatements
592598
elif func.ifstatements:
593599
if not bGameServerVersion:
594600
g_NativeMethods[-1] = "#if " + func.ifstatements.replace("defined(", "").replace(")", "")
595601
g_NativeMethods[-1] = "#if " + func.ifstatements.replace("defined(", "").replace(")", "")
596602

597-
g_Output[-1] = "#if " + func.ifstatements.replace("defined(", "").replace(")", "")
603+
if not isClientInterface:
604+
g_Output[-1] = "#if " + func.ifstatements.replace("defined(", "").replace(")", "")
598605
lastIfStatement = func.ifstatements
599606

600607
if func.private:
601608
continue
602609

603-
parse_func(f, interface, func)
610+
parse_func(f, interface, func, isClientInterface)
604611

605612
# Remove last whitespace
606613
if not bGameServerVersion:
607614
del g_NativeMethods[-1]
608615

609-
del g_Output[-1]
616+
if not isClientInterface:
617+
del g_Output[-1]
610618

611619
if lastIfStatement is not None:
612620
if not bGameServerVersion:
613621
g_NativeMethods.append("#endif")
614622

615-
g_Output.append("#endif")
623+
if not isClientInterface:
624+
g_Output.append("#endif")
616625

617626
if not bGameServerVersion:
618627
g_NativeMethods.append("#endregion")
619628

620-
g_Output.append("\t}")
629+
# Only close wrapper class for GameServer interfaces
630+
if not isClientInterface:
631+
g_Output.append("\t}")
621632

622-
def parse_func(f, interface, func):
633+
def parse_func(f, interface, func, isClientInterface=False):
623634
strEntryPoint = interface.name + '_' + func.name
624635

625636
if "GameServer" in interface.name and interface.name != "ISteamGameServer" and interface.name != "ISteamGameServerStats":
626637
bGameServerVersion = True
627638
else:
628639
bGameServerVersion = False
640+
629641
for attr in func.attributes:
630642
if attr.name == "STEAM_FLAT_NAME":
631643
strEntryPoint = interface.name + '_' + attr.value
@@ -658,6 +670,7 @@ def parse_func(f, interface, func):
658670
outstringsize = args[4][1]
659671
args_with_explicit_count = args[5]
660672

673+
# Always generate DllImport for all interfaces (client and server)
661674
if not bGameServerVersion:
662675
g_NativeMethods.append("\t\t[DllImport(NativeLibraryName, EntryPoint = \"SteamAPI_{0}\", CallingConvention = CallingConvention.Cdecl)]".format(strEntryPoint))
663676

@@ -667,6 +680,10 @@ def parse_func(f, interface, func):
667680
g_NativeMethods.append("\t\tpublic static extern {0} {1}({2});".format(returntype, strEntryPoint, pinvokeargs))
668681
g_NativeMethods.append("")
669682

683+
# Only generate wrapper methods for GameServer interfaces (skip client interfaces)
684+
if isClientInterface:
685+
return
686+
670687
functionBody = []
671688

672689
if 'GameServer' in interface.name:

managed/src/SwiftlyS2.Generated/SteamAPI/NativeMethods.cs

Lines changed: 1045 additions & 1043 deletions
Large diffs are not rendered by default.

managed/src/SwiftlyS2.Generated/SteamAPI/SteamConstants.cs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
using System.Runtime.InteropServices;
22
using IntPtr = System.IntPtr;
33

4-
namespace SwiftlyS2.Shared.SteamAPI {
5-
public static class Constants {
4+
namespace SwiftlyS2.Shared.SteamAPI
5+
{
6+
public static class Constants
7+
{
68
public const string STEAMAPPS_INTERFACE_VERSION = "STEAMAPPS_INTERFACE_VERSION008";
79
public const string STEAMAPPTICKET_INTERFACE_VERSION = "STEAMAPPTICKET_INTERFACE_VERSION001";
810
public const string STEAMCLIENT_INTERFACE_VERSION = "SteamClient021";
@@ -37,17 +39,17 @@ public static class Constants {
3739
public const string STEAMUTILS_INTERFACE_VERSION = "SteamUtils010";
3840
public const string STEAMVIDEO_INTERFACE_VERSION = "STEAMVIDEO_INTERFACE_V007";
3941
public const int k_cubAppProofOfPurchaseKeyMax = 240; // max supported length of a legacy cd key
40-
// maximum length of friend group name (not including terminating nul!)
42+
// maximum length of friend group name (not including terminating nul!)
4143
public const int k_cchMaxFriendsGroupName = 64;
4244
// maximum number of groups a single user is allowed
4345
public const int k_cFriendsGroupLimit = 100;
4446
public const int k_cEnumerateFollowersMax = 50;
4547
// special values for FriendGameInfo_t::m_usQueryPort
4648
public const ushort k_usFriendGameInfoQueryPort_NotInitialized = 0xFFFF; // We haven't asked the GS for this query port's actual value yet. Was #define QUERY_PORT_NOT_INITIALIZED in older versions of Steamworks SDK.
4749
public const ushort k_usFriendGameInfoQueryPort_Error = 0xFFFE; // We were unable to get the query port for this server. Was #define QUERY_PORT_ERROR in older versions of Steamworks SDK.
48-
// maximum number of characters in a user's name. Two flavors; one for UTF-8 and one for UTF-16.
49-
// The UTF-8 version has to be very generous to accomodate characters that get large when encoded
50-
// in UTF-8.
50+
// maximum number of characters in a user's name. Two flavors; one for UTF-8 and one for UTF-16.
51+
// The UTF-8 version has to be very generous to accomodate characters that get large when encoded
52+
// in UTF-8.
5153
public const int k_cchPersonaNameMax = 128;
5254
public const int k_cwchPersonaNameMax = 32;
5355
// size limit on chat room or member metadata
@@ -60,10 +62,10 @@ public static class Constants {
6062
public const int k_unFavoriteFlagNone = 0x00;
6163
public const int k_unFavoriteFlagFavorite = 0x01; // this game favorite entry is for the favorites list
6264
public const int k_unFavoriteFlagHistory = 0x02; // this game favorite entry is for the history list
63-
//-----------------------------------------------------------------------------
64-
// Purpose: Defines the largest allowed file size. Cloud files cannot be written
65-
// in a single chunk over 100MB (and cannot be over 200MB total.)
66-
//-----------------------------------------------------------------------------
65+
//-----------------------------------------------------------------------------
66+
// Purpose: Defines the largest allowed file size. Cloud files cannot be written
67+
// in a single chunk over 100MB (and cannot be over 200MB total.)
68+
//-----------------------------------------------------------------------------
6769
public const int k_unMaxCloudFileChunkSize = 100 * 1024 * 1024;
6870
public const int k_cchPublishedDocumentTitleMax = 128 + 1;
6971
public const int k_cchPublishedDocumentDescriptionMax = 8000;
@@ -81,7 +83,7 @@ public static class Constants {
8183
public const int k_ScreenshotThumbWidth = 200;
8284
public const int k_unMaxTimelinePriority = 1000;
8385
public const int k_unTimelinePriority_KeepCurrentValue = 1000000; // Use with UpdateRangeTimelineEvent to not change the priority
84-
public const float k_flMaxTimelineEventDuration = 600.0f;
86+
public const float k_flMaxTimelineEventDuration = 600;
8587
public const int k_cchMaxPhaseIDLength = 64;
8688
public const int kNumUGCResultsPerPage = 50;
8789
public const int k_cchDeveloperMetadataMax = 5000;
@@ -182,9 +184,9 @@ public static class Constants {
182184
public const int k_nSteamNetworkConnectionInfoFlags_Fast = 8; // The connection is "fast" and "reliable". Either internal/localhost (check the address to find out), or the peer is on the same LAN. (Probably. It's based on the address and the ping time, this is actually hard to determine unambiguously).
183185
public const int k_nSteamNetworkConnectionInfoFlags_Relayed = 16; // The connection is relayed somehow (SDR or TURN).
184186
public const int k_nSteamNetworkConnectionInfoFlags_DualWifi = 32; // We're taking advantage of dual-wifi multi-path
185-
//
186-
// Network messages
187-
//
187+
//
188+
// Network messages
189+
//
188190
/// Max size of a single message that we can SEND.
189191
/// Note: We might be wiling to receive larger messages,
190192
/// and our peer might, too.
@@ -225,7 +227,7 @@ public static class Constants {
225227
// and then immediately flushing the messages using ISteamNetworkingSockets::FlushMessagesOnConnection
226228
// or ISteamNetworkingMessages::FlushMessagesToUser. (But using this flag is more efficient since you
227229
// only make one API call.)
228-
public const int k_nSteamNetworkingSend_UnreliableNoNagle = k_nSteamNetworkingSend_Unreliable|k_nSteamNetworkingSend_NoNagle;
230+
public const int k_nSteamNetworkingSend_UnreliableNoNagle = k_nSteamNetworkingSend_Unreliable | k_nSteamNetworkingSend_NoNagle;
229231
// If the message cannot be sent very soon (because the connection is still doing some initial
230232
// handshaking, route negotiations, etc), then just drop it. This is only applicable for unreliable
231233
// messages. Using this flag on reliable messages is invalid.
@@ -241,7 +243,7 @@ public static class Constants {
241243
// will not be placed on the wire in the next ~200ms or so.
242244
//
243245
// If a message is dropped for these reasons, k_EResultIgnored will be returned.
244-
public const int k_nSteamNetworkingSend_UnreliableNoDelay = k_nSteamNetworkingSend_Unreliable|k_nSteamNetworkingSend_NoDelay|k_nSteamNetworkingSend_NoNagle;
246+
public const int k_nSteamNetworkingSend_UnreliableNoDelay = k_nSteamNetworkingSend_Unreliable | k_nSteamNetworkingSend_NoDelay | k_nSteamNetworkingSend_NoNagle;
245247
// Reliable message send. Can send up to k_cbMaxSteamNetworkingSocketsMessageSizeSend bytes in a single message.
246248
// Does fragmentation/re-assembly of messages under the hood, as well as a sliding window for
247249
// efficient sends of large chunks of data.
@@ -255,7 +257,7 @@ public static class Constants {
255257
// Send a message reliably, but bypass Nagle's algorithm.
256258
//
257259
// Migration note: This is equivalent to k_EP2PSendReliable
258-
public const int k_nSteamNetworkingSend_ReliableNoNagle = k_nSteamNetworkingSend_Reliable|k_nSteamNetworkingSend_NoNagle;
260+
public const int k_nSteamNetworkingSend_ReliableNoNagle = k_nSteamNetworkingSend_Reliable | k_nSteamNetworkingSend_NoNagle;
259261
// By default, message sending is queued, and the work of encryption and talking to
260262
// the operating system sockets, etc is done on a service thread. This is usually a
261263
// a performance win when messages are sent from the "main thread". However, if this
@@ -308,7 +310,7 @@ public static class Constants {
308310
public const int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_All = 0x7fffffff;
309311
public const int k_uAccountIdInvalid = 0;
310312
public const ulong k_ulPartyBeaconIdInvalid = 0;
311-
public const int INVALID_HTTPREQUEST_HANDLE = 0;
313+
public const int INVALID_HTTPREQUEST_HANDLE = 0;
312314
public const int STEAM_INPUT_MAX_COUNT = 16;
313315
public const int STEAM_INPUT_MAX_ANALOG_ACTIONS = 24;
314316
public const int STEAM_INPUT_MAX_DIGITAL_ACTIONS = 256;

0 commit comments

Comments
 (0)