Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

About unsupported SheepShaver configurations, like COI (Chubby Bunny), SheepShaver Wrapper, etc.

Moderators: Cat_7, Ronald P. Regensburg

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

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by emendelson »

Please download the current version of the Mac OS 9 application and let us know whether it shows the same error. You can keep the one you have in a different folder in case you want to preserve it.
brklyn.ellie
Student Driver
Posts: 13
Joined: Thu May 21, 2020 8:34 pm

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by brklyn.ellie »

I actually did that before posting. This is the most recent version.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by emendelson »

A complete puzzle. The word "Retina" isn't anywhere in the AppleScript launcher or, apparently, in the SheepShaver code.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by Ronald P. Regensburg »

Is it possible to start the application from Terminal and see what the output in Terminal is?
brklyn.ellie
Student Driver
Posts: 13
Joined: Thu May 21, 2020 8:34 pm

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by brklyn.ellie »

Same issue (unless I am not opening it correctly in Terminal).

https://imgur.com/YplhcFN
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by emendelson »

OK, try this.

First, open a terminal, type this command, and press Return.

Code: Select all

defaults remove org.wpdos.macos9
Try launching the Mac OS 9 app again. If the error message persists, then do this:

Right-click on the Mac OS 9 app; click Show package contents.

Double-click Contents.

Double-click Resources.

Double-click Files.

Drag the MacOS.sheepvm icon and drop it on to the SheepShaver icon.

SheepShaver should open. Do you see the same message? (Ignore any error messages that appear INSIDE SheepShaver about not finding a file, etc.)
brklyn.ellie
Student Driver
Posts: 13
Joined: Thu May 21, 2020 8:34 pm

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by brklyn.ellie »

Terminal command did nothing different upon opening Mac OS 9.

Following the second set of instructions, SheepShaver opens with 2 error messages inside of it, but no repeat of the original error message in my computer's current OS.

Edit: after doing both of these, trying to launch SheepShaver from the dock icon (which came up when I used the above steps) does not open the app, and the Mac OS 9 app continues to give the same error message.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by emendelson »

That means that the "Retina" error is produced by the AppleScript that launches Mac OS 9, not by SheepShaver itself.

The SheepShaver application inside the Mac OS 9 application will not launch from the taskbar; that's exactly the way it's supposed to work. The two error messages that you saw inside SheepShaver are exactly what ought to happen when the application is launched the way I described it.

So my AppleScript wrapper is somehow causing the error, but only on your system, not, apparently, on anyone else's, and certainly not on mine. And because the word "Retina" is nowhere in my AppleScript, I can't imagine what's causing this, unless something else in your system is interfering somehow. The only thing I can suggest is that you find some other way to run SheepShaver on your system that doesn't involve my system. This site has alternate methods that you can try.
ckrokosh
Space Cadet
Posts: 6
Joined: Tue Jun 22, 2021 2:25 am

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by ckrokosh »

I had the same issue on my iMac 5k and have somewhat solved it.

I am no expert on this and have never played with applescript but looking through the code it looks like it tries to get the resolution of your monitors from the system report accessed from the about this mac dialogue. I think the way this information is displayed may have changed in the latest update to Big Sur.

This seems to be the snippet of code causing the issue. ( i added the line numbers for my explanation.)

on getResolutions()

set resolutions to {}
repeat with p in paragraphs of ¬
(do shell script "system_profiler SPDisplaysDataType | awk '/Resolution:/{ printf \"%s %s\\n\", $2, $4 }'")
set resolutions to resolutions & {{word 1 of p as number, word 2 of p as number}}
end repeat
# `resolutions` now contains a list of size lists;
# e.g., with 2 displays, something like {{2560, 1440}, {1920, 1200}}

end getResolutions

