Any way to use a different prefs file?
Moderators: Cat_7, Ronald P. Regensburg
Any way to use a different prefs file?
I want to create a self-contained Basilisk II that uses a different preferences file than ~/.basilisk_ii_prefs, so I can configure it for a specific task without affecting my current Basilisk II settings. Ideally it'd use a prefs file in the same folder as the app itself. The host system is running macOS.
Is there any way to do that?
Is there any way to do that?
Re: Any way to use a different prefs file?
This should work:
You create a command file that starts BasiliskII with the argument --config prefs_file_name.
So first set the desired settings with the GUI. Then make a textfile (I use 81.txt as example below to start MacOS 8.1) and copy the content of your current .basilisk_ii_prefs file into it.
Save the file as 81.txt
Then make a new text file.
Content should be something like this:
Save the file with .command extension and make the file executable and you're done. When you double-click the command file Basilisk will use the prefs in the 81.txt file.
A terminal window opens in which you see Basilisk start. I don't know whether this can be prevented.
You can create multiple command files each pointing to a different text file with different prefs.
You can then no longer use the GUI to change settings, unless you repeat the step to copy your desired prefs into one of the multiple text files.
But you can edit the new prefs files with textedit.
Best,
Cat_7
You create a command file that starts BasiliskII with the argument --config prefs_file_name.
So first set the desired settings with the GUI. Then make a textfile (I use 81.txt as example below to start MacOS 8.1) and copy the content of your current .basilisk_ii_prefs file into it.
Save the file as 81.txt
Then make a new text file.
Content should be something like this:
Code: Select all
#!/bin/bash
cd "$(dirname "$0")"
/Applications/BasiliskII/BasiliskII.app/Contents/MacOS/BasiliskII --config /Applications/BasiliskII/81.txt
A terminal window opens in which you see Basilisk start. I don't know whether this can be prevented.
You can create multiple command files each pointing to a different text file with different prefs.
You can then no longer use the GUI to change settings, unless you repeat the step to copy your desired prefs into one of the multiple text files.
But you can edit the new prefs files with textedit.
Best,
Cat_7
-
- Forum All-Star
- Posts: 1875
- Joined: Tue Oct 14, 2008 12:12 am
Re: Any way to use a different prefs file?
You might look at the self-contained apps I posted here:
https://mendelson.org/selfcontained.html
The MacOS folder contains a script, not an executable, and you can edit the script to suit your needs. The "bii.prefs" file can also be rewritten or replaced with any other prefs file you want, and that prefs file can be called by the script.
And credit where credit is due: Some of the details in the script were first sugested by adespoton in this forum.
https://mendelson.org/selfcontained.html
The MacOS folder contains a script, not an executable, and you can edit the script to suit your needs. The "bii.prefs" file can also be rewritten or replaced with any other prefs file you want, and that prefs file can be called by the script.
And credit where credit is due: Some of the details in the script were first sugested by adespoton in this forum.
Re: Any way to use a different prefs file?
Thanks, I was thinking I might try something like that. I take it there's no way to also specify which prefs file the GUI will edit?Cat_7 wrote: Tue Apr 08, 2025 5:03 am You create a command file that starts BasiliskII with the argument --config prefs_file_name.
Re: Any way to use a different prefs file?
Another follow up question: is there a way to use a different xpram file too? (Is that even all that important?)
Re: Any way to use a different prefs file?
That can be important if you're flipping between different OSes while using the same XPRAM file.bribri wrote: Tue Apr 08, 2025 3:20 pm Another follow up question: is there a way to use a different xpram file too? (Is that even all that important?)
Since you seem to be using macOS as your host system, you could try fiddling with https://github.com/adespoton/macosemushells -- these are severely outdated compared to the ones I use today, but they show a solution for custom config and xpram files (I *think* the 7.0.1P through 7.1.2P setups are all using BII in this revision of my shells).
-
- Forum All-Star
- Posts: 1875
- Joined: Tue Oct 14, 2008 12:12 am
Re: Any way to use a different prefs file?
I finally figured out (it should have been obvious) how to modify the code to save the xpram file inside the app, and will post instructions sometime in the next few days. Stay tuned.
Re: Any way to use a different prefs file?
I figured out how to compile BasiliskII myself, so I can also just modify the source code now to have it look for these files in different places.
However, there's still the GUI. That's not open source, correct? I don't suppose there's any way to convince it to use a different preferences file, is there?
However, there's still the GUI. That's not open source, correct? I don't suppose there's any way to convince it to use a different preferences file, is there?
-
- Forum All-Star
- Posts: 1875
- Joined: Tue Oct 14, 2008 12:12 am
Re: Any way to use a different prefs file?
No way to edit the GUI. (For what it's worth, I never use the GUI - I always edit the prefs files by hand.)bribri wrote: Wed Apr 09, 2025 12:34 pm I figured out how to compile BasiliskII myself, so I can also just modify the source code now to have it look for these files in different places.
However, there's still the GUI. That's not open source, correct? I don't suppose there's any way to convince it to use a different preferences file, is there?
-
- Forum All-Star
- Posts: 1875
- Joined: Tue Oct 14, 2008 12:12 am
Re: Any way to use a different prefs file?
As a way to waste time, I modified the code so that the prefs file can optionally specify the folder path and/or filename of the BasiiskII xpram file.
Here is a notarized copy of the modified build:
https://www.dropbox.com/scl/fi/2pd2nqhv ... klpfo&dl=0
And here is a fork of the code with the modifications included. My code is incompetent, so I'm not sure I want to propose a pull to the main branch, but maybe kanjitalk755 will do a better job of it.
https://github.com/emendelson/macemu-xpram
Here is a notarized copy of the modified build:
https://www.dropbox.com/scl/fi/2pd2nqhv ... klpfo&dl=0
And here is a fork of the code with the modifications included. My code is incompetent, so I'm not sure I want to propose a pull to the main branch, but maybe kanjitalk755 will do a better job of it.
https://github.com/emendelson/macemu-xpram
-
- Forum All-Star
- Posts: 1875
- Joined: Tue Oct 14, 2008 12:12 am
Re: Any way to use a different prefs file?
And kanjitalk755 has now implemented this feature properly, so it's part of the standard code for macOS. I've updated my System761 and System Seven apps to write the xpram file to custom locations in the user's Library/Application Support folder.
Re: Any way to use a different prefs file?
Not for windows users?kanjitalk755 has now implemented this feature properly, so it's part of the standard code for macOS.
Best,
Cat_7
-
- Forum All-Star
- Posts: 1875
- Joined: Tue Oct 14, 2008 12:12 am
Re: Any way to use a different prefs file?
kanjitalk755 says it's only for macOS. Shall we both look at the Windows code and see if it's possible to do the same? I'll try to get to it today. But I'm a third-rate (make that fourth-rate) coder, so I doubt I'll succeed.
EDIT: I'm at a Mac now, so can't test, but the thing to do seems to be to edit Windows/xpram_windows, and find the section "static void build_xpram_path(void)". Then add the test for the path that kanjitalk755 added to the macOS version; if the xrpam pref is not present, use the existing setting. The trouble is that the code SEEMS to need double-backslashes, not single ones. Presumably we don't want the user to enter two backslashes, and presumably there's a way to replace single backslashes in a string with double backslashes, but I don't know what it is.
EDIT2: If it's necessary to replace backslashes with double backslashes, then maybe one of these methods will work:
https://stackoverflow.com/questions/610 ... -backslash
Of course you could simply ask kanjitalk755 to implement this - he probably could do it in two minutes or less.
EDIT: I'm at a Mac now, so can't test, but the thing to do seems to be to edit Windows/xpram_windows, and find the section "static void build_xpram_path(void)". Then add the test for the path that kanjitalk755 added to the macOS version; if the xrpam pref is not present, use the existing setting. The trouble is that the code SEEMS to need double-backslashes, not single ones. Presumably we don't want the user to enter two backslashes, and presumably there's a way to replace single backslashes in a string with double backslashes, but I don't know what it is.
EDIT2: If it's necessary to replace backslashes with double backslashes, then maybe one of these methods will work:
https://stackoverflow.com/questions/610 ... -backslash
Of course you could simply ask kanjitalk755 to implement this - he probably could do it in two minutes or less.
- Ronald P. Regensburg
- Expert User
- Posts: 8051
- Joined: Thu Feb 09, 2006 10:24 pm
- Location: Amsterdam, Netherlands
Re: Any way to use a different prefs file?
Didn't we always strive with these emulators for platform parity feature wise? Better ask kanjitalk755 to implement this feature for all platforms.
-
- Forum All-Star
- Posts: 1875
- Joined: Tue Oct 14, 2008 12:12 am
Re: Any way to use a different prefs file?
I prefer to try to do something by myself before asking kanjitalk755 to do it, and I figured out how to specify an xpram filename and location for BII under Windows. It required adding three lines of code. It's very incompetent code, but it seems to work. I'll post it on GitHub tomorrow and will ask kanjitalk755 to provide a more competent version.
Meanwhile, here's a codesigned BII exe for Windows that lets you specify the xpram file location in the prefs file like this:
The download is here:
https://www.dropbox.com/scl/fi/tils31j3 ... tg83p&dl=0
Meanwhile, here's a codesigned BII exe for Windows that lets you specify the xpram file location in the prefs file like this:
Code: Select all
xpram c:\path\to\xpramfilename
https://www.dropbox.com/scl/fi/tils31j3 ... tg83p&dl=0
-
- Forum All-Star
- Posts: 1875
- Joined: Tue Oct 14, 2008 12:12 am
Re: Any way to use a different prefs file?
And I've updated my Windows code so that it's only moderately incompetent, not very incompetent, and I've posted a pull request for kanjitalk755. With luck, kanjitalk755 will improve it as needed and will put an improved version into the standard code.
-
- Forum All-Star
- Posts: 1875
- Joined: Tue Oct 14, 2008 12:12 am
Re: Any way to use a different prefs file?
And kanjitalk755 accepted my code and merged it. I think I must have got it right purely by luck.