Skip to content

Commit

Permalink
v3.2.3.3 Beta with installer fix Merge pull request #1013 from Die4Ev…
Browse files Browse the repository at this point in the history
…er/develop

v3.2.3.3 Beta with installer fix
  • Loading branch information
Die4Ever authored Oct 23, 2024
2 parents 150c7fc + fb27bba commit 899beba
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 31 deletions.
2 changes: 1 addition & 1 deletion DXRModules/DeusEx/Classes/DXRFlags.uc
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ function int GameModeIdForSlot(int slot)
if(slot--==0) return SeriousSam;
if(slot--==0) return HordeZombies;
if(slot--==0) return HordeMode;
if(slot--==0) return OneItemMode;
if(!VersionIsStable()) if(slot--==0) return OneItemMode;
return 999999;
}

Expand Down
8 changes: 6 additions & 2 deletions DXRando/DeusEx/Classes/MemConUnit.uc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ function PostPostBeginPlay()

if (m==None) return;

Description = default.Description;
if(m.FixedSavesExtreme == m.dxr.flags.autosave){
Description="This item is capable of capturing and containing half of your memories, requiring 2 of them to save the game one time. The only freebie autosave you get is at the very start of the game.";
}
if (m.IsFixedSaves()){
Description=default.Description $ "|n|nYou must have an ATM, personal computer, public terminal, or security computer highlighted in order to save your game.";
Description=Description $ "|n|nYou must have an ATM, personal computer, public terminal, or security computer highlighted in order to save your game. You do not need to open the computer, just look at it. Then you can use the normal Save Game menu or the Quicksave button.";
}
}
#endif
Expand All @@ -39,7 +43,7 @@ defaultproperties
largeIcon=Texture'LargeIconMemConUnit'
largeIconWidth=18
largeIconHeight=44
Description="This item is capable of capturing and containing your memories, allowing you to save the game one time."
Description="This item is capable of capturing and containing your memories, allowing you to save the game one time. The only freebie autosave you get is at the very start of the game."
beltDescription="MCU"
Mesh=LodMesh'DeusExItems.VialAmbrosia'
CollisionRadius=5.0
Expand Down
41 changes: 24 additions & 17 deletions installer/GUI/KillRunningGame.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,40 @@ def CopyExeTo(source:Path, dest:Path):
try:
CopyTo(source, dest)
except PermissionError as e:
if not AskKillGame(source, dest):
if not AskKillGame(dest):
raise
CopyTo(source, dest)


def AskKillGame(source:Path, dest:Path):
def AskKillGame(exe:Path):
if not IsWindows():
return False
self = Path(sys.argv[0]).resolve()
if self == dest.resolve():
info('Cannot overwrite self', dest)
selfpath = Path(sys.argv[0]).resolve()
if selfpath == exe.resolve():
info('Cannot overwrite self', exe)
messagebox.showerror('Cannot overwrite installer', 'Rename the installer file and run it again.')
sys.exit(1)

cmd = ['TASKLIST', '/FI', 'imagename eq ' + dest.name]
if not IsGameRunning(exe):
return False

info('Ask kill game', exe)
resp = messagebox.askyesno('Close game?', exe.name + ' is currently running and must be closed in order to install. Would you like to close it now?\n\nYou will lose any unsaved progress.')
if resp:
cmd = ['taskkill', '/F', '/IM', exe.name]
info('Killing game', exe, cmd)
subprocess.run(cmd, text=True, capture_output=True, check=True, timeout=30, creationflags=subprocess.CREATE_NO_WINDOW)
time.sleep(1)
# try again, even if the user declines because maybe they closed the game manually
return True


def IsGameRunning(exe:Path):
if not IsWindows():
return False # we don't care outside of Windows
cmd = ['TASKLIST', '/FI', 'imagename eq ' + exe.name]
info('running', cmd)
ret = subprocess.run(cmd, text=True, capture_output=True, check=True, timeout=30, creationflags=subprocess.CREATE_NO_WINDOW)
if 'INFO: No tasks are running which match the specified criteria.' in ret.stdout:
return False

info('Ask kill game', dest)
resp = messagebox.askyesno('Close game?', dest.name + ' is currently running and must be closed in order to install. Would you like to close it now?\n\nYou will lose any unsaved progress.')
if not resp:
return