I believe in the5th line the $2 and $4 should be the resolutions. In my case 5120 and 2880. However in system information my display is listed in this format:
Resolution: Retina 5K (5120 X 2880) (1-resolution, 2-retina, 3-5k,4-5120,5-x, and 6 2880). I think this is why we were getting the "retina"...its in position 2
I changed the 2 and 4 in that line to 4 and 6 and it works! Unfortunately only if i disconnect my external monitor.

Its listed as: Resolution: 1920 x 1080 (1080p FHD - Full High Definition) so it gives me the same error but FHD not Retina because FHD is in position 6.

Hope this helps.
brklyn.ellie
Student Driver
Posts: 13
Joined: Thu May 21, 2020 8:34 pm

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by brklyn.ellie »

Interesting! Thanks for getting back to me.

Do you think this applies to my situation if I’m not using an external monitor?
ckrokosh
Space Cadet
Posts: 6
Joined: Tue Jun 22, 2021 2:25 am

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by ckrokosh »

It should, as it worked for me as long as my second monitor was disconnected. Not sure your knowledge on MacOS but you can find and edit the file by right clicking on the MAC OS 9 application, show package contents and then navigate to Contents, Resources and scripts folder. There is a file called main.scpt. Right click on it and select "open with script editor". You may get a pop up saying it is locked but it will give you the option to unlock it.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by emendelson »

ckrokosh wrote: Tue Jun 22, 2021 2:57 am I had the same issue on my iMac 5k and have somewhat solved it.

I am no expert on this and have never played with applescript but looking through the code it looks like it tries to get the resolution of your monitors from the system report accessed from the about this mac dialogue. I think the way this information is displayed may have changed in the latest update to Big Sur.

This seems to be the snippet of code causing the issue. ( i added the line numbers for my explanation.)

on getResolutions()

set resolutions to {}
repeat with p in paragraphs of ¬
(do shell script "system_profiler SPDisplaysDataType | awk '/Resolution:/{ printf \"%s %s\\n\", $2, $4 }'")
set resolutions to resolutions & {{word 1 of p as number, word 2 of p as number}}
end repeat
# `resolutions` now contains a list of size lists;
# e.g., with 2 displays, something like {{2560, 1440}, {1920, 1200}}

end getResolutions

I believe in the5th line the $2 and $4 should be the resolutions. In my case 5120 and 2880. However in system information my display is listed in this format:
Resolution: Retina 5K (5120 X 2880) (1-resolution, 2-retina, 3-5k,4-5120,5-x, and 6 2880). I think this is why we were getting the "retina"...its in position 2
I changed the 2 and 4 in that line to 4 and 6 and it works! Unfortunately only if i disconnect my external monitor.

Its listed as: Resolution: 1920 x 1080 (1080p FHD - Full High Definition) so it gives me the same error but FHD not Retina because FHD is in position 6.
Excellent detective work! Thank you! When I get a chance (maybe this week, maybe next), I'll revise my AppleScript to test for "Retina" in the output, and, if it's there, look for $4 and $6. This will require some programming that's probably beyond my abilities, but probably someone on one of the programming forums will know how to solve it. Again, well done!
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by emendelson »

@ckrorosh - On looking at the code, I think the solution may in fact be simple. Could you do this experiment, as I have no way of testing it (I only have laptops, no external monitors)? Replace the "on GetResolutions()" function in my code with this:

Code: Select all

on getResolutions()
	
	set resolutions to {}
	repeat with p in paragraphs of ¬
		(do shell script "system_profiler SPDisplaysDataType | awk '/Resolution:/{ printf \"%s %s\\n\", $2, $4, $6 }'")
		try
			set resolutions to resolutions & {{word 1 of p as number, word 2 of p as number}}
		on error
			set resolutions to resolutions & {{word 2 of p as number, word 3 of p as number}}
		end try
	end repeat
	# `resolutions` now contains a list of size lists;
	# e.g., with 2 displays, something like {{2560, 1440}, {1920, 1200}}
	
end getResolutions
This has two changes: first, in the shell script, it gets $2, $4, and $6 instead of just $2 and $4. Then, it adds the try/on-error/end-try sequence in which it tries to use $2 and $4, but if it gets an error (as it will if $2 says "retina"), then it tries to use $4 and $6.

I think this should work, but I'm a beginner at AppleScript, and I'm flying blind. If it it in fact works in your setup, with or without the external monitor attached, then I'll post a new version. If not, I'll keep trying.

EDIT: I don't think this is affected by a change in Big Sur, as the old code works on my Big Sur laptops, but it may be affected by the presence of a 5K external monitor.
ckrokosh
Space Cadet
Posts: 6
Joined: Tue Jun 22, 2021 2:25 am

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by ckrokosh »

Unfortunately that didn't work...now i get the following error:

"Can’t make word 3 of item 1 of every paragraph of "Retina (5120
1920 1080" into type number."

If it helps my two monitor are listed as:

Display Type: Built-In Retina LCD
Resolution: Retina 5K (5120 x 2880)

ASUS VP247:
Resolution: 1920 x 1080 (1080p FHD - Full High Definition)

Using my code changes i previously posted I also changed the line below it to:

set resolutions to resolutions & {{word 1 of p as number, word 1 of p as number}}

This works with or without the second monitor connected but is probably using the same number for both the horizontal and vertical size of the screen.

Not sure how this might affect other parts of the program.

But with this it runs, full screen works, as well as changing resolutions from the option menu.
ckrokosh
Space Cadet
Posts: 6
Joined: Tue Jun 22, 2021 2:25 am

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by ckrokosh »

My previous post was with the external monitor connected.

Disconnecting it I get the following error:

Can’t make word 3 of item 1 of every paragraph of "Retina (5120" into type number.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by emendelson »

If you're willing to keep trying, here's another version:

Code: Select all

on getResolutions()
	
	set resolutions to {}
	repeat with p in paragraphs of ¬
		(do shell script "system_profiler SPDisplaysDataType | awk '/Resolution:/{ printf \"%s %s\\n\", $2, $4, $6, $8 }'")
		try
			set resolutions to resolutions & {{word 1 of p as number, word 2 of p as number}}
		on error -- in case word 1 is "retina"
			try
				set resolutions to resolutions & {{word 2 of p as number, word 3 of p as number}}
			on error
				try
					set resolutions to resolutions & {{word 3 of p as number, word 4 of p as number}}
				on error
					-- use a minimal screensize as a fallback
					set resolutions to resolutions & {{1440, 900}}
				end try
			end try
		end try
	end repeat
	# `resolutions` now contains a list of size lists;
	# e.g., with 2 displays, something like {{2560, 1440}, {1920, 1200}}
	
end getResolutions
This gets four items, and performs additional tests - and, if it can't set any resolution from the string, uses the smallest current Mac screen size as a fallback, which I hope is better than crashing. Once again, please let me know if this works, and thanks again for figuring out the error.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by mabam »

No matter what the line “Resolution: …“ reads, it always seems to contain the horizontal and vertical amount of pixels with in between them “space, X (either small or capitalised), space”. The character to the left of the first and to the right of the second value is either a brace or a space, respectively.

May I offer an alternative that should work in a bit more universal way?

Code: Select all

on getResolutions()
	
	set resolutions to {}
	repeat with p in paragraphs of ¬
		(do shell script "system_profiler SPDisplaysDataType | grep Resolution:")
		try
			set {tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, {" X ", " x "}}
			set resParagraph to text items 1 thru 2 of p
			set AppleScript's text item delimiters to {" ", "(", ")"}
			copy {text item -1 of item 1 of resParagraph as number, text item 1 of item 2 of resParagraph as number} to end of resolutions
			set AppleScript's text item delimiters to tid
		on error
			copy {1440, 900} to end of resolutions
		end try
	end repeat
	# `resolutions` now contains a list of size lists;
	# e.g., with 2 displays, something like {{2560, 1440}, {1920, 1200}}
	
end getResolutions
ckrokosh
Space Cadet
Posts: 6
Joined: Tue Jun 22, 2021 2:25 am

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by ckrokosh »

emendelson: Success! I tried with both the external monitor disconnected and connected. I tried fullscreen and changing resolutions using the "option" menu, All is working perfectly.

As a side note, I was having the same issue with the System761 app. I tried this code in that script and it is working now as well.

Thanks for your time on fixing this and the project in general...much appreciated.

mabam: I tried your code and get the following error with the external monitor connected or not.

Can’t make item 1 of item 1 of {""} into type number. (-1700)
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by mabam »

ckrokosh wrote: Tue Jun 22, 2021 9:03 pm mabam: I tried your code and get the following error with the external monitor connected or not.

Can’t make item 1 of item 1 of {""} into type number. (-1700)
I got the same when I just tried again, though it did work in the first place. Looking into it.


EDIT:

This should work:

Code: Select all

on getResolutions()
	
	set resolutions to {}
	repeat with p in paragraphs of ¬
		(do shell script "system_profiler SPDisplaysDataType | grep Resolution:")
		try
			set {tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, {" X ", " x "}}
			set resParagraph to text items 1 thru 2 of p
			set AppleScript's text item delimiters to {" ", "(", ")"}
			copy {text item -1 of item 1 of resParagraph as number, text item 1 of item 2 of resParagraph as number} to end of resolutions
			set AppleScript's text item delimiters to tid
		on error
			copy {1440, 900} to end of resolutions
		end try
	end repeat
	# `resolutions` now contains a list of size lists;
	# e.g., with 2 displays, something like {{2560, 1440}, {1920, 1200}}
	return resolutions
	
end getResolutions
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by emendelson »

EDIT - mabam - I saw your revised code after I posted this. Will test your new code and report. Thank you!

ckrokosh - Thank you for testing. I'll post an updated version of the app as soon as I can. Right now, I'm on the road, with a slow connection, and it may be impractical to notarize something this massive.

EDIT: Removed now-irrelevant reply to mabam...
Last edited by emendelson on Tue Jun 22, 2021 9:22 pm, edited 1 time in total.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by emendelson »

mabam - Your revised code seems to work perfectly. Thank you.

ckrokosh - If can confirm that mabam's code works with your setup, I would certainly prefer to use it instead of mine. Thank you again for sorting this out!

EDIT: And I'll make the same fix in the System761.app, but will wait until you can confirm that mabam's code is working on your setup as it does on mine.
ckrokosh
Space Cadet
Posts: 6
Joined: Tue Jun 22, 2021 2:25 am

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by ckrokosh »

I used mabam's updated code in both MACOS9 and System761 apps and all is working as expected regardless of the second monitor being connected.

Thanks to the two of you.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by emendelson »

Terrific. Will update both apps either today or when I get a faster connection. The biggest thanks go to you for sorting out what the problem was. I was completely baffled by an error message with the word "retina" in it, when the word "retina" wasn't anywhere in the code...
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by mabam »

Glad it works for you.

I like AppleScript’s flexibility when parsing text. I’m sure this could also be done using sed or awk in a shell script, but I find AppleScript easier to learn as one can more or less read it like plain English.
User avatar
adespoton
Forum All-Star
Posts: 4208
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Standalone SheepShaver for OS X (add ROM and OS 8.5-9.0.4)

Post by adespoton »

mabam wrote: Tue Jun 22, 2021 9:33 pm Glad it works for you.

I like AppleScript’s flexibility when parsing text. I’m sure this could also be done using sed or awk in a shell script, but I find AppleScript easier to learn as one can more or less read it like plain English.
I like AppleScript's ability to be relatively easily debugged. That can't be sed for awk :D
Post Reply