From 730f900ff52c6d23f5492d87740ef90df7e77cdf Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Wed, 21 Oct 2026 09:53:37 +0200 Subject: [PATCH] fix: detect emudeck on macos EmuDeck's macOS build reads ~/.config/EmuDeck/settings.sh like the Linux one (functions/all.sh:3-4,24 and vars.sh:2 at dddb3022). The settings and ~/Emulation/bios rules now run on darwin too. --- install.ps1 | 2 +- install.py | 14 +++++++++----- install.sh | 2 +- platforms/_registry.yml | 11 +++++++++++ tests/test_install.py | 15 +++++++++++++++ wiki/installer.md | 4 ++-- 6 files changed, 39 insertions(+), 9 deletions(-) diff --git a/install.ps1 b/install.ps1 index f67d62ec..f7957297 100644 --- a/install.ps1 +++ b/install.ps1 @@ -11,7 +11,7 @@ $ErrorActionPreference = "Stop" $defaultInstallUrl = "https://raw.githubusercontent.com/Abdess/retrobios/main/install.py" - $defaultInstallSha256 = "1cf3bd0d3985e3a728513be75cb80682fe1e7a9224da6437e8f1cd9b2a3eedb1" + $defaultInstallSha256 = "1eb1aed96cab57bf3bc4ef2918bf1ef40cafcb1de157af2e5fcd5a23ae69a443" $maximumInstallerBytes = 2MB $installerExit = 0 $installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null } diff --git a/install.py b/install.py index 4e3581a9..4c2e6006 100644 --- a/install.py +++ b/install.py @@ -1102,6 +1102,7 @@ _PATH_RULES: tuple[tuple[str, str, str, str | None], ...] = ( ("windows", "retrobat", "C:\\RetroBat\\bios", None), ("windows", "retrobat", "%USERPROFILE%\\RetroBat\\bios", None), ("linux", "emudeck", "$HOME/Emulation/bios", None), + ("darwin", "emudeck", "$HOME/Emulation/bios", None), ("linux", "retrodeck", "$HOME/.var/app/net.retrodeck.retrodeck", "$HOME/retrodeck"), ("linux", "romm", "/romm/library/bios", None), # A library laid out as {platform}/bios has no library/bios: RomM's @@ -1238,15 +1239,18 @@ def detect_platforms(os_type: str) -> list[tuple[str, Path]]: muos = _muos_system_dir() if embedded and embedded[0][0] == "retroarch" else None found.extend([("retroarch", muos)] if muos else embedded) - # EmuDeck (Linux/SteamOS) - home = Path.home() - emudeck_settings = home / ".config" / "EmuDeck" / "settings.sh" + if os_type in ("linux", "wsl", "darwin"): + # EmuDeck on Linux and macOS: functions/all.sh:3-4 and 24 (EmuDeck + # dddb3022) reads $emudeckFolder/settings.sh on both, and vars.sh:2 + # sets emudeckFolder to $HOME/.config/EmuDeck. + emudeck_settings = Path.home() / ".config" / "EmuDeck" / "settings.sh" if emudeck_settings.exists(): emu_path = _parse_bash_var(emudeck_settings, "emulationPath") if emu_path: - bios_dir = Path(emu_path) / "bios" - found.append(("emudeck", bios_dir)) + found.append(("emudeck", Path(emu_path) / "bios")) + if os_type in ("linux", "wsl"): + home = Path.home() # RetroDECK: retrodeck.json since the cfg-to-json migration, which # renames the old retrodeck.cfg to retrodeck.bak (global.sh:149-153) retrodeck_conf_dir = home / ".var" / "app" / "net.retrodeck.retrodeck" / "config" / "retrodeck" diff --git a/install.sh b/install.sh index c5c3ec4a..ac4d205d 100755 --- a/install.sh +++ b/install.sh @@ -18,7 +18,7 @@ esac TEMP_INSTALLER="" TEMP_DIRECTORY="" DEFAULT_INSTALL_URL="https://raw.githubusercontent.com/Abdess/retrobios/main/install.py" -DEFAULT_INSTALL_SHA256="1cf3bd0d3985e3a728513be75cb80682fe1e7a9224da6437e8f1cd9b2a3eedb1" +DEFAULT_INSTALL_SHA256="1eb1aed96cab57bf3bc4ef2918bf1ef40cafcb1de157af2e5fcd5a23ae69a443" MAX_INSTALLER_BYTES=2097152 cleanup() { diff --git a/platforms/_registry.yml b/platforms/_registry.yml index 22c77a2d..790d0f31 100644 --- a/platforms/_registry.yml +++ b/platforms/_registry.yml @@ -413,6 +413,17 @@ platforms: - os: linux method: path_exists path: $HOME/Emulation/bios + # functions/all.sh:3-4,24 and vars.sh:2 (EmuDeck dddb3022): the macOS + # build reads the same settings.sh, emulationPath=~/Emulation by + # default (settings.sh:79). + - os: darwin + method: config_file + config: $HOME/.config/EmuDeck/settings.sh + parse_key: emulationPath + bios_subdir: bios + - os: darwin + method: path_exists + path: $HOME/Emulation/bios # functions/all.ps1:4-14 (emudeck-we 037460ef): the APPDATA settings, # else the profile ones, and C:\Emulation when neither names a folder. - os: windows diff --git a/tests/test_install.py b/tests/test_install.py index d358344e..2f6a62a2 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -1110,6 +1110,21 @@ class DetectionFollowsTheRegistry(unittest.TestCase): install._detect_by_path("linux", found) self.assertEqual(found, [("emudeck", home / "elsewhere" / "bios")]) + def test_emudeck_on_macos_is_found_by_its_settings(self): + """EmuDeck's macOS build reads ~/.config/EmuDeck/settings.sh as the + Linux one does (functions/all.sh:3-4,24, vars.sh:2): a Mac with + EmuDeck detected nothing and was offered RetroArch's folder.""" + home = self._home() + settings = home / ".config" / "EmuDeck" / "settings.sh" + settings.parent.mkdir(parents=True) + settings.write_text(f"emulationPath={home / 'Games' / 'Emulation'}\n") + self.assertIn(("emudeck", home / "Games" / "Emulation" / "bios"), + install.detect_platforms("darwin")) + settings.unlink() + (home / "Emulation" / "bios").mkdir(parents=True) + self.assertIn(("emudeck", home / "Emulation" / "bios"), + install.detect_platforms("darwin")) + class RetroArchIsFoundWhereWindowsInstallsPutIt(unittest.TestCase): """Program Files\\RetroArch-Win64, a Steam library on another drive and diff --git a/wiki/installer.md b/wiki/installer.md index 51a87086..004b5d7b 100644 --- a/wiki/installer.md +++ b/wiki/installer.md @@ -305,7 +305,7 @@ not already found that way. |----------|----------|----------------| | `/media/fat/MiSTer` | MiSTer FPGA | `/media/fat/games` | | `C:\RetroBat\bios` or `%USERPROFILE%\RetroBat\bios` | RetroBat | the same | -| `~/Emulation/bios` | EmuDeck | the same | +| `~/Emulation/bios` (Linux and macOS) | EmuDeck | the same | | `~/.var/app/net.retrodeck.retrodeck` | RetroDECK | `~/retrodeck` | | `/romm/library/bios` | RomM | the same | | `/romm/config/config.yml` | RomM | `/romm/library/bios`, laid out by its firmware template | @@ -326,7 +326,7 @@ WSL does not pass them. A forced `--platform retrobat` falls back to | Evidence | Platform | BIOS directory | |----------|----------|----------------| | `HKCU\SOFTWARE\RetroBat` `LatestKnownInstallPath`, which `RetroBat.exe` writes on every start (read through `reg.exe` under WSL) | RetroBat | that folder + `\bios`, before the fixed folders above | -| `~/.config/EmuDeck/settings.sh` | EmuDeck | `emulationPath` + `/bios` | +| `~/.config/EmuDeck/settings.sh` (Linux and macOS) | EmuDeck | `emulationPath` + `/bios` | | `%APPDATA%\EmuDeck\settings.ps1`, else `%USERPROFILE%\EmuDeck\settings.ps1` | EmuDeck | `$emulationPath` + `\bios`, `C:\Emulation\bios` when it names none (a network install: the `$VolName` share + `\Emulation\bios`) | | `~/.var/app/net.retrodeck.retrodeck/config/retrodeck/retrodeck.json` | RetroDECK | `paths.rd_home_path`, falling back to the pre-migration `retrodeck.cfg` and its `rdhome` | | `~/.var/app/org.libretro.RetroArch/config/retroarch/retroarch.cfg` | RetroArch (Flatpak) | `system_directory` |