Overlay format documentation?

I’m having one of those moments. I can’t find the docs on making a custom overlay. It shows a manual which mentions the ‘overlay guide’ but not the guide itself. Where’s it hiding?

OK, got it, thanks. Is there a list of valid button parameters somewhere?

edit: Just to be clear, I’m looking to open the menu when the screen is touched.

edit again: Ahh, looking at the basic_overlay, it almost looks like the in-game menu is just part of an overlay. Is that right, or is there a menu that’s accessible without overlays enabled?

Here: https://github.com/Themaister/RetroArch/blob/master/input/input_common.c#L499. Updated Wiki to reflect this.

The in-game menu is just an overlay, yes. We cycle through them with overlay_next.

I think I understand now.

My work will be like this:

Make 1024x552 transparent png for overlay0. Make 1024x552 png with menu options I want, transparent background, overlay1. Describe whole of overlay0.png as hitbox for overlay_next using overlay0_desc0. Describe menu options hitboxes of overlay1.png and include overlay_next somewhere to close the menu, this will be in overlay1_desc#.

Stuff I’m assuming:

Making the images 1024x552 (native screen size minus the menu bar) will reduce CPU needed to scale the images to fit screen. To describe the whole 1024x552 as a hitbox, I need to define it by finding the center (512x276) and making range_x and range_y also 512 and 276.* Rectangle hitboxes cannot be defined by their corners, only centers.

Hope that’s about right.

edit regarding * under assumptions: Center pixel +512 and -512 would give range of 1025. Will this be a problem? Do I need to define the box by 511 and 275, with a dead pixel around the edges to account for the non-integer center?

Hmm, I did all I said, and it doesn’t work. Other overlays show up properly, and games still work the same, but the overlay doesn’t appear when I tap the screen. I don’t know if the problem is with my images, or the scripting, or both. The images seem fine, so I guess it must be something else.

overlays = 2
overlay0_overlay = JXDMenuClosed.png
Overlay1_overlay = JXDMenuOpen.png

overlay0_full_screen = true
overlay1_full_screen = true

overlay0_descs = 1
overlay0_desc0 = "pause_toggle|overlay_next,512,276,rect,511,275"

overlay1_descs = 5
overlay1_desc0 = "save_state,140,50,rect,125,40"
overlay1_desc1 = "load_state,870,50,rect,150,40"
overlay1_desc2 = "state_slot_decrease,141,261,rect,120,40"
overlay1_desc3 = "state_slot_increase,865,261,rect,120,40"
overlay1_desc4 = "pause_toggle|overlay_next,512,462,rect,350,50"

Does that look workable? I also tried it without the pause_toggle and it also didn’t work.

Overlay1_overlay = JXDMenuOpen.png Is capitalized. Can’t have that :stuck_out_tongue: I guess overlay loading errors out in the log somewhere. Other than that, it looks like it should work. Haven’t tested pausing before like that, but it should work I guess.

Hmm, fixed that, still won’t work.

Found something in logs,

RetroArch [ERROR] Failed to load config file: /data/data/org.retroarch/cache/Overlays/JXD_S7300_Menu.cfg. RetroArch [ERROR] Failed to load overlay.

Don’t suppose it could be because I made the .cfg in Windows Notepad then copied it to the device…

Sorry to keep posting on top of myself, but I think there might be some kind of bug going on and it’s getting weird.

I changed one of the included overlay .cfg files to point to my own image instead of the default. The overlay stopped working. I changed it back to point to the original image for that overlay, and it still didn’t work. Other overlays still work, as long as I haven’t edited the .cfg in any way. Makes no sense to me, since I changed the file back to what it was before, but that’s what’s happening.

It gives the same message in the log as above, except it’s psx-landscape.cfg failing to load, rather than my custom overlay.

edit: I just went in to basic_overlay.cfg, added a space, backspaced it, saved the file, and that was enough to make the overlay stop loading. Permissions didn’t change, encoding didn’t change, the file seems to be exactly the same, but the overlay no longer loads. I’m stumped.

