Libretro Cores Progress Report – February 29, 2020

Our last core progress report was on February 5, 2020. Below we detail the most significant changes to all the Libretro cores we and/or upstream partners maintain. We are listing changes that have happened since then.

How to update your cores in RetroArch

There are two ways to update your cores:

a – If you have already installed the core before, you can go to Online Updater and select ‘Update Installed Cores’.

b – If you haven’t installed the core yet, go to Online Updater, ‘Core Updater’, and select the core from the list that you want to install.

Vitaquake 2

Description: Quake 2 game engine core

Vitaquake 2 is now available for the first time on 3DS and Android. It uses the software renderer on those platforms for now.

  • Bugfix: Analog input descriptors added
  • Bugfix: Actually exit on Sys_Quit and Sys_Error. They intend to exit. Not doing so only result in weird crashes later
  • Bugfix: Fix crash in soft renderer when going underwater on increased resolution
  • Port: Ported vitaQuake 2 core to 3DS (software renderer only).
  • Port: Ported vitaQuake 2 core to Android (software renderer only).
  • Softrend: Fix crash in soft renderer when going underwater on increased resolution

ECWolf

You’ve been able to read about the new core ECWolf in our separate blog article. Further developments since then have been a 3DS port and analog deadzone options.

  • Analog deadzone options
  • Port: Ported ECWolf to 3DS

TIC-80

Description: TIC-80 emulator core

  • Updated to latest version

Flycast

Description: Sega Dreamcast emulator
We reported before in two separate articles this month on the mipmapping accuracy improvements. There have been other developments since the last progress report –

  • x64 DSP JIT support – audio DSP enabled should now have far less overhead than before
  • users now cannot force enable div matching [flyinghead]
  • disable div matching for Donald Duck Goin Quackers [flyinghead]
  • (NAOMI) parent rom name was incorrect for GDROMs [flyinghead]
  • (NAOMI) add ringout eeprom + some crcs [barbudreadmon]

Picodrive

The fast tile-based renderer (a new addition) can give a very welcome increase in performance. Note that only the ‘accurate’ renderer will display any graphics with 32X-based games, so only use tile-based rendering for now with regular Genesis/Mega Drive games.

  • Added an option to change the renderer from the default “accurate” line-based renderer to an alternative “fast” tile-based renderer, which may improve performance on slower devices such as the PSP. [bmaupin]

gpSP

  • Fix periodic ram_translation_cache crashes
  • Add manual frame skipping

OpenLara

  • Fix Android compilation [phcoder]

    Despite what the comments say Openlara uses
    functions available only in glesv3. Hence we need to
    force GLES3 and not GLES2. Then we need to fix compile error.
    It was due to requiring too low version of Android before it
    had GLESv3

prBoom

We talked about the serialization support before in prBoom. New improvements since then is that the wiggle fix is finally fixed now for ARM-based platforms like Android and iOS. Previously you’d need to have Wiggle Fix turned off if you didn’t want the floors and ceilings to look glitchy.

  • Implemented serialization support. Rewinding and runahead has been tested.
  • Use fixed point in precise flat calculation. This should work well now also in ARM and other platforms
  • Fix double free on failed load

DOSbox SVN/Dosbox Core

  • Latest SVN updates

Final Burn Neo

  • Latest updates from upstream

Stella

  • Latest updates from upstream

PCSX ReARMed

The biggest improvement since the last progress report [and the articles that followed it] definitely has to be runahead second instance support.

  • [3DS] Tweak compile-time options to increase performance [justinweiss]
    Adjusting a few things in the makefile to get some easy performance boosts.

    Did some measurement with Crash Bandicoot idling on the beach he starts on in Crash 1. All of these together brought it from ~44.5 fps to ~50.9.

    Tried all four UNAI options, this was the fastest by ~0.5fps.

  • [3DS] Fix dynarec crashes [justinweiss]
    After the dynarec writes new instructions, it has to flush the
    instruction and data caches. Some of these flush operations are
    privileged on the 3DS, so the clear cache functions have to run
    through svcBackdoor. The Nintendo implementation (and CFW
    reimplementation) of svcBackdoor has a problem where interrupts and
    context switches will cause crashes.

    Even though we can disable interrupts in the flush function, there’s
    still a window of time between svcBackdoor being called and the
    function being run where an interrupt will corrupt the stack.

    Luma3DS implemements a svcCustomBackdoor call we can use that also
    runs a function in supervisor mode, but uses an implementation that
    avoids this problem.

  • Fix second instance runahead [ZachCook]

