summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdministrator <admin@themanaworld.org>2022-06-16 21:15:18 +0000
committerAdministrator <admin@themanaworld.org>2022-06-16 21:15:18 +0000
commitf30f61adfa3701d60ea4e4d9bc9d1b51b603ffea (patch)
tree9f909bd9535653a18cbb239ea2dd225110b7f7cb
parentb309d6e3b682142e76ddcb635fe107f737c8edd0 (diff)
downloadrenpy-f30f61adfa3701d60ea4e4d9bc9d1b51b603ffea.tar.gz
renpy-f30f61adfa3701d60ea4e4d9bc9d1b51b603ffea.tar.bz2
renpy-f30f61adfa3701d60ea4e4d9bc9d1b51b603ffea.tar.xz
renpy-f30f61adfa3701d60ea4e4d9bc9d1b51b603ffea.zip
Add Support for Renpy 8
-rw-r--r--game/client.rpy2
-rw-r--r--game/core.rpy17
-rw-r--r--game/screens.rpy3
-rw-r--r--game/vault.rpy15
4 files changed, 29 insertions, 8 deletions
diff --git a/game/client.rpy b/game/client.rpy
index 4c80ad7..771318f 100644
--- a/game/client.rpy
+++ b/game/client.rpy
@@ -112,6 +112,8 @@ init 2 python:
else:
app=CMD(OPT, PWD)
+ if not LEGACY:
+ app=app.returncode
## Determine error messages
if app == 7:
stdout("[CLIENT] Mirror Lake triggered.")
diff --git a/game/core.rpy b/game/core.rpy
index 90ba8eb..b4bbbf6 100644
--- a/game/core.rpy
+++ b/game/core.rpy
@@ -23,12 +23,18 @@ init -3 python:
# Ren'Py should come with Python 2.7.10 (2710), but just in case
# After all, I only tested with 2.7.10, 2.7.13 and 2.7.15
- if (PYTHON_VERSION < 2700 or PYTHON_VERSION > 3000):
+ if (PYTHON_VERSION < 2700):
+ raise KeyboardInterrupt("Unsupported Python version: %d" % PYTHON_VERSION)
+ elif (PYTHON_VERSION > 3000):
+ # This is Python 3.x
execute=subprocess.run
- # FIXME: check must be set and True
- raise Exception("WARNING: Python version is not 2.7\nStrange bugs may happen on your client.\n\nClick on \"Ignore\" to continue.\nClick on \"Quit\" to exit.")
+ LEGACY = False
+ print("Python 3.x detected! Version is %d. Compatibility mode enabled!" % PYTHON_VERSION)
else:
+ # This is Python 2.7
execute=subprocess.call
+ LEGACY = True
+ print("Python 2.7 detected! Setting legacy mode... (ver: %d)" % PYTHON_VERSION)
#############################################################################
# Functions
@@ -150,7 +156,10 @@ init -3 python:
#############################################################################
## Conditional imports
if persistent.steam:
- import _renpysteam as steam
+ try:
+ import _renpysteam as steam
+ except:
+ persistent.steam = False
#############################################################################
# ["themanaworld.org", "germantmw.de", "moubootaurlegends.org"]
diff --git a/game/screens.rpy b/game/screens.rpy
index 298eac5..0ea46e1 100644
--- a/game/screens.rpy
+++ b/game/screens.rpy
@@ -686,7 +686,8 @@ screen preferences():
action SetVariable("persistent.evol2cli", "manaverse")
textbutton _("ManaPlus"):
action SetVariable("persistent.evol2cli", "manaplus")
- textbutton _("Built-In"):
+ if not LEGACY:
+ textbutton _("Built-In"):
action SetVariable("persistent.evol2cli", "builtin")
diff --git a/game/vault.rpy b/game/vault.rpy
index 17678ee..bbe9fc3 100644
--- a/game/vault.rpy
+++ b/game/vault.rpy
@@ -54,7 +54,10 @@ init python:
self.variable = str(persistent.email)
uedit[key] = str(self.variable)
if (persistent.passd is not None and self.variable == "***"):
- self.variable = str(bytearray((x ^ (persistent.rhash/mp.sub) for x in bytearray(persistent.passd, 'utf-8'))))
+ if LEGACY:
+ self.variable = str(bytearray((x ^ int(persistent.rhash/mp.sub) for x in bytearray(persistent.passd, 'utf-8'))))
+ else:
+ self.variable = bytearray((x ^ int(persistent.rhash/mp.sub) for x in persistent.passd)).decode('utf-8')
uedit[key] = str(self.variable)
def get_text(self):
@@ -181,7 +184,10 @@ label register_vault:
key = base64.b32decode(persistent.totp.encode('utf-8'), True)
msg = struct.pack(">Q", int(time.time()/30))
h = hmac.new(key, msg, hashlib.sha1).digest()
- o = ord(h[19]) & 15
+ if LEGACY:
+ o = ord(h[19]) & 15
+ else:
+ o = (h[19] & 15)
_return = (struct.unpack(">I", h[o:o+4])[0] & 0x7fffffff) % 1000000
_return = "%06d" % _return
print("TOTP: %s" % _return)
@@ -206,7 +212,10 @@ label register_vault:
$ hsh = renpy.random.randint(11, 127)
$ mp.sub = renpy.random.randint(127, 16777215)
$ persistent.rhash = int(hsh)*mp.sub
- $ persistent.passd = str(bytearray(x ^ hsh for x in bytearray(password, 'utf-8')))
+ if LEGACY:
+ $ persistent.passd = str(bytearray(x ^ int(hsh) for x in bytearray(password, 'utf-8')))
+ else:
+ $ persistent.passd = bytearray(ord(x) ^ int(hsh) for x in password)
$ mp.save()
# Wait for Vault to confirm.