Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: FrizzleFried on January 29, 2019, 08:00:31 AM

Title: Layout To Load Other Layouts
Post by: FrizzleFried on January 29, 2019, 08:00:31 AM
I am almost sure this has been asked and answered before,  but my SearchFu stinks and I can't find it.

I would like to create a layout that has a menu of other layouts of which to choose from.  When choosing,  it would load the other layout,  but with the ability to exit back to the first (or re-load the first)...

Currently I have a dedicated button that switches between themed layouts... but it would be nice to have a centralized menu to choose,  for example "Daphne, CPS1, CPS2, IREM" etc... which would load each individual layout... then just a button to switch back to the initial menu.

I believe categories work this way,  but I do NOT want to have to modify/edit my romlists,  which I do believe is a requirement to use categories.

I imagine I would need code to load the other menus and then a small but of code that I would have to add to each of my "themed" layouts to load the main menu back?

Ideas?
Title: Re: Layout To Load Other Layouts
Post by: rand0m on January 29, 2019, 09:48:24 PM
1- Displaymenu does function in this manner A (select) will load the layout and B(escape/ cancel) will take you back one level to Displaymenu.

2- For CPS1/ CPS2 etc you can exclude the titles from mame romlist filter (i.e. manufacturer not contains/ equal CPS etc) while pointing them to filters of required systems (i.e.for CPS2, manufacturer contains CPS2) - This will keep your romlist intact, doing all the work through filters. So e.g. CPS will display only CPS titles, CPS2 will only display CPS2 and so on. Or u can display all titles in mame and also separately (rule of thumb is to have one title display only once unless using collections)

It prolly sounds more complicated then it is :D

 
Title: Re: Layout To Load Other Layouts
Post by: FrizzleFried on January 30, 2019, 06:43:09 AM
I am at a loss as to where I can find the code for displaymenu?


I am assuming you're referring to the actual code for poking through and adding displays,  emulators, etc?


Any idea where I can find this code?
Title: Re: Layout To Load Other Layouts
Post by: rand0m on January 30, 2019, 07:18:58 AM
DisplaysMenu is inbuilt into AM

1) Go to AM > Settings > Startup Mode > select 'Displays Menu'

2) Then go to AM > Settings > Displays > 'Displays Menu' Options > Menu Style (select layout) select some other layout/ theme then your main.

Now you can change the look/ feel/ code of layout theme for Displays Menu - your systems will be listed here and will operate in the manner you listed above in opening post. displaysmenu will list all systems in attract.cfg, there is some other fine tuning but that can wait.

PS: I got a working displaysmenu in here (only the last part, sega saturn is a different layout): https://www.youtube.com/watch?v=cEAhZQLsCho 

PS: I think like me you mix-up between displaysmenu and displaymenu too :D
Title: Re: Layout To Load Other Layouts
Post by: FrizzleFried on January 30, 2019, 08:47:09 AM
Hmmm... following your instructions and just changing startup to DISPLAYS MENU and then changing the DISPLAYS MENU to one of my themes (working) to test...

...I now load,  get attract mode video,  then crash to desktop.

:(

Title: Re: Layout To Load Other Layouts
Post by: FrizzleFried on January 30, 2019, 08:49:24 AM
I modified the cfg file and changed to Attrac-man... it now doesn't crash,  but none of the 4 displays I have setup are showing up in attrac-man.

Could I setup a layout using do_nut to load other layouts?  But how to list the current list of displays though...

Hmmm...

Title: Re: Layout To Load Other Layouts
Post by: FrizzleFried on January 30, 2019, 08:51:54 AM
This may help...

...I want to do something similar to this:

https://vimeo.com/282042530

I'd like to setup a dedicated PAC screen/layout.... a dedicated CPS1.... a dedicated Galaga... like you see in the video...

Title: Re: Layout To Load Other Layouts
Post by: rand0m on January 30, 2019, 08:00:47 PM
1- In your attrcat.cfg, systems should be listed like this:
Code: [Select]
display Atari 2600 (Stella)
layout               Chicuelo-WIP
romlist              Atari 2600 (Stella)
in_cycle             yes
in_menu              no
filter               ALL
sort_by              Title
If the parts about in_cycle and in_menu are missing then add them (please make a backup of attrcat.cfg before that) and check.

2- In the video, looks like collections are being used, you can do that in two ways. DisplaysMenu and using Tags/Displays. Displays Menu is discussed ^ For tags/Displays you have to:

a) Open MAME and create a tag on any CPSI game (Tags control can be Configured from AM > Controls). Tag can be named anything, lets name it CPSI. This will create a file in AM\Romlists\[MAME]\CPSI.tag. Opening this file will show you the [NAME] of file you created tag for.

