Steam Workshop issues (with detailed output)

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
Marson
Uruivellas
Posts: 645
Joined: Thu Jan 16, 2014 4:56 am

Steam Workshop issues (with detailed output)

#1 Post by Marson »

For a few days now, I haven't been able to update any of my addons to the Steam Workshop. I've stripped down to just addon-dev and a single one of my addons (tried a couple different ones), and still no go. To try and figure out what's going on, I added some debugging output to the in-game log.
Steam-hang1.png
Steam-hang1.png (68.65 KiB) Viewed 5391 times
I've let it sit for hours, and the wait dialog just sits there. I added code to let me close the dialog, and this is what shows afterwards:
Steam-hang2.png
Steam-hang2.png (13.87 KiB) Viewed 5391 times
So I'm thinking that the file reaches original line #276 and then barfs. Since nothing closes the dialog, the onscreen log doesn't update and it just waits forever. Once I close it manually, I see that it actually has just skipped over the function that's sent as a parameter of publishFileUpdate() and went right to the end of publishAddonSteam(). I'm assuming that publishFileUpdate() is compiled and exposed in te4-steam.dll or similar, as I can't find any source code to debug it further.

#276 core.steam.publishFileUpdate(pubid, file:sub(2), false, function(error)

Code: Select all

function _M:publishAddonSteam(add)
	game.log("#ROYAL_BLUE#Starting publishAddonSteam()...")
	if not add.tags or type(add.tags) ~= "table" then
		game.log("#LIGHT_RED#Addon init.lua must contain a tags table")
		Dialog:simplePopup("Registering new addon", "Addon init.lua must contain a tags table, i.e: tags={'foo', 'bar'}")
		return
	end
	if not add.description then
		game.log("#LIGHT_RED#Addon init.lua must contain a description field")
		Dialog:simplePopup("Registering new addon", "Addon init.lua must contain a description field")
		return
	end

	local file, fmd5 = self:zipAddon(add, true)

	game.log("#ROYAL_BLUE#Initiating core.profile.pushOrder('%s', '%s')...", "check_steam_pubid", add.short_name)
	core.profile.pushOrder(table.serialize{o="AddonAuthoring", suborder="check_steam_pubid",
		for_module = game.__mod_info.short_name,
		short_name = add.short_name,
		version = add.version,
		md5 = fmd5,
	})
	local pubid = nil
	local err = nil
	game.log("#ROYAL_BLUE#Connecting to Steam server...")
	local popup = Dialog:simpleWaiter("Connecting to server", "Addon: "..add.short_name)
	game.log("#ROYAL_BLUE#Initiating profile:waitEvent('%s', %d)...", "check_steam_pubid", 10000)
	profile:waitEvent("AddonAuthoring", function(e) if e.suborder == "check_steam_pubid" then pubid = e.pubid err = e.err end end, 10000)
	game.log("#ROYAL_BLUE#Clear wait dialog...")
	if popup then popup:done() end
	if pubid == '' then pubid = nil end
	game.log("#LIGHT_GREEN#Retrieved Steam pubid '%s' for addon %s.", pubid, add.short_name)
	print("[STEAM UPLOAD] Got addon steam pubid", pubid)

	if err then
		game.log("#LIGHT_RED#Update error: %s", err or "unknown")
		return
		Dialog:simplePopup("Steam Workshop: "..add.long_name, "Update error: "..(err or "unknown"))
	end

	game.log("#ROYAL_BLUE#Uploading addon %s to Steam Workshop...", add.short_name)
	local popup = Dialog:simpleWaiter("Uploading addon to Steam Workshop", "Addon: "..add.short_name, nil, 10000)
	--to remove
	popup.key:addBinds{ EXIT = function() popup:done() core.display.forceRedraw() game.log("#ROYAL_BLUE#Manually cleared wait dialog...") end, }
	--to remove end
	core.display.forceRedraw()
	if not pubid then
		game.log("#ROYAL_BLUE#No pubid...")
		local preview = "user-generated-addons/"..add.for_module.."-"..add.short_name.."-custom.png"
		if not fs.exists(preview) then
			game.log("#LIGHT_RED#Preview image %s doesn't exist...", preview)
			preview = self:addonPreview(add)
			game.log("#ROYAL_BLUE#Using %s instead...", preview)
		end
		game.log("#ROYAL_BLUE#Initiating core.steam.publishFile(%'s', '%s')...", file:sub(2), preview)
		core.display.forceRedraw()
		core.steam.publishFile(file:sub(2), preview, add.long_name, add.description, add.tags, function(pubid, needaccept, error)
			game.log("#ROYAL_BLUE#Clear wait dialog...")
			if popup then popup:done() end
			if not error and pubid then
				game.log("#ROYAL_BLUE#Initiating core.steam.pushOrder('%s', '%s')...", "steam_pubid", add.short_name)
				core.profile.pushOrder(table.serialize{o="AddonAuthoring", suborder="steam_pubid", for_module = game.__mod_info.short_name, short_name = add.short_name, pubid = pubid})
			end

			if error then
				game.log("#LIGHT_RED#There was an error uploading the addon %s: %s", add.short_name, error)
				Dialog:simplePopup("Steam Workshop: "..add.long_name, "There was an error uploading the addon.")
			elseif needaccept then
				game.log("#LIGHT_GREEN#Addon %s succesfully uploaded to the Workshop. You need to accept Steam Workshop Agreement in your Steam Client before the addon is visible to the community.", add.short_name)
				Dialog:yesnoLongPopup("Steam Workshop: "..add.long_name, "Addon succesfully uploaded to the Workshop.\nYou need to accept Steam Workshop Agreement in your Steam Client before the addon is visible to the community.", 500, function(ret) if ret then
					util.browserOpenUrl("http://steamcommunity.com/sharedfiles/workshoplegalagreement")
				end end, "Go to Workshop", "Later")
			else
				game.log("#LIGHT_GREEN#Addon %s succesfully uploaded to the Workshop.", add.short_name)
				Dialog:simplePopup("Steam Workshop: "..add.long_name, "Addon succesfully uploaded to the Workshop.")
			end
		end)
	else
		game.log("#ROYAL_BLUE#Initiating core.steam.publishFileUpdate('%s', '%s')...", pubid, file:sub(2))
		core.steam.publishFileUpdate(pubid, file:sub(2), false, function(error)
			game.log("#ROYAL_BLUE#Clear wait dialog...")
			if popup then popup:done() end
			game.log("#ROYAL_BLUE#Checking for custom preview image %s...", add.short_name, "user-generated-addons/"..add.for_module.."-"..add.short_name.."-custom.png")
			if fs.exists("/user-generated-addons/"..add.for_module.."-"..add.short_name.."-custom.png") then
				game.log("#LIGHT_GREEN#Found %s", add.short_name, "user-generated-addons/"..add.for_module.."-"..add.short_name.."-custom.png")
				game:registerTimer(0.01, function()
				game.log("#ROYAL_BLUE#Uploading addon %s preview image %s to Steam Workshop...", add.short_name, "user-generated-addons/"..add.for_module.."-"..add.short_name.."-custom.png")
				local popup = Dialog:simpleWaiter("Uploading addon preview to Steam Workshop", "Addon: "..add.short_name, nil, 10000)
				game.log("#ROYAL_BLUE#Initiating publishFileUpdate('%s')...", "user-generated-addons/"..add.for_module.."-"..add.short_name.."-custom.png")
				core.steam.publishFileUpdate(pubid, "user-generated-addons/"..add.for_module.."-"..add.short_name.."-custom.png", true, function(error)
					game.log("#ROYAL_BLUE#Clear wait dialog...")
					if popup then popup:done() end
					if error then
						game.log("#LIGHT_RED#There was an error uploading the preview image: %s", error)
						Dialog:simplePopup("Steam Workshop: "..add.long_name, "There was an error uploading the addon preview.")
					else
						game.log("#LIGHT_GREEN#Preview image succesfully uploaded to the Workshop.")
						Dialog:simplePopup("Steam Workshop: "..add.long_name, "Addon update & preview succesfully uploaded to the Workshop.")
					end
				end)
			end) else
				if error then
					game.log("#LIGHT_RED#There was an error uploading the addon %s: %s", add.short_name, error)
					Dialog:simplePopup("Steam Workshop: "..add.long_name, "There was an error uploading the addon.")
				else
					game.log("#LIGHT_GREEN#Addon %s update succesfully uploaded to the Workshop.", add.short_name)
					Dialog:simplePopup("Steam Workshop: "..add.long_name, "Addon update succesfully uploaded to the Workshop.")
				end
			end
		end)
	end
	game.log("#ROYAL_BLUE#Ending publishAddonSteam()...")
