New Feature: Overlays

Today’s update adds a new feature to Emulicious: Overlays

You can find this new feature in the Overlays tab at the bottom of the Debugger. It allows you to overlay information on top of the main screen. So you can for example display hitboxes or other shapes on top of your game graphics. Or display some values for debugging directly on screen.

The Overlays feature supports Emulicious’s expression language in each of its textfield columns. So you can either simply use values of variables via expressions like @playerX or more complex expressions like @(hitboxes + @playerHitboxIndex * 4 + 1). You can even make the color depend on specific conditions via something like $ff0000 * (@playerX > 100) + $00ff00 * (@playerX < 150) to use red if player’s x position is greater than 100, green if player’s x position is smaller or equal to 100 and yellow if player’s x position is between 100 (exclusive) and 150 (inclusive). The expression abuses the fact that conditions evaluate to 1 when true and 0 when false. When both conditions are true, both values get added together and form $ffff00 (yellow). If only the first condition is true, we get $ff0000 (red). If only the second condition is true, we get $00ff00 (green). If neither condition was true, we would get $000000 (black).

The Trigger column lets you choose between VBlank, PrevVBlank and Breakpoint. If VBlank is selected, the values are polled when VBlanking begins. For something like hitboxes, by the time of VBlank, the game will already have calculated the player position for the next frame but not updated VRAM accordingly. So if the game values at VBlank are used to display the hitbox, the hitbox will appear one frame ahead of what is actually visible on the screen. To solve this, the PrevVBlank Trigger uses the game values at the time of the previous frame and thus the ones matching what is currently displayed on screen.

Selecting Breakpoint here allows you to use any breakpoint as trigger for your overlay. That way you can display values from at a specific point of your program. For example it allows you to create a custom usage meter by putting a breakpoint on the beginning of your procedure waiting for vblank and use the scanline variable to determine for how many scanlines your program is going to wait until VBlank.

If you find any other creative way to use the new Overlays feature, I’m happy to read about them. 🙂

The full list of changes follows:

  • Added Overlays feature to the debugger
  • Fixed that for palette entries that span 2 bytes, values didn’t get padded to 4 digits (thanks to ISSOtm)
  • Fixed description of HDMA5 read event (thanks to ISSOtm)
  • Fixed that on Linux the Memory Editor didn’t use the correct selection color on a Linux theme (thanks to ISSOtm)
  • Fixed the Add Watchpoint option in the Expressions table (thanks to bofner)
  • Fixed MBC1M detection (thanks to ProstatePunch and PinoBatch)
  • Fixed that the „Add Expression“ text was missing on a Linux theme (thanks to bbbbbr)
  • Fixed precedence of @@ operator (thanks to badcomputer)