mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 21:06:09 +00:00
Dolphin: its data where it looks for it (fonts, per-game fixes), game folders, Vulkan, no NKit box; full screen from the front end
This commit is contained in:
1 parent
5d42e5e87a
commit
7fbfeb2edd
2 files changed
+116
-1
No files matched your search
@@ -510,10 +510,118 @@ def armsx2_bios(ini):
|
||||
print(f"bannerlator-pad-defaults: ARMSX2: BIOS {pick}")
|
||||
|
||||
|
||||
DOLPHIN_APPIMAGE = "/opt/appimages/dolphin.AppImage"
|
||||
DOLPHIN_DATA = "/usr/share/dolphin-emu"
|
||||
|
||||
|
||||
def dolphin_data():
|
||||
"""The Dolphin build in the catalog finds its own data - the GameCube fonts, the per-game fixes
|
||||
(GameSettings: GUT.ini puts Ultimate Spider-Man on the MMU), its icons and shaders - only at the
|
||||
fixed /usr/share/dolphin-emu it was built for; there is no setting or variable to move it. Here it
|
||||
runs from a copy unpacked under /tmp (no FUSE), so it found none of it: a GameCube game stopped
|
||||
on "Windows-1252 fonts are not loaded", another on an invalid write the missing game fix would
|
||||
have prevented. So the folder is unpacked from the AppImage to that path, once per AppImage."""
|
||||
import shutil, subprocess, tempfile
|
||||
try:
|
||||
st = os.stat(DOLPHIN_APPIMAGE)
|
||||
except OSError:
|
||||
return
|
||||
stamp = "%d:%d" % (st.st_size, int(st.st_mtime))
|
||||
marker = os.path.join(DOLPHIN_DATA, ".droiddeck-from")
|
||||
try:
|
||||
if open(marker).read() == stamp and os.path.isfile(os.path.join(DOLPHIN_DATA, "Sys/GC/font_western.bin")):
|
||||
return
|
||||
except OSError:
|
||||
pass
|
||||
work = tempfile.mkdtemp(prefix="dolphin-data-", dir="/tmp")
|
||||
try:
|
||||
subprocess.run([DOLPHIN_APPIMAGE, "--appimage-extract", "usr/share/dolphin-emu/*"], cwd=work,
|
||||
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=600)
|
||||
src = os.path.join(work, "squashfs-root/usr/share/dolphin-emu")
|
||||
if not os.path.isfile(os.path.join(src, "Sys/GC/font_western.bin")):
|
||||
print("bannerlator-pad-defaults: Dolphin: could not unpack its data from the AppImage")
|
||||
return
|
||||
new = DOLPHIN_DATA + ".new"
|
||||
shutil.rmtree(new, ignore_errors=True)
|
||||
shutil.move(src, new)
|
||||
with open(os.path.join(new, ".droiddeck-from"), "w") as f:
|
||||
f.write(stamp)
|
||||
shutil.rmtree(DOLPHIN_DATA, ignore_errors=True)
|
||||
os.rename(new, DOLPHIN_DATA)
|
||||
print("bannerlator-pad-defaults: Dolphin: its data (fonts, per-game fixes) in " + DOLPHIN_DATA)
|
||||
except (OSError, subprocess.SubprocessError) as e:
|
||||
print("bannerlator-pad-defaults: Dolphin: unpacking its data failed: %s" % e)
|
||||
finally:
|
||||
shutil.rmtree(work, ignore_errors=True)
|
||||
|
||||
|
||||
def dolphin():
|
||||
if not os.path.isfile(DOLPHIN_APPIMAGE):
|
||||
return
|
||||
dolphin_data()
|
||||
d = os.path.join(CONFIG, "dolphin-emu")
|
||||
seed(os.path.join(d, "GCPadNew.ini"), DOLPHIN_GC, "Dolphin (GameCube)")
|
||||
seed(os.path.join(d, "WiimoteNew.ini"), DOLPHIN_WII, "Dolphin (Wii)")
|
||||
# Games from the ROMs folder's gamecube and wii folders, subfolders included; Vulkan; no
|
||||
# NKit warning (it will not let a game start until a box is ticked - games run either way,
|
||||
# the warning is about loading times, netplay and save states); no statistics question.
|
||||
# Names from Dolphin's MainSettings.cpp / UISettings.cpp. Only what is not set yet is added,
|
||||
# except the game folders, which are added to whatever the user has.
|
||||
ini = os.path.join(d, "Dolphin.ini")
|
||||
gc = system_folder(("gamecube", "gc", "ngc"), "gamecube")
|
||||
wii = system_folder(("wii",), "wii")
|
||||
if not os.path.isfile(ini):
|
||||
os.makedirs(d, exist_ok=True)
|
||||
with open(ini, "w", encoding="utf-8") as f:
|
||||
f.write("[Analytics]\nEnabled = False\nPermissionAsked = True\n"
|
||||
"[Core]\nGFXBackend = Vulkan\n"
|
||||
"[General]\nISOPaths = 2\nISOPath0 = %s\nISOPath1 = %s\nRecursiveISOPaths = True\n"
|
||||
"[Interface]\nSkipNKitWarning = True\n" % (gc, wii))
|
||||
print("bannerlator-pad-defaults: Dolphin: first-time setup (Vulkan, games from %s and %s)" % (gc, wii))
|
||||
return
|
||||
try:
|
||||
count = int(ini_get(ini, "General", "ISOPaths") or "0")
|
||||
except ValueError:
|
||||
count = 0
|
||||
paths = [ini_get(ini, "General", "ISOPath%d" % i) for i in range(count)]
|
||||
changed = []
|
||||
# The whole ROMs folder as a game folder (what Dolphin's "set a games directory" was pointed at
|
||||
# before) would, searched with its subfolders, have Dolphin open every PS2 and PS3 image too;
|
||||
# the system folders below cover it.
|
||||
if any((p or "").rstrip("/") == ROMS for p in paths):
|
||||
paths = [p for p in paths if p and p.rstrip("/") != ROMS]
|
||||
for i, p in enumerate(paths):
|
||||
ini_set(ini, "General", "ISOPath%d" % i, p)
|
||||
for i in range(len(paths), count):
|
||||
ini_set(ini, "General", "ISOPath%d" % i, "")
|
||||
count = len(paths)
|
||||
ini_set(ini, "General", "ISOPaths", str(count))
|
||||
changed.append("not the whole ROMs folder")
|
||||
for folder in (gc, wii):
|
||||
if folder not in paths:
|
||||
ini_set(ini, "General", "ISOPath%d" % count, folder)
|
||||
count += 1
|
||||
paths.append(folder)
|
||||
changed.append(folder)
|
||||
if changed:
|
||||
ini_set(ini, "General", "ISOPaths", str(count))
|
||||
if ini_get(ini, "General", "RecursiveISOPaths") != "True":
|
||||
ini_set(ini, "General", "RecursiveISOPaths", "True")
|
||||
changed.append("subfolders")
|
||||
if changed:
|
||||
print("bannerlator-pad-defaults: Dolphin: games from " + ", ".join(changed))
|
||||
# Once, for a Dolphin set up before this: Vulkan unless it was chosen already, and the NKit box.
|
||||
marker = os.path.join(d, ".droiddeck-setup")
|
||||
if os.path.exists(marker):
|
||||
return
|
||||
if not ini_get(ini, "Core", "GFXBackend"):
|
||||
ini_set(ini, "Core", "GFXBackend", "Vulkan")
|
||||
ini_set(ini, "Interface", "SkipNKitWarning", "True")
|
||||
if ini_get(ini, "Analytics", "PermissionAsked") != "True":
|
||||
ini_set(ini, "Analytics", "Enabled", "False")
|
||||
ini_set(ini, "Analytics", "PermissionAsked", "True")
|
||||
open(marker, "w").close()
|
||||
print("bannerlator-pad-defaults: Dolphin: Vulkan, no NKit warning")
|
||||
|
||||
|
||||
# Cemu: an SDLController profile for the GamePad. The uuid is "<index>_<SDL GUID>" and SDL's GUID
|
||||
|
||||
Reference in new issue
Block a user