Blake Smith

create. code. learn.


Writing Software for the RG350M Gaming Handheld

I recently purchased a RG350M, a retro-gaming emuation handheld, that’s an improved version of the RG350. It features a 1Ghz, JZ4770 dual-core 64-bit processor, with 512MB of DDR ram, and a 640x480 LCD display (double the resolution from the RG350). Much to my surprise, the JZ4770 SOC features a MIPS64 core, rather than the prevalent ARM core that’s popular in so many portables these days. I thought MIPS was mostly a thing of the past, but it turns out it’s still found in many small embedded devices. MIPS processors were also used in many popular gaming consoles of the past (PS1, N64, and many others).

The RG350M can emulate all your retro gaming systems quite well, all the way up to many PS1 games.

Picture of a RG350M running rombp

Software Toolchain

After I got it, I wanted to know how I write software for the thing. The RG350 is based on OpenDingux Linux: a stripped down Linux distribution that’s optimized for these small, portable gaming handhelds. While having a Linux target makes it significantly easier to target for software development, OpenDingux has a few design constraints that make it different than your standard desktop Linux target:

  • No window manager: No X11 window manager, so you can’t just find your favorite GTK application and port it over. By default, applications are launched using the GMenu2X laucher and run fullscreen.
  • Only one application can be running at a time (with some exceptions).
  • While OpenDingux has its own OPK application file format, it has no traditional “package management” system like RPM or APT packages.

First, you’ll want to setup a cross-compilation toolchain. The two main things you need are:

  1. A C/C++ compiler that can target the MIPS64 ISA, along with a libc. The RG350 stock firmware ships with uclibc, so we’ll want to make sure our toolchain has that available for compilation.
  2. Cross compiled shared libraries that we can link against during development. Most applications for these handhelds end up using SDL2 for graphics rendering.

Luckily, there’s a Linux Buildroot GitHub repository that Github user tonyjih put together that will help you bootstrap this entire toolchain, including common shared libraries that are useful for development.

Development Notes

A few important details on building software for the RG350:

  • The OPK file format is basically a squashfs filesystem file that contains a special application launcher file inside (.desktop file). The .desktop file has basic application metadata, similar to a Debian package, and also includes a menu icon and application launch command. See the Makefile to see an example for how the squashfs filesystem can be built, and how the .desktop file gets included.
  • .desktop files are loosely based on GNOME Desktop launcher files, but with different keys and sections for handhelds. See the .desktop file to see a working example.
  • A useful workflow I’ve found is to compile and test my code on my Linux laptop, and then test on the device once I’m reasonably happy with the desktop behavior. Remember: this is just Linux, with SDL2, so it should be easy to iterate locally. If you need to use other libraries that don’t ship on the device, you will have to either include them compiled in your OPK file, or statically link them into your binary.

A ROM hack binary patcher

I wrote a retro gaming ROM hack binary patcher program that should work on most OpenDingux handhelds. There are many great (and awful) community made ROM hacks that I’d like to play, that require binary patching an original stock game ROM. It’d be nice to be able to patch these games on the handheld itself. I’m mostly interested in playing Super Metroid and Super Mario World hacks (Kaizo Super Metroid anyone?).

rombp desktop screenshot

The basic application structure is:

  1. A filesystem browser, to select ROM files and patch files.
  2. A basic IPS / BPS patch decoder, to patch the ROMs. IPS, even with it’s several shortcomings, seems to be the favored format for patch distribution in the Super Metroid community. I found BPS patches to be more popular in the Super Mario World community. Both IPS and BPS are simple and easy to implement.

You can get the source for rombp on the GitHub project page. If you have an OpenDingux compatible handheld, you can grab the compiled OPK files and give it a try.


If you’re going to pick an RG350M, I’d recommend getting one from an Amazon seller. Mine took almost a month to get here, spending most of it’s time sitting in a local post office in a “Tendered for Delivery” state.

I still have an old GP2X from South Korea, which a lot of the software for the RG350M is based on. The hardware has improved dramatically since then, and this is a fun little handheld that is fun and easy to hack. I’d recommend it if you’re at all interested in a compact retro gaming device.

about the author

Blake Smith is a Principal Software Engineer at Sprout Social.