A self-contained BasiliskII-System 7.6.1 app for macOS

About BasiliskII, a 68k Mac emulator for Windows, MacOSX, and Linux that can run System 7.x through MacOS 8.1.

Moderators: Cat_7, Ronald P. Regensburg

Post Reply
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

A self-contained BasiliskII-System 7.6.1 app for macOS

Post by emendelson »

Inspired by this post - viewtopic.php?t=11912 - I've put together a customized version of BasiliskII that contains in itself a ROM file and a standard US installation of System 7.6.1. When you run it for the first time, it copies its ROM, disk image, preferences, and.a keycodes file into a folder in your user Library folder (so multiple users on the same Mac can use the same copy of the app) and opens System 7.6.1 on your desktop. You can modify the prefs file in your ~/Library/Application Support/System7 folder, add additional disks, boot to an installer disk, etc.

This is simpler than my AppleScript-based System761 app (which has printing and file-transfer features) and may be all that you need.

Forum rules forbid links to copyrighted software (like the ROM file and copy of System 7.6.1 in this app), but you can find the app by searching for
MacOS9 for macOS
This will bring you to a page where a paragraph at the top takes to the page with the app itself and instructions on how to customize it. I've also put together a self-contained SheepShaver app running MacOS 9.0.4, available on the same page.

To repeat: These new apps are not duplicates of my earlier System761 and MacOS9 apps, which use AppleScript wrappers around BasiliskII and SheepShaver and rely on background scripts that are inherently fragile. These new apps are much simpler.
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: A self-contained BasiliskII-System 7.6.1 app for macOS

Post by adespoton »

Sounds like yours are getting closer to mine :) I just add a script to the MacOS folder and point Info.plist at it. The script checks for the presence of the files in the ~/Application Support/<OS Version> folder and copies them there if they're missing, then runs the MachO binary via command line arguments.

I keep meaning to create a script that auto-migrates all my OSes to new emulator versions given a new BII/SS app, but I've just never got around to that part.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: A self-contained BasiliskII-System 7.6.1 app for macOS

Post by emendelson »

adespoton wrote: Sun May 28, 2023 4:41 am Sounds like yours are getting closer to mine :) I just add a script to the MacOS folder and point Info.plist at it. The script checks for the presence of the files in the ~/Application Support/<OS Version> folder and copies them there if they're missing, then runs the MachO binary via command line arguments.
That's exactly what mine does. Mine also tests for the presence of "second.sparsebundle", "third.sparsebundle", "fourth.sparsebundle", "second.dsk", "third.dsk", and "fourth.dsk" and adds or removes them from the prefs depending on whether they're present. It also tests for an image named "basiliskii.dsk" and puts it at the top of the prefs if found so that it can boot from that instead of from the default sparsebundle. Finally, it tests for an image named "install.dsk" (for a bootable OS or other installer) and puts that at the top of the prefs, above "basiliskii.dsk" if present.

My SheepShaver app does essentially the same things.

But your message shows me that I should add a variable at the top of the script that would specify the version number, and use that variable when creating the folder in ~/LibraryApplication Support. That would make this a lot more flexible, and make it easy to have multiple versions. Also, I suppose it should be possible to test the filename of the app for numbers like 753 and use those automatically, so that you wouldn't have to break the notarization by editing the script itself.

Also, it occurs to me that my script could test whether the locale is US or CA and, if it isn't either of those, change "keycodes false" to "keycodes true" in the prefs. I'll add that to the list of changes.

EDIT: I've now uploaded a version that looks at its own filename to see if it ends in numbers like 701, 753, etc., and, if it does, creates a folder in Application Support that includes that number, so you can have multiple versions of the app running different System 7 versions. I've also implemented the fix that changes keycodes false to keycodes true if the system locale is NOT US or CA, during the initial installation, so you can modify this if needed by editing the prefs file in Application Support. Thank you for prompting these fixes!
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: A self-contained BasiliskII-System 7.6.1 app for macOS

