@@ -2823,6 +2823,14 @@ void MainWindow::setInitialUser(const QString& username, const QJsonObject& data
28232823 }
28242824 }
28252825 updateSidebarAvatar ();
2826+
2827+ // Check if initial setup is needed
2828+ QString appDataPath = QStandardPaths::writableLocation (QStandardPaths::AppConfigLocation);
2829+ QString settingsPath = appDataPath + " /settings.ini" ;
2830+ QSettings settings (settingsPath, QSettings::IniFormat);
2831+ if (!settings.value (" initial_setup_done" , false ).toBool ()) {
2832+ runInitialSetup ();
2833+ }
28262834}
28272835
28282836void MainWindow::sendHeartbeat () {
@@ -3248,3 +3256,92 @@ void MainWindow::checkAppUpdate() {
32483256 });
32493257}
32503258
3259+ void MainWindow::runInitialSetup () {
3260+ QWidget* overlay = new QWidget (this );
3261+ overlay->setStyleSheet (" background-color: rgba(10, 10, 15, 240);" );
3262+ overlay->setGeometry (rect ());
3263+ overlay->show ();
3264+
3265+ QVBoxLayout* layout = new QVBoxLayout (overlay);
3266+ layout->setAlignment (Qt::AlignCenter);
3267+
3268+ QLabel* title = new QLabel (" Setting up your Steam Environment" , overlay);
3269+ title->setStyleSheet (" font-size: 28px; font-weight: bold; color: white; background: transparent;" );
3270+ title->setAlignment (Qt::AlignCenter);
3271+
3272+ QLabel* status = new QLabel (" Initializing..." , overlay);
3273+ status->setStyleSheet (" font-size: 16px; color: #A8DB8F; background: transparent; margin-top: 20px;" );
3274+ status->setAlignment (Qt::AlignCenter);
3275+
3276+ LoadingSpinner* spinner = new LoadingSpinner (overlay);
3277+ spinner->setFixedSize (60 , 60 );
3278+
3279+ layout->addStretch ();
3280+ layout->addWidget (title, 0 , Qt::AlignCenter);
3281+ layout->addSpacing (30 );
3282+ layout->addWidget (spinner, 0 , Qt::AlignCenter);
3283+ layout->addWidget (status, 0 , Qt::AlignCenter);
3284+ layout->addStretch ();
3285+
3286+ overlay->raise ();
3287+ overlay->installEventFilter (this ); // Intercept events so user can't click through
3288+
3289+ status->setText (" Optimizing Steam Auto-Start..." );
3290+ QCoreApplication::processEvents ();
3291+
3292+ // 1. Remove standard Registry Run Key
3293+ QSettings reg (" HKEY_CURRENT_USER\\ Software\\ Microsoft\\ Windows\\ CurrentVersion\\ Run" , QSettings::NativeFormat);
3294+ reg.remove (" Steam" );
3295+
3296+ // 2. Create shortcut in Startup folder with correct Working Directory
3297+ QString psScript =
3298+ " $WshShell = New-Object -comObject WScript.Shell;"
3299+ " $Shortcut = $WshShell.CreateShortcut([Environment]::GetFolderPath('Startup') + '\\ Steam.lnk');"
3300+ " $Shortcut.TargetPath = 'C:\\ Program Files (x86)\\ Steam\\ steam.exe';"
3301+ " $Shortcut.Arguments = '-silent';"
3302+ " $Shortcut.WorkingDirectory = 'C:\\ Program Files (x86)\\ Steam';"
3303+ " $Shortcut.Save();" ;
3304+
3305+ QProcess* ps = new QProcess (this );
3306+ ps->start (" powershell" , QStringList () << " -NoProfile" << " -Command" << psScript);
3307+ ps->waitForFinished ();
3308+ ps->deleteLater ();
3309+
3310+ // 3. Patch Steam Payload
3311+ status->setText (" Installing Steam DRM Patch payload..." );
3312+ QCoreApplication::processEvents ();
3313+
3314+ if (!m_steamPatchWorker) {
3315+ m_steamPatchWorker = new SteamPatchWorker (this );
3316+ }
3317+
3318+ // Disconnect old connections to prevent duplicates
3319+ m_steamPatchWorker->disconnect ();
3320+
3321+ connect (m_steamPatchWorker, &SteamPatchWorker::log, this , [status](QString msg, QString level) {
3322+ status->setText (msg);
3323+ });
3324+
3325+ connect (m_steamPatchWorker, &SteamPatchWorker::finished, this , [this , overlay]() {
3326+ QString appDataPath = QStandardPaths::writableLocation (QStandardPaths::AppConfigLocation);
3327+ QString settingsPath = appDataPath + " /settings.ini" ;
3328+ QSettings settings (settingsPath, QSettings::IniFormat);
3329+ settings.setValue (" initial_setup_done" , true );
3330+
3331+ overlay->deleteLater ();
3332+ });
3333+
3334+ connect (m_steamPatchWorker, &SteamPatchWorker::error, this , [status](QString errorMsg) {
3335+ status->setText (" Error: " + errorMsg);
3336+ status->setStyleSheet (" color: #F2B8B5; font-size: 16px; background: transparent; margin-top: 10px;" );
3337+
3338+ // Even if payload patch fails, let them proceed after a delay
3339+ QTimer::singleShot (3000 , status, [status]() {
3340+ if (status && status->parentWidget ()) {
3341+ status->parentWidget ()->deleteLater ();
3342+ }
3343+ });
3344+ });
3345+
3346+ m_steamPatchWorker->start ();
3347+ }
0 commit comments