Something went wrong. Try again.
All-in-one editor for Paper Mario (N64) mods diorama64.starhaven.dev
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384# SPDX-FileCopyrightText: 2026 Alexander Bates <alex@bates64.com>## SPDX-License-Identifier: 0BSD
# Writes the .DS_Store that lays out the disk image's Finder window: its# size, background, and where the app and the Applications shortcut sit,# matching the dmg section of electron-builder.yml.## python3 dmg-layout.py OUT VOLUME_NAME APP_NAME
import datetimeimport sys
import mac_aliasfrom ds_store import DSStorefrom mac_alias import ALIAS_KIND_FILE, Alias, TargetInfo, VolumeInfo
out, volume, app = sys.argv[1:4]now = datetime.datetime.now(datetime.timezone.utc)
# Finder finds the background through an alias to it. The catalog IDs here# are the first an HFS+ volume hands out, and when they don't match, Finder# falls back to the alias's paths.background = Alias( volume=VolumeInfo( name=volume, creation_date=now, fs_type=b"H+", disk_type=mac_alias.ALIAS_EJECTABLE_DISK, attribute_flags=0, fs_id=b"\0\0", posix_path=f"/Volumes/{volume}", ), target=TargetInfo( kind=ALIAS_KIND_FILE, filename="background.tiff", folder_cnid=16, cnid=17, creation_date=now, creator_code=b"\0\0\0\0", type_code=b"\0\0\0\0", folder_name=".background", cnid_path=[16], carbon_path=f"{volume}:.background:\0background.tiff", posix_path="/.background/background.tiff", ),)
with DSStore.open(out, "w+") as d: d["."]["bwsp"] = { "WindowBounds": "{{100, 100}, {540, 380}}", "ShowStatusBar": False, "ShowToolbar": False, "ShowPathbar": False, "ShowSidebar": False, "ShowTabView": False, "ContainerShowSidebar": False, "PreviewPaneVisibility": False, "SidebarWidth": 180, } d["."]["icvp"] = { "viewOptionsVersion": 1, "backgroundType": 2, "backgroundImageAlias": background.to_bytes(), "backgroundColorRed": 1.0, "backgroundColorGreen": 1.0, "backgroundColorBlue": 1.0, "arrangeBy": "none", "iconSize": 80.0, "textSize": 12.0, "labelOnBottom": True, "showIconPreview": True, "showItemInfo": False, "gridSpacing": 100.0, "gridOffsetX": 0.0, "gridOffsetY": 0.0, "scrollPositionX": 0.0, "scrollPositionY": 0.0, } d["."]["vSrn"] = ("long", 1) d[app]["Iloc"] = (130, 220) d["Applications"]["Iloc"] = (410, 220) d[".background"]["Iloc"] = (900, 900)