2020#endif
2121
2222#include < iostream>
23+ #include < string>
2324
2425// Enumerated constants /////////////////////////
2526enum {
@@ -272,21 +273,21 @@ SW_PY void GetFileDetails(const char* filename){
272273// ///////////////////////////////////////////////
273274//
274275// Reconfigure the controller to use the specified action set.
275- void ActivateActionSet (uint64_t controllerHandle, uint64_t actionSetHandle){
276+ SW_PY void ActivateActionSet (uint64_t controllerHandle, uint64_t actionSetHandle){
276277 if (SteamController () == NULL ){
277278 return ;
278279 }
279280 SteamController ()->ActivateActionSet ((ControllerHandle_t)controllerHandle, (ControllerActionSetHandle_t)actionSetHandle);
280281}
281282// Lookup the handle for an Action Set.
282- uint64_t GetActionSetHandle (const char *actionSetName){
283+ SW_PY uint64_t GetActionSetHandle (const char *actionSetName){
283284 if (SteamController () == NULL ){
284285 return 0 ;
285286 }
286287 return (uint64_t )SteamController ()->GetActionSetHandle (actionSetName);
287288}
288289// Returns the current state of the supplied analog game action.
289- // Dictionary GetAnalogActionData(uint64_t controllerHandle, uint64_t analogActionHandle){
290+ // SW_PY Dictionary GetAnalogActionData(uint64_t controllerHandle, uint64_t analogActionHandle){
290291// ControllerAnalogActionData_t data;
291292// Dictionary d;
292293// memset(&data, 0, sizeof(data));
@@ -300,14 +301,14 @@ uint64_t GetActionSetHandle(const char *actionSetName){
300301// return d;
301302// }
302303// Get the handle of the specified Analog action.
303- uint64_t GetAnalogActionHandle (const char *actionName){
304+ SW_PY uint64_t GetAnalogActionHandle (const char *actionName){
304305 if (SteamController () == NULL ){
305306 return 0 ;
306307 }
307308 return (uint64_t )SteamController ()->GetAnalogActionHandle (actionName);
308309}
309310// Get the origin(s) for an analog action within an action.
310- // Array GetAnalogActionOrigins(uint64_t controllerHandle, uint64_t actionSetHandle, uint64_t analogActionHandle){
311+ // SW_PY Array GetAnalogActionOrigins(uint64_t controllerHandle, uint64_t actionSetHandle, uint64_t analogActionHandle){
311312// Array list;
312313// if(SteamController() == NULL){
313314// EControllerActionOrigin out[STEAM_CONTROLLER_MAX_ORIGINS];
@@ -319,7 +320,7 @@ uint64_t GetAnalogActionHandle(const char *actionName){
319320// return list;
320321// }
321322// Get current controllers handles.
322- // Array GetConnectedControllers(){
323+ // SW_PY Array GetConnectedControllers(){
323324// Array list;
324325// if(SteamController() == NULL){
325326// ControllerHandle_t handles[STEAM_CONTROLLER_MAX_COUNT];
@@ -331,29 +332,29 @@ uint64_t GetAnalogActionHandle(const char *actionName){
331332// return list;
332333// }
333334// Returns the associated controller handle for the specified emulated gamepad.
334- uint64_t GetControllerForGamepadIndex (int index){
335+ SW_PY uint64_t GetControllerForGamepadIndex (int index){
335336 if (SteamController () == NULL ){
336337 return 0 ;
337338 }
338339 return (uint64_t )SteamController ()->GetControllerForGamepadIndex (index);
339340}
340341// Get the currently active action set for the specified controller.
341- uint64_t GetCurrentActionSet (uint64_t controllerHandle){
342+ SW_PY uint64_t GetCurrentActionSet (uint64_t controllerHandle){
342343 if (SteamController () == NULL ){
343344 return 0 ;
344345 }
345346 return (uint64_t )SteamController ()->GetCurrentActionSet ((ControllerHandle_t)controllerHandle);
346347}
347348// Get the input type (device model) for the specified controller.
348- uint64_t GetInputTypeForHandle (uint64_t controllerHandle){
349+ SW_PY uint64_t GetInputTypeForHandle (uint64_t controllerHandle){
349350 if (SteamController () == NULL ){
350351 return 0 ;
351352
352353 }
353354 return (uint64_t )SteamController ()->GetInputTypeForHandle ((ControllerHandle_t)controllerHandle);
354355}
355356// Returns the current state of the supplied digital game action.
356- // Dictionary GetDigitalActionData(uint64_t controllerHandle, uint64_t digitalActionHandle){
357+ // SW_PY Dictionary GetDigitalActionData(uint64_t controllerHandle, uint64_t digitalActionHandle){
357358// ControllerDigitalActionData_t data;
358359// Dictionary d;
359360// memset(&data, 0, sizeof(data));
@@ -365,14 +366,14 @@ uint64_t GetInputTypeForHandle(uint64_t controllerHandle){
365366// return d;
366367// }
367368// Get the handle of the specified digital action.
368- uint64_t GetDigitalActionHandle (const char *actionName){
369+ SW_PY uint64_t GetDigitalActionHandle (const char *actionName){
369370 if (SteamController () == NULL ){
370371 return 0 ;
371372 }
372373 return (uint64_t )SteamController ()->GetDigitalActionHandle (actionName);
373374}
374375// Get the origin(s) for an analog action within an action.
375- // Array GetDigitalActionOrigins(uint64_t controllerHandle, uint64_t actionSetHandle, uint64_t digitalActionHandle){
376+ // SW_PY Array GetDigitalActionOrigins(uint64_t controllerHandle, uint64_t actionSetHandle, uint64_t digitalActionHandle){
376377// Array list;
377378// if(SteamController() == NULL){
378379// EControllerActionOrigin out[STEAM_CONTROLLER_MAX_ORIGINS];
@@ -384,14 +385,14 @@ uint64_t GetDigitalActionHandle(const char *actionName){
384385// return list;
385386// }
386387// Returns the associated gamepad index for the specified controller.
387- int GetGamepadIndexForController (uint64_t controllerHandle){
388+ SW_PY int GetGamepadIndexForController (uint64_t controllerHandle){
388389 if (SteamController () == NULL ){
389390 return -1 ;
390391 }
391392 return SteamController ()->GetGamepadIndexForController ((ControllerHandle_t)controllerHandle);
392393}
393394// Returns raw motion data for the specified controller.
394- // Dictionary GetMotionData(uint64_t controllerHandle){
395+ // SW_PY Dictionary GetMotionData(uint64_t controllerHandle){
395396// ControllerMotionData_t data;
396397// Dictionary d;
397398// memset(&data, 0, sizeof(data));
@@ -411,34 +412,34 @@ int GetGamepadIndexForController(uint64_t controllerHandle){
411412// return d;
412413// }
413414// Start SteamControllers interface.
414- bool ControllerInit (){
415+ SW_PY bool ControllerInit (){
415416 if (SteamController () == NULL ){
416417 return false ;
417418 }
418419 return SteamController ()->Init ();
419420}
420421// Syncronize controllers.
421- void RunFrame (){
422+ SW_PY void RunFrame (){
422423 if (SteamController () == NULL ){
423424 return ;
424425 }
425426 SteamController ()->RunFrame ();
426427}
427428// Invokes the Steam overlay and brings up the binding screen.
428- bool ShowBindingPanel (uint64_t controllerHandle){
429+ SW_PY bool ShowBindingPanel (uint64_t controllerHandle){
429430 if (SteamController () == NULL ){
430431 return false ;
431432 }
432433 return SteamController ()->ShowBindingPanel ((ControllerHandle_t)controllerHandle);
433434}
434435// Stop SteamControllers interface.
435- bool ControllerShutdown (){
436+ SW_PY bool ControllerShutdown (){
436437 if (SteamController () == NULL ){
437438 return false ;
438439 }
439440 return SteamController ()->Shutdown ();
440441}
441- // Trigger a vibration event on supported controllers.
442+ SW_PY // Trigger a vibration event on supported controllers.
442443void TriggerVibration (uint64_t controllerHandle, uint16_t leftSpeed, uint16_t rightSpeed){
443444 if (SteamController () == NULL ){
444445 return ;
@@ -548,6 +549,186 @@ SW_PY void TriggerScreenshot(){
548549 SteamScreenshots ()->TriggerScreenshot ();
549550}
550551
552+ // ///////////////////////////////////////////////
553+ // /// UGC ///////////////////////////////////////
554+ // ///////////////////////////////////////////////
555+ //
556+ // Download new or update already installed item. If returns true, wait for DownloadItemResult_t. If item is already installed, then files on disk should not be used until callback received.
557+ // If item is not subscribed to, it will be cached for some time. If bHighPriority is set, any other item download will be suspended and this item downloaded ASAP.
558+ SW_PY bool DownloadItem (int publishedFileID, bool highPriority){
559+ if (SteamUGC () == NULL ){
560+ return 0 ;
561+ }
562+ PublishedFileId_t fileID = (int )publishedFileID;
563+ return SteamUGC ()->DownloadItem (fileID, highPriority);
564+ }
565+ // SuspendDownloads( true ) will suspend all workshop downloads until SuspendDownloads( false ) is called or the game ends.
566+ SW_PY void SuspendDownloads (bool suspend){
567+ return SteamUGC ()->SuspendDownloads (suspend);
568+ }
569+ // Starts the item update process.
570+ SW_PY uint64_t StartItemUpdate (AppId_t appID, int publishedFileID){
571+ PublishedFileId_t fileID = (int )publishedFileID;
572+ return SteamUGC ()->StartItemUpdate (appID, fileID);
573+ }
574+ // Gets the current state of a workshop item on this client.
575+ SW_PY int GetItemState (int publishedFileID){
576+ if (SteamUGC () == NULL ){
577+ return 0 ;
578+ }
579+ PublishedFileId_t fileID = (int )publishedFileID;
580+ return SteamUGC ()->GetItemState (fileID);
581+ }
582+ // Creating a workshop item
583+ SW_PY void CreateItem (AppId_t appID, int fileType){
584+ if (SteamUGC () == NULL ){
585+ return ;
586+ }
587+ EWorkshopFileType workshopType;
588+ // Convert the file type back over.
589+ if (fileType == UGC_ITEM_MAX){
590+ workshopType = k_EWorkshopFileTypeMax;
591+ }
592+ else if (fileType == UGC_ITEM_MICROTRANSACTION){
593+ workshopType = k_EWorkshopFileTypeMicrotransaction;
594+ }
595+ else if (fileType == UGC_ITEM_COLLECTION){
596+ workshopType = k_EWorkshopFileTypeCollection;
597+ }
598+ else if (fileType == UGC_ITEM_ART){
599+ workshopType = k_EWorkshopFileTypeArt;
600+ }
601+ else if (fileType == UGC_ITEM_VIDEO){
602+ workshopType = k_EWorkshopFileTypeVideo;
603+ }
604+ else if (fileType == UGC_ITEM_SCREENSHOT){
605+ workshopType = k_EWorkshopFileTypeScreenshot;
606+ }
607+ else if (fileType == UGC_ITEM_GAME){
608+ workshopType = k_EWorkshopFileTypeGame;
609+ }
610+ else if (fileType == UGC_ITEM_SOFTWARE){
611+ workshopType = k_EWorkshopFileTypeSoftware;
612+ }
613+ else if (fileType == UGC_ITEM_CONCEPT){
614+ workshopType = k_EWorkshopFileTypeConcept;
615+ }
616+ else if (fileType == UGC_ITEM_WEBGUIDE){
617+ workshopType = k_EWorkshopFileTypeWebGuide;
618+ }
619+ else if (fileType == UGC_ITEM_INTEGRATEDGUIDE){
620+ workshopType = k_EWorkshopFileTypeIntegratedGuide;
621+ }
622+ else if (fileType == UGC_ITEM_MERCH){
623+ workshopType = k_EWorkshopFileTypeMerch;
624+ }
625+ else if (fileType == UGC_ITEM_CONTROLLERBINDING){
626+ workshopType = k_EWorkshopFileTypeControllerBinding;
627+ }
628+ else if (fileType == UGC_ITEM_STEAMWORKSACCESSINVITE){
629+ workshopType = k_EWorkshopFileTypeSteamworksAccessInvite;
630+ }
631+ else if (fileType == UGC_ITEM_STEAMVIDEO){
632+ workshopType = k_EWorkshopFileTypeSteamVideo;
633+ }
634+ else if (fileType == UGC_ITEM_GAMEMANAGEDITEM){
635+ workshopType = k_EWorkshopFileTypeGameManagedItem;
636+ }
637+ else {
638+ workshopType = k_EWorkshopFileTypeCommunity;
639+ }
640+ // Callbacks must be functional
641+ // SteamAPICall_t apiCall = SteamUGC()->CreateItem(appID, workshopType);
642+ // callResultItemCreate.Set(apiCall, this, &_item_created);
643+ }
644+ // Sets a new title for an item.
645+ SW_PY bool SetItemTitle (uint64_t updateHandle, const char *title){
646+ if (SteamUGC () == NULL ){
647+ return false ;
648+ }
649+ if (strlen (title) > UGC_MAX_TITLE_CHARS){
650+ printf (" Title cannot have more than %ld ASCII characters. Title not set." , UGC_MAX_TITLE_CHARS);
651+ return false ;
652+ }
653+ UGCUpdateHandle_t handle = uint64 (updateHandle);
654+ return SteamUGC ()->SetItemTitle (handle, title);
655+ }
656+ // Sets a new description for an item.
657+ SW_PY bool SetItemDescription (uint64_t updateHandle, const char *description){
658+ if (SteamUGC () == NULL ){
659+ return false ;
660+ }
661+ if (strlen (description) > UGC_MAX_DESC_CHARS){
662+ printf (" Description cannot have more than %ld ASCII characters. Description not set." , UGC_MAX_DESC_CHARS);
663+ return false ;
664+ }
665+ UGCUpdateHandle_t handle = uint64 (updateHandle);
666+ return SteamUGC ()->SetItemDescription (handle, description);
667+ }
668+ // Sets the language of the title and description that will be set in this item update.
669+ SW_PY bool SetItemUpdateLanguage (uint64_t updateHandle, const char *language){
670+ if (SteamUGC () == NULL ){
671+ return false ;
672+ }
673+ UGCUpdateHandle_t handle = uint64 (updateHandle);
674+ return SteamUGC ()->SetItemUpdateLanguage (handle, language);
675+ }
676+ // Sets arbitrary metadata for an item. This metadata can be returned from queries without having to download and install the actual content.
677+ SW_PY bool SetItemMetadata (uint64_t updateHandle, const char *metadata){
678+ if (SteamUGC () == NULL ){
679+ return false ;
680+ }
681+ if (strlen (metadata) > UGC_MAX_METADATA_CHARS){
682+ printf (" Metadata cannot have more than %ld ASCII characters. Metadata not set." , UGC_MAX_METADATA_CHARS);
683+ }
684+ UGCUpdateHandle_t handle = uint64 (updateHandle);
685+ return SteamUGC ()->SetItemMetadata (handle, metadata);
686+ }
687+ // Sets the visibility of an item.
688+ SW_PY bool SetItemVisibility (uint64_t updateHandle, int visibility){
689+ if (SteamUGC () == NULL ){
690+ return false ;
691+ }
692+ UGCUpdateHandle_t handle = uint64 (updateHandle);
693+ ERemoteStoragePublishedFileVisibility itemVisibility;
694+ // Convert the visibility type back over.
695+ if (visibility == UGC_FILE_VISIBLE_PUBLIC){
696+ itemVisibility = k_ERemoteStoragePublishedFileVisibilityPublic;
697+ }
698+ else if (visibility == UGC_FILE_VISIBLE_FRIENDS){
699+ itemVisibility = k_ERemoteStoragePublishedFileVisibilityFriendsOnly;
700+ }
701+ else {
702+ itemVisibility = k_ERemoteStoragePublishedFileVisibilityPrivate;
703+ }
704+ return SteamUGC ()->SetItemVisibility (handle, itemVisibility);
705+ }
706+ // Sets the folder that will be stored as the content for an item.
707+ SW_PY bool SetItemContent (uint64_t updateHandle, const char *contentFolder){
708+ if (SteamUGC () == NULL ){
709+ return false ;
710+ }
711+ UGCUpdateHandle_t handle = uint64 (updateHandle);
712+ return SteamUGC ()->SetItemContent (handle, contentFolder);
713+ }
714+ // Sets the primary preview image for the item.
715+ SW_PY bool SetItemPreview (uint64_t updateHandle, const char *previewFile){
716+ if (SteamUGC () == NULL ){
717+ return false ;
718+ }
719+ UGCUpdateHandle_t handle = uint64 (updateHandle);
720+ return SteamUGC ()->SetItemPreview (handle, previewFile);
721+ }
722+ // Uploads the changes made to an item to the Steam Workshop; to be called after setting your changes.
723+ SW_PY void SubmitItemUpdate (uint64_t updateHandle, const char *changeNote){
724+ if (SteamUGC () == NULL ){
725+ return ;
726+ }
727+ UGCUpdateHandle_t handle = uint64 (updateHandle);
728+ // SteamAPICall_t apiCall = SteamUGC()->SubmitItemUpdate(handle, changeNote);
729+ // callResultItemUpdate.Set(apiCall, this, &_item_updated);
730+ }
731+
551732// ///////////////////////////////////////////////
552733// /// USERS /////////////////////////////////////
553734// ///////////////////////////////////////////////
0 commit comments