Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
Folder pick improvements
Browse files Browse the repository at this point in the history
Also version bump
  • Loading branch information
Caleb Smith committed Jun 27, 2022
1 parent b21ed61 commit bcb5048
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "bcml"
authors = ["Caleb Smith"]
version = "3.9.12"
version = "3.9.13"
edition = "2021"
readme = "docs/README.md"

Expand Down
2 changes: 1 addition & 1 deletion bcml/__version__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
_MAJOR=3
_MINOR=9
_PATCH="12"
_PATCH="13"

VERSION = f"{_MAJOR}.{_MINOR}.{_PATCH}"
USER_VERSION = f"""{_MAJOR}.{_MINOR}.{_PATCH[0:1]} {
Expand Down
43 changes: 29 additions & 14 deletions bcml/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from tempfile import NamedTemporaryFile, mkdtemp
from time import sleep
from threading import Thread
from typing import List
from typing import List, Optional
from xml.dom import minidom

import requests
Expand Down Expand Up @@ -140,20 +140,35 @@ def parse_cemu_settings(self, params):
cemu = Path(params["folder"])
set_path = cemu / "settings.xml"
settings: minidom = util.parse_cemu_settings(set_path)
game_dir: Path
for entry in settings.getElementsByTagName("GameCache")[
0
].getElementsByTagName("Entry"):
entry: minidom.Element
path = entry.getElementsByTagName("path")[0].childNodes[0].data
if "U-King" in path:
game_dir = Path(path).parent.parent / "content"
break
game_dir: Optional[Path] = None
mlc_path: Path
try:
for entry in settings.getElementsByTagName("GameCache")[
0
].getElementsByTagName("Entry"):
entry: minidom.Element
path: str = entry.getElementsByTagName("path")[0].childNodes[0].data
if "U-King" in path:
if SYSTEM == "Linux" and path[1:3] == ":\\":
path = path[2:].replace("\\", "/")
game_dir = Path(path).parent.parent / "content"
break
except IndexError:
pass
try:
mlc_str: str = settings.getElementsByTagName("mlc_path")[0].childNodes[0].data
if SYSTEM == "Linux" and mlc_str[1:3] == ":\\":
mlc_path = Path(mlc_str[2:].replace("\\", "/"))
else:
mlc_path = Path(mlc_str)
except IndexError:
mlc_path = cemu / "mlc01"
if not mlc_path.exists():
return {}
if not game_dir:
return {}
mlc_path = Path(
settings.getElementsByTagName("mlc_path")[0].childNodes[0].data
)
game_dir = util.guess_game_dir(mlc_path)
if not game_dir:
return {}
update_dir = util.guess_update_dir(mlc_path, game_dir)
dlc_dir = util.guess_aoc_dir(mlc_path, game_dir)
return {
Expand Down
13 changes: 13 additions & 0 deletions bcml/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,19 @@ def set_site_meta(site_meta: str):
save_settings()


def guess_game_dir(mlc_dir: Path) -> Optional[Path]:
ids = {
("00050000", "101C9400"),
("00050000", "101C9500"),
("00050000", "101C9300"),
}
for (id1, id2) in ids:
target = mlc_dir / "usr" / "title" / id1 / id2 / "content"
if target.exists():
return target
return None


@lru_cache(None)
def get_title_id(game_dir: Path = None) -> Tuple[str, str]:
title_id = "00050000101C9400"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "bcml"
version = "3.9.12"
version = "3.9.13"
description = "A mod manager for The Legend of Zelda: Breath of the Wild"
author = "NiceneNerd"
author_email = "[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="bcml",
version="3.9.12",
version="3.9.13",
author="NiceneNerd",
author_email="[email protected]",
description="A mod manager for The Legend of Zelda: Breath of the Wild",
Expand Down

0 comments on commit bcb5048

Please sign in to comment.