Sundry improvements

I have been patching empw ad hoc. It would be too much trouble to
separate out all my changes so far. Highlights:
- Basilisk II (-b) for when you need more RAM (jankier UI, though)
- larger disk images
- support for partitioned images, *if* you create them yourself
- support for stderr and return codes (but not stdin yet)
- support for running from a subdirectory
- UNIX->Mac path conversion
This commit is contained in:
Elliot Nunn 2017-11-27 21:34:49 +08:00
parent 616e75d59a
commit dfc33860bc
23 changed files with 1832 additions and 24 deletions

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>BasiliskII</string>
<key>CFBundleGetInfoString</key>
<string>Basilisk II version 1.0, Copyright © 1997-2006 Christian Bauer et al. Mac OS X port 19</string>
<key>CFBundleIconFile</key>
<string>BasiliskII.icns</string>
<key>CFBundleIdentifier</key>
<string></string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>BasiliskII</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>Basilisk II 1.0, Mac OS X port 19, build 2014-03-01</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>NSHelpFile</key>
<string>README.txt</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>Controller</string>
</dict>
</plist>

Binary file not shown.

View File

@ -0,0 +1 @@
-n APPL????

Binary file not shown.

View File

@ -0,0 +1,11 @@
Basilisk II is an open source, 68k Mac. emulator.
<BR>
It enables you to run 68k MacOS software on your computer, even if you are using a different operating system (however, you do need a copy of the MacOS and a Macintosh ROM image to use it).
<CENTER>
<A HREF="http://basilisk.cebix.net">The Official Basilisk II Home Page</A>
</CENTER>
<RIGHT>
MacOS X (native windowing) port
<BR>
by Nigel Pearson &lt;nigel@ind.tansu.com.au&gt;
</RIGHT>

View File

@ -0,0 +1,3 @@
/* Localized versions of Info.plist keys */
NSHumanReadableCopyright = "Copyright © 1997-2006 Christian Bauer et al. Freely distributable under the terms of the GNU GPL.";

View File

@ -0,0 +1,131 @@
{
IBClasses = (
{
ACTIONS = {
HelpHowTo = id;
HelpToDo = id;
HelpVersions = id;
NewEmulator = id;
PauseAll = id;
RunAll = id;
TerminateAll = id;
};
CLASS = Controller;
LANGUAGE = ObjC;
OUTLETS = {theEmulator = id; thePrefsEditor = id; };
SUPERCLASS = NSApplication;
},
{
ACTIONS = {
Benchmark = id;
Interrupt = id;
PowerKey = id;
Restart = id;
Resume = id;
ScreenHideShow = id;
Snapshot = id;
SpeedChange = id;
Suspend = id;
Terminate = id;
ToggleState = id;
ZapPRAM = id;
};
CLASS = Emulator;
LANGUAGE = ObjC;
OUTLETS = {barberPole = id; runOrPause = id; screen = id; speed = id; win = id; };
SUPERCLASS = NSObject;
},
{CLASS = EmulatorView; LANGUAGE = ObjC; SUPERCLASS = NSView; },
{
ACTIONS = {
Interrupt = id;
PowerKey = id;
Restart = id;
Resume = id;
Snapshot = id;
Suspend = id;
Terminate = id;
ZapPRAM = id;
};
CLASS = FirstResponder;
LANGUAGE = ObjC;
SUPERCLASS = NSObject;
},
{
ACTIONS = {
AddSCSI = id;
AddVolume = id;
BrowseExtFS = id;
BrowsePrefs = id;
BrowseROM = id;
ChangeBootFrom = id;
ChangeCPU = id;
ChangeDisableCD = id;
ChangeDisableSound = id;
ChangeFPU = id;
ChangeKeyboard = id;
ChangeModel = id;
ChangeScreen = id;
CreateVolume = id;
DeleteVolume = id;
EditBytes = id;
EditDelay = id;
EditEtherNetDevice = id;
EditExtFS = id;
EditFrequency = id;
EditMB = id;
EditModemDevice = id;
EditPrinterDevice = id;
EditROMpath = id;
LoadPrefs = id;
RemoveSCSI = id;
RemoveVolume = id;
ResetPrefs = id;
SavePrefs = id;
ShowPrefs = id;
};
CLASS = PrefsEditor;
LANGUAGE = ObjC;
OUTLETS = {
CPU68000 = id;
CPU68020 = id;
CPU68030 = id;
CPU68040 = id;
FPU = id;
IIci = id;
MB = id;
ROMfile = id;
SCSIdisks = id;
bootFromAny = id;
bootFromCD = id;
bytes = id;
classic = id;
delay = id;
depth = id;
disableCD = id;
disableSound = id;
diskImages = id;
emuFreq = id;
emuWin = id;
etherNet = id;
extFS = id;
frequency = id;
height = id;
keyboard = id;
modem = id;
newVolumeSize = id;
newVolumeView = id;
panel = id;
prefsFile = id;
printer = id;
quadra900 = id;
screen = id;
theEmulator = id;
width = id;
window = id;
};
SUPERCLASS = NSObject;
}
);
IBVersion = 1;
}

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>3 11 521 240 0 4 1152 742 </string>
<key>IBEditorPositions</key>
<dict>
<key>29</key>
<string>3 256 365 44 0 0 1152 746 </string>
</dict>
<key>IBFramework Version</key>
<string>349.0</string>
<key>IBLockedObjects</key>
<array>
<integer>288</integer>
</array>
<key>IBOpenObjects</key>
<array>
<integer>29</integer>
<integer>813</integer>
</array>
<key>IBSystem Version</key>
<string>7D24</string>
<key>IBUserGuides</key>
<dict>
<key>VolumeSize</key>
<dict>
<key>guideLocations</key>
<array/>
<key>guidesLocked</key>
<string>NO</string>
</dict>
</dict>
</dict>
</plist>

