Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Arcade-TV

Pages: [1] 2
1
General / Re: Weird rom list navigation
« on: January 01, 2023, 04:44:55 PM »
I was pulling my hair over this and I wasn't able to pull off anything useful from the source code, so I made a fix with some custom squirrel code:
http://forum.attractmode.org/index.php?topic=4348.0

Hope this helps anyone struggeling with that issue.

2
Scripting / Fixing "next/prev_letter" hanging on certain titles.
« on: January 01, 2023, 04:36:53 PM »
This is my fix for AM hanging on letters when the "Title" has a different case as the previous entry, has special or numeric chars in it or other reasons as the famous "vs." or ", The" hanging.
Pre-sorting your romlists by "Title" (2nd entry in the csv file) helps.
I hope I correctly copied this from my layout file. Pls let me know otherwise.


Layout:

Code: [Select]
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Fixing next_letter / prev_letter /////////////////////////////////////////////////////////////////////////////////////

::current_signal <- "";

function setCurrentLetterIndex() {
    ::print("setCurrentLetterIndex()\n");
    ::print("list idx:"+fe.list.index+", currentLetterIndex:"+::currentLetterIndex+"\n");
    for(local i=0; i < ::letterIndexes.len(); i++) {
        if(::letterIndexes[i] >= fe.list.index) {
            ::currentLetterIndex = i-1;
            return;
        }
    }
    ::currentLetterIndex = (::letterIndexes.len()-1);
}

function buildLettersArray() {
    ::print("CurrentList: "+fe.list.index+" of "+fe.list.size+"\n");
    ::currentLetterIndex <- 0;
    local list_size = fe.list.size;
    local g;
    ::letterIndexes <- [];
    local l_prevLetter = "";
    for(g = 0; g < list_size; g++) {
        local l_gameTitle = fe.game_info( Info.Title, g-fe.list.index );
        local l_gameLetter = l_gameTitle.slice(0, 1);
        l_gameLetter = l_gameLetter.tolower();
        // declare any other char than a-z as numeric:
        if(l_gameLetter != "a" && l_gameLetter != "b" && l_gameLetter != "c" && l_gameLetter != "d" && l_gameLetter != "e" && l_gameLetter != "f" && l_gameLetter != "g" && l_gameLetter != "h" && l_gameLetter != "i" && l_gameLetter != "j" && l_gameLetter != "k" && l_gameLetter != "l" && l_gameLetter != "m" && l_gameLetter != "n" && l_gameLetter != "o" && l_gameLetter != "p" && l_gameLetter != "q" && l_gameLetter != "r" && l_gameLetter != "s" && l_gameLetter != "t" && l_gameLetter != "u" && l_gameLetter != "v" && l_gameLetter != "w" && l_gameLetter != "x" && l_gameLetter != "y" && l_gameLetter != "z") {
            l_gameLetter = "0";
        }
        // fill letterIndexes array:
        if(l_prevLetter != l_gameLetter) {
            ::letterIndexes.push(g-1);
            l_prevLetter = l_gameLetter;
            ::print(l_gameLetter+": "+g+"\n");
        }
    }
    setCurrentLetterIndex();
}
buildLettersArray();

::print("::currentLetterIndex: "+::currentLetterIndex+"\n");

function prevLetter() {
    if(::currentLetterIndex == 0) {
        ::currentLetterIndex = ::letterIndexes.len()-1;
    }else{
        ::currentLetterIndex--;
    }
    jumpToLetter("prev");
}

function nextLetter() {
    if(::currentLetterIndex >= ::letterIndexes.len()-1) {
        ::currentLetterIndex = 0;
    }else{
        ::currentLetterIndex++;
    }
    jumpToLetter("next");
}

function jumpToLetter(dir) {
    switch(dir) {
        case "next":
            fe.list.index = ::letterIndexes[::currentLetterIndex]+1;
            break;

        case "prev":
            fe.list.index = ::letterIndexes[::currentLetterIndex+1];
            break;
    }
}

Transition Callback:

Code: [Select]
function transition_callback(ttype, var, ttime)
{
    switch ( ttype )
    {
        case Transition.ToNewList:
            buildLettersArray();
            break;

        case Transition.EndNavigation:
            switch (::current_signal) {

                case "prev_letter":
                    setCurrentLetterIndex();
                    break;

                case "next_letter":
                    setCurrentLetterIndex();
                    break;

                case "prev_game":
                    setCurrentLetterIndex();
                    break;

                case "next_game":
                    setCurrentLetterIndex();
                    break;
            }
            break;
    }

    return false;
}

fe.add_transition_callback("transition_callback" );



onSignal:

Code: [Select]
function on_signal(str) {
   
if (str != "") {
::current_signal <- str;
    }

    case "prev_letter":
        prevLetter();
        return true;
        break;

    case "next_letter":
        nextLetter();
        return true;
        break;

    return false;
}

fe.add_signal_handler(this, "on_signal");


3
Scripting / Re: Diving into squirrel-scripting: some questions
« on: February 05, 2019, 06:39:23 AM »
I think I managed to get rid of the screensaver by disabling DPMS with "xset":

Check for any blanking, screensaver, timeouts and DPMS (Energy Star) with
Code: [Select]
xset q

Disable DPMS:
Code: [Select]
xset -dpms

Don't forget to add these to a script and execute it on startup.

4
Scripting / Re: Diving into squirrel-scripting: some questions
« on: February 04, 2019, 03:51:34 AM »
I have decided to use 2 layouts, one for menu and one for lists.
Now, if I wanted to return from a display straight into the last viewed system I need to fill and read a global variable.

