-
Notifications
You must be signed in to change notification settings - Fork 32
Source
You can try to download binaries here: Download
Directory targets/
contains various targets, ie. the emulators themselves emulating the desired machines, one machine per target (and per target directory).
Do not confuse targets
with the architecture
: which is simply the OS/hardware the emulator will run on, for example win32
for 32 bit Windows. Architecture dependent Makefile and (always included!) header files are in build/ (Makefile.*
, but Makefile.common is the common one, not an architecture specific file) and common/ directories (arch-sys-*.h
). Default architecture is the native
one which assumes a UNIX-like machine with gcc. Other architectures like win32
are cross compiled ones and also requires to build on UNIX-like machine (just the result
will run on Windows). Again: even compiling Windows exe's you must do it on Linux/UNIX like machine, no native Windows compilation is supported
Please note, that I don't have (really!) Windows at home or at my workplace. So I can only test with wine
, not so much serious testing/work behind the Windows architectures, but "it should work" at least.
Building a single emulator can be done by changing directory into its target and saying make
. In this case, you can even say make run
which compiles the target (if needed) and also run it. It's a useful thing during development, since binaries started from default place wouldn't found its ROM etc by default without installation in the emulator on the system.
You can also say make
in the top level directory, which will build all of the targets. In this case you can even say make all-arch
to build all targets for all architectures.
- Result binaries will be built in build/bin/, object files are stored in build/objs (prefixed with architecture and target to avoid name conflict).
- Command
make
also accepts theARCH=...
part to compile a given architecture (by default, onlyARCH=native
is built, unless you didmake all-arch
from the top level directory), for example:make ARCH=win32
to compile for Windows 32 bit (note, that you need cross compilation tools and SDL2 for that).
Running the emulators needs the linked libraries of course, in case of Windows, it means the SDL2.dll file usually. Also, you need the ROM images, you can download yourself, or you can say make roms
in the top-level directory if you want the system to do it for you.
Note: things like ROM images are searched in various places, including the current directory and rom/ sub-directory of the current directory. It can be a problem if you start the emulator from another place. Xemu tries to look up for files in various directories:
- current directory
- rom/ sub-directory of current directory
- SDL preference directory (SDL related OS-dependent directory)
- SDL base directory (the same one, where your executable is)
- On Linux at least: a custom "install" directory set by the Makefile See "Installation" part later about this topic.
Xemu basically consists of "common" sources (in directory /common) shared among all targets. The "target" stuffs are private to the given targets, and are in the corresponding target directory. Even common files are compiled for each targets, as there can be different CFLAGS, whatsoever.
Creating a new emulator is simple enough. Create a new directory here, and copy one Makefile and xemu-target.h of an existing emulator with your customizations then. Basically you need the following lines to change:
-
TARGET
: name of the target, should be the same as the directory name -
PRG_TARGET
: name of the binary, binaries will be built in the top level directory with extensions added based on the build architecture -
CFLAGS_TARGET
: your custom CFLAGS stuff, may be even empty with only the defaults -
SRCS_TARGET
: source .c files you want to compile from the target directory -
SRCS_COMMON
: source .c files from the common/ directory in the top level, you probably need emutools.c and maybe some emulation related files, for the CPU etc, if you don't want to use your own
-
#define TARGET_NAME "xx"
: should be the same as TARGET in Makefile (thus the directory name as well of the target) -
#define TARGET_DESC "xxxx"
: the description of the target, used for ie displaying the window title - Other than that, you can write your custom #define statements as well, this header is always included for each C compiler call, even without the source #include'ing it.
For building the project in the top directory, you may need to add your target into the top Makefile too.
In case of need of a new architecture and/or modification of a current one, you should look for build/Makefile.ARCH and common/arch-sys-ARCH.h where "ARCH" is the name of the architecture. "common" is a reserved name, ie build/Makefile.common is not the architecture, but the common parts of all make mechanisms. File common/arch-sys-ARCH.h is included by default for every C compiler call, without any #include in any sources.
You may need to modify architecture specific settings (ie: compiler, SDL2 stuffs, etc), probably you need to edit the architecture specific Makefile then.
TODO.