Beetle PSX


Some crucial accuracy improvements to the hardware renderers means that Gran Turismo 2 is finally glitch-free with both OpenGL and Vulkan. Before, the HUD and other parts of the screen would flicker during gameplay.

  • Separate lightrec PGXP and non-PGXP rw_func [ZachCook] –
    When tested with soul blade this increases dynarec performance by ~1%
    for non-PGXP, and ~2% for PGXP as it always uses rw_func due to the fast-path
    being disabled for it.

  • Add frame duping support to RSX Vulkan [ggdrt]
  • OpenGL: Eliminate redundant glClear call [ggdrt]
  • Add accurate timing macros and report noninterlaced by default
  • Vulkan: Delay VRAM framebuffer size calculation to latest possible moment in
    Vulkan renderer; don’t rely on external timing of UpdateDisplayMode.
  • Add GP1(05h) command to rsx and parallel-psx [ggdrt]
  • Vulkan: Add Display VRAM core option support [ggdrt]
  • parallel-psx/Vulkan: Decouple MDEC and SSAA filter logic [ggdrt]
  • Limit image_offset range to prevent segfault [ggdrt] –

    Also update image_offset formula to better match core option info

  • Update rsx hook sequence in GPU reset and GPU restore state [ggdrt] –

    Fixes hardware renderer glitch where a portion of the BIOS PS logo would
    briefly flicker into the bottom right corner of the viewport after the
    normal BIOS animation.

  • Make scanline core options dynamic for sw renderer [ggdrt]

Desmume 2015

  • Blank screen gap for non-hybrid modes [Exalm]
  • Account for screen gap for touch input in top/bottom mode [Exalm]

mGBA

  • 3DS: Fix build
  • Update to mgba 0.8.1

