summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2023-07-18 23:01:29 -0300
committerJesusaves <cpntb1@ymail.com>2023-07-18 23:01:29 -0300
commita6849c2f44596e168c41332884c71ed254307a5a (patch)
tree5456c8584745a211421a01b8d2781ad47178481a
parent5aa568124b438e68ba1f2d38f4ad7680e50853ab (diff)
downloadrenpy-a6849c2f44596e168c41332884c71ed254307a5a.tar.gz
renpy-a6849c2f44596e168c41332884c71ed254307a5a.tar.bz2
renpy-a6849c2f44596e168c41332884c71ed254307a5a.tar.xz
renpy-a6849c2f44596e168c41332884c71ed254307a5a.zip
Preserve client settings when updating. It looks clumsy but works better.
-rw-r--r--game/3rdparty/builtin.rpy2
-rw-r--r--game/3rdparty/manaplus.rpy17
-rw-r--r--game/3rdparty/manaverse.rpy21
-rw-r--r--game/client.rpy18
4 files changed, 39 insertions, 19 deletions
diff --git a/game/3rdparty/builtin.rpy b/game/3rdparty/builtin.rpy
index c1ac566..6b4be34 100644
--- a/game/3rdparty/builtin.rpy
+++ b/game/3rdparty/builtin.rpy
@@ -19,7 +19,7 @@ init 1 python:
return True
###############################
- def cli_builtin(launch=False, download=True):
+ def cli_builtin(launch=False, download=True, force=False):
global SCR_PROMPT, SCR_RESULT
##########
if launch:
diff --git a/game/3rdparty/manaplus.rpy b/game/3rdparty/manaplus.rpy
index 39dba52..d9432df 100644
--- a/game/3rdparty/manaplus.rpy
+++ b/game/3rdparty/manaplus.rpy
@@ -45,7 +45,10 @@ init 1 python:
def install_manaplus():
status_update("Creating ManaPlus directory...", 61)
installdir=get_path("manaplus")
- os.mkdir(installdir)
+ try:
+ os.mkdir(installdir)
+ except OSError:
+ pass
## Detect your plataform
#########################################################
if renpy.linux:
@@ -72,11 +75,15 @@ init 1 python:
else:
status_update("ERROR: Unsupported Plataform")
return False
- shutil.copytree(get_path('')+"Config", installdir+"/Config")
+ try:
+ shutil.copytree(get_path('')+"Config", installdir+"/Config")
+ except OSError:
+ traceback.print_exc()
+ pass
return True
###############################
- def cli_manaplus(launch=False, download=True):
+ def cli_manaplus(launch=False, download=True, force=False):
global SCR_PROMPT, SCR_RESULT
## Check if ManaPlus is already installed
try:
@@ -97,10 +104,12 @@ init 1 python:
if (not ret):
return False
+ ## Actual download/installation (for updates)
+ if download and (force or not MANAPLUS):
try:
if not install_manaplus():
# Delete the failed attempt before raising the exception
- shutil.rmtree(get_path("manaplus"))
+ #shutil.rmtree(get_path("manaplus"))
#os.rmdir(get_path("manaplus"))
raise Exception("Installation failed!")
except:
diff --git a/game/3rdparty/manaverse.rpy b/game/3rdparty/manaverse.rpy
index a65da63..a639122 100644
--- a/game/3rdparty/manaverse.rpy
+++ b/game/3rdparty/manaverse.rpy
@@ -7,8 +7,8 @@
#################################################################################
####### Constants
-define manaverseWin64 = "https://manaplus.germantmw.de/manaplus/nightly/windows/manaverse.zip"
-define manaverseLinux = "https://manaplus.germantmw.de/manaplus/nightly/linux/ManaPlus-x86_64.AppImage"
+define manaverseWin64 = "https://updates.tmw2.org/mana/windows/manaverse.zip"
+define manaverseLinux = "https://updates.tmw2.org/mana/linux/ManaPlus-x86_64.AppImage"
####### Main Code
init 1 python:
@@ -50,7 +50,10 @@ init 1 python:
def install_manaverse():
status_update("Creating ManaPlus directory...", 61)
installdir=get_path("manaplus")
- os.mkdir(installdir)
+ try:
+ os.mkdir(installdir)
+ except OSError:
+ pass
## Detect your plataform
#########################################################
if renpy.linux:
@@ -85,11 +88,15 @@ init 1 python:
else:
status_update("ERROR: Unsupported Plataform")
return False
- shutil.copytree(get_path('')+"Config", installdir+"/Config")
+ try:
+ shutil.copytree(get_path('')+"Config", installdir+"/Config")
+ except OSError:
+ traceback.print_exc()
+ pass
return True
###############################
- def cli_manaverse(launch=False, download=True):
+ def cli_manaverse(launch=False, download=True, force=False):
global SCR_PROMPT, SCR_RESULT
## Check if ManaPlus or ManaVerse is already installed
try:
@@ -110,10 +117,12 @@ init 1 python:
if (not ret):
return False
+ ## Actual download/installation (for updates)
+ if download and (force or not MANAPLUS):
try:
if not install_manaverse():
# Delete the failed attempt before raising the exception
- shutil.rmtree(get_path("manaplus"))
+ #shutil.rmtree(get_path("manaplus"))
#os.rmdir(get_path("manaplus"))
raise Exception("Installation failed!")
except:
diff --git a/game/client.rpy b/game/client.rpy
index 4887e46..014da64 100644
--- a/game/client.rpy
+++ b/game/client.rpy
@@ -5,7 +5,7 @@
# Distributed under the MIT license, except for Steam parts.
#################################################################################
init 2 python:
- def handle_client(CLIENT_NAME="", launch=False, download=True):
+ def handle_client(CLIENT_NAME="", launch=False, download=True, force=False):
## Local variables
f=False
if (CLIENT_NAME == ""):
@@ -13,11 +13,11 @@ init 2 python:
## Main loop
if (CLIENT_NAME == "manaplus"):
- f=cli_manaplus(launch, download)
+ f=cli_manaplus(launch, download, force)
elif (CLIENT_NAME == "manaverse"):
- f=cli_manaverse(launch, download)
+ f=cli_manaverse(launch, download, force)
elif (CLIENT_NAME == "builtin"):
- f=cli_builtin(launch, download)
+ f=cli_builtin(launch, download, force)
else:
status_update("ERROR, unrecognized client: %s" % CLIENT_NAME)
@@ -249,10 +249,12 @@ init 2 python:
stdout("MD5 Mismatch: hashes differ", True)
stdout("Ours: %s" % md5us, True)
stdout("Them: %s" % md5up, True)
- shutil.rmtree(get_path("manaplus"))
+ #shutil.rmtree(get_path("manaplus")) # FIXME! Download new client and override only specific files instead
if not silent:
renpy.notify("Files are outdated!")
- stdout("Client is outdated.")
+ stdout("Client is outdated. Updating...")
+ handle_client(launch=False, download=True, force=True)
+ stdout("Client updated.")
return False
else:
if not silent:
@@ -261,9 +263,9 @@ init 2 python:
return True
except:
traceback.print_exc()
- shutil.rmtree(get_path("manaplus"))
+ #shutil.rmtree(get_path("manaplus")) # FIXME! Download new client and override only specific files instead
if not silent:
- renpy.notify("An error happened (outdated?)")
+ renpy.notify("An error happened, nothing was done.")
return False
############################################