Post by adespoton »

emendelson wrote: Sun May 28, 2023 11:45 am
adespoton wrote: Sun May 28, 2023 4:41 am Sounds like yours are getting closer to mine :) I just add a script to the MacOS folder and point Info.plist at it. The script checks for the presence of the files in the ~/Application Support/<OS Version> folder and copies them there if they're missing, then runs the MachO binary via command line arguments.
That's exactly what mine does. Mine also tests for the presence of "second.sparsebundle", "third.sparsebundle", "fourth.sparsebundle", "second.dsk", "third.dsk", and "fourth.dsk" and adds or removes them from the prefs depending on whether they're present. It also tests for an image named "basiliskii.dsk" and puts it at the top of the prefs if found so that it can boot from that instead of from the default sparsebundle. Finally, it tests for an image named "install.dsk" (for a bootable OS or other installer) and puts that at the top of the prefs, above "basiliskii.dsk" if present.

My SheepShaver app does essentially the same things.

But your message shows me that I should add a variable at the top of the script that would specify the version number, and use that variable when creating the folder in ~/LibraryApplication Support. That would make this a lot more flexible, and make it easy to have multiple versions. Also, I suppose it should be possible to test the filename of the app for numbers like 753 and use those automatically, so that you wouldn't have to break the notarization by editing the script itself.

Also, it occurs to me that my script could test whether the locale is US or CA and, if it isn't either of those, change "keycodes false" to "keycodes true" in the prefs. I'll add that to the list of changes.

EDIT: I've now uploaded a version that looks at its own filename to see if it ends in numbers like 701, 753, etc., and, if it does, creates a folder in Application Support that includes that number, so you can have multiple versions of the app running different System 7 versions. I've also implemented the fix that changes keycodes false to keycodes true if the system locale is NOT US or CA, during the initial installation, so you can modify this if needed by editing the prefs file in Application Support. Thank you for prompting these fixes!
One other thing... where are your nvram/xpram files being written? It took me a few tries to get those automatically written to the correct location; BII writes it in the current working directory when the binary is loaded from the script IIRC. So my script cd's to the config file location and then calls the BII binary from there.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: A self-contained BasiliskII-System 7.6.1 app for macOS

Post by emendelson »

adespoton wrote: Mon May 29, 2023 3:12 pm One other thing... where are your nvram/xpram files being written? It took me a few tries to get those automatically written to the correct location; BII writes it in the current working directory when the binary is loaded from the script IIRC. So my script cd's to the config file location and then calls the BII binary from there.
Thank you for reminding me about this issue! In fact, as far as I can tell, all of kanjitalk755's builds save pram data to ~/.basilisk_ii_pram, no matter where they're started from, so I would be curious to know how you get around this.

I forgot that my method is to patch kanjitalk755's code to change the default location of the pram data file in order to save it into the same folder with BasiliskII itself. I also patch the default name and location of the prefs file, which is less important because my apps all load a prefs file from the command line. I've now uploaded a new version using the patched source code.

Once again, thank you for reminding me of this problem, and I would be very glad to know what your method is for saving the pram data file in the location where you want it.
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: A self-contained BasiliskII-System 7.6.1 app for macOS

Post by adespoton »

emendelson wrote: Mon May 29, 2023 5:17 pm
adespoton wrote: Mon May 29, 2023 3:12 pm One other thing... where are your nvram/xpram files being written? It took me a few tries to get those automatically written to the correct location; BII writes it in the current working directory when the binary is loaded from the script IIRC. So my script cd's to the config file location and then calls the BII binary from there.
Thank you for reminding me about this issue! In fact, as far as I can tell, all of kanjitalk755's builds save pram data to ~/.basilisk_ii_pram, no matter where they're started from, so I would be curious to know how you get around this.