Quasi88

  • Fix -mem_wait audio distortion

    Occurred when running in mode V1S
    due to front-loading DMA waits on
    each vertical sync.

  • ParaLLEl N64

    We’ve run several stories on ParaLLEl N64 this month already. In addition to the changes listed here, an Angrylion VI performance enhancement has been implemented which makes the VI filtered modes have less overhead than before.

    • Fixed VI performance issue caused by false sharing

      As pointed out by Themaister, the rseed array in vi.c suffers from false sharing, since its element size is smaller than the cache line size.

      This improves VI performance by no less than 30%. [Themaister/ata4]

    P-UAE

    Description: Commodore Amiga emulator

    This core is fast becoming one of the best ways to emulate the Amiga courtesy of sonninos.

    • Extended ZIP support [sonninnos]
    • WIIU build fix attempt + option display fix [sonninnos]
    • WHDLoad.hdf as raw files, Keylist fix, 68020 back to defaults [sonninnos]
    • Allow launching directories as hard drive images [sonninnos]
    • Save state fixes [jdgleaver]
    • Use memory-based save states (serialization support)
    • Reverted 68020 CPU shenanigans, Minor font fix, Less logging clutter [sonninnos]
    • New VKBD+statusbar fonts, RetroPad + CD32 Pad face button options [sonninnos]
    • Separate resolution & line mode core options, Automatic line mode [sonninnos]
    • Automatic resolution, Deinterlacing fixed, Statusbar fillings [sonninnos]
    • WHDLoad.hdf update [sonninnos]
    • Analog joystick device + minor reorganizing [sonninnos]
    • Resolution changing without reset [sonninnos]
    • Filesystem fixes
    • Model options for A4000, 68030+68040 [sonninnos]
    • “gl” video driver max_width fix [sonninnos]
    • Readme + core option label updates & ‘vsynctimebase’ tuning [sonninnos]
    • SuperHires video resolution & glue organizing [sonninnos]

    ScummVM

    • Update to ScummVM 2.1.1

    Opera (formerly 4DO)

    Description: 3DO emulator core

    Genesis Plus GX

    Description: Sega Genesis/Mega Drive/Master System/Game Gear emulator

    • Android: Add OPLL sound core

    FCEUmm

    Description: NES emulator core

    NOTE: All changes courtesy of negativeexponent (unless expressly attributed to somebody else)

    • Do overscan cropping after the ntsc frame is generated. this allows
      removing left and right screen artifacts when using horizontal crop like
      what you would see happen in TV when adjusting horizontal size (HSIZE).
    • add core option that implements NTSC scanline effects. This requires
      framebuffer to double the height, so a define is added (NTSC_SCANLINES at
      the top of libretro.c) to disable this on some low-memory platforms or just disable NTSC filters altogether.
    • Mapper 235 update support for 1MB/2MB carts and cart with unrom block
    • CNROM: Minor database cleanup
    • Use existing crc32 database for Bingo 75 (Asia) (Unl), this moves checksum check on mapper side instead of unif overrides.
    • m269: Deallocate memory on exit
    • Update mapper 15 based on latest notes
      – bit 7 acts as A13 only on mode 2
      – prg mask now 0x3F of data latche etc.
      – unrolled loops
    • Merge mappers 225 and 255 since they are basically the same
    • re-implement extra RAM as its required for some multicarts
    • Fix colour emphasis support for NTSC filter & raw palette + nes decoder shader

      – this implementation is based on a more accurate colour emphasis from fceux.

      – The raw palette + nes decoder shader was kinda incomplete since the implementation was based on
      a per-frame basis which means that the emphasis bits were read once and applied to the whole frame. This
      means that some games that uses a per pixel or per scanline emphasis would not appear correct. The more
      accurate implementation reads emphasis bits from bits 5-7 of PPU[1] and saves this info in a separate frame.

      – The same implementation is also used to fix emphasis for the ntsc filter.

    • Fix palette for vs. system
    • use fixed value for ntsc width and when its cropped
    • Fix colour emphasis when using palette presets –

      This is an issue i found when implementing the NTSC filters. Currently when using palette presets,
      no clour emphasis is seen on games that supports it. This is cause because the palette table is
      fille with the same 64*3 colour info.

      Using custom palette (palette file) and default both creates the emphasis as expected. So internally,
      fceumm is able to support such feature.

      The fix is to generate the base palette (64 * 3 with each triplet representing rgb colour), and then
      send this internally using FCEUI_SetPaletteArray() to fill the colour table with emphasis instead.

    • (3DS) Disable NTSC filter [jdgleaver]
    • (Android) Add NES NTSC filters
    • Implement blargg NTSC filters –

      – this implements blargg’s nes ntsc filters using core options
      – an optional height doubling is also added but disabled for performance reasons (might make that optional as a core option)
      – since PS2 and PSP have their own blitter branches, these platforms do not have the ntsc filters since i dont have the means to test on those systems.
      – compile with HAVE_NTSC=1 to have these options, HAVE_NTSC=0 disabled filter including core options
      – HAVE_NTSC=1 is set as default, other than PS2 and PSP as stated above.

    • Add mapper 218
    • m227: Implement chr-ram write protect
    • Add UNIF BMC-WX-KB4K (m134) to supported boards
    • Update implementation of some unlicensed mappers

    • Update mapper 91
    • Add mappers 111, 356, 269, 353
    • backport mapper 111 (Cheapocabra or GTROM) from fceux
    • Add BMC-SB-5013 (m359) and UNL-82112C (m540)
    • Add mapper 543, 550, 516
    • MMC1: Better work ram and battery saves support for size greater than 8K
    • Add mappers 382, 534, 539
    • Update mapper 150/243 (unif UNL-Sachen-74LS374N)
    • Update mapper 45 –
      – fix starting register value
      – fix memory write range to 0x6000-0xffff
    • Add mappers 360, 533
    • Minimize core options shown by default
    • updates to region-related settings and overclocking, UNIF now sets ines mapper if available (used for overrides etc)
    • Unif: Pass iNES mapper number to cart struct when available

    Gambatte

    Description: Game Boy/Game Boy Color emulator

    • Add optional LCD ghosting effect –
      This backports the LCD ghosting effects that were recently added to mGBA

      It replaces the existing Mix Frames core option with Interframe Blending. The old Accurate and Fast frame mixing settings have been renamed to Simple (Accurate) and Simple (Fast) – these perform the same 50:50 mix of the current and previous frames as before, required to achieve correct rendering of games that rely on LCD ghosting for transparency effects.

      In addition to these settings, there are now LCD Ghosting (Accurate) and LCD Ghosting (Fast) options. The former recreates the LCD response effect of RetroArch’s Gameboy Shader. The latter is similar, but uses a single accumulation buffer – which is more efficient, but lacks the subtlety of the shader implementation.

      Here are some stats showing the typical increase in performance overheads when using the various methods:

      Simple (Accurate): 30%
      Simple (Fast): 13%
      LCD Ghosting (Accurate): 48%
      LCD Ghosting (Fast): 28%

    • Do not add pointers to memory map if they are not available –

      skips sram when no sram is available
      skips extra RAM banks if not running in GBC mode

    • tvOS support

    Pokemini

    • Safely power off console before closing content [jdgleaver] –
      Thanks to the efforts of @Sanaki, it was discovered that certain games do not correctly update their EEPROM save data unless the virtual Pokemon Mini console is powered off before closing content. Affected titles include Pokemon Pinball Mini and Pokemon Race Mini – up until now, it was generally thought that saving was completely broken in these games.

      This PR adds an automatic power off event to retro_unload_game(). This ensures saves are always written without any special intervention from the user.

      The issue has existed forever, and I believe it affects the standalone version of PokeMini as well – great to finally get this fixed!

    EasyRPG

    • Fix Android build

    Kronos

    Description: Sega Saturn emulator based on Yabause

    • Latest updates by F-Care

    VICE

    Description: Commodore 64 home computer emulator

    Statusbar stays at the screen border + new position options: Top or Bottom

    RetroPad face button options: Rotate, Jump, Rotate+Jump

    Mouse type core option, usable with D-Pad + left analog + mouse, covered at least:

    Arkanoid (Paddles port 1)
    Arkanoid 2 (1351 port 1)
    Maniac Mansion Mercury (1351 port 2)
    Speeds are vastly different in Arkanoid & Maniac Mansion, so it was impossible to have both cases perfect with default options. VICE allows only one potentiometer device at a time, therefore it applies to the current RetroPad port. Pretty much everything else is familiar stuff from the PUAE core.

    Bonus:

    Defaulted ReSID sampling to “Fast” on low-power platforms
    Minor reorganizing

    • Mouse support [sonninnos]
    • RetroPad face button options, More statusbar options [sonninnos]
    • New fonts + cleanups [sonninnos]

    Final Burn Neo

    Description: Multi-system arcade emulator core

    • Latest updates

