Skip to main content

Implementation Support

All the export features can be added to any emulator runtime, here is a small briefing of how each of these is implemented on the engine.

Reading / Writing from tbceState

This is the simplest method, it's adjusted so it can work with pretty much every single emulator that can read/write from memory.
It also allows for implementations using RetroAchievement toolchains without direct access to the emulator source code.

Achievements

Unlocking an achievement, sets a specific variable in memory that is set with the achievement id.
The best way to find it is getting the symbols address for tbceState, then read 7 bytes after. This variable has u8 size, so the only thing needed is to read the position and when it's not zero, unlock the achievement that matches that number.
Once it has a non zero value, we recommend setting it back to zero.

Platform Detection

The emulator runtime sets a variable every frame depending on the state.
The best way to find it is getting the symbols address for tbceState, then write 6 bytes after.

The possible options you can write are:

  • 0: Generic emulator / Real hardware
  • 1: Steam
  • 2: Android
  • 3: iOS
  • 4: Nintendo Switch
  • 5: PS4
  • 6: PS5
  • 7: XBOX ONE
  • 8: XBOX SERIES X/S

It's recommended to implement this so the tutorials can easily be swapped depending on the target platform.

VDP registers

This method is more low level for more advanced features that require work editing the emulator itself and / or the runtime.
They rely on writing different values to the VDP register 26.

Toggle Wide Screen Mode

This is managed by the values 0 and 1.
VDP register 26 will get a value of 0 when it needs to be set to OFF and a value of 1 to be set to ON.

Toggle Fullscreen Mode

This is managed by the values 2 and 3.
VDP register 26 will get a value of 2 when it needs to be set to OFF and a value of 3 to be set to ON.

Toggle CRT Effect

This is managed by the values 4 and 5.
VDP register 26 will get a value of 4 when it needs to be set to OFF and a value of 5 to be set to ON.

Close Game Request

This is managed by the value 6.
VDP register 26 will get a value of 6 when a closing request has been issued.

Toggle 4:3 Window

This is managed by the values 7 and 8.
VDP register 26 will get a value of 7 when it needs to be set to OFF and a value of 8 to be set to ON.

Toggle Enhanced Mode

This is managed by the values 9 and 10.
VDP register 26 will get a value of 9 when it needs to be set to OFF and a value of 10 to be set to ON.

Toggle Rewind

This is managed by the values 11 and 12.
VDP register 26 will get a value of 11 when it needs to be set to OFF and a value of 12 to be set to ON.

Notify Game Completed

This is managed by the value 13.
VDP register 26 will get a value of 13 when a Game Completed notification has been issued.