Making Of: Craft core

qTILoyDWhile porting and rewriting ‘Craft’ for use as a libretro core, we decided it would be nice to document some of the steps involved for the purpose of education.

You can check out our source code repository here.

There might be addendums and followups to this article later on. Note that some of these steps are not things that are ‘required’ to be done for the purpose of porting software to the libretro API, they are simply best practices based on the subject matter at hand.

Step 1 – Getting it compiled
‘Craft’ uses Cmake as its build system. While libretro places no requirements on which build system you use for your project, usually out of habit and preference we prefer to write static Makefiles for convenience and portability instead.

We reuse a basic Makefile template for this that we import into other projects. The three files we will be creating are : Makefile.libretro, link.T, and Makefile.common. We will put these files into the root of the project (or any other place where the central Makefile is usually stored).

To make things easier to understand, Makefile.libretro is the general Makefile solution which includes Makefile.common. Makefile sets up all the platform targets that your core supports, while Makefile.common would be the equivalent of CMakeLists.txt. You define all the files here that will need to be compiled here.

A rundown on some of the variables inside Makefile.common :

SOURCES_C – You add C source code files to this variable.

SOURCES_CXX – You add C++ source code files to this variable.

INCFLAGS – You add include directories to this varaible.

Craft is a C-only program, so we will add all the source files to SOURCES_C.

First we will attempt to compile as many files as possible before we will move on to actually making it work with libretro. Later on, we might replace some of the dependencies that ‘Craft’ uses with some of our own for reasons of portability and consistency. Some dependencies we will avoid for now like glew and glfw, we will add our own substitutes for this later on.

You will notice after following this commit that there are still quite a number of undefined references left before the core will actually be assembled. That is because of some of the dependencies we have omitted so far (like glew and glfw), and because we have yet to write a libretro implementation.

The following are notes based on the dependencies found in Craft, if you don’t find any of these dependencies in another project you don’t need to be concerned about this.

NOTE: I defined SQLITE_OMIT_LOAD_EXTENSION and appended it to CFLAGS since we won’t be needing such functionality for the libretro port.

NOTE2: Although the developer of Craft has gone to great pains to make sure there are as few hard dependencies as possible (and the few there are, have their sources provided inside the project’s codebase) ,there are still some hard dependencies which will require us to pull in some sources later on, like ‘libcurl’. We will ignore this for now, and just dynamically link against it for now until we can get rid of this dependency by compiling it into the core itself.

Continue reading “Making Of: Craft core”

Vulkan progress report and initial impressions

Vulkan_API_logo.svg

So it’s already a couple of days ago since Vulkan launched. We were one of the first non-test programs in the world to launch on Day One with a quite mature Vulkan implementation. So far it seems only ARM Mali, nVidia and Intel Broadwell Mesa drivers can handle all the features inside RetroArch’s Vulkan backend.

This is a followup to the earlier article which can be found here.

WSI XCB support

Back when RetroArch added Vulkan support on Launch Day, there was only a working Wayland implementation.

We support Vulkan over XCB now too. This means you can get Vulkan to run now on Linux with an nVidia GPU since their binary  blob driver doesn’t support Wayland.

I have tested the XCB context successfully on an Intel Ivy Bridge GPU as well. You need DRI3 support in order for this to work.

In case the Vulkan driver does not work for you on Intel, try creating the file ‘/etc/X11/xorg.conf.d/20-intel.conf. The file can be found here.

We recommend that if you have the option to choose between the two (and on some GPUs you simply might not have this option, like nVidia), that you pick Wayland over XCB and an X11 server. It’s a lot smoother.

Continue reading “Vulkan progress report and initial impressions”

Day 1 Vulkan support

Vulkan_API_logo.svg

Today Hans-Kristian Arntzen (also known as Themaister) sent us a big pull request giving RetroArch complete Vulkan support, the new graphics library API that has been unveiled and released to the public today.

See the pull request here.

Features/what has been ported

  • A full-featured graphics driver for Vulkan was written.
  • It should be compatible with MaterialUI/XMB and the other hardware-accelerated menu drivers that were previously GL-only.
  • Overlays should work through Vulkan. (by overlays we mean the gamepad overlays in RetroArch)
  • Font rendering should work through Vulkan.
  • Shader support. Vulkan support will mean some changes for shaders that will be unveiled later on.
  • Asynchronous GPU recording.
  • Libretro cores can be written against Vulkan as well. A test core was included for this in the repo, you can find it here.

Libretro cores that use Vulkan will require an additional header, libretro_vulkan.h.

Continue reading “Day 1 Vulkan support”

RetroArch 1.3 released

RetroArch 1.3 was just released for iOS, OSX, Windows, Linux, Android, Wii, Gamecube, PS3, PSP, PlayStation Vita and 3DS.

You can get them from this page:

http://buildbot.libretro.com/stable/1.3.0/

Once again the changelist is huge but we will run down some of the more important things we should mention:

Continue reading “RetroArch 1.3 released”

RetroArch 1.2.2 released – for Android/Windows/OSX/Wii/Gamecube/PSP

Time for another update. Let’s get right to it.

Download it here!

OSX version

NOTE: If the OSX version doesn’t work for you, you might have to install the Cg framework first. To do that, download this and install it:

http://developer.download.nvidia.com/cg/Cg_3.1/Cg-3.1_April2012.dmg

The OSX version is back! We have two versions because we care about backwards compatibility, one for 32-bit Intel Macs (OSX 10.6 Snow Leopard and up), and one for 64-bit Intel Macs (OSX 10.7 and up). Later on we’ll go even an extra mile beyond this by releasing the PowerPC version too, which should be compatible from OSX 10.5 and up. It would be nice to push the OSX requirements down even further in time.

Some caveats right now: the guy who did our buildbot releases (IKarith – TJCarter) – I don’t know what fate befell him and whether or not he is still doing fine (I hope he is), but these builds seem to be no longer being pushed out to our buildbot, the last update was somewhere around the end of June. So we will have to be looking fast for a solution for this on our buildbot so that we can have 0-day updated cores again for iOS and OSX (the iOS version is not yet released but will be coming up next hopefully).

Continue reading “RetroArch 1.2.2 released – for Android/Windows/OSX/Wii/Gamecube/PSP”