Skip to content

Commit

Permalink
Significant rewrite of the artwork selection and loading process
Browse files Browse the repository at this point in the history
- Issue #4 - added surface objects for layouts.  Surfaces are
offscreen textures that other images, artworks, texts and surfaces
can be drawn on.  The surface itself is treated like any other image
and can have skew, pinch and shader effects applied.

- Issue #35 - removed the concept of a special "movie artwork".  Any
artwork or static image can now contain images or videos.  Videos are
given preference over images.

- Issue #37 - Added "video_flags" and "video_playing" properties to the
Image class for layout scripts.  Layouts can now test if a video is
playing, start or stop a video, and can set whether a video automatically
starts, loops, or plays its audio track.

- Multiple paths can now be specified for each artwork.  The paths are
checked in order for each rule (i.e. path#1 for romname, path#2 for
romname, path#1 for cloneof, path#2...)

- If an artwork path contains a subdirectory that matches a rule, then a
random video or image from that subdirectory is loaded (i.e. if path#1
contains a "pacman" subdirectory (but no pacman image or video), then a
random video or image from the subdirectory will be chosen if available.
Videos get preference.

- Fixed a bug that prevented image flipping from working when image/video
is scaled

- Added set_pos( x, y) and set_pos( x, y, w, h ) functions to the Image,
Text and ListBox classes used in layouts.
  • Loading branch information
mickelson committed Apr 25, 2014
1 parent b7b8796 commit a365826
Show file tree
Hide file tree
Showing 27 changed files with 1,358 additions and 598 deletions.
249 changes: 188 additions & 61 deletions Layouts.md

Large diffs are not rendered by default.

45 changes: 28 additions & 17 deletions Readme.md
Expand Up @@ -7,7 +7,8 @@ intended to be controlled with a joystick, gamepad or spin dial, making it
ideal for use in arcade cabinet setups.

Attract-Mode was originally developed for use in Linux. It is known to work
on Ubuntu Linux (x86, x86-64), Mac OS X (10.6.8), and Windows (XP and 7).
on Ubuntu Linux (x86, x86-64), Mac OS X (10.6.8), and Windows (x86 and
x86-64, XP, 7).

Attract-Mode is licensed under the terms of the GNU General Public License,
version 3 or later.
Expand All @@ -27,9 +28,9 @@ line as follows:

attract --config /my/config/location

In the (hopefully unlikely) event that Attract-Mode has difficulty finding
a display font to use on your system, you can specify one at the command line
as follows:
In the (hopefully unlikely) event that Attract-Mode has difficulty
finding a display font to use on your system, you can specify one at the
command line as follows:

attract --font <font_name>

Expand Down Expand Up @@ -72,22 +73,25 @@ be selected from the "Sound" menu when in config mode and mapped to an action
or event.

**ARTWORK:** Attract-Mode supports PNG, JPEG, GIF, BMP and TGA image formats.
When deciding what image file to use for a particular artwork type, Attract-
Mode will use the artwork/movie selection order set out below. The default
artworks in Attract-Mode are: "marquee" (for cabinet marquee images),
"snap" (for game screen shots), "flyer" (for game flyer/box art) and "wheel"
(for HyperSpin wheel art). You can add others as needed in the emulator
configuration menu.
For video formats, Attract-Mode should support any video format supported by
FFmpeg. When deciding what file to use for a particular artwork type,
Attract-Mode will use the artwork selection order set out below.

**MOVIE:** Attract-Mode should support any movie format supported by FFmpeg.
The movie to play is decided in the order set out below.
The location of artwork resources is configured on a per-emulator basis in the
emulator configuration menu. Attract-Mode's default artworks are: "marquee"
(for cabinet marquee images), "snap" (for attract-mode videos and game screen
shots), "flyer" (for game flyer/box art) and "wheel" (for Hyperspin wheel art).
You can add others as needed in the emulator configuration menu. Multiple
paths can be specified for each artwork, in which case Attract-Mode will check
each path in the order they are specified before moving to the next check in
the selection order.

**ARTWORK/MOVIE SELECTION ORDER:**
**ARTWORK SELECTION ORDER:**

* From the artwork path configured in the emulator setting (if any):

- [Name].xxx (i.e. "pacman.png")
- [CloneOf].xxx (i.e. "puckman.gif")
- [Name].xxx (i.e. "pacman.mp4")
- [CloneOf].xxx (i.e. "puckman.png")
- [Emulator].xxx (i.e. "mame.jpg")

* From the layout path for the current layout (layouts are located in
Expand All @@ -96,8 +100,15 @@ The movie to play is decided in the order set out below.
- [Emulator]-[ArtLabel].xxx (i.e. "mame-marquee.png")
- [ArtLabel].xxx (i.e. "marquee.png")

* If no files are found matching the above rules, then the artwork/movie
is left blank.
* If no files are found matching the above rules, then the artwork
is not drawn.

Attract-Mode gives preference to videos over images when checking for
artwork matches. If no video or image match is found, Attract-Mode will
then check for a subdirectory that meets the match criteria. If a
subdirectory is located (i.e. a "pacman" directory in the configured
artwork path) then Attract-Mode will then pick a random video or image
from that directory (with a preference for videos).

**LAYOUTS:** See: [Layouts.md][]

Expand Down
4 changes: 1 addition & 3 deletions config/default-emulator.cfg
Expand Up @@ -3,9 +3,7 @@
args "[romfilename]"
rompath $HOME/[emulator]/roms/
romext .zip
movie_path $HOME/[emulator]/videos
movie_artwork snap
artwork flyer $HOME/[emulator]/boxart
artwork marquee
artwork snap $HOME/[emulator]/snap
artwork snap $HOME/[emulator]/videos;$HOME/[emulator]/snap
artwork wheel
4 changes: 1 addition & 3 deletions config/language/en.msg
Expand Up @@ -18,14 +18,12 @@ No;No
_help_back;Exit menu
_help_emulators;Configure available emulators
_help_art_label;The label that identifies this artwork resource (used by layouts)
_help_art_path;The directory containing the artworks
_help_art_path;The path to the files for this artwork. Multiple paths can be entered if separated by a semicolon.
_help_art_add;Add a new artwork resource (marquee images, screen shots, etc.)
_help_emu_executable;The full path and name of the emulator executable. $HOME gets replaced with the user's home dir
_help_emu_args;The command line arguments for this emulator. The following get substituted appropriately: [name], [romext], [rompath], [emulator], [romfilename]
_help_emu_rompath;The path to the roms for this emulator
_help_emu_romext;The rom extension(s) for this emulator (i.e. .zip). Multiple extensions can be entered if separated by a semicolon.
_help_emu_movie_path;The path to the attract-mode videos (if any) for this emulator
_help_emu_movie_artwork;The artwork resource used to display movies
_help_emu_import_extras;Path to any additional files that need to be read when generating a romlist for this emulator. Supported files are: catver.ini (for game categories) and nplayers.ini (for number of players). Multiple file paths can be entered if separated by a semicolon
_help_emu_listxml;Valid values for XML Mode are "mame" (if this a recent version of mame that provides -listxml output) or "mess <system>" (if this is a recent version of mess that provides -listsoftware output for the specified system). For any other emulator this should be left empty
_help_emu_gen_romlist;Generate a romlist by searching the configured rom path for roms with the configured extension, incorporating XML and additional import file information into the generated list (if available)
Expand Down
4 changes: 0 additions & 4 deletions config/language/fr.msg
Expand Up @@ -20,8 +20,6 @@ Rom Path;Chemin des ROM
Rom Extension(s);Extension(s) des ROM
Additional Import Files;Fichiers additionels
XML Mode;Mode XML
Movie Path;Chemin des vidéos
Movie Artwork;Artwork alternatif
Add Artwork;Ajouter Artwork
Generate Romlist;Générer la liste de ROM
Delete this Emulator;Supprimer cet émulateur
Expand All @@ -42,8 +40,6 @@ _help_emu_executable;Chemin et nom de l'executable de l'émulateur. $HOME sera r
_help_emu_args;Arguments de la ligne de commande de cet émulateur. Options de substitution: [name], [romext], [rompath], [emulator], [romfilename]
_help_emu_rompath;Chemin des ROM pour cet émulateur
_help_emu_romext;Extension des ROM pour cet émulateur (ex .zip). Possibilité d'utiliser des extensions multiples separées par un point-virgule
_help_emu_movie_path;Chemin des vidéos attract-mode (si il y en a) pour cet emulateur
_help_emu_movie_artwork;Ressource d'Artwork utilisée pour afficher les films
_help_emu_import_extras;Fichiers additionels nécessitant d'être lus lors de la generation de la liste de ROM pour cet émulateur. Fichiers supportés: catver.ini (catégories) et nplayers.ini (nombre de joueur). Plusieurs fichiers peuvent etre saisis si separés par un point-virgule
_help_emu_listxml;Les valeurs valides pour le mode XML sont "mame" (si c'est une version récente de mame proposant l'option -listxml) ou "mess <system>" (si c'est une version récente de mess proposant l'option -listsoftware). Pour tout autre émulateur laisser vide
_help_emu_gen_romlist;Génére une liste de ROM en cherchant dans le chemin des ROM avec l'extension choisie, incorporant l'XML et les fichiers additionels d'information dans la liste générée (si disponible)
Expand Down
2 changes: 1 addition & 1 deletion config/layouts/orbit/layout.nut
Expand Up @@ -51,7 +51,7 @@ class Marquee {
xl=pxl; xm=pxm; xr=pxr; sl=psl; sm=psm; sr=psr;
orig_ob = ob = fe.add_artwork( my_config["orbit_art"] );
ob.preserve_aspect_ratio=true;
ob.movie_enabled = false;
ob.video_flags = Vid.ImagesOnly;
ob.index_offset = base_io = pio;
reset();
}
Expand Down
8 changes: 4 additions & 4 deletions config/layouts/screensaver.nut
Expand Up @@ -56,7 +56,7 @@ local screen_count=1;
// Initialize artwork resources
//
local art = fe.add_artwork( "", 0, 0, ScreenWidth, ScreenHeight );
art.movie_enabled = false;
art.video_flags = Vid.ImagesOnly;
art.index_offset = rand();

local PH = ScreenHeight / 4;
Expand All @@ -69,7 +69,7 @@ for ( local i=0; i<4; i++ )
{
group.append( fe.add_artwork( "", i * PW, j * PH, PW, PH ) );
group.top().visible = false;
group.top().movie_enabled = false;
group.top().video_flags = Vid.ImagesOnly;
}
}

Expand Down Expand Up @@ -112,11 +112,11 @@ function saver_tick( stime )

if ( cycle[current_mode] == Mode.Movie )
{
art.movie_enabled = true;
art.video_flags = Vid.Default;
}
else
{
art.movie_enabled = false;
art.video_flags = Vid.ImagesOnly;
screen_count = 1;
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/fe_base.cpp
Expand Up @@ -36,6 +36,8 @@ const char *FE_VERSION = FE_VERSION_D;

const char *FE_WHITESPACE=" \t\r";

const char *FE_DEFAULT_ARTWORK = "snap";

void FeBaseConfigurable::invalid_setting(
const std::string & fn,
const char *base,
Expand Down
9 changes: 5 additions & 4 deletions src/fe_base.hpp
Expand Up @@ -30,20 +30,21 @@ extern const char *FE_COPYRIGHT;
extern const char *FE_VERSION;
extern const int FE_VERSION_NUM;
extern const char *FE_WHITESPACE;
extern const char *FE_DEFAULT_ARTWORK;

class FeBaseConfigurable
{
protected:
void invalid_setting(
void invalid_setting(
const std::string &filename,
const char *base,
const std::string &setting,
const char *base,
const std::string &setting,
const char **valid1,
const char **valid2=NULL,
const char *label="setting" );

public:
virtual int process_setting( const std::string &setting,
virtual int process_setting( const std::string &setting,
const std::string &value,
const std::string &filename )=0;

Expand Down
8 changes: 7 additions & 1 deletion src/fe_config.cpp
Expand Up @@ -178,7 +178,10 @@ bool FeEmuArtEditMenu::save( FeConfigContext &ctx )

std::string label = ctx.opt_list[0].get_value();
if ( !label.empty() )
m_emulator->set_artwork( label, ctx.opt_list[1].get_value() );
{
m_emulator->delete_artwork( label );
m_emulator->add_artwork( label, ctx.opt_list[1].get_value() );
}

return true;
}
Expand Down Expand Up @@ -1247,6 +1250,9 @@ bool FeMiscMenu::save( FeConfigContext &ctx )
return true;
}

const int FeScriptConfigMenu::OPAQUE_BASE=100;
const int FeScriptConfigMenu::INPUT_OPAQUE_BASE=200;

void FeScriptConfigMenu::get_options_helper(
FeConfigContext &ctx,
std::string &gen_help,
Expand Down
4 changes: 2 additions & 2 deletions src/fe_config.hpp
Expand Up @@ -189,8 +189,8 @@ class FeScriptConfigMenu : public FeBaseConfigMenu
FeScriptConfigurable &configurable );

private:
static const int OPAQUE_BASE=100;
static const int INPUT_OPAQUE_BASE=200;
static const int OPAQUE_BASE;
static const int INPUT_OPAQUE_BASE;

std::vector<std::string>m_params;
};
Expand Down

0 comments on commit a365826

Please sign in to comment.