cmd = ['taskkill', '/F', '/IM', dest.name]
info('Killing game', dest, cmd)
subprocess.run(cmd, text=True, capture_output=True, check=True, timeout=30, creationflags=subprocess.CREATE_NO_WINDOW)
time.sleep(1)
CopyTo(source, dest)
return True
31 changes: 20 additions & 11 deletions installer/Install/Install.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from Install import MapVariants
from Install import Config
from GUI.SaveMigration import SaveMigration
from GUI.KillRunningGame import CopyExeTo
from GUI.KillRunningGame import AskKillGame, CopyExeTo
except Exception as e:
info('ERROR: importing', e)
raise
Expand Down Expand Up @@ -77,6 +77,8 @@ def Install(exe:Path, flavors:dict, globalsettings:dict) -> dict:

info('Installing flavors:', flavors, globalsettings, exe)

AskKillGame(exe)

for(f, settings) in flavors.items():
ret={}
if not settings.get('install') and f != 'Vanilla':
Expand Down Expand Up @@ -119,13 +121,6 @@ def InstallVanilla(system:Path, settings:dict, globalsettings:dict):
if not settings.get('install') and not settings.get('LDDP') and not settings.get('FixVanilla'):
return

if settings.get('LDDP'):
InstallLDDP(system, settings)

# always install FemJCu because it doesn't hurt to have
FemJCu = GetSourcePath() / '3rdParty' / "FemJC.u"
CopyTo(FemJCu, system / 'FemJC.u')

exe_source = GetSourcePath() / '3rdParty' / "KentieDeusExe.exe"
exetype = settings.get('exetype')
kentie = True
Expand All @@ -148,17 +143,25 @@ def InstallVanilla(system:Path, settings:dict, globalsettings:dict):
else:
info('skipping fixing of vanilla')

if settings.get('install'):
exedest:Path = system / (exename+'.exe')
CopyExeTo(exe_source, exedest)

if kentie: # kentie needs this, copy it into the regular System folder, doesn't hurt if you don't need it
deusexeu = GetSourcePath() / '3rdParty' / "DeusExe.u"
CopyTo(deusexeu, system / 'DeusExe.u')

if settings.get('LDDP'):
InstallLDDP(system, settings)

# always install FemJCu because it doesn't hurt to have
FemJCu = GetSourcePath() / '3rdParty' / "FemJC.u"
CopyTo(FemJCu, system / 'FemJC.u')

if not settings.get('install'):
info('skipping installation of vanilla DXRando')
return

exedest:Path = system / (exename+'.exe')
CopyExeTo(exe_source, exedest)

intfile = GetSourcePath() / 'Configs' / 'DXRando.int'
intdest = system / (exename+'.int')
CopyTo(intfile, intdest)
Expand Down Expand Up @@ -323,6 +326,8 @@ def InstallLDDP(system:Path, settings:dict):

def InstallGMDX(system:Path, settings:dict, exename:str):
game = system.parent
AskKillGame(system/'GMDX.exe')
AskKillGame(system/'GMDXv10.exe')
(changes, additions) = GetConfChanges('GMDX')
Mkdir(game/'SaveGMDXRando', exist_ok=True)
# GMDX uses absolute path shortcuts with ini files in their arguments, so it's not as simple to copy their exe
Expand All @@ -347,10 +352,12 @@ def InstallGMDX(system:Path, settings:dict, exename:str):
def InstallRevision(system:Path, settings:dict):
# Revision's exe is special and calls back to Steam which calls the regular Revision.exe file, so we pass in_place=True
revsystem = system.parent / 'Revision' / 'System'
AskKillGame(revsystem/'Revision.exe')
CreateModConfigs(revsystem, settings, 'Rev', 'Revision', in_place=True)


def InstallHX(system:Path, settings:dict):
AskKillGame(system/'HX.exe')
CopyPackageFiles('HX', system.parent, ['HXRandomizer.u'])
(changes, additions) = GetConfChanges('HX')
Mkdir(system.parent/'SaveHXRando', exist_ok=True)
Expand All @@ -366,6 +373,8 @@ def CreateModConfigs(system:Path, settings:dict, modname:str, exename:str, in_pl
newexepath = system / (newexename+'.exe')
modpath = system.parent / (modname+'Randomizer')
mapspath = modpath / 'Maps'
AskKillGame(exepath)
AskKillGame(newexepath)
Mkdir(mapspath, exist_ok=True, parents=True)
if not IsWindows():
in_place = True
Expand Down

0 comments on commit 899beba

Please sign in to comment.