Login  •  Register


The time is now: Tue Feb 25, 2020 9:53 am

Emaculation wiki  •  Delete all board cookies



Post new topic  Reply to topic Page 1 of 1 [ 9 posts ]
Print view Previous topic  |  Next topic
Author Message
PostPosted: Mon Jan 27, 2020 7:43 am 
Offline
Inquisitive Elf
User avatar

Joined: Tue Jan 24, 2017 6:58 am
Posts: 38
Hi everyone! Long time no talk.

Last I was on these forums, I was working on a replacement finder for wrapped SheepShaver applications. A Finder replacement is preferable to using AppleScript because: 1) it jails the user inside the application, 2) it reduces boot time and gives a much more native application feel. Normally, however, exiting an application just relaunches the Finder so a custom replacement is needed to issue a shutdown call when the application is exited.

I had implemented the direct LaunchApplication system call in a C++ program. The launch system call worked, but handling processes in the Macintosh toolbox were a bit trickier. I may revisit it later.

However, along the way I had been running an MPW Shell prototype that worked completely flawlessly. I realized I could just use ToolServer as the replacement Finder to run it as a script.

The results are a vast improvement over using AppleScript.

Simple Tutorial:
1) On Mac OS 9.0.4, download the MPW-GM archive and copy ToolServer to your System Folder.
2) Create a text file named "StartupTS" in your System Folder which contains the following code:
Code:
"Macintosh HD:FOLDER:FOLDER:NAMEOFAPP" -wait
Shutdown

3) Open ToolServer in ResEdit. File > Get info. Change the type from APPL to FNDR.
4) Rename Finder to something else, and ToolServer to "Finder".
5) Reboot.

There are a number of next steps towards hiding emulation. Darkening out the startup screen, or implementing communication between a modified SS and ToolServer in order to prevent the user from seeing any OS9 outside the application are possible next options.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Mon Jan 27, 2020 2:59 pm 
Offline
Forum All-Star

Joined: Tue Oct 14, 2008 12:12 am
Posts: 1133
This is really fascinating, and I can confirm that it works. It took me a while to figure out that MPW means "Macintosh Programmer's Workshop" and that it can be found on the usual abandonware sites. Thank you!

(And is it possible to hide the little Status window?)


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Mon Jan 27, 2020 6:26 pm 
Offline
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 2792
Location: Emaculation.com
classicmacreborn wrote:
There are a number of next steps towards hiding emulation. Darkening out the startup screen, or implementing communication between a modified SS and ToolServer in order to prevent the user from seeing any OS9 outside the application are possible next options.


Depending on the OS version, you should be able to do this with a startup screen. Seems to me that Startup Screen files need to be resources with a PICT resource with the image you want to display. The T&C need to be something specific too, but I can't recall what. Then you name the file StartupScreen and put it in the system folder, and it replaces the standard boot screen with your image.

The original Mini vMac came with a 6.0.8 image that had one of these loaded, if someone wants to hunt that down :)

IIRC, somewhere in early System 7, this startup screen method was deprecated and you could just place a regular PICT image somewhere in the System folder with a specific name, and it would be used and displayed right after the original Welcome screen (before extensions start to load).

However, it's also possible to replace the welcome image in ROM and/or the boot image in the System folder (that loads just before the extensions). There was also an extension created that hid all the loading extension images; I never checked what it was doing to accomplish this and can't remember its name (it's been around 30 years since I've used it).


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Mon Jan 27, 2020 6:35 pm 
Offline
Inquisitive Elf
User avatar

Joined: Tue Jan 24, 2017 6:58 am
Posts: 38
Interesting... The status window always goes to back for me. I've only run a few applications, all full screen.

I had actually made some pretty decent progress on the C++ Finder:
https://github.com/classicmacreborn/WrapperFinder

It basically launches the application, runs a loop to check to see if the program is still running, and then issues the shutdown call. It works as a standalone application. However, IIRC when running as a finder, the application is relaunched after it is quit (normal finder behavior). I think the commented loop that checks if the process is running breaks when operating as a finder. Having an ACTUAL custom finder would be a better, cleaner solution and the code is 90% there. But I haven't run across any situation where the TS Finder solution has caused me any limitations. Would rather spend time trying to make Mac OS 9 more invisible. Maybe I'll come back to it eventually. It needs to be completed.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Mon Jan 27, 2020 6:53 pm 
Offline
Inquisitive Elf
User avatar

Joined: Tue Jan 24, 2017 6:58 am
Posts: 38
adespoton wrote:
classicmacreborn wrote:
There are a number of next steps towards hiding emulation. Darkening out the startup screen, or implementing communication between a modified SS and ToolServer in order to prevent the user from seeing any OS9 outside the application are possible next options.


Depending on the OS version, you should be able to do this with a startup screen. Seems to me that Startup Screen files need to be resources with a PICT resource with the image you want to display. The T&C need to be something specific too, but I can't recall what. Then you name the file StartupScreen and put it in the system folder, and it replaces the standard boot screen with your image.

The original Mini vMac came with a 6.0.8 image that had one of these loaded, if someone wants to hunt that down :)

IIRC, somewhere in early System 7, this startup screen method was deprecated and you could just place a regular PICT image somewhere in the System folder with a specific name, and it would be used and displayed right after the original Welcome screen (before extensions start to load).

