Author Topic: Artwork does not display from "marquee" folder located from emulator settings  (Read 24833 times)

zeroid

  • Full Member
  • ***
  • Posts: 30
    • View Profile
I had tried to put an image into the "$HOME/marquee/" folder but it was not being added into the "fe" using "addimage".
however if  i try to load the image from the "layout" folder, lets say "bg.jpg", it will load just fine.
what went wrong?

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
to add artwork, you use fe.add_artwork("marquee", 0, 0, 100, 100); instead of fe.add_image

Make sure you have the artwork folders setup, it has defaults for flyer, marquee, snap, and wheel - you can add multiple (images or videos) paths using ; to separate them or add new artwork folders.

zeroid

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Thank you very much.

What if i decided not to use it's default artwork folder and adds a new folder such as

"artwork    background      C:\Users\Zeroid\Google Drive\Attract-Mode\Frontend\_Backgrounds" ?
this apparently does not work. or i just made something wrong at some where else?


EDIT: Here's what i'm trying to do.
IN MY EMULATOR CONFIG:
--------
args                 "[romfilename]" -fullscreen
rompath              C:\Users\Zeroid\Google Drive\Attract-Mode\Frontend\_Roms
romext               .sms;.sg;.sc;.mv;.gg;.cue;.bin;.zip;.gen
system               Sega Genesis
info_source          thegamesdb.net
artwork    background           C:\Users\Zeroid\Google Drive\Attract-Mode\Frontend\_Backgrounds
artwork    preview         C:\Users\Zeroid\Google Drive\Attract-Mode\Frontend\_Previews
artwork    thumbnail            C:\Users\Zeroid\Google Drive\Attract-Mode\Frontend\_Thumbnails
artwork    ui           C:\Users\Zeroid\Google Drive\Attract-Mode\Frontend\_UIs
--------


IN MY LAYOUT.NUT
--------
// Background Image
switch(my_config["bg_image"])
{
   case "Default":
   {
      local bg = fe.add_image( "bg.jpg", 0, 0, lw, lh);
   }break;
   
   case "Fanart":
   {
      local bg = fe.add_artwork( "background", 0, 0, lw, lh);
   }break;
   
   default:
   {
      //none
   }break;
}
--------


The result is a blank screen...
I'm trying to setup the folder to exist inside the same folder as the AM configs, so that all the [_Backgrounds], [_Previews], [_Thumbnails] are in there and it'd be easier to work with.
Apparently i'm not doing it right.

Please help me.
Thanks in advance.
« Last Edit: May 30, 2015, 09:54:58 PM by zeroid »

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Artwork is meant for you to specify a folder with images that are named after each rom name. As of now, I believe that's the only thing it will look for.

If you are using say "sf2.png", "kinst.png", etc... you can add a "background" artwork folder with those files in it, then use fe.add_artwork("background", 0, 0, 100, 100 ) to show the image for whatever game is selected. You can put the artwork folders wherever you want, in the AM folder, or otherwise, but the files have to match the name.

So it looks like you want a config option to choose either a default bg image file, or the "fan art" artwork in the background folder. Looks like you are close. Make sure that the files match the game names.. and double check your code, should look like:

Code: [Select]
switch( my_config["bg_image"] )
{
   case "Fan Art":
      fe.add_artwork( "background", 0, 0, fe.layout.width, fe.layout.height );
      break;
   case "Default":
      fe.add_image( "bg.png", 0, 0, fe.layout.width, fe.layout.height );
      break;
   default:
      //no background at all
      break;
}

Make sure you do breaks after each switch option, otherwise you will get unintended results. You might even try printing out your config setting to make sure it matches your choices in your switch statement since it looks like your default is no background:
Code: [Select]
print("Background is set to: " + my_config["bg_image"] + "\n" );

Case matters - you can use toupper() or tolower() to match the case on your config variable and your switch statement cases.

Also, make sure you run in Windowed mode, so you can see the debug output - if something isn't right, it will spit out some errors...

Hope that helps!

zeroid

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Thanks. that would help explained other wise.
I intended to have the artworks all shifted to a sub-directory of layout folder, so i will have them loaded from internally and anything were to go wrong, i just have to backup the layout folder.

zeroid

  • Full Member
  • ***
  • Posts: 30
    • View Profile
ok... here's one thing i faced.

