mirror of
https://github.com/cave-story-randomizer/cave-story-randomizer
synced 2024-11-22 06:43:03 +00:00
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:
parent
58f02f9180
commit
23be631cac
|
@ -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))
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue