diff --git a/Facepunch.Steamworks/Interfaces/Inventory.cs b/Facepunch.Steamworks/Interfaces/Inventory.cs index d08fd30..349b6f2 100644 --- a/Facepunch.Steamworks/Interfaces/Inventory.cs +++ b/Facepunch.Steamworks/Interfaces/Inventory.cs @@ -167,9 +167,9 @@ public void Dispose() /// IE - your player is alive, and playing. /// Don't stress on it too much tho cuz it's super hijackable anyway. /// + [Obsolete( "No longer required, will be removed in a later version" )] public void PlaytimeHeartbeat() { - inventory.SendItemDropHeartbeat(); } /// diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Constants.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Constants.cs index b1b7a86..29b15c6 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Constants.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Constants.cs @@ -58,7 +58,7 @@ internal static class Defines internal const string STEAMAPPLIST_INTERFACE_VERSION = "STEAMAPPLIST_INTERFACE_VERSION001"; internal const string STEAMAPPS_INTERFACE_VERSION = "STEAMAPPS_INTERFACE_VERSION008"; internal const string STEAMAPPTICKET_INTERFACE_VERSION = "STEAMAPPTICKET_INTERFACE_VERSION001"; - internal const string STEAMCONTROLLER_INTERFACE_VERSION = "SteamController004"; + internal const string STEAMCONTROLLER_INTERFACE_VERSION = "SteamController005"; internal const string STEAMFRIENDS_INTERFACE_VERSION = "SteamFriends015"; internal const string STEAMGAMECOORDINATOR_INTERFACE_VERSION = "SteamGameCoordinator001"; internal const string STEAMGAMESERVER_INTERFACE_VERSION = "SteamGameServer012"; diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Enums.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Enums.cs index 784f10f..d9c1790 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Enums.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Enums.cs @@ -438,24 +438,6 @@ internal enum VRHMDType : int Oculus_Unknown = 40, } - // - // EControllerType - // - internal enum ControllerType : int - { - None = -1, - Unknown = 0, - UnknownSteamController = 1, - SteamController = 2, - UnknownNonSteamController = 30, - XBox360Controller = 31, - XBoxOneController = 32, - PS3Controller = 33, - PS4Controller = 34, - WiiController = 35, - AppleController = 36, - } - // // CGameID::EGameIDType // @@ -522,7 +504,6 @@ internal enum FriendFlags : int RequestingInfo = 256, Ignored = 512, IgnoredFriend = 1024, - Suggested = 2048, ChatMember = 4096, All = 65535, } @@ -993,7 +974,10 @@ internal enum ControllerSource : int LeftTrigger = 6, RightTrigger = 7, Gyro = 8, - Count = 9, + CenterTrackpad = 9, + RightJoystick = 10, + DPad = 11, + Count = 12, } // @@ -1008,14 +992,15 @@ internal enum ControllerSourceMode : int AbsoluteMouse = 4, RelativeMouse = 5, JoystickMove = 6, - JoystickCamera = 7, - ScrollWheel = 8, - Trigger = 9, - TouchMenu = 10, - MouseJoystick = 11, - MouseRegion = 12, - RadialMenu = 13, - Switches = 14, + JoystickMouse = 7, + JoystickCamera = 8, + ScrollWheel = 9, + Trigger = 10, + TouchMenu = 11, + MouseJoystick = 12, + MouseRegion = 13, + RadialMenu = 14, + Switches = 15, } // @@ -1062,82 +1047,163 @@ internal enum ControllerActionOrigin : int Gyro_Pitch = 36, Gyro_Yaw = 37, Gyro_Roll = 38, - Count = 39, + PS4_X = 39, + PS4_Circle = 40, + PS4_Triangle = 41, + PS4_Square = 42, + PS4_LeftBumper = 43, + PS4_RightBumper = 44, + PS4_Options = 45, + PS4_Share = 46, + PS4_LeftPad_Touch = 47, + PS4_LeftPad_Swipe = 48, + PS4_LeftPad_Click = 49, + PS4_LeftPad_DPadNorth = 50, + PS4_LeftPad_DPadSouth = 51, + PS4_LeftPad_DPadWest = 52, + PS4_LeftPad_DPadEast = 53, + PS4_RightPad_Touch = 54, + PS4_RightPad_Swipe = 55, + PS4_RightPad_Click = 56, + PS4_RightPad_DPadNorth = 57, + PS4_RightPad_DPadSouth = 58, + PS4_RightPad_DPadWest = 59, + PS4_RightPad_DPadEast = 60, + PS4_CenterPad_Touch = 61, + PS4_CenterPad_Swipe = 62, + PS4_CenterPad_Click = 63, + PS4_CenterPad_DPadNorth = 64, + PS4_CenterPad_DPadSouth = 65, + PS4_CenterPad_DPadWest = 66, + PS4_CenterPad_DPadEast = 67, + PS4_LeftTrigger_Pull = 68, + PS4_LeftTrigger_Click = 69, + PS4_RightTrigger_Pull = 70, + PS4_RightTrigger_Click = 71, + PS4_LeftStick_Move = 72, + PS4_LeftStick_Click = 73, + PS4_LeftStick_DPadNorth = 74, + PS4_LeftStick_DPadSouth = 75, + PS4_LeftStick_DPadWest = 76, + PS4_LeftStick_DPadEast = 77, + PS4_RightStick_Move = 78, + PS4_RightStick_Click = 79, + PS4_RightStick_DPadNorth = 80, + PS4_RightStick_DPadSouth = 81, + PS4_RightStick_DPadWest = 82, + PS4_RightStick_DPadEast = 83, + PS4_DPad_North = 84, + PS4_DPad_South = 85, + PS4_DPad_West = 86, + PS4_DPad_East = 87, + PS4_Gyro_Move = 88, + PS4_Gyro_Pitch = 89, + PS4_Gyro_Yaw = 90, + PS4_Gyro_Roll = 91, + XBoxOne_A = 92, + XBoxOne_B = 93, + XBoxOne_X = 94, + XBoxOne_Y = 95, + XBoxOne_LeftBumper = 96, + XBoxOne_RightBumper = 97, + XBoxOne_Menu = 98, + XBoxOne_View = 99, + XBoxOne_LeftTrigger_Pull = 100, + XBoxOne_LeftTrigger_Click = 101, + XBoxOne_RightTrigger_Pull = 102, + XBoxOne_RightTrigger_Click = 103, + XBoxOne_LeftStick_Move = 104, + XBoxOne_LeftStick_Click = 105, + XBoxOne_LeftStick_DPadNorth = 106, + XBoxOne_LeftStick_DPadSouth = 107, + XBoxOne_LeftStick_DPadWest = 108, + XBoxOne_LeftStick_DPadEast = 109, + XBoxOne_RightStick_Move = 110, + XBoxOne_RightStick_Click = 111, + XBoxOne_RightStick_DPadNorth = 112, + XBoxOne_RightStick_DPadSouth = 113, + XBoxOne_RightStick_DPadWest = 114, + XBoxOne_RightStick_DPadEast = 115, + XBoxOne_DPad_North = 116, + XBoxOne_DPad_South = 117, + XBoxOne_DPad_West = 118, + XBoxOne_DPad_East = 119, + XBox360_A = 120, + XBox360_B = 121, + XBox360_X = 122, + XBox360_Y = 123, + XBox360_LeftBumper = 124, + XBox360_RightBumper = 125, + XBox360_Start = 126, + XBox360_Back = 127, + XBox360_LeftTrigger_Pull = 128, + XBox360_LeftTrigger_Click = 129, + XBox360_RightTrigger_Pull = 130, + XBox360_RightTrigger_Click = 131, + XBox360_LeftStick_Move = 132, + XBox360_LeftStick_Click = 133, + XBox360_LeftStick_DPadNorth = 134, + XBox360_LeftStick_DPadSouth = 135, + XBox360_LeftStick_DPadWest = 136, + XBox360_LeftStick_DPadEast = 137, + XBox360_RightStick_Move = 138, + XBox360_RightStick_Click = 139, + XBox360_RightStick_DPadNorth = 140, + XBox360_RightStick_DPadSouth = 141, + XBox360_RightStick_DPadWest = 142, + XBox360_RightStick_DPadEast = 143, + XBox360_DPad_North = 144, + XBox360_DPad_South = 145, + XBox360_DPad_West = 146, + XBox360_DPad_East = 147, + SteamV2_A = 148, + SteamV2_B = 149, + SteamV2_X = 150, + SteamV2_Y = 151, + SteamV2_LeftBumper = 152, + SteamV2_RightBumper = 153, + SteamV2_LeftGrip = 154, + SteamV2_RightGrip = 155, + SteamV2_Start = 156, + SteamV2_Back = 157, + SteamV2_LeftPad_Touch = 158, + SteamV2_LeftPad_Swipe = 159, + SteamV2_LeftPad_Click = 160, + SteamV2_LeftPad_DPadNorth = 161, + SteamV2_LeftPad_DPadSouth = 162, + SteamV2_LeftPad_DPadWest = 163, + SteamV2_LeftPad_DPadEast = 164, + SteamV2_RightPad_Touch = 165, + SteamV2_RightPad_Swipe = 166, + SteamV2_RightPad_Click = 167, + SteamV2_RightPad_DPadNorth = 168, + SteamV2_RightPad_DPadSouth = 169, + SteamV2_RightPad_DPadWest = 170, + SteamV2_RightPad_DPadEast = 171, + SteamV2_LeftTrigger_Pull = 172, + SteamV2_LeftTrigger_Click = 173, + SteamV2_RightTrigger_Pull = 174, + SteamV2_RightTrigger_Click = 175, + SteamV2_LeftStick_Move = 176, + SteamV2_LeftStick_Click = 177, + SteamV2_LeftStick_DPadNorth = 178, + SteamV2_LeftStick_DPadSouth = 179, + SteamV2_LeftStick_DPadWest = 180, + SteamV2_LeftStick_DPadEast = 181, + SteamV2_Gyro_Move = 182, + SteamV2_Gyro_Pitch = 183, + SteamV2_Gyro_Yaw = 184, + SteamV2_Gyro_Roll = 185, + Count = 186, } // - // EControllerActivationType + // ESteamControllerLEDFlag // - internal enum ControllerActivationType : int + internal enum SteamControllerLEDFlag : int { - None = 0, - FullPress = 1, - SoftPress = 2, - StartPress = 3, - Release = 4, - LongPress = 5, - DoublePress = 6, - Analog = 7, - } - - // - // EControllerPressureButton - // - internal enum ControllerPressureButton : int - { - LeftTrackPad = 0, - RightTrackPad = 1, - LeftBumper = 2, - RightBumper = 3, - LeftGripLower = 4, - RightGripLower = 5, - LeftGripUpper = 6, - RightGripUpper = 7, - Invalid = 8, - } - - // - // EControllerActivatorOutputAxis - // - internal enum ControllerActivatorOutputAxis : int - { - LeftTrigger = 0, - RightTrigger = 1, - LeftThumbXPos = 2, - LeftThumbXNeg = 3, - LeftThumbYPos = 4, - LeftThumbYNeg = 5, - RightThumbXPos = 6, - RightThumbXNeg = 7, - RightThumbYPos = 8, - RightThumbYNeg = 9, - } - - // - // EControllerConfigFeature - // - internal enum ControllerConfigFeature : int - { - None = 0, - Gamepad = 1, - Keyboard = 2, - Mouse = 3, - Gyro = 4, - TouchMenu = 5, - ModeShift = 6, - ActionSet = 7, - Activator = 8, - } - - // - // EControllerPopupMenuActivationType - // - internal enum ControllerPopupMenuActivationType : int - { - ButtonPress = 0, - ButtonRelease = 1, - TouchRelease = 2, - TouchAlways = 3, + SetColor = 0, + RestoreUserDefault = 1, } // diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Interface.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Interface.cs index 556913b..44a8a5a 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Interface.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Interface.cs @@ -90,11 +90,15 @@ internal interface Interface : IDisposable void /*void*/ ISteamController_StopAnalogActionMomentum( ulong controllerHandle, ulong eAction ); void /*void*/ ISteamController_TriggerHapticPulse( ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec ); void /*void*/ ISteamController_TriggerRepeatedHapticPulse( ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec, ushort /*unsigned short*/ usOffMicroSec, ushort /*unsigned short*/ unRepeat, uint /*unsigned int*/ nFlags ); + void /*void*/ ISteamController_TriggerVibration( ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ); + void /*void*/ ISteamController_SetLEDColor( ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ); int /*int*/ ISteamController_GetGamepadIndexForController( ulong ulControllerHandle ); ControllerHandle_t /*(ControllerHandle_t)*/ ISteamController_GetControllerForGamepadIndex( int /*int*/ nIndex ); ControllerMotionData_t /*struct ControllerMotionData_t*/ ISteamController_GetMotionData( ulong controllerHandle ); bool /*bool*/ ISteamController_ShowDigitalActionOrigins( ulong controllerHandle, ulong digitalActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); bool /*bool*/ ISteamController_ShowAnalogActionOrigins( ulong controllerHandle, ulong analogActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); + IntPtr ISteamController_GetStringForActionOrigin( ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); + IntPtr ISteamController_GetGlyphForActionOrigin( ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); IntPtr ISteamFriends_GetPersonaName(); SteamAPICall_t /*(SteamAPICall_t)*/ ISteamFriends_SetPersonaName( string /*const char **/ pchPersonaName ); PersonaState /*EPersonaState*/ ISteamFriends_GetPersonaState(); @@ -301,6 +305,8 @@ internal interface Interface : IDisposable bool /*bool*/ ISteamInventory_LoadItemDefinitions(); bool /*bool*/ ISteamInventory_GetItemDefinitionIDs( IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); bool /*bool*/ ISteamInventory_GetItemDefinitionProperty( int iDefinition, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); + SteamAPICall_t /*(SteamAPICall_t)*/ ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( ulong steamID ); + bool /*bool*/ ISteamInventory_GetEligiblePromoItemDefinitionIDs( ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); int /*int*/ ISteamMatchmaking_GetFavoriteGameCount(); bool /*bool*/ ISteamMatchmaking_GetFavoriteGame( int /*int*/ iGame, ref uint pnAppID, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnConnPort, out ushort /*uint16 **/ pnQueryPort, out uint /*uint32 **/ punFlags, out uint /*uint32 **/ pRTime32LastPlayedOnServer ); int /*int*/ ISteamMatchmaking_AddFavoriteGame( uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags, uint /*uint32*/ rTime32LastPlayedOnServer ); diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux32.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux32.cs index 79e0854..ef8d627 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux32.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux32.cs @@ -2804,6 +2804,18 @@ public virtual IntPtr ISteamApps_GetLaunchQueryParam( string /*const char **/ pc Native.SteamAPI_ISteamController_TriggerRepeatedHapticPulse(_ptr, controllerHandle, eTargetPad, usDurationMicroSec, usOffMicroSec, unRepeat, nFlags); } + public virtual void /*void*/ ISteamController_TriggerVibration( ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); + + Native.SteamAPI_ISteamController_TriggerVibration(_ptr, controllerHandle, usLeftSpeed, usRightSpeed); + } + public virtual void /*void*/ ISteamController_SetLEDColor( ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); + + Native.SteamAPI_ISteamController_SetLEDColor(_ptr, controllerHandle, nColorR, nColorG, nColorB, nFlags); + } public virtual int /*int*/ ISteamController_GetGamepadIndexForController( ulong ulControllerHandle ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); @@ -2834,6 +2846,18 @@ public virtual IntPtr ISteamApps_GetLaunchQueryParam( string /*const char **/ pc return Native.SteamAPI_ISteamController_ShowAnalogActionOrigins(_ptr, controllerHandle, analogActionHandle, flScale, flXPosition, flYPosition); } + public virtual IntPtr ISteamController_GetStringForActionOrigin( ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); + + return Native.SteamAPI_ISteamController_GetStringForActionOrigin(_ptr, eOrigin); + } + public virtual IntPtr ISteamController_GetGlyphForActionOrigin( ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); + + return Native.SteamAPI_ISteamController_GetGlyphForActionOrigin(_ptr, eOrigin); + } public virtual UGCQueryHandle_t /*(UGCQueryHandle_t)*/ ISteamUGC_CreateQueryUserUGCRequest( uint unAccountID, UserUGCList /*EUserUGCList*/ eListType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingUGCType, UserUGCListSortOrder /*EUserUGCListSortOrder*/ eSortOrder, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ) { @@ -3618,6 +3642,18 @@ public virtual IntPtr ISteamApps_GetLaunchQueryParam( string /*const char **/ pc return Native.SteamAPI_ISteamInventory_GetItemDefinitionProperty(_ptr, iDefinition, pchPropertyName, pchValueBuffer, out punValueBufferSizeOut); } + public virtual SteamAPICall_t /*(SteamAPICall_t)*/ ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( ulong steamID ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamInventory _ptr is null!" ); + + return Native.SteamAPI_ISteamInventory_RequestEligiblePromoItemDefinitionsIDs(_ptr, steamID); + } + public virtual bool /*bool*/ ISteamInventory_GetEligiblePromoItemDefinitionIDs( ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamInventory _ptr is null!" ); + + return Native.SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs(_ptr, steamID, pItemDefIDs, out punItemDefIDsArraySize); + } public virtual void /*void*/ ISteamVideo_GetVideoURL( uint unVideoAppID ) { @@ -4540,11 +4576,15 @@ internal static unsafe class Native [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_StopAnalogActionMomentum( IntPtr ISteamController, ulong controllerHandle, ulong eAction ); [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec ); [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerRepeatedHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec, ushort /*unsigned short*/ usOffMicroSec, ushort /*unsigned short*/ unRepeat, uint /*unsigned int*/ nFlags ); + [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerVibration( IntPtr ISteamController, ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ); + [DllImportAttribute( "libsteam_api.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_SetLEDColor( IntPtr ISteamController, ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ); [DllImportAttribute( "libsteam_api.so" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetGamepadIndexForController( IntPtr ISteamController, ulong ulControllerHandle ); [DllImportAttribute( "libsteam_api.so" )] internal static extern ControllerHandle_t /*(ControllerHandle_t)*/ SteamAPI_ISteamController_GetControllerForGamepadIndex( IntPtr ISteamController, int /*int*/ nIndex ); [DllImportAttribute( "libsteam_api.so" )] internal static extern ControllerMotionData_t /*struct ControllerMotionData_t*/ SteamAPI_ISteamController_GetMotionData( IntPtr ISteamController, ulong controllerHandle ); [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); + [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamController_GetStringForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); + [DllImportAttribute( "libsteam_api.so" )] internal static extern IntPtr SteamAPI_ISteamController_GetGlyphForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); // // ISteamUGC @@ -4690,6 +4730,8 @@ internal static unsafe class Native [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_LoadItemDefinitions( IntPtr ISteamInventory ); [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionIDs( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionProperty( IntPtr ISteamInventory, int iDefinition, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); + [DllImportAttribute( "libsteam_api.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( IntPtr ISteamInventory, ulong steamID ); + [DllImportAttribute( "libsteam_api.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs( IntPtr ISteamInventory, ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); // // ISteamVideo diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux64.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux64.cs index be11066..8811776 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux64.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Linux64.cs @@ -2804,6 +2804,18 @@ public virtual IntPtr ISteamApps_GetLaunchQueryParam( string /*const char **/ pc Native.SteamAPI_ISteamController_TriggerRepeatedHapticPulse(_ptr, controllerHandle, eTargetPad, usDurationMicroSec, usOffMicroSec, unRepeat, nFlags); } + public virtual void /*void*/ ISteamController_TriggerVibration( ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); + + Native.SteamAPI_ISteamController_TriggerVibration(_ptr, controllerHandle, usLeftSpeed, usRightSpeed); + } + public virtual void /*void*/ ISteamController_SetLEDColor( ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); + + Native.SteamAPI_ISteamController_SetLEDColor(_ptr, controllerHandle, nColorR, nColorG, nColorB, nFlags); + } public virtual int /*int*/ ISteamController_GetGamepadIndexForController( ulong ulControllerHandle ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); @@ -2834,6 +2846,18 @@ public virtual IntPtr ISteamApps_GetLaunchQueryParam( string /*const char **/ pc return Native.SteamAPI_ISteamController_ShowAnalogActionOrigins(_ptr, controllerHandle, analogActionHandle, flScale, flXPosition, flYPosition); } + public virtual IntPtr ISteamController_GetStringForActionOrigin( ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); + + return Native.SteamAPI_ISteamController_GetStringForActionOrigin(_ptr, eOrigin); + } + public virtual IntPtr ISteamController_GetGlyphForActionOrigin( ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); + + return Native.SteamAPI_ISteamController_GetGlyphForActionOrigin(_ptr, eOrigin); + } public virtual UGCQueryHandle_t /*(UGCQueryHandle_t)*/ ISteamUGC_CreateQueryUserUGCRequest( uint unAccountID, UserUGCList /*EUserUGCList*/ eListType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingUGCType, UserUGCListSortOrder /*EUserUGCListSortOrder*/ eSortOrder, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ) { @@ -3618,6 +3642,18 @@ public virtual IntPtr ISteamApps_GetLaunchQueryParam( string /*const char **/ pc return Native.SteamAPI_ISteamInventory_GetItemDefinitionProperty(_ptr, iDefinition, pchPropertyName, pchValueBuffer, out punValueBufferSizeOut); } + public virtual SteamAPICall_t /*(SteamAPICall_t)*/ ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( ulong steamID ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamInventory _ptr is null!" ); + + return Native.SteamAPI_ISteamInventory_RequestEligiblePromoItemDefinitionsIDs(_ptr, steamID); + } + public virtual bool /*bool*/ ISteamInventory_GetEligiblePromoItemDefinitionIDs( ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamInventory _ptr is null!" ); + + return Native.SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs(_ptr, steamID, pItemDefIDs, out punItemDefIDsArraySize); + } public virtual void /*void*/ ISteamVideo_GetVideoURL( uint unVideoAppID ) { @@ -4540,11 +4576,15 @@ internal static unsafe class Native [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_StopAnalogActionMomentum( IntPtr ISteamController, ulong controllerHandle, ulong eAction ); [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec ); [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerRepeatedHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec, ushort /*unsigned short*/ usOffMicroSec, ushort /*unsigned short*/ unRepeat, uint /*unsigned int*/ nFlags ); + [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerVibration( IntPtr ISteamController, ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ); + [DllImportAttribute( "libsteam_api64.so" )] internal static extern void /*void*/ SteamAPI_ISteamController_SetLEDColor( IntPtr ISteamController, ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ); [DllImportAttribute( "libsteam_api64.so" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetGamepadIndexForController( IntPtr ISteamController, ulong ulControllerHandle ); [DllImportAttribute( "libsteam_api64.so" )] internal static extern ControllerHandle_t /*(ControllerHandle_t)*/ SteamAPI_ISteamController_GetControllerForGamepadIndex( IntPtr ISteamController, int /*int*/ nIndex ); [DllImportAttribute( "libsteam_api64.so" )] internal static extern ControllerMotionData_t /*struct ControllerMotionData_t*/ SteamAPI_ISteamController_GetMotionData( IntPtr ISteamController, ulong controllerHandle ); [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); + [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamController_GetStringForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); + [DllImportAttribute( "libsteam_api64.so" )] internal static extern IntPtr SteamAPI_ISteamController_GetGlyphForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); // // ISteamUGC @@ -4690,6 +4730,8 @@ internal static unsafe class Native [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_LoadItemDefinitions( IntPtr ISteamInventory ); [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionIDs( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionProperty( IntPtr ISteamInventory, int iDefinition, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); + [DllImportAttribute( "libsteam_api64.so" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( IntPtr ISteamInventory, ulong steamID ); + [DllImportAttribute( "libsteam_api64.so" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs( IntPtr ISteamInventory, ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); // // ISteamVideo diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Mac.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Mac.cs index 06a5e84..454a847 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Mac.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Mac.cs @@ -2804,6 +2804,18 @@ public virtual IntPtr ISteamApps_GetLaunchQueryParam( string /*const char **/ pc Native.SteamAPI_ISteamController_TriggerRepeatedHapticPulse(_ptr, controllerHandle, eTargetPad, usDurationMicroSec, usOffMicroSec, unRepeat, nFlags); } + public virtual void /*void*/ ISteamController_TriggerVibration( ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); + + Native.SteamAPI_ISteamController_TriggerVibration(_ptr, controllerHandle, usLeftSpeed, usRightSpeed); + } + public virtual void /*void*/ ISteamController_SetLEDColor( ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); + + Native.SteamAPI_ISteamController_SetLEDColor(_ptr, controllerHandle, nColorR, nColorG, nColorB, nFlags); + } public virtual int /*int*/ ISteamController_GetGamepadIndexForController( ulong ulControllerHandle ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); @@ -2834,6 +2846,18 @@ public virtual IntPtr ISteamApps_GetLaunchQueryParam( string /*const char **/ pc return Native.SteamAPI_ISteamController_ShowAnalogActionOrigins(_ptr, controllerHandle, analogActionHandle, flScale, flXPosition, flYPosition); } + public virtual IntPtr ISteamController_GetStringForActionOrigin( ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); + + return Native.SteamAPI_ISteamController_GetStringForActionOrigin(_ptr, eOrigin); + } + public virtual IntPtr ISteamController_GetGlyphForActionOrigin( ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); + + return Native.SteamAPI_ISteamController_GetGlyphForActionOrigin(_ptr, eOrigin); + } public virtual UGCQueryHandle_t /*(UGCQueryHandle_t)*/ ISteamUGC_CreateQueryUserUGCRequest( uint unAccountID, UserUGCList /*EUserUGCList*/ eListType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingUGCType, UserUGCListSortOrder /*EUserUGCListSortOrder*/ eSortOrder, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ) { @@ -3618,6 +3642,18 @@ public virtual IntPtr ISteamApps_GetLaunchQueryParam( string /*const char **/ pc return Native.SteamAPI_ISteamInventory_GetItemDefinitionProperty(_ptr, iDefinition, pchPropertyName, pchValueBuffer, out punValueBufferSizeOut); } + public virtual SteamAPICall_t /*(SteamAPICall_t)*/ ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( ulong steamID ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamInventory _ptr is null!" ); + + return Native.SteamAPI_ISteamInventory_RequestEligiblePromoItemDefinitionsIDs(_ptr, steamID); + } + public virtual bool /*bool*/ ISteamInventory_GetEligiblePromoItemDefinitionIDs( ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamInventory _ptr is null!" ); + + return Native.SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs(_ptr, steamID, pItemDefIDs, out punItemDefIDsArraySize); + } public virtual void /*void*/ ISteamVideo_GetVideoURL( uint unVideoAppID ) { @@ -4540,11 +4576,15 @@ internal static unsafe class Native [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_StopAnalogActionMomentum( IntPtr ISteamController, ulong controllerHandle, ulong eAction ); [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec ); [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerRepeatedHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec, ushort /*unsigned short*/ usOffMicroSec, ushort /*unsigned short*/ unRepeat, uint /*unsigned int*/ nFlags ); + [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerVibration( IntPtr ISteamController, ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ); + [DllImportAttribute( "libsteam_api.dylib" )] internal static extern void /*void*/ SteamAPI_ISteamController_SetLEDColor( IntPtr ISteamController, ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ); [DllImportAttribute( "libsteam_api.dylib" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetGamepadIndexForController( IntPtr ISteamController, ulong ulControllerHandle ); [DllImportAttribute( "libsteam_api.dylib" )] internal static extern ControllerHandle_t /*(ControllerHandle_t)*/ SteamAPI_ISteamController_GetControllerForGamepadIndex( IntPtr ISteamController, int /*int*/ nIndex ); [DllImportAttribute( "libsteam_api.dylib" )] internal static extern ControllerMotionData_t /*struct ControllerMotionData_t*/ SteamAPI_ISteamController_GetMotionData( IntPtr ISteamController, ulong controllerHandle ); [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); + [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamController_GetStringForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); + [DllImportAttribute( "libsteam_api.dylib" )] internal static extern IntPtr SteamAPI_ISteamController_GetGlyphForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); // // ISteamUGC @@ -4690,6 +4730,8 @@ internal static unsafe class Native [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_LoadItemDefinitions( IntPtr ISteamInventory ); [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionIDs( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionProperty( IntPtr ISteamInventory, int iDefinition, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); + [DllImportAttribute( "libsteam_api.dylib" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( IntPtr ISteamInventory, ulong steamID ); + [DllImportAttribute( "libsteam_api.dylib" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs( IntPtr ISteamInventory, ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); // // ISteamVideo diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win32.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win32.cs index 1b02dec..13818df 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win32.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win32.cs @@ -2776,6 +2776,18 @@ public virtual IntPtr ISteamApps_GetLaunchQueryParam( string /*const char **/ pc Native.SteamAPI_ISteamController_TriggerRepeatedHapticPulse(_ptr, controllerHandle, eTargetPad, usDurationMicroSec, usOffMicroSec, unRepeat, nFlags); } + public virtual void /*void*/ ISteamController_TriggerVibration( ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); + + Native.SteamAPI_ISteamController_TriggerVibration(_ptr, controllerHandle, usLeftSpeed, usRightSpeed); + } + public virtual void /*void*/ ISteamController_SetLEDColor( ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); + + Native.SteamAPI_ISteamController_SetLEDColor(_ptr, controllerHandle, nColorR, nColorG, nColorB, nFlags); + } public virtual int /*int*/ ISteamController_GetGamepadIndexForController( ulong ulControllerHandle ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); @@ -2806,6 +2818,18 @@ public virtual IntPtr ISteamApps_GetLaunchQueryParam( string /*const char **/ pc return Native.SteamAPI_ISteamController_ShowAnalogActionOrigins(_ptr, controllerHandle, analogActionHandle, flScale, flXPosition, flYPosition); } + public virtual IntPtr ISteamController_GetStringForActionOrigin( ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); + + return Native.SteamAPI_ISteamController_GetStringForActionOrigin(_ptr, eOrigin); + } + public virtual IntPtr ISteamController_GetGlyphForActionOrigin( ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); + + return Native.SteamAPI_ISteamController_GetGlyphForActionOrigin(_ptr, eOrigin); + } public virtual UGCQueryHandle_t /*(UGCQueryHandle_t)*/ ISteamUGC_CreateQueryUserUGCRequest( uint unAccountID, UserUGCList /*EUserUGCList*/ eListType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingUGCType, UserUGCListSortOrder /*EUserUGCListSortOrder*/ eSortOrder, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ) { @@ -3584,6 +3608,18 @@ public virtual IntPtr ISteamApps_GetLaunchQueryParam( string /*const char **/ pc return Native.SteamAPI_ISteamInventory_GetItemDefinitionProperty(_ptr, iDefinition, pchPropertyName, pchValueBuffer, out punValueBufferSizeOut); } + public virtual SteamAPICall_t /*(SteamAPICall_t)*/ ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( ulong steamID ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamInventory _ptr is null!" ); + + return Native.SteamAPI_ISteamInventory_RequestEligiblePromoItemDefinitionsIDs(_ptr, steamID); + } + public virtual bool /*bool*/ ISteamInventory_GetEligiblePromoItemDefinitionIDs( ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamInventory _ptr is null!" ); + + return Native.SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs(_ptr, steamID, pItemDefIDs, out punItemDefIDsArraySize); + } public virtual void /*void*/ ISteamVideo_GetVideoURL( uint unVideoAppID ) { @@ -4506,11 +4542,15 @@ internal static unsafe class Native [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_StopAnalogActionMomentum( IntPtr ISteamController, ulong controllerHandle, ulong eAction ); [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec ); [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerRepeatedHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec, ushort /*unsigned short*/ usOffMicroSec, ushort /*unsigned short*/ unRepeat, uint /*unsigned int*/ nFlags ); + [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerVibration( IntPtr ISteamController, ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ); + [DllImportAttribute( "steam_api.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_SetLEDColor( IntPtr ISteamController, ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ); [DllImportAttribute( "steam_api.dll" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetGamepadIndexForController( IntPtr ISteamController, ulong ulControllerHandle ); [DllImportAttribute( "steam_api.dll" )] internal static extern ControllerHandle_t /*(ControllerHandle_t)*/ SteamAPI_ISteamController_GetControllerForGamepadIndex( IntPtr ISteamController, int /*int*/ nIndex ); [DllImportAttribute( "steam_api.dll" )] internal static extern ControllerMotionData_t /*struct ControllerMotionData_t*/ SteamAPI_ISteamController_GetMotionData( IntPtr ISteamController, ulong controllerHandle ); [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); + [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamController_GetStringForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); + [DllImportAttribute( "steam_api.dll" )] internal static extern IntPtr SteamAPI_ISteamController_GetGlyphForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); // // ISteamUGC @@ -4656,6 +4696,8 @@ internal static unsafe class Native [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_LoadItemDefinitions( IntPtr ISteamInventory ); [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionIDs( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionProperty( IntPtr ISteamInventory, int iDefinition, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); + [DllImportAttribute( "steam_api.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( IntPtr ISteamInventory, ulong steamID ); + [DllImportAttribute( "steam_api.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs( IntPtr ISteamInventory, ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); // // ISteamVideo diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win64.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win64.cs index d3d7fee..fe1c31a 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win64.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Platform.Win64.cs @@ -2776,6 +2776,18 @@ public virtual IntPtr ISteamApps_GetLaunchQueryParam( string /*const char **/ pc Native.SteamAPI_ISteamController_TriggerRepeatedHapticPulse(_ptr, controllerHandle, eTargetPad, usDurationMicroSec, usOffMicroSec, unRepeat, nFlags); } + public virtual void /*void*/ ISteamController_TriggerVibration( ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); + + Native.SteamAPI_ISteamController_TriggerVibration(_ptr, controllerHandle, usLeftSpeed, usRightSpeed); + } + public virtual void /*void*/ ISteamController_SetLEDColor( ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); + + Native.SteamAPI_ISteamController_SetLEDColor(_ptr, controllerHandle, nColorR, nColorG, nColorB, nFlags); + } public virtual int /*int*/ ISteamController_GetGamepadIndexForController( ulong ulControllerHandle ) { if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); @@ -2806,6 +2818,18 @@ public virtual IntPtr ISteamApps_GetLaunchQueryParam( string /*const char **/ pc return Native.SteamAPI_ISteamController_ShowAnalogActionOrigins(_ptr, controllerHandle, analogActionHandle, flScale, flXPosition, flYPosition); } + public virtual IntPtr ISteamController_GetStringForActionOrigin( ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); + + return Native.SteamAPI_ISteamController_GetStringForActionOrigin(_ptr, eOrigin); + } + public virtual IntPtr ISteamController_GetGlyphForActionOrigin( ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamController _ptr is null!" ); + + return Native.SteamAPI_ISteamController_GetGlyphForActionOrigin(_ptr, eOrigin); + } public virtual UGCQueryHandle_t /*(UGCQueryHandle_t)*/ ISteamUGC_CreateQueryUserUGCRequest( uint unAccountID, UserUGCList /*EUserUGCList*/ eListType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingUGCType, UserUGCListSortOrder /*EUserUGCListSortOrder*/ eSortOrder, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage ) { @@ -3584,6 +3608,18 @@ public virtual IntPtr ISteamApps_GetLaunchQueryParam( string /*const char **/ pc return Native.SteamAPI_ISteamInventory_GetItemDefinitionProperty(_ptr, iDefinition, pchPropertyName, pchValueBuffer, out punValueBufferSizeOut); } + public virtual SteamAPICall_t /*(SteamAPICall_t)*/ ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( ulong steamID ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamInventory _ptr is null!" ); + + return Native.SteamAPI_ISteamInventory_RequestEligiblePromoItemDefinitionsIDs(_ptr, steamID); + } + public virtual bool /*bool*/ ISteamInventory_GetEligiblePromoItemDefinitionIDs( ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ) + { + if ( _ptr == IntPtr.Zero ) throw new System.Exception( "ISteamInventory _ptr is null!" ); + + return Native.SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs(_ptr, steamID, pItemDefIDs, out punItemDefIDsArraySize); + } public virtual void /*void*/ ISteamVideo_GetVideoURL( uint unVideoAppID ) { @@ -4506,11 +4542,15 @@ internal static unsafe class Native [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_StopAnalogActionMomentum( IntPtr ISteamController, ulong controllerHandle, ulong eAction ); [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec ); [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerRepeatedHapticPulse( IntPtr ISteamController, ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec, ushort /*unsigned short*/ usOffMicroSec, ushort /*unsigned short*/ unRepeat, uint /*unsigned int*/ nFlags ); + [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_TriggerVibration( IntPtr ISteamController, ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed ); + [DllImportAttribute( "steam_api64.dll" )] internal static extern void /*void*/ SteamAPI_ISteamController_SetLEDColor( IntPtr ISteamController, ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags ); [DllImportAttribute( "steam_api64.dll" )] internal static extern int /*int*/ SteamAPI_ISteamController_GetGamepadIndexForController( IntPtr ISteamController, ulong ulControllerHandle ); [DllImportAttribute( "steam_api64.dll" )] internal static extern ControllerHandle_t /*(ControllerHandle_t)*/ SteamAPI_ISteamController_GetControllerForGamepadIndex( IntPtr ISteamController, int /*int*/ nIndex ); [DllImportAttribute( "steam_api64.dll" )] internal static extern ControllerMotionData_t /*struct ControllerMotionData_t*/ SteamAPI_ISteamController_GetMotionData( IntPtr ISteamController, ulong controllerHandle ); [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowDigitalActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong digitalActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamController_ShowAnalogActionOrigins( IntPtr ISteamController, ulong controllerHandle, ulong analogActionHandle, float /*float*/ flScale, float /*float*/ flXPosition, float /*float*/ flYPosition ); + [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamController_GetStringForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); + [DllImportAttribute( "steam_api64.dll" )] internal static extern IntPtr SteamAPI_ISteamController_GetGlyphForActionOrigin( IntPtr ISteamController, ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin ); // // ISteamUGC @@ -4656,6 +4696,8 @@ internal static unsafe class Native [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_LoadItemDefinitions( IntPtr ISteamInventory ); [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionIDs( IntPtr ISteamInventory, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetItemDefinitionProperty( IntPtr ISteamInventory, int iDefinition, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut ); + [DllImportAttribute( "steam_api64.dll" )] internal static extern SteamAPICall_t /*(SteamAPICall_t)*/ SteamAPI_ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( IntPtr ISteamInventory, ulong steamID ); + [DllImportAttribute( "steam_api64.dll" )] internal static extern bool /*bool*/ SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs( IntPtr ISteamInventory, ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize ); // // ISteamVideo diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.SteamController.cs b/Facepunch.Steamworks/SteamNative/SteamNative.SteamController.cs index 9ce480d..5b6c933 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.SteamController.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.SteamController.cs @@ -114,12 +114,30 @@ public int GetGamepadIndexForController( ControllerHandle_t ulControllerHandle / return platform.ISteamController_GetGamepadIndexForController( ulControllerHandle.Value ); } + // string + // with: Detect_StringReturn + public string GetGlyphForActionOrigin( ControllerActionOrigin eOrigin /*EControllerActionOrigin*/ ) + { + IntPtr string_pointer; + string_pointer = platform.ISteamController_GetGlyphForActionOrigin( eOrigin ); + return Marshal.PtrToStringAnsi( string_pointer ); + } + // ControllerMotionData_t public ControllerMotionData_t GetMotionData( ControllerHandle_t controllerHandle /*ControllerHandle_t*/ ) { return platform.ISteamController_GetMotionData( controllerHandle.Value ); } + // string + // with: Detect_StringReturn + public string GetStringForActionOrigin( ControllerActionOrigin eOrigin /*EControllerActionOrigin*/ ) + { + IntPtr string_pointer; + string_pointer = platform.ISteamController_GetStringForActionOrigin( eOrigin ); + return Marshal.PtrToStringAnsi( string_pointer ); + } + // bool public bool Init() { @@ -132,6 +150,12 @@ public void RunFrame() platform.ISteamController_RunFrame(); } + // void + public void SetLEDColor( ControllerHandle_t controllerHandle /*ControllerHandle_t*/, byte nColorR /*uint8*/, byte nColorG /*uint8*/, byte nColorB /*uint8*/, uint nFlags /*unsigned int*/ ) + { + platform.ISteamController_SetLEDColor( controllerHandle.Value, nColorR, nColorG, nColorB, nFlags ); + } + // bool public bool ShowAnalogActionOrigins( ControllerHandle_t controllerHandle /*ControllerHandle_t*/, ControllerAnalogActionHandle_t analogActionHandle /*ControllerAnalogActionHandle_t*/, float flScale /*float*/, float flXPosition /*float*/, float flYPosition /*float*/ ) { @@ -174,5 +198,11 @@ public void TriggerRepeatedHapticPulse( ControllerHandle_t controllerHandle /*Co platform.ISteamController_TriggerRepeatedHapticPulse( controllerHandle.Value, eTargetPad, usDurationMicroSec, usOffMicroSec, unRepeat, nFlags ); } + // void + public void TriggerVibration( ControllerHandle_t controllerHandle /*ControllerHandle_t*/, ushort usLeftSpeed /*unsigned short*/, ushort usRightSpeed /*unsigned short*/ ) + { + platform.ISteamController_TriggerVibration( controllerHandle.Value, usLeftSpeed, usRightSpeed ); + } + } } diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.SteamInventory.cs b/Facepunch.Steamworks/SteamNative/SteamNative.SteamInventory.cs index 63646c0..279132b 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.SteamInventory.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.SteamInventory.cs @@ -96,6 +96,25 @@ public bool GetAllItems( ref SteamInventoryResult_t pResultHandle /*SteamInvento return platform.ISteamInventory_GetAllItems( ref pResultHandle.Value ); } + // bool + // using: Detect_MultiSizeArrayReturn + public SteamItemDef_t[] GetEligiblePromoItemDefinitionIDs( CSteamID steamID /*class CSteamID*/ ) + { + uint punItemDefIDsArraySize = 0; + + bool success = false; + success = platform.ISteamInventory_GetEligiblePromoItemDefinitionIDs( steamID.Value, IntPtr.Zero, out punItemDefIDsArraySize ); + if ( !success || punItemDefIDsArraySize == 0) return null; + + var pItemDefIDs = new SteamItemDef_t[punItemDefIDsArraySize]; + fixed ( void* pItemDefIDs_ptr = pItemDefIDs ) + { + success = platform.ISteamInventory_GetEligiblePromoItemDefinitionIDs( steamID.Value, (IntPtr) pItemDefIDs_ptr, out punItemDefIDsArraySize ); + if ( !success ) return null; + return pItemDefIDs; + } + } + // bool // using: Detect_MultiSizeArrayReturn public SteamItemDef_t[] GetItemDefinitionIDs() @@ -178,6 +197,17 @@ public bool LoadItemDefinitions() return platform.ISteamInventory_LoadItemDefinitions(); } + // SteamAPICall_t + public CallbackHandle RequestEligiblePromoItemDefinitionsIDs( CSteamID steamID /*class CSteamID*/, Action CallbackFunction = null /*Action*/ ) + { + SteamAPICall_t callback = 0; + callback = platform.ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( steamID.Value ); + + if ( CallbackFunction == null ) return null; + + return SteamInventoryEligiblePromoItemDefIDs_t.CallResult( steamworks, callback, CallbackFunction ); + } + // void public void SendItemDropHeartbeat() { diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.Structs.cs b/Facepunch.Steamworks/SteamNative/SteamNative.Structs.cs index b8d0141..ac749b3 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.Structs.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.Structs.cs @@ -15990,6 +15990,128 @@ public static void RegisterCallback( Facepunch.Steamworks.BaseSteamworks steamwo } } + [StructLayout( LayoutKind.Sequential, Pack = 4 )] + internal struct SteamInventoryEligiblePromoItemDefIDs_t + { + public const int CallbackId = CallbackIdentifiers.ClientInventory + 3; + public Result Esult; // m_result enum EResult + public ulong SteamID; // m_steamID class CSteamID + public int UmEligiblePromoItemDefs; // m_numEligiblePromoItemDefs int + [MarshalAs(UnmanagedType.I1)] + public bool CachedData; // m_bCachedData _Bool + + // + // Read this struct from a pointer, usually from Native. It will automatically do the awesome stuff. + // + public static SteamInventoryEligiblePromoItemDefIDs_t FromPointer( IntPtr p ) + { + if ( Platform.PackSmall ) return (PackSmall) Marshal.PtrToStructure( p, typeof(PackSmall) ); + return (SteamInventoryEligiblePromoItemDefIDs_t) Marshal.PtrToStructure( p, typeof(SteamInventoryEligiblePromoItemDefIDs_t) ); + } + + [StructLayout( LayoutKind.Sequential, Pack = 4 )] + internal struct PackSmall + { + public Result Esult; // m_result enum EResult + public ulong SteamID; // m_steamID class CSteamID + public int UmEligiblePromoItemDefs; // m_numEligiblePromoItemDefs int + [MarshalAs(UnmanagedType.I1)] + public bool CachedData; // m_bCachedData _Bool + + // + // Easily convert from PackSmall to SteamInventoryEligiblePromoItemDefIDs_t + // + public static implicit operator SteamInventoryEligiblePromoItemDefIDs_t ( SteamInventoryEligiblePromoItemDefIDs_t.PackSmall d ) + { + return new SteamInventoryEligiblePromoItemDefIDs_t() + { + Esult = d.Esult, + SteamID = d.SteamID, + UmEligiblePromoItemDefs = d.UmEligiblePromoItemDefs, + CachedData = d.CachedData, + }; + } + } + + public static CallbackHandle CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action CallbackFunction ) + { + var handle = new CallbackHandle(); + handle.steamworks = steamworks; + handle.CallResultHandle = call; + handle.CallResult = true; + + // + // Create the functions we need for the vtable + // + Callback.Result funcA = ( _, p ) => { handle.Dispose(); CallbackFunction( FromPointer( p ), false ); }; + Callback.ResultWithInfo funcB = ( _, p, bIOFailure, hSteamAPICall ) => + { + if ( hSteamAPICall != call ) return; + + handle.CallResultHandle = 0; + handle.Dispose(); + + CallbackFunction( FromPointer( p ), bIOFailure ); + }; + Callback.GetSize funcC = ( _ ) => { return Marshal.SizeOf( typeof( SteamInventoryEligiblePromoItemDefIDs_t ) ); }; + + // + // If this platform is PackSmall, use PackSmall versions of everything instead + // + if ( Platform.PackSmall ) + { + funcC = ( _ ) => { return Marshal.SizeOf( typeof( PackSmall ) ); }; + } + + // + // Allocate a handle to each function, so they don't get disposed + // + handle.FuncA = GCHandle.Alloc( funcA ); + handle.FuncB = GCHandle.Alloc( funcB ); + handle.FuncC = GCHandle.Alloc( funcC ); + + // + // Create the VTable by manually allocating the memory and copying across + // + handle.vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) ); + var vTable = new Callback.VTable() + { + ResultA = Marshal.GetFunctionPointerForDelegate( funcA ), + ResultB = Marshal.GetFunctionPointerForDelegate( funcB ), + GetSize = Marshal.GetFunctionPointerForDelegate( funcC ), + }; + // + // The order of these functions are swapped on Windows + // + if ( Platform.IsWindows ) + { + vTable.ResultA = Marshal.GetFunctionPointerForDelegate( funcB ); + vTable.ResultB = Marshal.GetFunctionPointerForDelegate( funcA ); + } + Marshal.StructureToPtr( vTable, handle.vTablePtr, false ); + + // + // Create the callback object + // + var cb = new Callback(); + cb.vTablePtr = handle.vTablePtr; + cb.CallbackFlags = steamworks.IsGameServer ? (byte) SteamNative.Callback.Flags.GameServer : (byte) 0; + cb.CallbackId = CallbackId; + + // + // Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native + // + handle.PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned ); + + // + // Register the callback with Steam + // + steamworks.native.api.SteamAPI_RegisterCallResult( handle.PinnedCallback.AddrOfPinnedObject(), call ); + + return handle; + } + } + [StructLayout( LayoutKind.Sequential, Pack = 8 )] internal struct BroadcastUploadStop_t { diff --git a/Generator/CodeWriter/CodeWriter.cs b/Generator/CodeWriter/CodeWriter.cs index 813ca34..347537f 100644 --- a/Generator/CodeWriter/CodeWriter.cs +++ b/Generator/CodeWriter/CodeWriter.cs @@ -100,13 +100,6 @@ public void ToFolder( string folder ) System.IO.File.WriteAllText( $"{folder}SteamNative.Platform.Mac.cs", sb.ToString() ); } - { - sb = new StringBuilder(); - Header( "Facepunch.SteamApi" ); - Footer(); - System.IO.File.WriteAllText( $"{folder}SteamApi.cs", sb.ToString() ); - } - { GenerateClasses( $"{folder}SteamNative." ); }