Skip to content

Instantly share code, notes, and snippets.

@pezcode
Created January 14, 2018 14:34
Show Gist options
  • Save pezcode/d02055bc98eba5fb2bd4c0b8f34d4f66 to your computer and use it in GitHub Desktop.
Save pezcode/d02055bc98eba5fb2bd4c0b8f34d4f66 to your computer and use it in GitHub Desktop.
Unlock all LYNE (http://www.lynegame.com/) levels on the Windows version. I needed this after reformatting Windows since the game didn't have Steam Cloud sync.
import sys
import _winreg
# windows savegame location:
# HKCU/Software/Thomas Bowker/LYNE
def main():
sets = 26 # A-Z
levels = 25
for s in range(sets):
for l in range(levels):
level_pref = 'lyne_levelcomplete_' + str(s) + '_' + str(l)
write_pref(level_pref, 1)
stage_pref = 'lyne_stagecomplete_' + str(s)
write_pref(stage_pref, 1)
#write_pref('lyne_num_trytes', 999)
def write_pref(name, val):
full_name = pref_string(name)
write_regvalue((_winreg.HKEY_CURRENT_USER, 'Software\\Thomas Bowker\\LYNE'), full_name, _winreg.REG_DWORD, val)
def pref_string(name):
return name + '_h' + str(djb2xor(name))
def djb2xor(string):
hash = 5381
for c in string:
hash = ((hash * 33) & 0xffffffff) ^ ord(c)
return hash
def write_regvalue(key, name, valtype, val):
parent, subkey = key
handle = _winreg.CreateKeyEx(parent, subkey, 0, _winreg.KEY_SET_VALUE)
_winreg.SetValueEx(handle, name, 0, valtype, val)
_winreg.CloseKey(handle)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment