Author Topic: Same Layout Different options  (Read 4099 times)

mahuti

  • Administrator
  • Sr. Member
  • *****
  • Posts: 252
    • View Profile
    • Github Repositories
Same Layout Different options
« on: March 07, 2017, 10:08:10 AM »
Is it the case that if you use a layout in 2 different displays that the layout options saved in one display carry over into the other display? That's what I'm seeing, and I did not assume that was the case when I was developing my current theme.

What I assumed was when I went to

nintendo-nes -> display-edit -> layout-options and changed the options those options would not also save for
genesis -> display-edit -> layout-options

When I change one display's layout options, it's changing the other displays as well. Is this a feature? Or flaw? Poor coding? Any thoughts?

bjose2345

  • Sr. Member
  • ****
  • Posts: 107
    • View Profile
Re: Same Layout Different options
« Reply #1 on: March 07, 2017, 11:36:42 AM »
I think it is a default behavior, since you are changing the same file even though it is being used in different emulators. If you want a any combination for each emulator it is best to copy it (the layout.nut) and put it in another folder with another name and then change the settings

mahuti

  • Administrator
  • Sr. Member
  • *****
  • Posts: 252
    • View Profile
    • Github Repositories
Re: Same Layout Different options
« Reply #2 on: March 07, 2017, 12:08:25 PM »
Sigh. Lame. Sigh

Thanks for confirming hah hah. Sigh....  :'(

bjose2345

  • Sr. Member
  • ****
  • Posts: 107
    • View Profile
Re: Same Layout Different options
« Reply #3 on: March 07, 2017, 12:27:08 PM »
Well if you have some coding skills, you could do this

switch ( fe.list.name )
{
case "Atari Lynx":
logo = fe.add_image( "atarilynx.png",   10, 22, fe.layout.width / 5, height / 5);
break;
.
.
.
case "Bandai Wonderswan Color": <<<--- try to match you emulator alias

etc,etc,etc

and in that way you could use the same layout but with another behavior for each emulator

mahuti

  • Administrator
  • Sr. Member
  • *****
  • Posts: 252
    • View Profile
    • Github Repositories
Re: Same Layout Different options
« Reply #4 on: March 07, 2017, 09:06:02 PM »
That's what I ended up doing. Something like that anyway. The trick was that I had to figure out how to reload when switching to another display. Without doing a reload you end up with the same backgrounds and variables spread across all uses.

Still looking for a little more flexibility, but I'm getting close.

bjose2345

  • Sr. Member
  • ****
  • Posts: 107
    • View Profile
Re: Same Layout Different options
« Reply #5 on: March 08, 2017, 11:56:00 AM »
Im trying to do the same, still untested but i thing you need to add

fe.add_transition_callback( this, "reload_settings" );

function reload_settings( ttype, var, ttime )
   {
            
      switch ( ttype )
      {
      
      case Transition.StartLayout:
      case Transition.FromGame:
                // your code goes here

mahuti

  • Administrator
  • Sr. Member
  • *****
  • Posts: 252
    • View Profile
    • Github Repositories
Re: Same Layout Different options
« Reply #6 on: March 08, 2017, 01:23:06 PM »
The following was the only thing that could get a full reload that I found without also putting the reload in an infinite loop.

Code: [Select]
local console = fe.list.name;
fe.add_transition_callback(this, "on_transition");
function on_transition(ttype, var, ttime) {

local last_console = console;
switch( ttype)
{
case Transition.ToNewList:
console = fe.list.name;
if (last_console != console)
{
fe.signal("reload");
}
break;
default:
console = fe.list.name;
  }
   return false;
}