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 - Dal1980

Pages: 1 2 [3] 4
31
keilmillerjr, You may have an idea on how to do this better but sharing it on a forum is the whole point of the forum!

Or should the world just PM you?  :o

Welcome to the Forums where people meet up and PM solutions

32
Scripting / Re: ScrollingText module
« on: June 27, 2018, 03:02:21 PM »
Don't know if this helps but I ended up having an annoying problem with sending values created from functions over to the scrollingtext. It would either cull any text after the function call even if I had stored the value in a variable before including it in the string or stop all other variables from being populated and somehow write over existing string with a populated value much like how the insert key works on the keyboard. My only guess was that it picked up a new line "/n" or carriage return "/r" (which doesn't explain everything anyway) somewhere but even after sanitising data it still seemed to be an issue. I ended up leaving it alone and just working around the problem.

Code: [Select]
    //function simpleCat just spits out the first cat name from catver.ini
    function simpleCat( ioffset ) {
      local m = fe.game_info(Info.Category, ioffset);
      return split( m, " / " )[0];
    }

    local txtMarquee = "*** [Title] *** Manufactured by [Manufacturer] in [Year] *** Listed Category: [!simpleCat]";
    local scroller = ScrollingText.add( txtMarquee + " ***", flw*0.450, flh*0.001, flw*0.370, flh*0.055 );

    //the above produces something like the following
    //*** A game title *** Manufactured by SomeCo in 1980 *** Listed Category: Sports
    //notice even concatenating the extra 3 **** at the end does not show

    //but if I do this
    local txtMarquee = "*** [Title] *** Listed as [!simpleCat] and Manufactured by [Manufacturer] in [Year] *** Insert Coin";
    local scroller = ScrollingText.add( txtMarquee + " ***", flw*0.450, flh*0.001, flw*0.370, flh*0.055 );
    //I get weird results
    //*** A game title *** Listed as Sportsufactured by in *** Insert Coin ***
    //I've lost my [Manufacturer] and [Year] magic tokens


I don't think this will be a fix in your script, you may need to start pulling the scrollingtext module apart. Maybe someone could shed some light on this but for me I went with a cheap workaround for now.

33
Code: [Select]
//
// Attract-Mode Front-End - "Basic" sample layout
//
fe.layout.width=1280;
fe.layout.height=720;

local _f = null;
local _blb = null;
local binChar = null;
local curChar = null;
local tempArray = [];
local fileEntry = "";
local myFileIDs = [];
local myFileValues = [];
local lockLine = false;

_f = file( "c:/zombie1/emu/attract/layouts/hello-nintendo/1.txt", "r" );


_blb = _f.readblob( 100000 ); //pulls in 10,000 characters <- lazy way of setting the limit for read in
for(local i = 0; i < _blb.len(); i++){ 
    binChar = _blb.readn( 'b' );
    curChar = binChar.tochar();
    if(curChar == "#") lockLine = true;
    if(curChar == "\n") lockLine = false;
   
    if(!lockLine){
        if(curChar != "," && curChar != "\n" && curChar != "\r") fileEntry += curChar;
       
        if(curChar == "\n"){
            if(fileEntry != "" && fileEntry != " "){
              myFileValues.push(fileEntry);
              fileEntry = "";
            }
        }
    }
}

local l = fe.add_text( myFileValues[0], 100, 100, 290, 56 );
local l2 = fe.add_text( myFileValues[1], 100, 150, 290, 56 );
local l3 = fe.add_text( myFileValues[2], 100, 200, 290, 56 );
local l4 = fe.add_text( myFileValues[3], 100, 250, 290, 56 );





34
I'm not sure what you want to achieve but this should be a leap in the right direction for you

filename should be 1.ini
Comments allowed using # symbol and make sure you press return at the end of the last line otherwise the last entry my not be picked up.
You can add as many lines as you want.

Code: [Select]
aaaaaa=Something here
bbbbbb=Another thing here
cccccc=A test title here
dddddd=And now for something completely different



Code: [Select]
local flw = fe.layout.width;
local flh = fe.layout.height;
local bg1 = fe.add_text( "", 0, 0, flw, flh).set_bg_rgb( 255, 0, 14)

local _f = null;
local _blb = null;
local binChar = null;
local curChar = null;
local tempArray = [];
local fileEntry = "";
local myFileIDs = [];
local myFileValues = [];
local lockLine = false; //used for comment handling


////!!!!!UPDATE THIS!!!!!///////
_f = file( "c:/emu/attract/layouts/mytheme/1.ini", "r" ); //create file resource (full path)