vitaQuake II Libretro core WIP available right now on Windows/Mac/Linux! Plus high refresh rate support in libretro core games



We’ve always felt at libretro that RetroArch is a platform that is agnostic to emulators. That is, the libretro API is not in any way tied to emulators and allows for far more applications to be ported beyond just emulators. So it’s always a delight to us when game engines get ported as libretro cores to add to the growing pool of non-emulator libretro cores. So it was music to our ears when the talented PS Vita homebrew coder Rinnegatamante graced us with a new libretro core – vitaQuake II! This is a port of a Quake II engine source port that he made originally for the PS Vita.

With this core, you will be able to play Quake II on RetroArch (or any libretro-compatible program for that matter).

YouTube videos coming later today showcasing the game running at both 60Hz and 120Hz!

Where to get it and for what platforms

The core is available right now on our buildbot. It will be only available for Windows PCs, Mac and Linux for now given the OpenGL fixed function requirements right now. We will see where we can go from here.

To install this core, in RetroArch’s Main Menu, go to Online Updater. First make sure your core info files are updated. Select ‘Update Core Info Files’.

After this is done, select ‘Core Updater’. From here, you can select ‘Quake 2 (vitaQuake 2)’ from the list and download it.

How to start Quake 2

You need to load Quake 2’s PAK0.PAK. This is usually found inside the Quake 2 directory’s ‘baseq2’ directory. Both the shareware version and the full version should work fine.

Information

It’s a very early version, and some bugs will still exist. Some examples:

  • If you want this to run with the regular gl driver, “Shared Hardware Context” needs to be enabled in Settings -> Core (you might need to enable Show Advanced Settings first in Settings -> User Appearance). The glcore driver on the other hand does not require you to enable this in order for the game to work as normal.
  • A savefile bug where after having selected New Game for the first time, starting it again after closing vitaQuake 2 for the first time will start you off at the beginning with all enemies already killed and the elevator button missing. In case this happens, you then need to go to the directory where your Quake 2 datafiles are, and manually delete the baseq2/save directory contents. Obviously this is very inconvenient and not at all intentional, so hopefully we can fix this soon.
  • After about 5/7 minutes, there might be a big freeze that can last for 5 seconds, after which the game will resume again. Obviously very nonideal and something we want to fix ASAP.