However, it's also possible to replace the welcome image in ROM and/or the boot image in the System folder (that loads just before the extensions). There was also an extension created that hid all the loading extension images; I never checked what it was doing to accomplish this and can't remember its name (it's been around 30 years since I've used it).


Yeah, I spent so much time a year or so back inserting black data everywhere. PICT resources, the startup screen. I blackened the ROM icon in a hex editor, but I think I couldn't manage to find the background pattern. I lost my original installs, but the solution was a little finicky anyway. There are so many places where it needs to be changed. There would always be some thing getting displayed somewhere after running the sheepvm 50 times. What needs to happen is for the emulation window to be hidden until just before the application launches, and go to background just after. The launch screen replaced by a loading screen with a rotating wheel. I may end up just using the black screen technique for now, but I think this is probably the biggest priority for making a really seamless wrapper.

Quote:
There was also an extension created that hid all the loading extension images


Oh, that's a good starting point. I didn't know about this. I manually blacked out the icons for every extension, lol.
Do you happen to remember the name of this extension-hiding-extension and where to find it?


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Mon Jan 27, 2020 7:51 pm 
Offline
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 2792
Location: Emaculation.com
classicmacreborn wrote:
Oh, that's a good starting point. I didn't know about this. I manually blacked out the icons for every extension, lol.
Do you happen to remember the name of this extension-hiding-extension and where to find it?


Quote:
I never checked what it was doing to accomplish this and can't remember its name (it's been around 30 years since I've used it).


Sorry... but was probably either on the Info-Mac archive or the UMich archive back in the day. The fact that it could be done indicates that there's an image loading toolbox call that can be re-routed to null most likely.

Back in the 90s I wanted to replace the gray background with a black one, and it took me forever to figure out where it was drawn -- turns out it's actually in the ROM programmatically; it just alternates pixels drawing them black and white. Then it loads the happy mac image over top of this backdrop.

However, someone has already made all this a lot easier; someone wrote a tool to replace these with custom graphics. I think it was for the ROMulator or Gemulator projects, although it could be for one of the other software ROM replacement solutions. I know I stumbled across it recently. But that's for System 7, not for Mac OS 9. For Mac OS 9, I'd recommend checking with the guys on Mac OS 9 Lives! as they recently did a deep dive to hack the most recent ROM to boot on more recent hardware. They may know where the loading hooks are that you could NOP out, and where the background loader currently resides. Then you could end up with a custom ROM that behaves the way you want -- who knows? Maybe it's possible to even load the System resources directly into the custom ROM image and keep it all in one place, as you don't really need all the extra functionality for a single app loader.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Mon Jan 27, 2020 9:14 pm 
Offline
Inquisitive Elf
User avatar

Joined: Tue Jan 24, 2017 6:58 am
Posts: 38
Ah! Missed that, sorry.

Yeah when I was writing WrapperFinder, I was posting on the Mac OS 9 Lives forum. I think I got stumped/distracted when we were trying to build it with the BuildCubeE toolchain.

Actually, the vanilla ROM is fine. The only OS9 modification needed is to send/receive messages from host/client. I've done it before with the shared folder and a few OSX and OS9 AppleScripts fairly easily. But there is latency which is non-ideal. A better solution would be to implement messaging over AppleTalk. I haven't gone very deep into the SS source code, but there should be a way to modify SheepShaver to have custom menus and hide the display window on OSX to the background. The process would be as such:

1) Sheepvm Launched
2) Host OS splash screen is displayed with "Loading..."
3) After boot, OS9 signals over AppleTalk to SheepShaver that boot is completed and OS9 application is being launched.
4) SheepShaver displays OS9 emulation to user in full screen.
5) User quits OS9 application.
6) SheepShaver is terminated.

I think it would be significantly easier to modify SheepShaver than OS9 in almost any situation. The background will have to be set to black for the few seconds after you exit the application until shutdown is completed. But other than that, I think obfuscating the boot process and shutdown process should be done on the host OS in SheepShaver. It would be flawless.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Mon Jan 27, 2020 11:03 pm 
Offline
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 2792
Location: Emaculation.com
Instead of signalling over AppleTalk, it would probably make more sense to add a hook in the SS code to capture specific Apple Events, and then make your Finder replacement push those events to the OS. You can't get much faster on Mac OS than using Apple Events without going directly to toolbox calls / hardware calls.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Tue Jan 28, 2020 12:32 am 
Offline
Inquisitive Elf
User avatar

Joined: Tue Jan 24, 2017 6:58 am
Posts: 38
Well the MPW Shell is actually a front end for direct toolbox calls. MPW Shell/ToolServer is only a temporary solution. For some reason, Apple created this really nice scripting language (MPW Shell) and didn't provide a way to compile it into executable applications. I'm guessing that the C++ direct toolbox calling code I was writing on GitHub will be a better solution in terms of latency, but it's better to try the easiest thing first as to avoid making it harder than it needs to be.

I might actually be able to rework the guest-to-host signaling code that I've already written to be lower latency. I think I was trying to build a larger toolchain than I actually needed. I have some code that writes a timestamp'd code to a hidden file in SheepShaver's shared directory. Then there is a host OS AppleScript checking the file, listening for an update to its contents. Once I clean this up, I'll look into having the OSX AppleScript code display an eye candy loading animation.


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


Who is online

Users browsing this forum: No registered users and 12 guests


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