|
6 | 6 |
|
7 | 7 | from steamlayer.emulators import Emulator, EmulatorConfig |
8 | 8 | from steamlayer.fileops import BackedUpFile, SteamAPIDll |
| 9 | +from steamlayer.logging_utils import spinner |
9 | 10 | from steamlayer.steamstub import SteamlessCLI, SteamStubScanner |
10 | 11 |
|
11 | 12 | log = logging.getLogger("steamlayer." + __name__) |
@@ -85,17 +86,9 @@ def _handle_steamstub(self, dlls: list[SteamAPIDll]) -> None: |
85 | 86 | return |
86 | 87 |
|
87 | 88 | if not self.unpack: |
88 | | - log.warning("─" * 60) |
89 | | - log.warning("⚠ STEAMSTUB (SteamDRM) DETECTED") |
90 | | - log.warning( |
91 | | - "\nOne or more executables are wrapped with SteamStub. Replacing the DLL might not be enough." |
92 | | - ) |
93 | 89 | for exe, variant in sorted(wrapped.items()): |
94 | 90 | rel = exe.relative_to(self.game.path) if exe.is_relative_to(self.game.path) else exe |
95 | | - log.warning(f" {rel} [{variant}]") |
96 | | - |
97 | | - log.warning("\nRECOMMENDED: Run with '--unpack' to automate DRM removal via Steamless.") |
98 | | - log.warning("─" * 60) |
| 91 | + log.warning(f"SteamStub detected on '{rel}' ({variant}) — re-run with --unpack to strip it.") |
99 | 92 | return |
100 | 93 |
|
101 | 94 | dry_prefix = "[DRY RUN] " if self.dry_run else "" |
@@ -153,45 +146,49 @@ def run(self) -> None: |
153 | 146 | if not dlls: |
154 | 147 | raise FileNotFoundError("No Steam API DLLs found in game directory.") |
155 | 148 |
|
156 | | - self._handle_steamstub(dlls) |
| 149 | + with spinner("Handling steamstub..."): |
| 150 | + self._handle_steamstub(dlls) |
157 | 151 |
|
158 | | - for dll in dlls: |
159 | | - relative_path = dll.file.relative_to(self.game.path) |
160 | | - vault_dest = self.vault_root / relative_path |
161 | | - dll.set_backup_destination(vault_dest) |
162 | | - |
163 | | - if self.dry_run: |
164 | | - patched_dlls = dlls # used for logging at the end |
| 152 | + with spinner("Patching the game..."): |
165 | 153 | for dll in dlls: |
166 | | - log.info(f"[DRY RUN] Would vault original to: {dll.backup_path}") |
167 | | - log.info(f"[DRY RUN] Would overwrite: {dll.file}") |
168 | | - |
169 | | - for target_dir in {d.file.parent for d in dlls}: |
170 | | - log.info( |
171 | | - f"[DRY RUN] Would configure '{target_dir}' using the following flags: " |
172 | | - f"(APPID={self.game.appid} DLLS={dlls} DLCS={self.game.dlcs}). " |
173 | | - f"User-specific information would also be correctly written." |
174 | | - ) |
175 | | - |
176 | | - else: |
177 | | - patched_dlls = self.emulator.patch_game(dlls=dlls) |
178 | | - try: |
179 | | - self.emulator.create_config_files( |
180 | | - config=self.config, |
181 | | - appid=self.game.appid, |
182 | | - game_path=self.game.path, |
183 | | - dll_paths=[d.file for d in patched_dlls], |
184 | | - ) |
185 | | - except Exception as e: |
186 | | - log.error( |
187 | | - f"Config creation failed: {e}. The DLL patch was still applied " |
188 | | - "— the game may still work with default settings." |
189 | | - ) |
| 154 | + relative_path = dll.file.relative_to(self.game.path) |
| 155 | + vault_dest = self.vault_root / relative_path |
| 156 | + dll.set_backup_destination(vault_dest) |
190 | 157 |
|
191 | | - dlc_count = len(self.game.dlcs) if self.game.dlcs else 0 |
192 | | - dll_count = len(patched_dlls) |
| 158 | + if self.dry_run: |
| 159 | + patched_dlls = dlls # used for logging at the end |
| 160 | + for dll in dlls: |
| 161 | + log.info(f"[DRY RUN] Would vault original to: {dll.backup_path}") |
| 162 | + log.info(f"[DRY RUN] Would overwrite: {dll.file}") |
| 163 | + |
| 164 | + for target_dir in {d.file.parent for d in dlls}: |
| 165 | + log.info( |
| 166 | + f"[DRY RUN] Would configure '{target_dir}' using the following flags: " |
| 167 | + f"(APPID={self.game.appid} DLLS={dlls} DLCS={self.game.dlcs}). " |
| 168 | + f"User-specific information would also be correctly written." |
| 169 | + ) |
193 | 170 |
|
194 | | - log.info(f"{dry_prefix}Patch completed successfully (AppID={appid}, DLLs={dll_count}, DLCs={dlc_count})") |
| 171 | + else: |
| 172 | + patched_dlls = self.emulator.patch_game(dlls=dlls) |
| 173 | + try: |
| 174 | + self.emulator.create_config_files( |
| 175 | + config=self.config, |
| 176 | + appid=self.game.appid, |
| 177 | + game_path=self.game.path, |
| 178 | + dll_paths=[d.file for d in patched_dlls], |
| 179 | + ) |
| 180 | + except Exception as e: |
| 181 | + log.error( |
| 182 | + f"Config creation failed: {e}. The DLL patch was still applied " |
| 183 | + "— the game may still work with default settings." |
| 184 | + ) |
| 185 | + |
| 186 | + dlc_count = len(self.game.dlcs) if self.game.dlcs else 0 |
| 187 | + dll_count = len(patched_dlls) |
| 188 | + |
| 189 | + log.info( |
| 190 | + f"{dry_prefix}Patch completed successfully (AppID={appid}, DLLs={dll_count}, DLCs={dlc_count})" |
| 191 | + ) |
195 | 192 |
|
196 | 193 |
|
197 | 194 | class GameRestorer: |
|
0 commit comments