-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added SteamInventoryInterface #94
base: master
Are you sure you want to change the base?
Added SteamInventoryInterface #94
Conversation
@@ -487,7 +487,7 @@ private static native boolean getLobbyDataByIndex(long pointer, long steamIDLobb | |||
ISteamMatchmaking* matchmaking = (ISteamMatchmaking*) pointer; | |||
MatchMakingKeyValuePair_t result; | |||
bool success = matchmaking->GetLobbyDataByIndex((uint64) steamIDLobby, lobbyDataIndex, | |||
result.m_szKey, 256, result.m_szValue, 256); | |||
result.m_szKey, 256, result.m_szValue, 8192); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason behind this? The native field has a fixed size of char[256]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the Steamworks Documentation (https://partner.steamgames.com/doc/api/ISteamMatchmaking) the cchValueBufferSize should be set to "k_cubChatMetadataMax" which is the "Maximum size in bytes that chat room, lobby, or chat/lobby member metadata may have.". It's value is "8192", so I thought it should be called with 8192 instead (maybe I misinterpreted this paragraph?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. Ok, then the bug is that you shouldn't use MatchMakingKeyValuePair_t for storing the result, because its m_szValue field is only limited to 256 characters.
|
||
private static native String getItemDefinitionPropertyKeys(long pointer, int itemDefinition); /* | ||
ISteamInventory* inventory = (ISteamInventory*) pointer; | ||
char *valueBuffer = (char*) malloc(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose you are leaking memory here.
uint32 valueBufferSizeOut = 0; | ||
|
||
inventory->GetItemDefinitionProperty((SteamItemDef_t) itemDefinition, NULL, valueBuffer, &valueBufferSizeOut); | ||
valueBuffer = (char*) malloc(valueBufferSizeOut); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another memory leak.
uint32 count = 0; | ||
bool success = false; | ||
if(inventory->GetResultItems((SteamInventoryResult_t) resultHandle, NULL, &count)) { | ||
std::vector<SteamItemDetails_t> results; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I'm not a big fan of inviting the STL to the party, but well...
FYI I started looking into merging this. I just need to resolve a couple of conflicts with some changes of mine lingering around since a year... |
welcome back to github, brother |
Hey @code-disaster just wondering if this is still a possibility of being merged? |
Heyho,
I added the whole ISteamInventory interface as well as its corresponding classes and test methods. I also changed the language level from 7 to 8 to be able to use streams (And Java 1.7 is quite old now) and updated the steamworks sdk to v.1.49.
This closes #92
In order to be able to use the tests you have to upload the "inventoryTestItemDefs.json" inside the steamworks-inventoryservice menu and add a dynamic property for the following "tag_categorie:tag_value" - pair: "weapon:hat"