Ever since BYOND Beta Version 512.1427 the following code (within the file after extracting) has given me a BYOND Error 'failed to parse savefile text at line ...' while I was using Air Mapster's RC5 Encryption Library. This does not happen in the previous build before Version 512.1427.
Numbered Steps to Reproduce Problem:
1. Download/Install any BYOND Beta Version 512.1427 and higher.
2. Extract the following zip file. Link: http://files.byondhome.com/Hydrugen/savefile_bug_src.zip
3. Open the source in Dream Maker and Run.
4. Relog and Check Options and Messages to see the error.
Code Snippet (if applicable) to Reproduce Problem:
mob
Login()
if(fexists("player/[src.key].sav"))
src.file2read()
src << "Savefile found and has been loaded!"
else
src << "Savefile not found!"
..()
Logout()
src.file2write()
..()
proc
file2write()
var/savefile/F = new
if(fexists("player/[src.key].sav"))
fdel("player/[src.key].sav")
// Do not remove. Prevents savefile size from basically duplicating in size.
src.Write(F)
text2file(RC5_Encrypt(F.ExportText("/"), md5("byond")), "player/[src.key].sav")
file2read()
var/savefile/F = new
F.ImportText("/", RC5_Decrypt(file2text("player/[src.key].sav"), md5("byond")))
src.Read(F)
Expected Results:
BYOND Error message doesn't appear on output/Options and Message and everything runs without a problem.
Actual Results:
BYOND Error: failed to parse savefile text at line 1 (reading 'end of file'):
Does the problem occur:
Every time? Or how often? Every time
In other games? Probably not
In other user accounts? Yes
On other computers? Yes
When does the problem NOT occur?
Using any BYOND Beta Version before 512.1427.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
I would say Verison 512.1424 to 512.1426 that it didn't occur.
Workarounds:
Downgrade between 512.1424 to 512.1426
While I normally don't recommend editing libraries, I think a wise solution would be to make the following changes:
L[idx] = ((L[idx] << 8) + text2ascii(copytext(key, i+1, i+2))) & 0xFFFF // line 263
I haven't tested those changes yet but I believe they'll make do as a fix.
I may want to change the way bit twiddling is handled in pre-512-compiled games to avoid this problem with already-compiled source, though.