Step by step guide for how to create a Reversing emulator for your console of choice.
Note that you may not need this guide if someone has already created a Reversing emulator for your console.
Since the libRetroReversing library is based on
libRetro it is easier to find an existing libRetro based emulator and fork it as the basis of your new project.
You can find the emulators here: libretro Emulator Repositories
Find the repository most suited for your project, as there can be multiple emulators for your target console, do some research to find out which one you personally prefer.
In this example we chose the Sega Saturn emulator from libretro and clicked fork, resulting in our own forked version of the repository here: https://github.com/RetroReversing/yabause
First checkout your newly forked repository to your local machine and then open a new terminal in the root of the repository.
Now run the following command:
git submodule add https://github.com/RetroReversing/libRetroReversing.git
This should run and when finished you will see a new folder called
libRetroReversing in that root directory.
Now to make sure it is correct lets run git status like so:
The output should look something like this:
On branch master Your branch is up to date with 'origin/master'. Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: ../.gitmodules new file: ../libRetroReversing
Run the following in the same terminal you have been using previously:
git commit -m "First step in creating a Reversing emulator"
That should create your first commit and now to make sure you don’t loose your precious work lets push back to github:
git push origin master
This is where it will get a little bit different depending on the emulator (libretro core) you are trying to build.
You need to look for a file called
Makefile.libretro OR one simply called
Makefile, the letter case doesn’t matter.
If you can’t find it but you have a file called
CMakeLists.txt then you have an extra step before going to step 2.2.
This step is only required if you don’t have a Makefile already generated.
You need to go to the directory of your
CMakeLists.txt file in your terminal and run the following command:
After this has succeeded then you should get a “Makefile” file generated. If you don’t then please ask in the comments below and we should be able to help.
Before making changes to the Makefile its important that we can successfully run it.
So now that you are in the folder with the Makefile you simply need to run:
The problem with some of the libretro cores is that they sometimes reference system files that you don’t have, so when running make you may encounter issues such as:
Depending on your system you may have to install SDL2 from a package manager, e.g on Macos:
brew install SDL2
In my case I already had it installed but it still wasn’t finding it so I got the path to the file using the
locate command like so:
It came up with a few paths including the one I want to use
So I added the following to my environment:
Now that you have successfully compiled the library into a binary (with an extension such as
.so), you are ready to run it!
You can run the library you built through the terminal like so:
/Applications/RetroArch.app/Contents/MacOS/RetroArch -L mednafen_saturn_libretro.dylib "/Saturn/Games/Awesome Game.cue" -v
Note that for consoles that require a BIOS make sure it is located in the System directory of RetroArch. Mine was