b) go to AM > Displays > Add new dsiplay > Name it anything (like CPSI). Then fill the rest of details, in Collection/Romlist Select your main MAME romlist (exactly as you have named it - as it is in AM\romlists\[MAME].txt). In global filter > rule > Target = Tags, Comparison = contains, Filter Value = CPSI.

c) This should create a new Display CPSI, which will list a single game you tagged. If the game is there and display is working as expected you can use an app like romlister to make txt files of all CPSI titles (or get a list from internet) the .tag file only lists a single [NAME] in single line. If you like the results you can add the rest of displays following the same method.
 
Title: Re: Layout To Load Other Layouts
Post by: progets on January 30, 2019, 08:40:17 PM
1- In your attrcat.cfg, systems should be listed like this:
Code: [Select]
display Atari 2600 (Stella)
layout               Chicuelo-WIP
romlist              Atari 2600 (Stella)
in_cycle             yes
in_menu              no
filter               ALL
sort_by              Title
If the parts about in_cycle and in_menu are missing then add them (please make a backup of attrcat.cfg before that) and check.

2- In the video, looks like collections are being used, you can do that in two ways. DisplaysMenu and using Tags/Displays. Displays Menu is discussed ^ For tags/Displays you have to:

a) Open MAME and create a tag on any CPSI game (Tags control can be Configured from AM > Controls). Tag can be named anything, lets name it CPSI. This will create a file in AM\Romlists\[MAME]\CPSI.tag. Opening this file will show you the [NAME] of file you created tag for.

b) go to AM > Displays > Add new dsiplay > Name it anything (like CPSI). Then fill the rest of details, in Collection/Romlist Select your main MAME romlist (exactly as you have named it - as it is in AM\romlists\[MAME].txt). In global filter > rule > Target = Tags, Comparison = contains, Filter Value = CPSI.

c) This should create a new Display CPSI, which will list a single game you tagged. If the game is there and display is working as expected you can use an app like romlister to make txt files of all CPSI titles (or get a list from internet) the .tag file only lists a single [NAME] in single line. If you like the results you can add the rest of displays following the same method.

rand0m is correct about this being the correct/best/easiest way to get your desired function without reinventing the wheel. Depending on what you want you might also need to manually create your romlists for the submenus.

This thread might help you understand it better but it's old and the plugin mentioned there isn't needed since it's now built into Attract Mode http://forum.attractmode.org/index.php?topic=1804.msg12653#msg12653 (http://forum.attractmode.org/index.php?topic=1804.msg12653#msg12653)
Title: Re: Layout To Load Other Layouts
Post by: gunthermic on January 30, 2019, 11:31:35 PM
DisplaysMenu is inbuilt into AM

1) Go to AM > Settings > Startup Mode > select 'Displays Menu'

2) Then go to AM > Settings > Displays > 'Displays Menu' Options > Menu Style (select layout) select some other layout/ theme then your main.

Now you can change the look/ feel/ code of layout theme for Displays Menu - your systems will be listed here and will operate in the manner you listed above in opening post. displaysmenu will list all systems in attract.cfg, there is some other fine tuning but that can wait.

PS: I got a working displaysmenu in here (only the last part, sega saturn is a different layout): https://www.youtube.com/watch?v=cEAhZQLsCho 

PS: I think like me you mix-up between displaysmenu and displaymenu too :D

I have tried this on the ARpiCADE on my PI3B, and it never changes the DisplayMenu.. I change to all other kinds of themes(layouts) and it never changes.
Title: Re: Layout To Load Other Layouts
Post by: rand0m on January 31, 2019, 03:41:09 AM
DisplaysMenu is inbuilt into AM

1) Go to AM > Settings > Startup Mode > select 'Displays Menu'

2) Then go to AM > Settings > Displays > 'Displays Menu' Options > Menu Style (select layout) select some other layout/ theme then your main.

Now you can change the look/ feel/ code of layout theme for Displays Menu - your systems will be listed here and will operate in the manner you listed above in opening post. displaysmenu will list all systems in attract.cfg, there is some other fine tuning but that can wait.

