The frontends were copies of each other. The help was the same text three
times, the chain that picks the screen to show was the same branches three
times, and the SDL2 and SDL3 keyboards, joysticks and mice were the same files
twice with the constants of each toolkit.
frontend/shared holds them now: the view with what is on screen and the help,
the keyboard with the codes of the Apple II keyboard and the commands of the
emulator, the paddles with the four axis and the three buttons, the mouse, and
the mixer with every sound source of the machine already attached. The
frontends keep what belongs to their toolkit: the translation of their keys to
shared.Key, the clipboard, the instance ids of the SDL3 joysticks and the file
system Ebitengine hands the dropped files in. The drop targets take the drag
over the window too, so a frontend only tells which drive the pointer is on.
One implementation aligns what the frontends did differently, following a2sdl
where they disagreed:
- Ctrl with a letter was broken on a2ebiten and a2wasm. The key was already
zero based and 97 was subtracted from it again, so Ctrl-A sent 160 and not 1.
- The libretro core gets Ctrl-Left, the Delete of the Base64A.
- a2sdl3 marks the drive under the pointer when the areas are shown with F8.
- a2sdl finds the apple keys by scancode, so they work on the layouts where the
alt keys produce another symbol, and releases them when the window loses the
focus. Both come from a2sdl3.
a2ebiten keeps Ctrl-F5 for the readout of the speed it draws on the corner of
the screen, the only key that does something else anywhere.
The mouse leaves the pointer where it was on a window without size instead of
dividing by zero, which SDL3 can report when asking for the size fails.
What needs no machine is tested: the codes of the keyboard, the paddles, the
mouse and the drive the drop targets mark.
A file dropped on the window went to drive 1 or drive 2 depending on the
half it landed on. There was no way to know beforehand which drive was
which or what each one had inserted, and no sign afterwards of where the
file went. The machines with two Disk II cards have four drives and only
the first two could be reached.
F8 now shows a screen with one area per removable media drive, each with
the name of its drive and the image it has inserted, or EMPTY, and the
same screen appears for a moment after a drop with the drive that got the
file marked. It is a text screen of 80 columns rendered the same way the
help is, so SnapshotMessageGenerator takes the number of columns now.
The drives register with a label and tell the media they have, so the
frontends ask the machine with GetRemovableMediaDrives instead of assuming
two. The name of the media is written by the emulation goroutine and read
by the frontends, hence the atomic access.
The new frontend/shared package holds what the frontends have in common
and the emulator library has no place for: the composition of the screen
and the mapping from a position to a drive.
a2sdl reads the position of the pointer on the desktop when the file is
dropped. The mouse motion events do not arrive while another application
drags a file, so the last known position was stale and the file could land
on the wrong drive.
a2sdl3 shows the areas while the file is being dragged over the window,
which is something only SDL3 reports.
a2ebiten had no drag and drop at all, although the help it shows said
otherwise. Ebitengine hides the paths of the files dropped, but it opens
the real files and the handle tells the path back, so the images are
loaded like on every other frontend, compressed files included.
The README listed only the SDL2 and the console frontends, and the build
instructions for all of them lived in the README. Now there is a Frontends
section with the eight of them, each linking to a page with how to build it,
how to use it and what it can not do.
The libretro pages take the frontend_ prefix as well. The feature list moves
to doc/features.md, leaving a summary in the README.
The default configuration was wrong in the two places it was written: it
listed a parallel card in slot 1 and a mouse in slot 4, which are empty and a
Mockingboard, and flags -disk35 and -hd that no longer exist. Both lists now
come from -showConfig.