Login  •  Register


The time is now: Thu Sep 21, 2017 8:44 am

Emaculation wiki  •  Delete all board cookies



Post new topic  Reply to topic Page 1 of 1 [ 15 posts ]
Print view Previous topic  |  Next topic
Author Message
PostPosted: Wed Nov 03, 2010 3:52 pm 
Offline
Student Driver

Joined: Thu Oct 16, 2008 12:46 pm
Posts: 19
Myrd wrote:
I've committed a new feature to SheepShaver CVS. Currently, it is for Mac OS X and Unix only.

The idea is to allow for self-contained SheepShaver VMs, in a similar fashion to, for example, VMWare Fusion VMs.


Any chance this feature could be ported to BasiliskII?


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Jun 16, 2016 9:47 pm 
Offline
Tinkerer

Joined: Fri Nov 09, 2007 5:42 pm
Posts: 98
Does Basilisk II support something like this now?


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Jun 16, 2016 11:04 pm 
Offline
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 1751
Not officially, but I've cobbled together an equivalent. Basilisk II can load everything from the command line, so you can create a script that points to locally-referenced files for nvram, disk images, config file and ROM. Use something like Platypus to convert the script into an application, and you can even embed the BII binary inside, along with the other goodies, if you want. Otherwise, it'll just run using the default BII app, and you can have as many scripts as you want.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Jun 16, 2016 11:47 pm 
Offline
Tinkerer

Joined: Fri Nov 09, 2007 5:42 pm
Posts: 98
Thanks, I'm trying that workaround now.

if I call
Code:
./BasiliskII --config configFile

I should have all the needed settings, like rom file, disk images etc. in that configFile, right?

But then it doesn't work, if I add
Code:
--rom romFile
it starts, but without any disk images.

So what is the configFile in the --config parameter supposed to be if it's not the equivalent to ~/.basilisk_ii_prefs?

edit: the problem are the relative paths. But I can't figure out how I need to write the script.

Code:
#!/bin/sh

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"
./BasiliskII —-config basilisk_ii_prefs


This results in "ERROR: Cannot open ROM file."
BasiliskII, the config file and rom are in the Resources Folder of the .App that Platypus created.

What am I doing wrong?


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Fri Jun 17, 2016 5:58 pm 
Offline
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 1751
I don't have access right now, but when I get home I'll pull up my script. CWD defaults to the location of the binary; I seem to recall I called cwd, stripped the MacOS folder and CD'd to ../Resources, at which point everything can be done as relative references.

Actually, I might have already pasted that script on here somewhere.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Wed Jun 22, 2016 10:21 am 
Offline
Tinkerer

Joined: Fri Nov 09, 2007 5:42 pm
Posts: 98
Couldn't find a cwd command, besides in FTP which is just the cd command.

So, my first 2 lines

Code:
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"


is just going to the location of the binary (well, the sh script) and doing the rest from there. I can run ./BasiliskII --config basilisk_ii_prefs but it doesn't find the ROM set in the prefs file even though it's right there. If I use ./BasiliskII --rom and point to the rom file like I do in the prefs file it works.
I don't understand it. Why does it not work when called with --config?


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Jul 07, 2016 6:27 am 
Offline
Tinkerer

Joined: Fri Nov 09, 2007 5:42 pm
Posts: 98
@adespoton could you find anything yet?


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Jul 07, 2016 11:36 pm 
Offline
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 1751
Yes; finally at my Mac when I can pull this up:

Code:
#!/bin/sh
mypath=`dirname "$0"`
res="../Resources"
cd "$mypath"
mv "$res/nvram" ~/.basilisk_ii_xpram
"./MacOS 7.6.1" --config "../Resources/Config"
mv ~/.basilisk_ii_xpram "$res/xpram"


That's what I do for BII -- I've put that script in the MacOS folder and told the Info.plist that this is the binary to launch. As you can see, this script also manages the xpram file, so you can have multiple BII instances running at the same time.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Tue Aug 16, 2016 3:33 pm 
Offline
Tinkerer

Joined: Sat Jul 02, 2016 12:28 pm
Posts: 42
adespoton wrote:
Yes; finally at my Mac when I can pull this up:

Code:
#!/bin/sh
mypath=`dirname "$0"`
res="../Resources"
cd "$mypath"
mv "$res/nvram" ~/.basilisk_ii_xpram
"./MacOS 7.6.1" --config "../Resources/Config"
mv ~/.basilisk_ii_xpram "$res/xpram"


That's what I do for BII -- I've put that script in the MacOS folder and told the Info.plist that this is the binary to launch. As you can see, this script also manages the xpram file, so you can have multiple BII instances running at the same time.


Maybe I am just too rusty, but I don't quite get how this script lets you run more than one simultaneous machine/BII-instance in terms of the xpram. Please correct me if I am wrong.

