Skip to content
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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Zweistein2
Copy link

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"

@@ -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);
Copy link
Owner

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].

Copy link
Author

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?).

Copy link
Owner

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);
Copy link
Owner

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);
Copy link
Owner

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;
Copy link
Owner

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...

@code-disaster
Copy link
Owner

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...

@XenoAmess
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Steam Inventory Interface
3 participants