It’s now approximately one month since last update, and a lot of “under the hood” type progress has been made.
M68K Tester and 68K bug fixes
One major task we had on roadmap was attempting to see how we could integrate Pukka’s emulator core with the amazing M68K Emulator Testsuite (by Gwenolé Beauchesne and Ray Arachelian, archived at this URL: http://web.archive.org/web/20090417202939/http://gwenole.beauchesne.info/en/projects/68ktester ). After holidays, Pukka was able to get the integration done, and we found a bunch of hard-to-find CPU bugs thanks to it:
Even though a lot of bugs were fixed, there are still test cases which do not pass, and will be fixed soon. However, with the fixes already done to the bugs that were found thanks to the test suite, Dark Castle and Beyond Dark Castle appear to be stable in rooms that used to crash before:
Dark Castle “Fireball 1” works now Beyond Dark Castle rooms are working
New relative mouse mode
A long-time task that has been waiting implementation has been the relative mouse mode, in which M.A.C.E. captures mouse cursor entirely, and instead of using the absolute position given by the host operation system, calculates mouse motion itself using the mouse delta vectors. This both prevents stray clicks outside emulated desktop window, and allows long delta swipes such as required to control helicopter in Apache Strike. As a result of this, Apache Strike can now be played, as previously it would immediately crash into the wall – and Pirates! no longer hangs in the swordfight at beginning – both which depended on certain low-level mouse low memory globals being emulated correctly:
Apache Strike controls are working Pirates! swordfight works now
Another fun feature which we added to complement the relative mouse mode as experimenting with game controller input API of SDL, which took about 30 minutes to do and works quite OK as seen on this video:
Another issue that was fixed was missed clicks problem with “Tap to Click” MacBooks, which now should generate mouseDown events correctly.
Currently the cursor itself is still displayed using SDL “hardware” cursor API, but with the recent changes adding support for software cursor should not be a big problem – One that might be required to have decent cursor is certain games, where the cursor visibility depends on the cursor having ability to “invert” depending on underlaying graphics (such as the crosshair on black background in lemmings), which the SDL hardware cursor does not support.
Keyboard text input rewritten with proper character mapping
In first iteration of keyboard handler, we only had scancode support with minimal MacRoman mapping (without modifiers), which although was working for the simple use cases, did not allow flexibility required for example to enter upper-case letters.
For second iteration, we attempted to utilize host operating system keyboard layout mapping by using SDL text input API, and although it worked nicely for TextEdit text input, broke command keys and other things (such as Dark Castle & Lode Runner controls) horribly.
For the latest, third iteration, we went back to scancode based input, but instead are simulating the exactly same type KCHR scancode to MacRoman mapping like on real Macs. This allows every key to work properly in text editing, game input and menu shortcut etc, but one downside is that for international layouts we will need to have separate KCHR resources, currently only having U.S. as default layout. However, as “dead keys” are also working, typing special characters such as accents, umlauts, etc is working nicely even on this layout.
ResEdit bug “treasure chest”
ResEdit proved to be a real “treasure chest” of bugs and improvements, as it used literally every possible List Manager routine, and it also surfaced some unexpected bugs in other places such as TextEdit, Dialog Manager, QuickDraw, and other already heavily used toolbox traps.
After Dialog Manager and QuickDraw fixes, DLOG editor works perfectly MENU editing also works after List Manager bug fixes ‘PACK’ 1 bitmap editor works now TextEdit improvements for the hex editor
Some major improvements found through testing ResEdit:
- Most of List Manager calls were implemented, including resizing lists, deleting rows/columns, searching data. Also some bugs were fixed, such as corruption of data offsets in some cases, etc.
- Dialog manager edit field handling had a number of bugs, which surfaced in the DLOG editor, and there also were bugs in item hiding/showing which were also manifesting in Civilization.
- TextEdit had some bugs in the MixedMode handling of special case calling conventions, which caused crash in the hex editor. After fixing them, not only the hex editor works, but also MacPascal editing bugs were fixed, as it also used custom TEDoText hooks.
- The PACK 1 (“BitEdit”) package in ResEdit surface a couple QuickDraw bugs, such as random SeedFill memory corruption (using the paint bucket tool) and StretchBits memory corruption. These also make MacPaint more stable, which was also suffering from the SeedFill bug.
Some of these fixes had quite universal effects, such as improving the previously buggy behaviour of Lists and TextEdit in HyperCard 1.x:
HyperCard 1.x font lists work now HyperCard 1.x script editor works better
Other improvements
- Text scaling and measuring had some bugs, which were fixed so that MacPaint and Macwrite can display text of all sizes, faces and styles.
- MacWrite now works, at least kind of…all other edition options are working (styling, page breaks, font sizes, fonts, rulers, etc), except adding newline using enter/return causes text to corrupt.
- As the region corruption bug in polygon rendering was fixed, PT-109 appears now the be completely stable.
- With “dummy” SetPalette trap implemented, Railroad Tycoon is now able to proceed past first “End of Fiscal Period” report
- Scrollbar (CDEF 1) implementation (and related Control Manager TrackControl/DragControl stuff) were finally finished, so the indicator thumb dragging works now.
- Prototype of font fractional width support added, only test case for this is curently Photoshop, which enables them. Right now only FOND width tables are supported, but extended width tables could be easily added as soon as some application needs them.
New test applications added
Also, we have now finally two new test app bundles that should be complete enough for trying out. These are ZeroGravity by Duane Blehm, and Blob Manager Demo by Paul DuBois. They are now available for trying out in the Downloads section.
Additionally, the old test application bundles have been updated with the new M.A.C.E. runtime, which includes all the bug fixes and improvements done since their last update. For example, Stunt Copter uses now the new relative mouse mode, and all apps have been updated to support the “Tap to Click” trackpad mode on MacBooks.
Full list of changes since last post
There are too many changes to detail in a single post, so as a new feature below is the version control log of all changes made since last update:
2019-08-19 22:54:49 +0300 • Add SetDialogDefaultItem/CancelItem/TracksCursor 2019-08-19 22:47:32 +0300 • Tweak TrackControl and LClick delay to 8 ticks 2019-08-19 18:15:47 +0300 • Save alert default item also in the DialogRecord 2019-08-19 16:23:03 +0300 • Partial support for default dialog StdFilter proc 2019-08-19 07:03:12 +0300 • Bumb the M.A.C.E. version number & use current date 2019-08-19 07:02:52 +0300 • Replace printfs with log, and add a few DEBUG #ifs 2019-08-19 07:00:17 +0300 • Fix the SDL window title for now by using EnvStartupFile 2019-08-19 06:59:57 +0300 • Tweak Blob Mgr Demo and ZeroGravity for release 2019-08-19 06:00:30 +0300 • Work on FOND widthtable and fractional size support 2019-08-17 03:17:27 +0300 • Work a little on resource map "shadowing" handling 2019-08-17 03:04:32 +0300 • Fix WaitMouseUp to not return 1 extra "down" state 2019-08-17 02:23:40 +0300 • Fix SeedFill random memory corruption case 2019-08-15 23:36:01 +0300 • Merge branch 'master' of 2019-08-15 23:35:56 +0300 • Fix TextEdit cursor right-side clamping 2019-08-15 22:55:05 +0300 • add xcode 6 project 2019-08-15 22:43:06 +0300 • Fix incorrect register usage in TEDoText overrides 2019-08-15 21:21:29 +0300 • Fix StretchBits stack buffer overrun 2019-08-14 23:46:30 +0300 • Fix scrollbar redraw bug in List Manager 2019-08-14 23:25:48 +0300 • SetPalette classic-QD dummy trap 2019-08-14 21:44:36 +0300 • Fix LSetSelect highlight bugs 2019-08-14 19:28:32 +0300 • Fix lNoNilHilite flag handling in LSetSelect 2019-08-13 03:14:24 +0300 • Fix value clamping in Control Manager 2019-08-13 03:11:51 +0300 • Tweak CloseWD stub to not crash 2019-08-13 03:11:28 +0300 • Implement LClrCell and proto of LDelRow/LDelColumn 2019-08-12 21:10:26 +0300 • Fix a couple byteswap bugs in lists (selection) 2019-08-12 17:39:11 +0300 • Fix one-cell delta calculation in list pageup/down 2019-08-12 15:03:44 +0300 • Fix maxIndex bug in LNew 2019-08-12 02:34:18 +0300 • List Manager LSize implementation 2019-08-11 05:12:39 +0300 • Finished LAutoScroll, another easy one for ResEdit 2019-08-11 04:56:40 +0300 • Implemented C_LFind, was simpler than I thought… 2019-08-11 04:46:28 +0300 • Finish LNextCell trap, work on LClick multiselect 2019-08-11 02:18:20 +0300 • Implement C_LClick scroll indicator handling 2019-08-11 02:06:55 +0300 • Fix dividend overflow in scrollbar CDEF 1 rounding 2019-08-11 01:43:52 +0300 • Implement DragControl, finish TrackControl & CDEF1 2019-08-10 03:41:37 +0300 • Fix caps lock usage in SDL key event handler 2019-08-10 02:01:37 +0300 • SDL gamecontroller support "hack" to Apache Strike 2019-08-09 20:45:44 +0300 • Add FSpOpenDF, FSpCreate, FSpDelete, FSpGetInfo, FSpRename & (dummy) _Rename 2019-08-09 18:08:02 +0300 • Hacked procinfo for UIMagIDString call in LSearch 2019-08-09 03:28:00 +0300 • Fix buffer overflow in GetVolParms 2019-08-09 02:42:54 +0300 • Added dummy GetVolParms selector to _FSDispatch 2019-08-09 02:00:31 +0300 • Add Jigsaw test app 2019-08-09 02:00:10 +0300 • Implement LSearch, and (dummy stub) IUMagIDString 2019-08-09 01:58:42 +0300 • Implemented 1-bit NewGWorld in QDExtensions 2019-08-08 17:10:34 +0300 • Fix allocation of key state buffer 2019-08-08 02:45:45 +0300 • C_KeyTranslate Deadkey support + fix mac scancodes 2019-08-07 18:30:41 +0300 • Fix dialog edit field handling 2019-08-07 12:13:26 +0300 • Fix picture recording of port fgColor/bkColor 2019-08-07 04:49:10 +0300 • Add git log generator, for fun 🙂 2019-08-07 04:21:32 +0300 • Tweak type of ScrapSize in low memory 2019-08-07 04:21:04 +0300 • Fix fromMode handling in Picture Line recording 2019-08-07 04:19:58 +0300 • Fix picture line recording Point saving 2019-08-07 04:17:59 +0300 • Fix Hide/Show dialog item bounds calculation 2019-08-07 04:15:36 +0300 • Prevent editfield citation replacements in dialogs 2019-08-06 19:43:28 +0300 • Fix Scrap Manager bugs 2019-08-06 19:41:31 +0300 • Clean up Mouse module a bit 2019-08-06 19:07:03 +0300 • Fix bug in DefaultShowCursor 2019-08-06 16:38:47 +0300 • Un-obscure cursor before _MDrawCursor in CrsrTask 2019-08-06 01:42:37 +0300 • Make phase-shift adjustment configurable 2019-08-06 00:20:31 +0300 • Move audio phase-shift from RAM to ClassicSound 2019-08-06 00:17:50 +0300 • Disable VM_MAP and reverse-page mapping 2019-08-05 20:44:39 +0300 • Disable a couple of mouse debug log calls 2019-08-05 00:10:21 +0300 • Updated some test apps with relative mouse mode 2019-08-05 00:09:22 +0300 • Refactor cursor to support relative motion mode 2019-08-04 00:30:38 +0300 • fix abcd, partially fix sbcd instruction 2019-08-03 23:20:09 +0300 • fix zero status for subx.b/w/l instruction 2019-08-03 00:40:07 +0300 • fix add.b, addx.b/w/l and negx.b/w/l status bits 2019-08-03 00:40:01 +0300 • Merge branch 'master' of 2019-08-02 00:05:57 +0300 • Fix TEIdle blinker 2019-08-01 23:10:07 +0300 • Implement LLastClick and tweak trap glue generator 2019-08-01 16:03:22 +0300 • Disable the extra log debug trace of heap compact 2019-08-01 16:02:28 +0300 • Reduce logging in MixedMode calls 2019-08-01 16:01:44 +0300 • Fix size bug in WriteResource 2019-08-01 16:00:47 +0300 • Fix resProtected flag check in ChangedResource 2019-08-01 15:58:51 +0300 • Fix dialog edit field disabled check + others 2019-08-01 05:19:49 +0300 • Add missing lowmem changes for CurActivate bug fix 2019-08-01 05:19:04 +0300 • Work on KeyTranslate KCHR mapping (fix keyboard) 2019-07-31 01:21:08 +0300 • Add MacConcentration test app 2019-07-31 01:20:39 +0300 • Implement FADDD & fix major 64-bit float SANE bug 2019-07-31 01:08:21 +0300 • fix lsl and lsr instruction for shift > 31 2019-07-30 22:53:46 +0300 • fixes for m68k tester 2019-07-30 21:50:19 +0300 • move x68k xcode6 project to x68k root 2019-07-30 21:48:42 +0300 • add m68k tester 2019-07-30 21:46:25 +0300 • make kemu lib c++ compatible 2019-07-29 15:51:21 +0300 • Tweak GunShy config to use version 1.3 2019-07-28 04:54:27 +0300 • Fix window activation handling 2019-07-27 04:36:27 +0300 • Fix GetFontInfo for scaled fonts 2019-07-27 04:22:21 +0300 • Fix bug in fast-case of text blitter 2019-07-27 02:13:56 +0300 • Set Lo3Bytes lowmem global properly 2019-07-27 02:12:01 +0300 • Implemented ReadDateTime and (dummy) SetDateTime 2019-07-27 01:26:28 +0300 • Fix LActivate 2019-07-27 00:46:46 +0300 • Fix cursor leak 2019-07-26 18:29:56 +0300 • Tweak InitResources to be (again) re-callable 2019-07-26 17:32:20 +0300 • Fix UPP ProcInfo of DABeeper callback 2019-07-26 15:46:55 +0300 • Implemented LActivate selector in List Manager 2019-07-26 05:45:33 +0300 • Fix bug in resource manager name remove code 2019-07-26 05:44:44 +0300 • Add Glider4 test app 2019-07-26 05:44:24 +0300 • Fix possible bug in SetVol NFS handler 2019-07-26 05:43:07 +0300 • Setup CurrentA5 during boot stage 2 for INITs 2019-07-26 02:55:49 +0300 • Re-fix PurgeSpace to also return correct D0 2019-07-26 01:52:59 +0300 • Optimize FramePolygon case 2019-07-26 01:43:57 +0300 • Actually update the existing ADF header 2019-07-26 01:36:18 +0300 • Finish SetFileinfo handler in NativeFS 2019-07-26 01:35:28 +0300 • Fix region corruption bug in polygon drawing 2019-07-25 23:16:56 +0300 • Fix MapRgn duplicate inversion point bug 2019-07-25 23:07:21 +0300 • Fix MapPt negativity check 2019-07-25 22:08:06 +0300 • Fix size of ScriptUtil selector 2019-07-25 22:02:10 +0300 • Fix edge case bug in UnpackBits 2019-07-25 21:02:00 +0300 • Fix ADF file create bug, mixed up rsrc and data 2019-07-25 19:27:32 +0300 • Also reserve space for mapping in the stack after packBuffer