diff --git a/tools/linuxfs/overlay/usr/local/bin/bannerlator-pad-defaults b/tools/linuxfs/overlay/usr/local/bin/bannerlator-pad-defaults index 890b053f9f..88e56d76de 100755 --- a/tools/linuxfs/overlay/usr/local/bin/bannerlator-pad-defaults +++ b/tools/linuxfs/overlay/usr/local/bin/bannerlator-pad-defaults @@ -266,9 +266,10 @@ def duckstation(): if not os.path.isfile(ini) and os.path.isfile(legacy): ini = legacy if not os.path.isfile(ini): - # A new player: DuckStation's own first-time setup still runs, looking in the ROMs folder. + # A new player: everything DuckStation's first-time setup asks is answered here (it finds + # the BIOS in its folder by itself), so a game from the front end boots straight away. bios = bios_folder(ps1) - seed(ini, "[Main]\nSetupWizardIncomplete = true\nInhibitScreensaver = false\n\n" + seed(ini, "[Main]\nSetupWizardIncomplete = false\nInhibitScreensaver = false\n\n" f"[BIOS]\nSearchDirectory = {bios}\n\n" f"[GameList]\nRecursivePaths = {ps1}\n\n" "[GPU]\nRenderer = Vulkan\n\n" @@ -281,6 +282,10 @@ def duckstation(): done="the guide button opens the pause menu") patch_ini_section(ini, "GameList", f"RecursivePaths = {ps1}\n", "DuckStation", needle=ROMS, done="games listed from the ROMs folder") + # One set up by an earlier build still has its first-time setup pending, in the way of a game. + if ini_get(ini, "Main", "SetupWizardIncomplete") == "true": + ini_set(ini, "Main", "SetupWizardIncomplete", "false") + print("bannerlator-pad-defaults: DuckStation: first-time setup already done here") # Keeping the screen awake goes through org.freedesktop.ScreenSaver, which nothing in the session # provides (Android decides when the screen sleeps): DuckStation only warns it failed, every game. if (ini_get(ini, "Main", "InhibitScreensaver") or "true") == "true": @@ -448,17 +453,18 @@ def armsx2(): shutil.copytree(src, os.path.join(root, sub), dirs_exist_ok=True) print(f"bannerlator-pad-defaults: ARMSX2: settings and memory cards copied from PCSX2 ({root})") elif not os.path.isfile(ini): - # A new player: ARMSX2's own first-time setup still runs (SetupWizardIncomplete) to pick the - # BIOS, but looking in the ROMs folder, with the ps2 folder as its game list and the - # controller already on Player 1. + # A new player: everything ARMSX2's first-time setup asks is answered here - the BIOS + # folder in the ROMs folder, the ps2 folder as its game list, the controller on Player 1 - + # and the BIOS file itself is picked below once one is there. bios, games = ps2_bios_folder(), ps2_folder() - seed(ini, "[UI]\nSettingsVersion = 1\nSetupWizardIncomplete = true\n\n" + seed(ini, "[UI]\nSettingsVersion = 1\nSetupWizardIncomplete = false\n\n" f"[Folders]\nBios = {bios}\n\n" f"[GameList]\nRecursivePaths = {games}\n\n" # Vulkan outright rather than Auto's pick: the renderer every other path here uses. "[EmuCore/GS]\nRenderer = 14\n\n" "[Hotkeys]\nOpenPauseMenu = Keyboard/Escape\nOpenPauseMenu = SDL-0/Guide\n\n" "[Pad1]\n" + ARMSX2_PAD1, "ARMSX2", "first-time setup, BIOS from " + bios) + armsx2_bios(ini) return patch_ini_section(ini, "Pad1", ARMSX2_PAD1, "ARMSX2", require="SettingsVersion") # The guide button is the pause menu here; PCSX2's profile (ours, copied over) had it as the @@ -474,6 +480,34 @@ def armsx2(): require="SettingsVersion", done="the guide button opens the pause menu") patch_ini_section(ini, "GameList", f"RecursivePaths = {ps2_folder()}\n", "ARMSX2", needle=ROMS, require="SettingsVersion", done="games listed from the ROMs folder") + if ini_get(ini, "UI", "SetupWizardIncomplete") == "true": + ini_set(ini, "UI", "SetupWizardIncomplete", "false") + print("bannerlator-pad-defaults: ARMSX2: first-time setup already done here") + armsx2_bios(ini) + + +def armsx2_bios(ini): + """PCSX2 boots the one BIOS file named in [Filenames] BIOS (inside [Folders] Bios); its first-time + setup is what names it. With that skipped, the first dump in the folder is named here - a US one + first - while none is named or the named one is gone. A choice made in ARMSX2 is kept.""" + folder = ini_get(ini, "Folders", "Bios") or ps2_bios_folder() + if not os.path.isabs(folder): + folder = os.path.join(os.path.dirname(os.path.dirname(ini)), folder) + current = ini_get(ini, "Filenames", "BIOS") + if current and os.path.isfile(os.path.join(folder, current)): + return + try: + # A PS2 BIOS dump is 4 MiB (a few are 8); the .nvm/.mec files beside it are not dumps. + dumps = sorted(f for f in os.listdir(folder) + if os.path.isfile(os.path.join(folder, f)) and 4 << 20 <= os.path.getsize(os.path.join(folder, f)) <= 8 << 20) + except OSError: + return + if not dumps: + return + us = [f for f in dumps if any(t in f.lower() for t in ("usa", "(us)", "(us,", "ntsc-u"))] + pick = (us or dumps)[0] + ini_set(ini, "Filenames", "BIOS", pick) + print(f"bannerlator-pad-defaults: ARMSX2: BIOS {pick}") def dolphin():