PS: I got a working displaysmenu in here (only the last part, sega saturn is a different layout): https://www.youtube.com/watch?v=cEAhZQLsCho 

PS: I think like me you mix-up between displaysmenu and displaymenu too :D

I have tried this on the ARpiCADE on my PI3B, and it never changes the DisplayMenu.. I change to all other kinds of themes(layouts) and it never changes.

That shouldn't be happening, does console register any errors (or last_run.log)
Title: Re: Layout To Load Other Layouts
Post by: progets on January 31, 2019, 12:17:43 PM
I have tried this on the ARpiCADE on my PI3B, and it never changes the DisplayMenu.. I change to all other kinds of themes(layouts) and it never changes.

Configure-->General-->Startup Mode=Show Displays Menu
Title: Re: Layout To Load Other Layouts
Post by: rand0m on February 08, 2019, 02:17:41 AM
Hmmm... following your instructions and just changing startup to DISPLAYS MENU and then changing the DISPLAYS MENU to one of my themes (working) to test...

...I now load,  get attract mode video,  then crash to desktop.

:(

I just realized that you might be missing the [Emulator] value in displaysmenu romlists. In Am/romlists/DisplaysMenu.txt the [Emulator] value for each item must be @
Title: Re: Layout To Load Other Layouts
Post by: FrizzleFried on February 08, 2019, 06:40:06 AM
Hmmm... following your instructions and just changing startup to DISPLAYS MENU and then changing the DISPLAYS MENU to one of my themes (working) to test...

...I now load,  get attract mode video,  then crash to desktop.

:(

I just realized that you might be missing the [Emulator] value in displaysmenu romlists. In Am/romlists/DisplaysMenu.txt the [Emulator] value for each item must be @

OK... things actually work ...

:)

However,  of course,  only a text NAME for each emulator comes up.  How do I assign a "snap" or "wheel" image for each emulator name?  I tried naming an image "MAME" (to match my test display name) and put it in the proper snaps folder... nope... proper marquees folder... nope...  ALSO,  how do I get BACK to the display screen once I select a display.

Thanks!
Title: Re: Layout To Load Other Layouts
Post by: FrizzleFried on February 08, 2019, 07:01:27 AM
OK... figured this out... art goes in the "menu-art" folder of AM... not the location of the emulator in question.

Now,  to figure out how to get BACK to the display screen (I'm sure it's easy...)

Title: Re: Layout To Load Other Layouts
Post by: progets on February 08, 2019, 07:29:12 AM
Escape key by default.

Configure-->Controls-->Back=<whatever_you_press>
Title: Re: Layout To Load Other Layouts
Post by: rand0m on February 08, 2019, 07:35:56 AM
you can use add_image instead of add_artwork if you want to keep all the artwork assets within /images. For snap or wheels use absolute path with [Title] or [Name]:
Code: [Select]
local sys_snap = fe.add_image (D:/path/to/image/snaps/[Title].png, #,#,#,#)
local sys_wheel = fe.add_image (D:/path/to/image/wheels/[Name].png, #,#,#,#)

This won't show placeholder when artwork is missing.

For display screen go to AM > Settings > Displays > 'Displays Menu' Options > Select Menu Style/ Layout (select theme for Displays Menu)
then go to AM > Settings > General > Startup Mode (Change to Displays Menu)

Now if [Emulator] is @ in displaymenu romlist then if DisplaysMenu has 5 items say 1,2,3,4 & 5. Item 3 has 5 items say A,B,C,D & E. If you go from 3 > D then press back it should take you to 3. That is how its working at my end.

I just saw progets answer, if you mean back key then default is Escape and mstly ppl use A for select/enter and B for back in gamepads.
Title: Re: Layout To Load Other Layouts
Post by: FrizzleFried on February 09, 2019, 05:51:39 PM
Just adding this code breaks my layout:

local sys_wheel = fe.add_image (/image/[Name].png)

I then figured I'd try to add quotes as that seems to be the syntax used throughout... and it works...

local sys_wheel = fe.add_image ( "/image/[Name].png" )

Thanks.
Title: Re: Layout To Load Other Layouts
Post by: rand0m on February 10, 2019, 02:32:27 AM
Yup, sorry should have noticed that in my example. "" are required in most cases.