The mv copies/moves the one xpram to your home folder where Basilisk expects to find it. You open instance two, which overwrites the one in the home folder. The files are copied back on quit.

This would only work if the xpram is immediately read by BII on start, and written to only on exit, overwriting the file completely. If that is the case all is well. Else you would have BII one's file interfering with BII two's xpram potentially.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Tue Aug 16, 2016 5:27 pm 
Offline
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 1751
Yes -- it's a quick hack. However, it's also a bit more subtle than that -- the xpram gets written back after the BII process is spun up, not after it quits. This means that any changes made during the initial boot process will be written back, but any changes made during execution will be reverted on next execution.

So if you want to change something in xpram, you'll have to manually copy the xpram back after you shut down to replace the copy in the application bundle.

The result is that you want to wait until one BII instance is fully running before launching another, or else you might end up with the wrong xpram being written back, which can really mess things up (not just failure to boot, but subtle things like corrupted memory/disk images). Usually the OS's sanity check at boot is enough to prevent this issue, but if you change the file in mid-operation and then the OS reads from it... bad things can happen.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Sun Aug 21, 2016 4:49 am 
Offline
Tinkerer

Joined: Sat Jul 02, 2016 12:28 pm
Posts: 42
adespoton wrote:
Yes -- it's a quick hack. However, it's also a bit more subtle than that -- the xpram gets written back after the BII process is spun up, not after it quits.


I'm still battling with this, probably because of pure ignorance on the Unix side. Please excuse the long full paths.

Shell script named MacOS_8.1.sh:

Code:
cd "/Users/peter/BasiliskConfigs/Runfolder_MacOS_8.1"
mv "/Users/peter/BasiliskConfigs/Runfolder_MacOS_8.1/xpram" "/Users/peter/.basilisk_ii_xpram"
echo Starting emulator
"/Users/peter/BasiliskConfigs/Runfolder_MacOS_8.1/BasiliskII_2014.app/Contents/MacOS/BasiliskII"  --config "/Users/peter/BasiliskConfigs/Runfolder_MacOS_8.1/prefs"
echo Emulator Closing
echo Copying back
mv "/Users/peter/.basilisk_ii_xpram" "/Users/peter/BasiliskConfigs/Runfolder_MacOS_8.1/xpram"
echo Done


This produces this output:

Code:
Peters-MacBook-Pro:~ peter$ ./MacOS_8.1.sh
Starting emulator
Basilisk II V1.0 by Christian Bauer et al.
<snip whole lot of Basilisk stuff>
Sorting out untranslated instructions count...

Rank  Opc      Count Name
Emulator Closing
Copying back
Done


What I see is that the final copy-back happens only AFTER the emulator quits. Am I missing something here?


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Sun Aug 21, 2016 6:16 am 
Offline
Tinkerer

Joined: Sat Jul 02, 2016 12:28 pm
Posts: 42
Got it!! :smile:

Finally, after many searches, it all becomes simple. You can substitute another folder for your HOME folder in the shell script, and Basilisk puts the xpram in the new folder. Like so:

Code:
HOME="/Users/peter/test/"


More testing to be done, but if this is correct it solves a whole bunch of problems ( and means a whole lot of re-coding for me! ). ( I'm feeling a bit stupid ).


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Sun Aug 21, 2016 6:25 am 
Offline
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 1751
Well what do you know...
Code:
#!/bin/sh
mypath=`dirname "$0"`
res="../Resources"
cd "$mypath"
HOME="$mypath/$res"
./BasiliskII --config "$HOME/Config"


This works perfectly! The xprram file got written to the Resources folder!

I'm changing all my scripts over now :)


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Dec 01, 2016 4:31 pm 
Offline
Mac Mechanic
User avatar

Joined: Tue Mar 29, 2011 8:57 pm
Posts: 183
Location: London, UK
adespoton, suppose I have several virtual machines in either self-contained wrappers or different config files. Is there a reason why I'd like to keep the xpram file?
I want to know if your interest is simply to keep these xpram files separate for each bundle so you don't have to manually remove it or if there is something useful about it.
I am researching to improve my UI config application. It deletes xpram automatically every time Basilisk II shuts down. I wonder if I should change the behaviour.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Dec 01, 2016 9:27 pm 
Offline
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 1751
I like to keep the xpram around because things like screen resolution and depth are set in there, as well as menu blink, mouse tracking, key repeat rate and parameters specific to the OS version booted last time. Being able to load from xpram avoids having to re-configure all that info after next boot, and speeds up the boot process.


Top
 Profile  
Reply with quote Post a reply  
Display posts from previous:  Sort by  
Post new topic  Reply to topic Page 1 of 1 [ 15 posts ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
 

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group