DEV Community

Cover image for Retroachivment on real PS2
Hcan
Hcan

Posted on

Retroachivment on real PS2

Hi everyone! I like building all sorts of stuff, and I figured I'd share what I've been working on for the last two months. I think you might like this one.

What it is, in short

xeRAbora: RetroAchievements on a real PS2. No emulator. You play on the console, the achievements land in your RA account, and the TV flashes the moment one unlocks.

The first release came out on August 26, there have been 20-something versions since, and on October 26 the stable 1.0.0 shipped. That's why I'm writing now: it's not a pre-alpha anymore, plenty of people are playing, and it's safe to try.

What it can do today:

  • Achievements on real PS2 hardware from any media: original disc, USB stick, HDD, MX4SIO, SD card in an MMCE. Images in ISO.
  • PS1 works too: through POPStarter, VCD images in the POPS folder.
  • The unlock flash right on the TV, plus the same thing in the client (the achievement pops up on screen).
  • A client for Windows, Linux (Raspberry Pi included), macOS and Android. The phone runs the full client, identical to the PC version.
  • A separate companion mode for people who play on emulators, and a STREAM screen for OBS.
  • Softcore (casual) only for now.

What RetroAchievements is

A lot of you know and love RetroAchievements and use it through emulators. For those who don't: it's a service that records achievements to your account on the RA site while you play on emulators. Like Steam achievements, but for the old stuff (NES, SNES, PS1, PS2).

How the idea came about

Not long ago I got myself a PS2 Slim. I was basically just playing it, but the feeling that I was missing something wouldn't leave me alone. And then I caught myself thinking: why not try adding achievements natively on the PS2? So, well, I went digging on the internet. I started looking for anything similar, put an agent on deep research of the topic, it all felt super cool and innovative to me. The research showed that nobody had done it before and only theory existed. Here's the thread on opl Github and the post in it that gave birth to my project. Funny thing, the thread itself was closed in 2024 as "not planned".

The coolest part is that when the idea was born, I didn't know what OPL was or that games could be launched any way other than from discs. The backstory to all this: my laser ribbon cable started scratching discs, and I wrecked almost my entire collection. I had to look for other ways to finish the games I had saves in, and for other ways to launch games in general.

After studying the whole homebrew scene I realized I had to go with the original and not base things on forks, even if the forks are cooler. I wasn't after a fancy design or anything like that, the opposite, my goal was the most stable PS2 game operation possible. Looking at the number of issues in the official OPL repo, I understood it's not all smooth, but still, I took the base OPL and started modifying it. I have a lot of development experience, I fully understood the project's architecture and how everything would work.

I also studied the problems my modification might cause on the console, because I was afraid of straight-up breaking it. But that's the beauty of this old hardware: it stores nothing. Everything that runs on the console runs in its memory, and a reset (or a hard reset as a last resort) solves any problem. If the console can't do something, it just hangs. That opened up room for experiments and freedom to act.

The start of xeRAbora

So I sat down with the agent to think over that comment from the thread. Turned out everything written there was exactly what was needed. With a few rough edges maybe, but that's exactly how xeRAbora works.

Since PS2 hardware is very weak, cramming all the achievement processing and RA sync logic into it most likely won't work. So we decided right away: the hardware runs only the part that reads memory, and all the heavy logic lives in the client on the PC.

How it works on the hardware

The PS2 runs a custom OPL build, the PC runs the client. From there:

  1. Once per game, in the OPL menu, hit "RA: check game support". The console hashes the image the way RA does and asks the client. The client fetches the achievement set from the RA server, works out which memory addresses to watch, and sends the console the list.
  2. Launch the game. Every frame the console reads those addresses and sends snapshots over UDP. The client runs rcheevos on them, the same library emulators use.
  3. An achievement triggers: the client sends the unlock to RA and signals the console, which draws the flash on the TV.

setup client

Where the image comes from doesn't matter, as long as it's an ISO. PS1 is the same thing, just through POPStarter.

Along the way the client shows the current hardware state and all sorts of cool meta straight from the console: how many snapshots per second arrive, how many got lost, how many the console skipped.
hardware state

What's already been reworked in the OPL build
Besides RA itself, the OPL build got the things it couldn't live without:

  • stability in games with in-game reset (Mode 6);
  • a RESET CONSOLE button in the client;
  • an RA mark on the game cover, so you can see which games have a set;
  • the "RA: check game support" and "RA: test PC connection" menu items.

What's planned

  • ZSO. ISO only for now, compressed ZSO images aren't supported yet.
  • Ember. It's an alternative to POPStarter for PS1, I want to support it as well.

xeRAbora without a PS2: a companion for emulators

RA companion for emulators

I still play on emulators myself, and for a long time I wanted some kind of RA helper that guides you through a set instead of just showing a list. So I dug into the RA API and found a few cool things there that the emulators themselves don't have.

The client works without a console too, straight against the RA API. It follows your account (polling every 20 seconds) and shows:

  • the current game and what just dropped in it;
  • UP NEXT: what to go for next, sliced different ways. By developer order, by median, by average time to earn an achievement, to beat the game and to master it;
  • missable warnings, so you don't have to replay;
  • your library and leaderboards.

There's one difference from the PS2 mode: with the console, xeRAbora evaluates the rules itself and sees "3 of 10" progress and live leaderboard trackers. With an emulator, the emulator does the unlocking and the client learns about it through the API, so there's no measured progress there.

For streamers

streamers

streamers 8 bit theme

A separate STREAM screen for OBS: current game, recent unlocks, set progress, rarity and RetroPoints. Two styles, NEON CLASSIC and 8-BIT. Works both with the PS2 and in companion mode, so you can stream from the console or from an emulator.

How to try it

  1. Download OPL-RA.ELF and the client for your OS (or the APK for Android) from GitHub.
  2. Run OPL-RA.ELF on the console instead of regular OPL.
  3. Run the client on a PC on the same network, sign in with your RA login and paste your Web API key.
  4. On the console, hit "RA: test PC connection", then "RA: check game support" on the game you want.
  5. Launch the game. In about half a minute the console shows up on the LIVE tab.

Detailed instructions and the FAQ are on the xerabora GitPage

Where things stand

There are problems, and they're mostly with specific titles. Sly crashed because of Mode 6 (fixed), Mortal Kombat because of non-standard pointers (fixed too). Every bug like that raises both stability and coverage: fixing one game usually fixes a few similar ones. But not everything works yet.

There's a separate thread on GitHub where people share the games they've tested: . If you give it a try, post there, it helps a lot.

If you want to try it, everything is on GitHub, the instructions are on the site, questions go to Discord.

xerabora GitHub

Thank you for your attention!

Top comments (0)