Binary file not shown.

View File

@ -0,0 +1,226 @@
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN"><HTML>
<HEAD><TITLE>Basilisk II, Mac OS X port, HowTos</TITLE></HEAD>
<BODY>
<H1> Index </H1>
<UL>
<LI> <A HREF="#minreq"> Minimum Requirements</A> </LI>
<LI> <A HREF="#rom"> Macintosh ROM image</A> </LI>
<LI> <A HREF="#b-disk"> Finding a boot disk</A> </LI>
<LI> <A HREF="#install">Installing the MacOS</A> </LI>
<LI> <A HREF="#mount"> Mounting Unix Files</A> </LI>
<LI> <A HREF="#import"> Importing Mac Files</A> </LI>
<LI> <A HREF="#net"> Networking</A> </LI>
</UL>
<HR>
<H2> <A NAME="minreq"> Minimum Requirements </A> </H2>
To run Basilisk II, you need both:
<UL>
<LI>A Mac ROM image. Even though there is a ROM in your OS X Mac,
it is too new for a 68k Mac to make use of. Any Mac II ROM,
and most of the Quadra ROMS, will work.
<BR> (Quadra 660av and 840av ROMs are currently unusable.
I don't know about Mac LC ROMs. In the near future, Mac Plus,
SE or Classic ROMS may also be usable, though only for emulating
a monochrome Mac). </LI>
<LI>A copy of the MacOS, which at the moment has to either be on
a CD-ROM, or on a disk image </LI>
</UL>
<HR>
<H2> <A NAME="rom"> Macintosh ROM image </A> </H2>
<P> To run Basilisk II, you need a ROM image, which is a data file
containing a copy of the ROM chips from a real 68k Macintosh. </P>
<P> The best way (<I>i.e.</I> most legally acceptable) to get a ROM
image is to produce it from your old Mac. Take a program like CopyROM,
download it onto your old Mac, and use it to produce the image file,
which you then copy or upload to your OS X Mac.
A good page which describes this process is
<A HREF="http://mes.emuunlim.com/tips/capturing_a_mac_rom_image.htm">here</A>.
</P>
<P> The easiest way to get a ROM image is to get one from someone else
(<I>e.g.</I> another Basilisk II user, or an emulation web site).
Note that this probably contravenes several copyright laws. </P>
<P>Once you have your ROM image, you need to tell Basilisk II to use it:
<OL>
<LI> Open the Basilisk II application </LI>
<LI> Go to the 'BasiliskII' menu, then the Preferences...' menu item </LI>
<LI> On the Emulation tab, there is a field 'ROM file:'. Either type in the
path to the ROM file, or click the Browse button and Open the ROM file </LI>
<LI> Click the Save button, so that Basilisk II will be able to find the ROM
each time you boot it </LI>
</OL>
</P>
<P> If you want to test this, press the Run or Power button
(in the top right corner of the 'BasiliskII Emulator' window).
After a few moments you should see a Mac screen, with a picture of a floppy
disk with a flashing question mark. That is the Mac telling you that it needs
a disk to boot from. </P>
<HR>
<H2> <A NAME="b-disk"> Finding a boot disk </A> </H2>
<P> Basilisk II needs a copy of the MacOS to boot from. Anything from System 7
through to MacOS 8.1 should be usable.
<BR> (Felix Eng and I have only tested System 7.0.1, 7.1, 7.5.3 and 7.6,
although Felix also got System 6.0.8 to work with SE/30 Roms) </P>
Basilisk II can currently boot from:
<TABLE BORDER=1>
<TR>
<TD> CD-ROM </TD>
<TD> Most (not all) MacOS Install CDs will also boot your Mac. I also think
that some old Norton Utilities install CDs might have booted 68k Macs </TD>
</TR>
<TR>
<TD> Floppy disk image </TD>
<TD> Jonathan C. Silverstein reports that
<A HREF="http://download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/English-North_American/Macintosh/Utilities/Network_Access_Disk_7.5.sea.bin">this</A> Apple floppy disk image will boot Basilisk II </TD>
</TR>
<TR>
<TD> Preinstalled Basilisk II disk image </TD>
<TD> Another Basilisk II user might be willing to loan you the disk image
that they are using </TD>
</TR>
</TABLE>
<P> It is possible to use Basilisk II with a CD-ROM or floppy image, but
because most bootable CDs have a minimal System Folder, it is better if you
use a disk image with a more complete MacOS installed on it. The next section
tells you how to do this. </P>
<P> Note that there is currently no Install CD image on Apple's Web site, but
they do seem to have MacOS 7.5.3 floppy disk images (all 19 of them). Burning
those images onto a CD (not in the extended format) should allow you to install.
<BR>Thanks to Attilio Farina for this tip! </P>
<H2> <A NAME="install"> Installing the MacOS </A> </H2>
<H3> Create a new BasiliskII disk </H3>
<P> Before you can install the MacOS onto a disk volume,
you need to create a disk to install onto: </P>
<OL>
<LI> Start up the Basilisk application.<BR>
(If it is already running, skip this step)</LI>
<LI> Open the preferences. </LI>
<LI> Go to the Disk Volumes tab. </LI>
<LI> Press the 'Create...' button
(go with the defaults, unless you think you will need a huge disk). </LI>
</OL>
<P> If you want to have more than one hard disk available to Basilisk II,
you could create additional volumes here. </P>
<H3> Installing the MacOS </H3>
<P> Insert your MacOS install CD-ROM, and wait a few moments for the
OS X Finder to mount the disk. While still in your preferences: </P>
<OL>
<LI> Go to the Emulation tab and check that your emulation is appropriate
for your install image
<BR>(<I>e.g.</I> I had to change from Quadra900 to IIci,
because my generic 7.1 install CD didn't support the Quadra),
and that you have the RAM size set appropriately
<BR>(<I>e.g.</I> 8MB RAM may not be enough for a 7.5.3 install). </LI>
<LI> Click the save button. </LI>
<LI> In the BasiliskII Emulator window, click Run. <BR>
(If it is already running, but showing the floppy with the question mark,
press the restart button - the triangle in the bottom right hand corner) <BR>
You should get a HappyMac, and the emulator will start to boot from the CD.
You should then a dialog asking you to format a disk. </LI>
<LI> Click Initialize, then Erase, give the disk an appropriate name
(<I>e.g.</I> Hard Disk), then click OK. </LI>
<LI> Find the OS installer (in my case the CD booted into At Ease, and one of
the first buttons was 'Install System'), and go with the defaults. </LI>
</OL>
<P> After the installer finishes it may try to reboot (or you may need to
force a reboot). When it reboots, BasiliskII may exit. Start it again,
and you should boot into your installed OS. </P>
<HR>
<H2> <A NAME="mount">Mounting Unix Files</A> </H2>
<P> If Basilisk II is running MacOS 7.5.3 or newer, you can easily access some
of the files from your OS X disks. Just set the 'Unix directory to mount' in the
Volumes tab of the Preferences. Next time the Emulator starts up, a new disk
will appear on its Desktop (called Unix). </P>
<P> To prevent clashes with the OS X desktop files, I suggest that the directory
you select is not a whole disk (<I>e.g.</I> '/' or '/Volumes/disk'). Mount a
sub-folder instead (like '/Applications (Mac OS 9)'). </P>
<HR>
<H2> <A NAME="import">Importing Mac Files</A> </H2>
<P> If you are not running MacOS 7.5.3 or newer, the above trick won't work.
This makes getting files into Basilisk II harder. Luckily, Apple's 'Disk Copy'
or 'Disk Utility' can create a disk image file that is compatible
with Basilisk II (<I>i.e.</I> you can add it as a disk volume). </P>
<OL>
<LI> Open 10.1's 'Disk Copy' program, and create a 'Mac Standard' image,
<BR> or 10.3's 'Disk Utility', and create a 'read/write disk image',
<BR> or Disk Copy 6.??? in Classic, and create new image </LI>
<LI> If the image is not mounted, mount it </LI>
<LI> Copy any files that you want to access in the emulator to the mounted
image </LI>
<LI> Unmount the image </LI>
<LI> In Basilisk II's preferences, go to the 'Disk Volumes' tab,
add your new image, and start the emulation </LI>
</OL>
A new disk should appear on the emulation's desktop which contains the files
that you wanted to access. If the emulator complains about a disk needing to
be formatted, you may have chosen the wrong type of image type in 'Disk Copy'
or 'Disk Utility.'
<HR>
<H2> <A NAME="net">Networking</A> </H2>
<P> If your Mac is networked, then your emulated MacOS can also access that
network:
<OL>
<LI> Open Basilisk II, go to the Preferences, then the Hardware tab,
and set the emulator's EtherNet interface to slirp </LI>
<LI> Start the Emulator </LI>
<LI> In the emulated MacOS, open the TCP/IP Control Panel and set:
<UL>
<LI> 'Connect via:' to EtherNet, and </LI>
<LI> 'Configure:' to 'Using DHCP Server' </LI>
</UL>
<LI> Restart the emulation. </LI>
</OL>
You should now be able to surf the web, or FTP download software,
in the emulated Mac. Not sure about AppleTalk networking, though. </P>
<P> Note that this does not require the OS X Mac to be using EtherNet,
any working TCP/IP networking should be fine. I have tested it over
DHCP EtherNet (ADSL modem/router at home), and with a static IP
address at work (which also has an external web proxy/firewall). </P>
<HR>
$Id$
<BR>
Written by Nigel Pearson on 26th March, 2003.
</BODY>
</HTML>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,61 @@
<!-- $Id$><-->
Bugs:
<UL>
<LI>In window mode, if the framerate is low (<I>e.g.</I> if you leave it at the
default of 10fps) or if the emulated screen is too large,
really fast mouse clicks are sometimes not picked up
by the Emulator. For now, click more slowly</LI>
<LI>In full screen mode after a restart, when the mouse is first moved,
the emulated pointer jumps to the location that it was before the restart.
Disturbing, but not damaging.</LI>
<LI>Ejecting a CD only works in 10.2 or higher, and it freezes the emulation
for about 5 seconds.</LI>
<LI>Status of 'dd' command is not always correct. (If it runs out of space,
an error about file not found is printed?)</LI>
<LI>The Snapshot function is currently broken in some situations
(if the emulation changes its own screen settings, and the program
is compiled with the default window drawing mode of CGIMAGEREF).
Setting the depth to millions (in the emulator) is a workaround for now</LI>
<LI>Cut and paste between emulator and OS X only half works</LI>
</UL>
Untested:
<UL>
<LI>Mac Classic emulation. I don't have a ROM, but I suspect it will crash</LI>
<LI>Serial port code</LI>
</UL>
Unimplemented:
<UL>
<LI>CD audio stuff. I am still trying to get this to work</LI>
<LI>CD insert detection. At the moment, if a CD isn't there when the
emulator boots, or if you change CDs, it will never know. I don't
know how to register with the OS for disk insertion and mount events.
(Gwenol&eacute; rewrote the CD code, and it should poll for new disks,
but it don't work for me. I must be doing something wrong!)</LI>
<LI>Floppy stuff. If a floppy is mounted by the OS X Finder,
it is busy and cannot be opened by the emulator</LI>
<LI>Interrupt function for emulator</LI>
<LI>'nogui' to disable GUI alerts (and maybe preferences, but I need to split
MainMenu.nib to do that)</LI>
</UL>
Possible Enhancements:
<UL>
<LI>Use NSFileManager's movePath:toPath:handler to rename all a file's forks
in extfs_macosx.mm</LI>
<LI>Emulator snapshot - save the current emulator state
(memory + registers) to a file for fast startup next time</LI>
<LI>Multiple emulators. The window stuff is mostly there,
but the uae_cpu code has lots of globals, and is not re-entrant</LI>
<LI>Real addressing mode for the emulator. Mike Sliczniak had done most of the
work, but with real addressing the emulator just crashes for me</LI>
<LI>Improve Objective-C object allocation. e.g. http://www.mulle-kybernetik.com/artikel/Optimisation/opti-5.html</LI>
<LI>Use automake instead of the current 1_prepare_files.sh ?</LI>
<LI>Add JIT options to preferences?</LI>
<LI>Use internal windows to display Help doco?</LI>
<LI>Provide feedback during external commands (<I>e.g.</I> ejecting a CD or
creating a disk volume)</LI>
<LI>Widescreen window layout (suggestion by Michael Franz), so that users
with widescreen displays can squeeze a bigger emulated screen in.
I have a mock up of this that can be pasted in (MainMenu.nib).
Ideally, this would be via a generalised "theme" facility,
but who has time for that :-)</LI>
</UL>

View File

@ -0,0 +1,120 @@
<!-- $Id$><-->
Versions of MacOS X port of Basilisk II:
<OL>
<LI>Initial port to Public Beta, made minor changes to get it to compile under Final Release.
<BR>Gave a copy of this version to Gwenol&eacute; Beauchesne (one of the other porters)</LI>
<LI>Ported to version 0.9 of the Basilisk II tarball.
<BR>Re-engineered autoconfig files to give a clean autoconf and make of cpu_uae code.
<BR>Fixed a bug in the EmulatorView class (I was customising release instead of dealloc).
<BR>Added:
<UL>
<LI>Transparency to icon</LI>
<LI>Port-specific doco: 0_HOW_TO_BUILD.txt, ToDo.html and Versions.html</LI>
<LI>Screen Snapshot code</LI>
<LI>Preferences saving and resetting</LI>
<LI>Delegate code, called when user attempts to close emulator window or quit application,
to check whether preferences need saving or application should be allowed to quit</LI>
<LI>ExtFS resource and type/creator access code</LI>
<LI>Window resizing stuff:
<OL>
<LI>The screensize can be set in the preferences. If the emulator has yet to
start then the window and emulator screen is resized. Otherwise, and</LI>
<LI>At any time, the window can be resized, which scales the emulator screen image</LI>
</OL>
</LI>
</UL>
Gave a copy of this to Max Horn</LI>
<LI>Some code fixes suggested by Max, doco updates, and porting to OS 10.1</LI>
<LI>Event handling re-write inspired by Max (subclassing NSApplication for custom sendEvent:).
Command key and double clicks are now passed correctly to the Emulator. Took out the custom
"About" window stuff, and added some credits (with an html link to the official Basilisk home
page) in the standard About box. Also has the standard README in the help menu.
<BR>Gave a copy to Max</LI>
<LI>Streamlining of event sending (filter mouseMoved events when not in Emulator screen)</LI>
<LI>Recompile in Project Builder, because the makefile generated binary dies at startup</LI>
<LI>Ported to the Basilisk II 1.0 snapshot's source and implemented video resolution switching.
Also uses Objective-C++, which eliminates some of the wrapper code which was previously needed.</LI>
<LI>Video preferences fixes, small tidyup of source.</LI>
<LI>Full screen mode added, more source tidied up.</LI>
<!-- v10><-->
<LI>Finally checked into CVS repository. Key event bug fixes:
<UL>
<LI>Cursor keys are now decoded and passed to the Emulator correctly</LI>
<LI>New one (in version 9) reported by Kentaro Nakatani -
full screen mode was not passing key events</LI>
</UL></LI>
<LI>Repaired help menu item, added documentation folder.</LI>
<LI>Several monitor resolution-changing fixes. Windowed mode now supports all depths,
and is up to 6 times faster. I now no longer have any plans to do an OpenGL mode.
<BR>Minor change in preferences (RAM size fields no longer require
the user to press return or enter for the value to "take").
<BR>Some modifications for compilation on 10.2 <I>and</I> 10.1
<BR>Initial CD-ROM reading code.</LI>
<LI>Restarting the emulator should be safe and fairly reliable,
and errors in starting the emulator should now be caught.
<BR>Resizing of window is now animated, and window is centred afterwards.
<BR>Reduced memory leaks when changing screensize in windowed mode.
<BR>Screen default pref is now Mac II (and not Classic) size.
<BR>Fixed:
<UL>
<LI>Bug where the Prefs could not be edited while the emulator was running</LI>
<LI>Help menu item (again) and added extra doco there</LI>
<LI>Preferences RAM size thing (again)</LI>
<LI>A minor Prefs editor button anomaly</LI>
</UL></LI>
<LI>Preferences file can now be specified on the command line,
and changed/loaded in the Preferences editor.
Added a feature from the windows port - now supports different keyboard types.
Changed:
<UL>
<LI>Default extfs; was '/', now user's home directory (Suggestion by Olaf Pluta.
Seeing all the Unix dirs <I>is</I> a bit scary!)</LI>
<LI>HowTo now displayed by default web browser (as it contains links)</LI>
<LI>Project Builder defaults so that debug symbols are not included</LI>
</UL></LI>
<LI>Now built on 10.3 and Xcode. Also adds:
<UL>
<LI>Xcode project files</LI>
<LI>Initial floppy and serial port locating code</LI>
<LI>Some help labels on the buttons
(some users didn't understand what the triangle button meant)</LI>
<LI>Signal handling for crash protection
(thanks to Mike Sliczniak's hard work)</LI>
</UL>
</LI>
<LI>Now distributed as two applications; the usual one (which should be faster),
and one for emulating a Mac Classic (which may also help the 10.2/10.3 users
who are having problems with a black screen at startup). The difference is
that the "classic" version uses virtual or "banks" memory addressing.
Fixed:
<UL>
<LI>Loading of ROM or disk images from directories or filenames which
contain non-ASCII characters</LI>
<LI>Floppy locating code. It can't actually access a floppy, but at
least it now won't add the cdrom multiple times</LI>
</UL>
</LI>
<LI>Working ethernet, without extra drivers, thanks to Gwenol&eacute;.
<BR>Lots of bug fixes by Bernie Zenis. Some 10.4 fixes by Kirk Kerekes.
<BR>Some fixes by Marcus Gail ( 'Boot From: CD-ROM' <I>vs</I>
'Disable CD-ROM Driver' clash).
<BR>Some cosmetic changes (widened RAM MB in prefs, added confirmation
when deleting volumes).
<BR>Now no need for "classic" version -
Gwenol&eacute; fixed the black screen problem</LI>
<LI>(actually 18a) Minor fixes:
<UL>
<LI>Mouse should always woork in fullscreen mode, and</LI>
<LI>If snapshot fails, the dialog makes a workaround suggestion</LI>
</UL>
</LI>
<LI>Updated the HowTo, external filesystem fix on 10.4, CD code rewrite.
Added some new features:
<UL>
<LI>Sound support by Daniel Sumorok! Thanks also to Dave Vasilevsky,
who produced earlier versions of sound code that I didn't use.</LI>
<LI>Cut & Paste support from Gwenol&eacute;. You can now paste from the OS X
clipboard into the emulator (pasting the other way doesn't work
for me yet)</LI>
</UL>
</OL>

BIN
MacIIci.ROM Executable file

Binary file not shown.

213
empw
View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3
from os import path, listdir
from sys import argv
from os import path, listdir, environ, getcwd, chdir
from sys import argv, stderr
import datetime
from subprocess import run, PIPE, DEVNULL
import tempfile
@ -9,6 +9,45 @@ from shutil import copyfile
BASILISK_PREFS = """
extfs
screen win/640/480
seriala
serialb /dev/null
udptunnel false
udpport 6066
bootdrive 0
bootdriver 0
ramsize 33554432
frameskip 0
modelid 5
cpu 3
fpu true
nocdrom false
nosound false
noclipconversion false
nogui false
jit true
jitfpu true
jitdebug false
jitcachesize 8192
jitlazyflush true
jitinline true
keyboardtype 5
keycodes false
mousewheelmode 1
mousewheellines 3
dsp /dev/dsp
mixer /dev/mixer
ignoresegv false
idlewait true
"""
def h_topdir():
rc = 0
while rc == 0:
@ -17,9 +56,106 @@ def h_topdir():
def climb(frm):
yield frm
l = frm
while 1:
t = path.dirname(l)
if t == l: break
l = t
yield l
def rel_path_to_hfs(i):
if '/' not in i:
return i
if ':' in i:
return i
if i in '..': i = i + '/'
if i.startswith('./'):
i = ':' + i[2:]
i = i.replace('../', ':')
i = i.replace('/', ':')
if not i.startswith(':'): i = ':' + i
def rel_path_to_hfs(i):
if not i.startswith('/') and ('/' in i or i in '..'):
# do all this stuff:
pass
else:
return i
oi = i
if i in '..': i = i + '/'
if '/' not in i:
return i
if ':' in i:
return i
if i.startswith('./'):
i = ':' + i[2:]
i = i.replace('../', '::')
i = i.replace('/', ':')
if not i.startswith(':'): i = ':' + i
try:
if path.isdir(oi) and not i.endswith(':'):
i = i + ':'
except FileNotFoundError:
pass
return i
my_name, *cmds = argv
# Interpret leading '-options':
which_emulator = 'vmac'
while cmds and cmds[0].startswith('-'):
if cmds[0] == '-v':
which_emulator = 'vmac'
elif cmds[0] == '-b':
which_emulator = 'basilisk'
else:
raise ValueError('Unknown option: %s' % cmds[0])
cmds = cmds[1:]
# Convert paths of things that actually exist:
cmds = [rel_path_to_hfs(x) for x in cmds]
# Choose our working directory...
srcimage = 'SourceForEmulator.dmg'
mpw_cd_cmd = 'Src:'
try:
newcwd = next(d for d in climb(getcwd()) if path.exists(path.join(d, srcimage)))
except StopIteration:
newcwd = getcwd()
if newcwd != getcwd():
rel = path.relpath(getcwd(), newcwd)
for c in rel.split('/'):
mpw_cd_cmd += c + ':'
chdir(newcwd)
cmdline = ' '.join(cmds)
@ -29,6 +165,10 @@ vmac_app = path.join(scriptfolder, 'Mini vMac 9590.app') # requested for later:
vmac_exec = path.join(vmac_app, 'Contents', 'MacOS')
vmac_exec = path.join(vmac_exec, next(l for l in listdir(vmac_exec) if not l.startswith('.')))
basilisk_app = path.join(scriptfolder, 'BasiliskII.app')
basilisk_exec = path.join(basilisk_app, 'Contents', 'MacOS')
basilisk_exec = path.join(basilisk_exec, next(l for l in listdir(basilisk_exec) if not l.startswith('.')))
bootimg = path.join(scriptfolder, 'MPW-VM.dmg')
backupimg = path.join(scriptfolder, 'MPW-VM-KnownGood.dmg')
@ -43,29 +183,32 @@ if not path.exists(bootimg):
if cmds:
mpw_cmd = """# This is an auto-generated MPW script!
Echo '# %s'
Echo '# %s'
SetDirectory Src:
Begin
%s
End > "{Boot}StdOut"
Echo
mpw_cmd = u"""# This is an auto-generated MPW script!
SetDirectory '%s'
Set EmpwReturned 0
"{Boot}AutoGenInner" > "{Boot}StdOut" \u2265 "{Boot}StdErr" || Set EmpwReturned {Status}
Echo {EmpwReturned} > "{Boot}Return"
Move -y "{Boot}AutoGenInner" "{Boot}Trash:"
Move -y "{__Startup__i}" "{Boot}Trash:"
ShutDown -y
""" % (datetime.datetime.now(), cmdline, cmdline)
""" % (mpw_cd_cmd)
else:
mpw_cmd = """# This is an auto-generated MPW script!
SetDirectory Src:
SetDirectory '%s'
Move -y "{__Startup__i}" "{Boot}Trash:"
"""
""" % mpw_cd_cmd
mpw_cmd = mpw_cmd.replace('\n','\r')
with open('/tmp/AutoGen', 'w') as f:
f.write(mpw_cmd)
with open('/tmp/AutoGen', 'wb') as f:
f.write(mpw_cmd.encode('mac_roman'))
tmp_path = f.name
if cmds:
with open('/tmp/AutoGenInner', 'wb') as f:
f.write(cmdline.encode('mac_roman'))
tmp_path_inner = f.name
run([hsync], check=True)
@ -74,19 +217,39 @@ run([hsync], check=True)
run(['SetFile', '-t', 'TEXT', '-c', 'MPS ', tmp_path], check=True)
run(['macbinary', 'encode', '--overwrite', '-o', tmp_path+'.bin', tmp_path], check=True)
if cmds:
run(['SetFile', '-t', 'TEXT', '-c', 'MPS ', tmp_path_inner], check=True)
run(['macbinary', 'encode', '--overwrite', '-o', tmp_path_inner+'.bin', tmp_path_inner], check=True)
run(['hmount', bootimg], check=True, stdout=DEVNULL)
h_topdir()
run(['hcopy', '-m', tmp_path+'.bin', ':MPW:Startup Items:'], check=True)
if cmds:
run(['hcopy', '-m', tmp_path_inner+'.bin', ':AutoGenInner'], check=True)
run(['humount'], check=True)
# http://www.gryphel.com/c/minivmac/osx_note.html
# Disable Path Randomization
run(['xattr', '-cr', vmac_app], check=True)
if which_emulator == 'vmac':
# http://www.gryphel.com/c/minivmac/osx_note.html
# Disable Path Randomization
run(['xattr', '-cr', vmac_app], check=True)
run([vmac_exec, bootimg, srcimage], check=True)
elif which_emulator == 'basilisk':
with tempfile.TemporaryDirectory(prefix='/tmp/') as d:
with open(path.join(d, '.basilisk_ii_prefs'), 'w') as f:
f.write(BASILISK_PREFS)
print('disk', bootimg, file=f)
print('disk', srcimage, file=f)
print('rom', path.join(scriptfolder, 'MacIIci.ROM'), file=f)
newenviron = dict(environ, HOME=d.rstrip('/'))
run([basilisk_exec], env=newenviron, stdout=DEVNULL, stderr=DEVNULL, check=True)
run([vmac_exec, bootimg, srcimage], check=True)
@ -98,7 +261,15 @@ run([hsyncback], check=True)
if cmds:
run(['hmount', bootimg], check=True, stdout=DEVNULL)
run(['hcopy', '-t', ':StdOut', '/tmp/StdOut'], check=True)
run(['hcopy', '-t', ':StdErr', '/tmp/StdErr'], check=True)
run(['hcopy', '-t', ':Return', '/tmp/Return'], check=True)
run(['humount'], check=True)
with open('/tmp/StdOut') as f:
print(f.read(), end='')
with open('/tmp/StdOut', 'rb') as f:
print(f.read().decode('mac_roman'), end='')
with open('/tmp/StdErr', 'rb') as f:
print(f.read().decode('mac_roman'), end='', file=stderr)
with open('/tmp/Return', 'rb') as f:
exit(int(f.read()))

8
hsync
View File

@ -84,7 +84,7 @@ label = 'Src'
# Dirs are in /full/path/without/trailing/slash form, thanks to os.path.abspath
if not path.exists(srcimg):
run(['dd', 'if=/dev/zero', 'of='+srcimg, 'bs=1048576', 'count='+str(128)], stdout=DEVNULL, stderr=DEVNULL, check=True)
run(['dd', 'if=/dev/zero', 'of='+srcimg, 'bs=1048576', 'count='+str(256)], stdout=DEVNULL, stderr=DEVNULL, check=True)
run(['hformat', '-l', label, srcimg], stdout=DEVNULL, check=True)
run(['humount'], check=True)
@ -102,14 +102,18 @@ rsync_opts = [
'--exclude', srcimg,
'--exclude', 'Desktop DB',
'--exclude', 'Desktop DF',
'--exclude', 'Desktop Folder',
'--exclude', 'Trash',
'--exclude', 'TheVolumeSettingsFolder',
'--exclude', 'TheFindByContentFolder',
'--recursive',
'-tX', # consider times and xattrs
'--delete', # may delete things on the vMac drive
]
try:
devnode, mountpoint = run(['hdiutil', 'attach', '-nobrowse', srcimg], stdout=PIPE, check=True).stdout.decode('ascii').split()
cmdresult = run(['hdiutil', 'attach', '-nobrowse', srcimg], stdout=PIPE, check=True).stdout.decode('ascii')
mountpoint = next(x for x in cmdresult.split() if x.startswith('/') and not x.startswith('/dev'))
mountpoint = mountpoint.rstrip('/') # try to deal in clean paths
rsync_list = [] # (local_base_path, relative_path_components, rsync_code) tuple

View File

@ -11,7 +11,10 @@ rsync_opts = [
'--exclude', srcimg,
'--exclude', 'Desktop DB',
'--exclude', 'Desktop DF',
'--exclude', 'Desktop Folder',
'--exclude', 'Trash',
'--exclude', 'TheVolumeSettingsFolder',
'--exclude', 'TheFindByContentFolder',
'--recursive',
'-tX', # consider times and xattrs
'--delete', # may delete things on the vMac drive
@ -20,7 +23,8 @@ rsync_opts = [
devnode, mountpoint = run(['hdiutil', 'attach', '-nobrowse', srcimg], stdout=PIPE, check=True).stdout.decode('ascii').split()
cmdresult = run(['hdiutil', 'attach', '-nobrowse', srcimg], stdout=PIPE, check=True).stdout.decode('ascii')
mountpoint = next(x for x in cmdresult.split() if x.startswith('/') and not x.startswith('/dev'))
try:
mountpoint = mountpoint.rstrip('/') # try to deal in clean paths