Author Topic: Opening Display to first game in a romlist  (Read 4801 times)

spud1

  • Full Member
  • ***
  • Posts: 40
    • View Profile
Opening Display to first game in a romlist
« on: October 17, 2018, 11:33:54 PM »
Hi.  Is there a way of making sure every time a Display opens, it opens to the first game listed at the top of a Romlist?

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: Opening Display to first game in a romlist
« Reply #1 on: October 19, 2018, 04:21:03 PM »
yes their is,,  what you do is before you exit go back to the first game :P

sorry thats all iv got..and it sucks i know!
help a friend....

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: Opening Display to first game in a romlist
« Reply #2 on: October 19, 2018, 05:12:36 PM »
Easy enough to create a plugin to do this. Transition to new list make index zero.

spud1

  • Full Member
  • ***
  • Posts: 40
    • View Profile
Re: Opening Display to first game in a romlist
« Reply #3 on: October 20, 2018, 03:48:09 PM »
Thanks, guys. 

I haven't got very far on this, as I'm not certain how to show "index = 0".

Code: [Select]
// This plugin ensures that when a Display is opened, the first game in the romlist is in focus
fe.add_transition_callback( "first_game" );
function first_game( ttype, var, ttime )
{
 switch ( ttype )
 {
  case Transition.ToNewList:
          index = 0     
        return false;
}}

I only really want to do this with one layout.  Once I've got the plugin sorted, can I add the same code just to one layout.nut and it should work?


rand0m

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
Re: Opening Display to first game in a romlist
« Reply #5 on: October 21, 2018, 01:43:11 AM »
My understanding was that "index = 0" means item being currently highlighted (in selection) so +1 or -1 would mean item above and below the selected item respectively. Wouldn't "index = 0" simply keep the selection at the same item which is currently highlighted without plugin?

spud1

  • Full Member
  • ***
  • Posts: 40
    • View Profile
Re: Opening Display to first game in a romlist
« Reply #6 on: October 21, 2018, 03:42:58 PM »
Thanks keilmillerjr.  Works perfectly:

Code: [Select]
// This plugin ensures that when a Display is opened, the first game in the romlist is in focus
fe.add_transition_callback( "first_game" );
function first_game( ttype, var, ttime )
{
 switch ( ttype )
 {
  case Transition.ToNewList:
          fe.list.index = 0     
        return false;
}}

I've added it to the bottom of my layout in layout.nut and it does what I want it to do.



keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: Opening Display to first game in a romlist
« Reply #7 on: October 22, 2018, 02:27:55 AM »
My understanding was that "index = 0" means item being currently highlighted (in selection) so +1 or -1 would mean item above and below the selected item respectively. Wouldn't "index = 0" simply keep the selection at the same item which is currently highlighted without plugin?

“Index” in reference to list is an array. Other instances where you see “index” can be a relative position to selected game.

Glad it worked. :)

Steven Campoli

  • Guest
Re: Opening Display to first game in a romlist
« Reply #8 on: October 28, 2018, 07:54:24 PM »
Attract.am
Edit this file... change all numbers to 0
Save the file
Edit the permissions to read only...gonna work
For sure....

U have to make it Read only because if not it won’t go back to 0 the next time u start

progets

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1271
    • View Profile
Re: Opening Display to first game in a romlist
« Reply #9 on: October 28, 2018, 11:03:55 PM »
Attract.am
Edit this file... change all numbers to 0
Save the file
Edit the permissions to read only...gonna work
For sure....

U have to make it Read only because if not it won’t go back to 0 the next time u start

Interesting idea. How did you come up with it? What do all of these numbers mean? Can you please explain the format of the file? Will setting every number to "0" or making it read only effect other parts of AttractMode?

Steven Campoli

  • Guest
Re: Opening Display to first game in a romlist
« Reply #10 on: October 29, 2018, 07:50:11 AM »
Attract.am
Edit this file... change all numbers to 0
Save the file
Edit the permissions to read only...gonna work
For sure....

U have to make it Read only because if not it won’t go back to 0 the next time u start

Interesting idea. How did you come up with it? What do all of these numbers mean? Can you please explain the format of the file? Will setting every number to "0" or making it read only effect other parts of AttractMode?

U told me this lol! I only changed the file to read only so none of the numbers change.
The first number on file is the default emulator display when launching am. The other rows under are the emulators. If see on row 2 ... 11,0.... that means emulator 1 was left off on game 11...

The only thing it will affect having it read only is when changing a layout. The next time am is launched it will be back to what it was in the read only
File.... so if u wanna change a layout just put the file to full
Control.... make your changes the  make it read only...
« Last Edit: October 29, 2018, 08:07:32 AM by Steven Campoli »