_blb = _f.readblob( 100000 ); //pulls in 10,000 characters <- lazy way of setting the limit for read in
for(local i = 0; i < _blb.len(); i++){ 
    binChar = _blb.readn( 'b' );
    curChar = binChar.tochar();
    if(curChar == "#") lockLine = true;
    if(curChar == "\n") lockLine = false;
   
    if(!lockLine){
        if(curChar != "," && curChar != "\n" && curChar != "\r") fileEntry += curChar;
       
        if(curChar == "\n"){
            tempArray = split( fileEntry, "=" );
            if(tempArray.len() == 2){
              myFileIDs.push(tempArray[0]);
              myFileValues.push(tempArray[1]);
              fileEntry = "";
            }
        }
    }
}

for(local i = 0; i < myFileValues.len(); i++){
   local tempTxt = fe.add_text( myFileValues[i], 10, ((i*50) + 2), myFileValues[i].len() * 20, 30 )
   //local tempTxt is only relevant to the value currently active in the loop. Once the loop passes to the next element you'll have lost
   //direct access to manipulating that element.
   
   //myFileValues[i] <- an array containing your list of values read in from the ini. If you need access to the ids then use myFileIDs
   
   //((i*50) + 2) This takes each i in the loop i.e. (0*50)+2 = 2, (1*50)+2 = 52, (2*50)+2 = 102, (3*50)+2 = 152 etc
   
   //myFileValues[i].len() * 20 <- this just uses 20 * the character length to provide enough width otherwise the text will be cut short
   //You may need to alter this based on text size and length as fonts generally aren't going to be fixed widths, you can set this number
   //to the full screen width if you want and just be done with it. Doesn't make much difference unless your trying to align things in different ways
   
   //30 is the font size in pixels. All this is absolute px measurment so bare that in mind when using different resolutions, you might be better off
   //using a percentage based calculation which will help transition between various monitors of the same aspect.
   
   tempTxt.align = Align.Left;
}



If you really don't require the ini to have id=value structure and would prefer just to use single lines then strip this block out:

Code: [Select]
        if(curChar == "\n"){
            tempArray = split( fileEntry, "=" );
            if(tempArray.len() == 2){
              myFileIDs.push(tempArray[0]);
              myFileValues.push(tempArray[1]);
              fileEntry = "";
            }
        }

and replace with

Quote
        if(curChar == "\n"){
            if(fileEntry != "" && fileEntry != " "){
              myFileValues.push(fileEntry);
              fileEntry = "";
            }
        }


35
Hi kent79

This script I wrote for one of my layouts might help you.

Code: [Select]
# region.ini Dal1980;
# all lines starting with a # symbol or a blank return are ignored

005=World
100lions=World
10yard=World
10yard85=US
10yardj=Japan
11beat=World
1292apvs=World
136094_0072=World
136095_0072=World
1392apvs=World
18w=World
18w2=World

#... my file goes on for many lines

Code: [Select]
_f = file( myConfig["optPath"] + "parts/region.ini", "r" ); //create file resource
_f = file( "c:/emu/attract/layouts/parts/region.ini", "r" ); //create file resource <- you can add the path directly if you want rather than pulling it from layout config options

_blb = _f.readblob( 100000 ); //pulls in 10,000 characters <- lazy way of setting the limit for read in
for(local i = 0; i < _blb.len(); i++){ 
    binChar = _blb.readn( 'b' );
    curChar = binChar.tochar();
    if(curChar == "#") lockLine = true;
    if(curChar == "\n") lockLine = false;
    if(!lockLine){
        if(curChar != "," && curChar != " " && curChar != "\n" && curChar != "\r") fileEntry += curChar;
        if(curChar == "\n"){
            tempArray = split( fileEntry, "=" );
            if(tempArray.len() == 2){
              /*tempObj = {
                "id": tempArray[0],
                "name": tempArray[1]
              }*/
              regionsID.push(tempArray[0]);
              regionsName.push(tempArray[1]);
              //regions.push(tempObj);
              fileEntry = "";
            }
        }
    }
}

Then I used this to call the data

Code: [Select]
local mapExample = fe.add_image( "parts/[!getCurrentRegion]", flw*0.860, flh*0.003, flw*0.140, flh*0.100);
mapExample.preserve_aspect_ratio = true;
function getCurrentRegion( ioffset){
  local romName = fe.game_info(Info.Name, ioffset);
  romName = romName.tolower(); //just in case
  local returnRegion = "";
  for(local i = 0; i < regionsID.len(); i++){
    if(regionsID[i] == romName) returnRegion = regionsName[i];
  }
  if(returnRegion == "") returnRegion = "world";
  returnRegion.tolower();
  return "mame-regions-" + returnRegion + ".png";
}


