From 8ac40a904f0658dc517dac3bc60b1780a9c88ff0 Mon Sep 17 00:00:00 2001 From: Cornelius Andreas Rosenaa Date: Fri, 26 Jul 2024 16:31:11 +0200 Subject: [PATCH] Remove downgrade login seperation --- FOLON-Downgrader.py | 130 ++++++++++---------------------------------- 1 file changed, 29 insertions(+), 101 deletions(-) diff --git a/FOLON-Downgrader.py b/FOLON-Downgrader.py index e5214a3..596e571 100644 --- a/FOLON-Downgrader.py +++ b/FOLON-Downgrader.py @@ -112,11 +112,6 @@ def __init__(self, steampath=None): self.stacklayout.addWidget(self.tab3) self.tab3UI() - self.tab4 = QWidget() - self.tab4.setObjectName("Tab") - self.stacklayout.addWidget(self.tab4) - self.tab4UI() - self.InstallProgress = QProgressBar(self) self.InstallProgress.setFormat("Locate SteamApps folder") self.InstallProgress.setObjectName("DowngraderProgress") @@ -140,14 +135,14 @@ def ContinueAction(self): self.SubmitPath() elif self.TabIndex == 2: self.SteamSubmit() - elif self.TabIndex == 4: + elif self.TabIndex == 3: self.Finish() def activate_tab_2(self): # GUI Backend self.TabIndex = 2 self.stacklayout.setCurrentIndex(1) self.SubmitButton.setEnabled(False) - self.SubmitButton.setText("Login to Steam") + self.SubmitButton.setText("Login to Steam and downgrade") self.InstallProgress.setFormat("Login to Steam") self.InstallProgress.setValue(self.TabIndex) @@ -155,18 +150,11 @@ def activate_tab_3(self): # GUI Backend if self.FinishedLogging: self.TabIndex = 3 self.stacklayout.setCurrentIndex(2) - self.SubmitButton.hide() - self.InstallProgress.setFormat("Downgrade Fallout 4") + self.SubmitButton.show() + self.SubmitButton.setText("Finish!") + self.InstallProgress.setFormat("Bethesda, Bethesda Never Changes") self.InstallProgress.setValue(self.TabIndex) - def activate_tab_4(self): # GUI Backend - self.TabIndex = 4 - self.stacklayout.setCurrentIndex(3) - self.SubmitButton.show() - self.SubmitButton.setText("Finish!") - self.InstallProgress.setFormat("Bethesda, Bethesda Never Changes") - self.InstallProgress.setValue(self.TabIndex) - ######################################################################################### # GENERAL GUI # ######################################################################################### @@ -322,6 +310,7 @@ def WrongPathDialog2(self, path): # GUI Backend def tab2UI(self): # GUI self.FinishedLogging = False + self.Downloadstep = 0 layout = QFormLayout() @@ -395,14 +384,23 @@ def SteamSubmit(self): # Steam PostFunction=self.SteamSubmit, ) else: - self.Loading( - self.LoginSteam, - text="Logging into Steam", - UseResult=True, - PostFunction=self.LoginPopups, - ) + if self.Downloadstep == 0: + self.Loading( + lambda: self.LoginSteam(self.Downloadstep), + text="Logging in and downgrading", + UseResult=True, + PostFunction=self.LoginPopups, + ) + elif self.Downloadstep == 1: + self.Loading( + self.RemoveCC, + text=f"Removing Creation Club content", + PostFunction=self.LoginPopups, + ) + else: + self.activate_tab_3() - def LoginSteam(self): # Steam + def LoginSteam(self, DownloadStepVAR): # Steam self.Password = self.PasswordEntry.text() self.Username = self.UsernameEntry.text() @@ -424,14 +422,14 @@ def LoginSteam(self): # Steam if os.path.isfile(self.DepotDownloader): self.Steam = pexpect.popen_spawn.PopenSpawn( - f'{self.DepotDownloader} -username "{self.Username}" -password "{self.Password}" -remember-password -app 377160 -depot 377162 -dir FOLON-Downgrader-Files/SteamFiles', + f'{self.DepotDownloader} -username {self.Username} -password "{self.Password}" -remember-password -app 377160 -depot 377161 377162 377163 377164 435880 435870 435871 -manifest 7497069378349273908 5847529232406005096 5819088023757897745 2178106366609958945 1255562923187931216 1691678129192680960 5106118861901111234 -dir "{self.SteamPath}" -validate', logfile=sys.stdout.buffer, timeout=120, ) - self.Wait() + self.Wait(DownloadStepVAR) - def Wait(self): + def Wait(self, DownloadStepVAR): index = self.Steam.expect( [ pexpect.EOF, @@ -446,6 +444,7 @@ def Wait(self): if index == 0: Settings["LoginResult"] = "Success" Util.Write_Settings(Settings) + DownloadStepVAR += 1 elif index == 1: Settings["LoginResult"] = "Guard" Util.Write_Settings(Settings) @@ -569,12 +568,7 @@ def GuardSubmitInit2(self): except: pass - self.Loading( - self.LoginSteam, - text="Checking auth", - UseResult=True, - PostFunction=self.LoginPopups, - ) + self.SteamSubmit() def SteamGuideDialog(self, parent): # GUI if not self.shown: @@ -714,72 +708,6 @@ def OpenRateDialog(self): # GUI def CloseRateDialog(self): # GUI Backend sys.exit() - ########################################################################################## - # Installation # - ########################################################################################## - - def tab3UI(self): # GUI - self.Depots = [ - # Main game - [377161, 7497069378349273908], - [377162, 5847529232406005096], - [377163, 5819088023757897745], - [377164, 2178106366609958945], - # Workshops - [435880, 1255562923187931216], - # Automatron - [435870, 1691678129192680960], - [435871, 5106118861901111234], - ] - self.DownloadIndex = 0 - self.SteamFiles = "FOLON-Downgrader-Files/SteamFiles/depots" - self.Downloaded = 0 - layout = QFormLayout() - - Header = QLabel("Downgrade Fallout 4") - Header.setFont(QFont("Overseer", 30)) - # layout.addRow(Header) - layout.addRow( - QLabel( - "

