source: trunk/dports/emulators/minivmac-devel/files/configure.applescript.in @ 58974

Last change on this file since 58974 was 58974, checked in by ryandesign@…, 11 years ago

minivmac, minivmac-devel: Bootstrap using a Mini vMac built with the +bootstrap variant instead of the official universal binary. Ours is built with sound turned off, which is less annoying, and fixes some timing issues, because on laptops the sound hardware turns itself off when inactive, and turning it back on takes time. Ours is also built to run at full speed and in the background, fixing more timing issues and letting us remove the configure script bits which handled setting the speed. And since it's packaged as a zip, it can now be automatically extracted along with the other zip files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.2 KB
Line 
1-- $Id: configure.applescript.in 58974 2009-10-08 00:28:43Z ryandesign@macports.org $
2
3global configuration_delay
4
5on run argv
6        set save_delims to text item delimiters of AppleScript
7        set text item delimiters of AppleScript to " "
8        set configure_args to argv as string
9        set text item delimiters of AppleScript to ";"
10        set number_of_variations to count of every text item of configure_args
11        set text item delimiters of AppleScript to save_delims
12       
13        -- Base the delay for the configuration run on the processor speed.
14        -- The multiplier was chosen based on observations of a 2.2-GHz
15        -- MacBook Pro and a 466-MHz Power Mac G4.
16        set cpu_mhz to (system attribute "pclk") / 1000000
17        set configuration_delay to 1400 * number_of_variations / cpu_mhz
18       
19        delay 4 -- wait 1 second for each disk image Mini vMac needs to mount
20       
21        my key_code(22) -- "6" -- select the 6-ClipIn program
22        set the clipboard to configure_args -- copy the configure args to the clipboard
23        my menu_file_open() -- open ClipIn, transferring the clipboard into the emulated machine; ClipIn auto-quits
24        my menu_file_close() -- close Finder window
25       
26        my key_code(11) -- "B" -- select the Build program
27        my menu_file_open() -- open it
28        my menu_edit_paste() -- paste the clipboard contents into the window
29        my menu_file_go() -- do the build
30        my menu_file_quit() -- quit
31        my menu_file_close() -- close Finder window
32       
33        my key_code(32) -- "U" -- select the untitled output disk
34        my menu_file_put_away() -- eject the output disk
35       
36        activate application "@BOOTSTRAP_APP@"
37        tell application "System Events"
38                tell process "Mini vMac"
39                        key down control -- open Mini vMac control menu
40                        my key_code(12) -- "Q" -- quit
41                        my key_code(16) -- "Y" -- yes, really quit
42                        key up control -- close Mini vMac control menu
43                end tell
44        end tell
45       
46        return "Variations: " & number_of_variations & ". CPU speed: " & (round cpu_mhz rounding up) & " MHz. Configuration delay: " & ((round configuration_delay * 100 rounding up) / 100) & " seconds."
47end run
48
49on key_code(key_code)
50        my key_code_with_modifiers(key_code, {})
51end key_code
52
53-- Key codes are used instead of keystrokes because keystrokes would be
54-- translated through the currently-selected Mac OS X keyboard layout
55-- but the system software being used on the emulated machine is using
56-- the US English keyboard layout.
57on key_code_with_modifiers(key_code, key_modifiers)
58        activate application "@BOOTSTRAP_APP@"
59        tell application "System Events"
60                tell process "Mini vMac"
61                        delay 0.3
62                        key code key_code using key_modifiers
63                end tell
64        end tell
65end key_code_with_modifiers
66
67on menu_file_open()
68        my key_code_with_modifiers(31, {command down}) -- "Command-O"
69        delay 0.5 -- wait for zoomrects to draw
70end menu_file_open
71
72on menu_file_close()
73        my key_code_with_modifiers(13, {command down}) -- "Command-W"
74        delay 0.5 -- wait for zoomrects to draw
75end menu_file_close
76
77on menu_file_put_away()
78        my key_code_with_modifiers(16, {command down}) -- "Command-Y"
79        delay 0.5 -- wait for zoomrects to draw
80end menu_file_put_away
81
82on menu_file_go()
83        my key_code_with_modifiers(5, {command down}) -- "Command-G"
84        delay configuration_delay -- wait for configuration to run
85end menu_file_go
86
87on menu_file_quit()
88        my key_code_with_modifiers(12, {command down}) -- "Command-Q"
89end menu_file_quit
90
91on menu_edit_paste()
92        my key_code_with_modifiers(9, {command down}) -- "Command-V"
93end menu_edit_paste
Note: See TracBrowser for help on using the repository browser.