Bill Brendling's version of MEMU

Everything about Andy Key's great Emulator MEMU
Bill B
Posts: 641
Joined: 26 Jan 2014 16:31

Re: Bill Brendling's version of MEMU

Post by Bill B »

stephen_usher wrote: 06 Feb 2025 18:06 Doesn't quite work, src/memu/CMakeLists.txt needs editing around line 220 to add an entry for Darwin.
OK, I have hopefully added that.
stephen_usher wrote: 06 Feb 2025 18:06 Now I'm going down the rabbit hole of "find_package" which seems to be overly complex. Why can't it just use environment variables as as "EXTRALIBS" and "EXTRAINCLUDES" ? *sigh*
Try setting the environment variable SDL3_DIR to /opt/local/lib/SDL3 or wherever SDL3 is installed.

Or try building SDL3 from source as I first suggested, and as is recommended by the SDL3 team.
stephen_usher
Posts: 341
Joined: 27 Nov 2016 19:58

Re: Bill Brendling's version of MEMU

Post by stephen_usher »

Thanks... actually cmake was doing the right thing as there was a config for sdl3... but there were other issues. A couple of ones with CMakeList.txt files, nfx.c (the type SOCKET isn't defined) and main.c.

In main.c your "UNIX" executable name determination was actually a Linux-ism. It wouldn't work under Solaris etc. so I've made it for Linux only and re-written it using only POSIX calls. This works under macOS/Darwin too. The macOS code you had didn't seem to work. There's also the issue that for some reason Apple removed MAX_PATH from limits.h so I've fudged it with the normal size.

I've attached a zipped patch file. Should work with patch -p1 < memu-patch.patch
Attachments
memu-macos-patch.zip
(1.77 KiB) Downloaded 113 times
Bill B
Posts: 641
Joined: 26 Jan 2014 16:31

Re: Bill Brendling's version of MEMU

Post by Bill B »

I have pushed another revision.

I revised your PATH search routine so that it does not use MAX_PATH.
stephen_usher
Posts: 341
Joined: 27 Nov 2016 19:58

Re: Bill Brendling's version of MEMU

Post by stephen_usher »

Thanks. I'll take a look ASAP.

With regards to the keyboard, I was wondering if it would be possible to use a modifier key to map the keypad keys to the main keyboard for laptop users. The Apple keyboard has the "Command" key which maps to the SDL keycode SDLK_LGUI. I have no idea what this would be under Windows and Linux/UNIX though, maybe Alt-Gr?

I was trying to work out how the keyboard code worked but couldn't see how it was being read.
Bill B
Posts: 641
Joined: 26 Jan 2014 16:31

Re: Bill Brendling's version of MEMU

Post by Bill B »

I thought most laptop keyboards had a Fn key, which when held down caused some of the keys on the right hand side of the main keyboard to send keypad scan codes. Certainly all the laptops I have had do so.

In MEMU, keyboard events are captured in the various win_*.c files (depending on which version). These translate the events to a standard format (defined in kbd.h). These are then passed to window specific keypress() and keyrelease() routines. kbd2.c does the mapping of key events to the emulated Memotech keyboard matrix, but there are routines in other source files which do their own processing of the key events.

SDL_LGUI is the Windows key on most laptops.

Given how much effort you are putting into this, am I right in thinking that the SDL version is the first version of MEMU to work on a Mac?
stephen_usher
Posts: 341
Joined: 27 Nov 2016 19:58

Re: Bill Brendling's version of MEMU

Post by stephen_usher »

None of my old Windows laptops have Fn+keys for keypad and Macs have never had this.

I've not tried previous versions but it would have to be an SDL version. Actually, I'd not tried MEMU before. :-)
Bill B
Posts: 641
Joined: 26 Jan 2014 16:31

Re: Bill Brendling's version of MEMU

Post by Bill B »

keyboard.jpeg
keyboard.jpeg (42.1 KiB) Viewed 37367 times
Just to illustrate, I borrowed the above image from https://www.dummies.com/article/technol ... op-202099/.

Note the symbols bottom right on the keys "7" to "0", "U" to "P", "J" to ";" and "M" to "/". These are the emulated keypad keys sent when the Fn key is held down.
stephen_usher
Posts: 341
Joined: 27 Nov 2016 19:58

Re: Bill Brendling's version of MEMU

Post by stephen_usher »

Definitely doesn't work on a Mac... Some of the combinations bring up system stuff. At the moment the Command key brings up the MEMU settings window by the way.

Oh, that brings me to the only real bug. The 80 column window keeps getting recreated and the old one orphaned. e.g. bring up the settings and they appear in a new window, leaving the old MTX window frozen. Use Reset from the options and a new MTX window appears leaving the settings window behind etc.
Bill B
Posts: 641
Joined: 26 Jan 2014 16:31

Re: Bill Brendling's version of MEMU

Post by Bill B »

stephen_usher wrote: 11 Feb 2025 23:17 Oh, that brings me to the only real bug. The 80 column window keeps getting recreated and the old one orphaned. e.g. bring up the settings and they appear in a new window, leaving the old MTX window frozen. Use Reset from the options and a new MTX window appears leaving the settings window behind etc.
That does not happen with the SDL version on either Linux or Windows. So it sounds like a bug in the Mac version of SDL3.
stephen_usher
Posts: 341
Joined: 27 Nov 2016 19:58

Re: Bill Brendling's version of MEMU

Post by stephen_usher »

Yeah... well, I've just built with the very latest version of the library and it's still creating a new window every time the settings are brought up. I don't think that it's at any other time.
Post Reply