2019-03-14 11:47:00 +00:00
|
|
|
/* Copyright (C) 2010-2019 The RetroArch team
|
|
|
|
*
|
|
|
|
* ---------------------------------------------------------------------------------------
|
2020-02-16 15:38:17 +00:00
|
|
|
* The following license statement only applies to this file (gfx_thumbnail_path.c).
|
2019-03-14 11:47:00 +00:00
|
|
|
* ---------------------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge,
|
|
|
|
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation the rights to
|
|
|
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
|
|
|
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
|
|
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
|
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
|
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2020-02-16 15:38:17 +00:00
|
|
|
#ifndef __GFX_THUMBNAIL_PATH_H
|
|
|
|
#define __GFX_THUMBNAIL_PATH_H
|
2019-03-14 11:47:00 +00:00
|
|
|
|
|
|
|
#include <retro_common_api.h>
|
|
|
|
#include <libretro.h>
|
|
|
|
|
|
|
|
#include <boolean.h>
|
|
|
|
|
|
|
|
#include "../playlist.h"
|
|
|
|
|
|
|
|
RETRO_BEGIN_DECLS
|
|
|
|
|
|
|
|
/* Note: This implementation reflects the current
|
|
|
|
* setup of:
|
|
|
|
* - menu_driver_set_thumbnail_system()
|
|
|
|
* - menu_driver_set_thumbnail_content()
|
|
|
|
* - menu_driver_update_thumbnail_path()
|
|
|
|
* This is absolutely not the best way to handle things,
|
|
|
|
* but I have no interest in rewriting the existing
|
|
|
|
* menu code... */
|
|
|
|
|
2020-02-16 15:38:17 +00:00
|
|
|
enum gfx_thumbnail_id
|
2019-03-14 11:47:00 +00:00
|
|
|
{
|
2020-02-16 15:38:17 +00:00
|
|
|
GFX_THUMBNAIL_RIGHT = 0,
|
|
|
|
GFX_THUMBNAIL_LEFT
|
2019-03-14 11:47:00 +00:00
|
|
|
};
|
|
|
|
|
2020-02-16 15:38:17 +00:00
|
|
|
/* Prevent direct access to gfx_thumbnail_path_data_t members */
|
|
|
|
typedef struct gfx_thumbnail_path_data gfx_thumbnail_path_data_t;
|
2019-03-14 11:47:00 +00:00
|
|
|
|
|
|
|
/* Initialisation */
|
|
|
|
|
|
|
|
/* Creates new thumbnail path data container.
|
2020-02-16 15:38:17 +00:00
|
|
|
* Returns handle to new gfx_thumbnail_path_data_t object.
|
2019-03-14 11:47:00 +00:00
|
|
|
* on success, otherwise NULL.
|
|
|
|
* Note: Returned object must be free()d */
|
2020-02-16 15:38:17 +00:00
|
|
|
gfx_thumbnail_path_data_t *gfx_thumbnail_path_init(void);
|
2019-03-14 11:47:00 +00:00
|
|
|
|
|
|
|
/* Resets thumbnail path data
|
|
|
|
* (blanks all internal string containers) */
|
2020-02-16 15:38:17 +00:00
|
|
|
void gfx_thumbnail_path_reset(gfx_thumbnail_path_data_t *path_data);
|
2019-03-14 11:47:00 +00:00
|
|
|
|
|
|
|
/* Utility Functions */
|
|
|
|
|
2019-05-14 15:24:24 +00:00
|
|
|
/* Fetches the thumbnail subdirectory (Named_Snaps,
|
|
|
|
* Named_Titles, Named_Boxarts) corresponding to the
|
|
|
|
* specified 'type index' (1, 2, 3).
|
|
|
|
* Returns true if 'type index' is valid */
|
2020-02-16 15:38:17 +00:00
|
|
|
bool gfx_thumbnail_get_sub_directory(unsigned type_idx, const char **sub_directory);
|
2019-05-14 15:24:24 +00:00
|
|
|
|
2019-03-14 11:47:00 +00:00
|
|
|
/* Returns currently set thumbnail 'type' (Named_Snaps,
|
|
|
|
* Named_Titles, Named_Boxarts) for specified thumbnail
|
|
|
|
* identifier (right, left) */
|
2020-02-16 15:38:17 +00:00
|
|
|
const char *gfx_thumbnail_get_type(gfx_thumbnail_path_data_t *path_data, enum gfx_thumbnail_id thumbnail_id);
|
2019-03-14 11:47:00 +00:00
|
|
|
|
|
|
|
/* Returns true if specified thumbnail is enabled
|
|
|
|
* (i.e. if 'type' is not equal to MENU_ENUM_LABEL_VALUE_OFF) */
|
2020-02-16 15:38:17 +00:00
|
|
|
bool gfx_thumbnail_is_enabled(gfx_thumbnail_path_data_t *path_data, enum gfx_thumbnail_id thumbnail_id);
|
2019-03-14 11:47:00 +00:00
|
|
|
|
|
|
|
/* Setters */
|
|
|
|
|
|
|
|
/* Sets current 'system' (default database name).
|
|
|
|
* Returns true if 'system' is valid.
|
2019-08-16 14:49:01 +00:00
|
|
|
* If playlist is provided, extracts system-specific
|
|
|
|
* thumbnail assignment metadata (required for accurate
|
2020-02-16 15:38:17 +00:00
|
|
|
* usage of gfx_thumbnail_is_enabled())
|
2019-03-14 11:47:00 +00:00
|
|
|
* > Used as a fallback when individual content lacks an
|
|
|
|
* associated database name */
|
2020-02-16 15:38:17 +00:00
|
|
|
bool gfx_thumbnail_set_system(gfx_thumbnail_path_data_t *path_data, const char *system, playlist_t *playlist);
|
2019-03-14 11:47:00 +00:00
|
|
|
|
|
|
|
/* Sets current thumbnail content according to the specified label.
|
|
|
|
* Returns true if content is valid */
|
2020-02-16 15:38:17 +00:00
|
|
|
bool gfx_thumbnail_set_content(gfx_thumbnail_path_data_t *path_data, const char *label);
|
2019-03-14 11:47:00 +00:00
|
|
|
|
|
|
|
/* Sets current thumbnail content to the specified image.
|
|
|
|
* Returns true if content is valid */
|
2020-02-16 15:38:17 +00:00
|
|
|
bool gfx_thumbnail_set_content_image(gfx_thumbnail_path_data_t *path_data, const char *img_dir, const char *img_name);
|
2019-03-14 11:47:00 +00:00
|
|
|
|
|
|
|
/* Sets current thumbnail content to the specified playlist entry.
|
|
|
|
* Returns true if content is valid.
|
|
|
|
* > Note: It is always best to use playlists when setting
|
|
|
|
* thumbnail content, since there is no guarantee that the
|
|
|
|
* corresponding menu entry label will contain a useful
|
|
|
|
* identifier (it may be 'tainted', e.g. with the current
|
|
|
|
* core name). 'Real' labels should be extracted from source */
|
2020-02-16 15:38:17 +00:00
|
|
|
bool gfx_thumbnail_set_content_playlist(gfx_thumbnail_path_data_t *path_data, playlist_t *playlist, size_t idx);
|
2019-03-14 11:47:00 +00:00
|
|
|
|
|
|
|
/* Updaters */
|
|
|
|
|
|
|
|
/* Updates path for specified thumbnail identifier (right, left).
|
|
|
|
* Must be called after:
|
2020-02-16 15:38:17 +00:00
|
|
|
* - gfx_thumbnail_set_system()
|
|
|
|
* - gfx_thumbnail_set_content*()
|
2019-03-14 11:47:00 +00:00
|
|
|
* ...and before:
|
2020-02-16 15:38:17 +00:00
|
|
|
* - gfx_thumbnail_get_path()
|
2019-03-14 11:47:00 +00:00
|
|
|
* Returns true if generated path is valid */
|
2020-02-16 15:38:17 +00:00
|
|
|
bool gfx_thumbnail_update_path(gfx_thumbnail_path_data_t *path_data, enum gfx_thumbnail_id thumbnail_id);
|
2019-03-14 11:47:00 +00:00
|
|
|
|
|
|
|
/* Getters */
|
|
|
|
|
|
|
|
/* Fetches the current thumbnail file path of the
|
|
|
|
* specified thumbnail 'type'.
|
|
|
|
* Returns true if path is valid. */
|
2020-02-16 15:38:17 +00:00
|
|
|
bool gfx_thumbnail_get_path(gfx_thumbnail_path_data_t *path_data, enum gfx_thumbnail_id thumbnail_id, const char **path);
|
2019-03-14 11:47:00 +00:00
|
|
|
|
2019-05-14 15:24:24 +00:00
|
|
|
/* Fetches current 'system' (default database name).
|
|
|
|
* Returns true if 'system' is valid. */
|
2020-02-16 15:38:17 +00:00
|
|
|
bool gfx_thumbnail_get_system(gfx_thumbnail_path_data_t *path_data, const char **system);
|
2019-05-14 15:24:24 +00:00
|
|
|
|
|
|
|
/* Fetches current content path.
|
|
|
|
* Returns true if content path is valid. */
|
2020-02-16 15:38:17 +00:00
|
|
|
bool gfx_thumbnail_get_content_path(gfx_thumbnail_path_data_t *path_data, const char **content_path);
|
2019-05-14 15:24:24 +00:00
|
|
|
|
2019-03-14 11:47:00 +00:00
|
|
|
/* Fetches current thumbnail label.
|
|
|
|
* Returns true if label is valid. */
|
2020-02-16 15:38:17 +00:00
|
|
|
bool gfx_thumbnail_get_label(gfx_thumbnail_path_data_t *path_data, const char **label);
|
2019-03-14 11:47:00 +00:00
|
|
|
|
|
|
|
/* Fetches current thumbnail core name.
|
|
|
|
* Returns true if core name is valid. */
|
2020-02-16 15:38:17 +00:00
|
|
|
bool gfx_thumbnail_get_core_name(gfx_thumbnail_path_data_t *path_data, const char **core_name);
|
2019-03-14 11:47:00 +00:00
|
|
|
|
2019-05-14 15:24:24 +00:00
|
|
|
/* Fetches current database name.
|
|
|
|
* Returns true if database name is valid. */
|
2020-02-16 15:38:17 +00:00
|
|
|
bool gfx_thumbnail_get_db_name(gfx_thumbnail_path_data_t *path_data, const char **db_name);
|
2019-05-14 15:24:24 +00:00
|
|
|
|
|
|
|
/* Fetches current thumbnail image name
|
|
|
|
* (name is the same for all thumbnail types).
|
|
|
|
* Returns true if image name is valid. */
|
2020-02-16 15:38:17 +00:00
|
|
|
bool gfx_thumbnail_get_img_name(gfx_thumbnail_path_data_t *path_data, const char **img_name);
|
2019-05-14 15:24:24 +00:00
|
|
|
|
2019-05-16 13:32:25 +00:00
|
|
|
/* Fetches current content directory.
|
|
|
|
* Returns true if content directory is valid. */
|
2020-02-16 15:38:17 +00:00
|
|
|
bool gfx_thumbnail_get_content_dir(gfx_thumbnail_path_data_t *path_data, char *content_dir, size_t len);
|
2019-05-16 13:32:25 +00:00
|
|
|
|
2019-03-14 11:47:00 +00:00
|
|
|
RETRO_END_DECLS
|
|
|
|
|
|
|
|
#endif
|