Author Topic: code to set_display doesn't work  (Read 1756 times)

ericball

  • Newbie
  • *
  • Posts: 6
    • View Profile
code to set_display doesn't work
« on: August 26, 2021, 05:58:23 AM »
Attract-Mode v2.6.1 running on RetroPie 4.7.1

For my barcade I have two displays: top40vert_by_year, top40vert_by_name which use my QuarterEater layout.  I have
   prev_display         Joy0 Button0
   next_display         Joy0 Button4
so P1 / P2 cycle between the two displays.  What I want to do is have P1 select the top40vert_by_year display and P2 select the top40vert_by_name display.  I added the following code to QuarterEater/layout.nut, but P1 & P2 still cycle between displays.

fe.add_signal_handler( handle_signal )

function handle_signal( signal_str )
{
  if ( ( signal_str == "prev_display" ) && ( fe.list.display_index != 0 ) ) {
    fe.set_display( 0 )
    return true
  }
  if ( ( signal_str == "next_display" ) && ( fe.list.display_index != 1 ) ) {
    fe.set_display( 1 )
    return true
  }
  return false
}

I know in theory I could use the SpecificDisplay plugin for this, but there's no simple how-to docs for the plug-in (and it seems like overkill for this simple use case).

I'm wondering if I just need to map the P1/P2 buttons to another signal (or a custom signal).