Skip to content

Commit

Permalink
Remove downgrade login seperation
Browse files Browse the repository at this point in the history
  • Loading branch information
coffandro committed Jul 26, 2024
1 parent 76b4a73 commit 8ac40a9
Showing 1 changed file with 29 additions and 101 deletions.
130 changes: 29 additions & 101 deletions FOLON-Downgrader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -140,33 +135,26 @@ 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)

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 #
#########################################################################################
Expand Down Expand Up @@ -322,6 +310,7 @@ def WrongPathDialog2(self, path): # GUI Backend

def tab2UI(self): # GUI
self.FinishedLogging = False
self.Downloadstep = 0

layout = QFormLayout()

Expand Down Expand Up @@ -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()

Expand All @@ -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,
Expand All @@ -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)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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(
"<p>The following button can take quite a while, please <b>be patient</b>.</p>"
)
)

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(
[
Expand Down Expand Up @@ -809,7 +737,7 @@ def RemoveCC(self):
# FINIS STAGE #
##########################################################################################

def tab4UI(self): # GUI
def tab3UI(self): # GUI
layout = QGridLayout()

TextLayout = QVBoxLayout()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8ac40a9

Please sign in to comment.