It’s been a busy later half of the year, but there are some minor interesting updates to share from this time. This is a short update, especially as we didn’t have time to update binaries right now, but will do that later in the spring.
Testing “better” shell relaunch with RealExitToShell
In the past, doing ExitToShell has just done plain “exit(0)”, causing the emulation to terminate immediately, reflecting the nature of application bundles being handled as private processes within the host system. However, for the next step of development, to make it a more general purpose application runtime environment, having a proper shell application and mechanism for returning from applications to it is required.
As indicated by the name of the trap ExitToShell, it should in this case return control to the shell application by launching it, instead of just doing dummy exit. The tricky part, however, has been the nature of having layer of C-based toolbox intertwined with 68k code, which causes call stacks to mix between 68k and native code. Luckily with System 6-type emulation there’s a very handy, albeit rather “hacky” solution – that is, using setjmp/longjmp for setting up and tearing down the native stack frames.
For experimenting this feature, we added setjmp call just before initial shell launch, and when RealExitToShell configuration flag is active, instead of doing “exit(0)” we do longjmp to rewind native stack to state where it was before shell launch, and continue from there. All the emulated 68k environment is already set up from scratch at that point, so we didn’t have to do much modifications, and the hack seems to work pretty good for this purpose
We did have to fix a couple parts that were not compatible with shell relaunch, most notably clearing application palettes in color mode, and fixing a bug with resource file cleanup when closing old resource maps.
With this current limited hack, we were able to run Apple’s Finder from System 6 under MACE with quite good success. Below is video of how it turned out:
Important note regarding this is that next we have to implement proper disabling/enabling of toolbox traps based on feature levels, as System 6’s Finder has a mysterious quirk that if it detects OSDispatch is implemented, it attempts to do MultiFinder stuff, even though the Finder itself is single-tasking version. For this experiment, we had to manually disable it in the trap table, but there are also other applications which require certain traps to be marked as unimplemented to work properly (most importantly, MS Excel attempts to do System 7 specific stuff if it detects OSDispatch trap, no matter what the reported Gestalt/SysEnvirons System version is. Another case is also Welltris, which does check presence a bunch of Color QuickDraw traps, and attempts to use color-only traps even in classic mode if those are defined). This is something we want to get done for the summer update, to make the generic runtime environment closer to reality.
Another note is that at some point we need to create our own Finder replacement, as even though System 6’s Finder runs quite nicely, we do need to create an alternative shell that would be legally distributable with the generic runtime. Same also goes to certain Desk Accessories, such as Control Panels, which is also Apple’s implementation, and needs to be replaced with original version with close enough functionality.
Also another important note is that this hack only applies to System 6-style single-tasking emulation – for proper System 7-style cooperative multitasking support we need to implement not just the shell launching, but also task switching, with quite different mechanics. We have an idea for this, but it needs kind of major overhaul in the threading system (which we use currently to allow VBL and timer tasks to “interrupt” the active application properly). More on that later!
Other interesting minor updates
File renaming support
As part of experimentation with Finder, we saw need to implement finally renaming of files & folders. The tricky part here was that we need to keep the native file system file paths & names in sync, but using POSIX rename and careful traversal of directory subhierarchy, at least Finder seems to be able to quite well rename the files & folders without major issues. There is known issue that any open FCBs in renamed paths are not updated, but as in System 6-style single-tasking mode it is rare case to rename open files/folders, we’ll fix it later this year.
Text truncation
We also implemented finally truncEnd (and truncMiddle) for TruncText/TruncString, which makes especially file dialogs look much nicer with long, non-fitting filenames getting ellipsis symbol indicating truncated text. This was also visible in the Marathon’s map preview in the load game file selection dialogs.
Proper time formatting using internationalization resources
One quite important feature was also date & time to string conversion routines, which use the itl0 and itl1 resources to also localize the converted dates, and allows also user to configure their own date & time formatting. This is visible in a number of places, including Dalek’s highscore lists, Pipe dream highscore list, ResEdit file “Get Info” dialog, Finder list-style folder views, etc.
Finally fixed the FramePoly glitch
One long-standing (and embarassingly rather simple to fix) issue was the glitches in FramePoly trap. As most of polygon drawing is delegated to region rendering, we accidentally also passed FramePoly to FrameRgn, which in hindsight makes no sense, as FramePoly should logically just draw lines to connect the polygon points. The problem was, that as polygon was converted by FramePoly to region before doing FrameRgn on it, the bounds of the polygon would be off by one pixel, causing quite visible glitches in The Fool’s Errand. Now with this fix, that game also works quite perfectly.
ScreenRow low-mem global buggy behaviour
One really puzzling issue was behaviour of the ScreenRow low memory global…we originally assumed it would be expected to contain rowbytes value of currently active screen resolution & color depth, but what it was actually was supposed to contain was rowbytes of not the active color depth, but imaginary 1-bit screen of the current resolution…so instead of having rowbytes value of 640 in 256-color mode of 640×480 resolution, it was expected to have 80. This issue surfaced when trying to run Titan in color mode, as it depended weirdly on this specific behaviour. It should be noted, that during our testing, we noticed that at least in System 7.1/7.5 also Apple’s own implementation seems to indecisive about this, as Apple’s system starts with this 1-bit rowbytes value, but changing the color depth replaces this low memory value with current depth’s rowbytes…which seems to be quite erratic!
Generic INIT loading mechanism
It’s not yet perfect, but the environment bootstrapping will now iterate system extensions, extensions and control panels to try to load any INIT resources from them. This should allow loading extensions and control panels at boot time by just placing them into the System Folder, instead of the hard-coded the INIT loading that was there previously. This should help and speed up testing various extensions and control panels quite nicely. The ‘sysz’ resource handling seems to work okay’ish, but is not perfect yet (that is, the mechanism that allows INITs to expand system zone at startup time to reserve enough space for their possible needs, without risking of running out of system zone space later when running the emulation).
There’s also a number of other fixes, most being too small to go into great detail, such as:
- Implemented csCode 23 for native FS driver, which fixes Finder not displaying sensible drive type for emulated file system
- sfIsFolder & sfIsVolume was not set up properly, causing ResEdit to try to open folders as files (*sigh*)
- Modify EnvGetNextEventDelayHack to allow specifying delay value with the configuration value
- Added default label colors to System file
- Clean up a lot the messy project structure, most importantly by moving toolbox emulation code from getting compiled for each test target to a single library being linked to them. This speeds up the compilation roughly 100x times 😀 (one important step in getting the spaghetti code closer to presentable shape, in hope of opening the source someday in future)
Hopefully by summer we’ll have more news for you.
Full list of changes since last post
2025-12-24 22:59:54 +0200 • Add TCP control call codes to MacTCP driver header
2025-12-24 22:58:06 +0200 • Add Welltris test app config
2025-11-08 22:41:08 +0200 • Fix resource file cleanup referencing freed memory
2025-11-08 18:40:44 +0200 • Also throttle OSEvents w/ EnvGetNextEventDelayHack
2025-11-08 00:44:10 +0200 • Set correctly sfIsFolder & sfIsVolume in StdFile
2025-11-08 00:01:34 +0200 • Use label colors for icons in StdFile dialog lists
2025-11-08 00:00:55 +0200 • Add label colors to System file
2025-11-07 23:04:32 +0200 • Implement PBRename/HRename for NativeFS & ADF
2025-11-07 03:07:14 +0200 • Fix dirBkDat byte-swap size bug in Get/SetCatInfo
2025-11-05 23:05:17 +0200 • Write adfRealName to ADF Header, fix root name bug
2025-11-05 23:02:47 +0200 • Throttle Railroad Tycoon to make it more playable
2025-10-30 02:02:27 +0200 • Add EnvRealExitToShell to test with setjmp/longjmp
2025-10-30 01:58:43 +0200 • More old test code cleanup (from startup routines)
2025-10-30 00:43:26 +0200 • Add dummy ShutDwnPower and ShutDwnStart (for exit)
2025-10-29 00:25:52 +0200 • Clean up extra mess from repository
2025-10-28 01:21:59 +0200 • Make ScreenRow low mem global more compatible
2025-10-27 12:05:41 +0200 • Configs for Titan Color, Warlords, Warlords Demo
2025-10-26 23:31:25 +0200 • Config for Titan, Carmen, Mouse Stampede & MacBugs
2025-10-26 06:55:24 +0200 • Add Sargon 3 and Wizard's Fire test app configs
2025-10-26 06:54:50 +0200 • Make reset opcode exit emulator properly in PT-109
2025-10-26 06:54:16 +0200 • Remove old RunEmulation test code from 6 years ago
2025-10-25 19:16:36 +0300 • Cleanup mess - refactor MaceEmuSDL to SDLPlatform
2025-10-25 13:35:02 +0300 • Make GetNextEventDelayHack delay adjustable
2025-10-13 01:30:55 +0300 • Implement truncMiddle TruncText/TruncString case
2025-10-11 23:42:01 +0300 • Implement NativeFS csCode 23 (drive info)
2025-10-11 23:41:37 +0300 • Tweak MIDI driver port names
2025-10-10 23:50:24 +0300 • Update Geneva font to System 6 compatible version
2025-09-29 10:48:29 +0300 • Fix 'qdrw' gestalt response for classic mode
2025-09-29 01:54:41 +0300 • Use TruncString for long menu names in MDEF ID=0
2025-09-29 01:53:47 +0300 • Implement truncEnd case of TruncText & TruncString
2025-09-08 00:45:36 +0300 • Fix bug in reading abbrevation tables from 'itl1's
2025-09-08 00:11:42 +0300 • Fix typo
2025-09-08 00:09:50 +0300 • Proper IUTimeString/IUtimePString implementation
2025-09-08 00:09:02 +0300 • Fix longDate/abbrevDate mixup
2025-09-07 00:08:07 +0300 • Also implement long form (ext&abbrev) IUDateString
2025-09-06 14:04:28 +0300 • Implement short form IUDateString
2025-09-03 11:29:23 +0300 • Implement SndChannelStatus (no disk playback yet)
2025-08-26 23:28:31 +0300 • Make CDResolveCodeResource errors more verbose
2025-08-26 23:27:39 +0300 • NotificationManager globals init (for Afterk Dark)
2025-08-26 23:25:10 +0300 • Byteswap ADF fileinfo flags properly
2025-08-26 23:24:28 +0300 • Icons for Carmen, MacBugs, Mouse Stampede & Titan
2025-08-15 01:47:30 +0300 • Fix the FramePoly glitching
2025-08-10 20:41:30 +0300 • Fix fullscreen glitches (added SDL_RenderClear)
2025-07-30 13:10:12 +0300 • Hack to SDL code to prevent mouse warping bug
2025-07-25 14:29:37 +0300 • Fix settings failure w/ USESIGNING off in CMake
2025-07-25 14:28:18 +0300 • Add more DAs for testing
2025-07-25 14:11:48 +0300 • Handle error if loading settings file fails
2025-07-21 15:49:01 +0300 • Implement ArithAddMin rect blitter (for AfterDark)
2025-07-21 02:02:47 +0300 • Fix typo in AngleFromSlope fix
2025-07-20 23:37:55 +0300 • Start separating toolbox emulation to a sublibrary
2025-07-20 20:58:26 +0300 • Fix another 32-bit block tag ptr bug in MMPurge32
2025-07-20 14:19:50 +0300 • Fix MMMakeSpaceForPtr32 bug using wrong tag byte
2025-07-20 14:08:34 +0300 • Fix low AngleFromSlope slope breaking on release
2025-07-20 03:19:58 +0300 • Fixes to INIT file iteration
2025-07-20 03:18:39 +0300 • Add dummy PtInIconID selector for IconUtils
2025-07-20 02:08:10 +0300 • Support for kD0DispatchedPascalStackBased patches
2025-07-19 16:48:14 +0300 • Proto of generic (ie not hard-coded) INIT loading














































































































You must be logged in to post a comment.