Skip to content

Commit

Permalink
Work around sound not working in Mac OS 8 and Mac OS 9
Browse files Browse the repository at this point in the history
Appears to be due to corruption introduced by modifying the images with
machfs, which in turn results in the sound driver resource not being
loaded. I do not have a fix for that yet (tracked in #84), but as a
workaround we remove the need to read-modify-write the disk image with
machfs.

The main reason why we were doing that was to insert a dynamically-
generated stickies file (see 5be16f6
and 6b04758). However, we can do that
with direct manipulation of the disk image, instead of doing HFS
operations. We do this by generating a placeholder "Stickies file" file
that we copy to the disk image by hand, and then replace it with the
actual file when building images (the images are defragmented with
Speed Disk from Norton Utilities to ensure the placeholder data is
continuous). The load-placeholder-stickies-file script helps with this.

Mac OS 9 still does not have sound by default, because the "Built-in"
source is not selected. It will likely require some tweaks to the PRAM
to fix that.

Updates #67
  • Loading branch information
mihaip committed Dec 27, 2022
1 parent 2b462dc commit 8be8bd2
Show file tree
Hide file tree
Showing 14 changed files with 291 additions and 177 deletions.
2 changes: 1 addition & 1 deletion Images/KanjiTalk 7.5.3 HD.dsk
Git LFS file not shown
2 changes: 1 addition & 1 deletion Images/Mac OS 8.1 HD.dsk
Git LFS file not shown
2 changes: 1 addition & 1 deletion Images/Mac OS 9.0.4 HD.dsk
Git LFS file not shown
3 changes: 3 additions & 0 deletions Images/Speed Disk 3.1.3.dsk
Git LFS file not shown
2 changes: 1 addition & 1 deletion Images/System 7.5.3 (PPC) HD.dsk
Git LFS file not shown
2 changes: 1 addition & 1 deletion Images/System 7.5.3 HD.dsk
Git LFS file not shown
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -26,6 +26,7 @@
"import-basilisk-ii": "scripts/import-macemu.sh basiliskii",
"import-sheepshaver": "scripts/import-macemu.sh sheepshaver",
"import-disks": "scripts/import-disks.py",
"load-placeholder-stickies-file": "scripts/load-placeholder-stickies-file.py",
"build-xadmaster": "scripts/build-xadmaster.sh",
"start": "PORT=3127 react-scripts start",
"build": "react-scripts build",
Expand Down
32 changes: 32 additions & 0 deletions scripts/basilisk.py
@@ -0,0 +1,32 @@
import disks
import os.path
import paths
import subprocess
import typing


def run(disk_paths: typing.List[str], modelid: int = 14) -> None:
rom_path = os.path.join(paths.DATA_DIR, "Quadra-650.rom")
basilisk_ii_args = [
("--config", "none"),
] + [("--disk", p) for p in disk_paths] + [
("--extfs", "none"),
("--rom", rom_path),
("--screen", "win/800/600"),
("--ramsize", "134217728"),
("--frameskip", "0"),
("--modelid", str(modelid)),
("--cpu", "4"),
("--fpu", "true"),
("--nocdrom", "true"),
("--nosound", "true"),
("--noclipconversion", "true"),
("--idlewait", "true"),
]
subprocess.check_call([
"open",
"-a",
"BasiliskII",
"-W",
"--args",
] + [a for arg in basilisk_ii_args for a in arg])
74 changes: 74 additions & 0 deletions scripts/disks.py
@@ -0,0 +1,74 @@
import dataclasses
import os.path
import paths
import stickies
import typing


@dataclasses.dataclass
class Disk:
name: str
domain: str
stickies_path: typing.List[str] = dataclasses.field(
default_factory=lambda:
["System Folder", "Preferences", "Stickies file"])
stickies_encoding: str = "mac_roman"
welcome_sticky_override: stickies.Sticky = None

def path(self) -> str:
return os.path.join(paths.IMAGES_DIR, self.name)


SYSTEM_753 = Disk(
name="System 7.5.3 HD.dsk",
domain="system7.app",
)

SYSTEM_753_PPC = Disk(
name="System 7.5.3 (PPC) HD.dsk",
domain="system7.app",
)

MAC_OS_81 = Disk(
name="Mac OS 8.1 HD.dsk",
domain="macos8.app",
)

JAPANESE_WELCOME_STICKY = stickies.Sticky(
top=125,
left=468,
bottom=180,
right=660,
font=stickies.Font.OSAKA,
size=18,
style={stickies.Style.BOLD},
text="Infinite Macintosh へようこそ!",
)

KANJITALK_753 = Disk(
name="KanjiTalk 7.5.3 HD.dsk",
domain="kanjitalk7.app",
# Generate Mojibake of Shift-JIS interpreted as MacRoman, the machfs
# library always assumes the latter.
stickies_path=[
p.encode("shift_jis").decode("mac_roman") for p in [
"システムフォルダ",
"初期設定",
'スティッキーズファイル',
]
],
stickies_encoding="shift_jis",
welcome_sticky_override=JAPANESE_WELCOME_STICKY)

MAC_OS_904 = Disk(
name="Mac OS 9.0.4 HD.dsk",
domain="macos9.app",
)

ALL_DISKS = [
SYSTEM_753,
SYSTEM_753_PPC,
MAC_OS_81,
KANJITALK_753,
MAC_OS_904,
]

0 comments on commit 8be8bd2

Please sign in to comment.