Technical details

Let us discuss some of the intricacies of this port:

  • Quake II dates back to an era where 3D graphics APIs and 3D video cards in general were truly in their infancy. Quake II makes use of a very limited subset of OpenGL 1.x. To complicate matters, right now the renderer is using some OpenGL 2.x functions as well such as glGetTexImage. We’ll have to see where we go from here – mobile would need a renderer that is at least compatible with GLES2, which means making use of non-fixed function vertex and pixel shaders, while on the other hand we can see an exclusively OpenGL 1.x renderer being very useful for low end hardware such as the 3DS, PS Vita and PSP – all these platforms have an OpenGL 1.x wrapper to some degree that translates back to their native graphics APIs. Frangarcj and Rinnegatamante are discussing possibly adding an OpenGL 1.x hardware context to the libretro API that would make it possible to target these platforms. So perhaps the future of this port is multiple renderers so that we can cast a wide net in terms of compatibility.

    Long story short – for now, this renderer is making use of fixed function GL, so you’ll need to be on a desktop computer to run this for now.

  • The glcore video driver will run this core right now without having to enable ‘Shared Hardware Context’. To get it to run with the regular gl driver, you will need to enable ‘Shared Hardware Context’ inside Settings -> Core. You might need to enable ‘Advanced Settings’ first in Settings -> User Interface before this shows up.
  • The libretro core has been changed slightly from the original so that the Quake II frame logic operates in fixed timesteps. In normal Quake 2 ports, this is usually done with a timer which acts as the framerate limiter. In libretro instead, we can guarantee that each retro_run iteration is exactly one frame, so all we have to do is pass the exact timestep delta for the framerate we are to target to Qcommon_frame. This gives us a silky smooth framerate with minimal frametime deviations. This might complicate matters in terms of existing Quake 2 server compatibility, but we kinda figure that it’s not worth it having suboptimal performance and that the existing Quake 2 server pool is very limited anyway and that it has its own drawbacks in terms of performance as it stands (with hard caps on framerate – most servers cap at 60-70 fps).
  • Quake II in general seems to have a default framerate cap of 90fps. We want to make as many libretro game engine cores suitable for high refresh rate gaming as possible, so we’ve gotten rid of this cap. We’ve tested the game to be running flawlessly at 100Hz and 120Hz.
  • The UI in Quake II normally doesn’t scale, so at higher resolutions it would appear very small. Because it’s 2019 and not a lot of people play their games at 640×480 anymore, there is now UI scaling implemented so that the UI text popups will be readable at 1080p and beyond.
  • Rumble has been implemented and is available as a core option, just like it was in the PS Vita standalone version.

High refresh rate gaming with libretro/RetroArch


There has been an increased focus on making sure libretro game cores are all they can be when it comes to supporting higher refresh rates. So far we have already had the following libretro game cores that can run at higher framerates (>60fps):

  • Prboom (Doom 1/2 game engine core)
  • Cannonball (Outrun game engine core)
  • OpenLara (Tomb Raider game engine core)
  • Tyrquake (Quake 1 game engine core) (NEW)
  • vitaQuake2 (Quake 2 game engine core) (NEW)

Tyrquake and vita Quake2 are two recent additions to this list. In order to get them to run without audio crackling at higher refresh rates, we had to change the audio samplerate from 44Khz to 48Khz, which seemed to do the trick.

To further increase the convenience factor, we’ve also implemented a nifty feature in these libretro cores: support for libretro’s ‘preferred refresh rate’ option. Basically, if you leave the ‘Framerate’ option at ‘Auto’, the libretro core will look at RetroArch’s configured ‘refresh rate’, and it will use this for the framerate. This means that inside RetroArch, you can switch to a 1440p 120Hz mode with the Resolution setting, then start the core, and without having to configure the framerate, it will then run the game at 120fps. Likewise, if you then switch to a 4K resolution at 60Hz, and close and reload the Quake core, the game will automatically run at 60fps instead. So, with cores that support the ‘RETRO_ENVIRONMENT_GET_TARGET_REFRESH_RATE’ environment callback, you don’t have to keep switching back and forth between separate framerates inside the core – you can simply leave it at ‘Auto’ and RetroArch will do the rest.

This feature has not been added yet for OpenLara and Prboom, but we’ll do so soon.