I forgot that my method is to patch kanjitalk755's code to change the default location of the pram data file in order to save it into the same folder with BasiliskII itself. I also patch the default name and location of the prefs file, which is less important because my apps all load a prefs file from the command line. I've now uploaded a new version using the patched source code.

Once again, thank you for reminding me of this problem, and I would be very glad to know what your method is for saving the pram data file in the location where you want it.
Hah... you know what? I just checked the modification date on my xpram files... March 14, 2020. Looks like I'm using the ~/.basilisk_ii_pram file across my apps now xP . Serves me right for updating in-place. Good news is, I don't seem to have caused any major issues in the past 3 years by stomping all over my PRAM.

Maybe we should ask for an optional command-line argument or a config file argument to get around the hard-coded path....
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: A self-contained BasiliskII-System 7.6.1 app for macOS

Post by Ronald P. Regensburg »

Using the same xpram file with different setups rarely causes problems.

Only a few settings in the control panels are saved (also) in the xpram file at shutdown. If, for instance, you change the color depth in Monitors control panel and subsequently shut down BasiliskII, the xpram file will get a new modification date.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: A self-contained BasiliskII-System 7.6.1 app for macOS

Post by emendelson »

Ronald P. Regensburg wrote: Tue May 30, 2023 7:22 am Using the same xpram file with different setups rarely causes problems.

Only a few settings in the control panels are saved (also) in the xpram file at shutdown. If, for instance, you change the color depth in Monitors control panel and subsequently shut down BasiliskII, the xpram file will get a new modification date.
That clears up something that I've wondered about for a long time. If anyone has any other details of what gets saved in that file, please let us know.

I tried to patch kanjitalk755's code to read/write an xpram file from a location specified in the prefs file, but didn't get it to work properly. I think I see what I did wrong, but it's probably not worth the effort to fix it.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: A self-contained BasiliskII-System 7.6.1 app for macOS

Post by Ronald P. Regensburg »

I used to have a list of settings that were stored in PRAM. Resetting (zapping) PRAM would set some settings back to default. The ones I remember:

Work in BasiliskII:
screen resolution and color depth
keyboard layout

Overridden in BasiliskII by host settings:
time zone settings
date and time
mouse tracking

Do not work in BasiliskII:
speaker volume
startup disk/volume (may cause BasiliskII crash)

NVRAM stores mostly the same settings in later Macs.
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: A self-contained BasiliskII-System 7.6.1 app for macOS

Post by adespoton »

Ronald P. Regensburg wrote: Tue May 30, 2023 1:22 pm I used to have a list of settings that were stored in PRAM. Resetting (zapping) PRAM would set some settings back to default. The ones I remember:

Work in BasiliskII:
screen resolution and color depth
keyboard layout

Overridden in BasiliskII by host settings:
time zone settings
date and time
mouse tracking

Do not work in BasiliskII:
speaker volume
startup disk/volume (may cause BasiliskII crash)

NVRAM stores mostly the same settings in later Macs.
There's another one too that I can't quite recall. I do remember that if the OS versions are too different from each other, it can cause failure to boot on the newer/older OS (can't recall which). I generally only use BII for System 7.1-7.5.3 now, and don't run into this issue. I think if I run 8.1 and then try running 7.1 with the same xpram is where problems used to crop up. Some feature being set that the older OS doesn't know about maybe?
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: A self-contained BasiliskII-System 7.6.1 app for macOS

Post by Ronald P. Regensburg »

I use BasiliskII alternately with System 7.0.1, System 7.5.5, and MacOS 8.1 without issues with the same xpram file. Doing that, I noticed that the file's modification date is updated when I shut down BasiliskII, regardless whether I changed any settings.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: A self-contained BasiliskII-System 7.6.1 app for macOS

Post by emendelson »

For complete safety, however, it may be best to save the pram file in the same folder with the executable, or in the user's Application Support folder, but maybe it's not worth the trouble.
Post Reply