It’s been quite a while since last update, which is due to combination of us being busy real-life jobs, and focusing work on this project on a monolithic feature, which in this case is nothing less than getting the Standard File Package to work!
Features
This is list of the features which the M.A.C.E. Standard File Package emulation is currently capable of:
- All 8 selectors for Pack3 (SFPutFile, SFGetFile, SFPPutFile, SFPGetFile, StandardPutFile, StandardGetFile, CustomPutFile, & CustomGetFile). The ones tested are highlighted, but others should work too.
- Support for custom file dialogs (with assorted hacks to convert MFS-style dialogs, such as the “Save” dialog in MS-BASIC 2.00, to the new HFS-style format)
- Supports both SFReply and StandardFileReply outputs
- File listing using List Manager, which displays currently System 6-style SICNs, but with System 7.1+ style spacing (later expandable to use the real icons, when we get Desktop Manager interface)
- Path popup menu, visually and functionally like on real System 7.x
- Desktop folder support
- Focus on selected items (including file list with highlight frame), alterable by mouse or tab key
- Most of common SF key shortcuts: Clipboard shortcuts, Cmd+S (Save), Cmd+O (Open), Cmd+N (New folder), Cmd+D (Go to desktop), Cmd+Up (Go to parent), Cmd+Shift+Up (Go to root/desktop), Cmd+Down (Open folder), (Cmd+Left/Right to browse volumes not yet implemented)
- Filename field input filtering (prevents “:” from being used in filenames, which is path separator). Also, copy-pasted filenames will be filtered with proper alert messages.
- Most of SF items/hooks implemented:
- Items: sfItemOpenButton, sfItemCancelButton, sfItemVolumeUser, sfItemEjectButton, sfItemDesktopButton, sfItemFileListUser, sfItemPopUpMenuUser, sfItemDividerLinePict, sfItemFileNameTextEdit, sfItemPromptStaticText, sfItemNewFolderUser,
- Hooks: sfHookFirstCall, sfHookCharOffset, sfHookNullEvent, sfHookRebuildList, sfHookFolderPopUp, sfHookOpenFolder, sfHookLastCall, sfHookGoToDesktop
- Not yet implemented: sfHookOpenAlias, sfHookGoToAliasTarget, sfHookGoToNextDrive, sfHookGoToPrevDrive, sfHookChangeSelection, sfHookSetActiveOffset
- File type filtering supported, both by typeList and FileFilterProc

Known issues
Although most of the Standard File Package is functional, and usable, there are still some issues left:
- Because DirCreate is not yet implemented in NativeFS layer, FindFolder cannot create the Desktop Folder/Trash folders to the file system, thus at least Desktop Folder needs to exist to allow access to “Desktop” level in the SF dialogs. This also prevents “New folder” from actually creating the folders.
- Eject button does not yet do anything, as the NativeFS volumes are non-ejectable
- There are minor differences to real System 7.x style SF dialogs, for example with certain elements being a few pixels off their intended locations, and popup menu’s width not always expanding
- Some custom dialogs don’t yet work exactly as they should, for example THINK Pascal 4.0 “Add files” dialog erases left edge of the applications own custom list located below the SF file list, and for some reason it allows attempts to add folders as source files…
- Location of the SF dialog is sometimes not correct (for example, Railroad Tycoon’s “Save game” dialog is partially under the menu bar)
- We cannot yet create app bundles for the currently working freeware/shareware applications that use StandardFile, because when sandboxed the bundle file system is read-only, and thus attempting to save anything to it would straight out fail. To work around this, we need to implement certain changes to the way file system in bundled applications is handled, but we are already working on that for the next release
Other improvements made for Standard File
There were a couple features that were implemented as part of Standard File Package implementation, some of which were necessary to make it work
NativeFS AVL tree balancing and iteration support
One important feature was the need for catalog iteration, which is used by Standard File dialogs to enumerate the files in current folder to be displayed in the file list. This allows for example GetCatInfo to use ioFDirIndex in the parameter block to index specific files inside given directory.
Also, this gave a good excuse to finally implement the actual AVL balancing algorithm in the NativeFS file system, which until now had behaved mostly as a dummy binary tree. Below is a screenshot of how the file system structure was changed by the balancing algorithm:

On the right-hand side, is the unbalanced “dummy” binary tree, and on left-hand side is the same file system, when using AVL balancing algorithm to do the insertions. The deepest nodes were reduced from, in this case, from way over 100+ key comparisons into a rough maximum of 10+.
Popup Menu Control
One important feature of the HFS-style Standard File dialogs is the navigation aid provided by the path popup menu. For this, the Popup Menu Control CDEF 63 was implemented. On real Macs, this was originally part of Communications Toolbox, before it was merged to the System 7.x at some point. The Standard File dialogs use only a subset of its features, but foundation for most use cases was built at the same time, so taking it into more common use should be quite easy. As it uses the Menu Manager’s PopUpMenuSelect trap call, the actual menu selection was already there.
One fun and tricky part though was the need to add MDEF “wrapper” for SF popup path menu, to ensure that the opened popup menu would never be narrower than width of the popup control. To do this, the control imitates how the real Macs did this by adding temporarily a MDEF “wrapper”, which injects modified menuWidth value to the menu after it receives a mSizeMsg message from the Menu Manager, thus modifying the resulting popup menu size.
Picture Button Control
The CDEF 61, picture button, was implemented just to allow adding the “New folder” button to the “put” dialogs. It is quite simple, at least in monochrome version, just drawing a PICT resource as content of a regular push button
Dialog Manager improvements
The StdFilter, which is also used by Standard File dialogs, was improved to add features used by it:
- Outlining default button with FrameRoundRect
- Handle “cancel” item’s shortcut key as escape/cmd+dot
- Track cursor to turn it into i-beam over enabled textedit fields
- Handle update events for default items
Also, the default shortcut keys (Cmd+X/C/V for Cut/Copy/Paste) were also implemented in DialogSelect trap.
Other news: 68020/68040 support
In other news, Pukka has also been busy adding 68020/68040 support, which includes:
- Bitfield instructions (bfins, bfset, bftst, bfchg, bfclr, bfextu, bfffo)
- cas2.b/w/l instruction
- divs.l/divu.l 32-bit division instructions
- move16 instruction for 68040
- Disassembler support for the new and improved instructions
- Various other improvements
Full list of changes since last post
2019-10-21 02:25:22 +0300 • GetResource falls back to TopMap if CurMap invalid 2019-10-20 23:00:18 +0300 • Fix byteswap bug in LDEF -4000 (item font & size) 2019-10-19 21:44:23 +0300 • Update ArmorAlley JSON config, it now almost works 2019-10-19 02:18:39 +0300 • Fix _Allocate, use ioFRefNum/FCB to get the vcbPtr 2019-10-19 02:06:57 +0300 • Make MemoryManager allocation alignment adjustable 2019-10-19 01:54:24 +0300 • Fix AddResource bug, ResErr not cleared on success 2019-10-19 01:44:31 +0300 • Implemented RmveResource 2019-10-18 17:44:45 +0300 • Set ioFDirIndex for GetCatInfo in SF popup refresh 2019-10-18 17:21:28 +0300 • Desktop folder support improved in SFUpdateReply 2019-10-18 17:08:07 +0300 • Show files in Desktop Folders on desktop 2019-10-18 16:25:39 +0300 • Update StdFile Eject button enable/disable state 2019-10-18 03:39:11 +0300 • Close app resource file on exit from emulator 2019-10-18 03:07:05 +0300 • Draw CDEF 63 popup triangle & hack to resize menu 2019-10-17 00:07:14 +0300 • Fix StdFile dirID byteswap bug for popup menu item 2019-10-17 00:05:13 +0300 • Rough proto of autoTrack to CDEF 63 popup tracking 2019-10-16 23:28:35 +0300 • Add sfHookFolderPopUp trigger & handler to StdFile 2019-10-16 23:27:14 +0300 • Implement testCntl in CDEF 63 (& refactor headers) 2019-10-16 22:47:54 +0300 • Merge branch 'master' of 2019-10-16 22:47:13 +0300 • Fix popup menu creation (fix title & set icon cmd) 2019-10-16 22:45:09 +0300 • Work on CDEF 63 (draw menu in the control) 2019-10-16 22:44:10 +0300 • Implement mDrawItemMsg in MDEF 0 2019-10-16 22:40:13 +0300 • fix initializing 68040 processor type and linkin.. 2019-10-16 04:50:31 +0300 • Implement mCalcItemMsg in MDEF 0 2019-10-16 03:59:46 +0300 • Implement calculation of popup bounds in CDEF 63 2019-10-16 03:58:56 +0300 • Make Mac_GetMenu visible in public headers 2019-10-16 03:58:31 +0300 • Fix bugs in StdFile path popup folder iteration 2019-10-15 02:25:13 +0300 • Work on CDEF 63 init, dispose and calc messages 2019-10-14 21:40:29 +0300 • disassembler fixes and support for bit field ins.. 2019-10-14 02:50:31 +0300 • Work on CDEF 63: Init StdFile dir popup contents 2019-10-13 07:21:56 +0300 • Fix filename in GetFileInfo for ioFDirIndex > 0 2019-10-12 23:57:53 +0300 • Fix old-style StdFile filelist bounds byteswap bug 2019-10-12 23:56:36 +0300 • Fix ioFDirIndex>0 case for GetFileInfo in NativeFS 2019-10-12 04:29:25 +0300 • "New folder" dialog added, and many fixes & tweaks 2019-10-12 02:09:45 +0300 • Cmd+Down in SF & fix list arrow when no selection 2019-10-11 22:40:18 +0300 • Handle Cmd+S, Cmd+O, cmd+D and cmd+N in StdFile 2019-10-11 22:21:15 +0300 • Fix crash in CDEF 61 dispCntl message handler 2019-10-11 05:12:59 +0300 • Enable "new folder" button in StdFile put dialogs 2019-10-11 05:11:37 +0300 • Implemented CDEF 61 ('PICT' button control for SF) 2019-10-11 02:44:50 +0300 • Don't try to go to the parent of Desktop 2019-10-11 02:39:49 +0300 • Open parent with cmd+up, desktop with cmd+shift+up 2019-10-11 01:49:34 +0300 • Implement cut/copy/paste handling in DialogSelect 2019-10-11 00:08:41 +0300 • Fix inverted zonecheck result in handle validation 2019-10-11 00:06:45 +0300 • Finish IsCmdChar implementation (& fix signature) 2019-10-11 00:05:16 +0300 • Fix KCHR load from ROM (RomMapInsert & TmpResLoad) 2019-10-10 22:27:30 +0300 • Cache KCHR 0 in script manager expand mem globals 2019-10-10 10:32:50 +0300 • Handle escape key in StdFilter 2019-10-10 10:32:26 +0300 • Add dummy IsCmdChar to ScriptUtil dispatcher 2019-10-10 02:43:08 +0300 • Handle iBeam cursor in StdFilter null/updateEvents 2019-10-10 02:25:40 +0300 • Frame default button in StdFilter (also disabled) 2019-10-10 01:53:25 +0300 • Handle desktop folder and related buttons 2019-10-09 22:58:06 +0300 • Use new defines for FindFolder folders in StdFile 2019-10-09 22:57:33 +0300 • Call DirCreate in FindFolder when createFolder set 2019-10-09 22:56:44 +0300 • Add dummy DirCreate placeholder to FSDispatch 2019-10-09 22:55:41 +0300 • Merge branch 'master' of 2019-10-09 22:55:37 +0300 • Fix font strike size to inRec size scale ratio 2019-10-09 22:20:59 +0300 • disassembler support for move16 2019-10-09 21:54:33 +0300 • remove unused sr_bits field from instruction data 2019-10-09 21:33:53 +0300 • finish implementing move16 instruction 2019-10-09 21:26:06 +0300 • update xcode 6 project 2019-10-09 17:23:48 +0300 • Fix FindFolder memory corrupt (ioNamePtr not set) 2019-10-09 11:16:53 +0300 • Fix byteswap bug in fld# type comparison 2019-10-09 11:15:00 +0300 • Fix fld# search to work on non-system folder lists 2019-10-09 03:46:40 +0300 • Add linecount script 2019-10-09 03:46:28 +0300 • Add empty desktop/trash folders to THINK Pascal 2019-10-09 03:32:46 +0300 • AliasManager added, to implement FindFolder for SF 2019-10-09 02:42:02 +0300 • Implemented HOpenResFile 2019-10-08 00:43:44 +0300 • Implement sfHookCharOffset and sHookRebuildList 2019-10-07 21:56:21 +0300 • Found hidden ListManager selector, used by StdFile 2019-10-07 21:55:09 +0300 • Add PageUp/Down and Home/End keys to SDL keymapper 2019-10-07 04:57:10 +0300 • Use inThumb also to draw control on SetCtlMin/Max 2019-10-07 04:55:48 +0300 • Fix wrong zero-case part code bug in HiliteControl 2019-10-07 03:16:46 +0300 • Fix ignore dot & '%'-prefix items in InsertResMenu 2019-10-07 02:19:28 +0300 • Fix memory leak in DrawPicture 2019-10-07 02:18:10 +0300 • Fix conversion of uncompressed pixmap data to b&w 2019-10-06 23:37:38 +0300 • fix divs.l, start implementing move16 instruction 2019-10-06 00:00:12 +0300 • allocate move16 instruction 2019-10-05 23:07:36 +0300 • fixes for divs.l/divu.l instruction 2019-10-05 22:00:21 +0300 • Merge branch 'master' of 2019-10-05 21:59:44 +0300 • implement chk2.b/w/l instructions 2019-10-05 21:57:57 +0300 • Merge branch 'master' of 2019-10-05 21:57:22 +0300 • Fix resource name remove bug 2019-10-05 21:27:28 +0300 • implement cas2.w and cas2.l instructions 2019-10-05 20:34:46 +0300 • finish cas.b/w/l instruction implementation 2019-10-05 04:50:14 +0300 • Fix bug in FindWindow (theWindow not initialized) 2019-10-05 04:10:11 +0300 • Merge branch 'master' of 2019-10-05 00:11:35 +0300 • make bsr instruction branchless 2019-10-04 23:43:40 +0300 • THINK Pascal def missing from root CMakeLists.txt 2019-10-04 23:25:35 +0300 • register variants for bfins, bfset and bftst 2019-10-04 23:05:14 +0300 • remove unused c16 param from bfxxx_read/write 2019-10-04 22:42:22 +0300 • use read_pc_immediate for bit field extension 2019-10-04 22:30:25 +0300 • fixes for bit field instructions 2019-10-04 01:06:20 +0300 • Add THINK Pascal 4.0 test app JSON config to CMake 2019-10-04 01:06:00 +0300 • Implemented MaxSizeRsrc 2019-10-03 22:25:37 +0300 • Reinforce fake handle handling in memory manager 2019-10-03 22:21:15 +0300 • bfchg, bfclr, bfext, bfextu and bfffo instructio.. 2019-10-03 22:09:06 +0300 • Revert "bfchg, bfclr, bfext, bfextu and bfffo in.. 2019-10-03 22:08:15 +0300 • bfchg, bfclr, bfext, bfextu and bfffo instructio.. 2019-10-03 04:04:45 +0300 • Escape MacRoman filenames & avoid UTF8 conversions 2019-10-03 00:27:19 +0300 • SF key filtering (max length, skip ':' & CR, etc.) 2019-10-03 00:26:24 +0300 • Support "autoKey" in keyboard and platform modules 2019-10-02 02:55:34 +0300 • Handle tab key in SFDialogFilter 2019-10-02 02:14:00 +0300 • Tweak list ListManagerClickTrackProc visible size 2019-10-02 02:00:26 +0300 • Fix missing sfHookLastCall set on SF dialog close 2019-10-02 01:58:50 +0300 • Escape characters in NFS (and fix full-path bug) 2019-10-02 00:08:29 +0300 • Adjust Art Class JSON to use 68020 machine config 2019-10-02 00:07:57 +0300 • Update SF reply records during event loop 2019-10-02 00:07:24 +0300 • Handle invalid names and replace in "save" dialogs 2019-10-02 00:05:56 +0300 • Reduce keyboard debug logging 2019-10-01 22:34:26 +0300 • Fix missing origName in SFPutFile 2019-10-01 22:06:24 +0300 • Merge branch 'master' of 2019-10-01 22:06:17 +0300 • Tweak Gestalt and fix M68kHelper for 68020 support 2019-10-01 21:35:17 +0300 • kemu header cleanup 2019-10-01 21:33:14 +0300 • update xcode6 project 2019-10-01 20:38:00 +0300 • 020 bit field instructions, optimizations, some .. 2019-10-01 17:01:23 +0300 • First successful "open" from Standard File 2019-10-01 15:37:53 +0300 • Missing header update for no-read privilege flag 2019-10-01 15:37:03 +0300 • Add missing part of previous LayerDispatch fix 2019-10-01 15:36:20 +0300 • Handle cancel button & implement closing dialogs 2019-10-01 15:20:57 +0300 • Handle opening of folder in file list 2019-10-01 15:20:00 +0300 • Don't hilite disabled items in file list lDrawMsg 2019-10-01 14:58:06 +0300 • Error dialog support for Standard File 2019-10-01 14:57:19 +0300 • Add some more TODOs to StdFilter proc 2019-10-01 14:56:52 +0300 • Fix bug in AutoPositionWindow lcParentWindow case 2019-10-01 13:42:47 +0300 • Fix redraw bug in file list item selection 2019-10-01 13:40:58 +0300 • Detect when a folder is opened instead of file 2019-10-01 13:39:08 +0300 • Fix accidental file list framing in "Get" dialogs 2019-10-01 03:24:36 +0300 • Update save/open button state (and title) 2019-10-01 01:21:11 +0300 • Add Desktop Folder and Trash to TeachText config 2019-10-01 01:20:45 +0300 • Add empty folder creation support to make.cmake 2019-10-01 01:06:51 +0300 • Go to parent folder by clicking volume name 2019-09-30 02:06:23 +0300 • Handle more events in SF(update, activate & mouse) 2019-09-30 02:02:42 +0300 • Fix byteswap bug in FindDialogItem 2019-09-29 03:39:31 +0300 • SF activation handling: set reply & frame filelist 2019-09-29 03:35:48 +0300 • Fix more maxIndex bugs in LGetSelect and LSearch 2019-09-28 03:54:21 +0300 • Add file type filtering & call custom file filters 2019-09-28 03:53:38 +0300 • Fix bug in Standard File dialog autopositioning 2019-09-28 03:28:31 +0300 • Fix SF special folder detection bytes-wap bug 2019-09-28 03:27:37 +0300 • Fix ioDrDirID for folders in GetCatInfo 2019-09-28 03:08:52 +0300 • Handle list clicking in SF dialog event handler 2019-09-28 03:08:12 +0300 • Fix maxIndex case in LClick selection clearing 2019-09-28 03:07:09 +0300 • Set mouseLoc in ListRec in LClick 2019-09-28 03:05:32 +0300 • Fix ioDirFlg setup in GetCatInfo 2019-09-28 01:59:31 +0300 • Re-enable EraseRect calls in SF dialog item redraw 2019-09-28 01:57:24 +0300 • Fix ioNamePtr handling in GetCatInfo 2019-09-28 01:56:01 +0300 • Draw volume icon & name in Standard File dialogs 2019-09-27 15:40:16 +0300 • Finalize LDEF -4000 drawing for standard file list 2019-09-27 15:38:52 +0300 • Fix file type mapping bugs in standard file pack 2019-09-27 15:37:44 +0300 • Add Scratch20 low memory global 2019-09-27 04:21:58 +0300 • First real filelist shown in Standard File Dialogs 2019-09-26 22:56:17 +0300 • Add balancing algorithm to the AVL tree (+debug) 2019-09-26 22:54:32 +0300 • Add missing header from previous commit 2019-09-26 22:53:19 +0300 • Finish volume/directory setup in SF initialization 2019-09-26 11:30:42 +0300 • Reset to VCBQHdr after last VCB in SF volume scan 2019-09-26 04:06:05 +0300 • Work on volume state initialization in SF package 2019-09-26 04:03:16 +0300 • Tweak FMGetDrive to allow passing nil driverRefNum 2019-09-26 04:02:01 +0300 • Support GetVolInfo calls with drvNum as vRefNum 2019-09-26 04:01:13 +0300 • Add four flag bytes in front of DrvQEl in NativeFS 2019-09-25 04:33:14 +0300 • Set default SF volume&folder to application folder 2019-09-25 04:11:00 +0300 • Add indexing to GetCatInfo + fetch real ioDrNmFls 2019-09-25 04:09:38 +0300 • Add rough iteration support to file system AVLTree 2019-09-22 13:09:58 +0300 • Refresh file list in StdFile dialogs 2019-09-22 05:17:32 +0300 • First StdFile dialogs visible, not yet functional 2019-09-22 05:15:58 +0300 • Support opcodes 0x12, 0x13 and 0x14 in pictures 2019-09-22 04:41:36 +0300 • More progress on StdFilePack 2019-09-22 04:39:36 +0300 • Minor List Manager fixes and tweaks 2019-09-22 04:37:15 +0300 • Placeholder for popup CDEF (63) 2019-09-19 23:06:31 +0300 • Finalize CheckWindow selector for LayerDispatch 2019-09-19 03:25:17 +0300 • More work on Standard File Package 2019-09-19 03:23:39 +0300 • Add two new selectors to LayerDispatch for StdFile 2019-09-18 03:58:15 +0300 • Some work on Standard File Package 2019-09-18 03:54:32 +0300 • Use _RelString in IUMagIDString for now 2019-09-13 01:48:34 +0300 • Mac OS X 10.6.8 compatibility 2019-09-11 21:30:30 +0300 • Enable GetNextEvent CPU throttle for Arkanoid 2019-09-11 18:25:41 +0300 • Add Crystal Quest and Armor Alley test apps 2019-09-09 01:31:04 +0300 • Bump up runtime version for new bundles 2019-09-09 00:58:48 +0300 • Tweak IAGO cmake config 2019-09-07 14:04:32 +0300 • Add two more test app configs, IAGO and EveryMan 1 2019-09-07 14:04:02 +0300 • Add substitution for missing fonts in Font Manager