Skip to content

[LINUX] Really weird behaviour of callbacks #95

Description

@Def-Try

so, my code is this:

from steamworks import STEAMWORKS, EWorkshopFileType
sw = STEAMWORKS() 
sw.initialize()

from time import sleep

_IID = -1
IID = -1

def _cb_create(item):
	global _IID, IID
	_IID = item.publishedFileId
	IID = _IID
	#IID = _IID & 0b0000011111111111111111111111111111111111111111111111111111111111
	print(item.result, item.publishedFileId, IID, item.userNeedsToAcceptWorkshopLegalAgreement)

def _cb_update(item):
	global _IID, IID
	_IID = item.publishedFileId
	IID = _IID
	#IID = _IID & 0b0000011111111111111111111111111111111111111111111111111111111111
	print(item.result, item.publishedFileId, IID, item.userNeedsToAcceptWorkshopLegalAgreement)

callbacks = {
	"create": _cb_create,
	"update": _cb_update
}

def update(sw, iid, note=None, title=None, desc=None, preview=None, content=None):
	print(f"ItemID {iid}")
	if iid == -1 or iid == 0:
		print("Invalid itemID, aborting")
		return
	print("Starting Item update")
	iuh = sw.Workshop.StartItemUpdate(4000, iid)
	print(f"ItemUpdateHandle {iuh}")
	print("Updating info")
	sw.Workshop.SetItemTitle(iuh, title or "Title")
	sw.Workshop.SetItemDescription(iuh, desc or "Description")
	if preview:
		print("Uploading preview")
		sw.Workshop.SetItemPreview(iuh, preview)
	if content:
		print("Uploading content")
		sw.Workshop.SetItemContent(iuh, content)
	print("Submitting")
	sw.Workshop.SubmitItemUpdate(iuh, note or "No update info provided", callbacks['update'], True)
	sleep(1)
	for _ in range(10):
		sw.run_callbacks()
		sleep(0.1)


sw.Workshop.CreateItem(4000, EWorkshopFileType.COMMUNITY, callbacks['create'], True)
sleep(1)
for _ in range(10):
	sw.run_callbacks()
	sleep(0.1)

update(sw, IID, "update note", "addon title", "addon description")

and it outputs this:

[S_API] SteamAPI_Init(): Loaded '/home/googer/.local/share/Steam/linux64/steamclient.so' OK.
Setting breakpad minidump AppID = 4000
Steam_SetMinidumpSteamID:  Caching Steam ID:  76561198971792706 [API loaded no]
1 952283722281910272 952283722281910272 False
ItemID 952283722281910272
Starting Item update
ItemUpdateHandle 8213354041600338912
Updating info
Submitting
9 952283722281910272 952283722281910272 False

code thinks that itemid is 952283722281910272, but really, it is 3032959564.
probably bit shifts i thought, but...

>>> a = 952283722281910272
>>> f"{a:064b}"
'0000110100110111001100010000000000000000000000000000000000000000'
>>> a = 3032959564
>>> f"{a:064b}"
'0000000000000000000000000000000010110100110001110100101001001100'

i built library by myself, libsteam_api.so taken from steamworks v147. attaching both SteamworksPy.so, libsteam_api.so below.
libraries.zip

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions