RPCEmu Mac Guide

From RISC OS

(Difference between revisions)
Jump to: navigation, search
(Fixed typo.)
(Preparing RPCEmu: 'om' => 'on')
Line 109: Line 109:
<pre>cd rpcemu-0.8.1/src</pre>
<pre>cd rpcemu-0.8.1/src</pre>
-
As it stands, if you try and compile RPCEmu 0.8.1 om a Mac, it will fail.  You must patch your download first, using the content of the listing shown.
+
As it stands, if you try and compile RPCEmu 0.8.1 on a Mac, it will fail.  You must patch your download first, using the content of the listing shown.
For the listing below, copy and paste the code in the box from your web browser into a TextEdit document and save it as "spoon.patch" (without quotes) in the "src" directory that your Terminal session is currently using (e.g. ~/Public/rpcemu-0.8.1/src).
For the listing below, copy and paste the code in the box from your web browser into a TextEdit document and save it as "spoon.patch" (without quotes) in the "src" directory that your Terminal session is currently using (e.g. ~/Public/rpcemu-0.8.1/src).

Revision as of 14:28, 7 February 2009

The January 2009 release of RPCEmu, version 0.8.1 (codenamed "Spoon") works out of the box on both Linux and Windows PCs. The release notes did not mention whether it is possible to run it on a Mac, but it is possible if you patch the code. This guide will lead you through the process of getting 0.8.1 running on your Mac. Patches have been submitted to the developers which should mean that this guide can be simplified in the future.

This guide has only been tested on an Intel-powered Mac Pro using Mac OS X Leopard 10.5.6. It may also work on Tiger and other versions of OS X, but this is not guaranteed.

Contents

Prerequisites

To get RPCEmu up and running, you will need the following:

  • An Intel-based Mac, preferably running Leopard.
  • The Developer Tools from your OS X install discs must be installed. These will create a folder named "Developer" in the root of your hard drive and install applications such as XCode and Interface Builder.
  • It is also of benefit if you are somewhat familiar with the use of the Terminal application.

Installing The Developer Tools

The developer tools can be found in the following places:

  • On the Leopard install DVD, in the Optional Installs/Xcode Tools folder. Double-click on XcodeTools.mpkg to start the installation.
  • On your computer's install DVDs, in the Xcode Tools folder. You may have more than one disc. For a 2006 Mac Pro, the tools were on disc one; for a 2008 MacBook Air, on disc two. Double-click on XcodeTools.mpkg to start the installation.
  • On Apple's web site: https://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/

Once the installer is running, perform the following steps:

  • Click on the "Next" button to skip the welcome page.
  • Click on the "Continue" button on the page with the licence agreement and press "Agree" to confirm that you agree with the licence terms.
  • On the third page, press the "Customize" button.

A list will show six items, beneath "Package Name", "Location" and "Action" columns. Ensure that the Unix Development Support item is ticked and press the "Install" button. The developer tools will then be installed. Once installation is complete, close the installer.

Downloading

You will need to download RPCEmu itself, as well as a library it uses named Allegro.

First, download the source code for RPCEmu:

http://www.marutan.net/rpcemuspoon/081/rpcemu-0.8.1.tar.gz

Secondly, the source code for Allegro (currently, version 4.2.2):

http://prdownloads.sourceforge.net/alleg/allegro-4.2.2.tar.gz?download

Copy both of the downloaded files to the same directory using the Finder. This guide assumes that you have copied them to ~/Public.

Compiling and installing Allegro

Allegro's web site describes it as "a portable library mainly aimed at video game and multimedia programming". It must be compiled and installed before you can successfully run RPCEmu.

Start the Terminal application by double-clicking on it. It should be in the "Utilities" folder in "Applications". A window will be opened. You should see a prompt that ends with a dollar sign ($) and a flashing cursor.

First, change directory to wherever you copied the Allegro and RPCEmu source files:

cd ~/Public

You must decompress Allegro. Type the following:

tar fzxv allegro-4.2.2.tar.gz

You will see a list of filenames flash past and eventually the $ prompt will reappear.

Change directory into the newly-created folder where the Allegro files have been placed:

cd allegro-4.2.2

You must first configure Allegro for building on OS X. Type the following two commands, pressing ENTER after each:

chmod +x fix.sh
./fix.sh macosx

You will see a short message telling you that Allegro has been configured for building on OS X.

Start the build by typing the following:

make

Depending on how fast your CPU is, this may take a few minutes. When it is finished, you will see another $ prompt.

You must now install Allegro. The relevant files are installed in the /usr/local folder. If this folder does not exist, the install will likely error.

First, create the folder:

mkdir /usr/local

If the folder already exists (i.e. you already have something installed there), the command will error. The error can safely be ignored.

On to the installation proper:

sudo make install

This will prompt you for your login password. Type it in and press RETURN. Shortly afterwards, you will see another prompt.

Return to the previous directory:

cd ..

Allegro is now installed and you can move to the second part of the process, getting RPCEmu up and running.

Preparing RPCEmu

You should now be in the directory where your two downloaded files are stored (e.g. ~/Public).

Type the following:

tar fzxv rpcemu-0.8.1.tar.gz

This will decompress the source for RPCEmu.

Change directory so you can start preparing RPCEmu:

cd rpcemu-0.8.1/src

As it stands, if you try and compile RPCEmu 0.8.1 on a Mac, it will fail. You must patch your download first, using the content of the listing shown.

For the listing below, copy and paste the code in the box from your web browser into a TextEdit document and save it as "spoon.patch" (without quotes) in the "src" directory that your Terminal session is currently using (e.g. ~/Public/rpcemu-0.8.1/src).

