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

Fixes issue on workshop items being > 1 000 000 #621

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexandre433
Copy link

Fixes issue on workshop items being > 1 000 000

In my own project i added items with the id > 1 000 000, and it would return a negative item id, where it would throw errors on other parts of the code, when we tried to use some int conversion.

Since this id is also always positive, adding it to uint sounds better than just having an int.

Fixes issue on workshop items
@rlabrecque
Copy link
Owner

rlabrecque commented Jul 1, 2024

Hmm, I'm not really understanding how it would be capped at 1,000,000; surely it should be non-negative up to 2,147,483,647 ?

Regardless, this is well defined by the Steam API to be a signed integer, and all valid values fall within 1 and 999999999 as outlined here:

// Types of items in your game are identified by a 32-bit "item definition number".
// Valid definition numbers are between 1 and 999999999; numbers less than or equal to
// zero are invalid, and numbers greater than or equal to one billion (1x10^9) are
// reserved for internal Steam use.
typedef int32 SteamItemDef_t;

Am I missing something?

@alexandre433
Copy link
Author

alexandre433 commented Jul 2, 2024

Well I had an error where my steam itemdefid, was set to 3 275 882 830 (a workshop id) and it ran ok on steam's side, but when it got retrieved via the game it returned a negative number.
According to the documentation from steam the itemdefid should be below 1 000 000 if it's not a workshop item id, at least that's my interpretation from it:
image

So if i add a steam workshop item id, it should allow it, and should be bigger than the 1 000 000 and in this case it's about 3 thousand times bigger than the limit they mentioned.

Update:
From my understanding the "internal use" for steam, in this case, workshop is internal, so i'd assume it's "accepted"?

@rlabrecque
Copy link
Owner

Okay yeah this is making a lot more sense to me!

I'm still a little conflicted just because this is how it is in the Steamworks SDK as well;

How are you going to/from the SteamItemDef_t? I ask because I /thought/ the 3275882830 that you have is actually a PublishedFileId_t -- but I can vaguely see how you ended up with it on the Inventory side of things with like a Curated Workshop.

Now though my worry is PublishedFileId_t is defined as typedef uint64 PublishedFileId_t; so this will become very exciting once the workshop gets up to ~4,294,967,295 ! 🙈

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.

2 participants