In my menu layout:

Code: [Select]
if(::last_display_index){
    jumpToSystem(::last_display_index);
}else{
    jumpToSystem(0);
}

and in the Emulator/List layout:

Code: [Select]
::last_display_index = fe.list.display_index;

This kind of declaration must be wrong, because I always get "The index last_display_index does not exist."[/s]


edit:
The solution to this was rather simple...

Code: [Select]
local sys_index = fe.list.index;
local sys_index_name = fe.displays[sys_index].name;
my "sys_index" controlls the system to show.

5
Scripting / Re: Diving into squirrel-scripting: some questions
« on: February 04, 2019, 12:58:29 AM »
Unfortunately I already tried every grub-related solution prior to my post and none of those work for me.
Must be something related to X, I dunno.


6
Scripting / Re: Diving into squirrel-scripting: some questions
« on: February 03, 2019, 05:01:00 AM »
What distro are you using?

Ubuntu Server 18.04 LTS

7
Scripting / Re: Diving into squirrel-scripting: some questions
« on: February 03, 2019, 12:33:05 AM »
Not sure what a screen blank is.

or a console-blanking, when the screen turns off - a screensaver.
as I said I already went for the grub-option but it's not working.

RetroArch has some kind of disabling that works a charm...

8
General / Voice-over for layouts
« on: February 02, 2019, 06:43:42 PM »
I'd like to share this set of voices I made while experimenting with Attract Mode layouts...

https://www.dropbox.com/sh/f3zb52qsuqmbuhp/AAAUgWOYdzGg7X6tHgWJvEFta?dl=0


Maybe someone finds this useful.

9
Scripting / Re: Diving into squirrel-scripting: some questions
« on: February 02, 2019, 06:40:05 PM »
Is there a opposite method for add_x? Like remove_image and remove_artwork?

Also, I see that the base for positioning a video is top/left. Could it be that this is different for images?
When I do
Code: [Select]
fe.add_image("myImage.extension", 0, 0, layout_with/2, layout_height/2);it looks like the horizontal center is off to the left...

I'm still struggeling to disable the screen blank in AttractMode.

10
Scripting / Re: Diving into squirrel-scripting: some questions
« on: February 01, 2019, 02:07:54 AM »
Another day - another question...

When I create a surface to "group"  images that are aligned horizontally,
must it be the exact size of the layout?

I'm asking because when I create a surface that is 10x wider than the layout it just disappears...

11
Scripting / Re: Diving into squirrel-scripting: some questions
« on: January 31, 2019, 12:38:13 PM »
I had the same solution, but without the "::" (What does it mean?)

But it doesn't seem to work:
Script Error in /opt/retropie/configs/all/attractmode/layouts/012019-menu/layout.nut - the index 'sys1' does not exist

edit:
ha! Got the solution here: https://developer.valvesoftware.com/wiki/Squirrel#Tables

The assignment outside a table has to be a key/value pattern with "<-" instead of an equal-sign :-)

Thanks!

12
Scripting / Re: Diving into squirrel-scripting: some questions
« on: January 31, 2019, 11:35:11 AM »
I'm looking for an elegant way to create this by the number of displays with a loop:

Code: [Select]
::OBJECTS <- {
sys0 = "",
sys1 = "",
sys2 = "",
sys3 = "",
sys4 = "",
sys5 = "",
sys6 = "",
sys7 = "",
sys8 = "",
sys9 = "",
sys10 = "",
sys11 = "",
sys12 = ""
}


13
Scripting / Re: Diving into squirrel-scripting: some questions
« on: January 31, 2019, 03:14:10 AM »
It's coming together.. bit by bit, thanks guys!

Is there a way to prevent AM from jumping into another Display when I hit left or right in the "Displays Menu"?
I'd like to do custom stuff when up/down/left/right is pressed and I can't find a way to unbind the default signals/actions.


edit:
I think I solved this one...
I'll post my code when it's ready.

14
Scripting / Re: Diving into squirrel-scripting: some questions
« on: January 30, 2019, 08:25:46 AM »
With your help I already sorted some problmens I had out, thanks!

Is there a way to re-assign the signals or the way a listbox is navigated?

I'd like to have a horizontal control scheme on start in the displays-menu, then a classical list - a bit like EmulationStation works.
My idea is to position a list and set it to ".visible = false", then animating the system-logos on a horizontal line.
Now I guess I just need to tell the list it has to react to "left/right" instead of "up/down" by manipulating the default signals...?





Is there something like dynamic assignment?

In other languages this might work:

Code: [Select]
array = {1,2,3,4,5};
which_element = "element_" + array[0];
which_element.animate(); // -> should be the same as: element_1

or like this

Code: [Select]
for(i=0;i<10;i++){
    ["element"+i].doSomething;
}

in other words: is there a way to make up an object's name out of a string + a variable and then do something with it?

15
Scripting / Re: Diving into squirrel-scripting: some questions
« on: January 30, 2019, 04:37:46 AM »
Another thing that I can't sort out is the screensaver.
I'm on Ubuntu Server 18.04 LTS and already added the console blanking command to my grub file.
In RetroArch, when a game is running the screen will stay on forever, but in Attract Mode it blanks after a short time.

I dunno how it's done in RA but I'd love to disable any (system-)screen blanking or screensaver for good.
(this is not related to AM-screensaver)

If anybody has an idea, I'd love to hear it.

Pages: [1] 2