philippj / SteamworksPy

A working Python API system for Valve's Steamworks.
MIT License
213 stars 40 forks source link

ItemSubscribed/ItemUnsubscribed callbacks cross-platform compatibility #76

Closed joseasoler closed 2 years ago

joseasoler commented 2 years ago

The enums used by RemoteStorageSubscribePublishedFileResult_t and RemoteStorageEnumerateUserSubscribedFilesResult_t do not have a fixed underlying type.

According to the C++ standard, any integral type that can represent all of the values of the enumeration could be a valid choice to store these enums in memory. In Windows the chosen type happens to be an int, but this can be different when using other compilers or platforms.

To prevent these cross-platform issues from affecting the results, the data is now copied into types which must have the same size on all platforms, and that data is then sent to Python.

The changes of this PR have been tested on both Windows and Linux, using the script provided in issue #75.

Fixes #75

philippj commented 2 years ago

Looks good and fixes the issue.