--- configure.ac.orig	2009-01-25 13:41:22.000000000 +0000
+++ configure.ac	2009-01-25 13:43:08.000000000 +0000
@@ -54,10 +54,15 @@
     *mingw*)
 	    OS="win"
   	    AC_MSG_RESULT(Windows)
             AC_DEFINE(RPCEMU_WIN, [], [OS is Windows])
 	    ;;
+    *apple*)
+            OS="macosx"
+            AC_MSG_RESULT([Mac OS X])
+            AC_DEFINE(RPCEMU_MACOSX, [], [OS is Mac OS X])
+            ;;
     *macosx*)
 	    OS="macosx"
   	    AC_MSG_RESULT([Mac OS X])
             AC_DEFINE(RPCEMU_MACOSX, [], [OS is Mac OS X])
 	    ;;
--- romload.c.orig	2009-01-25 13:49:20.000000000 +0000
+++ romload.c	2009-01-25 13:49:57.000000000 +0000
@@ -41,11 +41,11 @@
 
         while (!finished && file<MAXROMS)
         {
                 ext=get_extension(ff.name);
 //				printf("Found rom %s\n",ff.name);
-                if (stricmp(ext,"txt"))
+                if (stricmp(ext,"txt") && ff.name[0] != '.')
                 {
                         strcpy(romfns[file],ff.name);
                         file++;
                 }
                 finished = al_findnext(&ff);
--- rpcemu.h.orig	2009-01-25 13:47:09.000000000 +0000
+++ rpcemu.h	2009-01-25 13:48:22.000000000 +0000
@@ -46,10 +46,12 @@
 #define fseeko64(_a, _b, _c) fseek(_a, (long)_b, _c)
 #endif
 
 #ifdef __MACH__
 #define fseeko64(_a, _b, _c) fseek(_a, (long)_b, _c)
+#define fopen64(_a, _b) fopen(_a, _b)
+#define off64_t off_t
 #endif
 
 #if defined _BIG_ENDIAN || defined __BIG_ENDIAN__
 	#define _RPCEMU_BIG_ENDIAN
 #endif
--- rpc-macosx.c.orig	2009-01-26 20:51:24.000000000 +0000
+++ rpc-macosx.c	2009-01-26 20:51:48.000000000 +0000
@@ -9,11 +9,11 @@
 #include "rpcemu.h"
 #include "mem.h"
 #include "sound.h"
 #include "vidc20.h"
 #include "gui.h"
-#include "network-linux.h"
+// #include "network-linux.h"
 
 
 int mousecapture=0;
 static float mips;
 static int updatemips = 0;
@@ -228,11 +228,11 @@
         install_mouse();
 
         if (startrpcemu())
            return -1;
 
-        initnetwork();
+//        initnetwork();
 
         install_int_ex(domips,MSEC_TO_TIMER(1000));
         install_int_ex(vblupdate,BPS_TO_TIMER(refresh));
 	startsoundthread();
         if (soundenabled) initsound();

Switch back to the Terminal, where your prompt will be awaiting your command.

Before applying the patch, you must make a copy of one of the files, as one of the files required by the OS X version of RPCEmu is missing from the 0.8.1 release:

cp rpc-linux.c rpc-macosx.c

Type the following and press RETURN:

patch -p0 < spoon.patch

If all goes well, you should see the following:

patching file configure.ac
patching file romload.c
patching file rpcemu.h
patching file rpc-macosx.c

You must now copy a file from your Allegro source directory to your RPCEmu directory:

cp ../../allegro-4.2.2/misc/allegro.m4 .

RPCEmu is now ready to be built.

Compiling and building RPCEmu

As RPCEmu has been patched, the compilation process is slightly different to that of Allegro. Type the following commands, pressing RETURN after each:

aclocal -I .
autoconf
automake

You can now configure RPCEmu. Unfortunately, dynamic code compilation does not appear to work on a Mac, so RPCEmu must be compiled without it.

Type the following, again, pressing RETURN after each command:

./configure
make

If the process has worked, the very last line before the $ prompt should read "cp rpcemu ..".

Type the following to change directory to where the binary for RPCEmu has been copied:

cd ..

After the build

Before you can run RPCEmu, you must copy your RISC OS ROM image to the roms folder in your rpcemu-0.8.1 folder (e.g. ~/Public/rpcemu-0.8.1). It is best to use RISC OS 4.02, but 3.7 will work as well. A hard drive image may also come in handy.

You may also want to change the default configuration, to speed up the emulator and give it more memory. From the command prompt, type the following:

nano -w rpc.cfg

Things you may want to change:

Change the cpu_type line to read:

cpu_type = SA110

Change the mem_size line to read:

mem_size = 128

To save your changes, type CTRL+O and press RETURN when prompted for a file name. Finally, press CTRL+X to exit and return to the command prompt.

To try it all out, type the following:

./rpcemu

If all goes well, you should see a window appear and the familiar desktop should be displayed.

Using the mouse

Most Macs will nowadays be equipped with a two (or more) button mouse. However, RPCEmu may not detect all your buttons: with a Microsoft Laser Mouse 5000, for example, only the left mouse button has any effect.

For a MENU (middle) click, hold down the ALT key whilst clicking. For an ADJUST (right) click, hold down the CTRL key whilst clicking.

Quirks

A number of quirks exist, relating to the keyboard:

  • Caps Lock doesn't work at all using an Apple aluminium keyboard.
  • F12, which should invoke the command line, will instead invoke the OS X Dashboard. If you need to use a command prompt, choose the "* commands" option from the switcher menu (ALT-click on the Acorn).

Networking

Networking does not currently work on OS X. The code that 0.8.1 uses for Linux does not compile on a Mac and would need changing to work correctly.

Personal tools