From 0899e13f319b8bc9c4dbbc184c9c08a4cebb13fb Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 10 Sep 2025 16:28:18 +0200 Subject: [PATCH 1/6] Add additional DLLs to the lslib retriever --- games/baldursgate3/lslib_retriever.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/games/baldursgate3/lslib_retriever.py b/games/baldursgate3/lslib_retriever.py index 9a7b7af..8716703 100644 --- a/games/baldursgate3/lslib_retriever.py +++ b/games/baldursgate3/lslib_retriever.py @@ -25,16 +25,19 @@ def _needed_lslib_files(self): "Divine.dll.config", "Divine.exe", "Divine.runtimeconfig.json", + "K4os.Compression.LZ4.dll", + "K4os.Compression.LZ4.Streams.dll", "LSLib.dll", "LSLibNative.dll", "LZ4.dll", + "Newtonsoft.Json.dll", "System.IO.Hashing.dll", "ZstdSharp.dll", } } def download_lslib_if_missing(self, force: bool = False) -> bool: - if not force and all(x.exists() for x in self._needed_lslib_files): + if not force and (self._utils.tools_dir / "Divine.exe").exists(): return True try: self._utils.tools_dir.mkdir(exist_ok=True, parents=True) From e007d99e4a47127bf227cfb3a051e5fb93e4648e Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 10 Sep 2025 16:33:49 +0200 Subject: [PATCH 2/6] Fix regex pattern for folder name in pak_parser --- games/baldursgate3/pak_parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/games/baldursgate3/pak_parser.py b/games/baldursgate3/pak_parser.py index e3757e4..940a3d3 100644 --- a/games/baldursgate3/pak_parser.py +++ b/games/baldursgate3/pak_parser.py @@ -249,7 +249,7 @@ def metadata_to_ini( # 2. it has files in Mods// other than the meta.lsx file, or # 3. it has files in Public/ result = self.run_divine( - f'list-package --use-regex -x "(/{folder_name}/(?!meta\\.lsx))|(Public/Engine/Timeline/MaterialGroups)"', + f'list-package --use-regex -x "(/{re.escape(folder_name)}/(?!meta\\.lsx))|(Public/Engine/Timeline/MaterialGroups)"', file, ) self._mod_cache[file] = ( From 966aeb61baebb298801d387633d6e92adc222956 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 10 Sep 2025 16:35:14 +0200 Subject: [PATCH 3/6] Ensure log directory is created if missing --- games/game_baldursgate3.py | 1 + 1 file changed, 1 insertion(+) diff --git a/games/game_baldursgate3.py b/games/game_baldursgate3.py index 03bd8a0..fcc4497 100644 --- a/games/game_baldursgate3.py +++ b/games/game_baldursgate3.py @@ -179,6 +179,7 @@ def _base_dlls(self) -> set[str]: def _on_finished_run(self, exec_path: str, exit_code: int): if "bin/bg3" not in exec_path: return + self.utils.log_dir.mkdir(parents=True, exist_ok=True) if self.utils.log_diff: for x in difflib.unified_diff( open(self.utils.modsettings_backup).readlines(), From 48d55aabdef45069df99d922ab685c216cde17c8 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 10 Sep 2025 16:40:37 +0200 Subject: [PATCH 4/6] Update pak file naming to include parent directory name --- games/baldursgate3/pak_parser.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/games/baldursgate3/pak_parser.py b/games/baldursgate3/pak_parser.py index 940a3d3..e9a00c5 100644 --- a/games/baldursgate3/pak_parser.py +++ b/games/baldursgate3/pak_parser.py @@ -154,7 +154,8 @@ def _get_metadata_for_file( f"pak with same name as packable dir exists in mod directory. not packing dir {file}" ) return "" - pak_path = self._utils.overwrite_path / f"Mods/{file.name}.pak" + parent_mod_name = file.parent.name.replace(" ", "_") + pak_path = self._utils.overwrite_path / f"Mods/{parent_mod_name}_{file.name}.pak" build_pak = True if pak_path.exists(): pak_creation_time = os.path.getmtime(pak_path) From 7668216d38d65e884b5cab6d9fa367bbcbb852dd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 10 Sep 2025 14:40:42 +0000 Subject: [PATCH 5/6] [pre-commit.ci] Auto fixes from pre-commit.com hooks. --- games/baldursgate3/pak_parser.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/games/baldursgate3/pak_parser.py b/games/baldursgate3/pak_parser.py index e9a00c5..7797df5 100644 --- a/games/baldursgate3/pak_parser.py +++ b/games/baldursgate3/pak_parser.py @@ -155,7 +155,10 @@ def _get_metadata_for_file( ) return "" parent_mod_name = file.parent.name.replace(" ", "_") - pak_path = self._utils.overwrite_path / f"Mods/{parent_mod_name}_{file.name}.pak" + pak_path = ( + self._utils.overwrite_path + / f"Mods/{parent_mod_name}_{file.name}.pak" + ) build_pak = True if pak_path.exists(): pak_creation_time = os.path.getmtime(pak_path) From 8d8697d8d3b472312c779cefc1361a790ebe98b2 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 10 Sep 2025 16:44:59 +0200 Subject: [PATCH 6/6] revert change --- games/baldursgate3/lslib_retriever.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/games/baldursgate3/lslib_retriever.py b/games/baldursgate3/lslib_retriever.py index 8716703..5a031f0 100644 --- a/games/baldursgate3/lslib_retriever.py +++ b/games/baldursgate3/lslib_retriever.py @@ -37,7 +37,7 @@ def _needed_lslib_files(self): } def download_lslib_if_missing(self, force: bool = False) -> bool: - if not force and (self._utils.tools_dir / "Divine.exe").exists(): + if not force and all(x.exists() for x in self._needed_lslib_files): return True try: self._utils.tools_dir.mkdir(exist_ok=True, parents=True)