The following button can take quite a while, please be patient.

" - ) - ) - - InstallButton = QPushButton( - text="Downgrade Fallout 4 \n(This will take a long time)" - ) - InstallButton.setObjectName("InstallButton") - InstallButton.setFont(QFont("Overseer", 25)) - InstallButton.pressed.connect(self.InstallInit) - layout.addRow(InstallButton) - - self.tab3.setLayout(layout) - - def InstallInit(self): - if self.DownloadIndex < len(self.Depots): - self.Loading( - lambda: self.Install(self.DownloadIndex), - text=f"Downloading depot[{self.DownloadIndex+1}/{len(self.Depots)}]", - PostFunction=self.InstallInit, - ) - elif self.Downloaded == 1: - self.Loading( - self.RemoveCC, - text=f"Removing Creation Club content", - PostFunction=self.InstallInit, - ) - elif self.Downloaded == 2: - self.activate_tab_4() - - def Install(self, index): - self.Steam.timeout = None - self.Steam = pexpect.popen_spawn.PopenSpawn( - f'{self.DepotDownloader} -username "{self.Username}" -remember-password -app 377160 -depot {self.Depots[index][0]} -manifest "{self.Depots[index][1]}" -dir "{self.SteamPath}" -validate', - logfile=sys.stdout.buffer, - timeout=None, - ) - self.Wait3() - def Wait3(self): index = self.Steam.expect( [ @@ -809,7 +737,7 @@ def RemoveCC(self): # FINIS STAGE # ########################################################################################## - def tab4UI(self): # GUI + def tab3UI(self): # GUI layout = QGridLayout() TextLayout = QVBoxLayout() @@ -840,7 +768,7 @@ def tab4UI(self): # GUI separator_horizontal = QHSeparationLine() layout.addWidget(separator_horizontal, 1, 0, 1, 2) - self.tab4.setLayout(layout) + self.tab3.setLayout(layout) def OpenDiscord(self): from webbrowser import open