RPCEmu 0.9.0 and Macs - beta testers wanted

ask about 32-bit emulators like ArcEm, Red Squirrel, Arculator or RPCEmu here
Post Reply
VincentVega
Posts: 275
Joined: Thu Sep 11, 2008 9:19 pm
Contact:

RPCEmu 0.9.0 and Macs - beta testers wanted

Post by VincentVega » Tue Jul 10, 2018 6:57 pm

Not so long ago, a new version of RPCEmu (0.9.0) was released, featuring a new (and much improved) QT front end. As with most RPCEmu releases, I eagerly compiled it on my Mac, only to find that the keyboard doesn't work! It seems that when you get keyboard events from QT on the Mac, you don't get a scan code, which is what RPCEmu uses to map keypresses to PS/2 codes for RISC OS to process.

For the last couple of weeks, I've been playing around trying to get the keyboard working. It's been a process involving a large amount of guesswork, but I think I finally have it working. Fortunately there are no changes required to QT, just to RPCEmu. You can get most of the information you need from other fields of the key event from QT and from another event that RPCEmu ignores on Macs, and the only key I've found that needs special treatment is Caps Lock (mainly because you don't get a "key up" event for some reason).

Before I submit a patch to RPCEmu's mailing list, would anyone be interested in doing some beta testing? It works fine on my 2017 iMac with a normal Apple keyboard and I'll probably give it a whirl on my MacBook too, but I don't have any other hardware available to use.

The patch adds a couple of new files and modifies a few others. I've currently got it working so the keys are in the same layout as a normal RISC PC/Acorn keyboard, so the backslash key is to the left of "Z", not to the left of "ENTER". I'm weird like that: I use a normal "PC" keyboard layout when I'm in Windows, even if it's in a virtual machine running in OS X.

The patch won't be ready for couple of weeks as I'm off on holiday next week, but hopefully it will be ready shortly after I return. Unfortunately I never remember to make a copy of files before I change them so I have the originals to use to compare using "diff" so I'll have to faff about with that for a bit.
Last edited by VincentVega on Wed Jul 11, 2018 8:40 pm, edited 2 times in total.

User avatar
lcww1
Posts: 274
Joined: Wed Mar 15, 2017 11:16 pm
Location: Moon Base Alpha
Contact:

Re: RPCEmu 0.9.0 and Macs - beta testers wanted

Post by lcww1 » Tue Jul 10, 2018 10:33 pm

Nice work! I’d be delighted to beta test your Mac RPCEmu build 8)

User avatar
myelin
Posts: 431
Joined: Tue Apr 26, 2016 9:17 pm
Location: San Francisco, CA, USA
Contact:

Re: RPCEmu 0.9.0 and Macs - beta testers wanted

Post by myelin » Wed Jul 11, 2018 5:36 am

Me too!
SW/EE from New Zealand, now in Mountain View, CA, making BBC/Electron hardware projects for fun.
Most popular: fast serial port, FX2+PiTubeDirect Tube/Cartridge adapter, USB cart interface.


matt_nottm
Posts: 100
Joined: Sat Feb 11, 2017 11:54 am
Contact:

Re: RPCEmu 0.9.0 and Macs - beta testers wanted

Post by matt_nottm » Wed Jul 11, 2018 1:16 pm

<AOL> Me too please! </AOL>

danielhanlon
Posts: 1
Joined: Tue Jul 17, 2018 5:32 pm
Contact:

Re: RPCEmu 0.9.0 and Macs - beta testers wanted

Post by danielhanlon » Tue Jul 17, 2018 6:29 pm

I'd be very happy to be a beta tester too...

VincentVega
Posts: 275
Joined: Thu Sep 11, 2008 9:19 pm
Contact:

Re: RPCEmu 0.9.0 and Macs - beta testers wanted

Post by VincentVega » Wed Jul 18, 2018 7:17 pm

Thanks for all the kind offers of help!

I'm still on holiday (it's so nice not to think about work!), but I managed to find some time yesterday and today to start working on putting together a proper patch. It's going pretty well (C/C++/Objective C are very different to .NET, and making them work together is something I've not done before) and I just need to do a bit of tidying up before I pull everything together and upload something so you can all have a play. It will be a single unified diff, which you will need to apply to a fresh "rpcemu-0.9.0" folder via the "patch" command in Terminal. I'll endeavour to get something finished during the weekend, all being well.

I've had a quick play on my 12" Macbook, and the patch works fine there too, so it's looking fairly promising.

VincentVega
Posts: 275
Joined: Thu Sep 11, 2008 9:19 pm
Contact:

Re: RPCEmu 0.9.0 and Macs - beta testers wanted

Post by VincentVega » Sun Jul 22, 2018 6:49 pm

As promised, I have a patch ready for testing. You can download it here: here. The download is around 84K in length and contains the following:

* "rpcemu-0.9.0-mac.patch" - a patch file in unified diff format.
* "macosx" - a folder that contains icons in various sizes for the Dock icon.

To apply the patch, you will need to have installed the Mac developer tools at minimum, and probably Xcode as well. The easiest way to do this is to start the Terminal application (in /Applications/Utilities) and to type the following:

Code: Select all

xcode-select --install
This will prompt you to choose which you want to install - just the command-line tools or the full Xcode experience.

Once you've done that, you'll need to install QT. This can be downloaded from the QT web site here. Most people will want the Open Source version. This will download a small installer that connects online and downloads what it needs. Alternatively, you can obtain an off=line version or the source code from one of the links here.

The final thing you need is the source for RPCEmu. At the moment, the patch is for the current release version, 0.9.0. You can obtain the source from here.

After all the downloads are ready and everything is installed, create a new folder in Finder and copy the "rpcemu-0.9.0.tar.gz" file and the "rpcemu-mac-patch-0.9.0-1.tar.gz" into it. Next, start a Terminal session.

Part 1 - unpack the archives

Type the following, pressing RETURN after each line:

Code: Select all

tar fx rpcemu-0.9.0.tar.gz
tar fx rpcemu-mac-patch-0.9.0-1.tar.gz
Part 2 - apply the patch

Type the following, pressing RETURN after each line:

Code: Select all

cd rpcemu-0.9.0/src
patch -p0 < ../../rpcemu-mac-patch-0.9.0-1/rpcemu-0.9.0-mac.patch
If all is well, you should see output from the last command like this:

Code: Select all

patching file hostfs-macosx.c
patching file qt5/main_window.cpp
patching file qt5/main_window.h
patching file rpc-machdep.c
patching file rpc-macosx.c
patching file qt5/rpcemu.pro
patching file qt5/keyboard_macosx.h
patching file qt5/keyboard_macosx.m
Part 3 - copy icon files

Type the following, pressing RETURN after each line:

Code: Select all

cp -r ../../rpcemu-mac-patch-0.9.0-1/macosx .
Compile the source

Change folder into the "qt5" sub-folder within "src":

Code: Select all

cd qt5
You will need to create the make files for the project, using the QT "qmake" command. The exact line you type in depends on where you installed QT and whether the path for the QT stuff is in the $PATH environment variable. My QT installation is in "/usr/local/qt", so I type:

Code: Select all

/usr/local/qt/bin/qmake rpcemu.pro
Next, you can compile everything, via make:

Code: Select all

make
Feel free to add "-jX" to that last command, where "X" is the number of threads you want (e.g. "make -j4"). This will speed up compilation, though RPCEmu isn't huge.

Once that's completed, you should end up with a file named "rpcemu-interpreter-debug.app" in the "rpcemu" folder (the one above "src").

Part 4 - install ROMs, etc

As the structure of Mac apps is different to Linux/Windows, the patch tweaks RPCEmu so it loads the CMOS, ROMs, hard drive image and so on from a folder outside the application, namely:

Code: Select all

~/Library/Application Support/RPCEmu
You can get to this via the Finder from your home directory. If "Library" doesn't show up, you can remedy this by clicking on "View > Show View Options" and turning on "Show Library Folder". Double click on "Library", then "Application Support".

Create a folder named "RPCEmu".

Open another Finder window and browse to wherever your "rpcemu-0.9.0" folder is. From this folder, copy the following to the "RPCEmu" folder you just created:

Code: Select all

cmos.ram
hostfs
poduleroms
riscos-progs
roms
rpc.cfg
You will also need to copy a RISC OS image into the "roms" folder. I've found that 5.24 doesn't work (it errors on boot), but 3.71 works fine.

All being well, if you then double-click on "rpcemu-interpreter-debug", it should launch the emulator, complete with working keyboard.

Things to note

1. The keyboard layout mimics that of a UK RISC PC keyboard, not a Mac one, so the key to the left of "Z" is the backslash/pipe and that to the left of RETURN is hash/tilde.
2. There is some slightly odd behaviour keyboard-wise:

* SHIFT-3 produces an angled bar.
* The pilcrow key to the left of "1" on a standard Apple aluminium keyboard produces the pound sign.

I am not sure whether this is an issue with the patch or with RPCEmu. I haven't had the time to compile on Windows/Linux to check.

