Preferences manager for OSX

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

User avatar
sentient06
Mac Mechanic
Posts: 188
Joined: Tue Mar 29, 2011 8:57 pm
Location: London, UK

Preferences manager for OSX

Post by sentient06 »

Hello everyone!

I am glad to announce the second beta release of my Basilisk II's preferences manager for OSX, Medusa.

I announced the first over one year ago here: http://www.emaculation.com/forum/viewto ... f=6&t=7608. However, it was very unstable, buggy and was pretty much an outline.

I took all feedbacks and worked for the last months to improve it, aiming for an easy-to-use and intuitive interface.

Between the major changes are:

- No more invisible preferences file on the home folder;
- Support for several versions of Basilisk II;
- Possibility to clone a virtual machine;
- Several settings that couldn't be found in the previous versions.

You can check the progress here: https://github.com/sentient06/Medusa/wiki/Requests

And you can download the compiled version here: https://github.com/sentient06/Medusa/re ... g/v1.1.0b7

Please read the notes file in the DMG, remember to flush the data files from the previous version (if you have it) and I hope you like it.

I am open for discussion and suggestions of improvements. This is still a beta, so maybe we can fit a couple of new features before the first release candidate of version 1.1.

One thing in particular I would like to ask: what settings are you missing? I am now designing a way to work with floppy disks and cd-rom disks, but I know other settings may be relevant for some people.

One more thing: I am trying to compile a complete and updated list of settings available on Basilisk II for OSX. The list is still in progress, but you can find it here:

https://github.com/sentient06/Medusa/wi ... X-and-Unix

Thank you everyone for your support!
User avatar
sentient06
Mac Mechanic
Posts: 188
Joined: Tue Mar 29, 2011 8:57 pm
Location: London, UK

Re: Preferences manager for OSX

Post by sentient06 »

I thought a quick overview would be useful:

There are 3 important windows.

- Assets manager

It will open automatically in the first execution of Medusa. After an emulator is inserted, it will not open anymore unless the user decides to do so.

This window is made to organise the rom files, disk images and emulators. Each kind of file has it's own tab. Each tab has a list. Each list allows new files to be dropped into it. There is a fourth tab called "drop area". This area allows the dropping of folders and individual files. It parses both rom files and disk files. Try having a folder with a disk image and a rom file dropped here!

- Virtual machines list

This is the "main" window. It has a list of virtual machines. There are 3 buttons on the left side to add, remove or duplicate virtual machines. There are also 2 buttons in the right to open the machine's settings and to boot it.

Each virtual machine has an icon. The icon changes depending on the machine's state. If the machine is new, you will see a paper with a mac inside. If the machine has a rom image associated and no disks, you will see a diskette with a question mark; if there are disks and no rom image, a sad mac; if all is fine, a happy mac.

- Settings window

Each machine has it's own version of this window. It has 6 tabs: general settings, disk settings, display settings, network settings and advanced settings.

All settings have a default value except emulator, rom image and disk images.

Rom images, disk images and emulators can be selected via drag & drop, similar to the assets window.

The disks can be dragged upwards and downwards. The first disk (in bold) is always the one to boot the machine. Medusa tries to guess if the disk is bootable.

Some tricks:

The memory can use values not predefined. Type a different value in the field and it will be used.

In the assets window, the name of the emulator can be changed. The name is an invisible text field. Try it.

Medusa cannot yet kill Basilisk. If it hangs, use Cmd + Option + Esc to kill it.

Quick start guide:

1. Drag a basilisk to the assets window's emulator list or click the "download" button.
2. Drag a ROM image file and a disk image file to the file drop area or their own lists.
3. Add a new virtual machine in the main window.
4. Open the machine's settings, choose your rom, emulator and disk.
5. Run it.
User avatar
adespoton
Forum All-Star
Posts: 4208
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Preferences manager for OSX

Post by adespoton »

I haven't taken a look yet, but you should be able to kill BII from Medusa by tracking its pid on launch and sending a kill command, if nothing else. You can also kill HUP to restart.

With some BII source modification however, we could probably send a running BII the restart and shutdown signals -- for someone wanting to learn how the source works, it could be a useful learning exercise.
User avatar
sentient06
Mac Mechanic
Posts: 188
Joined: Tue Mar 29, 2011 8:57 pm
Location: London, UK