You will obviously need to adapt the code to your requirements.

The goal for my code was to pull in using an ini style document (similar to catver.ini), I would have an array with all rom names and an array of regions that match. I didn't end up using this in the end but the function I wrote uses the selected rom id to lookup the region data and then throw back a string representing the correct image.

I've also wrote another way to read in the ini style and utilise it a different way if you want to download this script: http://retro.zombiesbyte.com/attract-mode/plugin-system-menu

Hope this helps you




36
Scripting / Re: ScrollingText module
« on: June 26, 2018, 06:28:32 PM »
Hi arthurvalenca

I would suggest trying the sample https://github.com/liquid8d/attract-extra/tree/master/layouts/sample_objects_scrollingtext and altering that to see if you still have the problem.

If the problem goes away using the sample layout file then I would suspect either something happening in the code before your scrolling text or some issue with updating the file via FTP/Samba (check to make sure your changes are being wrote as I've fell into this trap before. I've also had crazy times where I was updating the wrong file too but that's just my world probably ;D).

Hope this helps

37
I do not know ;D

I ended up switching to XP in the end to resolve the issue and then found that RetroArch kind of sucked on XP end ended up using Mame directly as you described  :o

I think my thoughts for using RA initially where to utilise the different cores. If I had to start trying to get different emulators running different things then I may have hit some problems and kinda thought that I would have made things easy by using RA in this way... the Pi manages quite well so guess that had some influence too.

As it happens light guns and Linux don't mix very well (or at least Mame gets confused) so switched it all out for XP, had I not, your comment would have had me probably kicking myself a little and I would have pursued that angle so thanks. Hope this at least helps other confused wanderers like myself out there.  :-[

38
I wouldn't normally bump a topic this old but I just tried to google the same question and came across my own post!  :o ;D.

Can someone please point me in the right direction

Code: [Select]
     class WheelEntry extends ConveyorSlot {
     
          constructor() {
               base.constructor( ::fe.add_artwork( myConfig["orbit_art"] ));
     }
         
          function on_progress( progress, var ) {
               local p = progress / 0.1;
               local slot = p.tointeger();
               p -= slot;
               slot++;

               if ( slot < 0 ) slot=0;
               if ( slot >= 10 ) slot=10;

/* ADDITIONAL */
               if(m_obj.file_name == ""){
                    m_obj.file_name = "parts/no-logo.png";
                    m_obj.preserve_aspect_ratio = true;
               }
/* ADDITIONAL */

               m_obj.x = wheel_x[slot] + p * ( wheel_x[slot+1] - wheel_x[slot] );
               m_obj.y = wheel_y[slot] + p * ( wheel_y[slot+1] - wheel_y[slot] );
               m_obj.width = wheel_w[slot] + p * ( wheel_w[slot+1] - wheel_w[slot] );
               m_obj.height = wheel_h[slot] + p * ( wheel_h[slot+1] - wheel_h[slot] );
               m_obj.rotation = wheel_r[slot] + p * ( wheel_r[slot+1] - wheel_r[slot] );
               m_obj.alpha = wheel_a[slot] + p * ( wheel_a[slot+1] - wheel_a[slot] );


          }
     };


This works but only after the conveyor has moved.



 

39
General / Keyboard not working after returning from game
« on: June 11, 2018, 03:12:49 PM »
Hi

When I first load up Attract Mode I can control the menu in the normal way using my keyboard. After clicking to launch a game (Retroarch) and exiting (esc key) I return to Attract Mode but I am unable to move the menu. AM hasn't crashed but it just won't accept input from the keyboard.

Strangely, I did find that plugging in a USB controller allowed some control back and after setting that up against the keyboard control mapping I am able to now exit properly (or start a new game).

I can't post logs because there isn't any errors.

Using
Code: [Select]
startx attractDebian 9.4 (no desktop environment installed)

Attract Mode locally compiled from main branch https://github.com/mickelson/attract:
Attract-Mode v2.3.0-48 (Linux, SFML 2.4 +FontConfig +GLES +SWF +7z)
avcodec 57.64.101 / avformat 57.56.101 / swscale 4.2.100 / swresample 2.3.100

Retroarch locally compiled from main branch https://github.com/libretro/RetroArch: 1.7.3

Here's the last log (in it's entirety) but as you can see, nothing here to report:
Code: [Select]
Attract-Mode v2.3.0-48 (Linux, SFML 2.4 +FontConfig +GLES +SWF +7z)
avcodec 57.64.101 / avformat 57.56.101 / swscale 4.2.100 / swresample 2.3.100