i have the original artwork folder "snap" pointed to a path say "c:\snap" and i had placed 3 images into it.
Now i wanted to add these artwork into the screen using the code below:
Code: [Select]
fe.add_artwork("snap");but nothing came out or displays.
i do have 3 files placed into the ROM folder and generated the list with the same name, such as "mario.gen" (inside ROM folder) & "mario.jpg" (inside SNAP folder)
but the screen will not show anything at all.
Where did I do wrong?

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Hard to say without seeing the whole thing.

My guess would be you added the artwork underneath another object - perhaps a background image? Objects are drawn on the screen in the order you add them in your layout.nut, so if you did something like this:

Code: [Select]
fe.add_artwork("snap", 0, 0, 320, 240 );
fe.add_image("bg.jpg", 0, 0, 800, 600 );

The background image will end up overtop of the snap artwork.

zeroid

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Hi.
Thanks for helping out.

I had tried a few attempts and eventually i think i found the problem.
I have to first place the images into [snaps] then generate the rom list.
only then the layout will show the image when the game is selected.

if i generate the list and then place images into the [snaps] folder then it will not show.
which is a bit odd.

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
I don't think that is accurate. You DO have to have a list generated - otherwise there is no games to show.. and if you add new roms - you need to regenerate so the new games are added but you shouldn't need to regenerate each time you add new images - it's possible (although I haven't tried) that it might not recognize new snaps unless you exit out and restart AM.

zeroid

  • Full Member
  • ***
  • Posts: 30
    • View Profile
ok. i managed to solve that and apparently i do need to generate the list once to allow the snap to be viewed.
after the list generated, any image i replaced will just display without problems.

now, i do have another question.
How can I detect if the image loaded from snap is not available and i wish to change that fe.image into something else programmatically?

imagine, when i load the snap folder, and 3 out of 10 games were loaded but the 7 blanks remains because i dont have any image in the snap folder.
and i wanted to replace it with a placeholder image.
is there anyway i check for "fe.image.loaded == true" thing?

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Use the function I provided in your other thread to see if the file is available. You might make use of the fe.get_art() function to check various iterations of file_name that might be used for artwork.

If it's not available, I think you can just set artwork.file_name attribute to change it to what you want (I haven't tried that with artwork, but I assume it would work)

zeroid

  • Full Member
  • ***
  • Posts: 30
    • View Profile
i tried to get any string from artwork.file_name unfortunately nothing is being returned.
basically null.

that's why i drop that and was hoping there is other workaround.
I would use the "file_exist" method you showed me on the other thread but here comes another problem.

is there anyway i can resolve the "snap" (artwork) path?
the user will enter any path they like to point to any directory, but in the code i wanted to "resolve" that to a physical string path, how would i be able to do that.

the AM document doesnt really show stuff like this.
and when i try to use "artwork.file_name" to get the full path so that i can trim off the end and figure out the actual physical path that was given to "[snap]", it wont work becoz "artwork.file_name" returns null.

raygun

  • Administrator
  • Sr. Member
  • *****
  • Posts: 393
    • View Profile
i tried to get any string from artwork.file_name unfortunately nothing is being returned.
basically null.

that's why i drop that and was hoping there is other workaround.
I would use the "file_exist" method you showed me on the other thread but here comes another problem.

is there anyway i can resolve the "snap" (artwork) path?
the user will enter any path they like to point to any directory, but in the code i wanted to "resolve" that to a physical string path, how would i be able to do that.

the AM document doesnt really show stuff like this.
and when i try to use "artwork.file_name" to get the full path so that i can trim off the end and figure out the actual physical path that was given to "[snap]", it wont work becoz "artwork.file_name" returns null.


Hi Zeroid,
To resolve an artwork path, use fe.get_art().... it is documented here: https://github.com/mickelson/attract/blob/master/Layouts.md#get_art
it should return the filename for the specified artwork, so "fe.get_art( "snap")" should give you the full filename for the snap associated with the current selection.

The artwork.file_name attribute should be the filename for whatever image is currently being displayed.  It will only be empty if there is no artwork/image being displayed in the artwork container you are working with.

hope that helps!

zeroid

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Hmm... how the hell did I missed that~!!!!!???
Shame on me...

zeroid

  • Full Member
  • ***
  • Posts: 30
    • View Profile
ok. I appreciate the help. but i have to break it to you.
the fe.get_art("snap") does not return anything.

i tried to print() it and nothing came out.
im sure i have the snap folder setup as artwork coz it loads the images i need when i select the games.

not sure where went wrong.


EDIT: I'm an idiot for not having the "fe.list.index" set to any number.
Anyway, it works now.
Thanks.
« Last Edit: June 09, 2015, 11:50:21 PM by zeroid »