Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion library/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
makeall:
SteamworksPy.so: SteamworksPy.cpp
g++ -std=c++11 -o SteamworksPy.so -shared -fPIC SteamworksPy.cpp -l steam_api -L.

clean:
rm SteamworksPy.so
13 changes: 11 additions & 2 deletions library/SteamworksPy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "TargetConditionals.h"
#define SW_PY extern "C" __attribute__ ((visibility("default")))
#elif defined( __linux__ )
#include <cstdint>
Copy link
Copy Markdown
Contributor Author

@zhulik zhulik May 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not compile on my machine without this include:

SteamworksPy.cpp:90:14: error: ‘int32_t’ in namespace ‘std’ does not name a type
   90 |         std::int32_t result;
      |              ^~~~~~~
SteamworksPy.cpp:91:14: error: ‘uint64_t’ in namespace ‘std’ does not name a type; did you mean ‘wint_t’?
   91 |         std::uint64_t publishedFileId;
      |              ^~~~~~~~
      |              wint_t
SteamworksPy.cpp: In member function ‘void Workshop::OnItemSubscribed(RemoteStorageSubscribePublishedFileResult_t*, bool)’:
SteamworksPy.cpp:185:112: error: too many initializers for ‘SubscriptionResult’
  185 |             SubscriptionResult result{itemSubscribedResult->m_eResult, itemSubscribedResult->m_nPublishedFileId};
      |                                                                                                                ^
SteamworksPy.cpp: In member function ‘void Workshop::OnItemUnsubscribed(RemoteStorageUnsubscribePublishedFileResult_t*, bool)’:
SteamworksPy.cpp:192:116: error: too many initializers for ‘SubscriptionResult’
  192 |             SubscriptionResult result{itemUnsubscribedResult->m_eResult, itemUnsubscribedResult->m_nPublishedFileId};
      |                                                                                                                    ^
make: *** [Makefile:2: SteamworksPy.so] Error 1

I use Arch and gcc 13.1.1. Not sure about other platforms, but it feels like this header is standard and we could use it on all platforms

#include "sdk/steam/steam_api.h"
#define SW_PY extern "C" __attribute__ ((visibility("default")))
#else
Expand Down Expand Up @@ -665,7 +666,7 @@ SW_PY uint64_t GetCurrentActionSet(uint64_t controllerHandle){
}
return (uint64_t) SteamInput()->GetCurrentActionSet((InputHandle_t) controllerHandle);
}
// Get the input type (device model) for the specified controller.
// Get the input type (device model) for the specified controller.
SW_PY uint64_t GetInputTypeForHandle(uint64_t controllerHandle){
if(SteamInput() == NULL){
return 0;
Expand Down Expand Up @@ -736,6 +737,13 @@ SW_PY bool ControllerInit(bool bExplicitlyCallRunFrame) {
return SteamInput()->Init(bExplicitlyCallRunFrame);
}

SW_PY bool SetInputActionManifestFilePath(const char *path) {
if (SteamInput() == NULL) {
return false;
}
return SteamInput()->SetInputActionManifestFilePath(path);
}

// Syncronize controllers.
SW_PY void RunFrame() {
if (SteamInput() == NULL) {
Expand Down Expand Up @@ -1467,4 +1475,5 @@ SW_PY void MicroTxn_SetAuthorizationResponseCallback(MicroTxnAuthorizationRespon
return;
}
microtxn.SetAuthorizationResponseCallback(callback);
}
}

3 changes: 3 additions & 0 deletions steamworks/interfaces/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ def __init__(self, steam: object):
def Init(self, explicitlyCallRunFrame=False):
return self.steam.ControllerInit(explicitlyCallRunFrame)

def SetInputActionManifestFilePath(self, path):
return self.steam.SetInputActionManifestFilePath(path.encode())

def RunFrame(self):
return self.steam.RunFrame()

Expand Down
4 changes: 4 additions & 0 deletions steamworks/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ class InputDigitalActionData_t(Structure):
'restype': None,
'argtypes': [c_uint64]
},
'SetInputActionManifestFilePath': {
'restype': bool,
'argtypes': [c_char_p]
},
'ActivateActionSet': {
'restype': None,
'argtypes': [c_uint64, c_uint64]
Expand Down