Config: /home/blackcab/.attract/attract.cfg

*** Initializing display: 'mame'
 - Loaded master romlist 'mame' in 270 ms (34774 entries kept, 0 discarded)
 - Constructed 10 filters in 275 ms (347740 comparisons)
 - Loaded layout: /usr/local/share/attract/layouts/Basic/ (layout.nut)
*** Running: retroarch -L "/home/blackcab/.config/retroarch/cores/mame_libretro.so" "/home/blackcab/.attract/romlists/mame-latest/arcade/mame/sonicwi2.zip"

attract.cfg
Code: [Select]
# Generated by Attract-Mode v2.3.0-48
#
display mame
layout               Basic
romlist              mame
in_cycle             yes
in_menu              yes
filter               All
filter               "NoMOPMUC Games"
rule                 Title not_contains bootleg|prototype|Trivia|Quiz|Mahjong|Japan
rule                 Manufacturer not_contains bootleg
rule                 Category contains Climbing|Fighter|Misc.|Multiplay|Not Classified|Player|Shooter|Sports|2.5D|3D|Adventure|Asian 3D|Baseball|Boat|Boxing|Command|Darts|Digging|Driving|Driving 1st Person|Driving Horizontal|Drop|Fighter|Fishing|Flying (chase view)|Flying Diagonal|Flying Vertical|Golf|Hang Gliding|Horse Racing|Japanese|Korean|Maze|Misc.|Misc. Vertical|Outline|Pad|Ping Pong|Pool|Race (chase view)|Race 1st P Bike|Race Bike|Racing|Run Jump|Shooter Large|Shooter Small|Shuffleboard|Skiing|Sliding|Tennis|Toss|Versus|Vertical|Walking|1st Person|2D|3rd Person|Armwrestling|Basketball|Bowling|Breakout|Compilation|Dodgeball|Driving (chase view)|Driving Diagonal|Driving Vertical|English|Field|Fighter Scrolling|Flying|Flying 1st Person|Flying Horizontal|Football|Go|Gun|Handball|Hockey|Horseshoes|Mini-Games|Multiplay|Pinball|Plane|Pong|Race|Race (chase view) Bike|Race 1st Person|Race Track|Rugby Football|Run Jump Scrolling|Shooter|Shooter Scrolling|Skateboarding|SkyDiving|Soccer|Sumo|Swimming|Timing|Track & Field|Versus Co-op|Volleyball|Wrestling
rule                 Control contains doublejoy|joy|lightgun|mouse|only_buttons|positional|stick
rule                 Control contains 2-way|4-way|8-way
rule                 Control not_contains paddle|pedal|mechanical
rule                 Status equals good|imperfect
filter               NeoGeo
rule                 AltRomname contains neogeo
rule                 Status equals good|imperfect
filter               SHMUPs
rule                 Title not_contains bootleg|prototype|Sports|Trivia|Quiz|Mahjong
rule                 Manufacturer not_contains bootleg
rule                 Category contains Flying
rule                 Status equals good|imperfect
filter               Mature
rule                 Category contains Mature
filter               Fighter
rule                 Category contains Fighter
filter               Mini-Games
rule                 Category contains Mini-Games
filter               Sports
rule                 Category contains Sports
filter               Tabletop
rule                 Category contains Tabletop
filter               Favourites
rule                 Favourite equals 1

sound
sound_volume         100
ambient_volume       100
movie_volume         50

input_map
next_filter          LControl+Right
edit_game            Escape+Down
next_filter          Joy0 Right+Joy0 Button0
edit_game            Joy0 Down+Joy0 Button1
up                   Up
up                   Joy0 Up
down                 Down
down                 Joy0 Down
left                 Left
left                 Joy0 Left
right                Right
right                Joy0 Right
filters_menu         Joy0 Left+Joy0 Button0
filters_menu         Num5+Num6
configure            Tab
configure            Joy0 Up+Joy0 Button1
configure            Num2
add_favourite        Joy0 Button0+Joy0 Button1
add_favourite        LAlt
next_letter          LControl+Down
next_letter          Joy0 Down+Joy0 Button0
next_letter          F
prev_letter          LControl+Up
prev_letter          Joy0 Up+Joy0 Button0
prev_letter          R
select               Return
select               LControl
select               Num1
select               Joy0 Button0
back                 Joy0 Button1
back                 LShift
default             back exit
default             up prev_page
default             down next_page
default             left prev_game
default             right next_game