If you’re using Notepad, try using Notepad++ instead. I’ve seen regular Notepad break things before.

Used ES file editor with EOL encoding set to both DOS and UNIX it breaks either way.

Anyone able to repro?

edit: Also, is there a more verbose logging option? Seeing ‘failed to load’ doesn’t help much :slight_smile:

True. There isn’t much debugging logs for overlay yet. It’s something I will add later. It might be helpful if you go through it with a debugger or add lots of printf’s yourself for now.

Just for repro/sanity purposes, can anyone else try changing and saving an overlay.cfg file and see if the overlay still works?

Also useful if you could post the exact file that fails, so we can test as well.

Also useful if you could post the exact file that fails, so we can test as well.[/quote]

They all do. Just open any of the overlay.cfg files, make any change (add a letter then backspace it even) then save the file. That’s enough to break an overlay on my install.

Even with exact same file contents, they fail to load after being saved again. It’s almost like a checksum (which includes file time/date) is failing or something.

I added some more error logging: https://github.com/Themaister/RetroArch/commit/bdabb39eb6d6b4f215ffc6606cccecb5d9f48b73

Are you trying to save directly into retroarch’s cache directory? That could have some permissions issues (RetroArch might not be able to open it, but just guessing. How are you able to edit files there anyways?

Yah, saving to the cache directory… I thought that’s where overlays lived, based on what I saw in a thread around here somewhere. I’m able to edit files there because my device is rooted :slight_smile:

edit: This thread: http://forum.themaister.net/viewtopic.php?id=298

I don’t build my own retroarch, is the updated more verbose logging available if I update through play store? Or does it even matter, bearing in mind the pathing mantioned above?

Not sure if Square updated on playstore last night. Anyways, overwriting stuff in /data/data/org.retroarch/* might cause some permissions issues which makes RetroArch unable to load the saved file. That’s all I can think of. Also, you don’t necessarily have to save it in /data/data. You can save it to your sdcard and load overlays from there. The browser just starts in the overlays folder inside /data/data.

I haven’t rooted my phone, so I can’t test that specific issue. Still, have you verified that the files are actually perfectly equal with a checksum?

Well, putting the overlay and image files on the SD card helped, it loads the overlay. Now there’s a new set of issues :slight_smile:

When pause_toggle is used as the first command, it definitely pauses, but it pauses everything, including the overlay, so the overlay_next doesn’t ever execute and there’s no way to unpause. Option to pause emulation but letting overlay continue would be great.

I removed the pause toggles to test the actual menu, and it opens as expected, but it carries the opening input over from the initial touch that opened the menu. Like, if you tap the screen where the ‘save’ button of the menu is, it will save, even though that function is not part of overlay 0 (overlay 0 is just a blank image that opens the overlay 1 when touched anywhere). Oddly enough, it does not happen when tapping ‘exit menu’ to go back to overlay 0, even though the whole screen is a hitbox in overlay 0.

I’d suggest giving the option to set a time for desensitizing hitboxes, if it’s not too much trouble to implement.

Like this:

overlays = 2
overlay0_overlay = JXDMenuClosed.png
overlay1_overlay = JXDMenuOpen.png

overlay0_full_screen = true
overlay1_full_screen = true

overlay0_descs = 1
overlay0_desc0 = "overlay_next,512,276,rect,511,275"

overlay1_descs = 5
overlay1_hitboxes_active_delay = 500
overlay1_desc0 = "save_state,140,50,rect,125,40"
overlay1_desc1 = "load_state,870,50,rect,150,40"
overlay1_desc2 = "state_slot_decrease,141,261,rect,120,40"
overlay1_desc3 = "state_slot_increase,865,261,rect,120,40"
overlay1_desc4 = "overlay_next,512,462,rect,350,50"

Parameter in milliseconds.