Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fe.filters.len and filters data not updated after display change #566

Open
zpaolo11x opened this issue May 8, 2019 · 4 comments

Comments

Projects
None yet
2 participants
@zpaolo11x
Copy link

commented May 8, 2019

I have a very basic layout like this:

fe.add_text("[Title]",0,0,1000,100)
print (fe.filters.len()+"\n")

I have a setup with three Displays, all using this layout, and the Displays Menu uses the same layout. Now when you launch AM you see in the console the number of filters, for example 8 in my "Mame" Display. If I then open the Displays Menu via hotkey on the console I get "0" filters, which is ok since Displays don't have filters.

Now if I select another Display from the menu, like "Capcom" which has 4 filters, the layout is loaded but, probably since it's the same as the Displays Menu layout, filter data is not correctly updated and I don't get any output on the console. If I have code in a layout that depends or checks the filters, this is not going to work if the same layout is used as Displays Menu layout.

@zpaolo11x

This comment has been minimized.

Copy link
Author

commented May 8, 2019

Basically here the main issue is that when you select a display from a display menu, and the display menu is using the same layout as the display, the layout is not reloaded correctly, I'd expect it to reload from scratch

@qqplayer

This comment has been minimized.

Copy link

commented May 9, 2019

I made this for other thing, can you test?

function filters_transition( ttype, var, ttime ) {
 switch ( ttype ) {
  case Transition.StartLayout:
  case Transition.ToNewSelection:
  case Transition.ToNewList:
  case Transition.EndNavigation:
       fe.add_text("[Title]",0,0,1000,100);
       print (fe.filters.len()+"\n");
       break;
  }
 return false;
}

fe.add_transition_callback( "filters_transition" );
@zpaolo11x

This comment has been minimized.

Copy link
Author

commented May 10, 2019

I made this for other thing, can you test?

I really wanted it to work, sadly it doesn't work: when I launch AM and use this as both Displays Menu layout and display layout, I get lists of 0s on the console. I only get "2" as output at the very beginning because AM first loads a display layout (with 2 filters) briefly (you can't even see it) before the displays menu layout is launched. Once the displays menu layout is engaged no matter if you change display it will still output "0" as filter length :(

@zpaolo11x

This comment has been minimized.

Copy link
Author

commented May 13, 2019

Found a couple of workaraound for this. First you need to detect if your layout is being used as Displays Menu layout, this can be done setting a variable like this:

local DISPLAYMENUON = (fe.list.display_index == -1)

Once this variable is set, you can add a line like this in your signal_callback function:


if (sig == "select"){
         if (DISPLAYMENUON){
            fe.set_display(fe.list.index)
            return true
         }
         
   }

this will force a display load (and layout reload) when someone hits "select" and the layout is used as Displays Menu. Another option would be to set a variable in the signal_callback function when "select" is used and displays menu is on, and then add a fe.reload call in the ticks_callback function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.