general
language             en
exit_command         
default_font         FreeSans
font_path            /usr/share/fonts/;$HOME/.fonts/
screen_saver_timeout 600
displays_menu_exit   yes
hide_brackets        no
startup_mode         default
confirm_favourites   yes
confirm_exit         yes
mouse_threshold      10
joystick_threshold   75
window_mode          default
filter_wrap_mode     default
track_usage          yes
multiple_monitors    no
smooth_images        yes
accelerate_selection yes
selection_speed_ms   40
scrape_snaps         yes
scrape_marquees      yes
scrape_flyers        yes
scrape_wheels        yes
scrape_fanart        no
scrape_videos        no
scrape_overview      yes
video_decoder        software
menu_prompt          Displays Menu
menu_layout         

layout_config mvs-insertcoin
param                optPath /home/blackcab/.attract/layouts/mvs-insertcoin/


plugin History.dat
enabled              yes
param                button H
param                dat_path /home/blackcab/.attract/dat/history.dat
param                generate_index
param                index_clones No
param                rows 30

plugin UtilityMenu
enabled              no

plugin AudioMode
enabled              no
param                dir
param                info_button
param                skip_button

Read through all bugs relating to this but couldn't find anything except these
https://github.com/mickelson/attract/issues/199
https://github.com/mickelson/attract/issues/244
But both relate to focus issues were as I think my issue seems to be that gremlins go pulling wires inside my keyboard (I've tried other keyboards too but I must have a family of gremlins in each)

My video explanation
https://youtu.be/a5YixnhPlfY

Thanks 


40
General / Re: PC Build (X86) Attract Mode with SFML
« on: May 31, 2018, 02:59:23 AM »
Hmm that didn't work.

Seems there's a ton of things that need fixing. Kinda went 10 steps backwards

For full bash terminal history:
https://pastebin.com/La8XcVjm

Starting to lose hope  :'(

41
General / Re: PC Build (X86) Attract Mode with SFML
« on: May 31, 2018, 02:24:01 AM »
I wasn't sure about your link so held off running down that route. Thanks for confirming kent79.

I used the same link for AM but it feels a little weird to use it for PC hardware. Fingers crossed.  :)

Many thanks
Dal1980

42
General / Re: PC Build (X86) Attract Mode with SFML
« on: May 29, 2018, 12:03:53 PM »
Thanks kent79

Just wondering if you dumped that link in a way to say it was obvious or in a way to tell me that I can use that link to solve my problem?  ???

Cheers
Dal1980

43
General / PC Build (X86) Attract Mode with SFML
« on: May 29, 2018, 02:34:02 AM »
Can you hear the splashing of me drowning  :D

I need help (and I'm not talking mentally... that can wait  ;)) I'm currently building a Debian image and after going around the houses for some time I think I've come to terms with the fact that the XOrg/XServer way of doing things is squeezing life out of me and my PC. I've had a few issues which seem to be related to using X.

I have AM on Pi and love it, well big fan of AM anyway  8) but when it comes to standard PC hardware, generally support is limited in this topic.

Anyone got any clues for how I might compile an image of AM with SFML so I don't have to use X?

Debian GNU/Linux 9.4 (Stretch)
Attract Mode V2.3.0-44 (Linux SFML 2.4 +FrontConfig +SWF)
avcodec 57.64.101 / avformat 57.56.101
swscale 4.2.100 / swresample 2.3.100
Xserver 1.19.2
Retroarch 1.3.6
ultimarc Minipac (1313?) <- this PC is actually a Arcade Cab

Stupid questions but I couldn't just use this package could I? https://github.com/mickelson/sfml-pi

Cheers
Dal1980

44
Might be worth sharing my thread over at retroarch forums since I assumed that the problem was more retroarch less AM.

https://forums.libretro.com/t/retroarch-control-issue/16299

At this moment in time I'm leaning towards using the XServer
Code: [Select]
xinit attract command to launch AM as potentially being the problem. When I line up retroarch to use Xdriver it seems to solve some of the problems so I'm going to assume that XServer is shielding communication between these two environments/programs.

My question now is; is there any alternatives to using XServer. I know raspi just launches
Code: [Select]
attract without needing to do
Code: [Select]
xinit attract or
Code: [Select]
xstart. What I don't know is if it's actually just preloading that somewhere or if there is an alternative method of launching using another package.

45
Think I'm going to ask this over at the Retroarch forums as I've spent the last few hours trying to get retroarch just to recognise my minipac (which it hasn't, just seems to know about my usb joypad only, not even my keyboard is working).

I'd like to keep this open here just in case anyone has any input and I'll also update the thread with the resolution (hopefully).


Pages: 1 2 [3] 4