3. F13, F14 and F15 are mapped to "Print Screen/SysRq", "Scroll Lock" and "BREAK" respectively. In theory, the "Fn" key (on my keyboard, between F13 and DELETE should function as "INSERT".

4. The patch uses virtual key codes, not scan codes, as these are apparently not accessible. This means that if you have a non-UK keyboard layout where keys are in different positions, the wrong key will be sent to the emulator. For example, if you have a French layout and you press "Z", the emulator will think you actually pressed "Y". It is possible to work out what keyboard layout is currently active (there is some unused code in the patch for this), so it would be possible to have the emulator work out what keyboard layout is active and switch the key mappings accordingly. I haven't put much thought into this, let alone done any development.

5. If you compile a debug build (which is the default) the application icon doesn't show up in the Finder. However, it does with release builds. If you want this, type "make -f Makefile.Release" instead of "make".

I think that's enough to be getting on with. Any feedback and bug reports would be appreciated.
Last edited by VincentVega on Tue Jul 24, 2018 5:53 pm, edited 3 times in total.

User avatar
lcww1
Posts: 274
Joined: Wed Mar 15, 2017 11:16 pm
Location: Moon Base Alpha
Contact:

Re: RPCEmu 0.9.0 and Macs - beta testers wanted

Post by lcww1 » Mon Jul 23, 2018 10:07 pm

Many thanks for these detailed and very helpful instructions!

Following your instructions, I've got RPCEmu 0.9.0 built and running on my MacBook Air running Mac OS X 10.13.6.

Just a couple of trivial points. When compiling, I had to use:

Code: Select all

path_to_qt_install/Qt/5.11.1/clang_64/bin/qmake qt5/rpcemu.pro
the build then proceeded without error, but the resulting app was called rpcemu-interpreter.app, and was placed in the same directory as the rpcemu-0.9.0 source directory (one level higher than I had expected).

The rpcemu-interpreter.app app is running nicely, so far. One difference from RPCEmu 0.8.14 that I've noted is that I have to select "Two-button mouse mode" to get the middle mouse button menu behaviour working, with the menu button then being assigned to ctrl-trackpad-click.

Anyhow, so far, so good!
Thanks again for your work on getting the latest RPCEmu onto Mac OS X!

VincentVega
Posts: 275
Joined: Thu Sep 11, 2008 9:19 pm
Contact:

Re: RPCEmu 0.9.0 and Macs - beta testers wanted

Post by VincentVega » Tue Jul 24, 2018 5:52 pm

Thank you for the feedback - much appreciated!

The folder thing is because I missed out a step from the compile stage. Before you type the 'qmake' command, you need to change directory into the 'qt5' folder within 'src'. I'll tweak the instructions accordingly.

dpsharp
Posts: 4
Joined: Fri Sep 07, 2018 1:05 pm
Contact:

Re: RPCEmu 0.9.0 and Macs - beta testers wanted

Post by dpsharp » Fri Sep 07, 2018 2:11 pm

From a quick review of the mercurial changelog I couldn't see this committed, is this change stable enough to be submitted or is further testing required (in which case I might help out if time allows)?

VincentVega
Posts: 275
Joined: Thu Sep 11, 2008 9:19 pm
Contact:

Re: RPCEmu 0.9.0 and Macs - beta testers wanted

Post by VincentVega » Fri Sep 07, 2018 6:19 pm

I haven't had time to submit the patch yet due to other (both computing and non-computing) projects and certain events affecting family members, but I'm hoping to get it sent over next week sometime when I'm off work. I haven't had any feedback other than that from lcww1, so I'm assuming that all is well with the patch.

dpsharp
Posts: 4
Joined: Fri Sep 07, 2018 1:05 pm
Contact:

Re: RPCEmu 0.9.0 and Macs - beta testers wanted

Post by dpsharp » Fri Sep 07, 2018 6:47 pm

Sounds good, will look out for it on the trunk/next release then.

VincentVega
Posts: 275
Joined: Thu Sep 11, 2008 9:19 pm
Contact:

Re: RPCEmu 0.9.0 and Macs - beta testers wanted

Post by VincentVega » Fri Sep 21, 2018 1:30 pm

Update: the patch was submitted last week, but hasn't shown up on the mailing list yet. I had an email come through from the list saying that my message was held for approval because it was bigger than a specific size, but since then nothing. The list archives don't show any postings since June, so I have no idea what's happening.

dpsharp
Posts: 4
Joined: Fri Sep 07, 2018 1:05 pm
Contact:

Re: RPCEmu 0.9.0 and Macs - beta testers wanted

Post by dpsharp » Fri Sep 21, 2018 2:39 pm

Thanks for submitting, hopefully normal service will resume soon. Do post back if you see it get onto main. I'll try and keep an eye out too.

Phlamethrower
Posts: 81
Joined: Fri Nov 24, 2017 1:35 pm
Contact:

Re: RPCEmu 0.9.0 and Macs - beta testers wanted

Post by Phlamethrower » Fri Sep 21, 2018 5:15 pm

There was a "mailing list glitch" recently, so if you don't get any feedback in the next day or two then it's probably worth trying to send it again (or a test message, at least)

http://www.riscos.info/index.php?title= ... itch_fixed

Post Reply