Make sharecodes platform-independent

Resolves the issue of sharecodes generated with the 32-bit version
of LÖVE being incompatible with the 64-bit version, and vice versa.

This also happens to shorten the sharecodes by removing all of the
"A"s at the beginning. :)
This commit is contained in:
periwinkle 2020-03-07 21:11:54 -05:00
parent 58f02f9180
commit 23be631cac
2 changed files with 2 additions and 2 deletions

View File

@ -399,7 +399,7 @@ function C:_updateSharecode(seed)
seed = seed .. (" "):rep(20-#seed)
end
local packed = love.data.pack("data", "sBB", seed, settings, seq)
local packed = love.data.pack("data", "<s1BB", seed, settings, seq)
self.sharecode = love.data.encode("string", "base64", packed)
logNotice(("Sharecode: %s"):format(self.sharecode))

View File

@ -269,7 +269,7 @@ end)
settings.importshare:onPress(function()
local success, seed, sharesettings, seq = pcall(function()
local packed = love.data.decode("data", "base64", settings.sharecode.value)
local seed, settings, seq = love.data.unpack("sBB", packed)
local seed, settings, seq = love.data.unpack("<s1BB", packed)
assert(#seed == 20)
return seed, settings, seq
end)