/BlueberryMSX-2.0plus

Blueberry MSX with SDL2 and DRM/KMS/GBM support

Primary LanguageCGNU General Public License v3.0GPL-3.0

BlueberryMSX 2.0 Plus

blueberryMSX

BlueberryMSX-2.0Plus is an update from a port of blueMSX to Raspberry Pi, originally distributed by Meeso Kim.

I took the task to upgrade the whole project to run on the newest Raspberry Pi 4/400, removing all dependencies from the DispmanX library and upgrading the SDL library from 1.2 to 2.0. You can find the newest GPIO Slot board at Retro Game Restore store, which is the same I used to test this version.

Notice that I have zero experience programming in C/C++, so this process took almost 6 months to result in a running program. Right now I think that I'm starting to grasp the concept of the whole thing :-)

As the previous version, the emulator runs from the command line with the same arguments as the Windows/SDL versions and supports joysticks/joypads. Because it draws directly to framebuffer using the Direct Render Management/Kernel Mode Settings it does not need a windowing environment and can be run without X.

Shortcuts:

  • Press F12 to quit
  • Press F11 to disable frame skipping
  • Press F10, F9, F8 to set frame skipping to 1, 2, 3, respectively
  • Press ALT+F10 to toggle scanline
  • Press CTRL+F10 to toggle 4:3 forced for 16:9 or more resolution.
  • Press F6 to soft reset
  • Press F7 to take a screen shot.

Current Status:

Everything that depended on the DispmanX API and SDL version 1.2 was replaced, and there are lots of things that still needs to be fixed at this point but the emulator runs pretty well.

How to install on a new SD card image:

  • Download and write the latest RaspiOS Lite image in a 2GB+ Sd Card. I'm using the 2021-05-07-raspios-buster-armhf-lite.img image file to write these instructions

  • Boot the RPI4/400 with the SD card then configure the internet connection (wireless or wired, your choice)

  • Update apt packages:

$ sudo apt update && sudo apt upgrade -y

  • Install git and required libraries: SDL2, GLES, EGL, KMS/DRM and GBM:

$ sudo apt install -y git libsdl2-2.0-0 libdrm2 libgbm1 libgles2 libegl1 libgl1-mesa-dri

  • Clone the WiringPi repo for GPIO support:

git clone https://github.com/WiringPi/WiringPi.git

  • Build WiringPi libs, which will be installed at /usr/local/lib/:
$ cd WiringPi
$ ./build
  • Make sure you have the parameters below configured at the [all] section of the /boot/config.txt file:
 [all]
 dtparam=audio=on
 dtoverlay=vc4-fkms-v3d
 max_framebuffers=2
  • Reboot the RaspberryPi if you made any changes in the config.txt file

  • Clone the BlueberryMSX-2.0plus repo

$ git clone https://github.com/matheusjgsantos/BlueberryMSX-2.0plus.git

  • Finally run the BlueberryMSX with GPIO slot support:
 $ cd ~/BlueberryMSX-2.0plus
 $ ./bluemsx.sh

How to build from source:

  • Install the following development libs: sudo apt install -y libsdl2-dev libdrm-dev libgbm-dev autoconf
  • Configure and build BCM2835 support lib: cd bcm2835-1.68 ./configure make && sudo make install
  • Running make from ~/BlueberryMSX-2.0plus should do the trick.
  • All source files are available at the ~/BlueberryMSX-2.0plus/Src, but documentation is still incomplete

Known issues:

  • Keyboard mapping code is garbage because SDL2.0 introduced very long values for the key ids causing segmentation faults just by looking at it. Need complete rework
  • Emulator only works on HDMI0, I need to add logic to make DRM "discover" which HDMI port is in use and enable it. Zero idea how to do this
  • Sometimes the emulator gets upset and decides to disable sound. Check bluemsx.ini for sound.masterEnable=yes entry and fix it if changed to no
  • Improvements, improvements and more improvements

Resolved issues:

  • Screen resolution code is odd, opens a 800x600 screen even when the desired configuration is 640x480. Need to figure out what is happening - FIXED
  • RPMC power led
  • Slot 2 is now working, but I need to test what happens with 2 cartridges inserted