end

---


I added:

Code: Select all

	if popup then
		game.log("#LIGHT_RED#Something went wrong somewhere, as a dialog was left hanging open and had to be closed at the end of publishAddonSteam().")
		popup:done()
	end
just ahead of the last two lines. Sure enough, I didn't have to close the popup this time. The error went to the log and that new code closed it.

Marson
Uruivellas
Posts: 645
Joined: Thu Jan 16, 2014 4:56 am

Re: Steam Workshop issues (with detailed output)

#2 Post by Marson »

If I make a change to marson-dev and upload a fresh version to ToME, then Steam returns a pubid of nil when I try to upload it there. Going down that chain of code, it reaches line #261 (another core.steam function), it fails in some way, and the next line it executes is #292 at the end of the publishAddonSteam() function.

line #261 - core.steam.publishFile(file:sub(2), preview, add.long_name, add.description, add.tags, function(pubid, needaccept, error)

If I come back later and just try to upload to Steam, it finds a pubid and fails like in my first post.

Anyone have any ideas? Short of coding my own DLL to interface with Steam in a way I can track and debug, I'm not sure where to go next.

Marson
Uruivellas
Posts: 645
Joined: Thu Jan 16, 2014 4:56 am

Re: Steam Workshop issues (with detailed output)

#3 Post by Marson »

Just in case anyone else runs into this and finds this thread in a search, this is how I fixed it.

Bugged DG in IRC.
Enabled "-dev -console" on Steam command line, as he suggested.
Used "log_ipc t-engine.exe" in console to watch ToME.

... and the uploads just started working. They didn't when I tried just before that. Some DG voodoo or something.

---

Scratch that. It started failing again. I have the Steam Cloud saves turned off in Steam and ToME, but Steam still saves to the cloud as part of normal procedure. It just isn't supposed to overwrite it locally if turned off. I purged the cloud just in case, as I noticed a return code of 25 (I think that's k_EResultLimitExceeded). I still had plenty of storage quota left, but now it's uploading again.

Post Reply