Re: Preferences manager for OSX

Post by sentient06 »

Hello adespoton, thanks for the feedback!

I already started implementing the kill option. The current option is available in the newest build (#8) as a hidden feature.

Please check it here:

https://github.com/sentient06/Medusa/re ... g/v1.1.0b8

To enable it, go to the preferences window > advanced and tick "display advanced information and hidden controls".

There will be 4 new elements below the VM list window. The first to the left saves the preferences file of the selected VM. The second selects this file in Finder. The third opens a details window I will talk about soon and there is a "terminate" button too.

When Basilisk II launches, the application tracks down the PID and saves temporarily in the database (transient attribute). The PID can be seen in the other window I called "status list". The "X" button is responsible to send a "terminate" message to Basilisk II. I won't do more than that in the same action because I found out that Basilisk II identifies the terminate message just like if I were trying to shutdown the guest computer. So now I am designing a second "terminate" action that will kill the process for real, for I think the current terminate action can be useful anyway. At least we know the PID and can use the console to kill it... =D

For VMs hanging because they have a non-bootable disk, I am using the "Ctrl + Esc" combination. I also thought in triggering the same action in the Basilisk process, but I didn't take too much effort in this direction yet.

Extra details: the execution of one virtual machine also "blocks" the disk images used, so no other virtual machine can boot with these disks, avoiding data corruption. I am working on a code to eject the host-mounted disks too, for the same purpose.

But please, any more ideas are really welcome!
User avatar
adespoton
Forum All-Star
Posts: 4208
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Preferences manager for OSX

Post by adespoton »

Not sure if you want to do it, and not sure if you'll read this until after your move, but you could also do a few other things with the icon/info/etc.

You could parse out the selected ROM info for the virtual hardware presented if you wanted to... you could also pull the system version directly off the disk image (unless it's compressed, it should be directly readable) and you could use icons that directly represent the OS and ROM version. You could also automatically set the gestalt ID in the prefs based on the ROM found. Forgive me if you've already done any of that; I haven't had a chance to play around with it yet.
User avatar
sentient06
Mac Mechanic
Posts: 188
Joined: Tue Mar 29, 2011 8:57 pm
Location: London, UK

Re: Preferences manager for OSX

Post by sentient06 »

Yes, I thought in both getting default settings from the ROM file and the disk images.

The ROM file information the app fetches from hardcoded information. So it gets the checksum, finds out which ROM is that based in a big list and it can guess:

- Which gestalt models use that ROM (it can set modelid);
- Which processor the host models are known to use (it can set the cpu and fpu);
- What are the factory settings of that model (it can set the memory, for example);
- What are the system versions originally supported by that model (it can suggest one);
- If it supports AppleTalk (that's already there).

It could even guess the emulator.

But I think it would be very cool to get all we need from the ROM itself. I never dived into the ROM codes, maybe I'll do it when I have some spare time and a better assembly knowledge.

As for the disks... I've been improving the code to recognise the details. The code is able to get details on the partitions of a given file. If the partition is formatted on HFS, it can guess if that partition is bootable. If the structure uses an HFS+ is more tricky, but I did one code today that guesses the same information. I have a few bugs to address, specially on Mountain Lion, which doesn't display the size properly.

To guess the system version I couldn't find a simple way. The best I came with was to dig the file structure until I find the Finder application and try to match the version in the extended attributes. But that requires the file to be copied to the host system and I think this is a messy solution. Maybe the information can be found in the disk image itself without trying to access the file tree. But I still don't know how to find it.

But I like the suggestions, I'll definitely do some research!

Also, keep in mind the application is open source. Anyone can borrow / fork these codes or contribute too.

And keep checking the repository for new updates. The most stable releases will be downloadable. :wink:
User avatar
adespoton
Forum All-Star
Posts: 4208
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Preferences manager for OSX

Post by adespoton »

sentient06 wrote:Maybe the information can be found in the disk image itself without trying to access the file tree. But I still don't know how to find it.
That's what I was referring to; I've written up a bash script that pulls the system version out of a disk image by running strings and searching for the MACS resource string, followed by a value :) Not all that dependable, but it works pretty well for a quick hack.
User avatar
sentient06
Mac Mechanic
Posts: 188
Joined: Tue Mar 29, 2011 8:57 pm
Location: London, UK

Re: Preferences manager for OSX

Post by sentient06 »

Wow! That's great! Can I borrow it from you? =D
User avatar
adespoton
Forum All-Star
Posts: 4208
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Preferences manager for OSX

Post by adespoton »

Here's a basic one:

Code: Select all

strings "<path to image>" |grep "\(System Software [0-7]\)\|\(Mac OS [7-9]\)"|uniq
Of course, this will have multiple results. The trick is to first find the binary location of MACS and search from there. This is more easily done with perl, python, or a C snippet.

Here's one I have for finding dates in Classic Applications:
(This stuff goes in my ~/.bash_profile file)

Code: Select all

export RSRC=/..namedfork/rsrc
function grr() { strings "$1$RSRC" | grep "\b19[89]\d\b\|[-. \\/][89]\d[-. \\/]"|uniq ; }
export -f grr
function grd() { strings "$1" | grep "\b19[89]\d\b\|[-. \\/][89]\d[-. \\/]"|uniq ; }
export -f grd
function grf() { grr "$1"; grd "$1" ; }
export -f grf
With this one, grr finds dates in resource forks, grd finds dates in data forks, and grf combines them to find any dates stored in either fork. Useful for figuring out what OS you should use a specific piece of software with.
User avatar
sentient06
Mac Mechanic
Posts: 188
Joined: Tue Mar 29, 2011 8:57 pm
Location: London, UK

Re: Preferences manager for OSX

Post by sentient06 »

Brilliant stuff! Very clever.

I will get a few hours stuck in an airport Wednesday, I will try go get this functionality into the next build in the meantime. =D

Edit
I changed the code to limit 1 result:

Code: Select all

strings ./file.dmg | grep "\(System Software [0-7]\)\|\(Mac OS [7-9]\)" -m 1 | uniq
I tested with 3 images with Systems 7.5.5, 8.1 and 8.6, all worked fine, but they get the first string. I suppose the first is always correct, but that's a wild guess. Tomorrow I will test different images including updates.

The other two won't return any data. Not sure why. I suppose these particular files have no extended attributes. I'll check it.
User avatar
adespoton
Forum All-Star
Posts: 4208
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Preferences manager for OSX

Post by adespoton »

If they're compressed, you'd need to decompress them before you'd find any readable strings. Should work on any read/write images though.
Katakis
Student Driver
Posts: 16
Joined: Wed Oct 30, 2013 7:17 am

Re: Preferences manager for OSX

Post by Katakis »

This program is amazing. Keep up the good work.

I am using the 2009-10-04 build of BasiliskIIGUI which has a File browser that is complicated to use, and I can't even get Fullscreen without the emulator crashing. So thanks once again.
Renegade
Student Driver
Posts: 11
Joined: Sun Mar 08, 2009 8:13 am

Re: Preferences manager for OSX

Post by Renegade »

Great piece of software indeed. :wink:
May I suggest support for keysets ?


Thanks.
User avatar
sentient06
Mac Mechanic
Posts: 188
Joined: Tue Mar 29, 2011 8:57 pm
Location: London, UK

Re: Preferences manager for OSX

Post by sentient06 »

Hi there, thank you all for the feedback, is really encouraging!

I am working on amplifying the ROM recognition code in order to properly support SheepShaver. I am also documenting SheepShaver's preferences in order to write the files correctly. (https://github.com/sentient06/Medusa/wi ... X-and-Unix - the items with a '*' are for SS only and the description was not written yet)

Adespoton's suggestion is still on hold until I have a more stable version, right now it is crashing often since I made some re-factorings.

Renegade, what do you mean by keysets? I developed partially the support for Basilisk's keyboard settings, but it is not complete, so it is invisible.

Anything is possible guys, just tell me what you need and I can see what can be done. Folks here have some great ideas that should be taken into consideration.

If any of you is using Medusa often enough, please tell me because I am not working with core-data migrations. It means that every time I release a new beta, any saved data in a previous version must be deleted. But if I have many users I need to get the migrations to work the right way in order to avoid any hassle.

Thanks again, I really appreciate! =)
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Preferences manager for OSX

Post by Ronald P. Regensburg »

sentient06 wrote:Renegade, what do you mean by keysets?
I suppose Renegade is referring to the use of the keycodes file. It is indispensable in both BasiliskII and SheepShaver if your keyboard does not have a US-English QWERTY layout. In both BII and SS prefs file the setting looks like this:

keycodes true
keycodefile PATH/keycodes-file

The, otherwise identical, file can have different names, like "keycodes" or "BasiliskII_keycodes", and is often distributed with the emulator applications. A copy is on my site here:

http://www.xs4all.nl/~ronaldpr/sheepsha ... ycodes.zip
Last edited by Ronald P. Regensburg on Thu Nov 14, 2013 3:01 pm, edited 1 time in total.
Reason:  
User avatar
sentient06
Mac Mechanic
Posts: 188
Joined: Tue Mar 29, 2011 8:57 pm
Location: London, UK

Re: Preferences manager for OSX

Post by sentient06 »

Ah! Sure thing.

However, I feel like making an editor for this keycodes file too. Is there any documentation for it? Like a dictionary of codes and correspondent keys or things similar?

Anyway, the ability to simply refer to the file will be simple enough, so I added to the requests list.

https://github.com/sentient06/Medusa/wiki/Requests

I'll try to implement in the next build. Maybe this month. I don't know when I am releasing the new minor version, but hopefully before the end of the year.

Thanks for the suggestions. Keep them coming if you think of anything else. Everything is being documented in the project's wiki, so if you can fetch more documentation on anything else I'll copy it there.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Preferences manager for OSX

Post by Ronald P. Regensburg »

sentient06 wrote:Anyway, the ability to simply refer to the file will be simple enough, so I added to the requests list.
It could even be added by default. It is needed for all other keyboards layouts, but it does no harm when used with a keyboard that happens to be US-English QWERTY.

(Besides using the keycodes file, in both host system and guest system the appropriate keyboard layout needs to be selected.)
User avatar
sentient06
Mac Mechanic
Posts: 188
Joined: Tue Mar 29, 2011 8:57 pm
Location: London, UK

Re: Preferences manager for OSX

Post by sentient06 »

Hello,

I am glad to announce a new beta of my Medusa application, version 1.2b.
I would like to ask Snow Leopard users to give a feedback. My old Macbook 2008 is sick and in the hospital, so I only managed to test on Mavericks! I am specially concerned about some new images I added that work fine for retina, but I am not sure about not-retina macs.

Please find it here:

https://github.com/sentient06/Medusa/re ... g/v1.2.0b2

A summary of changes:
  • This version drops the "run" button in favour of a "toggle" button that attempts to terminate the emulator task.
  • The ROM and image files associated with the virtual machine are now stored as aliases (which allows Medusa to locate them and report deleted files).
  • There is a new advanced option to force-kill the emulator process and a tool to delete Basilisk II's XPRAM file.
  • In the Assets Manager, there is new functionality to locate the files stored.
  • There is a new feature that blocks the virtual machine's edition tools and locks its disks when it is running, so any VMs that share disks won't be able to boot.
  • There is a feature that will stop the emulator from launching if the disk images are being used by another process (it would crash Basilisk II otherwise).
  • There is a new area to edit keyboard preferences (the keycodes file is used automatically).
  • This version supports data migration from previous 1.1b release (with a few bugs on the disk list).
Pending requests:
  • A tailored keycodes file cannot be used yet, but the original keycodes can be replaced (it resides in the same dir as the preferences files). I am working on a solution for it.
  • I still didn't find a reliable way to identify the OS residing in the disk images. I am working on it.
  • Sheepshaver is still not supported. I am working on the interface tools to allow that to happen. I foresee version 1.5b may support SS.
Tricky stuff:
  • I opted for reporting the Gestalt id (Macintosh model id) to the emulator based on the ROM file. The docs state that it may crash the emulator, but I didn't find any evidence of that. The Gestalt can be forced to Mac IIci or Quadra 900 by ticking an option in the preferences window.
  • There is an option to delete the XPRAM file Basilisk II saves in the home dir. It quietly does so, there is no feedback given. There is a preference option that leaves the file alone, otherwise, Medusa may delete it every time all virtual machines are down.
  • There is an option to download Basilisk II. It downloads three versions. The numbers refer to the year it was compiled. In macs with retina display, execute the version 13, or else it will look really weird.
Known issues:
  • The size information on the disks list can be messed up after the migration from a previous version. I am already working on a fix for the next release. At the moment, the only fix is to add the disk image again.
Any feedbacks are welcome, any bugs can be reported on GitHub. If you don't have GitHub, anywhere then. My email is on GitHub as well.

Thank you!
Last edited by sentient06 on Sun Sep 28, 2014 7:32 pm, edited 1 time in total.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Preferences manager for OSX

Post by emendelson »

This sounds terrific. I'm sorry to report that it crashes on my MacBook Air running the latest Mavericks. Here's the report that gets generated, if it's of any use to you:

https://dl.dropboxusercontent.com/u/271 ... report.txt

If you've downloaded it, or if it's no use to you, please let me know so I can delete it.
User avatar
sentient06
Mac Mechanic
Posts: 188
Joined: Tue Mar 29, 2011 8:57 pm
Location: London, UK

Re: Preferences manager for OSX

Post by sentient06 »

emendelson wrote:This sounds terrific. I'm sorry to report that it crashes on my MacBook Air running the latest Mavericks. Here's the report that gets generated, if it's of any use to you:

https://dl.dropboxusercontent.com/u/271 ... report.txt

If you've downloaded it, or if it's no use to you, please let me know so I can delete it.
Thank you very much, this was very helpful! It is also a major bug, I'm fixing right away and I'll update the DMG within a few minutes.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Preferences manager for OSX

Post by emendelson »

Great! Looking forward to the new version...
User avatar
sentient06
Mac Mechanic
Posts: 188
Joined: Tue Mar 29, 2011 8:57 pm
Location: London, UK

Re: Preferences manager for OSX

Post by sentient06 »

Thanks again emendelson. The fixed version is here.

https://github.com/sentient06/Medusa/re ... g/v1.2.0b2

How embarrassing! :mrgreen:

I re-factored the code for the app's data storage and I forgot the most simple part: to check if the data file exists at all. Now it should be fine.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Preferences manager for OSX

Post by emendelson »

This really works beautifully. The only thing I can think of as a suggestion is this:

In the window that lists Basilisk setups, could a power-on button appear at the right of each item in the list of configurations? Right now, we have to select a configuration and then click the power-on button. Even better, maybe, would be the ability to double-click on a configuration name and have it launch.

Also, I'm not sure I understand what "Override all Basilisk emulators with:" does. Does it select a different Basilisk II app?

If you've explained this somewhere already, my apologies.

This is really, really impressive work.

(BTW, is it possible that Medusa might someday create branch out into something can create standalone Basilisk II setups? I use an AppleScript wrapper to create standalone systems, but it's an embarrassing kludge.)
User avatar
sentient06
Mac Mechanic
Posts: 188
Joined: Tue Mar 29, 2011 8:57 pm
Location: London, UK

Re: Preferences manager for OSX

Post by sentient06 »

Hey, I'm glad you liked it! Took me two years of spare time to get to a mature code.

Yes, the override is a legacy from an older version where I had a Basilisk II executable nested in the application. It will force-execute the chosen Basilisk instead of any chosen alternative. I think I will remove that, so the user can manage any basilisk application in the assets manager just like ROMs and disk images.

I was considering the feature to export to a bundle, but I haven't done anything really tangible to make it happen. But I will do that as soon as Sheepshaver is okay to go, which I hope to achieve soon enough.

The inline power button sounds good, I will do that, thanks for the suggestion.

Feel free for any more suggestions, all of them are being carefully considered. Adespoton suggested a feature to recognise any installed OSes in the disk, but my code generated some false-positives and I don't think it is good enough just yet. But it is on its way.
Renegade
Student Driver
Posts: 11
Joined: Sun Mar 08, 2009 8:13 am

Re: Preferences manager for OSX

Post by Renegade »

Hi sentient06,

Thanks for this nice piece of software :-)
However, I'm afraid to say it crashed on my rig (10.9.5).

here's the report
http://pastebin.com/hcnQ52D4

Bye
Post Reply