How to configure Power Button in Basilisk II and SheepShaver
Moderators: Cat_7, Ronald P. Regensburg
How to configure Power Button in Basilisk II and SheepShaver
As many of you may know, old Macs used to have a Power Button on their keyboards (at least until the iMac came around) that turned off the system. I know that I can configure the Power button to work in both Basilisk II and SheepShaver (cause someone said it made it work) so I looked at the BasiliskII_keycodes file, but I can't figure the file out. Just a bunch of numbers and letters that I don't know their meaning. Can someone help me? Why it has to be so damn difficult to get a button working?
- adespoton
- Forum All-Star
- Posts: 4284
- Joined: Fri Nov 27, 2009 5:11 am
- Location: Emaculation.com
- Contact:
Re: How to configure Power Button in Basilisk II and SheepSh
The mac power button is hex code 0x66 -- I'm not sure what this is in the keycodes file, but that should help.
Re: How to configure Power Button in Basilisk II and SheepSh
Forgot to mention it, the format in the Keycodes file is like this: <SDL scancode> <Mac keycode>
- Ronald P. Regensburg
- Expert User
- Posts: 7835
- Joined: Thu Feb 09, 2006 10:24 pm
- Location: Amsterdam, Netherlands
Re: How to configure Power Button in Basilisk II and SheepSh
Some older machines needed to be turned off physically after shutdown. If I remember well, pressing the power button while the system was still running would bring up the shutdown/sleep/restart dialog, while ctrl-cmd-opt-power would result in shutdown without dialog.macplus wrote:old Macs used to have a Power Button on their keyboards (at least until the iMac came around) that turned off the system.
Re: How to configure Power Button in Basilisk II and SheepSh
I use a Macally keyboard that still has the power button:
![Image](http://lowendmac.com/wp-content/uploads/ikey.jpg)
![Image](http://lowendmac.com/wp-content/uploads/ikey.jpg)
I wasn't aware of the latter. Just tested it and it works as advertised. That is, on Mountain Lion.Ronald P. Regensburg wrote:If I remember well, pressing the power button while the system was still running would bring up the shutdown/sleep/restart dialog, while ctrl-cmd-opt-power would result in shutdown without dialog.
Re: How to configure Power Button in Basilisk II and SheepSh
Well, thanks for the info, but that wasn't what I was asking for! Just tell me how to configure the button and that's it. End of story.
- Ronald P. Regensburg
- Expert User
- Posts: 7835
- Joined: Thu Feb 09, 2006 10:24 pm
- Location: Amsterdam, Netherlands
Re: How to configure Power Button in Basilisk II and SheepSh
I don't think there is a way to use a power key inside these emulators.
The equivalent of pressing the power key on a real hardware Mac is stopping the emulator.
Stopping the emulator will bring up the restart/shutdown (or restart/sleep/shutdown) dialog.
Stopping the emulator with ctrl-cmd-op pressed will make the emulator shut down without dialog.
The equivalent of pressing the power key on a real hardware Mac is stopping the emulator.
Stopping the emulator will bring up the restart/shutdown (or restart/sleep/shutdown) dialog.
Stopping the emulator with ctrl-cmd-op pressed will make the emulator shut down without dialog.
Re: How to configure Power Button in Basilisk II and SheepSh
In my case, when pressing the power button the shutdown dialog appears in both, the host macOS and Mac OS in SheepShaver. I use the standard keycodes file provided with SheepShaver.
You could have an AppleScript or LauchDaemon watch the shutdown dialog in your host macOS. (If you use a bash script to start SheepShaver, e.g. for tap networking, you could make the AppleScript start with SheepShaver automatically.) Once the dialog appears the script checks for SheepShaver being the frontmost application. If it is, the script closes the dialog in your host system. (Not the most beautiful solution, but it should work.)
If the dialog does not also appear in SheepShaver in your case (which isn't entirely clear to me from what I read), you could make the script tell SheepShaver to quit in order to trigger the dialog within SheepShaver.
You could have an AppleScript or LauchDaemon watch the shutdown dialog in your host macOS. (If you use a bash script to start SheepShaver, e.g. for tap networking, you could make the AppleScript start with SheepShaver automatically.) Once the dialog appears the script checks for SheepShaver being the frontmost application. If it is, the script closes the dialog in your host system. (Not the most beautiful solution, but it should work.)
If the dialog does not also appear in SheepShaver in your case (which isn't entirely clear to me from what I read), you could make the script tell SheepShaver to quit in order to trigger the dialog within SheepShaver.
Re: How to configure Power Button in Basilisk II and SheepSh
The Macally story was just a detour as part of what Ronald wrote was new to me.macplus wrote:Well, thanks for the info, but that wasn't what I was asking for!
But I tend to need a bit longer until I understand what others really mean. So my last post also seems to have missed the point. Sorry.
What I found in the keycodes file is this:
Code: Select all
# Quartz (1:1 translation actually)
#
sdl Quartz
…
127 127 # Power
EDIT:
I suppose you're on a Mac. Which key on your keyboard is the one you would like to use as power key for SheepShaver?
Re: How to configure Power Button in Basilisk II and SheepSh
I'm in a Windows machine. I want to assign the DEL key for it to be the Power button.
Re: How to configure Power Button in Basilisk II and SheepSh
In the "BasiliskII_keycodes" file (for SheepShaver the name should be similar) there are four tables, the last one being titled "Windows". In that last table, scroll to the line
and change 117 to 127, as that is the code for the power key:
Does that make the DEL key work as power key for you?
Code: Select all
211 117 # Delete
Code: Select all
211 127 # Delete
Re: How to configure Power Button in Basilisk II and SheepSh
Nope, it does not work.
Re: How to configure Power Button in Basilisk II and SheepSh
Then I don't know a solution, I'm afraid. This works on a Mac, but I don't know much about Windows.
Maybe there's a Windows tool that could watch your keystrokes when SheepShaver is active and trigger an action to be performed or script to be ran. You could have it tell SheepShaver to quit, as this will make the restart/sleep/shutdown dialog appear in the emulated Mac OS, as Ronald wrote earlier. Maybe there is someone here who could tell you how to do that.
Maybe there's a Windows tool that could watch your keystrokes when SheepShaver is active and trigger an action to be performed or script to be ran. You could have it tell SheepShaver to quit, as this will make the restart/sleep/shutdown dialog appear in the emulated Mac OS, as Ronald wrote earlier. Maybe there is someone here who could tell you how to do that.
Re: How to configure Power Button in Basilisk II and SheepSh
Don't worry about it, it was just a lost cause.
-
- Inquisitive Elf
- Posts: 26
- Joined: Wed Jul 26, 2017 10:50 pm
Re: How to configure Power Button in Basilisk II and SheepSh
Hi all,
Just as a followup to this, from someone who is trying to get MacsBug working in Basilisk:
The Mac power key is 0x7f (or 127 in decimal), not 0x66. I am unsure what 0x66 is. Possibly an SDL key code or scan code, perhaps? It's not the power key, though. Only when I mapped something to Mac key 0x7f did MacsBug launch (it runs when Mac-side Command + Power is pressed).
I hope this helps!
Just as a followup to this, from someone who is trying to get MacsBug working in Basilisk:
The Mac power key is 0x7f (or 127 in decimal), not 0x66. I am unsure what 0x66 is. Possibly an SDL key code or scan code, perhaps? It's not the power key, though. Only when I mapped something to Mac key 0x7f did MacsBug launch (it runs when Mac-side Command + Power is pressed).
I hope this helps!
Re: How to configure Power Button in Basilisk II and SheepSh
I remember being able to configure the power button to F15 for build 142 years ago, and it worked, being able to enter MacsBug via Alt-F15. (The incomplete 68k CPU emulation broke instruction stepping in MacsBug, but having a debugger is better than not having one.)
As far as I know, the problem here is an old one, in the key code reader.
I conducted a test using the 2015 build of Basilisk II. I changed the prefs file to use the key codes file, and set the (forward) Delete key to Power (#127). I typed a few characters into a text box and hit Delete in the middle. The result: "." was typed. Some other keys were incorrectly producing number keys.
It appears the bug where bit #7 is ignored is still present in the code, making the right hand side of the keyboard map to the lower keys in the key code file.
As far as I know, the problem here is an old one, in the key code reader.
I conducted a test using the 2015 build of Basilisk II. I changed the prefs file to use the key codes file, and set the (forward) Delete key to Power (#127). I typed a few characters into a text box and hit Delete in the middle. The result: "." was typed. Some other keys were incorrectly producing number keys.
It appears the bug where bit #7 is ignored is still present in the code, making the right hand side of the keyboard map to the lower keys in the key code file.