Merge branch '63-add-badges-decals-e-g-for-favorites-completed-games-non-working-games-collections-and-folders' into 575-theme-add-a-modern-clean-switch-like-theme-as-an-official-theme-in-es-de-to-choose-from

This commit is contained in:
Sophia Hadash 2021-09-25 02:25:00 +02:00
commit 176953941a
576 changed files with 10616 additions and 7879 deletions

View file

@ -10,16 +10,72 @@
### Detailed list of changes
* Added alternative emulators support where additional emulators can be defined in es_systems.xml and be selected
system-wide or per game via the user interface
* Added a virtual keyboard partly based on code from batocera-emulationstation
* Added the ability to make complementary game system customizations without having to replace the entire bundled
es_systems.xml file
* Added a menu option to change the application exit key combination
* Expanded the themeable options for "helpsystem" to support custom button graphics, dimmed text and icon colors,
upper/lower/camel case and custom spacing
* Added support for using the left and right trigger buttons in the help prompts
* Removed the "Choose" entry from the help prompts in the gamelist view
* Changed the "Toggle screensaver" help entry in the system view to simply "Screensaver"
* Added support for upscaling bitmap images using linear filtering
* Changed the marquee image upscale filtering from nearest neighbor to linear for the launch screen and the gamelist
views
* Moved the Media Viewer and Screensaver settings higher in the UI Settings menu
* Moved the game media directory setting to the top of the Other Settings menu, following the new Alternative Emulators
entry
* Added a blinking cursor to TextEditComponent
* Changed the filter description "Text filter (game name)" to "Game name"
* Added support for a new type of "flat style" button to ButtonComponent
* Added support for correctly navigating arbitrarily sized ComponentGrid entries, i.e. those spanning multiple cells
* Bundled the bold font version of Fontfabric Akrobat
* Added the GLM (OpenGL Mathematics) library as a Git subtree
* Replaced all built-in matrix and vector data types and functions with GLM library equivalents
* Replaced some additional math functions and moved the remaining built-in functions to a math utility namespace
* Added a function to generate MD5 hashes
* Changed two clang-format rules related to braced lists and reformatted the codebase
* Moved the "complex" mode functionality from GuiComplexTextEditPopup into GuiTextEditPopup and removed the source files
for the former
* Increased the warning level for Clang/LLVM and GCC by adding -Wall, -Wpedantic and some additional flags
* Fixed a lot of compiler warnings introduced by the -Wall and -Wpedantic flags
* Changed the language standard from C++14 to C++17
* Increased the minimal required compiler version to 5.0.0 for Clang/LLVM and 7.1 for GCC
* Changed two clang-format rules related to braced lists and reformatted the codebase
### Bug fixes
* When multi-scraping in interactive mode with "Auto-accept single game matches" enabled, the game name could not be
refined if there were no games found
* When multi-scraping in interactive mode, the game counter was not decreased when skipping games, making it impossible
to skip the final games in the queue
* When multi-scraping in interactive mode, "No games found" results could be accepted using the "A" button
* When scraping in interactive mode, any refining done using the "Y" button shortcut would not be shown when doing
another refine using the "Refine search" button
* Input consisting of only whitespace characters would get accepted by TextEditComponent which led to various strange
behaviors
* Leading and trailing whitespace characters would not get trimmed from the collection name when creating a new custom
collection
* Leading and trailing whitespace characters would get included in scraper search refines and TheGamesDB searches
* Game name (text) filters were matching the system names for collection systems if the "Show system names in
collections" setting was enabled
* Brackets such as () and [] were filtered from game names in collection systems if the "Show system names in
collections" setting was enabled
* When navigating menus, the separator lines and menu components did not align properly and moved up and down slightly
* When scrolling in menus, pressing other buttons than "Up" or "Down" did not stop the scrolling which caused all sorts
of weird behavior
* With the menu scale-up effect enabled and entering a submenu before the parent menu was completely scaled up, the
parent would get stuck at a semi-scaled size
* Disabling a collection while its gamelist was displayed would lead to a slide transition from a black screen if a
gamelist on startup had been set
* When marking a game to not be counted in the metadata editor and the game was part of a custom collection, no
collection disabling notification was displayed
* Horizontal sizing of the TextComponent input field was not consistent across different screen resolutions
* The "sortname" window header was incorrectly spelled when editing this type of entry in the metadata editor
* When the last row of a menu had its text color changed, this color was completely desaturated when navigating to a
button below the list
## Version 1.1.0
**Release date:** 2021-08-10

View file

@ -1,3 +1,13 @@
# SPDX-License-Identifier: MIT
#
# EmulationStation Desktop Edition
# CMakeLists.txt
#
# Main CMake configuration file.
# Sets up the overall build environment including dependencies detection, build options,
# compiler and linker flags and preprocessor directives.
#
cmake_minimum_required(VERSION 3.13)
if(APPLE)
# Set this to the operating system version you're building on, and also update
@ -15,8 +25,7 @@ set(CMAKE_VERBOSE_MAKEFILE OFF CACHE BOOL "Show verbose compiler output" FORCE)
set(LINUX_CPACK_GENERATOR "DEB" CACHE STRING "CPack generator, DEB or RPM")
# Add local find modules to the CMake path.
list(APPEND CMAKE_MODULE_PATH
${CMAKE_CURRENT_SOURCE_DIR}/CMake/Utils
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake/Utils
${CMAKE_CURRENT_SOURCE_DIR}/CMake/Packages)
# Define the options.
@ -29,14 +38,20 @@ option(CLANG_TIDY "Set to ON to build using the clang-tidy static analyzer" ${CL
if (CLANG_TIDY)
find_program(CLANG_TIDY_BINARY NAMES clang-tidy)
if("${CLANG_TIDY_BINARY}" STREQUAL "CLANG_TIDY_BINARY-NOTFOUND")
if (CLANG_TIDY_BINARY STREQUAL "CLANG_TIDY_BINARY-NOTFOUND")
message("-- CLANG_TIDY was set but the clang-tidy binary was not found")
else()
else ()
message("-- Building with the clang-tidy static analyzer")
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=*,-fuchsia-*,-hicpp-*,-llvm-*, \
-readability-braces-*,-google-readability-braces-*, \
-readability-uppercase-literal-suffix,-modernize-use-trailing-return-type, \
-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers")
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=*,\
-fuchsia-*,\
-hicpp-*,\
-llvm-*,\
-readability-braces-*,\
-google-readability-braces-*,\
-readability-uppercase-literal-suffix,\
-modernize-use-trailing-return-type,\
-cppcoreguidelines-avoid-magic-numbers,\
-readability-magic-numbers")
endif()
endif()
@ -49,24 +64,24 @@ if(EXISTS "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/bcm_host.h")
# Setting BCMHOST seems to break OpenGL ES on the RPi 4 so set RPI instead.
#set(BCMHOST found)
set(RPI ON)
set(GLSystem "Embedded OpenGL" CACHE STRING "The OpenGL system to be used")
set(GLSYSTEM "Embedded OpenGL" CACHE STRING "The OpenGL system to be used")
elseif(GLES OR RPI)
set(GLSystem "Embedded OpenGL" CACHE STRING "The OpenGL system to be used")
set(GLSYSTEM "Embedded OpenGL" CACHE STRING "The OpenGL system to be used")
else()
set(GLSystem "Desktop OpenGL" CACHE STRING "The OpenGL system to be used")
set(GLSYSTEM "Desktop OpenGL" CACHE STRING "The OpenGL system to be used")
endif()
set_property(CACHE GLSystem PROPERTY STRINGS "Desktop OpenGL" "Embedded OpenGL")
set_property(CACHE GLSYSTEM PROPERTY STRINGS "Desktop OpenGL" "Embedded OpenGL")
#---------------------------------------------------------------------------------------------------
# Package dependencies.
if(${GLSystem} MATCHES "Desktop OpenGL")
if (GLSYSTEM MATCHES "Desktop OpenGL")
set(OpenGL_GL_PREFERENCE "GLVND")
find_package(OpenGL REQUIRED)
else()
else ()
find_package(OpenGLES REQUIRED)
endif()
endif ()
# Skip package dependency checks if we're on Windows.
if(NOT WIN32)
@ -88,75 +103,73 @@ if(CEC)
endif()
# Add ALSA for Linux.
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
find_package(ALSA REQUIRED)
endif()
endif ()
#---------------------------------------------------------------------------------------------------
# Compiler and linker settings.
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message("-- Compiler is Clang/LLVM")
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE CLANG_VERSION)
if(CLANG_VERSION VERSION_LESS 4.2.1)
message(SEND_ERROR "You need at least Clang 4.2.1 to compile EmulationStation-DE")
endif()
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0.0)
message(SEND_ERROR "You need at least Clang 5.0.0 to compile EmulationStation-DE")
endif ()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message("-- Compiler is GNU/GCC")
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpfullversion OUTPUT_VARIABLE G++_VERSION)
if(G++_VERSION VERSION_LESS 5.4)
message(SEND_ERROR "You need at least GCC 5.4 to compile EmulationStation-DE")
endif()
if(WIN32)
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.1)
message(SEND_ERROR "You need at least GCC 7.1 to compile EmulationStation-DE")
endif ()
if (WIN32)
set(CMAKE_CXX_FLAGS "-mwindows ${CMAKE_CXX_FLAGS}")
endif()
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
endif ()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
message("-- Compiler is MSVC")
# If using the MSVC compiler on Windows, disable the built-in min() and max() macros.
add_definitions(-DNOMINMAX)
endif()
endif ()
if (CMAKE_BUILD_TYPE)
message("-- Build type is ${CMAKE_BUILD_TYPE}")
endif()
endif ()
# Set up compiler and linker flags for debug, profiling or release builds.
if(CMAKE_BUILD_TYPE MATCHES Debug)
# Enable the C++17 standard and disable optimizations as it's a debug build.
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /Od /DEBUG:FULL")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O0")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O0 -Wall -Wpedantic -Wsign-compare -Wnarrowing -Wmissing-field-initializers -Wunused-macros")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O0")
endif()
endif ()
# If using Clang, then add additional debug data needed by GDB.
# Comment this out if you're using LLDB for debugging as this flag makes the binary
# much larger and the application much slower. On macOS this setting is never enabled
# as LLDB is the default debugger on this OS.
if(NOT APPLE AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
if (NOT APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_DEBUG")
endif()
endif ()
elseif(CMAKE_BUILD_TYPE MATCHES Profiling)
# For the profiling build, we enable optimizations and supply the required profiler flags.
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /O2 /DEBUG:FULL")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O2 -pg -g")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O2 -pg -g -Wall -Wpedantic -Wsign-compare -Wnarrowing -Wmissing-field-initializers -Wunused-macros")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O2 -pg")
endif()
endif ()
else()
# Enable the C++17 standard and enable optimizations as it's a release build.
# This will also disable all assert() macros. Strip the binary too.
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG /std:c++17 /O2 /DEBUG:NONE")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O2 -DNDEBUG")
if(APPLE)
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O2 -DNDEBUG -Wall -Wpedantic -Wsign-compare -Wnarrowing -Wmissing-field-initializers -Wunused-macros")
if (APPLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O2")
else()
else ()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O2 -s")
endif()
endif()
endif ()
endif ()
endif()
# The following removes half of the ranlib warnings on macOS regarding no symbols for files
@ -167,26 +180,26 @@ if(APPLE)
endif()
if(APPLE)
if(MACOS_CODESIGN_IDENTITY)
if (MACOS_CODESIGN_IDENTITY)
message("-- Code signing certificate identity: " ${MACOS_CODESIGN_IDENTITY})
endif()
if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_LESS 10.14)
endif ()
if (CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 10.14)
message("-- macOS version 10.13 or lower has been set, so if code signing is enabled, Hardened Runtime will not be used")
endif()
endif ()
endif()
#---------------------------------------------------------------------------------------------------
# Preprocessor directives.
if(${GLSystem} MATCHES "Desktop OpenGL")
if (GLSYSTEM MATCHES "Desktop OpenGL")
add_definitions(-DUSE_OPENGL_21)
else()
else ()
add_definitions(-DUSE_OPENGLES_10)
endif()
endif ()
if (VLC_PLAYER)
add_definitions(-DBUILD_VLC_PLAYER)
endif()
endif ()
if(DEFINED BCMHOST OR RPI)
add_definitions(-D_RPI_)
@ -204,13 +217,13 @@ add_definitions(-DGLM_FORCE_XYZW_ONLY)
# we use /usr on Linux, /usr/pkg on NetBSD and /usr/local on FreeBSD and OpenBSD.
if(NOT WIN32 AND NOT APPLE)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CMAKE_INSTALL_PREFIX "/usr" CACHE INTERNAL "CMAKE_INSTALL_PREFIX")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
elseif (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
set(CMAKE_INSTALL_PREFIX "/usr/pkg" CACHE INTERNAL "CMAKE_INSTALL_PREFIX")
else()
else ()
set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE INTERNAL "CMAKE_INSTALL_PREFIX")
endif()
endif ()
endif()
message("-- Installation prefix is set to " ${CMAKE_INSTALL_PREFIX})
add_definitions(-DES_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}")
@ -225,8 +238,7 @@ endif()
#---------------------------------------------------------------------------------------------------
# Include files.
set(COMMON_INCLUDE_DIRS
${CURL_INCLUDE_DIR}
set(COMMON_INCLUDE_DIRS ${CURL_INCLUDE_DIR}
${FFMPEG_INCLUDE_DIRS}
${FreeImage_INCLUDE_DIRS}
${FREETYPE_INCLUDE_DIRS}
@ -264,36 +276,33 @@ if(DEFINED libCEC_FOUND)
endif()
# For Linux, add the ALSA include directory.
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
list(APPEND COMMON_INCLUDE_DIRS ${ALSA_INCLUDE_DIRS})
endif()
endif ()
if(DEFINED BCMHOST OR RPI)
list(APPEND COMMON_INCLUDE_DIRS
"${CMAKE_FIND_ROOT_PATH}/opt/vc/include"
if (DEFINED BCMHOST OR RPI)
list(APPEND COMMON_INCLUDE_DIRS "${CMAKE_FIND_ROOT_PATH}/opt/vc/include"
"${CMAKE_FIND_ROOT_PATH}/opt/vc/include/interface/vcos"
"${CMAKE_FIND_ROOT_PATH}/opt/vc/include/interface/vmcs_host/linux"
"${CMAKE_FIND_ROOT_PATH}/opt/vc/include/interface/vcos/pthreads")
endif()
endif ()
#---------------------------------------------------------------------------------------------------
# Dependency libraries.
if(NOT WIN32)
set(COMMON_LIBRARIES
${CURL_LIBRARIES}
if (NOT WIN32)
set(COMMON_LIBRARIES ${CURL_LIBRARIES}
${FFMPEG_LIBRARIES}
${FreeImage_LIBRARIES}
${FREETYPE_LIBRARIES}
${PUGIXML_LIBRARIES}
${SDL2_LIBRARY})
if(VLC_PLAYER)
if (VLC_PLAYER)
set(COMMON_LIBRARIES ${COMMON_LIBRARIES} ${VLC_LIBRARIES})
endif()
elseif(WIN32)
if(DEFINED MSVC)
set(COMMON_LIBRARIES
"${PROJECT_SOURCE_DIR}/avcodec.lib"
endif ()
elseif (WIN32)
if (DEFINED MSVC)
set(COMMON_LIBRARIES "${PROJECT_SOURCE_DIR}/avcodec.lib"
"${PROJECT_SOURCE_DIR}/avfilter.lib"
"${PROJECT_SOURCE_DIR}/avformat.lib"
"${PROJECT_SOURCE_DIR}/avutil.lib"
@ -307,12 +316,11 @@ elseif(WIN32)
"${PROJECT_SOURCE_DIR}/SDL2main.lib"
"${PROJECT_SOURCE_DIR}/SDL2.lib"
"Winmm.dll")
if(VLC_PLAYER)
if (VLC_PLAYER)
set(COMMON_LIBRARIES ${COMMON_LIBRARIES} "${PROJECT_SOURCE_DIR}/libvlc.lib")
endif()
else()
set(COMMON_LIBRARIES
"${PROJECT_SOURCE_DIR}/avcodec-58.dll"
endif ()
else ()
set(COMMON_LIBRARIES "${PROJECT_SOURCE_DIR}/avcodec-58.dll"
"${PROJECT_SOURCE_DIR}/avfilter-7.dll"
"${PROJECT_SOURCE_DIR}/avformat-58.dll"
"${PROJECT_SOURCE_DIR}/avutil-56.dll"
@ -327,22 +335,20 @@ elseif(WIN32)
"${PROJECT_SOURCE_DIR}/SDL2.dll"
"mingw32"
"Winmm.dll")
if(VLC_PLAYER)
if (VLC_PLAYER)
set(COMMON_LIBRARIES ${COMMON_LIBRARIES} "${PROJECT_SOURCE_DIR}/libvlc.dll")
endif()
endif()
endif ()
endif ()
endif()
if(APPLE)
# See es-app/CMakeLists.txt for an explation for why an extra 'Resources' directory
# See es-app/CMakeLists.txt for an explation for why an extra "Resources" directory
# has been added to the install prefix.
set(CMAKE_INSTALL_PREFIX
"/Applications/EmulationStation Desktop Edition.app/Contents/Resources")
set(CMAKE_INSTALL_PREFIX "/Applications/EmulationStation Desktop Edition.app/Contents/Resources")
if(VLC_PLAYER)
# Required as the VLC find module doesn't work properly on macOS.
set(COMMON_LIBRARIES ${COMMON_LIBRARIES}
"/Applications/VLC.app/Contents/MacOS/lib/libvlc.dylib")
set(COMMON_LIBRARIES ${COMMON_LIBRARIES} "/Applications/VLC.app/Contents/MacOS/lib/libvlc.dylib")
endif()
# Set the same rpath links for the install executable as for the build executable.
@ -360,9 +366,9 @@ if(DEFINED libCEC_FOUND)
endif()
# Add ALSA for Linux libraries.
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
list(APPEND COMMON_LIBRARIES ${ALSA_LIBRARY})
endif()
endif ()
if(DEFINED BCMHOST)
link_directories("${CMAKE_FIND_ROOT_PATH}/opt/vc/lib")
@ -372,11 +378,11 @@ elseif(RPI)
list(APPEND COMMON_LIBRARIES ${OPENGLES_LIBRARIES})
endif()
if(${GLSystem} MATCHES "Desktop OpenGL")
if (GLSYSTEM MATCHES "Desktop OpenGL")
list(APPEND COMMON_LIBRARIES ${OPENGL_LIBRARIES})
else()
else ()
list(APPEND COMMON_LIBRARIES EGL ${OPENGLES_LIBRARIES})
endif()
endif ()
#---------------------------------------------------------------------------------------------------
# Build directories.

View file

@ -31,8 +31,8 @@ This plan is under constant review so expect it to change from time to time. Sti
* Support for pre-defined alternative emulators and cores (configured in es_systems.xml)
* Badges highlighting things like favorite games, completed games etc. (will require theme support)
* Improved full-screen support, removing the temporary full-screen hacks
* On-screen keyboard
* Support for the Raspberry Pi 4 with OpenGL ES 2.0 and GLSL shaders (Raspberry Pi OS)
* Virtual (on-screen) keyboard
* Support for the Raspberry Pi 4 (Raspberry Pi OS)
* Add GLM library dependency for matrix and vector operations, decommission the built-in functions
* Add to more Linux repositories, BSD ports collections etc.
* Flatpak and Snap releases on Linux
@ -40,8 +40,9 @@ This plan is under constant review so expect it to change from time to time. Sti
#### v1.3
* Localization/multi-language support
* Overhaul of the theme handling, adding capabilities and improving compatibility with Recalbox and Batocera themes
* Scrapping the Grid view style and adding a general grid/wall component instead
* New theme engine with generalized views (only System and Gamelist) and theme variants support
* Add multiple new gamelist components (wheels, wall/grid etc.)
* Move existing theme logic to legacy support, only to be used for backwards compatibility
* Checksum support for the scraper for exact searches and for determining when to overwrite files
* Improved text and font functions, e.g. faster and cleaner line wrapping and more exact sizing

View file

@ -11,8 +11,6 @@ https://retropie.org.uk
Leon Styhre (Desktop Edition fork, based on the RetroPie version) \
https://gitlab.com/leonstyhre/emulationstation-de
The shader code for blur_horizontal.glsl, blur_vertical_glsl and scanlines.glsl has been borrowed from the [RetroArch](https://www.retroarch.com) project.
# UI Art & Design
@ -62,6 +60,16 @@ https://rapidjson.org
SDL \
https://www.libsdl.org
# Code
Some code (like the virtual keyboard) was borrowed from Batocera.linux \
https://batocera.org
The MD5 hash functions were adapted from code by the BZFlag project \
https://www.bzflag.org
A few of the GLSL shaders were borrowed from the RetroArch project \
https://www.retroarch.com
# Resources

View file

@ -125,7 +125,9 @@ pkg_add vlc
In the same manner as for FreeBSD, Clang/LLVM and cURL should already be installed by default.
RapidJSON is not part of the OpenBSD ports/package collection as of v6.8, so you need to compile it yourself. At the time of writing, the latest release v1.1.0 does not compile on OpenBSD, so you need to use the master branch:
RapidJSON is not part of the OpenBSD ports/package collection as of v6.8, so you need to compile it yourself. At the
time of writing, the latest release v1.1.0 does not compile on OpenBSD, so you need to use the latest available code
from the master branch:
```
git clone https://github.com/Tencent/rapidjson.git
@ -865,6 +867,7 @@ nmake
```
MinGW:
```
cmake -G "MinGW Makefiles" -DBUILD_SHARED_LIBS=ON .
make
@ -872,16 +875,15 @@ make
[RapidJSON](http://rapidjson.org)
For RapidJSON you don't need to compile, you just need the include files:
For RapidJSON you don't need to compile anything, you just need the include files.
At the time of writing, the latest release v1.1.0 generates some compiler warnings on Windows, but this can be avoided
by using the latest available code from the master branch:
```
git clone git://github.com/Tencent/rapidjson.git
cd rapidjson
git checkout v1.1.0
```
**Clone the ES-DE repository:**
This works the same as on Unix or macOS, just run the following:
@ -1174,11 +1176,11 @@ In some instances you may want to avoid getting code formatted, and you can acco
```c++
// clang-format off
CollectionSystemDecl systemDecls[] = {
// Type Name Long name Theme folder isCustom
{ AUTO_ALL_GAMES, "all", "all games", "auto-allgames", false },
{ AUTO_LAST_PLAYED, "recent", "last played", "auto-lastplayed", false },
{ AUTO_FAVORITES, "favorites", "favorites", "auto-favorites", false },
{ CUSTOM_COLLECTION, myCollectionsName, "collections", "custom-collections", true }
// Type Name Long name Theme folder isCustom
{AUTO_ALL_GAMES, "all", "all games", "auto-allgames", false},
{AUTO_LAST_PLAYED, "recent", "last played", "auto-lastplayed", false},
{AUTO_FAVORITES, "favorites", "favorites", "auto-favorites", false},
{CUSTOM_COLLECTION, myCollectionsName, "collections", "custom-collections", true }
};
// clang-format on
```
@ -1396,26 +1398,44 @@ For the following options, the es_settings.xml file is immediately updated/saved
--show-hidden-games
```
## es_systems.xml
The es_systems.xml file contains the system configuration data for ES-DE, written in XML format. This defines the system name, the full system name, the ROM path, the allowed file extensions, the launch command, the platform (for scraping) and the theme to use.
The es_systems.xml file contains the game systems configuration data for ES-DE, written in XML format. This defines the
system name, the full system name, the ROM path, the allowed file extensions, the launch command, the platform (for
scraping) and the theme to use.
ES-DE ships with a comprehensive `es_systems.xml` configuration file and normally you shouldn't need to modify this. However there may be special circumstances such as wanting to use alternative emulators for some game systems or perhaps you need to add additional systems altogether.
ES-DE ships with a comprehensive `es_systems.xml` file and most users will probably never need to make any
customizations. But there may be special circumstances such as wanting to use different emulators for some game systems
or perhaps to add additional systems altogether.
To make a customized version of the systems configuration file, it first needs to be copied to `~/.emulationstation/custom_systems/es_systems.xml`. (The tilde symbol `~` translates to `$HOME` on Unix and macOS, and to `%HOMEPATH%` on Windows unless overridden using the --home command line option.)
To accomplish this, ES-DE supports customizations via a separate es_systems.xml file that is to be placed in
the `custom_systems` folder in the application home directory, i.e. `~/.emulationstation/custom_systems/es_systems.xml`
. (The tilde symbol `~` translates to `$HOME` on Unix and macOS, and to `%HOMEPATH%` on Windows unless overridden via
the --home command line option.)
The bundled es_systems.xml file is located in the resources directory that is part of the application installation. For example this could be `/usr/share/emulationstation/resources/systems/unix/es_systems.xml` on Unix, `/Applications/EmulationStation Desktop Edition.app/Contents/Resources/resources/systems/macos/es_systems.xml` on macOS or `C:\Program Files\EmulationStation-DE\resources\systems\windows\es_systems.xml` on Windows. The actual location may differ from these examples of course, depending on where ES-DE has been installed.
This custom file functionality is designed to be complementary to the bundled es_systems.xml file, meaning you should
only add entries to the custom configuration file for game systems that you actually want to add or override. So to for
example customize a single system, this file should only contain a single `<system>` tag. The structure of the custom
file is identical to the bundled file with the exception of an additional optional tag named `<loadExclusive/>`. If this
is placed in the custom es_systems.xml file, ES-DE will not load the bundled file. This is normally not recommended and
should only be used for special situations. At the end of this section you can find an example of a custom
es_systems.xml file.
Note that when copying the bundled es_systems.xml file to ~/.emulationstation/custom_systems/, it will completely replace the default file processing. So when upgrading to future ES-DE versions, any modifications such as additional game systems will not be enabled until the customized configuration file has been manually updated.
The bundled es_systems.xml file is located in the resources directory that is part of the application installation. For
example this could be `/usr/share/emulationstation/resources/systems/unix/es_systems.xml` on
Unix, `/Applications/EmulationStation Desktop Edition.app/Contents/Resources/resources/systems/macos/es_systems.xml` on
macOS or `C:\Program Files\EmulationStation-DE\resources\systems\windows\es_systems.xml` on Windows. The actual location
may differ from these examples of course, depending on where ES-DE has been installed.
It doesn't matter in which order you define the systems as they will be sorted by the full system name inside the application, but it's still probably a good idea to add them in alphabetical order to make the file easier to maintain.
It doesn't matter in which order you define the systems as they will be sorted by the full system name inside the
application, but it's still probably a good idea to add them in alphabetical order to make the file easier to maintain.
Keep in mind that you have to set up your emulators separately from ES-DE as the es_systems.xml file assumes that your emulator environment is properly configured.
Keep in mind that you have to set up your emulators separately from ES-DE as the es_systems.xml file assumes that your
emulator environment is properly configured.
Below is an overview of the file layout with various examples. For the command tag, the newer es_find_rules.xml logic described later in this document removes the need for most of the legacy options, but they are still supported for special configurations and for backward compatibility with old configuration files.
For a real system entry there can of course not be multiple entries for the same tag such as the multiple \<command\> entries listed here.
Below is an overview of the file layout with various examples. For the command tag, the newer es_find_rules.xml logic
described later in this document removes the need for most of the legacy options, but they are still supported for
special configurations and for backward compatibility with old configuration files.
```xml
<?xml version="1.0"?>
@ -1424,7 +1444,9 @@ For a real system entry there can of course not be multiple entries for the same
<!-- Any tag not explicitly described as optional in the description is mandatory.
If omitting a mandatory tag, ES-DE will skip the system entry during startup. -->
<system>
<!-- A short name, used internally. -->
<!-- A short name. Although there can be multiple identical <name> tags in the file, upon successful loading of a system,
any succeeding entries with identical <name> tags will be skipped. Multiple identical name tags is only required for very
special situations so it's normally recommended to keep this tag unique. -->
<name>snes</name>
<!-- The full system name, used for sorting the systems, for selecting the systems to multi-scrape etc. -->
@ -1436,14 +1458,22 @@ For a real system entry there can of course not be multiple entries for the same
<path>%ROMPATH%/snes</path>
<!-- A list of extensions to search for, delimited by any of the whitespace characters (", \r\n\t").
You must include the period at the start of the extension and it's also case sensitive. -->
The extensions are case sensitive and they must begin with a dot. -->
<extension>.smc .SMC .sfc .SFC .swc .SWC .fig .FIG .bs .BS .bin .BIN .mgd .MGD .7z .7Z .zip .ZIP</extension>
<!-- The command executed when a game is launched. A few special variables are replaced if found for a command tag (see below).
<!-- The command executed when a game is launched. Various variables are replaced if found for a command tag as explained below.
This example for Unix uses the %EMULATOR_ and %CORE_ variables which utilize the find rules defined in the es_find_rules.xml
file. This is the recommended way to configure the launch command. -->
<command>%EMULATOR_RETROARCH% -L %CORE_RETROARCH%/snes9x_libretro.so %ROM%</command>
<!-- It's possible to define alternative emulators by adding additional command tags for a system. When doing this,
the "label" attribute is mandatory for all tags. It's these labels that will be shown in the user interface when
selecting the alternative emulators either system-wide or per game. The first row will be the default emulator. -->
<command label="Nestopia UE">%EMULATOR_RETROARCH% -L %CORE_RETROARCH%/nestopia_libretro.so %ROM%</command>
<command label="FCEUmm">%EMULATOR_RETROARCH% -L %CORE_RETROARCH%/fceumm_libretro.so %ROM%</command>
<command label="Mesen">%EMULATOR_RETROARCH% -L %CORE_RETROARCH%/mesen_libretro.so %ROM%</command>
<command label="QuickNES">%EMULATOR_RETROARCH% -L %CORE_RETROARCH%/quicknes_libretro.so %ROM%</command>
<!-- This example for Unix will search for RetroArch in the PATH environment variable and it also has an absolute path to
the snes9x_libretro core, If there are spaces in the path or file name, you must enclose them in quotation marks, such as
retroarch -L "~/my configs/retroarch/cores/snes9x_libretro.so" %ROM% -->
@ -1518,103 +1548,147 @@ The following variables are expanded for the `command` tag:
Here are some additional real world examples of system entries, the first one for Unix:
```xml
<system>
<system>
<name>dos</name>
<fullname>DOS (PC)</fullname>
<path>%ROMPATH%/dos</path>
<extension>.bat .BAT .com .COM .conf .CONF .cue .CUE .exe .EXE .iso .ISO .7z .7Z .zip .ZIP</extension>
<command>%EMULATOR_RETROARCH% -L %CORE_RETROARCH%/dosbox_core_libretro.so %ROM%</command>
<command label="DOSBox-Core">%EMULATOR_RETROARCH% -L %CORE_RETROARCH%/dosbox_core_libretro.so %ROM%</command>
<command label="DOSBox-Pure">%EMULATOR_RETROARCH% -L %CORE_RETROARCH%/dosbox_pure_libretro.so %ROM%</command>
<command label="DOSBox-SVN">%EMULATOR_RETROARCH% -L %CORE_RETROARCH%/dosbox_svn_libretro.so %ROM%</command>
<platform>dos</platform>
<theme>dos</theme>
</system>
</system>
```
Then one for macOS:
```xml
<system>
<name>nes</name>
<fullname>Nintendo Entertainment System</fullname>
<path>%ROMPATH%/nes</path>
<extension>.nes .NES .unf .UNF .unif .UNIF .7z .7Z .zip .ZIP</extension>
<command>%EMULATOR_RETROARCH% -L %CORE_RETROARCH%/nestopia_libretro.dylib %ROM%</command>
<platform>nes</platform>
<theme>nes</theme>
</system>
<system>
<name>n64</name>
<fullname>Nintendo 64</fullname>
<path>%ROMPATH%/n64</path>
<extension>.n64 .N64 .v64 .V64 .z64 .Z64 .bin .BIN .u1 .U1 .7z .7Z .zip .ZIP</extension>
<command>%EMULATOR_RETROARCH% -L %CORE_RETROARCH%/parallel_n64_libretro.dylib %ROM%</command>
<platform>n64</platform>
<theme>n64</theme>
</system>
```
And finally one for Windows:
```xml
<system>
<name>sega32x</name>
<fullname>Sega Mega Drive 32X</fullname>
<path>%ROMPATH%\sega32x</path>
<extension>.bin .BIN .gen .GEN .smd .SMD .md .MD .32x .32X .cue .CUE .iso .ISO .sms .SMS .68k .68K .7z .7Z .zip .ZIP</extension>
<command>%EMULATOR_RETROARCH% -L %CORE_RETROARCH%\picodrive_libretro.dll %ROM%</command>
<platform>sega32x</platform>
<theme>sega32x</theme>
</system>
<system>
<name>pcengine</name>
<fullname>NEC PC Engine</fullname>
<path>%ROMPATH%\pcengine</path>
<extension>.bin .BIN .ccd .CCD .chd .CHD .cue .CUE .img .IMG .iso .ISO .m3u .M3U .pce .PCE .sgx .SGX .toc .TOC .7z .7Z .zip .ZIP</extension>
<command label="Beetle PCE">%EMULATOR_RETROARCH% -L %CORE_RETROARCH%\mednafen_pce_libretro.dll %ROM%</command>
<command label="Beetle PCE FAST">%EMULATOR_RETROARCH% -L %CORE_RETROARCH%\mednafen_pce_fast_libretro.dll %ROM%</command>
<platform>pcengine</platform>
<theme>pcengine</theme>
</system>
```
As well, here's an example for Unix of a custom es_systems.xml file placed in ~/.emulationstation/custom_systems/ that
overrides a single game system from the bundled configuration file:
```xml
<?xml version="1.0"?>
<!-- This is a custom ES-DE game systems configuration file for Unix -->
<systemList>
<system>
<name>nes</name>
<fullname>Nintendo Entertainment System</fullname>
<path>%ROMPATH%/nes</path>
<extension>.nes .NES .zip .ZIP</extension>
<command>/usr/games/fceux %ROM%</command>
<platform>nes</platform>
<theme>nes</theme>
</system>
</systemList>
```
If adding the `<loadExclusive/>` tag to the file, the bundled es_systems.xml file will not be processed. For this
example it wouldn't be a very good idea as NES would then be the only platform that could be used in ES-DE.
```xml
<?xml version="1.0"?>
<!-- This is a custom ES-DE game systems configuration file for Unix -->
<loadExclusive/>
<systemList>
<system>
<name>nes</name>
<fullname>Nintendo Entertainment System</fullname>
<path>%ROMPATH%/nes</path>
<extension>.nes .NES .zip .ZIP</extension>
<command>/usr/games/fceux %ROM%</command>
<platform>nes</platform>
<theme>nes</theme>
</system>
</systemList>
```
## es_find_rules.xml
This file makes it possible to define rules for where to search for the emulator binaries and emulator cores.
The file is located in the resources directory in the same location as the es_systems.xml file, but a customized copy can be placed in ~/.emulationstation/custom_systems, which will override the bundled file.
The file is located in the resources directory in the same location as the es_systems.xml file, but a customized copy
can be placed in ~/.emulationstation/custom_systems, which will override the bundled file.
Here's an example es_find_rules.xml file for Unix:
```xml
<?xml version="1.0"?>
<!-- This is the ES-DE find rules configuration file for Unix -->
<ruleList>
<emulator name="RETROARCH">
<rule type="systempath">
<entry>retroarch</entry>
<entry>org.libretro.RetroArch</entry>
<entry>RetroArch-Linux-x86_64.AppImage</entry>
</rule>
<rule type="staticpath">
<entry>/var/lib/flatpak/exports/bin/org.libretro.RetroArch</entry>
<entry>~/Applications/RetroArch-Linux-x86_64.AppImage</entry>
<entry>~/.local/bin/RetroArch-Linux-x86_64.AppImage</entry>
<entry>~/bin/RetroArch-Linux-x86_64.AppImage</entry>
</rule>
</emulator>
<emulator name="YUZU">
<!-- Nintendo Switch emulator Yuzu -->
<rule type="systempath">
<entry>yuzu</entry>
<entry>org.yuzu_emu.yuzu</entry>
<entry>yuzu.AppImage</entry>
</rule>
<rule type="staticpath">
<entry>/var/lib/flatpak/exports/bin/org.yuzu_emu.yuzu</entry>
<entry>~/Applications/yuzu.AppImage</entry>
<entry>~/.local/bin/yuzu.AppImage</entry>
<entry>~/bin/yuzu.AppImage</entry>
</rule>
</emulator>
<core name="RETROARCH">
<rule type="corepath">
<!-- Snap package -->
<entry>~/snap/retroarch/current/.config/retroarch/cores</entry>
<!-- Flatpak package -->
<entry>~/.var/app/org.libretro.RetroArch/config/retroarch/cores</entry>
<!-- AppImage and compiled from source -->
<entry>~/.config/retroarch/cores</entry>
<!-- Ubuntu and Linux Mint repository -->
<entry>/usr/lib/x86_64-linux-gnu/libretro</entry>
<!-- Fedora repository -->
<entry>/usr/lib64/libretro</entry>
<!-- Manjaro repository -->
<entry>/usr/lib/libretro</entry>
<!-- FreeBSD and OpenBSD repository -->
<entry>/usr/local/lib/libretro</entry>
<!-- NetBSD repository -->
<entry>/usr/pkg/lib/libretro</entry>
</rule>
</core>
<emulator name="RETROARCH">
<rule type="systempath">
<entry>retroarch</entry>
<entry>org.libretro.RetroArch</entry>
<entry>RetroArch-Linux-x86_64.AppImage</entry>
</rule>
<rule type="staticpath">
<entry>/var/lib/flatpak/exports/bin/org.libretro.RetroArch</entry>
<entry>~/Applications/RetroArch-Linux-x86_64.AppImage</entry>
<entry>~/.local/bin/RetroArch-Linux-x86_64.AppImage</entry>
<entry>~/bin/RetroArch-Linux-x86_64.AppImage</entry>
</rule>
</emulator>
<emulator name="YUZU">
<!-- Nintendo Switch emulator Yuzu -->
<rule type="systempath">
<entry>yuzu</entry>
<entry>org.yuzu_emu.yuzu</entry>
<entry>yuzu.AppImage</entry>
</rule>
<rule type="staticpath">
<entry>/var/lib/flatpak/exports/bin/org.yuzu_emu.yuzu</entry>
<entry>~/Applications/yuzu.AppImage</entry>
<entry>~/.local/bin/yuzu.AppImage</entry>
<entry>~/bin/yuzu.AppImage</entry>
</rule>
</emulator>
<core name="RETROARCH">
<rule type="corepath">
<!-- Snap package -->
<entry>~/snap/retroarch/current/.config/retroarch/cores</entry>
<!-- Flatpak package -->
<entry>~/.var/app/org.libretro.RetroArch/config/retroarch/cores</entry>
<!-- AppImage and compiled from source -->
<entry>~/.config/retroarch/cores</entry>
<!-- Ubuntu and Linux Mint repository -->
<entry>/usr/lib/x86_64-linux-gnu/libretro</entry>
<!-- Fedora repository -->
<entry>/usr/lib64/libretro</entry>
<!-- Manjaro repository -->
<entry>/usr/lib/libretro</entry>
<!-- FreeBSD and OpenBSD repository -->
<entry>/usr/local/lib/libretro</entry>
<!-- NetBSD repository -->
<entry>/usr/pkg/lib/libretro</entry>
</rule>
</core>
</ruleList>
```
@ -1655,19 +1729,19 @@ For reference, here are also example es_find_rules.xml files for macOS and Windo
<?xml version="1.0"?>
<!-- This is the ES-DE find rules configuration file for macOS -->
<ruleList>
<emulator name="RETROARCH">
<rule type="staticpath">
<entry>/Applications/RetroArch.app/Contents/MacOS/RetroArch</entry>
</rule>
</emulator>
<core name="RETROARCH">
<rule type="corepath">
<!-- RetroArch >= v1.9.2 -->
<entry>~/Library/Application Support/RetroArch/cores</entry>
<!-- RetroArch < v1.9.2 -->
<entry>/Applications/RetroArch.app/Contents/Resources/cores</entry>
</rule>
</core>
<emulator name="RETROARCH">
<rule type="staticpath">
<entry>/Applications/RetroArch.app/Contents/MacOS/RetroArch</entry>
</rule>
</emulator>
<core name="RETROARCH">
<rule type="corepath">
<!-- RetroArch >= v1.9.2 -->
<entry>~/Library/Application Support/RetroArch/cores</entry>
<!-- RetroArch < v1.9.2 -->
<entry>/Applications/RetroArch.app/Contents/Resources/cores</entry>
</rule>
</core>
</ruleList>
```
@ -1675,48 +1749,48 @@ For reference, here are also example es_find_rules.xml files for macOS and Windo
<?xml version="1.0"?>
<!-- This is the ES-DE find rules configuration file for Windows -->
<ruleList>
<emulator name="RETROARCH">
<rule type="winregistrypath">
<!-- Check for an App Paths entry in the Windows Registry -->
<entry>retroarch.exe</entry>
</rule>
<rule type="systempath">
<!-- This requires that the user has manually updated the Path variable -->
<entry>retroarch.exe</entry>
</rule>
<rule type="staticpath">
<!-- Some reasonable installation locations as fallback -->
<entry>C:\RetroArch-Win64\retroarch.exe</entry>
<entry>C:\RetroArch\retroarch.exe</entry>
<entry>~\AppData\Roaming\RetroArch\retroarch.exe</entry>
<entry>C:\Program Files\RetroArch-Win64\retroarch.exe</entry>
<entry>C:\Program Files\RetroArch\retroarch.exe</entry>
<entry>C:\Program Files (x86)\RetroArch-Win64\retroarch.exe</entry>
<entry>C:\Program Files (x86)\RetroArch\retroarch.exe</entry>
<!-- Portable installation -->
<entry>%ESPATH%\RetroArch-Win64\retroarch.exe</entry>
<entry>%ESPATH%\RetroArch\retroarch.exe</entry>
<entry>%ESPATH%\..\RetroArch-Win64\retroarch.exe</entry>
<entry>%ESPATH%\..\RetroArch\retroarch.exe</entry>
</rule>
</emulator>
<emulator name="YUZU">
<!-- Nintendo Switch emulator Yuzu -->
<rule type="systempath">
<entry>yuzu.exe</entry>
</rule>
<rule type="staticpath">
<entry>~\AppData\Local\yuzu\yuzu-windows-msvc\yuzu.exe</entry>
<!-- Portable installation -->
<entry>%ESPATH%\yuzu\yuzu-windows-msvc\yuzu.exe</entry>
<entry>%ESPATH%\..\yuzu\yuzu-windows-msvc\yuzu.exe</entry>
</rule>
</emulator>
<core name="RETROARCH">
<rule type="corepath">
<entry>%EMUPATH%\cores</entry>
</rule>
</core>
<emulator name="RETROARCH">
<rule type="winregistrypath">
<!-- Check for an App Paths entry in the Windows Registry -->
<entry>retroarch.exe</entry>
</rule>
<rule type="systempath">
<!-- This requires that the user has manually updated the Path variable -->
<entry>retroarch.exe</entry>
</rule>
<rule type="staticpath">
<!-- Some reasonable installation locations as fallback -->
<entry>C:\RetroArch-Win64\retroarch.exe</entry>
<entry>C:\RetroArch\retroarch.exe</entry>
<entry>~\AppData\Roaming\RetroArch\retroarch.exe</entry>
<entry>C:\Program Files\RetroArch-Win64\retroarch.exe</entry>
<entry>C:\Program Files\RetroArch\retroarch.exe</entry>
<entry>C:\Program Files (x86)\RetroArch-Win64\retroarch.exe</entry>
<entry>C:\Program Files (x86)\RetroArch\retroarch.exe</entry>
<!-- Portable installation -->
<entry>%ESPATH%\RetroArch-Win64\retroarch.exe</entry>
<entry>%ESPATH%\RetroArch\retroarch.exe</entry>
<entry>%ESPATH%\..\RetroArch-Win64\retroarch.exe</entry>
<entry>%ESPATH%\..\RetroArch\retroarch.exe</entry>
</rule>
</emulator>
<emulator name="YUZU">
<!-- Nintendo Switch emulator Yuzu -->
<rule type="systempath">
<entry>yuzu.exe</entry>
</rule>
<rule type="staticpath">
<entry>~\AppData\Local\yuzu\yuzu-windows-msvc\yuzu.exe</entry>
<!-- Portable installation -->
<entry>%ESPATH%\yuzu\yuzu-windows-msvc\yuzu.exe</entry>
<entry>%ESPATH%\..\yuzu\yuzu-windows-msvc\yuzu.exe</entry>
</rule>
</emulator>
<core name="RETROARCH">
<rule type="corepath">
<entry>%EMUPATH%\cores</entry>
</rule>
</core>
</ruleList>
```
@ -1807,8 +1881,8 @@ There are two basic categories of metadata, `game` and `folders` and the metdata
* `nogamecount` - bool, indicates whether the game should be excluded from the game counter and the automatic and custom collections
* `nomultiscrape` - bool, indicates whether the game should be excluded from the multi-scraper
* `hidemetadata` - bool, indicates whether to hide most of the metadata fields when displaying the game in the gamelist view
* `launchcommand` - string, overrides the emulator and core settings on a per-game basis
* `playcount` - integer, the number of times this game has been played
* `altemulator` - string, overrides the emulator/launch command on a per game basis
* `lastplayed` - statistic, datetime, the last date and time this game was played
For folders, most of the fields are identical although some are removed. In the list below, the fields with identical function compared to the game files described above have been left without a description.

View file

@ -8,9 +8,6 @@ Web site:\
YouTube channel with installation instruction videos:\
[https://www.youtube.com/channel/UCosLuC9yIMQPKFBJXgDpvVQ](https://www.youtube.com/channel/UCosLuC9yIMQPKFBJXgDpvVQ)
Twitter:\
[https://twitter.com/ESDE_Frontend](https://twitter.com/ESDE_Frontend)
Discord server:\
[https://discord.gg/3jmbRXFe](https://discord.gg/EVVX4DqWAP)
@ -44,7 +41,8 @@ The latest version is 1.1.0 (released 2021-08-10)
| :------------------ | :------------------------------------------------------ | :----------- | :------------- |
| Debian DEB package | Ubuntu 20.04 to 21.04, Linux Mint 20, possibly others | x64 (x86) | [emulationstation-de-1.1.0-x64.deb](https://gitlab.com/leonstyhre/emulationstation-de/-/package_files/14892301/download)|
| Fedora RPM package | Fedora Workstation 33, possibly others | x64 (x86) | [emulationstation-de-1.1.0-x64.rpm](https://gitlab.com/leonstyhre/emulationstation-de/-/package_files/14892436/download)|
| Debian DEB package | Raspberry Pi OS (Raspian) - preview release | ARM | [emulationstation-de-1.1.0-preview-armv7l.deb](https://gitlab.com/leonstyhre/emulationstation-de/-/package_files/14892276/download)|
| Debian DEB package | Raspberry Pi OS (Raspian) - preview release | ARM 32-bit | [emulationstation-de-1.1.0-preview-armv7l.deb](https://gitlab.com/leonstyhre/emulationstation-de/-/package_files/14892276/download)|
| Debian DEB package | Raspberry Pi OS (Raspian) - preview release | ARM 64-bit | [emulationstation-de-1.1.0-preview-aarch64.deb](https://gitlab.com/leonstyhre/emulationstation-de/-/package_files/16221679/download)|
| macOS DMG installer | macOS 10.14 "Mojave" to 11 "Big Sur" | x64 (x86) | [EmulationStation-DE-1.1.0-x64.dmg](https://gitlab.com/leonstyhre/emulationstation-de/-/package_files/14892342/download)|
| Windows installer | Windows 10 and 8.1 | x64 (x86) | [EmulationStation-DE-1.1.0-x64.exe](https://gitlab.com/leonstyhre/emulationstation-de/-/package_files/14892429/download)|
@ -82,32 +80,32 @@ If you would like to contribute to the development of ES-DE, then that's great!
Here are some highlights of what EmulationStation Desktop Edition provides, displayed using the default theme set rbsimple-DE. There are of course many more features available, as covered in the [User guide](USERGUIDE.md).
![alt text](images/current/es-de_system_view.png "ES-DE System View")
![alt text](images/es-de_system_view.png "ES-DE System View")
_The **System view**, which is the default starting point for the application, it's here that you browse through your game systems._
![alt text](images/current/es-de_gamelist_view.png "ES-DE Gamelist View")
![alt text](images/es-de_gamelist_view.png "ES-DE Gamelist View")
_The **Gamelist view**, it's here that you browse the games for a specific system. Note the support for mixing files and folders, and as well that favorite games are marked with stars. There is a game counter to the upper right, displaying the total number of games and the number of favorite games for this system._
![alt text](images/current/es-de_folder_support.png "ES-DE Folder Support")
![alt text](images/es-de_folder_support.png "ES-DE Folder Support")
_Another example of the gamelist view, displaying advanced folder support. You can scrape folders for game info and game media, sort folders as you would files, mark them as favorites etc. In this example ES-DE has been configured to sort favorite games above non-favorites._
![alt text](images/current/es-de_custom_collections.png "ES-DE Custom Collections")
![alt text](images/es-de_custom_collections.png "ES-DE Custom Collections")
_Games can be grouped into your own custom collections, in this example they're defined as game genres but you can name them anything you like. All gamelist views including the custom collections support both game images or game videos. By default the rbsimple-DE theme will display the game image for a short moment before starting to play the video._
![alt text](images/current/es-de_scraper_running.png "ES-DE Scraper Running")
![alt text](images/es-de_scraper_running.png "ES-DE Scraper Running")
_This is a view of the built-in scraper which downloads game info and game media from either [screenscraper.fr](https://screenscraper.fr) or [thegamesdb.net](https://thegamesdb.net). It's possible to scrape a single game, or to run the multi-scraper which can scrape a complete game system or even your entire collection._
![alt text](images/current/es-de_scraper_settings.png "ES-DE Scraper Settings")
![alt text](images/es-de_scraper_settings.png "ES-DE Scraper Settings")
_There are many settings for the scraper including options to define which type of info and media to download. The above screenshot shows only a portion of these settings._
![alt text](images/current/es-de_metadata_editor.png "ES-DE Metadata Editor")
![alt text](images/es-de_metadata_editor.png "ES-DE Metadata Editor")
_In addition to the scraper there is a fully-featured metadata editor that can be used to modify information on a per-game basis. Here you can also toggle some additional flags which the scraper does not set, such as if the game is a favorite or if you have completed it. Some of these flags can then be filtered in the gamelist view, letting you for instance only display games that you have not played through._
![alt text](images/current/es-de_screensaver.png "ES-DE Screensaver")
![alt text](images/es-de_screensaver.png "ES-DE Screensaver")
_There are four types of built-in screensavers available, including a slideshow and the video screensaver shown in action above. These screensavers start after a configurable number of minutes of inactivity, and randomly display game media that you have previously scraped. If the corresponding option has been enabled, you can jump to the game from the screensaver, or even start it directly. There is shader support in ES-DE to render scanlines and screen blur on top of the videos (for the slideshow screensaver, scanline rendering is provided)._
![alt text](images/current/es-de_ui_theme_support.png "ES-DE Theme Support")
![alt text](images/es-de_ui_theme_support.png "ES-DE Theme Support")
_ES-DE is fully themeable, so if you prefer another look than what the default theme rbsimple-DE gives you, it's possible to apply another theme set. In the example above a modified version of the [Fundamental](https://github.com/G-rila/es-theme-fundamental) theme is used. Be aware though that although ES-DE is backwards compatible with older EmulationStation themes, some newer features which are specific to ES-DE will not work, at least not until the theme authors update their themes._
![alt text](images/current/es-de_ui_easy_setup.png "ES-DE Easy Setup")
![alt text](images/es-de_ui_easy_setup.png "ES-DE Easy Setup")
_A lot of effort has been spent on making ES-DE easy to setup and use. The above screenshot shows the dialog if starting the application without any game files present in the default ROM directory. ES-DE also ships with a comprehensive game systems configuration file, so unless you really want to customize your setup, you should not need to tinker with the configuration._

View file

@ -864,9 +864,9 @@ EmulationStation borrows the concept of "nine patches" from Android (or "9-Slice
- Where on the component `pos` refers to. For example, an origin of `0.5 0.5` and a `pos` of `0.5 0.5` would place
the component exactly in the middle of the screen.
* `textColor` - type: COLOR. Default is 777777FF.
* `textColorDimmed` - type: COLOR. Default is 777777FF.
* `textColorDimmed` - type: COLOR. Default is the same value as textColor. Must be placed under the 'system' view.
* `iconColor` - type: COLOR. Default is 777777FF.
* `iconColorDimmed` - type: COLOR. Default is 777777FF.
* `iconColorDimmed` - type: COLOR. Default is the same value as iconColor. Must be placed under the 'system' view.
* `fontPath` - type: PATH.
* `fontSize` - type: FLOAT.
* `entrySpacing` - type: FLOAT. Default is 16.0.
@ -884,6 +884,8 @@ EmulationStation borrows the concept of "nine patches" from Android (or "9-Slice
`button_l`,
`button_r`,
`button_lr`,
`button_lt`,
`button_rt`,
`button_a_SNES`,
`button_b_SNES`,
`button_x_SNES`,

View file

@ -73,17 +73,37 @@ There's not really much to say about these operating systems, just install ES-DE
Upon first startup, ES-DE will create its `~/.emulationstation` home directory.
On Unix this means /home/\<username\>/.emulationstation/, on macOS /Users/\<username\>/.emulationstation/ and on Windows C:\Users\\<username\>\\.emulationstation\
On Unix this means /home/\<username\>/.emulationstation/, on macOS /Users/\<username\>/.emulationstation/ and on Windows
C:\Users\\<username\>\\.emulationstation\
**Note:** As of ES-DE v1.1 there is no internationalization support, which means that the application will always require the physical rather than the localized path to your home directory. For instance on macOS configured for the Swedish language /Users/myusername will be the physical path but /Användare/myusername is the localized path that is actually shown in the user interface. The same is true on Windows where the directories would be C:\Users\myusername and C:\Användare\myusername respectively. If attempting to enter the localized path for any directory-related setting, ES-DE will not be able to find it. But it's always possible to use the tilde `~` symbol when referring to your home directory, which ES-DE will expand to the physical location regardless of what language you have configured for your operating system. If you're using an English-localized system, this whole point is irrelevant as the physical and localized paths are then identical.
**Note:** As of ES-DE v1.1 there is no internationalization support, which means that the application will always
require the physical rather than the localized path to your home directory. For instance on macOS configured for the
Swedish language /Users/myusername will be the physical path but /Användare/myusername is the localized path that is
actually shown in the user interface. The same is true on Windows where the directories would be C:\Users\myusername and
C:\Användare\myusername respectively. If attempting to enter the localized path for any directory-related setting, ES-DE
will not be able to find it. But it's always possible to use the tilde `~` symbol when referring to your home directory,
which ES-DE will expand to the physical location regardless of what language you have configured for your operating
system. If you're using an English-localized system, this whole point is irrelevant as the physical and localized paths
are then identical.
It's also possible to override the home directory path using the --home command line option, but this is normally required only for very special situations so we can safely ignore that option for now.
It's possible to override the home directory path using the --home command line option, but this is normally required
only for very special situations so we can safely ignore that option for now.
Also on first startup the configuration file `es_settings.xml` will be generated in the ES-DE home directory, containing all the application settings at their default values. Following this, a file named `es_systems.xml` will be loaded from the resources directory (which is part of the ES-DE installation). This file contains the game system definitions including which emulator to use per platform. The systems configuration file can be customized, as described in the next section.
Also on first startup the configuration file `es_settings.xml` will be generated in the ES-DE home directory, containing
all the application settings at their default values. Following this, a file named `es_systems.xml` will be loaded from
the resources directory (which is part of the ES-DE installation). This file contains the game system definitions
including which emulator to use per platform. For some systems there are also alternative emulators defined which can be
applied system-wide or per game. How that works is explained later in this guide. A customized systems configuration
file can also be used, as described in the next section.
There's an application log file created in the ES-DE home directory named `es_log.txt`, please refer to this in case of any issues as it should hopefully provide information on what went wrong. Starting ES-DE with the --debug flag provides even more detailed information.
There's an application log file created in the ES-DE home directory named `es_log.txt`, please refer to this in case of
any issues as it should hopefully provide information on what went wrong. Starting ES-DE with the --debug flag provides
even more detailed information.
After ES-DE finds at least one game file, it will populate that game system and the application will start. If there are no game files, a dialog will be shown explaining that you need to install your game files into your ROMs directory. You will also be given a choice to change that ROMs directory path if you don't want to use the default one. As well you have the option to generate the complete game systems directory structure based on information in es_systems.xml.
After ES-DE finds at least one game file, it will populate that game system and the application will start. If there are
no game files, a dialog will be shown explaining that you need to install your game files into your ROMs directory. You
will also be given a choice to change that ROMs directory path if you don't want to use the default one. As well you
have the option to generate the complete game systems directory structure based on information in es_systems.xml.
When generating the directory structure, a file named systeminfo.txt will be created in each game system folder which will provide you with some information about the system. Here's an example for the _gc_ system as seen on macOS:
```
@ -106,9 +126,11 @@ Theme folder:
gc
```
The primary use of this file is to see which RetroArch core the system needs, which you will have to install manually from inside the RetroArch user interface. Also the supported file extensions can be quite useful to know.
The primary use of this file is to see which RetroArch core the system needs, which you will have to install manually
from inside the RetroArch user interface. Also the supported file extensions can be quite useful to know.
In addition to this, a file named systems.txt will be created in the root of the ROMs directory which shows the mapping between the directory names and the full system names.
In addition to this, a file named systems.txt will be created in the root of the ROMs directory which shows the mapping
between the directory names and the full system names.
For example:
@ -118,24 +140,59 @@ genesis: Sega Genesis
gx4000: Amstrad GX4000
```
Note that neither the systeminfo.txt files or the systems.txt file are needed to run ES-DE, they're only generated as a convenience to help with the setup.
If a custom es_systems.xml file is present in ~/.emulationstation/custom_systems/ any entries from this file will have
their names trailed by the text _(custom system)_. So if the GameCube system in the example above would be present in
the custom systems configuration file, the system would be shown as `gc (custom system)` instead of simply `gc`. This is
only applicable for the systems.txt and systeminfo.txt files, the trailing text is not applied or used anywhere else in
the application.
There will be a lot of directories created if using the es_systems.xml file bundled with the installation, so it may be a good idea to remove the ones you don't need. It's recommended to move them to another location to be able to use them later if more systems should be added. For example a directory named _DISABLED could be created inside the ROMs folder (i.e. ~/ROMs/_DISABLED) and all game system directories you don't need could be moved there. Doing this reduces the application startup time as ES-DE would otherwise need to scan for game files for all these systems.
Note that neither the systeminfo.txt files or the systems.txt file are needed to run ES-DE, they're only generated as a
convenience to help with the setup.
![alt text](images/current/es-de_ui_easy_setup.png "ES-DE Easy Setup")
_This is the dialog shown if no game files were found. It lets you configure the ROM directory if you don't want to use the default one, and you can also generate the game systems directory structure. Note that the directory is the physical path, and that your operating system may present this as a localized path if you are using a language other than English._
There will be a lot of directories created if using the es_systems.xml file bundled with the installation, so it may be
a good idea to remove the ones you don't need. It's recommended to move them to another location to be able to use them
later if more systems should be added. For example a directory named _DISABLED could be created inside the ROMs folder (
i.e. ~/ROMs/_DISABLED) and all game system directories you don't need could be moved there. Doing this reduces the
application startup time as ES-DE would otherwise need to scan for game files for all these systems.
![alt text](images/es-de_ui_easy_setup.png "ES-DE Easy Setup")
_This is the dialog shown if no game files were found. It lets you configure the ROM directory if you don't want to use
the default one, and you can also generate the game systems directory structure. Note that the directory is the physical
path, and that your operating system may present this as a localized path if you are using a language other than
English._
## Customizing the systems configuration file
## Game system customizations
The `es_systems.xml` file is located in the ES-DE resources directory which is part of the application installation. As such this file is not intended to be modified directly. If a customized file is needed, this should instead be placed in the `custom_systems` folder in the ES-DE home directory, i.e. `~/.emulationstation/custom_systems/es_systems.xml`. You can find information on the file structure and how to adapt the configuration in the [INSTALL-DEV.md](INSTALL-DEV.md#es_systemsxml) document.
The game systems configuration file `es_systems.xml` is located in the ES-DE resources directory which is part of the
application installation. As such this file is not intended to be modified directly. If system customizations are
required, a separate es_systems.xml file should instead be placed in the `custom_systems` folder in the ES-DE home
directory, i.e. `~/.emulationstation/custom_systems/es_systems.xml`.
Although it's possible to make a copy of the bundled configuration file, to modify it and then place it in this
directory, that is not how the system customization is designed to be done. Instead the intention is that the file in
the custom_systems directory complements the bundled configuration, meaning only systems that are to be modified should
be included.
For example you may want to replace the emulator launch command, modify the full name or change the supported file
extensions for a single system. In this case it wouldn't make sense to copy the complete bundled file and just apply
these minor modifications, instead an es_systems.xml file only containing the configuration for that single system
should be placed in the custom_systems directory.
The instructions for how to customize the es_systems.xml file can be found
in [INSTALL-DEV.md](INSTALL-DEV.md#es_systemsxml). There you can also find an example of a custom file that you can copy
into ~/.emulationstation/custom_systems/ and modify as required.
## Migrating from other EmulationStation forks
**IMPORTANT!!! IMPORTANT!!! IMPORTANT!!!**
ES-DE is designed to be backward compatible to a certain degree, that is, it should be able to read data from other/previous EmulationStation versions such as the RetroPie fork. But the opposite is not true and it's a one-way ticket for your gamelist.xml files and your custom collection files when migrating to ES-DE as they will be modified in ways that previous ES versions will see as data loss. For instance ES-DE does not use image tags inside the gamelist.xml files to find game media but instead matches the media to the names of the game/ROM files. So it will not save any such tags back to the gamelist files during updates, effectively removing the display of the game media if the files are opened in another ES fork.
ES-DE is designed to be backward compatible to a certain degree, that is, it should be able to read data from
other/previous EmulationStation versions such as the RetroPie fork. But the opposite is not true and it's a one-way
ticket for your gamelist.xml files and your custom collection files when migrating to ES-DE as they will be modified in
ways that previous ES versions will see as data loss. For instance ES-DE does not use image tags inside the gamelist.xml
files to find game media but instead matches the media to the names of the game/ROM files. So it will not save any such
tags back to the gamelist files during updates, effectively removing the display of the game media if the files are
opened in another ES fork.
Due to this, always make backups of at least the following directories before testing ES-DE for the first time:
@ -175,7 +232,7 @@ Depending on the theme, the system navigation carousel can be either horizontal
The game systems are sorted by their full names, as defined in the es_systems.xml file.
![alt text](images/current/es-de_system_view.png "ES-DE System View")
![alt text](images/es-de_system_view.png "ES-DE System View")
_The **System view** is the default starting point for the application, it's here that you browse through your game systems._
@ -193,10 +250,10 @@ In addition to the styles just described, there is a **Grid** view style as well
If the theme supports it, there's a gamelist information field displayed in the gamelist view, showing the number of games for the system (total and favorites) as well as a folder icon if a folder has been entered. When applying any filters to the gamelist, the game counter is replaced with the amount of games filtered, as in 'filtered / total games', e.g. '19 / 77'. If there are game entries in the filter result that are marked not to be counted as games, the number of such files will be indicated as 'filtered + filtered non-games / total games', for example '23 + 4 / 77' indicating 23 normal games, 4 non-games out of a total of 77. Due to this approach it's theoretically possible that the combined filtered game amount exceeds the number of counted games in the collection, for instance '69 + 11 / 77'. This is not considered a bug and is so by design. This gamelist information field functionality is specific to EmulationStation Desktop Edition so older themes will not support this.
![alt text](images/current/es-de_gamelist_view.png "ES-DE Gamelist View")
![alt text](images/es-de_gamelist_view.png "ES-DE Gamelist View")
_The **Gamelist view** is where you browse the games for a specific system._
![alt text](images/current/es-de_basic_view_style.png "ES-DE Basic View Style")
![alt text](images/es-de_basic_view_style.png "ES-DE Basic View Style")
_Here's an example of what the Basic view style looks like. Needless to say, ES-DE is not intended to be used like this. After scraping some game media for the system, the view style will automatically change to Detailed or Video (assuming the Automatic view style option has been selected)._
@ -219,7 +276,7 @@ The application can also be forced into any of the three modes via the command l
There is a help system available throughout the application that provides an overview of the possible actions and buttons that can be used. But some general actions are never shown, such as the ability to quick jump in gamelists, menus and text input fields using the shoulder and trigger buttons. It's also possible to disable the help system using a menu option for a somewhat cleaner look.
![alt text](images/current/es-de_folder_support.png "ES-DE Help System")
![alt text](images/es-de_folder_support.png "ES-DE Help System")
_The help system is displayed at the bottom of the screen, showing the various actions currently available._
@ -302,15 +359,18 @@ The supported file extensions are listed in [unix/es_systems.xml](resources/syst
Here is the snippet from the unix/es_systems.xml file:
```
```xml
<system>
<name>nes</name>
<fullname>Nintendo Entertainment System</fullname>
<path>%ROMPATH%/nes</path>
<extension>.nes .NES .unf .UNF .unif .UNIF .7z .7Z .zip .ZIP</extension>
<command>%EMULATOR_RETROARCH% -L %CORE_RETROARCH%/nestopia_libretro.so %ROM%</command>
<platform>nes</platform>
<theme>nes</theme>
<name>nes</name>
<fullname>Nintendo Entertainment System</fullname>
<path>%ROMPATH%/nes</path>
<extension>.nes .NES .unf .UNF .unif .UNIF .7z .7Z .zip .ZIP</extension>
<command label="Nestopia UE">%EMULATOR_RETROARCH% -L %CORE_RETROARCH%/nestopia_libretro.so %ROM%</command>
<command label="FCEUmm">%EMULATOR_RETROARCH% -L %CORE_RETROARCH%/fceumm_libretro.so %ROM%</command>
<command label="Mesen">%EMULATOR_RETROARCH% -L %CORE_RETROARCH%/mesen_libretro.so %ROM%</command>
<command label="QuickNES">%EMULATOR_RETROARCH% -L %CORE_RETROARCH%/quicknes_libretro.so %ROM%</command>
<platform>nes</platform>
<theme>nes</theme>
</system>
```
@ -344,7 +404,7 @@ Then simply copy your game ROMs into this folder, and you should end up with som
**Note:** These directories are case sensitive on Unix, so creating a directory named `Nes` instead of `nes` won't work.
That's it, start ES-DE and the NES game system should be populated. You can now scrape information and media for the games, and assuming you've setup RetroArch correctly with the Nestopia UE core, you can launch the games.
That's it, start ES-DE and the NES game system should be populated. You can now scrape information and media for the games, and assuming you've setup RetroArch correctly with the Nestopia UE core, you can launch the games. If you instead prefer to use any of the three alternative emulators listed above (FCEUmm, Mesen or QuickNES) you can install one of these cores instead and change your emulator preference using the _Alternative emulators_ interface in the _Other settings_ menu. Note that alternative emulators are only available for some game systems.
### Multiple game files installation
@ -366,7 +426,8 @@ The platform name for the Commodore 64 is `c64`, so the following structure woul
~/ROMs/c64/Multidisk/Pirates/Pirates!.m3u
```
It's highly recommended to create `.m3u` playlist files for multi-disk images as this normally automates disk swapping in the emulator. It's then this .m3u file that should be selected for launching the game.
It's highly recommended to create `.m3u` playlist files for multi-disc images as this normally automates disk swapping
in the emulator. It's then this .m3u file that should be selected for launching the game.
The .m3u file simply contains a list of the game files, for example in the case of Last Ninja 2.m3u:
@ -419,9 +480,13 @@ Apart from the potential difficulty in locating the emulator binary, there are s
#### Commodore Amiga
There are multiple ways to run Amiga games, but the recommended approach is to use WHDLoad. The best way is to use hard disk images in `.hdf` or `.hdz` format, meaning there will be a single file per game. This makes it just as easy to play Amiga games as any console with game ROMs.
There are multiple ways to run Amiga games, but the recommended approach is to use WHDLoad. The best way is to use hard
disk images in `.hdf` or `.hdz` format, meaning there will be a single file per game. This makes it just as easy to play
Amiga games as any console with game ROMs.
An alternative would be to use `.adf` images as not all games may be available with WHDLoad support. For this, you can either put single-disk images in the root folder or in a dedicated adf directory, or multiple-disk games in separate folders. It's highly recommended to create `.m3u` playlist files for multi-disk images as described earlier.
An alternative would be to use `.adf` images as not all games may be available with WHDLoad support. For this, you can
either put single-disc images in the root folder or in a dedicated adf directory, or multiple-disk games in separate
folders. It's highly recommended to create `.m3u` playlist files for multi-disc images as described earlier.
Here's an example of what the file structure could look like:
@ -618,7 +683,7 @@ The **Multi-language** support includes translated game genres and game descript
There are two approaches to scraping, either for a single game from the metadata editor, or for many games and systems using the multi-scraper.
![alt text](images/current/es-de_scraper_running.png "ES-DE Scraper Running")
![alt text](images/es-de_scraper_running.png "ES-DE Scraper Running")
_Here's an example of the multi-scraper running in interactive mode, asking the user to make a selection from the multiple matching games returned by the scraper service._
### Single-game scraper
@ -699,7 +764,7 @@ It's possible to change the game media directory location from within ES-DE, for
This menu can be accessed from both the system view and gamelist view. It contains the scraper, application settings and various tools such as the input configurator and the miximage generator. Settings are saved when navigating back from any menu screen, assuming at least one setting was changed. Pressing the application exit key (F4 by default) will also save any pending changes.
![alt text](images/current/es-de_main_menu.png "ES-DE Main Menu")
![alt text](images/es-de_main_menu.png "ES-DE Main Menu")
_The ES-DE main menu._
Following is a breakdown of the main menu entries.
@ -708,7 +773,7 @@ Following is a breakdown of the main menu entries.
Contains the various options for the scraper, which is used to download metadata, images and videos for your games.
![alt text](images/current/es-de_scraper_settings.png "ES-DE Scraper Settings")
![alt text](images/es-de_scraper_settings.png "ES-DE Scraper Settings")
_Some of the scraper settings._
**Scrape from**
@ -861,7 +926,8 @@ If this setting is enabled and a folder has its flag set to be excluded from the
**Scrape actual folders** _(Multi-scraper only)_
Enabling this option causes folders themselves to be included by the scraper. This is useful for DOS games or any multi-disk games where there is a folder for each individual game.
Enabling this option causes folders themselves to be included by the scraper. This is useful for DOS games or any
multi-disc games where there is a folder for each individual game.
**Auto-retry on peer verification errors** _(ScreenScraper only)_
@ -903,6 +969,14 @@ Animation to play when opening the main menu or the game options menu. Also sets
This configures for how long to display the game launch screen when starting a game. The options are _Normal_, _Brief_, _Long_ and _Disabled_. If set to _Disabled_, a simple notification popup will be displayed instead.
**Media viewer settings**
Submenu containing all the settings for the media viewer. These are described in detail below.
**Screensaver settings**
Submenu containing all the settings for the screensaver. These are described in detailed below.
**Blur background when menu is open** _(OpenGL renderer only)_
This option will blur the background behind the menu slightly. Normally this can be left enabled, but if you have a really slow GPU, disabling this option may make the application feel a bit more responsive.
@ -925,23 +999,50 @@ Whether to sort your favorite games above your other games in the gamelists.
**Add star markings to favorite games**
With this setting enabled, there is a star symbol added at the beginning of the game name in the gamelist views. It's strongly recommended to keep this setting enabled if the option to sort favorite games above non-favorites has been enabled. If not, favorite games would be sorted on top of the gamelist with no visual indication that they are favorites, which would be quite confusing.
With this setting enabled, there is a star symbol added at the beginning of the game name in the gamelist views. It's
strongly recommended to keep this setting enabled if the option to sort favorite games above non-favorites has been
enabled. If not, favorite games would be sorted on top of the gamelist with no visual indication that they are
favorites, which would be quite confusing.
**Use plain ASCII for special gamelist characters**
There are some special characters in ES-DE such as the favorites star, the folder icon and the tickmark (seen when editing custom collections) that are displayed using symbols from the bundled Font Awesome. This normally looks perfectly fine, but on some specific theme sets with very pixelated fonts such as [es-themes-snes-mini](https://github.com/ruckage/es-theme-snes-mini) and [es-themes-workbench](https://github.com/ehettervik/es-theme-workbench) these symbols look terrible. For such themes, this option is available, which will use plain ASCII characters instead of the Font Awesome symbols. For the favorites an asterisk `*` will be used, for folders a hash sign `#` will be used and for the tickmark an exclamation mark `!` will be used. This only applies to the gamelist view, in all other places in the application the Font Awesome symbols are retained. Make sure to disable this option if not using such a pixelated theme as it looks equally terrible to enable this option on themes where it's not supposed to be used.
There are some special characters in ES-DE such as the favorites star, the folder icon and the tickmark (seen when
editing custom collections) that are displayed using symbols from the bundled Font Awesome. This normally looks
perfectly fine, but on some specific theme sets with very pixelated fonts such
as [es-themes-snes-mini](https://github.com/ruckage/es-theme-snes-mini)
and [es-themes-workbench](https://github.com/ehettervik/es-theme-workbench) these symbols look terrible. For such
themes, this option is available, which will use plain ASCII characters instead of the Font Awesome symbols. For the
favorites an asterisk `*` will be used, for folders a hash sign `#` will be used and for the tickmark an exclamation
mark `!` will be used. This only applies to the gamelist view, in all other places in the application the Font Awesome
symbols are retained. Make sure to disable this option if not using such a pixelated theme as it looks equally terrible
to enable this option on themes where it's not supposed to be used.
**Enable quick list scrolling overlay**
With this option enabled, there will be an overlay displayed when scrolling the gamelists quickly, i.e. when holding down the _Up_, _Down_, _Left shoulder_ or _Right shoulder_ buttons for some time. The overlay will darken the background slightly and display the first two characters of the game names. If the game is a favorite and the setting to sort favorites above non-favorites has been enabled, a star will be shown instead.
With this option enabled, there will be an overlay displayed when scrolling the gamelists quickly, i.e. when holding
down the _Up_, _Down_, _Left shoulder_ or _Right shoulder_ buttons for some time. The overlay will darken the background
slightly and display the first two characters of the game names. If the game is a favorite and the setting to sort
favorites above non-favorites has been enabled, a star will be shown instead.
**Enable virtual keyboard**
This enables a virtual (on-screen) keyboard that can be used at various places throughout the application to input text
and numbers using a controller. The Shift and Alt keys can be toggled individually or combined together to access many
special characters. The general use of the virtual keyboard should hopefully be self-explanatory.
**Enable toggle favorites button**
This setting enables the _Y_ button for quickly toggling a game as favorite. Although this may be convenient at times, it's also quite easy to accidentally remove a favorite tagging of a game when using the application more casually. As such it could sometimes make sense to disable this functionality. It's of course still possible to mark a game as favorite using the metadata editor when this setting is disabled. The option does not affect the use of the _Y_ button to add or remove games when editing custom collections.
This setting enables the _Y_ button for quickly toggling a game as favorite. Although this may be convenient at times,
it's also quite easy to accidentally remove a favorite tagging of a game when using the application more casually. As
such it could sometimes make sense to disable this functionality. It's of course still possible to mark a game as
favorite using the metadata editor when this setting is disabled. The option does not affect the use of the _Y_ button
to add or remove games when editing custom collections.
**Enable random system or game button**
This enables or disables the ability to jump to a random system or game. It's mapped to the thumbstick click button, either the left or right thumbstick will work. The help prompts will also visually indicate whether this option is enabled or not.
This enables or disables the ability to jump to a random system or game. It's mapped to the thumbstick click button,
either the left or right thumbstick will work. The help prompts will also visually indicate whether this option is
enabled or not.
**Enable gamelist filters**
@ -1154,6 +1255,17 @@ Enables the system name to be shown in square brackets after the game name, for
These are mostly technical settings.
**Alternative emulators**
Using this interface it's possible to select alternative emulators to use per game system, which requires that these alternatives have been defined in the es_systems.xml file. Note that only systems that you have currently populated will be listed. To change to an alternative emulator, you simply select a system from the list and choose which alternative to use from the presented options. If you select an alternative emulator and later remove its corresponding entry from the es_systems.xml file, an error message will be shown on application startup telling you to review your invalid emulator selection. Games will still launch, but the default emulator will be used in this case. How to clear an invalid entry should be self-explanatory once you access the interface. It's also possible to set alternative emulators per game using the metadata editor. If this is done, it will take precedence and override the system-wide emulator selection for the specific game.
![alt text](images/es-de_alternative_emulators.png "ES-DE Scraper Settings")
_The alternative emulators interface._
**Game media directory**
This setting defines the directory for the game media, i.e. game images and videos. The default location is _~/.emulationstation/downloaded_media_
**VRAM limit**
The amount of video RAM to use for the application. Defaults to 256 MiB (80 MiB on the Raspberry Pi) which works fine most of the time when running at 1080p resolution and with a moderate amount of game systems. If running at 4K resolution or similar and with lots of game systems enabled, it's recommended to increase this number to 512 MiB or possibly more to avoid stuttering transition animations caused by unloading and loading of textures from the cache. Enabling the GPU statistics overlay gives some indications regarding the amount of texture memory currently used by ES-DE, which is helpful to determine a reasonable value for this option. The allowed range for the settings is 80 to 1024 MiB. If you try to set it lower or higher than this by passing such values as command line parameters or by editing the es_settings.xml file manually, ES-DE will log a warning and automatically adjust the value within the allowable range.
@ -1176,11 +1288,7 @@ This gives the choice of which key combination to use to close the application.
**When to save game metadata**
The metadata for a game is updated by scraping or by manual editing using the metadata editor, but also when launching it as this updates the _Times played_ counter and the _Last played_ timestamp. This setting enables you to define when to write such metadata changes to the gamelist.xml files. Setting the option to _Never_ will disable writing to these files altogether, except for some special conditions such as when a game is manually deleted using the metadata editor, or when scraping using the multi-scraper (the multi-scraper will always save any updates immediately to the gamelist.xml files). In theory _On exit_ will give some performance gains, but it's normally recommended to leave the setting at its default value which is _Always_. Note that with the settings set to _Never_, any updates such as the _Last played_ date will still be shown on screen, but during the next application startup, any values previously saved to the gamelist.xml files will be read in again. As well, when changing this setting to _Always_ from either of the two other options, any pending changes will be immediately written to the gamelist.xml files.
**Game media directory**
This setting defines the directory for the game media, i.e. game images and videos. The default location is _~/.emulationstation/downloaded_media_
The metadata for a game is updated by scraping or by manual editing using the metadata editor, but also when launching it as this updates the _Times played_ counter and the _Last played_ timestamp. This setting enables you to define when to write such metadata changes to the gamelist.xml files. Setting the option to _Never_ will disable writing to these files altogether, except for some special conditions such as when a game is manually deleted using the metadata editor, when scraping using the multi-scraper (the multi-scraper will always save any updates immediately to the gamelist.xml files) or when changing the alternative emulator for the system. In theory _On exit_ will give some small performance gains, but it's normally recommended to leave the setting at its default value which is _Always_. Note that with the settings set to _Never_, any updates such as the _Last played_ date will still be shown on screen, but during the next application startup, any values previously saved to the gamelist.xml files will be read in again. As well, when changing this setting to _Always_ from either of the two other options, any pending changes will be immediately written to the gamelist.xml files.
**Hide taskbar (requires restart)** _(Windows only)_
@ -1202,9 +1310,9 @@ Enabling this option offloads video decoding to the GPU. Whether this actually i
With this option enabled, videos with lower frame rates than 60 FPS, such as 24 and 30 will get upscaled to 60 FPS. This results in slightly smoother playback for some videos. There is a small performance hit from this option, so on weaker machines it may be necessary to disable it for fluent video playback. This setting has no effect when using the VLC video player. If the VLC video player is not included in the ES-DE build, the "(FFmpeg)" text is omitted from the setting name.
**Per game launch command override**
**Enable alternative emulators per game**
If enabled, you can override the launch command defined in es_systems.xml on a per-game basis using the metadata editor. It's only recommended to disable this option for testing purposes, such as when a game won't start and you're unsure if it's your custom launch command that causes the problem.
If enabled, you will be able to select alternative emulators per game using the metadata editor. It's only recommended to disable this option for testing purposes.
**Show hidden files and folders (requires restart)**
@ -1212,7 +1320,11 @@ If this option is disabled, hidden files and folders within the ROMs directory t
**Show hidden games (requires restart)**
You can mark games as hidden in the metadata editor, which is useful for instance for DOS games where you may not want to see some batch files and executables inside ES-DE, or for multi-disk games where you may only want to show the .m3u playlists and not the individual game files. By disabling this option these files will not be processed at all when ES-DE starts up. If you enable the option you will see the files, but their name entries will be almost transparent in the gamelist view to visually indicate that they are hidden.
You can mark games as hidden in the metadata editor, which is useful for instance for DOS games where you may not want
to see some batch files and executables inside ES-DE, or for multi-disc games where you may only want to show the .m3u
playlists and not the individual game files. By disabling this option these files will not be processed at all when
ES-DE starts up. If you enable the option you will see the files, but their name entries will be almost transparent in
the gamelist view to visually indicate that they are hidden.
**Enable custom event scripts**
@ -1263,7 +1375,7 @@ This menu is opened from the gamelist view, and can't be accessed from the syste
You open the menu using the **Back** button, and by pressing **B** or selecting the **Apply** button any settings such as letter jumping using the quick selector or sorting changes are applied. If you instead press the Back button again or select the **Cancel** button, the menu is closed without applying any changes.
![alt text](images/current/es-de_game_options_menu.png "ES-DE Game Options Menu")
![alt text](images/es-de_game_options_menu.png "ES-DE Game Options Menu")
_The game options menu as laid out when opening it from within a custom collection, which adds the menu entry to add or remove games from the collection._
Here's a summary of the menu entries:
@ -1295,12 +1407,12 @@ The secondary sorting is always in ascending filename order.
Choosing this entry opens a separate screen where it's possible to apply a filter to the gamelist. The filter is persistent throughout the program session, or until it's manually reset. The option to reset all filters is shown on the same screen.
![alt text](images/current/es-de_gamelist_filters.png "ES-DE Gamelist Filters")
![alt text](images/es-de_gamelist_filters.png "ES-DE Gamelist Filters")
_The gamelist filter screen, accessed from the game options menu._
The following filters can be applied:
**Text Filter (game name)**
**Game name**
**Favorites**
@ -1320,9 +1432,14 @@ The following filters can be applied:
**Hidden**
With the exception of the text filter, all available filter values are assembled from metadata from the actual gamelist, so if there for instance are no games marked as completed, the Completed filter will only have the selectable option False, i.e. True will be missing.
With the exception of the game name text filter, all available filter values are assembled from metadata from the actual
gamelist, so if there for instance are no games marked as completed, the Completed filter will only have the selectable
option False, i.e. True will be missing.
Be aware that although folders can have most of the metadata values set, the filters are only applied to files (this is also true for the text/game name filter). So if you for example set a filter to only display your favorite games, any folder that contains a favorite game will be displayed, and other folders which are themselves marked as favorites but that do not contain any favorite games will be hidden.
Be aware that although folders can have most of the metadata values set, the filters are only applied to files (this is
also true for the game name text filter). So if you for example set a filter to only display your favorite games, any
folder that contains a favorite game will be displayed, and other folders which are themselves marked as favorites but
that do not contain any favorite games will be hidden.
The filters are always applied for the complete game system, including all folder content.
@ -1343,7 +1460,7 @@ This opens the metadata editor for the currently selected game file or folder.
In the metadata editor, you can modify the metadata, scrape for game info and media files, clear the entry which will delete all metadata and game media files, or delete the entire game which also removes its file on the filesystem. When manually modifying a value, it will change color from gray to blue, and if the scraper has changed a value, it will change to red. When leaving the metadata editor you will be asked whether you want to save any settings done manually or by the scraper.
![alt text](images/current/es-de_metadata_editor.png "ES-DE Metadata Editor")
![alt text](images/es-de_metadata_editor.png "ES-DE Metadata Editor")
_The metadata editor._
### Metadata entries
@ -1400,7 +1517,11 @@ A flag to mark whether the game is suitable for children. This will be applied a
**Hidden**
A flag to indicate that the game is hidden. If the corresponding option has been set in the main menu, the game will not be shown. Useful for example for DOS games to hide batch scripts and unnecessary binaries or to hide the actual game files for multi-disk games. If a file or folder is flagged as hidden but the corresponding option to hide hidden games has not been enabled, then the opacity of the text will be lowered significantly to make it clear that it's a hidden entry.
A flag to indicate that the game is hidden. If the corresponding option has been set in the main menu, the game will not
be shown. Useful for example for DOS games to hide batch scripts and unnecessary binaries or to hide the actual game
files for multi-disc games. If a file or folder is flagged as hidden but the corresponding option to hide hidden games
has not been enabled, then the opacity of the text will be lowered significantly to make it clear that it's a hidden
entry.
**Broken/not working**
@ -1408,24 +1529,36 @@ A flag to indicate whether the game is broken. Useful for MAME games for instanc
**Exclude from game counter** _(files only)_
A flag to indicate whether the game should be excluded from being counted. If this is set for a game, it will not be included in the game counter shown per system on the system view, and it will not be included in the system information field in the gamelist view. As well, it will be excluded from all automatic and custom collections. This option is quite useful for multi-file games such as multi-disk Amiga or Commodore 64 games, or for DOS games where you want to exclude setup programs and similar but still need them available in ES-DE and therefore can't hide them. Files that have this flag set will have a lower opacity in the gamelists, making them easy to spot.
A flag to indicate whether the game should be excluded from being counted. If this is set for a game, it will not be
included in the game counter shown per system on the system view, and it will not be included in the system information
field in the gamelist view. As well, it will be excluded from all automatic and custom collections. This option is quite
useful for multi-file games such as multi-disc Amiga or Commodore 64 games, or for DOS games where you want to exclude
setup programs and similar but still need them available in ES-DE and therefore can't hide them. Files that have this
flag set will have a lower opacity in the gamelists, making them easy to spot.
**Exclude from multi-scraper**
Whether to exclude the file from the multi-scraper. This is quite useful in order to avoid scraping all the disks for multi-disk games for example. There is an option in the scraper settings to ignore this flag, but by default the multi-scraper will respect it.
Whether to exclude the file from the multi-scraper. This is quite useful in order to avoid scraping all the disks for
multi-disc games for example. There is an option in the scraper settings to ignore this flag, but by default the
multi-scraper will respect it.
**Hide metadata fields**
This option will hide most metadata fields in the gamelist view. The intention is to be able to hide the fields for situations such as general folders (Multi-disk, Cartridges etc.) and for setup programs and similar (e.g. SETUP.EXE or INSTALL.BAT for DOS games). It could also be used on the game files for multi-disk games where perhaps only the .m3u playlist should have any metadata values. The only fields shown with this option enabled are the game name and description. Using the description it's possible to write some comments regarding the file or folder, should you want to. It's also possible to display game images and videos with this setting enabled.
**Launch command** _(files only)_
Here you can override the launch command for the game, for example to use a different emulator than the default one defined for the game system. Very useful for MAME/arcade games.
This option will hide most metadata fields in the gamelist view. The intention is to be able to hide the fields for
situations such as general folders (Multi-disc, Cartridges etc.) and for setup programs and similar (e.g. SETUP.EXE or
INSTALL.BAT for DOS games). It could also be used on the game files for multi-disc games where perhaps only the .m3u
playlist should have any metadata values. The only fields shown with this option enabled are the game name and
description. Using the description it's possible to write some comments regarding the file or folder, should you want
to. It's also possible to display game images and videos with this setting enabled.
**Times played** _(files only)_
A statistics counter that tracks how many times you have played the game. You normally don't need to touch this, but if you want to, the possibility is there.
**Alternative emulator** _(files only)_
If the option _Enable alternative emulators per game_ has been enabled, there will be an entry shown where you can select between alternative emulators for the specific game. There is a similar _Alternative emulators_ entry under the _Other settings_ menu, but that will apply the selection to the entire game system. If you select an alternative for a specific game using the metadata editor, that will take precedence and override any system-wide emulator selection (the currently selected system-wide emulator will be clearly marked on the selection screen). The alternative emulators need to be defined in the es_systems.xml file, and if there are no alternatives available for the current system, this row in the metadata editor will be grayed out. If you select an alternative emulator and later remove its corresponding entry from the es_systems.xml file, an error notice will be shown on this row. In this case you have the option to remove the invalid entry. But even if there is an invalid entry, games will still launch using the default emulator while logging a warning message to the es_log.txt file. Apart from this, the emulator selection should hopefully be self-explanatory.
### Buttons
For game files, there will be five buttons displayed on the bottom of the metadata editor window, and for folders there will be four. These are their functions:
@ -1474,7 +1607,7 @@ For the video and slideshow screensavers, an overlay can be enabled via the scre
If the Video screensaver has been selected and there are no videos available, a fallback to the Dim screensaver will take place. The same is true for the Slideshow screensaver if no game images are available.
![alt text](images/current/es-de_screensaver.png "ES-DE Screensaver")
![alt text](images/es-de_screensaver.png "ES-DE Screensaver")
_An example of what the video screensaver looks like._
## Game collections
@ -1515,10 +1648,10 @@ When you are done adding games, you can either open the main menu and go to **Ga
You can later add additional games to the collection by navigating to it, bringing up the game options menu and choosing **Add/remove games to this game collection**.
![alt text](images/current/es-de_custom_collections.png "ES-DE Custom Collections")
![alt text](images/es-de_custom_collections.png "ES-DE Custom Collections")
_Example of custom collections, here configured as genres._
![alt text](images/current/es-de_custom_collections_editing.png "ES-DE Custom Collections")
![alt text](images/es-de_custom_collections_editing.png "ES-DE Custom Collections")
_When editing a custom collection, a tick symbol will be displayed for any game that is already part of the collection._
@ -1578,7 +1711,7 @@ https://gitlab.com/recalbox/recalbox-themes
https://wiki.batocera.org/themes
![alt text](images/current/es-de_ui_theme_support.png "ES-DE Theme Support")
![alt text](images/es-de_ui_theme_support.png "ES-DE Theme Support")
_An example of a modified version of the [Fundamental](https://github.com/G-rila/es-theme-fundamental) theme applied to ES-DE._
@ -1602,168 +1735,232 @@ Refer to the [INSTALL-DEV.md](INSTALL-DEV.md#command-line-options) document for
## Supported game systems
**Note:** The following list is what the default es_systems.xml files and the rbsimple-DE theme supports. This theme set is very comprehensive, so if you're using another theme, it may be that some or many of these systems are not supported. ES-DE will still work but the game system will unthemed which looks very ugly.
**Note:** The following list is what the default es_systems.xml files and the rbsimple-DE theme supports. This theme set
is very comprehensive, so if you're using another theme, it may be that some or many of these systems are not supported.
ES-DE will still work but the game system will unthemed which looks very ugly.
Note as well that the list and corresponding es_systems.xml templates may not reflect what is readily available for all supported operating system. This is especially true on Unix/Linux if installing RetroArch via the OS repository instead of using the Snap or Flatpak distributions (or compiling from source code) as the repository versions are normally quite crippled.
Note as well that the list and corresponding es_systems.xml templates may not reflect what is readily available for all
supported operating system. This is especially true on Unix/Linux if installing RetroArch via the OS repository instead
of using the Snap or Flatpak distributions (or compiling from source code) as the repository versions are normally quite
crippled.
The column **Game system name** corresponds to the directory where you should put your game files, e.g. `~/ROMs/c64` or `~/ROMs/megadrive`.
The column **System name** corresponds to the directory where you should put your game files, e.g. `~/ROMs/c64`
or `~/ROMs/megadrive`.
Regional differences are handled by simply using the game system name corresponding to your region. For example for Sega Mega Drive, _megadrive_ would be used by most people in the world, although persons from North America would use _genesis_ instead. The same is true for _pcengine_ vs _tg16_ etc. This only affects the theme selection and the corresponding theme graphics, the same emulator and scraper settings are still used for the regional variants although that can of course be modified in the es_systems.xml file if you wish.
Regional differences are handled by simply using the game system name corresponding to your region. For example for Sega
Mega Drive, _megadrive_ would be used by most people in the world, although persons from North America would use _
genesis_ instead. The same is true for _pcengine_ vs _tg16_ etc. This only affects the theme selection and the
corresponding theme graphics, the same emulator and scraper settings are still used for the regional variants although
that can of course be customized in the es_systems.xml file if you wish.
Sometimes the name of the console is (more or less) the same for multiple regions, and in those cases the region has been added as a suffix to the game system name. For instance `na` for North America has been added to `snes` (Super Nintendo) giving the system name `snesna`. The same goes for Japan, as in `megacd` and `megacdjp`. Again, this only affects the theme and theme graphics.
Sometimes the name of the console is (more or less) the same for multiple regions, and in those cases the region has
been added as a suffix to the game system name. For instance `na` for North America has been added to `snes` (Super
Nintendo) giving the system name `snesna`. The same goes for Japan, as in `megacd` and `megacdjp`. Again, this only
affects the theme and theme graphics.
For the **Full name** column, text inside square brackets [] are comments and not part of the actual game system name.
For the **Full name** column, text inside square brackets [] are comments and not part of the actual system name.
The **Default emulator** column shows the emulator configured in es_systems.xml, and for emulators that support multiple cores, the configured core is shown inside brackets. Any system marked with an asterisk (*) in this column requires additional system/BIOS ROMs to run, as should be explained in the emulator documentation.
The **Default emulator** column lists the primary emulator as configured in es_systems.xml. If this differs between
Unix, macOS and Windows then it's specified in square brackets, such as [UW] for Unix and Windows and [M] for macOS. If
not all of the three platforms are specified it means that the system is not available on the missing platforms. For
example Lutris which is only avaialable on Unix is marked with only a _[U]_. Unless explicitly marked as **(
Standalone)**, each emulator is a RetroArch core.
For additional details regarding which game file extensions are supported per system, refer to the es_systems.xml files [unix/es_systems.xml](resources/systems/unix/es_systems.xml), [macos/es_systems.xml](resources/systems/macos/es_systems.xml) and [windows/es_systems.xml](resources/systems/windows/es_systems.xml). Normally the extensions setup in these files should cover everything that the emulators support.
The **Alternative emulators** column lists additional emulators configured in es_systems.xml that can be selected per
system and per game, as explained earlier in this guide. This does not necessarily include everything in existence, as
for some platforms there are a lot of emulators to choose from. In those cases the included emulators is a curated
selection. In the same manner as the _Default emulator_ column, differences between Unix, macOS and Windows are marked
using square brackets. Unless explicitly marked as **(Standalone)**, echo emulator is a RetroArch core.
If you generated the ROMs directory structure when first starting ES-DE, the systeminfo.txt files located in each game system directory will also contain the information about the emulator core and supported file extensions.
The **Needs BIOS** column indicates if additional BIOS/system ROMs are required, as should be explained by the emulator
documentation. Good starting points for such documentation are [https://docs.libretro.com](https://docs.libretro.com)
and [https://docs.libretro.com/library/bios](https://docs.libretro.com/library/bios)
MAME emulation is a bit special as the choice of emulator or core depends on which ROM set you're using. It's recommended to go for the latest available set, as MAME is constantly improved with more complete and accurate emulation. Therefore the default `arcade` system is preconfigured to use the RetroArch core _MAME - Current_ which as the name implies will be the latest available MAME version. For really slow computers though, the 0.78 ROM set is a popular choice. To use this you either need to make a customized es_systems.xml file, or you can use the `mame` system which comes preconfigured for the RetroArch core _MAME 2003-Plus_ that is compatible with the 0.78 ROM set. There are other alternatives as well such as _MAME 2010_ that uses the 0.139 ROM set but this is generally not recommended.
For additional details regarding which game file extensions are supported per system, refer to the es_systems.xml
files [unix/es_systems.xml](resources/systems/unix/es_systems.xml)
, [macos/es_systems.xml](resources/systems/macos/es_systems.xml)
and [windows/es_systems.xml](resources/systems/windows/es_systems.xml). Normally the extensions setup in these files
should cover everything that the emulators support. Note that for systems that have alternative emulators defined, the
list of extensions is a combination of what is supported by all the emulators. This approach is necessary as you want to
be able to see all games for each system while potentially testing and switching between different emulators, either
system-wide or on a per game basis.
There are other MAME versions and derivates available as well such as MAME4ALL, AdvanceMAME, FinalBurn Alpha and FinalBurn Neo but it's beyond the scope of this document to describe those in detail. For more information, refer to the [RetroPie arcade documentation](https://retropie.org.uk/docs/Arcade) which has a good overview of the various MAME alternatives.
If you generated the ROMs directory structure when first starting ES-DE, the systeminfo.txt files located in each game
system directory will also contain the information about the emulator core and supported file extensions.
For CD-based systems it's generally recommended to use CHD files (extension .chd) as this saves space due to compression
compared to BIN/CUE, IMG, ISO etc. The CHD format is also supported by most emulators. You can convert to CHD from
various formats using the MAME `chdman` utility, for example `chdman createcd -i mygame.iso -o mygame.chd`. Sometimes
chdman has issues converting from the IMG and BIN formats, and in this case it's possible to first convert to ISO
using `ccd2iso`, such as `ccd2iso mygame.img mygame.iso`.
MAME emulation is a bit special as the choice of emulator depends on which ROM set you're using. It's recommended to go
for the latest available set, as MAME is constantly improved with more complete and accurate emulation. Therefore
the `arcade` system is configured to use _MAME - Current_ by default, which as the name implies will be the latest
available MAME version. But if you have a really slow computer you may want to use another ROM set such as the popular
0.78. In this case, you can either select _MAME 2003-Plus_ as an alternative emulator, or you can use the `mame` system
which comes configured with this emulator as the default. There are more MAME versions available as alternative
emulators, as you can see in the table below.
There are also other MAME forks and derivates available such as MAME4ALL, AdvanceMAME, FinalBurn Alpha and FinalBurn Neo
but it's beyond the scope of this document to describe those in detail. For more information, refer to
the [RetroPie arcade documentation](https://retropie.org.uk/docs/Arcade) which has a good overview of the various MAME
alternatives.
In general .zip or .7z files are recommended for smaller-sized games like those from older systems (assuming the
emulator supports it). But for CD-based systems it's not a good approach as uncompressing the larger CD images takes
quite some time, leading to slow game launches. As explained above, converting CD images to CHD files is a better
solution for achieving file compression while still enjoying fast game launches.
Consider the table below a work in progress as it's obvioulsy not fully populated yet!
| Game system name | Full name | Default emulator | Recommended game setup |
| :-------------------- | :--------------------------------------------- | :-------------------------------- | :----------------------------------- |
| 3do | 3DO | | |
| 64dd | Nintendo 64DD | RetroArch (Mupen64Plus-Next on Unix and Windows, ParaLLEl N64 on macOS) | |
| ags | Adventure Game Studio game engine | | |
| amiga | Commodore Amiga | RetroArch (P-UAE)* | WHDLoad hard disk image in .hdf or .hdz format in root folder, or diskette image in .adf format in root folder if single-disk, or in separate folder with .m3u playlist if multi-disk |
| amiga600 | Commodore Amiga 600 | RetroArch (P-UAE)* | WHDLoad hard disk image in .hdf or .hdz format in root folder, or diskette image in .adf format in root folder if single-disk, or in separate folder with .m3u playlist if multi-disk |
| amiga1200 | Commodore Amiga 1200 | RetroArch (P-UAE)* | WHDLoad hard disk image in .hdf or .hdz format in root folder, or diskette image in .adf format in root folder if single-disk, or in separate folder with .m3u playlist if multi-disk |
| amigacd32 | Commodore Amiga CD32 | | |
| amstradcpc | Amstrad CPC | | |
| apple2 | Apple II | | |
| apple2gs | Apple IIGS | | |
| arcade | Arcade | RetroArch (MAME - Current)* | Single archive file following MAME name standard in root folder |
| astrocade | Bally Astrocade | | |
| atari2600 | Atari 2600 | RetroArch (Stella on macOS and Windows, Stella 2014 on Unix) | Single archive or ROM file in root folder |
| atari5200 | Atari 5200 | | |
| atari7800 | Atari 7800 ProSystem | | |
| atari800 | Atari 800 | | |
| atarijaguar | Atari Jaguar | | |
| atarijaguarcd | Atari Jaguar CD | | |
| atarilynx | Atari Lynx | | |
| atarist | Atari ST [also STE and Falcon] | | |
| atarixe | Atari XE | | |
| atomiswave | Atomiswave | | |
| bbcmicro | BBC Micro | | |
| c64 | Commodore 64 | RetroArch (VICE x64sc, accurate) | Single disk, tape or cartridge image in root folder and/or multi-disk images in separate folder |
| cavestory | Cave Story (NXEngine) | | |
| cdtv | Commodore CDTV | | |
| chailove | ChaiLove game engine | | |
| channelf | Fairchild Channel F | | |
| coco | Tandy Color Computer | | |
| colecovision | ColecoVision | | |
| daphne | Daphne Arcade Laserdisc Emulator | | |
| desktop | Desktop applications | N/A | |
| doom | Doom | | |
| dos | DOS (PC) | RetroArch (DOSBox-core) | In separate folder (one folder per game, with complete file structure retained) |
| dragon32 | Dragon 32 | | |
| dreamcast | Sega Dreamcast | | |
| famicom | Nintendo Family Computer | RetroArch (Nestopia UE) | Single archive or ROM file in root folder |
| fba | FinalBurn Alpha | RetroArch (FB Alpha 2012)* | Single archive file following MAME name standard in root folder |
| fbneo | FinalBurn Neo | RetroArch (FinalBurn Neo)* | Single archive file following MAME name standard in root folder |
| fds | Nintendo Famicom Disk System | RetroArch (Nestopia UE)* | Single archive or ROM file in root folder |
| gameandwatch | Nintendo Game and Watch | | |
| gamegear | Sega Game Gear | | |
| gb | Nintendo Game Boy | | |
| gba | Nintendo Game Boy Advance | | |
| gbc | Nintendo Game Boy Color | | |
| gc | Nintendo GameCube | | |
| genesis | Sega Genesis | RetroArch (Genesis Plus GX) | Single archive or ROM file in root folder |
| gx4000 | Amstrad GX4000 | | |
| intellivision | Mattel Electronics Intellivision | | |
| kodi | Kodi home theatre software | N/A | |
| lutris | Lutris open gaming platform | Lutris application (Unix only) | Shell script in root folder |
| lutro | Lutro game engine | | |
| macintosh | Apple Macintosh | | |
| mame | Multiple Arcade Machine Emulator | RetroArch (MAME 2003-Plus)* | Single archive file following MAME name standard in root folder |
| mame-advmame | AdvanceMAME | | Single archive file following MAME name standard in root folder |
| mame-mame4all | MAME4ALL | | Single archive file following MAME name standard in root folder |
| mastersystem | Sega Master System | RetroArch (Genesis Plus GX) | Single archive or ROM file in root folder |
| megacd | Sega Mega-CD | | |
| megacdjp | Sega Mega-CD [Japan] | | |
| megadrive | Sega Mega Drive | RetroArch (Genesis Plus GX) | Single archive or ROM file in root folder |
| mess | Multi Emulator Super System | | |
| moonlight | Moonlight game streaming | | |
| moto | Thomson MO/TO series | RetroArch (Theodore) | |
| msx | MSX | RetroArch (blueMSX) | |
| msx1 | MSX1 | RetroArch (blueMSX) | |
| msx2 | MSX2 | RetroArch (blueMSX) | |
| msxturbor | MSX Turbo R | RetroArch (blueMSX) | |
| multivision | Othello Multivision | RetroArch (Gearsystem) | |
| naomi | Sega NAOMI | RetroArch (Flycast) | |
| naomigd | Sega NAOMI GD-ROM | RetroArch (Flycast) | |
| n3ds | Nintendo 3DS | RetroArch (Citra) | |
| n64 | Nintendo 64 | RetroArch (Mupen64Plus-Next on Unix and Windows, ParaLLEl N64 on macOS) | Single archive or ROM file in root folder |
| nds | Nintendo DS | | |
| neogeo | SNK Neo Geo | RetroArch (FinalBurn Neo)* | Single archive file following MAME name standard in root folder |
| neogeocd | SNK Neo Geo CD | RetroArch (NeoCD)* | Single archive in root folder (which includes the CD image and ripped audio) |
| neogeocdjp | SNK Neo Geo CD [Japan] | RetroArch (NeoCD)* | Single archive in root folder (which includes the CD image and ripped audio) |
| nes | Nintendo Entertainment System | RetroArch (Nestopia UE) | Single archive or ROM file in root folder |
| ngp | SNK Neo Geo Pocket | | |
| ngpc | SNK Neo Geo Pocket Color | | |
| odyssey2 | Magnavox Odyssey2 | | |
| openbor | OpenBOR game engine | | |
| oric | Tangerine Computer Systems Oric | | |
| palm | Palm OS | | |
| pc | IBM PC | RetroArch (DOSBox-core) | In separate folder (one folder per game, with complete file structure retained) |
| pc88 | NEC PC-8800 series | RetroArch (QUASI88) | |
| pc98 | NEC PC-9800 series | RetroArch (Neko Project II Kai) | |
| pcengine | NEC PC Engine | RetroArch (Beetle PCE) | Single archive or ROM file in root folder |
| pcenginecd | NEC PC Engine CD | RetroArch (Beetle PCE) | |
| pcfx | NEC PC-FX | | |
| pokemini | Nintendo Pokémon Mini | | |
| ports | Ports | N/A | Shell/batch script in separate folder (possibly combined with game data) |
| ps2 | Sony PlayStation 2 | | |
| ps3 | Sony PlayStation 3 | | |
| ps4 | Sony PlayStation 4 | | |
| psp | Sony PlayStation Portable | | |
| psvita | Sony PlayStation Vita | | |
| psx | Sony PlayStation | | |
| residualvm | ResidualVM game engine | | |
| samcoupe | SAM Coupé | | |
| satellaview | Nintendo Satellaview | | |
| saturn | Sega Saturn | RetroArch (Beetle Saturn) | |
| saturnjp | Sega Saturn [Japan] | RetroArch (Beetle Saturn) | |
| scummvm | ScummVM game engine | RetroArch (ScummVM) | In separate folder (one folder per game, with complete file structure retained) |
| sega32x | Sega Mega Drive 32X | RetroArch (PicoDrive) | Single archive or ROM file in root folder |
| sega32xjp | Sega Super 32X [Japan] | RetroArch (PicoDrive) | Single archive or ROM file in root folder |
| sega32xna | Sega Genesis 32X [North America] | RetroArch (PicoDrive) | Single archive or ROM file in root folder |
| segacd | Sega CD | | |
| sg-1000 | Sega SG-1000 | | |
| snes | Nintendo SNES (Super Nintendo) | RetroArch (Snes9x - Current) | Single archive or ROM file in root folder |
| snesna | Nintendo SNES (Super Nintendo) [North America] | RetroArch (Snes9x - Current) | Single archive or ROM file in root folder |
| solarus | Solarus game engine | | |
| spectravideo | Spectravideo | | |
| steam | Valve Steam | Steam application | Shell script/batch file in root folder |
| stratagus | Stratagus game engine | | |
| sufami | Bandai SuFami Turbo | | |
| supergrafx | NEC SuperGrafx | | |
| switch | Nintendo Switch | Yuzu (Linux and Windows only, not available on macOS) | |
| tanodragon | Tano Dragon | | |
| tg16 | NEC TurboGrafx-16 | RetroArch (Beetle PCE) | Single archive or ROM file in root folder |
| tg-cd | NEC TurboGrafx-CD | RetroArch (Beetle PCE) | |
| ti99 | Texas Instruments TI-99 | | |
| tic80 | TIC-80 game engine | | |
| to8 | Thomson TO8 | RetroArch (Theodore) | |
| trs-80 | Tandy TRS-80 | | |
| uzebox | Uzebox | | |
| vectrex | Vectrex | | |
| videopac | Philips Videopac G7000 (Magnavox Odyssey2) | | |
| virtualboy | Nintendo Virtual Boy | | |
| wii | Nintendo Wii | | |
| wiiu | Nintendo Wii U | | |
| wonderswan | Bandai WonderSwan | | |
| wonderswancolor | Bandai WonderSwan Color | | |
| x1 | Sharp X1 | RetroArch (x1) | Single archive or ROM file in root folder |
| x68000 | Sharp X68000 | | |
| xbox | Microsoft Xbox | | |
| xbox360 | Microsoft Xbox 360 | | |
| zmachine | Infocom Z-machine | | |
| zx81 | Sinclair ZX81 | | |
| zxspectrum | Sinclair ZX Spectrum | | |
Default emulator/Alternative emulators columns: \
**[U]**: Unix, **[M]**: macOS, **[W]**: Windows
All emulators are RetroArch cores unless marked as **(Standalone**)
| System name | Full name | Default emulator | Alternative emulators | Needs BIOS | Recommended game setup |
| :-------------------- | :--------------------------------------------- | :-------------------------------- | :-------------------------------- | :----------- | :----------------------------------- |
| 3do | 3DO | 4DO | | | |
| 64dd | Nintendo 64DD | Mupen64Plus-Next [UW],<br>ParaLLEl N64 [M] | ParaLLEl N64 [UW] | | |
| ags | Adventure Game Studio game engine | | | | |
| amiga | Commodore Amiga | PUAE | | Yes | WHDLoad hard disk image in .hdf or .hdz format in root folder, or diskette image in .adf format in root folder if single-disc, or in separate folder with .m3u playlist if multi-disc |
| amiga600 | Commodore Amiga 600 | PUAE | | Yes | WHDLoad hard disk image in .hdf or .hdz format in root folder, or diskette image in .adf format in root folder if single-disc, or in separate folder with .m3u playlist if multi-disc |
| amiga1200 | Commodore Amiga 1200 | PUAE | | Yes | WHDLoad hard disk image in .hdf or .hdz format in root folder, or diskette image in .adf format in root folder if single-disc, or in separate folder with .m3u playlist if multi-disc |
| amigacd32 | Commodore Amiga CD32 | PUAE | | | |
| amstradcpc | Amstrad CPC | Caprice32 | | | |
| apple2 | Apple II | | | | |
| apple2gs | Apple IIGS | | | | |
| arcade | Arcade | MAME - Current | MAME 2000,<br>MAME 2003-Plus,<br>MAME 2010,<br>FinalBurn Neo,<br>FB Alpha 2012 | Depends | Single archive file following MAME name standard in root folder |
| astrocade | Bally Astrocade | | | | |
| atari2600 | Atari 2600 | Stella | Stella 2014 | No | Single archive or ROM file in root folder |
| atari5200 | Atari 5200 | Atari800 | | | |
| atari7800 | Atari 7800 ProSystem | ProSystem | | | |
| atari800 | Atari 800 | Atari800 | | | |
| atarijaguar | Atari Jaguar | Virtual Jaguar | | | |
| atarijaguarcd | Atari Jaguar CD | Virtual Jaguar | | | |
| atarilynx | Atari Lynx | Beetle Lynx | | | |
| atarist | Atari ST [also STE and Falcon] | Hatari | | | |
| atarixe | Atari XE | Atari800 | | | |
| atomiswave | Atomiswave | Flycast | | | |
| bbcmicro | BBC Micro | | | | |
| c64 | Commodore 64 | VICE x64sc Accurate | VICE x64 Fast,<br>VICE x64 SuperCPU,<br>VICE x128,<br>Frodo | No | Single disk, tape r cartridge image in root folder and/or multi-disc images in separate folder |
| cavestory | Cave Story (NXEngine) | NXEngine | | | |
| cdtv | Commodore CDTV | | | | |
| chailove | ChaiLove game engine | ChaiLove | | | |
| channelf | Fairchild Channel F | FreeChaF | | | |
| coco | Tandy Color Computer | | | | |
| colecovision | ColecoVision | blueMSX | | | |
| daphne | Daphne Arcade Laserdisc Emulator | | | | |
| desktop | Desktop applications | N/A | | No | |
| doom | Doom | PrBoom | | | |
| dos | DOS (PC) | DOSBox-Core | DOSBox-Pure,<br>DOSBox-SVN | No | In separate folder (one folder per game, with complete file structure retained) |
| dragon32 | Dragon 32 | | | | |
| dreamcast | Sega Dreamcast | Flycast | | | |
| famicom | Nintendo Family Computer | Nestopia UE | FCEUmm,<br>Mesen,<br>QuickNES | No | Single archive or ROM file in root folder |
| fba | FinalBurn Alpha | FB Alpha 2012 | FB Alpha 2012 Neo Geo,<br>FB Alpha 2012 CPS-1,<br>FB Alpha 2012 CPS-2,<br>FB Alpha 2012 CPS-3 | Yes | Single archive file following MAME name standard in root folder |
| fbneo | FinalBurn Neo | FinalBurn Neo | | Yes | Single archive file following MAME name standard in root folder |
| fds | Nintendo Famicom Disk System | Nestopia UE | | Yes | Single archive or ROM file in root folder |
| gameandwatch | Nintendo Game and Watch | GW | | | |
| gamegear | Sega Game Gear | Genesis Plus GX | | | |
| gb | Nintendo Game Boy | bsnes | | | |
| gba | Nintendo Game Boy Advance | Beetle GBA | | | |
| gbc | Nintendo Game Boy Color | bsnes | | | |
| gc | Nintendo GameCube | Dolphin | | | |
| genesis | Sega Genesis | Genesis Plus GX | Genesis Plus GX Wide,<br>PicoDrive,<br>BlastEm | No | Single archive or ROM file in root folder |
| gx4000 | Amstrad GX4000 | | | | |
| intellivision | Mattel Electronics Intellivision | FreeIntv | | | |
| kodi | Kodi home theatre software | N/A | | No | |
| lutris | Lutris open gaming platform | Lutris application **(
Standalone)** [U] | | No | Shell script in root folder |
| lutro | Lutro game engine | Lutro | | | |
| macintosh | Apple Macintosh | | | | |
| mame | Multiple Arcade Machine Emulator | MAME 2003-Plus | MAME 2000,<br>MAME 2010,<br>MAME - Current,<br>FinalBurn Neo,<br>FB Alpha 2012 | Depends | Single archive file following MAME name standard in root folder |
| mame-advmame | AdvanceMAME | | | Depends | Single archive file following MAME name standard in root folder |
| mame-mame4all | MAME4ALL | | | Depends | Single archive file following MAME name standard in root folder |
| mastersystem | Sega Master System | Genesis Plus GX | Genesis Plus GX Wide,<br>SMS Plus GX,<br>Gearsystem,<br>PicoDrive | No | Single archive or ROM file in root folder |
| megacd | Sega Mega-CD | Genesis Plus GX | | | |
| megacdjp | Sega Mega-CD [Japan] | Genesis Plus GX | | | |
| megadrive | Sega Mega Drive | Genesis Plus GX | Genesis Plus GX Wide,<br>PicoDrive,<br>BlastEm | No | Single archive or ROM file in root folder |
| mess | Multi Emulator Super System | MESS 2015 | | | |
| moonlight | Moonlight game streaming | | | | |
| moto | Thomson MO/TO series | Theodore | | | |
| msx | MSX | blueMSX | | | |
| msx1 | MSX1 | blueMSX | | | |
| msx2 | MSX2 | blueMSX | | | |
| msxturbor | MSX Turbo R | blueMSX | | | |
| multivision | Othello Multivision | Gearsystem | | | |
| naomi | Sega NAOMI | Flycast | | | |
| naomigd | Sega NAOMI GD-ROM | Flycast | | | |
| n3ds | Nintendo 3DS | Citra | | | |
| n64 | Nintendo 64 | Mupen64Plus-Next [UW],<br>ParaLLEl N64 [M] | ParaLLEl N64 [UW] | No | Single archive or ROM file in root folder |
| nds | Nintendo DS | melonDS | | | |
| neogeo | SNK Neo Geo | FinalBurn Neo | | Yes | Single archive file following MAME name standard in root folder |
| neogeocd | SNK Neo Geo CD | NeoCD | | Yes | Single archive in root folder (which includes the CD image and ripped audio) |
| neogeocdjp | SNK Neo Geo CD [Japan] | NeoCD | | Yes | Single archive in root folder (which includes the CD image and ripped audio) |
| nes | Nintendo Entertainment System | Nestopia UE | FCEUmm,<br>Mesen,<br>QuickNES | No | Single archive or ROM file in root folder |
| ngp | SNK Neo Geo Pocket | Beetle NeoPop | | | |
| ngpc | SNK Neo Geo Pocket Color | Beetle NeoPop | | | |
| odyssey2 | Magnavox Odyssey2 | O2EM | | | |
| openbor | OpenBOR game engine | | | | |
| oric | Tangerine Computer Systems Oric | | | | |
| palm | Palm OS | Mu | | | |
| pc | IBM PC | DOSBox-Core | DOSBox-Pure,<br>DOSBox-SVN | No | In separate folder (one folder per game, with complete file structure retained) |
| pc88 | NEC PC-8800 series | QUASI88 | | | |
| pc98 | NEC PC-9800 series | Neko Project II Kai | | | |
| pcengine | NEC PC Engine | Beetle PCE | Beetle PCE FAST | No | Single archive or ROM file in root folder |
| pcenginecd | NEC PC Engine CD | Beetle PCE | Beetle PCE FAST | Yes | |
| pcfx | NEC PC-FX | Beetle PC-FX | | | |
| pokemini | Nintendo Pokémon Mini | PokeMini | | No | |
| ports | Ports | N/A | | No | Shell/batch script in separate folder (possibly combined with game data) |
| ps2 | Sony PlayStation 2 | PCSX2 [UW] | | | |
| ps3 | Sony PlayStation 3 | | | | |
| ps4 | Sony PlayStation 4 | | | | |
| psp | Sony PlayStation Portable | PPSSPP | | | |
| psvita | Sony PlayStation Vita | | | | |
| psx | Sony PlayStation | Beetle PSX | Beetle PSX HW,<br>PCSX ReARMed,<br>DuckStation | Yes | .chd file in root folder for single-disc games, .m3u playlist in root folder for multi-disc games |
| residualvm | ResidualVM game engine | | | | |
| samcoupe | SAM Coupé | SimCoupe | | | |
| satellaview | Nintendo Satellaview | Snes9x - Current | | | |
| saturn | Sega Saturn | Beetle Saturn | | | |
| saturnjp | Sega Saturn [Japan] | Beetle Saturn | | | |
| scummvm | ScummVM game engine | ScummVM | | No | In separate folder (one folder per game, with complete file structure retained) |
| sega32x | Sega Mega Drive 32X | PicoDrive | | No | Single archive or ROM file in root folder |
| sega32xjp | Sega Super 32X [Japan] | PicoDrive | | No | Single archive or ROM file in root folder |
| sega32xna | Sega Genesis 32X [North America] | PicoDrive | | No | Single archive or ROM file in root folder |
| segacd | Sega CD | Genesis Plus GX | | | |
| sg-1000 | Sega SG-1000 | Genesis Plus GX | | | |
| snes | Nintendo SNES (Super Nintendo) | Snes9x - Current | Snes9x 2010,<br>bsnes,<br>bsnes-mercury Accuracy,<br>Beetle Supafaust [UW],<br>Mesen-S | No | Single archive or ROM file in root folder |
| snesna | Nintendo SNES (Super Nintendo) [North America] | Snes9x - Current | Snes9x 2010,<br>bsnes,<br>bsnes-mercury Accuracy,<br>Beetle Supafaust [UW],<br>Mesen-S | No | Single archive or ROM file in root folder |
| solarus | Solarus game engine | | | | |
| spectravideo | Spectravideo | blueMSX | | | |
| steam | Valve Steam | Steam application **(
Standalone)** | | No | Shell script/batch file in root folder |
| stratagus | Stratagus game engine | | | | |
| sufami | Bandai SuFami Turbo | Snes9x - Current | | | |
| supergrafx | NEC SuperGrafx | Beetle SuperGrafx | Beetle PCE | | |
| switch | Nintendo Switch | Yuzu **(
Standalone)** [UW] | | Yes | |
| tanodragon | Tano Dragon | | | | |
| tg16 | NEC TurboGrafx-16 | Beetle PCE | Beetle PCE FAST | No | Single archive or ROM file in root folder |
| tg-cd | NEC TurboGrafx-CD | Beetle PCE | Beetle PCE FAST | Yes | |
| ti99 | Texas Instruments TI-99 | | | | |
| tic80 | TIC-80 game engine | | | | |
| to8 | Thomson TO8 | Theodore | | | |
| trs-80 | Tandy TRS-80 | | | | |
| uzebox | Uzebox | Uzem | | | |
| vectrex | Vectrex | vecx | | | |
| videopac | Philips Videopac G7000 (Magnavox Odyssey2) | O2EM | | | |
| virtualboy | Nintendo Virtual Boy | Beetle VB | | | |
| wii | Nintendo Wii | Dolphin | | | |
| wiiu | Nintendo Wii U | | | | |
| wonderswan | Bandai WonderSwan | Beetle Cygne | | | |
| wonderswancolor | Bandai WonderSwan Color | Beetle Cygne | | | |
| x1 | Sharp X1 | x1 | | | Single archive or ROM file in root folder |
| x68000 | Sharp X68000 | PX68k | | | |
| xbox | Microsoft Xbox | | | | |
| xbox360 | Microsoft Xbox 360 | | | | |
| zmachine | Infocom Z-machine | | | | |
| zx81 | Sinclair ZX81 | EightyOne | | | |
| zxspectrum | Sinclair ZX Spectrum | Fuse | | | | | Amstrad GX4000 | | | | |

View file

@ -120,7 +120,7 @@ Note that neither the systeminfo.txt files or the systems.txt file are needed to
There will be a lot of directories created if using the es_systems.xml file bundled with the installation, so it may be a good idea to remove the ones you don't need. It's recommended to move them to another location to be able to use them later if more systems should be added. For example a directory named _DISABLED could be created inside the ROMs folder (i.e. ~/ROMs/_DISABLED) and all game system directories you don't need could be moved there. Doing this reduces the application startup time as ES-DE would otherwise need to scan for game files for all these systems.
![alt text](images/current/es-de_ui_easy_setup.png "ES-DE Easy Setup")
![alt text](images/es-de_ui_easy_setup.png "ES-DE Easy Setup")
_This is the dialog shown if no game files were found. It lets you configure the ROM directory if you don't want to use the default one, and you can also generate the game systems directory structure. Note that the directory is the physical path, and that your operating system may present this as a localized path if you are using a language other than English._
@ -173,7 +173,7 @@ Depending on the theme, the system navigation carousel can be either horizontal
The game systems are sorted by their full names, as defined in the es_systems.xml file.
![alt text](images/current/es-de_system_view.png "ES-DE System View")
![alt text](images/es-de_system_view.png "ES-DE System View")
_The **System view** is the default starting point for the application, it's here that you browse through your game systems._
@ -191,10 +191,10 @@ In addition to the styles just described, there is a **Grid** view style as well
If the theme supports it, there's a gamelist information field displayed in the gamelist view, showing the number of games for the system (total and favorites) as well as a folder icon if a folder has been entered. When applying any filters to the gamelist, the game counter is replaced with the amount of games filtered, as in 'filtered / total games', e.g. '19 / 77'. If there are game entries in the filter result that are marked not to be counted as games, the number of such files will be indicated as 'filtered + filtered non-games / total games', for example '23 + 4 / 77' indicating 23 normal games, 4 non-games out of a total of 77. Due to this approach it's theoretically possible that the combined filtered game amount exceeds the number of counted games in the collection, for instance '69 + 11 / 77'. This is not considered a bug and is so by design. This gamelist information field functionality is specific to EmulationStation Desktop Edition so older themes will not support this.
![alt text](images/current/es-de_gamelist_view.png "ES-DE Gamelist View")
![alt text](images/es-de_gamelist_view.png "ES-DE Gamelist View")
_The **Gamelist view** is where you browse the games for a specific system._
![alt text](images/current/es-de_basic_view_style.png "ES-DE Basic View Style")
![alt text](images/es-de_basic_view_style.png "ES-DE Basic View Style")
_Here's an example of what the Basic view style looks like. Needless to say, ES-DE is not intended to be used like this. After scraping some game media for the system, the view style will automatically change to Detailed or Video (assuming the Automatic view style option has been selected)._
@ -217,7 +217,7 @@ The application can also be forced into any of the three modes via the command l
There is a help system available throughout the application that provides an overview of the possible actions and buttons that can be used. But some general actions are never shown, such as the ability to quick jump in gamelists, menus and text input fields using the shoulder and trigger buttons. It's also possible to disable the help system using a menu option for a somewhat cleaner look.
![alt text](images/current/es-de_folder_support.png "ES-DE Help System")
![alt text](images/es-de_folder_support.png "ES-DE Help System")
_The help system is displayed at the bottom of the screen, showing the various actions currently available._
@ -364,7 +364,8 @@ The platform name for the Commodore 64 is `c64`, so the following structure woul
~/ROMs/c64/Multidisk/Pirates/Pirates!.m3u
```
It's highly recommended to create `.m3u` playlist files for multi-disk images as this normally automates disk swapping in the emulator. It's then this .m3u file that should be selected for launching the game.
It's highly recommended to create `.m3u` playlist files for multi-disc images as this normally automates disk swapping
in the emulator. It's then this .m3u file that should be selected for launching the game.
The .m3u file simply contains a list of the game files, for example in the case of Last Ninja 2.m3u:
@ -417,9 +418,13 @@ Apart from the potential difficulty in locating the emulator binary, there are s
#### Commodore Amiga
There are multiple ways to run Amiga games, but the recommended approach is to use WHDLoad. The best way is to use hard disk images in `.hdf` or `.hdz` format, meaning there will be a single file per game. This makes it just as easy to play Amiga games as any console with game ROMs.
There are multiple ways to run Amiga games, but the recommended approach is to use WHDLoad. The best way is to use hard
disk images in `.hdf` or `.hdz` format, meaning there will be a single file per game. This makes it just as easy to play
Amiga games as any console with game ROMs.
An alternative would be to use `.adf` images as not all games may be available with WHDLoad support. For this, you can either put single-disk images in the root folder or in a dedicated adf directory, or multiple-disk games in separate folders. It's highly recommended to create `.m3u` playlist files for multi-disk images as described earlier.
An alternative would be to use `.adf` images as not all games may be available with WHDLoad support. For this, you can
either put single-disk images in the root folder or in a dedicated adf directory, or multiple-disk games in separate
folders. It's highly recommended to create `.m3u` playlist files for multi-disc images as described earlier.
Here's an example of what the file structure could look like:
@ -616,7 +621,7 @@ The **Multi-language** support includes translated game genres and game descript
There are two approaches to scraping, either for a single game from the metadata editor, or for many games and systems using the multi-scraper.
![alt text](images/current/es-de_scraper_running.png "ES-DE Scraper Running")
![alt text](images/es-de_scraper_running.png "ES-DE Scraper Running")
_Here's an example of the multi-scraper running in interactive mode, asking the user to make a selection from the multiple matching games returned by the scraper service._
### Single-game scraper
@ -697,7 +702,7 @@ It's possible to change the game media directory location from within ES-DE, for
This menu can be accessed from both the system view and gamelist view. It contains the scraper, application settings and various tools such as the input configurator and the miximage generator. Settings are saved when navigating back from any menu screen, assuming at least one setting was changed. Pressing the application exit key (F4) will also save any pending changes.
![alt text](images/current/es-de_main_menu.png "ES-DE Main Menu")
![alt text](images/es-de_main_menu.png "ES-DE Main Menu")
_The ES-DE main menu._
Following is a breakdown of the main menu entries.
@ -706,7 +711,7 @@ Following is a breakdown of the main menu entries.
Contains the various options for the scraper, which is used to download metadata, images and videos for your games.
![alt text](images/current/es-de_scraper_settings.png "ES-DE Scraper Settings")
![alt text](images/es-de_scraper_settings.png "ES-DE Scraper Settings")
_Some of the scraper settings._
**Scrape from**
@ -859,7 +864,8 @@ If this setting is enabled and a folder has its flag set to be excluded from the
**Scrape actual folders** _(Multi-scraper only)_
Enabling this option causes folders themselves to be included by the scraper. This is useful for DOS games or any multi-disk games where there is a folder for each individual game.
Enabling this option causes folders themselves to be included by the scraper. This is useful for DOS games or any
multi-disc games where there is a folder for each individual game.
**Auto-retry on peer verification errors** _(ScreenScraper only)_
@ -1206,7 +1212,11 @@ If this option is disabled, hidden files and folders within the ROMs directory t
**Show hidden games (requires restart)**
You can mark games as hidden in the metadata editor, which is useful for instance for DOS games where you may not want to see some batch files and executables inside ES-DE, or for multi-disk games where you may only want to show the .m3u playlists and not the individual game files. By disabling this option these files will not be processed at all when ES-DE starts up. If you enable the option you will see the files, but their name entries will be almost transparent in the gamelist view to visually indicate that they are hidden.
You can mark games as hidden in the metadata editor, which is useful for instance for DOS games where you may not want
to see some batch files and executables inside ES-DE, or for multi-disc games where you may only want to show the .m3u
playlists and not the individual game files. By disabling this option these files will not be processed at all when
ES-DE starts up. If you enable the option you will see the files, but their name entries will be almost transparent in
the gamelist view to visually indicate that they are hidden.
**Enable custom event scripts**
@ -1257,7 +1267,7 @@ This menu is opened from the gamelist view, and can't be accessed from the syste
You open the menu using the **Back** button, and by pressing **B** or selecting the **Apply** button any settings such as letter jumping using the quick selector or sorting changes are applied. If you instead press the Back button again or select the **Cancel** button, the menu is closed without applying any changes.
![alt text](images/current/es-de_game_options_menu.png "ES-DE Game Options Menu")
![alt text](images/es-de_game_options_menu.png "ES-DE Game Options Menu")
_The game options menu as laid out when opening it from within a custom collection, which adds the menu entry to add or remove games from the collection._
Here's a summary of the menu entries:
@ -1289,7 +1299,7 @@ The secondary sorting is always in ascending filename order.
Choosing this entry opens a separate screen where it's possible to apply a filter to the gamelist. The filter is persistent throughout the program session, or until it's manually reset. The option to reset all filters is shown on the same screen.
![alt text](images/current/es-de_gamelist_filters.png "ES-DE Gamelist Filters")
![alt text](images/es-de_gamelist_filters.png "ES-DE Gamelist Filters")
_The gamelist filter screen, accessed from the game options menu._
The following filters can be applied:
@ -1337,7 +1347,7 @@ This opens the metadata editor for the currently selected game file or folder.
In the metadata editor, you can modify the metadata, scrape for game info and media files, clear the entry which will delete all metadata and game media files, or delete the entire game which also removes its file on the filesystem. When manually modifying a value, it will change color from gray to blue, and if the scraper has changed a value, it will change to red. When leaving the metadata editor you will be asked whether you want to save any settings done manually or by the scraper.
![alt text](images/current/es-de_metadata_editor.png "ES-DE Metadata Editor")
![alt text](images/es-de_metadata_editor.png "ES-DE Metadata Editor")
_The metadata editor._
### Metadata entries
@ -1394,7 +1404,11 @@ A flag to mark whether the game is suitable for children. This will be applied a
**Hidden**
A flag to indicate that the game is hidden. If the corresponding option has been set in the main menu, the game will not be shown. Useful for example for DOS games to hide batch scripts and unnecessary binaries or to hide the actual game files for multi-disk games. If a file or folder is flagged as hidden but the corresponding option to hide hidden games has not been enabled, then the opacity of the text will be lowered significantly to make it clear that it's a hidden entry.
A flag to indicate that the game is hidden. If the corresponding option has been set in the main menu, the game will not
be shown. Useful for example for DOS games to hide batch scripts and unnecessary binaries or to hide the actual game
files for multi-disc games. If a file or folder is flagged as hidden but the corresponding option to hide hidden games
has not been enabled, then the opacity of the text will be lowered significantly to make it clear that it's a hidden
entry.
**Broken/not working**
@ -1402,15 +1416,27 @@ A flag to indicate whether the game is broken. Useful for MAME games for instanc
**Exclude from game counter** _(files only)_
A flag to indicate whether the game should be excluded from being counted. If this is set for a game, it will not be included in the game counter shown per system on the system view, and it will not be included in the system information field in the gamelist view. As well, it will be excluded from all automatic and custom collections. This option is quite useful for multi-file games such as multi-disk Amiga or Commodore 64 games, or for DOS games where you want to exclude setup programs and similar but still need them available in ES-DE and therefore can't hide them. Files that have this flag set will have a lower opacity in the gamelists, making them easy to spot.
A flag to indicate whether the game should be excluded from being counted. If this is set for a game, it will not be
included in the game counter shown per system on the system view, and it will not be included in the system information
field in the gamelist view. As well, it will be excluded from all automatic and custom collections. This option is quite
useful for multi-file games such as multi-disc Amiga or Commodore 64 games, or for DOS games where you want to exclude
setup programs and similar but still need them available in ES-DE and therefore can't hide them. Files that have this
flag set will have a lower opacity in the gamelists, making them easy to spot.
**Exclude from multi-scraper**
Whether to exclude the file from the multi-scraper. This is quite useful in order to avoid scraping all the disks for multi-disk games for example. There is an option in the scraper settings to ignore this flag, but by default the multi-scraper will respect it.
Whether to exclude the file from the multi-scraper. This is quite useful in order to avoid scraping all the disks for
multi-disc games for example. There is an option in the scraper settings to ignore this flag, but by default the
multi-scraper will respect it.
**Hide metadata fields**
This option will hide most metadata fields in the gamelist view. The intention is to be able to hide the fields for situations such as general folders (Multi-disk, Cartridges etc.) and for setup programs and similar (e.g. SETUP.EXE or INSTALL.BAT for DOS games). It could also be used on the game files for multi-disk games where perhaps only the .m3u playlist should have any metadata values. The only fields shown with this option enabled are the game name and description. Using the description it's possible to write some comments regarding the file or folder, should you want to. It's also possible to display game images and videos with this setting enabled.
This option will hide most metadata fields in the gamelist view. The intention is to be able to hide the fields for
situations such as general folders (Multi-disc, Cartridges etc.) and for setup programs and similar (e.g. SETUP.EXE or
INSTALL.BAT for DOS games). It could also be used on the game files for multi-disc games where perhaps only the .m3u
playlist should have any metadata values. The only fields shown with this option enabled are the game name and
description. Using the description it's possible to write some comments regarding the file or folder, should you want
to. It's also possible to display game images and videos with this setting enabled.
**Launch command** _(files only)_
@ -1468,7 +1494,7 @@ For the video and slideshow screensavers, an overlay can be enabled via the scre
If the Video screensaver has been selected and there are no videos available, a fallback to the Dim screensaver will take place. The same is true for the Slideshow screensaver if no game images are available.
![alt text](images/current/es-de_screensaver.png "ES-DE Screensaver")
![alt text](images/es-de_screensaver.png "ES-DE Screensaver")
_An example of what the video screensaver looks like._
## Game collections
@ -1509,10 +1535,10 @@ When you are done adding games, you can either open the main menu and go to **Ga
You can later add additional games to the collection by navigating to it, bringing up the game options menu and choosing **Add/remove games to this game collection**.
![alt text](images/current/es-de_custom_collections.png "ES-DE Custom Collections")
![alt text](images/es-de_custom_collections.png "ES-DE Custom Collections")
_Example of custom collections, here configured as genres._
![alt text](images/current/es-de_custom_collections_editing.png "ES-DE Custom Collections")
![alt text](images/es-de_custom_collections_editing.png "ES-DE Custom Collections")
_When editing a custom collection, a tick symbol will be displayed for any game that is already part of the collection._
@ -1572,7 +1598,7 @@ https://gitlab.com/recalbox/recalbox-themes
https://wiki.batocera.org/themes
![alt text](images/current/es-de_ui_theme_support.png "ES-DE Theme Support")
![alt text](images/es-de_ui_theme_support.png "ES-DE Theme Support")
_An example of a modified version of the [Fundamental](https://github.com/G-rila/es-theme-fundamental) theme applied to ES-DE._
@ -1625,9 +1651,9 @@ Consider the table below a work in progress as it's obvioulsy not fully populate
| 3do | 3DO | | |
| 64dd | Nintendo 64DD | RetroArch (Mupen64Plus-Next on Unix and Windows, ParaLLEl N64 on macOS) | |
| ags | Adventure Game Studio game engine | | |
| amiga | Commodore Amiga | RetroArch (P-UAE)* | WHDLoad hard disk image in .hdf or .hdz format in root folder, or diskette image in .adf format in root folder if single-disk, or in separate folder with .m3u playlist if multi-disk |
| amiga600 | Commodore Amiga 600 | RetroArch (P-UAE)* | WHDLoad hard disk image in .hdf or .hdz format in root folder, or diskette image in .adf format in root folder if single-disk, or in separate folder with .m3u playlist if multi-disk |
| amiga1200 | Commodore Amiga 1200 | RetroArch (P-UAE)* | WHDLoad hard disk image in .hdf or .hdz format in root folder, or diskette image in .adf format in root folder if single-disk, or in separate folder with .m3u playlist if multi-disk |
| amiga | Commodore Amiga | RetroArch (P-UAE)* | WHDLoad hard disk image in .hdf or .hdz format in root folder, or diskette image in .adf format in root folder if single-disk, or in separate folder with .m3u playlist if multi-disc |
| amiga600 | Commodore Amiga 600 | RetroArch (P-UAE)* | WHDLoad hard disk image in .hdf or .hdz format in root folder, or diskette image in .adf format in root folder if single-disk, or in separate folder with .m3u playlist if multi-disc |
| amiga1200 | Commodore Amiga 1200 | RetroArch (P-UAE)* | WHDLoad hard disk image in .hdf or .hdz format in root folder, or diskette image in .adf format in root folder if single-disk, or in separate folder with .m3u playlist if multi-disc |
| amigacd32 | Commodore Amiga CD32 | | |
| amstradcpc | Amstrad CPC | | |
| apple2 | Apple II | | |
@ -1645,7 +1671,7 @@ Consider the table below a work in progress as it's obvioulsy not fully populate
| atarixe | Atari XE | | |
| atomiswave | Atomiswave | | |
| bbcmicro | BBC Micro | | |
| c64 | Commodore 64 | RetroArch (VICE x64sc, accurate) | Single disk, tape or cartridge image in root folder and/or multi-disk images in separate folder |
| c64 | Commodore 64 | RetroArch (VICE x64sc, accurate) | Single disk, tape or cartridge image in root folder and/or multi-disc images in separate folder |
| cavestory | Cave Story (NXEngine) | | |
| cdtv | Commodore CDTV | | |
| chailove | ChaiLove game engine | | |

View file

@ -1,3 +1,12 @@
# SPDX-License-Identifier: MIT
#
# EmulationStation Desktop Edition
# CMakeLists.txt (es-app)
#
# CMake configuration for es-app.
# Also contains the application packaging configuration.
#
project("emulationstation-de")
set(ES_HEADERS
@ -49,7 +58,7 @@ set(ES_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/src/views/SystemView.h
${CMAKE_CURRENT_SOURCE_DIR}/src/views/UIModeController.h
${CMAKE_CURRENT_SOURCE_DIR}/src/views/ViewController.h
)
)
set(ES_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/CollectionSystemsManager.cpp
@ -100,7 +109,7 @@ set(ES_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/views/SystemView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/views/UIModeController.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/views/ViewController.cpp
)
)
if(WIN32)
LIST(APPEND ES_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation.rc)
@ -125,27 +134,55 @@ endif()
# Setup for installation and package generation.
if(WIN32)
install(TARGETS EmulationStation RUNTIME DESTINATION .)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
install(FILES ../avcodec-58.dll ../avfilter-7.dll ../avformat-58.dll ../avutil-56.dll
../postproc-55.dll ../swresample-3.dll ../swscale-5.dll ../FreeImage.dll
../glew32.dll ../libcrypto-1_1-x64.dll ../libcurl-x64.dll ../freetype.dll
../pugixml.dll ../libssl-1_1-x64.dll ../SDL2.dll ../MSVCP140.dll ../VCOMP140.DLL
../VCRUNTIME140.dll ../VCRUNTIME140_1.dll DESTINATION .)
if(VLC_PLAYER)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
install(FILES ../avcodec-58.dll
../avfilter-7.dll
../avformat-58.dll
../avutil-56.dll
../postproc-55.dll
../swresample-3.dll
../swscale-5.dll
../FreeImage.dll
../freetype.dll
../glew32.dll
../libcrypto-1_1-x64.dll
../libcurl-x64.dll
../libssl-1_1-x64.dll
../MSVCP140.dll
../pugixml.dll
../SDL2.dll
../VCOMP140.DLL
../VCRUNTIME140.dll
../VCRUNTIME140_1.dll
DESTINATION .)
if (VLC_PLAYER)
install(FILES ../libvlc.dll ../libvlccore.dll DESTINATION .)
endif()
else()
install(FILES ../avcodec-58.dll ../avfilter-7.dll ../avformat-58.dll ../avutil-56.dll
../postproc-55.dll ../swresample-3.dll ../swscale-5.dll ../FreeImage.dll
../glew32.dll ../libcrypto-1_1-x64.dll ../libcurl-x64.dll ../libfreetype.dll
../libpugixml.dll ../libssl-1_1-x64.dll ../SDL2.dll ../vcomp140.dll DESTINATION .)
if(VLC_PLAYER)
endif ()
else ()
install(FILES ../avcodec-58.dll
../avfilter-7.dll
../avformat-58.dll
../avutil-56.dll
../postproc-55.dll
../swresample-3.dll
../swscale-5.dll
../FreeImage.dll
../glew32.dll
../libcrypto-1_1-x64.dll
../libcurl-x64.dll
../libfreetype.dll
../libpugixml.dll
../libssl-1_1-x64.dll
../SDL2.dll
../vcomp140.dll
DESTINATION .)
if (VLC_PLAYER)
install(FILES ../libvlc.dll ../libvlccore.dll DESTINATION .)
endif()
endif()
if(VLC_PLAYER)
endif ()
endif ()
if (VLC_PLAYER)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/plugins DESTINATION .)
endif()
endif ()
install(FILES ../LICENSE DESTINATION .)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/licenses DESTINATION .)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/themes DESTINATION .)
@ -157,12 +194,9 @@ elseif(APPLE)
# So an extra 'Resources' directory was added to the CMAKE_INSTALL_PREFIX variable as well
# to compensate for this. It's a bad solution to the problem and there must surely be a
# better way to fix this.
install(TARGETS EmulationStation RUNTIME
DESTINATION ../MacOS)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation-DE.icns
DESTINATION ../Resources)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation-DE_Info.plist
DESTINATION .. RENAME Info.plist)
install(TARGETS EmulationStation RUNTIME DESTINATION ../MacOS)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation-DE.icns DESTINATION ../Resources)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation-DE_Info.plist DESTINATION .. RENAME Info.plist)
# Another hack/workaround. I have not been able to find any way whatsover to force the
# linker to use rpaths for all shared libraries instead of absolute paths. So instead
@ -183,8 +217,8 @@ elseif(APPLE)
-change /usr/local/opt/libpng/lib/libpng16.16.dylib @rpath/libpng16.16.dylib
-change /usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib @rpath/libSDL2-2.0.0.dylib
$<TARGET_FILE:EmulationStation>)
set(APPLE_DYLIB_PERMISSIONS
OWNER_WRITE OWNER_READ OWNER_EXECUTE
set(APPLE_DYLIB_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
@ -212,32 +246,29 @@ elseif(APPLE)
PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS)
install(FILES ${CMAKE_SOURCE_DIR}/libSDL2-2.0.0.dylib
PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS)
if(VLC_PLAYER)
if (VLC_PLAYER)
install(FILES ${CMAKE_SOURCE_DIR}/libvlc.dylib
PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS)
install(FILES ${CMAKE_SOURCE_DIR}/libvlccore.dylib
PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/plugins
DESTINATION ../MacOS)
endif()
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE
DESTINATION ../Resources)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/resources
DESTINATION ../Resources)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/themes
DESTINATION ../Resources)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/licenses
DESTINATION ../Resources)
else()
install(TARGETS emulationstation RUNTIME
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
endif ()
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION ../Resources)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/resources DESTINATION ../Resources)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/themes DESTINATION ../Resources)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/licenses DESTINATION ../Resources)
else ()
install(TARGETS emulationstation RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/emulationstation.6.gz
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man6)
else()
else ()
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/emulationstation.6.gz
DESTINATION ${CMAKE_INSTALL_PREFIX}/man/man6)
endif()
endif ()
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/emulationstation)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/emulationstation.desktop
@ -286,13 +317,13 @@ endif()
# Settings per operating system and generator type.
if(APPLE)
set(CPACK_GENERATOR "Bundle")
if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_LESS 10.14)
if (CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 10.14)
set(CPACK_PACKAGE_FILE_NAME "EmulationStation-DE-${CPACK_PACKAGE_VERSION}-${CPU_ARCHITECTURE}_legacy")
set(CPACK_DMG_VOLUME_NAME "EmulationStation Desktop Edition ${CPACK_PACKAGE_VERSION}_legacy")
else()
else ()
set(CPACK_PACKAGE_FILE_NAME "EmulationStation-DE-${CPACK_PACKAGE_VERSION}-${CPU_ARCHITECTURE}")
set(CPACK_DMG_VOLUME_NAME "EmulationStation Desktop Edition ${CPACK_PACKAGE_VERSION}")
endif()
endif ()
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation-DE.icns")
set(CPACK_DMG_DS_STORE "${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation-DE_DS_Store")
set(CPACK_BUNDLE_NAME "EmulationStation Desktop Edition")
@ -300,9 +331,9 @@ if(APPLE)
set(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation-DE_Info.plist")
if(MACOS_CODESIGN_IDENTITY)
set(CPACK_BUNDLE_APPLE_CERT_APP "Developer ID Application: ${MACOS_CODESIGN_IDENTITY}")
if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_GREATER 10.13)
if (CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER 10.13)
set(CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER "--deep --force --options runtime")
endif()
endif ()
endif()
elseif(WIN32)
set(CPACK_GENERATOR "NSIS")
@ -323,9 +354,9 @@ elseif(WIN32)
else()
set(CPACK_PACKAGE_INSTALL_DIRECTORY "emulationstation_${CMAKE_PACKAGE_VERSION}")
set(CPACK_PACKAGE_EXECUTABLES "emulationstation" "emulationstation")
if("${LINUX_CPACK_GENERATOR}" STREQUAL "DEB")
if (LINUX_CPACK_GENERATOR STREQUAL "DEB")
set(CPACK_GENERATOR "DEB")
endif()
endif ()
set(CPACK_DEBIAN_FILE_NAME "emulationstation-de-${CPACK_PACKAGE_VERSION}-${CPU_ARCHITECTURE}.deb")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Leon Styhre <leon@leonstyhre.com>")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://es-de.org")
@ -335,9 +366,9 @@ else()
set(CPACK_DEBIAN_PACKAGE_DEPENDS "vlc")
endif()
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
if("${LINUX_CPACK_GENERATOR}" STREQUAL "RPM")
if (LINUX_CPACK_GENERATOR STREQUAL "RPM")
set(CPACK_GENERATOR "RPM")
endif()
endif ()
set(CPACK_RPM_FILE_NAME "emulationstation-de-${CPACK_PACKAGE_VERSION}-${CPU_ARCHITECTURE}.rpm")
set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
set(CPACK_RPM_PACKAGE_LICENSE "MIT")

View file

@ -52,7 +52,7 @@ CollectionSystemsManager::CollectionSystemsManager(Window* window)
{
// clang-format off
CollectionSystemDecl systemDecls[] = {
// Type Name Long name Theme folder isCustom
// Type Name Long name Theme folder isCustom
{AUTO_ALL_GAMES, "all", "all games", "auto-allgames", false},
{AUTO_LAST_PLAYED, "recent", "last played", "auto-lastplayed", false},
{AUTO_FAVORITES, "favorites", "favorites", "auto-favorites", false},
@ -377,14 +377,22 @@ void CollectionSystemsManager::updateCollectionSystem(FileData* file, Collection
// If the countasgame flag has been set to false, then remove the game.
if (curSys->isGroupedCustomCollection()) {
ViewController::get()
->getGameListView(curSys->getRootFolder()->getParent()->getSystem())
.get()
->remove(collectionEntry, false);
FileData* parentRootFolder =
rootFolder->getParent()->getSystem()->getRootFolder();
->getGameListView(curSys->getRootFolder()->getParent()->getSystem())
.get()
->remove(collectionEntry, false);
FileData *parentRootFolder =
rootFolder->getParent()->getSystem()->getRootFolder();
parentRootFolder->sort(parentRootFolder->getSortTypeFromString(
parentRootFolder->getSortTypeString()),
parentRootFolder->getSortTypeString()),
mFavoritesSorting);
GuiInfoPopup *s = new GuiInfoPopup(
mWindow,
"DISABLED '" +
Utils::String::toUpper(
Utils::String::removeParenthesis(file->getName())) +
"' IN '" + Utils::String::toUpper(sysData.system->getName()) + "'",
4000);
mWindow->setInfoPopup(s);
}
else {
ViewController::get()->getGameListView(curSys).get()->remove(collectionEntry,
@ -542,19 +550,26 @@ bool CollectionSystemsManager::isThemeCustomCollectionCompatible(
return true;
}
std::string CollectionSystemsManager::getValidNewCollectionName(std::string inName, int index)
{
std::string CollectionSystemsManager::getValidNewCollectionName(std::string inName, int index) {
std::string name = inName;
// Trim leading and trailing whitespaces.
name.erase(name.begin(), std::find_if(name.begin(), name.end(), [](char c) {
return !std::isspace(static_cast<unsigned char>(c));
}));
name.erase(std::find_if(name.rbegin(), name.rend(),
[](char c) { return !std::isspace(static_cast<unsigned char>(c)); })
.base(),
name.end());
if (index == 0) {
size_t remove = std::string::npos;
// Get valid name.
while ((remove = name.find_first_not_of(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-[]()' ")) !=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-[]()' ")) !=
std::string::npos)
name.erase(remove, 1);
}
else {
} else {
name += " (" + std::to_string(index) + ")";
}
@ -674,7 +689,6 @@ bool CollectionSystemsManager::toggleGameInCollection(FileData* file)
rootFolder->getChildrenByFilename();
bool found = children.find(key) != children.cend();
FileFilterIndex* fileIndex = sysData->getIndex();
std::string name = sysData->getName();
SystemData* systemViewToUpdate = getSystemToView(sysData);
@ -1317,36 +1331,43 @@ void CollectionSystemsManager::addEnabledCollectionsToDisplayedSystems(
}
}
std::vector<std::string> CollectionSystemsManager::getSystemsFromConfig()
{
std::vector<std::string> CollectionSystemsManager::getSystemsFromConfig() {
std::vector<std::string> systems;
std::string path = SystemData::getConfigPath(false);
std::vector<std::string> configPaths = SystemData::getConfigPath(false);
if (!Utils::FileSystem::exists(path))
return systems;
// Here we don't honor the <loadExclusive> tag which may be present in the custom es_systems.xml
// file under ~/.emulationstation/custom_systems as we really want to include all the themes
// supported by ES-DE. Otherwise a user may accidentally create a custom collection that
// corresponds to a supported theme.
for (auto path: configPaths) {
if (!Utils::FileSystem::exists(path))
return systems;
pugi::xml_document doc;
pugi::xml_document doc;
#if defined(_WIN64)
pugi::xml_parse_result res = doc.load_file(Utils::String::stringToWideString(path).c_str());
pugi::xml_parse_result res = doc.load_file(Utils::String::stringToWideString(path).c_str());
#else
pugi::xml_parse_result res = doc.load_file(path.c_str());
pugi::xml_parse_result res = doc.load_file(path.c_str());
#endif
if (!res)
return systems;
if (!res)
return systems;
// Actually read the file.
pugi::xml_node systemList = doc.child("systemList");
// Actually read the file.
pugi::xml_node systemList = doc.child("systemList");
if (!systemList)
return systems;
if (!systemList)
return systems;
for (pugi::xml_node system = systemList.child("system"); system;
system = system.next_sibling("system")) {
// Theme folder.
std::string themeFolder = system.child("theme").text().get();
systems.push_back(themeFolder);
for (pugi::xml_node system = systemList.child("system"); system;
system = system.next_sibling("system")) {
// Theme folder.
std::string themeFolder = system.child("theme").text().get();
if (std::find(systems.cbegin(), systems.cend(), themeFolder) == systems.cend())
systems.push_back(themeFolder);
}
}
std::sort(systems.begin(), systems.end());
return systems;
}

View file

@ -30,19 +30,11 @@
#include <assert.h>
FileData::FileData(FileType type,
const std::string& path,
SystemEnvironmentData* envData,
SystemData* system)
: mType(type)
, mPath(path)
, mSystem(system)
, mEnvData(envData)
, mSourceFileData(nullptr)
, mParent(nullptr)
, mOnlyFolders(false)
, mDeletionFlag(false)
// Metadata is set in the constructor.
, metadata(type == GAME ? GAME_METADATA : FOLDER_METADATA)
const std::string &path,
SystemEnvironmentData *envData,
SystemData *system)
: metadata(type == GAME ? GAME_METADATA : FOLDER_METADATA), mSourceFileData(nullptr), mParent(nullptr),
mType(type), mPath(path), mEnvData(envData), mSystem(system), mOnlyFolders(false), mDeletionFlag(false)
{
// Metadata needs at least a name field (since that's what getName() will return).
if (metadata.get("name").empty()) {
@ -224,7 +216,7 @@ const std::string FileData::getMediafilePath(std::string subdirectory, std::stri
subFolders + "/" + getDisplayName();
// Look for an image file in the media directory.
for (int i = 0; i < extList.size(); i++) {
for (size_t i = 0; i < extList.size(); i++) {
std::string mediaPath = tempPath + extList[i];
if (Utils::FileSystem::exists(mediaPath))
return mediaPath;
@ -299,7 +291,7 @@ const std::string FileData::getVideoPath() const
getMediaDirectory() + mSystemName + "/videos" + subFolders + "/" + getDisplayName();
// Look for media in the media directory.
for (int i = 0; i < extList.size(); i++) {
for (size_t i = 0; i < extList.size(); i++) {
std::string mediaPath = tempPath + extList[i];
if (Utils::FileSystem::exists(mediaPath))
return mediaPath;
@ -347,9 +339,9 @@ std::vector<FileData*> FileData::getFilesRecursive(unsigned int typeMask,
out.insert(out.cend(), subChildren.cbegin(), subChildren.cend());
}
else {
for (auto it = subChildren.cbegin(); it != subChildren.cend(); it++) {
if ((*it)->getCountAsGame())
out.push_back(*it);
for (auto it2 = subChildren.cbegin(); it2 != subChildren.cend(); it2++) {
if ((*it2)->getCountAsGame())
out.push_back(*it2);
}
}
}
@ -743,37 +735,58 @@ FileData::SortType FileData::getSortTypeFromString(std::string desc)
return FileSorts::SortTypes.at(0);
}
void FileData::launchGame(Window* window)
{
void FileData::launchGame(Window *window) {
LOG(LogInfo) << "Launching game \"" << this->metadata.get("name") << "\"...";
SystemData *gameSystem = nullptr;
std::string command = "";
std::string alternativeEmulator;
// Check if there is a launch command override for the game
// and the corresponding option to use it has been set.
if (Settings::getInstance()->getBool("LaunchCommandOverride") &&
!metadata.get("launchcommand").empty()) {
command = metadata.get("launchcommand");
}
else {
std::string alternativeEmulator = getSystem()->getAlternativeEmulator();
for (auto launchCommand : mEnvData->mLaunchCommands) {
if (launchCommand.second == alternativeEmulator) {
command = launchCommand.first;
break;
}
}
if (!alternativeEmulator.empty() && command.empty()) {
LOG(LogWarning) << "The alternative emulator configured for system \""
<< getSystem()->getName()
<< "\" is invalid, falling back to the default command \""
<< getSystem()->getSystemEnvData()->mLaunchCommands.front().first << "\"";
}
if (mSystem->isCollection())
gameSystem = SystemData::getSystemByName(mSystemName);
else
gameSystem = mSystem;
if (command.empty())
command = mEnvData->mLaunchCommands.front().first;
// This is just a precaution as getSystemByName() should always return a valid result.
if (gameSystem == nullptr)
gameSystem = mSystem;
alternativeEmulator = gameSystem->getAlternativeEmulator();
// Check if there is a game-specific alternative emulator configured.
// This takes precedence over any system-wide alternative emulator configuration.
if (Settings::getInstance()->getBool("AlternativeEmulatorPerGame") &&
!metadata.get("altemulator").empty()) {
command = gameSystem->getLaunchCommandFromLabel(metadata.get("altemulator"));
if (command == "") {
LOG(LogWarning) << "Invalid alternative emulator \"" << metadata.get("altemulator")
<< "\" configured for game";
}
else {
LOG(LogDebug) << "FileData::launchGame(): Using alternative emulator \""
<< metadata.get("altemulator")
<< "\" as configured for the specific game";
}
}
// Check if there is a system-wide alternative emulator configured.
if (command == "" && alternativeEmulator != "") {
command = gameSystem->getLaunchCommandFromLabel(alternativeEmulator);
if (command == "") {
LOG(LogWarning) << "Invalid alternative emulator \""
<< alternativeEmulator.substr(9, alternativeEmulator.length() - 9)
<< "\" configured for system \"" << gameSystem->getName() << "\"";
}
else {
LOG(LogDebug) << "FileData::launchGame(): Using alternative emulator \""
<< gameSystem->getAlternativeEmulator() << "\""
<< " as configured for system \"" << gameSystem->getName() << "\"";
}
}
if (command.empty())
command = mEnvData->mLaunchCommands.front().first;
std::string commandRaw = command;
const std::string romPath = Utils::FileSystem::getEscapedPath(getPath());
@ -1332,10 +1345,10 @@ void CollectionFileData::refreshMetadata()
const std::string& CollectionFileData::getName()
{
if (mDirty) {
mCollectionFileName =
Utils::String::removeParenthesis(mSourceFileData->metadata.get("name"));
mCollectionFileName +=
" [" + Utils::String::toUpper(mSourceFileData->getSystem()->getName()) + "]";
mCollectionFileName = mSourceFileData->metadata.get("name");
mCollectionFileName.append(" [")
.append(Utils::String::toUpper(mSourceFileData->getSystem()->getName()))
.append("]");
mDirty = false;
}

View file

@ -20,22 +20,15 @@
#define INCLUDE_UNKNOWN false;
FileFilterIndex::FileFilterIndex()
: mFilterByText(false)
, mFilterByFavorites(false)
, mFilterByGenre(false)
, mFilterByPlayers(false)
, mFilterByPubDev(false)
, mFilterByRatings(false)
, mFilterByKidGame(false)
, mFilterByCompleted(false)
, mFilterByBroken(false)
, mFilterByHidden(false)
: mFilterByText(false), mTextRemoveSystem(false), mFilterByFavorites(false), mFilterByGenre(false),
mFilterByPlayers(false), mFilterByPubDev(false), mFilterByRatings(false), mFilterByKidGame(false),
mFilterByCompleted(false), mFilterByBroken(false), mFilterByHidden(false)
{
clearAllFilters();
// clang-format off
FilterDataDecl filterDecls[] = {
//type //allKeys //filteredBy //filteredKeys //primaryKey //hasSecondaryKey //secondaryKey //menuLabel
//type //allKeys //filteredBy //filteredKeys //primaryKey //hasSecondaryKey //secondaryKey //menuLabel
{FAVORITES_FILTER, &mFavoritesIndexAllKeys, &mFilterByFavorites, &mFavoritesIndexFilteredKeys, "favorite", false, "", "FAVORITES"},
{GENRE_FILTER, &mGenreIndexAllKeys, &mFilterByGenre, &mGenreIndexFilteredKeys, "genre", true, "genre", "GENRE"},
{PLAYER_FILTER, &mPlayersIndexAllKeys, &mFilterByPlayers, &mPlayersIndexFilteredKeys, "players", false, "", "PLAYERS"},
@ -279,7 +272,7 @@ void FileFilterIndex::setTextFilter(std::string textFilter)
mFilterByText = false;
else
mFilterByText = true;
};
}
void FileFilterIndex::clearAllFilters()
{
@ -359,22 +352,27 @@ bool FileFilterIndex::showFile(FileData* game)
bool keepGoing = false;
// Name filters take precedence over all other filters, so if there is no match for
// the game name, then always return false.
if (mTextFilter != "" &&
!(Utils::String::toUpper(game->getName()).find(mTextFilter) != std::string::npos)) {
// the game name, then always return false. If we're in a collection system and the option
// to show the system name has been enabled, then exclude the system name that is encapsulated
// in [] from the search string.
if (mTextFilter != "" && mTextRemoveSystem &&
!(Utils::String::toUpper(game->getName().substr(0, game->getName().find_last_of("[")))
.find(mTextFilter) != std::string::npos)) {
return false;
} else if (mTextFilter != "" &&
!(Utils::String::toUpper(game->getName()).find(mTextFilter) != std::string::npos)) {
return false;
}
else if (mTextFilter != "") {
if (mTextFilter != "")
nameMatch = true;
}
for (std::vector<FilterDataDecl>::const_iterator it = filterDataDecl.cbegin();
it != filterDataDecl.cend(); it++) {
FilterDataDecl filterData = (*it);
if (filterData.primaryKey == "kidgame" && UIModeController::getInstance()->isUIModeKid()) {
return (getIndexableKey(game, filterData.type, false) != "FALSE");
}
else if (*(filterData.filteredByRef)) {
} else if (*(filterData.filteredByRef)) {
// Try to find a match.
std::string key = getIndexableKey(game, filterData.type, false);
keepGoing = isKeyBeingFilteredBy(key, filterData.type);

View file

@ -48,21 +48,37 @@ class FileFilterIndex
public:
FileFilterIndex();
~FileFilterIndex();
void addToIndex(FileData* game);
void removeFromIndex(FileData* game);
void setFilter(FilterIndexType type, std::vector<std::string>* values);
void setTextFilter(std::string textFilter);
std::string getTextFilter() { return mTextFilter; }
void clearAllFilters();
void debugPrintIndexes();
bool showFile(FileData* game);
bool isFiltered();
bool isKeyBeingFilteredBy(std::string key, FilterIndexType type);
std::vector<FilterDataDecl>& getFilterDataDecls() { return filterDataDecl; }
void importIndex(FileFilterIndex* indexToImport);
void addToIndex(FileData *game);
void removeFromIndex(FileData *game);
void setFilter(FilterIndexType type, std::vector<std::string> *values);
void setTextFilter(std::string textFilter);
std::string getTextFilter() { return mTextFilter; }
void clearAllFilters();
void debugPrintIndexes();
bool showFile(FileData *game);
bool isFiltered();
bool isKeyBeingFilteredBy(std::string key, FilterIndexType type);
std::vector<FilterDataDecl> &getFilterDataDecls() { return filterDataDecl; }
void setTextRemoveSystem(bool status) { mTextRemoveSystem = status; }
void importIndex(FileFilterIndex *indexToImport);
void resetIndex();
void resetFilters();
void setKidModeFilters();
private:
@ -85,6 +101,7 @@ private:
std::string mTextFilter;
bool mFilterByText;
bool mTextRemoveSystem;
bool mFilterByFavorites;
bool mFilterByGenre;
@ -115,8 +132,6 @@ private:
std::vector<std::string> mCompletedIndexFilteredKeys;
std::vector<std::string> mBrokenIndexFilteredKeys;
std::vector<std::string> mHiddenIndexFilteredKeys;
FileData* mRootFolder;
};
#endif // ES_APP_FILE_FILTER_INDEX_H

View file

@ -227,11 +227,10 @@ namespace FileSorts
return system1.compare(system2) < 0;
}
bool compareSystemDescending(const FileData* file1, const FileData* file2)
{
bool compareSystemDescending(const FileData *file1, const FileData *file2) {
std::string system1 = Utils::String::toUpper(file1->getSystemName());
std::string system2 = Utils::String::toUpper(file2->getSystemName());
return system1.compare(system2) > 0;
}
}; // namespace FileSorts
} // namespace FileSorts

View file

@ -18,26 +18,44 @@ namespace FileSorts
{
bool compareName(const FileData* file1, const FileData* file2);
bool compareNameDescending(const FileData* file1, const FileData* file2);
bool compareRating(const FileData* file1, const FileData* file2);
bool compareRatingDescending(const FileData* file1, const FileData* file2);
bool compareReleaseDate(const FileData* file1, const FileData* file2);
bool compareReleaseDateDescending(const FileData* file1, const FileData* file2);
bool compareDeveloper(const FileData* file1, const FileData* file2);
bool compareDeveloperDescending(const FileData* file1, const FileData* file2);
bool comparePublisher(const FileData* file1, const FileData* file2);
bool comparePublisherDescending(const FileData* file1, const FileData* file2);
bool compareGenre(const FileData* file1, const FileData* file2);
bool compareGenreDescending(const FileData* file1, const FileData* file2);
bool compareNumPlayers(const FileData* file1, const FileData* file2);
bool compareNumPlayersDescending(const FileData* file1, const FileData* file2);
bool compareLastPlayed(const FileData* file1, const FileData* file2);
bool compareLastPlayedDescending(const FileData* file1, const FileData* file2);
bool compareTimesPlayed(const FileData* file1, const FileData* fil2);
bool compareTimesPlayedDescending(const FileData* file1, const FileData* fil2);
bool compareSystem(const FileData* file1, const FileData* file2);
bool compareSystemDescending(const FileData* file1, const FileData* file2);
bool compareRating(const FileData *file1, const FileData *file2);
bool compareRatingDescending(const FileData *file1, const FileData *file2);
bool compareReleaseDate(const FileData *file1, const FileData *file2);
bool compareReleaseDateDescending(const FileData *file1, const FileData *file2);
bool compareDeveloper(const FileData *file1, const FileData *file2);
bool compareDeveloperDescending(const FileData *file1, const FileData *file2);
bool comparePublisher(const FileData *file1, const FileData *file2);
bool comparePublisherDescending(const FileData *file1, const FileData *file2);
bool compareGenre(const FileData *file1, const FileData *file2);
bool compareGenreDescending(const FileData *file1, const FileData *file2);
bool compareNumPlayers(const FileData *file1, const FileData *file2);
bool compareNumPlayersDescending(const FileData *file1, const FileData *file2);
bool compareLastPlayed(const FileData *file1, const FileData *file2);
bool compareLastPlayedDescending(const FileData *file1, const FileData *file2);
bool compareTimesPlayed(const FileData *file1, const FileData *fil2);
bool compareTimesPlayedDescending(const FileData *file1, const FileData *fil2);
bool compareSystem(const FileData *file1, const FileData *file2);
bool compareSystemDescending(const FileData *file1, const FileData *file2);
extern const std::vector<FileData::SortType> SortTypes;
}; // namespace FileSorts
} // namespace FileSorts
#endif // ES_APP_FILE_SORTS_H

View file

@ -132,7 +132,7 @@ void parseGamelist(SystemData* system)
<< "\" has a valid alternativeEmulator entry: \"" << label << "\"";
}
else {
system->setAlternativeEmulator("<INVALID>");
system->setAlternativeEmulator("<INVALID>" + label);
LOG(LogWarning) << "System \"" << system->getName()
<< "\" has an invalid alternativeEmulator entry that does "
"not match any command tag in es_systems.xml: \""
@ -258,6 +258,7 @@ void updateGamelist(SystemData* system, bool updateAlternativeEmulator)
pugi::xml_document doc;
pugi::xml_node root;
std::string xmlReadPath = system->getGamelistPath(false);
bool hasAlternativeEmulatorTag = false;
if (Utils::FileSystem::exists(xmlReadPath)) {
// Parse an existing file first.
@ -283,6 +284,9 @@ void updateGamelist(SystemData* system, bool updateAlternativeEmulator)
if (updateAlternativeEmulator) {
pugi::xml_node alternativeEmulator = doc.child("alternativeEmulator");
if (alternativeEmulator)
hasAlternativeEmulatorTag = true;
if (system->getAlternativeEmulator() != "") {
if (!alternativeEmulator) {
doc.prepend_child("alternativeEmulator");
@ -373,14 +377,14 @@ void updateGamelist(SystemData* system, bool updateAlternativeEmulator)
Utils::FileSystem::createDirectory(Utils::FileSystem::getParent(xmlWritePath));
if (updateAlternativeEmulator) {
if (system->getAlternativeEmulator() == "") {
if (hasAlternativeEmulatorTag && system->getAlternativeEmulator() == "") {
LOG(LogDebug) << "Gamelist::updateGamelist(): Removed the "
"alternativeEmulator tag for system \""
<< system->getName() << "\" as the default emulator \""
<< system->getSystemEnvData()->mLaunchCommands.front().second
<< "\" was selected";
}
else {
else if (system->getAlternativeEmulator() != "") {
LOG(LogDebug) << "Gamelist::updateGamelist(): "
"Added/updated the alternativeEmulator tag for system \""
<< system->getName() << "\" to \""

View file

@ -81,7 +81,7 @@ void MediaViewer::update(int deltaTime)
mVideo->update(deltaTime);
}
void MediaViewer::render()
void MediaViewer::render(const glm::mat4& /*parentTrans*/)
{
glm::mat4 trans{Renderer::getIdentity()};
Renderer::setMatrix(trans);
@ -184,7 +184,7 @@ void MediaViewer::findMedia()
void MediaViewer::showNext()
{
if (mHasImages && mCurrentImageIndex != mImageFiles.size() - 1)
if (mHasImages && mCurrentImageIndex != static_cast<int>(mImageFiles.size()) - 1)
NavigationSounds::getInstance()->playThemeNavigationSound(SCROLLSOUND);
bool showedVideo = false;
@ -205,7 +205,7 @@ void MediaViewer::showNext()
if ((mVideo || showedVideo) && !mDisplayingImage)
mCurrentImageIndex = 0;
else if (mImageFiles.size() > mCurrentImageIndex + 1)
else if (static_cast<int>(mImageFiles.size()) > mCurrentImageIndex + 1)
mCurrentImageIndex++;
if (mVideo)
@ -281,7 +281,7 @@ void MediaViewer::showImage(int index)
mDisplayingImage = true;
if (!mImageFiles.empty() && mImageFiles.size() >= index) {
if (!mImageFiles.empty() && static_cast<int>(mImageFiles.size()) >= index) {
mImage = new ImageComponent(mWindow, false, false);
mImage->setImage(mImageFiles[index]);
mImage->setOrigin(0.5f, 0.5f);

View file

@ -20,11 +20,11 @@ public:
MediaViewer(Window* window);
virtual ~MediaViewer();
virtual bool startMediaViewer(FileData* game);
virtual void stopMediaViewer();
virtual bool startMediaViewer(FileData* game) override;
virtual void stopMediaViewer() override;
virtual void update(int deltaTime);
virtual void render();
virtual void update(int deltaTime) override;
virtual void render(const glm::mat4& parentTrans) override;
private:
void initiateViewer();
@ -33,8 +33,8 @@ private:
void playVideo();
void showImage(int index);
virtual void showNext();
virtual void showPrevious();
virtual void showNext() override;
virtual void showPrevious() override;
Window* mWindow;
FileData* mGame;

View file

@ -15,10 +15,12 @@
#include <pugixml.hpp>
// clang-format off
// The statistic entries must be placed at the bottom or otherwise there will be problems with
// saving the values in GuiMetaDataEd.
MetaDataDecl gameDecls[] = {
// key, type, default, statistic, name in GuiMetaDataEd, prompt in GuiMetaDataEd, shouldScrape
{"name", MD_STRING, "", false, "name", "enter name", true},
{"sortname", MD_STRING, "", false, "sortname", "enter sort name", false},
{"sortname", MD_STRING, "", false, "sortname", "enter sortname", false},
{"desc", MD_MULTILINE_STRING, "", false, "description", "enter description", true},
{"rating", MD_RATING, "0", false, "rating", "enter rating", true},
{"releasedate", MD_DATE, "19700101T010000", false, "release date", "enter release date", true},
@ -34,9 +36,8 @@ MetaDataDecl gameDecls[] = {
{"nogamecount", MD_BOOL, "false", false, "exclude from game counter", "enter don't count as game off/on", false},
{"nomultiscrape", MD_BOOL, "false", false, "exclude from multi-scraper", "enter no multi-scrape off/on", false},
{"hidemetadata", MD_BOOL, "false", false, "hide metadata fields", "enter hide metadata off/on", false},
{"launchcommand", MD_LAUNCHCOMMAND, "", false, "launch command", "enter game launch command "
"(emulator override)", false},
{"playcount", MD_INT, "0", false, "times played", "enter number of times played", false},
{"altemulator", MD_ALT_EMULATOR, "", false, "alternative emulator", "select alternative emulator", false},
{"lastplayed", MD_TIME, "0", true, "last played", "enter last played date", false}
};

View file

@ -32,7 +32,7 @@ enum MetaDataType {
// Specialized types.
MD_MULTILINE_STRING,
MD_LAUNCHCOMMAND,
MD_ALT_EMULATOR,
MD_PATH,
MD_RATING,
MD_DATE,

View file

@ -387,220 +387,246 @@ bool SystemData::loadConfig()
LOG(LogInfo) << "Populating game systems...";
std::string path = getConfigPath(true);
std::vector<std::string> configPaths = getConfigPath(true);
const std::string rompath = FileData::getROMDirectory();
LOG(LogInfo) << "Parsing systems configuration file \"" << path << "\"...";
bool onlyProcessCustomFile = false;
pugi::xml_document doc;
for (auto configPath : configPaths) {
// If the loadExclusive tag is present in the custom es_systems.xml file, then skip
// processing of the bundled configuration file.
if (onlyProcessCustomFile)
break;
LOG(LogInfo) << "Parsing systems configuration file \"" << configPath << "\"...";
pugi::xml_document doc;
#if defined(_WIN64)
pugi::xml_parse_result res = doc.load_file(Utils::String::stringToWideString(path).c_str());
pugi::xml_parse_result res =
doc.load_file(Utils::String::stringToWideString(configPath).c_str());
#else
pugi::xml_parse_result res = doc.load_file(path.c_str());
pugi::xml_parse_result res = doc.load_file(configPath.c_str());
#endif
if (!res) {
LOG(LogError) << "Couldn't parse es_systems.xml: " << res.description();
return true;
}
if (!res) {
LOG(LogError) << "Couldn't parse es_systems.xml: " << res.description();
return true;
}
// Actually read the file.
pugi::xml_node systemList = doc.child("systemList");
if (!systemList) {
LOG(LogError) << "es_systems.xml is missing the <systemList> tag";
return true;
}
for (pugi::xml_node system = systemList.child("system"); system;
system = system.next_sibling("system")) {
std::string name;
std::string fullname;
std::string path;
std::string themeFolder;
name = system.child("name").text().get();
fullname = system.child("fullname").text().get();
path = system.child("path").text().get();
auto nameFindFunc = [&] {
for (auto system : sSystemVector) {
if (system->mName == name) {
LOG(LogWarning) << "A system with the name \"" << name
<< "\" has already been loaded, skipping duplicate entry";
return true;
}
pugi::xml_node loadExclusive = doc.child("loadExclusive");
if (loadExclusive) {
if (configPath == configPaths.front() && configPaths.size() > 1) {
LOG(LogInfo) << "Only loading custom file as the <loadExclusive> tag is present";
onlyProcessCustomFile = true;
}
return false;
};
else {
LOG(LogWarning) << "A <loadExclusive> tag is present in the bundled es_systems.xml "
"file, ignoring it as this is only supposed to be used for the "
"custom es_systems.xml file";
}
}
// If the name is matching a system that has already been loaded, then skip the entry.
if (nameFindFunc())
continue;
// Actually read the file.
pugi::xml_node systemList = doc.child("systemList");
// If there is a %ROMPATH% variable set for the system, expand it. By doing this
// it's possible to use either absolute ROM paths in es_systems.xml or to utilize
// the ROM path configured as ROMDirectory in es_settings.xml. If it's set to ""
// in this configuration file, the default hardcoded path $HOME/ROMs/ will be used.
path = Utils::String::replace(path, "%ROMPATH%", rompath);
if (!systemList) {
LOG(LogError) << "es_systems.xml is missing the <systemList> tag";
return true;
}
for (pugi::xml_node system = systemList.child("system"); system;
system = system.next_sibling("system")) {
std::string name;
std::string fullname;
std::string path;
std::string themeFolder;
name = system.child("name").text().get();
fullname = system.child("fullname").text().get();
path = system.child("path").text().get();
auto nameFindFunc = [&] {
for (auto system : sSystemVector) {
if (system->mName == name) {
LOG(LogWarning) << "A system with the name \"" << name
<< "\" has already been loaded, skipping duplicate entry";
return true;
}
}
return false;
};
// If the name is matching a system that has already been loaded, then skip the entry.
if (nameFindFunc())
continue;
// If there is a %ROMPATH% variable set for the system, expand it. By doing this
// it's possible to use either absolute ROM paths in es_systems.xml or to utilize
// the ROM path configured as ROMDirectory in es_settings.xml. If it's set to ""
// in this configuration file, the default hardcoded path $HOME/ROMs/ will be used.
path = Utils::String::replace(path, "%ROMPATH%", rompath);
#if defined(_WIN64)
path = Utils::String::replace(path, "\\", "/");
path = Utils::String::replace(path, "\\", "/");
#endif
path = Utils::String::replace(path, "//", "/");
path = Utils::String::replace(path, "//", "/");
// Check that the ROM directory for the system is valid or otherwise abort the processing.
if (!Utils::FileSystem::exists(path)) {
LOG(LogDebug) << "SystemData::loadConfig(): Skipping system \"" << name
<< "\" as the defined ROM directory \"" << path << "\" does not exist";
continue;
}
if (!Utils::FileSystem::isDirectory(path)) {
LOG(LogDebug) << "SystemData::loadConfig(): Skipping system \"" << name
<< "\" as the defined ROM directory \"" << path
<< "\" is not actually a directory";
continue;
}
if (Utils::FileSystem::isSymlink(path)) {
// Make sure that the symlink is not pointing to somewhere higher in the hierarchy
// as that would lead to an infite loop, meaning the application would never start.
std::string resolvedRompath = Utils::FileSystem::getCanonicalPath(rompath);
if (resolvedRompath.find(Utils::FileSystem::getCanonicalPath(path)) == 0) {
LOG(LogWarning) << "Skipping system \"" << name
<< "\" as the defined ROM directory \"" << path
<< "\" is an infinitely recursive symlink";
// Check that the ROM directory for the system is valid or otherwise abort the
// processing.
if (!Utils::FileSystem::exists(path)) {
LOG(LogDebug) << "SystemData::loadConfig(): Skipping system \"" << name
<< "\" as the defined ROM directory \"" << path
<< "\" does not exist";
continue;
}
}
// Convert extensions list from a string into a vector of strings.
std::vector<std::string> extensions = readList(system.child("extension").text().get());
// Load all launch command tags for the system and if there are multiple tags, then
// the label attribute needs to be set on all entries as it's a requirement for the
// alternative emulator logic.
std::vector<std::pair<std::string, std::string>> commands;
for (pugi::xml_node entry = system.child("command"); entry;
entry = entry.next_sibling("command")) {
if (!entry.attribute("label")) {
if (commands.size() == 1) {
// The first command tag had a label but the second one doesn't.
LOG(LogError)
<< "Missing mandatory label attribute for alternative emulator "
"entry, only the default command tag will be processed for system \""
<< name << "\"";
break;
}
else if (commands.size() > 1) {
// At least two command tags had a label but this one doesn't.
LOG(LogError)
<< "Missing mandatory label attribute for alternative emulator "
"entry, no additional command tags will be processed for system \""
<< name << "\"";
break;
if (!Utils::FileSystem::isDirectory(path)) {
LOG(LogDebug) << "SystemData::loadConfig(): Skipping system \"" << name
<< "\" as the defined ROM directory \"" << path
<< "\" is not actually a directory";
continue;
}
if (Utils::FileSystem::isSymlink(path)) {
// Make sure that the symlink is not pointing to somewhere higher in the hierarchy
// as that would lead to an infite loop, meaning the application would never start.
std::string resolvedRompath = Utils::FileSystem::getCanonicalPath(rompath);
if (resolvedRompath.find(Utils::FileSystem::getCanonicalPath(path)) == 0) {
LOG(LogWarning)
<< "Skipping system \"" << name << "\" as the defined ROM directory \""
<< path << "\" is an infinitely recursive symlink";
continue;
}
}
else if (!commands.empty() && commands.back().second == "") {
// There are more than one command tags and the first tag did not have a label.
// Convert extensions list from a string into a vector of strings.
std::vector<std::string> extensions = readList(system.child("extension").text().get());
// Load all launch command tags for the system and if there are multiple tags, then
// the label attribute needs to be set on all entries as it's a requirement for the
// alternative emulator logic.
std::vector<std::pair<std::string, std::string>> commands;
for (pugi::xml_node entry = system.child("command"); entry;
entry = entry.next_sibling("command")) {
if (!entry.attribute("label")) {
if (commands.size() == 1) {
// The first command tag had a label but the second one doesn't.
LOG(LogError)
<< "Missing mandatory label attribute for alternative emulator "
"entry, only the first command tag will be processed for system \""
<< name << "\"";
break;
}
else if (commands.size() > 1) {
// At least two command tags had a label but this one doesn't.
LOG(LogError)
<< "Missing mandatory label attribute for alternative emulator "
"entry, no additional command tags will be processed for system \""
<< name << "\"";
break;
}
}
else if (!commands.empty() && commands.back().second == "") {
// There are more than one command tags and the first tag did not have a label.
LOG(LogError)
<< "Missing mandatory label attribute for alternative emulator "
"entry, only the first command tag will be processed for system \""
<< name << "\"";
break;
}
commands.push_back(
std::make_pair(entry.text().get(), entry.attribute("label").as_string()));
}
// Platform ID list
const std::string platformList =
Utils::String::toLower(system.child("platform").text().get());
if (platformList == "") {
LOG(LogWarning) << "No platform defined for system \"" << name
<< "\", scraper searches will be inaccurate";
}
std::vector<std::string> platformStrs = readList(platformList);
std::vector<PlatformIds::PlatformId> platformIds;
for (auto it = platformStrs.cbegin(); it != platformStrs.cend(); it++) {
std::string str = *it;
PlatformIds::PlatformId platformId = PlatformIds::getPlatformId(str);
if (platformId == PlatformIds::PLATFORM_IGNORE) {
// When platform is PLATFORM_IGNORE, do not allow other platforms.
platformIds.clear();
platformIds.push_back(platformId);
break;
}
// If there's a platform entry defined but it does not match the list of supported
// platforms, then generate a warning.
if (str != "" && platformId == PlatformIds::PLATFORM_UNKNOWN)
LOG(LogWarning) << "Unknown platform \"" << str << "\" defined for system \""
<< name << "\", scraper searches will be inaccurate";
else if (platformId != PlatformIds::PLATFORM_UNKNOWN)
platformIds.push_back(platformId);
}
// Theme folder.
themeFolder = system.child("theme").text().as_string(name.c_str());
// Validate.
if (name.empty()) {
LOG(LogError)
<< "Missing mandatory label attribute for alternative emulator "
"entry, only the default command tag will be processed for system \""
<< name << "\"";
break;
<< "A system in the es_systems.xml file has no name defined, skipping entry";
continue;
}
commands.push_back(
std::make_pair(entry.text().get(), entry.attribute("label").as_string()));
}
// Platform ID list
const std::string platformList =
Utils::String::toLower(system.child("platform").text().get());
if (platformList == "") {
LOG(LogWarning) << "No platform defined for system \"" << name
<< "\", scraper searches will be inaccurate";
}
std::vector<std::string> platformStrs = readList(platformList);
std::vector<PlatformIds::PlatformId> platformIds;
for (auto it = platformStrs.cbegin(); it != platformStrs.cend(); it++) {
std::string str = *it;
PlatformIds::PlatformId platformId = PlatformIds::getPlatformId(str);
if (platformId == PlatformIds::PLATFORM_IGNORE) {
// When platform is PLATFORM_IGNORE, do not allow other platforms.
platformIds.clear();
platformIds.push_back(platformId);
break;
else if (fullname.empty() || path.empty() || extensions.empty() || commands.empty()) {
LOG(LogError) << "System \"" << name
<< "\" is missing the fullname, path, "
"extension, or command tag, skipping entry";
continue;
}
// If there's a platform entry defined but it does not match the list of supported
// platforms, then generate a warning.
if (str != "" && platformId == PlatformIds::PLATFORM_UNKNOWN)
LOG(LogWarning) << "Unknown platform \"" << str << "\" defined for system \""
<< name << "\", scraper searches will be inaccurate";
else if (platformId != PlatformIds::PLATFORM_UNKNOWN)
platformIds.push_back(platformId);
}
// Theme folder.
themeFolder = system.child("theme").text().as_string(name.c_str());
// Validate.
if (name.empty()) {
LOG(LogError)
<< "A system in the es_systems.xml file has no name defined, skipping entry";
continue;
}
else if (fullname.empty() || path.empty() || extensions.empty() || commands.empty()) {
LOG(LogError) << "System \"" << name
<< "\" is missing the fullname, path, "
"extension, or command tag, skipping entry";
continue;
}
// Convert path to generic directory seperators.
path = Utils::FileSystem::getGenericPath(path);
// Convert path to generic directory seperators.
path = Utils::FileSystem::getGenericPath(path);
#if defined(_WIN64)
if (!Settings::getInstance()->getBool("ShowHiddenFiles") &&
Utils::FileSystem::isHidden(path)) {
LOG(LogWarning) << "Skipping hidden ROM folder \"" << path << "\"";
continue;
}
if (!Settings::getInstance()->getBool("ShowHiddenFiles") &&
Utils::FileSystem::isHidden(path)) {
LOG(LogWarning) << "Skipping hidden ROM folder \"" << path << "\"";
continue;
}
#endif
// Create the system runtime environment data.
SystemEnvironmentData* envData = new SystemEnvironmentData;
envData->mStartPath = path;
envData->mSearchExtensions = extensions;
envData->mLaunchCommands = commands;
envData->mPlatformIds = platformIds;
// Create the system runtime environment data.
SystemEnvironmentData* envData = new SystemEnvironmentData;
envData->mStartPath = path;
envData->mSearchExtensions = extensions;
envData->mLaunchCommands = commands;
envData->mPlatformIds = platformIds;
SystemData* newSys = new SystemData(name, fullname, envData, themeFolder);
bool onlyHidden = false;
SystemData* newSys = new SystemData(name, fullname, envData, themeFolder);
bool onlyHidden = false;
// If the option to show hidden games has been disabled, then check whether all
// games for the system are hidden. That will flag the system as empty.
if (!Settings::getInstance()->getBool("ShowHiddenGames")) {
std::vector<FileData*> recursiveGames = newSys->getRootFolder()->getChildrenRecursive();
onlyHidden = true;
for (auto it = recursiveGames.cbegin(); it != recursiveGames.cend(); it++) {
if ((*it)->getType() != FOLDER) {
onlyHidden = (*it)->getHidden();
if (!onlyHidden)
break;
// If the option to show hidden games has been disabled, then check whether all
// games for the system are hidden. That will flag the system as empty.
if (!Settings::getInstance()->getBool("ShowHiddenGames")) {
std::vector<FileData*> recursiveGames =
newSys->getRootFolder()->getChildrenRecursive();
onlyHidden = true;
for (auto it = recursiveGames.cbegin(); it != recursiveGames.cend(); it++) {
if ((*it)->getType() != FOLDER) {
onlyHidden = (*it)->getHidden();
if (!onlyHidden)
break;
}
}
}
}
if (newSys->getRootFolder()->getChildrenByFilename().size() == 0 || onlyHidden) {
LOG(LogDebug) << "SystemData::loadConfig(): Skipping system \"" << name
<< "\" as no files matched any of the defined file extensions";
delete newSys;
}
else {
sSystemVector.push_back(newSys);
if (newSys->getRootFolder()->getChildrenByFilename().size() == 0 || onlyHidden) {
LOG(LogDebug) << "SystemData::loadConfig(): Skipping system \"" << name
<< "\" as no files matched any of the defined file extensions";
delete newSys;
}
else {
sSystemVector.push_back(newSys);
}
}
}
@ -615,6 +641,18 @@ bool SystemData::loadConfig()
return false;
}
std::string SystemData::getLaunchCommandFromLabel(const std::string& label)
{
auto commandIter = std::find_if(
mEnvData->mLaunchCommands.cbegin(), mEnvData->mLaunchCommands.cend(),
[label](std::pair<std::string, std::string> command) { return (command.second == label); });
if (commandIter != mEnvData->mLaunchCommands.cend())
return (*commandIter).first;
return "";
}
void SystemData::deleteSystems()
{
for (unsigned int i = 0; i < sSystemVector.size(); i++)
@ -623,8 +661,10 @@ void SystemData::deleteSystems()
sSystemVector.clear();
}
std::string SystemData::getConfigPath(bool legacyWarning)
std::vector<std::string> SystemData::getConfigPath(bool legacyWarning)
{
std::vector<std::string> paths;
if (legacyWarning) {
std::string legacyConfigFile =
Utils::FileSystem::getHomePath() + "/.emulationstation/es_systems.cfg";
@ -651,7 +691,7 @@ std::string SystemData::getConfigPath(bool legacyWarning)
if (Utils::FileSystem::exists(path)) {
LOG(LogInfo) << "Found custom systems configuration file";
return path;
paths.push_back(path);
}
#if defined(_WIN64)
@ -663,18 +703,16 @@ std::string SystemData::getConfigPath(bool legacyWarning)
path = ResourceManager::getInstance()->getResourcePath(":/systems/unix/es_systems.xml", true);
#endif
return path;
paths.push_back(path);
return paths;
}
bool SystemData::createSystemDirectories()
{
std::string path = getConfigPath(false);
std::vector<std::string> configPaths = getConfigPath(true);
const std::string rompath = FileData::getROMDirectory();
if (!Utils::FileSystem::exists(path)) {
LOG(LogInfo) << "Systems configuration file does not exist, aborting";
return true;
}
bool onlyProcessCustomFile = false;
LOG(LogInfo) << "Generating ROM directory structure...";
@ -695,144 +733,187 @@ bool SystemData::createSystemDirectories()
LOG(LogInfo) << "Base ROM directory \"" << rompath << "\" already exists";
}
LOG(LogInfo) << "Parsing systems configuration file \"" << path << "\"...";
pugi::xml_document doc;
if (configPaths.size() > 1) {
// If the loadExclusive tag is present in the custom es_systems.xml file, then skip
// processing of the bundled configuration file.
pugi::xml_document doc;
#if defined(_WIN64)
pugi::xml_parse_result res = doc.load_file(Utils::String::stringToWideString(path).c_str());
pugi::xml_parse_result res =
doc.load_file(Utils::String::stringToWideString(configPaths.front()).c_str());
#else
pugi::xml_parse_result res = doc.load_file(path.c_str());
pugi::xml_parse_result res = doc.load_file(configPaths.front().c_str());
#endif
if (!res) {
LOG(LogError) << "Couldn't parse es_systems.xml";
LOG(LogError) << res.description();
return true;
}
// Actually read the file.
pugi::xml_node systemList = doc.child("systemList");
if (!systemList) {
LOG(LogError) << "es_systems.xml is missing the <systemList> tag";
return true;
}
std::vector<std::string> systemsVector;
for (pugi::xml_node system = systemList.child("system"); system;
system = system.next_sibling("system")) {
std::string systemDir;
std::string name;
std::string fullname;
std::string path;
std::string extensions;
std::vector<std::string> commands;
std::string platform;
std::string themeFolder;
const std::string systemInfoFileName = "/systeminfo.txt";
bool replaceInfoFile = false;
std::ofstream systemInfoFile;
name = system.child("name").text().get();
fullname = system.child("fullname").text().get();
path = system.child("path").text().get();
extensions = system.child("extension").text().get();
for (pugi::xml_node entry = system.child("command"); entry;
entry = entry.next_sibling("command")) {
commands.push_back(entry.text().get());
if (res) {
pugi::xml_node loadExclusive = doc.child("loadExclusive");
if (loadExclusive)
onlyProcessCustomFile = true;
}
platform = Utils::String::toLower(system.child("platform").text().get());
themeFolder = system.child("theme").text().as_string(name.c_str());
}
// Check that the %ROMPATH% variable is actually used for the path element.
// If not, skip the system.
if (path.find("%ROMPATH%") != 0) {
LOG(LogWarning) << "The path element for system \"" << name
<< "\" does not "
"utilize the %ROMPATH% variable, skipping entry";
// Process the custom es_systems.xml file after the bundled file, as any systems with identical
// <path> tags will be overwritten by the last occurrence.
std::reverse(configPaths.begin(), configPaths.end());
std::vector<std::pair<std::string, std::string>> systemsVector;
for (auto configPath : configPaths) {
// If the loadExclusive tag is present.
if (onlyProcessCustomFile && configPath == configPaths.front())
continue;
}
else {
systemDir = path.substr(9, path.size() - 9);
}
// Trim any leading directory separator characters.
systemDir.erase(systemDir.begin(),
std::find_if(systemDir.begin(), systemDir.end(),
[](char c) { return c != '/' && c != '\\'; }));
if (!Utils::FileSystem::exists(rompath + systemDir)) {
if (!Utils::FileSystem::createDirectory(rompath + systemDir)) {
LOG(LogError) << "Couldn't create system directory \"" << systemDir
<< "\", permission problems or disk full?";
return true;
}
else {
LOG(LogInfo) << "Created system directory \"" << systemDir << "\"";
}
}
else {
LOG(LogInfo) << "System directory \"" << systemDir << "\" already exists";
}
if (Utils::FileSystem::exists(rompath + systemDir + systemInfoFileName))
replaceInfoFile = true;
else
replaceInfoFile = false;
if (replaceInfoFile) {
if (Utils::FileSystem::removeFile(rompath + systemDir + systemInfoFileName))
return true;
}
LOG(LogInfo) << "Parsing systems configuration file \"" << configPath << "\"...";
pugi::xml_document doc;
#if defined(_WIN64)
systemInfoFile.open(
Utils::String::stringToWideString(rompath + systemDir + systemInfoFileName).c_str());
pugi::xml_parse_result res =
doc.load_file(Utils::String::stringToWideString(configPath).c_str());
#else
systemInfoFile.open(rompath + systemDir + systemInfoFileName);
pugi::xml_parse_result res = doc.load_file(configPath.c_str());
#endif
if (systemInfoFile.fail()) {
LOG(LogError) << "Couldn't create system information file \""
<< rompath + systemDir + systemInfoFileName
<< "\", permission problems or disk full?";
systemInfoFile.close();
if (!res) {
LOG(LogError) << "Couldn't parse es_systems.xml";
LOG(LogError) << res.description();
return true;
}
systemInfoFile << "System name:" << std::endl;
systemInfoFile << name << std::endl << std::endl;
systemInfoFile << "Full system name:" << std::endl;
systemInfoFile << fullname << std::endl << std::endl;
systemInfoFile << "Supported file extensions:" << std::endl;
systemInfoFile << extensions << std::endl << std::endl;
systemInfoFile << "Launch command:" << std::endl;
systemInfoFile << commands.front() << std::endl << std::endl;
// Alternative emulator configuration entries.
if (commands.size() > 1) {
systemInfoFile << (commands.size() == 2 ? "Alternative launch command:" :
"Alternative launch commands:")
<< std::endl;
for (auto it = commands.cbegin() + 1; it != commands.cend(); it++)
systemInfoFile << (*it) << std::endl;
systemInfoFile << std::endl;
}
systemInfoFile << "Platform (for scraping):" << std::endl;
systemInfoFile << platform << std::endl << std::endl;
systemInfoFile << "Theme folder:" << std::endl;
systemInfoFile << themeFolder << std::endl;
systemInfoFile.close();
// Actually read the file.
pugi::xml_node systemList = doc.child("systemList");
systemsVector.push_back(systemDir + ": " + fullname);
if (replaceInfoFile) {
LOG(LogInfo) << "Replaced existing system information file \""
<< rompath + systemDir + systemInfoFileName << "\"";
if (!systemList) {
LOG(LogError) << "es_systems.xml is missing the <systemList> tag";
return true;
}
else {
LOG(LogInfo) << "Created system information file \""
<< rompath + systemDir + systemInfoFileName << "\"";
for (pugi::xml_node system = systemList.child("system"); system;
system = system.next_sibling("system")) {
std::string systemDir;
std::string name;
std::string fullname;
std::string path;
std::string extensions;
std::vector<std::string> commands;
std::string platform;
std::string themeFolder;
const std::string systemInfoFileName = "/systeminfo.txt";
bool replaceInfoFile = false;
std::ofstream systemInfoFile;
name = system.child("name").text().get();
fullname = system.child("fullname").text().get();
path = system.child("path").text().get();
extensions = system.child("extension").text().get();
for (pugi::xml_node entry = system.child("command"); entry;
entry = entry.next_sibling("command")) {
commands.push_back(entry.text().get());
}
platform = Utils::String::toLower(system.child("platform").text().get());
themeFolder = system.child("theme").text().as_string(name.c_str());
// Check that the %ROMPATH% variable is actually used for the path element.
// If not, skip the system.
if (path.find("%ROMPATH%") != 0) {
LOG(LogWarning) << "The path element for system \"" << name
<< "\" does not "
"utilize the %ROMPATH% variable, skipping entry";
continue;
}
else {
systemDir = path.substr(9, path.size() - 9);
}
// Trim any leading directory separator characters.
systemDir.erase(systemDir.begin(),
std::find_if(systemDir.begin(), systemDir.end(),
[](char c) { return c != '/' && c != '\\'; }));
if (!Utils::FileSystem::exists(rompath + systemDir)) {
if (!Utils::FileSystem::createDirectory(rompath + systemDir)) {
LOG(LogError) << "Couldn't create system directory \"" << systemDir
<< "\", permission problems or disk full?";
return true;
}
else {
LOG(LogInfo) << "Created system directory \"" << systemDir << "\"";
}
}
else {
LOG(LogInfo) << "System directory \"" << systemDir << "\" already exists";
}
if (Utils::FileSystem::exists(rompath + systemDir + systemInfoFileName))
replaceInfoFile = true;
else
replaceInfoFile = false;
if (replaceInfoFile) {
if (Utils::FileSystem::removeFile(rompath + systemDir + systemInfoFileName))
return true;
}
#if defined(_WIN64)
systemInfoFile.open(
Utils::String::stringToWideString(rompath + systemDir + systemInfoFileName)
.c_str());
#else
systemInfoFile.open(rompath + systemDir + systemInfoFileName);
#endif
if (systemInfoFile.fail()) {
LOG(LogError) << "Couldn't create system information file \""
<< rompath + systemDir + systemInfoFileName
<< "\", permission problems or disk full?";
systemInfoFile.close();
return true;
}
systemInfoFile << "System name:" << std::endl;
if (configPaths.size() != 1 && configPath == configPaths.back())
systemInfoFile << name << " (custom system)" << std::endl << std::endl;
else
systemInfoFile << name << std::endl << std::endl;
systemInfoFile << "Full system name:" << std::endl;
systemInfoFile << fullname << std::endl << std::endl;
systemInfoFile << "Supported file extensions:" << std::endl;
systemInfoFile << extensions << std::endl << std::endl;
systemInfoFile << "Launch command:" << std::endl;
systemInfoFile << commands.front() << std::endl << std::endl;
// Alternative emulator configuration entries.
if (commands.size() > 1) {
systemInfoFile << (commands.size() == 2 ? "Alternative launch command:" :
"Alternative launch commands:")
<< std::endl;
for (auto it = commands.cbegin() + 1; it != commands.cend(); it++)
systemInfoFile << (*it) << std::endl;
systemInfoFile << std::endl;
}
systemInfoFile << "Platform (for scraping):" << std::endl;
systemInfoFile << platform << std::endl << std::endl;
systemInfoFile << "Theme folder:" << std::endl;
systemInfoFile << themeFolder << std::endl;
systemInfoFile.close();
auto systemIter = std::find_if(systemsVector.cbegin(), systemsVector.cend(),
[systemDir](std::pair<std::string, std::string> system) {
return system.first == systemDir;
});
if (systemIter != systemsVector.cend())
systemsVector.erase(systemIter);
if (configPaths.size() != 1 && configPath == configPaths.back())
systemsVector.push_back(std::make_pair(systemDir + " (custom system)", fullname));
else
systemsVector.push_back(std::make_pair(systemDir, fullname));
if (replaceInfoFile) {
LOG(LogInfo) << "Replaced existing system information file \""
<< rompath + systemDir + systemInfoFileName << "\"";
}
else {
LOG(LogInfo) << "Created system information file \""
<< rompath + systemDir + systemInfoFileName << "\"";
}
}
}
@ -859,8 +940,10 @@ bool SystemData::createSystemDirectories()
systemsFileSuccess = false;
}
else {
for (std::string systemEntry : systemsVector) {
systemsFile << systemEntry << std::endl;
std::sort(systemsVector.begin(), systemsVector.end());
for (auto systemEntry : systemsVector) {
systemsFile << systemEntry.first.append(": ").append(systemEntry.second)
<< std::endl;
}
systemsFile.close();
}
@ -886,6 +969,16 @@ bool SystemData::isVisible()
return true;
}
SystemData* SystemData::getSystemByName(const std::string& systemName)
{
for (auto it : sSystemVector) {
if ((*it).getName() == systemName)
return it;
}
return nullptr;
}
SystemData* SystemData::getNext() const
{
std::vector<SystemData*>::const_iterator it = getIterator();
@ -1152,21 +1245,21 @@ void SystemData::onMetaDataSavePoint()
writeMetaData();
}
void SystemData::setupSystemSortType(FileData* mRootFolder)
void SystemData::setupSystemSortType(FileData* rootFolder)
{
// If DefaultSortOrder is set to something, check that it is actually a valid value.
if (Settings::getInstance()->getString("DefaultSortOrder") != "") {
for (unsigned int i = 0; i < FileSorts::SortTypes.size(); i++) {
if (FileSorts::SortTypes.at(i).description ==
Settings::getInstance()->getString("DefaultSortOrder")) {
mRootFolder->setSortTypeString(
rootFolder->setSortTypeString(
Settings::getInstance()->getString("DefaultSortOrder"));
break;
}
}
}
// If no valid sort type was defined in the configuration file, set to default sorting.
if (mRootFolder->getSortTypeString() == "")
mRootFolder->setSortTypeString(
if (rootFolder->getSortTypeString() == "")
rootFolder->setSortTypeString(
Settings::getInstance()->getDefaultString("DefaultSortOrder"));
}

View file

@ -99,11 +99,12 @@ public:
std::string getAlternativeEmulator() { return mAlternativeEmulator; }
void setAlternativeEmulator(const std::string& command) { mAlternativeEmulator = command; }
std::string getLaunchCommandFromLabel(const std::string& label);
static void deleteSystems();
// Loads the systems configuration file at getConfigPath() and creates the systems.
// Loads the systems configuration file(s) at getConfigPath() and creates the systems.
static bool loadConfig();
static std::string getConfigPath(bool legacyWarning);
static std::vector<std::string> getConfigPath(bool legacyWarning);
// Generates the game system directories and information files based on es_systems.xml.
static bool createSystemDirectories();
@ -130,6 +131,7 @@ public:
bool isVisible();
static SystemData* getSystemByName(const std::string& systemName);
SystemData* getNext() const;
SystemData* getPrev() const;
static SystemData* getRandomSystem(const SystemData* currentSystem);
@ -145,14 +147,9 @@ public:
void onMetaDataSavePoint();
void writeMetaData();
void setupSystemSortType(FileData* mRootFolder);
void setupSystemSortType(FileData* rootFolder);
private:
bool mIsCollectionSystem;
bool mIsCustomCollectionSystem;
bool mIsGroupedCustomCollectionSystem;
bool mIsGameSystem;
bool mScrapeFlag; // Only used by scraper GUI to remember which systems to scrape.
std::string mName;
std::string mFullName;
SystemEnvironmentData* mEnvData;
@ -160,6 +157,12 @@ private:
std::string mThemeFolder;
std::shared_ptr<ThemeData> mTheme;
bool mIsCollectionSystem;
bool mIsCustomCollectionSystem;
bool mIsGroupedCustomCollectionSystem;
bool mIsGameSystem;
bool mScrapeFlag; // Only used by scraper GUI to remember which systems to scrape.
bool populateFolder(FileData* folder);
void indexAllGameFilters(const FileData* folder);
void setIsGameSystemStatus();

View file

@ -440,10 +440,10 @@ void SystemScreensaver::generateImageList()
continue;
std::vector<FileData*> allFiles = (*it)->getRootFolder()->getFilesRecursive(GAME, true);
for (auto it = allFiles.begin(); it != allFiles.end(); it++) {
std::string imagePath = (*it)->getImagePath();
for (auto it2 = allFiles.begin(); it2 != allFiles.end(); it2++) {
std::string imagePath = (*it2)->getImagePath();
if (imagePath != "")
mImageFiles.push_back((*it));
mImageFiles.push_back((*it2));
}
}
}
@ -457,10 +457,10 @@ void SystemScreensaver::generateVideoList()
continue;
std::vector<FileData*> allFiles = (*it)->getRootFolder()->getFilesRecursive(GAME, true);
for (auto it = allFiles.begin(); it != allFiles.end(); it++) {
std::string videoPath = (*it)->getVideoPath();
for (auto it2 = allFiles.begin(); it2 != allFiles.end(); it2++) {
std::string videoPath = (*it2)->getVideoPath();
if (videoPath != "")
mVideoFiles.push_back((*it));
mVideoFiles.push_back((*it2));
}
}
}

View file

@ -131,9 +131,10 @@ void VolumeControl::init()
// Retrieve endpoint volume.
defaultDevice->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_INPROC_SERVER,
nullptr, reinterpret_cast<LPVOID*>(&endpointVolume));
if (endpointVolume == nullptr)
if (endpointVolume == nullptr) {
LOG(LogError) << "VolumeControl::init(): "
"Failed to get default audio endpoint volume!";
}
// Release default device. we don't need it anymore.
defaultDevice->Release();
}
@ -245,8 +246,9 @@ void VolumeControl::setVolume(int volume)
float floatVolume = 0.0f; // 0-1
if (volume > 0)
floatVolume = static_cast<float>(volume) / 100.0f;
if (endpointVolume->SetMasterVolumeLevelScalar(floatVolume, nullptr) != S_OK)
if (endpointVolume->SetMasterVolumeLevelScalar(floatVolume, nullptr) != S_OK) {
LOG(LogError) << "VolumeControl::setVolume(): Failed to set master volume";
}
}
#endif
}

View file

@ -23,14 +23,17 @@ GuiAlternativeEmulators::GuiAlternativeEmulators(Window* window)
// Horizontal sizes for the system and label entries.
float systemSizeX = mMenu.getSize().x / 3.27f;
float labelSizeX = mMenu.getSize().x / 1.53;
float labelSizeX = mMenu.getSize().x / 1.53f;
if (Renderer::getScreenHeightModifier() > 1.0f)
labelSizeX += 8.0f * Renderer::getScreenHeightModifier();
for (auto it = SystemData::sSystemVector.cbegin(); // Line break.
it != SystemData::sSystemVector.cend(); it++) {
// Only include systems that have at least two command entries, unless the system
// has an invalid entry.
if ((*it)->getAlternativeEmulator() != "<INVALID>" &&
if ((*it)->getAlternativeEmulator().substr(0, 9) != "<INVALID>" &&
(*it)->getSystemEnvData()->mLaunchCommands.size() < 2)
continue;
@ -68,7 +71,7 @@ GuiAlternativeEmulators::GuiAlternativeEmulators(Window* window)
bool invalidEntry = false;
if (label.empty()) {
label = "<INVALID ENTRY>";
label = ViewController::EXCLAMATION_CHAR + " INVALID ENTRY";
invalidEntry = true;
}
@ -94,7 +97,11 @@ GuiAlternativeEmulators::GuiAlternativeEmulators(Window* window)
labelText->setSize(labelSizeX, labelText->getSize().y);
row.addElement(labelText, false);
row.makeAcceptInputHandler([this, it] { selectorWindow(*it); });
row.makeAcceptInputHandler([this, it, labelText] {
if (labelText->getValue() == ViewController::CROSSEDCIRCLE_CHAR + " CLEARED ENTRY")
return;
selectorWindow(*it);
});
mMenu.addRow(row);
mHasSystems = true;
@ -104,9 +111,9 @@ GuiAlternativeEmulators::GuiAlternativeEmulators(Window* window)
// es_systems.xml.
if (!mHasSystems) {
ComponentListRow row;
std::shared_ptr<TextComponent> systemText =
std::make_shared<TextComponent>(mWindow, "<NO ALTERNATIVE EMULATORS DEFINED>",
Font::get(FONT_SIZE_MEDIUM), 0x777777FF, ALIGN_CENTER);
std::shared_ptr<TextComponent> systemText = std::make_shared<TextComponent>(
mWindow, ViewController::EXCLAMATION_CHAR + " NO ALTERNATIVE EMULATORS DEFINED",
Font::get(FONT_SIZE_MEDIUM), 0x777777FF, ALIGN_CENTER);
row.addElement(systemText, true);
mMenu.addRow(row);
}
@ -150,13 +157,16 @@ void GuiAlternativeEmulators::selectorWindow(SystemData* system)
ComponentListRow row;
if (entry.second == "")
label = "<REMOVE INVALID ENTRY>";
label = ViewController::CROSSEDCIRCLE_CHAR + " CLEAR INVALID ENTRY";
else
label = entry.second;
std::shared_ptr<TextComponent> labelText = std::make_shared<TextComponent>(
mWindow, label, Font::get(FONT_SIZE_MEDIUM), 0x777777FF, ALIGN_CENTER);
if (system->getSystemEnvData()->mLaunchCommands.front().second == label)
labelText->setValue(labelText->getValue().append(" [DEFAULT]"));
row.addElement(labelText, true);
row.makeAcceptInputHandler([this, s, system, labelText, entry, selectedLabel] {
if (entry.second != selectedLabel) {
@ -165,9 +175,26 @@ void GuiAlternativeEmulators::selectorWindow(SystemData* system)
else
system->setAlternativeEmulator(entry.second);
updateGamelist(system, true);
updateMenu(
system->getName(), labelText->getValue(),
(entry.second == system->getSystemEnvData()->mLaunchCommands.front().second));
if (entry.second == system->getSystemEnvData()->mLaunchCommands.front().second) {
if (system->getSystemEnvData()->mLaunchCommands.front().second == "") {
updateMenu(system->getName(),
ViewController::CROSSEDCIRCLE_CHAR + " CLEARED ENTRY",
(entry.second ==
system->getSystemEnvData()->mLaunchCommands.front().second));
}
else {
updateMenu(system->getName(),
system->getSystemEnvData()->mLaunchCommands.front().second,
(entry.second ==
system->getSystemEnvData()->mLaunchCommands.front().second));
}
}
else {
updateMenu(system->getName(), labelText->getValue(),
(entry.second ==
system->getSystemEnvData()->mLaunchCommands.front().second));
}
}
delete s;
});

View file

@ -14,6 +14,7 @@
#include "components/SwitchComponent.h"
#include "guis/GuiMsgBox.h"
#include "guis/GuiSettings.h"
#include "guis/GuiTextEditKeyboardPopup.h"
#include "guis/GuiTextEditPopup.h"
#include "utils/StringUtil.h"
#include "views/ViewController.h"
@ -199,29 +200,39 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(Window* window, std::st
glm::vec2{0.0f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()});
row.addElement(newCollection, true);
row.addElement(bracketNewCollection, false);
auto createCollectionCall = [this](const std::string& newVal) {
auto createCollectionCall = [this](const std::string &newVal) {
std::string name = newVal;
// We need to store the first GUI and remove it, as it'll be deleted
// by the actual GUI.
Window* window = mWindow;
GuiComponent* topGui = window->peekGui();
Window *window = mWindow;
GuiComponent *topGui = window->peekGui();
window->removeGui(topGui);
createCustomCollection(name);
};
row.makeAcceptInputHandler([this, createCollectionCall] {
mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), "New Collection Name", "",
createCollectionCall, false, "SAVE"));
});
if (Settings::getInstance()->getBool("VirtualKeyboard")) {
row.makeAcceptInputHandler([this, createCollectionCall] {
mWindow->pushGui(new GuiTextEditKeyboardPopup(
mWindow, getHelpStyle(), "New Collection Name", "", createCollectionCall, false,
"CREATE", "CREATE COLLECTION?"));
});
} else {
row.makeAcceptInputHandler([this, createCollectionCall] {
mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), "New Collection Name",
"", createCollectionCall, false, "CREATE",
"CREATE COLLECTION?"));
});
}
addRow(row);
// Delete custom collection.
row.elements.clear();
auto deleteCollection = std::make_shared<TextComponent>(
mWindow, "DELETE CUSTOM COLLECTION", Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
mWindow, "DELETE CUSTOM COLLECTION", Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
auto bracketDeleteCollection = std::make_shared<ImageComponent>(mWindow);
bracketDeleteCollection->setImage(":/graphics/arrow.svg");
bracketDeleteCollection->setResize(
glm::vec2{0.0f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()});
glm::vec2{0.0f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()});
row.addElement(deleteCollection, true);
row.addElement(bracketDeleteCollection, false);
row.makeAcceptInputHandler([this, customSystems] {
@ -271,7 +282,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(Window* window, std::st
CollectionSystemsManager::get()->deleteCustomCollection(name);
return true;
},
"NO", [this] { return false; }));
"NO", [] { return false; }));
};
row.makeAcceptInputHandler(deleteCollectionCall);
auto customCollection = std::make_shared<TextComponent>(

View file

@ -18,14 +18,11 @@
#include "components/TextComponent.h"
#include "views/ViewController.h"
GuiGameScraper::GuiGameScraper(Window* window,
GuiGameScraper::GuiGameScraper(Window *window,
ScraperSearchParams params,
std::function<void(const ScraperSearchResult&)> doneFunc)
: GuiComponent(window)
, mGrid(window, glm::ivec2{1, 7})
, mBox(window, ":/graphics/frame.svg")
, mSearchParams(params)
, mClose(false)
std::function<void(const ScraperSearchResult &)> doneFunc)
: GuiComponent(window), mClose(false), mGrid(window, glm::ivec2{1, 7}), mBox(window, ":/graphics/frame.svg"),
mSearchParams(params)
{
addChild(&mBox);
addChild(&mGrid);

View file

@ -12,6 +12,7 @@
#include "SystemData.h"
#include "components/OptionListComponent.h"
#include "guis/GuiTextEditKeyboardPopup.h"
#include "guis/GuiTextEditPopup.h"
#include "views/UIModeController.h"
#include "views/ViewController.h"
@ -28,13 +29,21 @@ GuiGamelistFilter::GuiGamelistFilter(Window* window,
initializeMenu();
}
void GuiGamelistFilter::initializeMenu()
{
void GuiGamelistFilter::initializeMenu() {
addChild(&mMenu);
// Get filters from system.
mFilterIndex = mSystem->getIndex();
// If this is a collection and system names are shown per game, then let FileFilterIndex
// know about this so the system names will not be included in game name text searches.
if (ViewController::get()->getState().getSystem()->isCollection()) {
if (Settings::getInstance()->getBool("CollectionShowSystemInfo"))
mFilterIndex->setTextRemoveSystem(true);
else
mFilterIndex->setTextRemoveSystem(false);
}
ComponentListRow row;
// Show filtered menu.
@ -84,13 +93,12 @@ void GuiGamelistFilter::resetAllFilters()
GuiGamelistFilter::~GuiGamelistFilter() { mFilterOptions.clear(); }
void GuiGamelistFilter::addFiltersToMenu()
{
void GuiGamelistFilter::addFiltersToMenu() {
ComponentListRow row;
auto lbl =
std::make_shared<TextComponent>(mWindow, Utils::String::toUpper("TEXT FILTER (GAME NAME)"),
Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
auto lbl = std::make_shared<TextComponent>(
mWindow, Utils::String::toUpper(ViewController::KEYBOARD_CHAR + " GAME NAME"),
Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
mTextFilterField = std::make_shared<TextComponent>(mWindow, "", Font::get(FONT_SIZE_MEDIUM),
0x777777FF, ALIGN_RIGHT);
@ -113,16 +121,24 @@ void GuiGamelistFilter::addFiltersToMenu()
}
// Callback function.
auto updateVal = [this](const std::string& newVal) {
auto updateVal = [this](const std::string &newVal) {
mTextFilterField->setValue(Utils::String::toUpper(newVal));
mFilterIndex->setTextFilter(Utils::String::toUpper(newVal));
};
row.makeAcceptInputHandler([this, updateVal] {
mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), "TEXT FILTER (GAME NAME)",
mTextFilterField->getValue(), updateVal, false, "OK",
"APPLY CHANGES?"));
});
if (Settings::getInstance()->getBool("VirtualKeyboard")) {
row.makeAcceptInputHandler([this, updateVal] {
mWindow->pushGui(new GuiTextEditKeyboardPopup(mWindow, getHelpStyle(), "GAME NAME",
mTextFilterField->getValue(), updateVal,
false, "OK", "APPLY CHANGES?"));
});
} else {
row.makeAcceptInputHandler([this, updateVal] {
mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), "GAME NAME",
mTextFilterField->getValue(), updateVal, false,
"OK", "APPLY CHANGES?"));
});
}
mMenu.addRow(row);
@ -137,9 +153,6 @@ void GuiGamelistFilter::addFiltersToMenu()
std::string menuLabel = (*it).menuLabel; // Text to show in menu.
std::shared_ptr<OptionListComponent<std::string>> optionList;
// Add filters (with first one selected).
ComponentListRow row;
// Add genres.
optionList = std::make_shared<OptionListComponent<std::string>>(mWindow, getHelpStyle(),
menuLabel, true);

View file

@ -25,15 +25,9 @@
#include "views/ViewController.h"
#include "views/gamelist/IGameListView.h"
GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system)
: GuiComponent(window)
, mSystem(system)
, mMenu(window, "OPTIONS")
, mFiltersChanged(false)
, mCancelled(false)
, mIsCustomCollection(false)
, mIsCustomCollectionGroup(false)
, mCustomCollectionSystem(nullptr)
GuiGamelistOptions::GuiGamelistOptions(Window *window, SystemData *system)
: GuiComponent(window), mMenu(window, "OPTIONS"), mSystem(system), mFiltersChanged(false), mCancelled(false),
mIsCustomCollection(false), mIsCustomCollectionGroup(false), mCustomCollectionSystem(nullptr)
{
addChild(&mMenu);

View file

@ -14,12 +14,9 @@
#include "components/TextComponent.h"
#include "utils/StringUtil.h"
GuiLaunchScreen::GuiLaunchScreen(Window* window)
: GuiComponent(window)
, mBackground(window, ":/graphics/frame.svg")
, mGrid(nullptr)
, mMarquee(nullptr)
, mWindow(window)
GuiLaunchScreen::GuiLaunchScreen(Window *window)
: GuiComponent(window), mWindow(window), mBackground(window, ":/graphics/frame.svg"), mGrid(nullptr),
mMarquee(nullptr)
{
addChild(&mBackground);
mWindow->setLaunchScreen(this);
@ -169,7 +166,6 @@ void GuiLaunchScreen::displayLaunchScreen(FileData* game)
mMarquee->setOrigin(0.5f, 0.5f);
glm::vec3 currentPos{mMarquee->getPosition()};
glm::vec2 currentSize{mMarquee->getSize()};
// Position the image in the middle of row four.
currentPos.x = mSize.x / 2.0f;
@ -221,8 +217,7 @@ void GuiLaunchScreen::update(int deltaTime)
mScaleUp = glm::clamp(mScaleUp + 0.07f, 0.0f, 1.0f);
}
void GuiLaunchScreen::render()
{
void GuiLaunchScreen::render(const glm::mat4 & /*parentTrans*/) {
// Scale up animation.
if (mScaleUp < 1.0f)
setScale(mScaleUp);

View file

@ -21,21 +21,24 @@ class FileData;
class GuiLaunchScreen : public Window::GuiLaunchScreen, GuiComponent
{
public:
GuiLaunchScreen(Window* window);
GuiLaunchScreen(Window *window);
virtual ~GuiLaunchScreen();
virtual void displayLaunchScreen(FileData* game) override;
virtual void displayLaunchScreen(FileData *game) override;
virtual void closeLaunchScreen() override;
void onSizeChanged() override;
virtual void update(int deltaTime) override;
virtual void render() override;
virtual void render(const glm::mat4 &parentTrans) override;
private:
Window* mWindow;
ComponentGrid* mGrid;
Window *mWindow;
NinePatchComponent mBackground;
ComponentGrid *mGrid;
std::shared_ptr<TextComponent> mTitle;
std::shared_ptr<TextComponent> mGameName;

View file

@ -22,12 +22,13 @@
#include "components/SwitchComponent.h"
#include "guis/GuiAlternativeEmulators.h"
#include "guis/GuiCollectionSystemsOptions.h"
#include "guis/GuiComplexTextEditPopup.h"
#include "guis/GuiDetectDevice.h"
#include "guis/GuiMediaViewerOptions.h"
#include "guis/GuiMsgBox.h"
#include "guis/GuiScraperMenu.h"
#include "guis/GuiScreensaverOptions.h"
#include "guis/GuiTextEditKeyboardPopup.h"
#include "guis/GuiTextEditPopup.h"
#include "views/UIModeController.h"
#include "views/ViewController.h"
#include "views/gamelist/IGameListView.h"
@ -35,10 +36,8 @@
#include <SDL2/SDL_events.h>
#include <algorithm>
GuiMenu::GuiMenu(Window* window)
: GuiComponent(window)
, mMenu(window, "MAIN MENU")
, mVersion(window)
GuiMenu::GuiMenu(Window *window)
: GuiComponent(window), mMenu(window, "MAIN MENU"), mVersion(window)
{
bool isFullUI = UIModeController::getInstance()->isUIModeFull();
@ -509,6 +508,18 @@ void GuiMenu::openUIOptions()
}
});
// Enable virtual (on-screen) keyboard.
auto virtual_keyboard = std::make_shared<SwitchComponent>(mWindow);
virtual_keyboard->setState(Settings::getInstance()->getBool("VirtualKeyboard"));
s->addWithLabel("ENABLE VIRTUAL KEYBOARD", virtual_keyboard);
s->addSaveFunc([virtual_keyboard, s] {
if (virtual_keyboard->getState() != Settings::getInstance()->getBool("VirtualKeyboard")) {
Settings::getInstance()->setBool("VirtualKeyboard", virtual_keyboard->getState());
s->setNeedsSaving();
s->setInvalidateCachedBackground();
}
});
// Enable the 'Y' button for tagging games as favorites.
auto favorites_add_button = std::make_shared<SwitchComponent>(mWindow);
favorites_add_button->setState(Settings::getInstance()->getBool("FavoritesAddButton"));
@ -809,10 +820,19 @@ void GuiMenu::openOtherOptions()
rowMediaDir.makeAcceptInputHandler([this, titleMediaDir, mediaDirectoryStaticText,
defaultDirectoryText, initValueMediaDir, updateValMediaDir,
multiLineMediaDir] {
mWindow->pushGui(new GuiComplexTextEditPopup(
mWindow, getHelpStyle(), titleMediaDir, mediaDirectoryStaticText, defaultDirectoryText,
Settings::getInstance()->getString("MediaDirectory"), updateValMediaDir,
multiLineMediaDir, "SAVE", "SAVE CHANGES?"));
if (Settings::getInstance()->getBool("VirtualKeyboard")) {
mWindow->pushGui(new GuiTextEditKeyboardPopup(
mWindow, getHelpStyle(), titleMediaDir,
Settings::getInstance()->getString("MediaDirectory"), updateValMediaDir,
multiLineMediaDir, "SAVE", "SAVE CHANGES?", mediaDirectoryStaticText,
defaultDirectoryText, "load default directory"));
} else {
mWindow->pushGui(new GuiTextEditPopup(
mWindow, getHelpStyle(), titleMediaDir,
Settings::getInstance()->getString("MediaDirectory"), updateValMediaDir,
multiLineMediaDir, "SAVE", "SAVE CHANGES?", mediaDirectoryStaticText,
defaultDirectoryText, "load default directory"));
}
});
s->addRow(rowMediaDir);
@ -1021,16 +1041,17 @@ void GuiMenu::openOtherOptions()
}
});
// Allow overriding of the launch command per game (the option to disable this is
// intended primarily for testing purposes).
auto launchcommand_override = std::make_shared<SwitchComponent>(mWindow);
launchcommand_override->setState(Settings::getInstance()->getBool("LaunchCommandOverride"));
s->addWithLabel("PER GAME LAUNCH COMMAND OVERRIDE", launchcommand_override);
s->addSaveFunc([launchcommand_override, s] {
if (launchcommand_override->getState() !=
Settings::getInstance()->getBool("LaunchCommandOverride")) {
Settings::getInstance()->setBool("LaunchCommandOverride",
launchcommand_override->getState());
// Whether to enable alternative emulators per game (the option to disable this is intended
// primarily for testing purposes).
auto alternativeEmulatorPerGame = std::make_shared<SwitchComponent>(mWindow);
alternativeEmulatorPerGame->setState(
Settings::getInstance()->getBool("AlternativeEmulatorPerGame"));
s->addWithLabel("ENABLE ALTERNATIVE EMULATORS PER GAME", alternativeEmulatorPerGame);
s->addSaveFunc([alternativeEmulatorPerGame, s] {
if (alternativeEmulatorPerGame->getState() !=
Settings::getInstance()->getBool("AlternativeEmulatorPerGame")) {
Settings::getInstance()->setBool("AlternativeEmulatorPerGame",
alternativeEmulatorPerGame->getState());
s->setNeedsSaving();
}
});
@ -1307,7 +1328,7 @@ void GuiMenu::close(bool closeAllWindows)
}
else {
Window* window = mWindow;
closeFunc = [window, this] {
closeFunc = [window] {
while (window->peekGui() != ViewController::get())
delete window->peekGui();
};

View file

@ -23,32 +23,26 @@
#include "components/RatingComponent.h"
#include "components/SwitchComponent.h"
#include "components/TextComponent.h"
#include "guis/GuiComplexTextEditPopup.h"
#include "guis/GuiGameScraper.h"
#include "guis/GuiMsgBox.h"
#include "guis/GuiTextEditKeyboardPopup.h"
#include "guis/GuiTextEditPopup.h"
#include "resources/Font.h"
#include "utils/StringUtil.h"
#include "views/ViewController.h"
GuiMetaDataEd::GuiMetaDataEd(Window* window,
MetaDataList* md,
const std::vector<MetaDataDecl>& mdd,
GuiMetaDataEd::GuiMetaDataEd(Window *window,
MetaDataList *md,
const std::vector<MetaDataDecl> &mdd,
ScraperSearchParams scraperParams,
const std::string& /*header*/,
const std::string & /*header*/,
std::function<void()> saveCallback,
std::function<void()> clearGameFunc,
std::function<void()> deleteGameFunc)
: GuiComponent(window)
, mScraperParams(scraperParams)
, mBackground(window, ":/graphics/frame.svg")
, mGrid(window, glm::ivec2{1, 3})
, mMetaDataDecl(mdd)
, mMetaData(md)
, mSavedCallback(saveCallback)
, mClearGameFunc(clearGameFunc)
, mDeleteGameFunc(deleteGameFunc)
, mMediaFilesUpdated(false)
: GuiComponent(window), mBackground(window, ":/graphics/frame.svg"), mGrid(window, glm::ivec2{1, 3}),
mScraperParams(scraperParams), mMetaDataDecl(mdd), mMetaData(md), mSavedCallback(saveCallback),
mClearGameFunc(clearGameFunc), mDeleteGameFunc(deleteGameFunc), mMediaFilesUpdated(false),
mInvalidEmulatorEntry(false)
{
addChild(&mBackground);
addChild(&mGrid);
@ -99,9 +93,9 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window,
if (iter->isStatistic)
continue;
// Don't show the launch command override entry if this option has been disabled.
if (!Settings::getInstance()->getBool("LaunchCommandOverride") &&
iter->type == MD_LAUNCHCOMMAND) {
// Don't show the alternative emulator entry if the corresponding option has been disabled.
if (!Settings::getInstance()->getBool("AlternativeEmulatorPerGame") &&
iter->type == MD_ALT_EMULATOR) {
ed = std::make_shared<TextComponent>(
window, "", Font::get(FONT_SIZE_SMALL, FONT_PATH_LIGHT), 0x777777FF, ALIGN_RIGHT);
assert(ed);
@ -170,7 +164,9 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window,
std::placeholders::_2);
break;
}
case MD_LAUNCHCOMMAND: {
case MD_ALT_EMULATOR: {
mInvalidEmulatorEntry = false;
ed = std::make_shared<TextComponent>(window, "",
Font::get(FONT_SIZE_SMALL, FONT_PATH_LIGHT),
0x777777FF, ALIGN_RIGHT);
@ -185,48 +181,137 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window,
bracket->setResize(glm::vec2{0.0f, lbl->getFont()->getLetterHeight()});
row.addElement(bracket, false);
bool multiLine = false;
const std::string title = iter->displayPrompt;
// OK callback (apply new value to ed).
auto updateVal = [ed, originalValue](const std::string& newVal) {
auto updateVal = [this, ed, originalValue](const std::string& newVal) {
ed->setValue(newVal);
if (newVal == originalValue)
if (newVal == originalValue) {
ed->setColor(DEFAULT_TEXTCOLOR);
else
}
else {
ed->setColor(TEXTCOLOR_USERMARKED);
mInvalidEmulatorEntry = false;
}
};
std::string staticTextString = "Default value from es_systems.xml:";
std::string defaultLaunchCommand;
std::string alternativeEmulator = scraperParams.system->getAlternativeEmulator();
for (auto launchCommand :
scraperParams.system->getSystemEnvData()->mLaunchCommands) {
if (launchCommand.second == alternativeEmulator) {
defaultLaunchCommand = launchCommand.first;
break;
}
}
if (!alternativeEmulator.empty() && defaultLaunchCommand.empty()) {
if (originalValue != "" &&
scraperParams.system->getLaunchCommandFromLabel(originalValue) == "") {
LOG(LogWarning)
<< "The alternative emulator defined for system \""
<< scraperParams.system->getName()
<< "\" is invalid, falling back to the default command \""
<< scraperParams.system->getSystemEnvData()->mLaunchCommands.front().first
<< "\"";
<< "GuiMetaDataEd: Invalid alternative emulator \"" << originalValue
<< "\" configured for game \"" << mScraperParams.game->getName() << "\"";
mInvalidEmulatorEntry = true;
}
if (defaultLaunchCommand.empty())
defaultLaunchCommand =
scraperParams.system->getSystemEnvData()->mLaunchCommands.front().first;
if (scraperParams.system->getSystemEnvData()->mLaunchCommands.size() == 1) {
lbl->setOpacity(DISABLED_OPACITY);
bracket->setOpacity(DISABLED_OPACITY);
}
row.makeAcceptInputHandler([this, title, staticTextString, defaultLaunchCommand, ed,
updateVal, multiLine] {
mWindow->pushGui(new GuiComplexTextEditPopup(
mWindow, getHelpStyle(), title, staticTextString, defaultLaunchCommand,
ed->getValue(), updateVal, multiLine, "APPLY", "APPLY CHANGES?"));
});
if (mInvalidEmulatorEntry ||
scraperParams.system->getSystemEnvData()->mLaunchCommands.size() > 1) {
row.makeAcceptInputHandler([this, title, scraperParams, ed, updateVal,
originalValue] {
GuiSettings *s = nullptr;
bool singleEntry =
scraperParams.system->getSystemEnvData()->mLaunchCommands.size() == 1;
if (mInvalidEmulatorEntry && singleEntry)
s = new GuiSettings(mWindow, "CLEAR INVALID ENTRY");
else
s = new GuiSettings(mWindow, title);
if (!mInvalidEmulatorEntry && ed->getValue() == "" && singleEntry)
return;
std::vector<std::pair<std::string, std::string>> launchCommands =
scraperParams.system->getSystemEnvData()->mLaunchCommands;
if (ed->getValue() != "" && mInvalidEmulatorEntry && singleEntry)
launchCommands.push_back(std::make_pair(
"", ViewController::EXCLAMATION_CHAR + " " + originalValue));
else if (ed->getValue() != "")
launchCommands.push_back(std::make_pair(
"", ViewController::CROSSEDCIRCLE_CHAR + " CLEAR ENTRY"));
for (auto entry: launchCommands) {
std::string selectedLabel = ed->getValue();
std::string label;
ComponentListRow row;
if (entry.second == "")
continue;
else
label = entry.second;
std::shared_ptr<TextComponent> labelText =
std::make_shared<TextComponent>(mWindow, label,
Font::get(FONT_SIZE_MEDIUM),
0x777777FF, ALIGN_CENTER);
if (scraperParams.system->getAlternativeEmulator() == "" &&
scraperParams.system->getSystemEnvData()
->mLaunchCommands.front()
.second == label)
labelText->setValue(labelText->getValue().append(" [SYSTEM-WIDE]"));
if (scraperParams.system->getAlternativeEmulator() == label)
labelText->setValue(labelText->getValue().append(" [SYSTEM-WIDE]"));
row.addElement(labelText, true);
row.makeAcceptInputHandler(
[this, s, updateVal, entry, selectedLabel, launchCommands] {
if (entry.second == launchCommands.back().second &&
launchCommands.back().first == "") {
updateVal("");
}
else if (entry.second != selectedLabel) {
updateVal(entry.second);
}
mInvalidEmulatorEntry = false;
delete s;
});
// This transparent bracket is only added to generate the correct help
// prompts.
auto bracket = std::make_shared<ImageComponent>(mWindow);
bracket->setImage(":/graphics/arrow.svg");
bracket->setOpacity(0);
bracket->setSize(bracket->getSize() / 3.0f);
row.addElement(bracket, false);
// Select the row that corresponds to the selected label.
if (selectedLabel == label)
s->addRow(row, true);
else
s->addRow(row, false);
}
// Adjust the width depending on the aspect ratio of the screen, to make the
// screen look somewhat coherent regardless of screen type. The 1.778 aspect
// ratio value is the 16:9 reference.
float aspectValue = 1.778f / Renderer::getScreenAspectRatio();
float maxWidthModifier = glm::clamp(0.70f * aspectValue, 0.50f, 0.92f);
float maxWidth =
static_cast<float>(Renderer::getScreenWidth()) * maxWidthModifier;
s->setMenuSize(glm::vec2{maxWidth, s->getMenuSize().y});
auto menuSize = s->getMenuSize();
auto menuPos = s->getMenuPosition();
s->setMenuPosition(glm::vec3{(s->getSize().x - menuSize.x) / 2.0f,
(s->getSize().y - menuSize.y) / 3.0f,
menuPos.z});
mWindow->pushGui(s);
});
}
else {
lbl->setOpacity(DISABLED_OPACITY);
bracket->setOpacity(DISABLED_OPACITY);
}
break;
}
case MD_MULTILINE_STRING:
@ -271,8 +356,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window,
ed->setColor(DEFAULT_TEXTCOLOR);
else
ed->setColor(TEXTCOLOR_USERMARKED);
}
else {
} else {
ed->setValue(newVal);
if (newVal == originalValue)
ed->setColor(DEFAULT_TEXTCOLOR);
@ -281,18 +365,31 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window,
}
};
row.makeAcceptInputHandler([this, title, ed, updateVal, multiLine] {
mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), title,
ed->getValue(), updateVal, multiLine,
"APPLY", "APPLY CHANGES?"));
});
if (Settings::getInstance()->getBool("VirtualKeyboard")) {
row.makeAcceptInputHandler([this, title, ed, updateVal, multiLine] {
mWindow->pushGui(new GuiTextEditKeyboardPopup(
mWindow, getHelpStyle(), title, ed->getValue(), updateVal, multiLine,
"apply", "APPLY CHANGES?", "", ""));
});
} else {
row.makeAcceptInputHandler([this, title, ed, updateVal, multiLine] {
mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), title,
ed->getValue(), updateVal, multiLine,
"APPLY", "APPLY CHANGES?"));
});
}
break;
}
}
assert(ed);
mList->addRow(row);
ed->setValue(mMetaData->get(iter->key));
if (iter->type == MD_ALT_EMULATOR && mInvalidEmulatorEntry == true)
ed->setValue(ViewController::EXCLAMATION_CHAR + " " + originalValue);
else
ed->setValue(mMetaData->get(iter->key));
mEditors.push_back(ed);
}
@ -435,6 +532,9 @@ void GuiMetaDataEd::save()
if (mMetaDataDecl.at(i).isStatistic)
continue;
if (mMetaDataDecl.at(i).key == "altemulator" && mInvalidEmulatorEntry == true)
continue;
if (!showHiddenGames && mMetaDataDecl.at(i).key == "hidden" &&
mEditors.at(i)->getValue() != mMetaData->get("hidden"))
hideGameWhileHidden = true;
@ -576,6 +676,9 @@ void GuiMetaDataEd::close()
std::string mMetaDataValue = mMetaData->get(key);
std::string mEditorsValue = mEditors.at(i)->getValue();
if (key == "altemulator" && mInvalidEmulatorEntry == true)
continue;
if (mMetaDataValue != mEditorsValue) {
metadataUpdated = true;
break;

View file

@ -15,6 +15,7 @@
#include "MetaData.h"
#include "components/ComponentGrid.h"
#include "components/NinePatchComponent.h"
#include "guis/GuiSettings.h"
#include "scrapers/Scraper.h"
class ComponentList;
@ -64,6 +65,7 @@ private:
std::function<void()> mDeleteGameFunc;
bool mMediaFilesUpdated;
bool mInvalidEmulatorEntry;
};
#endif // ES_APP_GUIS_GUI_META_DATA_ED_H

View file

@ -13,11 +13,9 @@
#include "components/MenuComponent.h"
#include "views/ViewController.h"
GuiOfflineGenerator::GuiOfflineGenerator(Window* window, const std::queue<FileData*>& gameQueue)
: GuiComponent(window)
, mBackground(window, ":/graphics/frame.svg")
, mGrid(window, glm::ivec2{6, 13})
, mGameQueue(gameQueue)
GuiOfflineGenerator::GuiOfflineGenerator(Window *window, const std::queue<FileData *> &gameQueue)
: GuiComponent(window), mGameQueue(gameQueue), mBackground(window, ":/graphics/frame.svg"),
mGrid(window, glm::ivec2{6, 13})
{
addChild(&mBackground);
addChild(&mGrid);

View file

@ -91,7 +91,8 @@ GuiScraperMenu::GuiScraperMenu(Window* window, std::string title)
}
// The filter setting is only retained during the program session i.e. it's not saved
// to es_settings.xml.
if (mFilters->getSelectedId() != Settings::getInstance()->getInt("ScraperFilter"))
if (mFilters->getSelectedId() !=
static_cast<unsigned int>(Settings::getInstance()->getInt("ScraperFilter")))
Settings::getInstance()->setInt("ScraperFilter", mFilters->getSelectedId());
});

View file

@ -79,13 +79,36 @@ GuiScraperMulti::GuiScraperMulti(Window* window,
if (mApproveResults) {
buttons.push_back(
std::make_shared<ButtonComponent>(mWindow, "REFINE SEARCH", "refine search", [&] {
// Refine the search, unless the result has already been accepted or we're in
// semi-automatic mode and there are less than 2 search results.
if (!mSearchComp->getAcceptedResult() &&
!(mSearchComp->getSearchType() == GuiScraperSearch::ACCEPT_SINGLE_MATCHES &&
mSearchComp->getScraperResultsSize() < 2)) {
mSearchComp->openInputScreen(mSearchQueue.front());
mGrid.resetCursor();
// Check whether we should allow a refine of the game name.
if (!mSearchComp->getAcceptedResult()) {
bool allowRefine = false;
// Previously refined.
if (mSearchComp->getRefinedSearch())
allowRefine = true;
// Interactive mode and "Auto-accept single game matches" not enabled.
else if (mSearchComp->getSearchType() !=
GuiScraperSearch::ACCEPT_SINGLE_MATCHES)
allowRefine = true;
// Interactive mode with "Auto-accept single game matches" enabled and more
// than one result.
else if (mSearchComp->getSearchType() ==
GuiScraperSearch::ACCEPT_SINGLE_MATCHES &&
mSearchComp->getScraperResultsSize() > 1)
allowRefine = true;
// Dito but there were no games found, or the search has not been completed.
else if (mSearchComp->getSearchType() ==
GuiScraperSearch::ACCEPT_SINGLE_MATCHES &&
!mSearchComp->getFoundGame())
allowRefine = true;
if (allowRefine) {
// Copy any search refine that may have been previously entered by opening
// the input screen using the "Y" button shortcut.
mSearchQueue.front().nameOverride = mSearchComp->getNameOverride();
mSearchComp->openInputScreen(mSearchQueue.front());
mGrid.resetCursor();
}
}
}));
@ -212,6 +235,7 @@ void GuiScraperMulti::skip()
mSearchQueue.pop();
mCurrentGame++;
mTotalSkipped++;
mSearchComp->decreaseScrapeCount();
mSearchComp->unsetRefinedSearch();
doNextSearch();
}

View file

@ -29,6 +29,7 @@
#include "components/ScrollableContainer.h"
#include "components/TextComponent.h"
#include "guis/GuiMsgBox.h"
#include "guis/GuiTextEditKeyboardPopup.h"
#include "guis/GuiTextEditPopup.h"
#include "resources/Font.h"
#include "utils/StringUtil.h"
@ -36,15 +37,9 @@
#define FAILED_VERIFICATION_RETRIES 8
GuiScraperSearch::GuiScraperSearch(Window* window, SearchType type, unsigned int scrapeCount)
: GuiComponent(window)
, mGrid(window, glm::ivec2{4, 3})
, mBusyAnim(window)
, mSearchType(type)
, mScrapeCount(scrapeCount)
, mScrapeRatings(false)
, mRefinedSearch(false)
, mFoundGame(false)
GuiScraperSearch::GuiScraperSearch(Window *window, SearchType type, unsigned int scrapeCount)
: GuiComponent(window), mGrid(window, glm::ivec2{4, 3}), mSearchType(type), mScrapeCount(scrapeCount),
mRefinedSearch(false), mFoundGame(false), mScrapeRatings(false), mBusyAnim(window)
{
addChild(&mGrid);
@ -323,6 +318,7 @@ void GuiScraperSearch::search(const ScraperSearchParams& params)
mBlockAccept = true;
mAcceptedResult = false;
mMiximageResult = false;
mFoundGame = false;
mScrapeResult = {};
mResultList->clear();
@ -470,15 +466,15 @@ void GuiScraperSearch::updateInfoPane()
if (mSearchType == ALWAYS_ACCEPT_FIRST_RESULT && mScraperResults.size())
i = 0;
if (i != -1 && static_cast<int>(mScraperResults.size() > i)) {
ScraperSearchResult& res = mScraperResults.at(i);
if (i != -1 && static_cast<int>(mScraperResults.size()) > i) {
ScraperSearchResult &res = mScraperResults.at(i);
mResultName->setText(Utils::String::toUpper(res.mdl.get("name")));
mResultDesc->setText(Utils::String::toUpper(res.mdl.get("desc")));
mDescContainer->reset();
mResultThumbnail->setImage("");
const std::string& thumb = res.screenshotUrl.empty() ? res.coverUrl : res.screenshotUrl;
const std::string &thumb = res.screenshotUrl.empty() ? res.coverUrl : res.screenshotUrl;
mScraperResults[i].thumbnailImageUrl = thumb;
// Cache the thumbnail image in mScraperResults so that we don't need to download
@ -540,21 +536,34 @@ void GuiScraperSearch::updateInfoPane()
bool GuiScraperSearch::input(InputConfig* config, Input input)
{
if (config->isMappedTo("a", input) && input.value != 0) {
if (mBlockAccept)
if (mBlockAccept || mScraperResults.empty())
return true;
}
// Refine the search, unless the result has already been accepted or we're in semi-automatic
// mode and there are less than 2 search results.
// Check whether we should allow a refine of the game name.
if (!mAcceptedResult && config->isMappedTo("y", input) && input.value != 0) {
if (mSearchType != ACCEPT_SINGLE_MATCHES ||
(mSearchType == ACCEPT_SINGLE_MATCHES && mScraperResults.size() > 1)) {
bool allowRefine = false;
// Previously refined.
if (mRefinedSearch)
allowRefine = true;
// Interactive mode and "Auto-accept single game matches" not enabled.
else if (mSearchType != ACCEPT_SINGLE_MATCHES)
allowRefine = true;
// Interactive mode with "Auto-accept single game matches" enabled and more than one result.
else if (mSearchType == ACCEPT_SINGLE_MATCHES && mScraperResults.size() > 1)
allowRefine = true;
// Dito but there were no games found, or the search has not been completed.
else if (mSearchType == ACCEPT_SINGLE_MATCHES && !mFoundGame)
allowRefine = true;
if (allowRefine)
openInputScreen(mLastSearch);
}
}
// Skip game, unless the result has already been accepted.
if (!mAcceptedResult && mScrapeCount > 1 && config->isMappedTo("x", input) && input.value != 0)
// If multi-scraping, skip game unless the result has already been accepted.
if (mSkipCallback != nullptr && !mAcceptedResult && // Line break.
config->isMappedTo("x", input) && input.value)
mSkipCallback();
return GuiComponent::input(config, input);
@ -575,6 +584,7 @@ void GuiScraperSearch::render(const glm::mat4& parentTrans)
void GuiScraperSearch::returnResult(ScraperSearchResult result)
{
mBlockAccept = true;
mAcceptedResult = true;
@ -774,9 +784,17 @@ void GuiScraperSearch::updateThumbnail()
}
}
void GuiScraperSearch::openInputScreen(ScraperSearchParams& params)
{
auto searchForFunc = [&](const std::string& name) {
void GuiScraperSearch::openInputScreen(ScraperSearchParams &params) {
auto searchForFunc = [&](std::string name) {
// Trim leading and trailing whitespaces.
name.erase(name.begin(), std::find_if(name.begin(), name.end(), [](char c) {
return !std::isspace(static_cast<unsigned char>(c));
}));
name.erase(std::find_if(name.rbegin(), name.rend(),
[](char c) { return !std::isspace(static_cast<unsigned char>(c)); })
.base(),
name.end());
stop();
mRefinedSearch = true;
params.nameOverride = name;
@ -792,8 +810,7 @@ void GuiScraperSearch::openInputScreen(ScraperSearchParams& params)
// regardless of whether the entry is an arcade game and TheGamesDB is used.
if (Settings::getInstance()->getBool("ScraperSearchMetadataName")) {
searchString = Utils::String::removeParenthesis(params.game->metadata.get("name"));
}
else {
} else {
// If searching based on the actual file name, then expand to the full game name
// in case the scraper is set to TheGamesDB and it's an arcade game. This is
// required as TheGamesDB does not support searches using the short MAME names.
@ -803,13 +820,19 @@ void GuiScraperSearch::openInputScreen(ScraperSearchParams& params)
else
searchString = params.game->getCleanName();
}
}
else {
} else {
searchString = params.nameOverride;
}
mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), "REFINE SEARCH", searchString,
searchForFunc, false, "SEARCH", "APPLY CHANGES?"));
if (Settings::getInstance()->getBool("VirtualKeyboard")) {
mWindow->pushGui(new GuiTextEditKeyboardPopup(mWindow, getHelpStyle(), "REFINE SEARCH",
searchString, searchForFunc, false, "SEARCH",
"SEARCH USING REFINED NAME?"));
} else {
mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), "REFINE SEARCH",
searchString, searchForFunc, false, "SEARCH",
"SEARCH USING REFINED NAME?"));
}
}
bool GuiScraperSearch::saveMetadata(const ScraperSearchResult& result,
@ -895,13 +918,15 @@ bool GuiScraperSearch::saveMetadata(const ScraperSearchResult& result,
return metadataUpdated;
}
std::vector<HelpPrompt> GuiScraperSearch::getHelpPrompts()
{
std::vector<HelpPrompt> GuiScraperSearch::getHelpPrompts() {
std::vector<HelpPrompt> prompts;
prompts.push_back(HelpPrompt("y", "refine search"));
if (mScrapeCount > 1)
// Only show the skip prompt during multi-scraping.
if (mSkipCallback != nullptr)
prompts.push_back(HelpPrompt("x", "skip"));
if (mFoundGame && (mRefinedSearch || mSearchType != ACCEPT_SINGLE_MATCHES ||
(mSearchType == ACCEPT_SINGLE_MATCHES && mScraperResults.size() > 1)))
prompts.push_back(HelpPrompt("a", "accept result"));

View file

@ -63,31 +63,51 @@ public:
{
mAcceptCallback = acceptCallback;
}
void setSkipCallback(const std::function<void()>& skipCallback)
{
void setSkipCallback(const std::function<void()> &skipCallback) {
mSkipCallback = skipCallback;
}
void setCancelCallback(const std::function<void()>& cancelCallback)
{
mScrapeCount -= 1;
void setCancelCallback(const std::function<void()> &cancelCallback) {
mCancelCallback = cancelCallback;
}
bool input(InputConfig* config, Input input) override;
bool input(InputConfig *config, Input input) override;
void update(int deltaTime) override;
void render(const glm::mat4& parentTrans) override;
void render(const glm::mat4 &parentTrans) override;
std::vector<HelpPrompt> getHelpPrompts() override;
HelpStyle getHelpStyle() override;
void onSizeChanged() override;
void decreaseScrapeCount() {
if (mScrapeCount > 0)
mScrapeCount--;
}
void unsetRefinedSearch() { mRefinedSearch = false; }
bool getRefinedSearch() { return mRefinedSearch; }
bool getFoundGame() { return mFoundGame; }
const std::string &getNameOverride() { return mLastSearch.nameOverride; }
void onFocusGained() override { mGrid.onFocusGained(); }
void onFocusLost() override { mGrid.onFocusLost(); }
private:
void updateViewStyle();
void updateThumbnail();
void updateInfoPane();
void resizeMetadata();
void onSearchError(const std::string& error,

View file

@ -16,25 +16,16 @@
#include "SystemData.h"
#include "Window.h"
#include "components/HelpComponent.h"
#include "guis/GuiTextEditKeyboardPopup.h"
#include "guis/GuiTextEditPopup.h"
#include "views/ViewController.h"
#include "views/gamelist/IGameListView.h"
GuiSettings::GuiSettings(Window* window, std::string title)
: GuiComponent(window)
, mMenu(window, title)
, mNeedsSaving(false)
, mNeedsReloadHelpPrompts(false)
, mNeedsCollectionsUpdate(false)
, mNeedsSorting(false)
, mNeedsSortingCollections(false)
, mNeedsResetFilters(false)
, mNeedsReloading(false)
, mNeedsGoToStart(false)
, mNeedsGoToSystem(false)
, mNeedsGoToGroupedCollections(false)
, mInvalidateCachedBackground(false)
, mGoToSystem(nullptr)
GuiSettings::GuiSettings(Window *window, std::string title)
: GuiComponent(window), mMenu(window, title), mGoToSystem(nullptr), mNeedsSaving(false),
mNeedsReloadHelpPrompts(false), mNeedsCollectionsUpdate(false), mNeedsSorting(false),
mNeedsSortingCollections(false), mNeedsResetFilters(false), mNeedsReloading(false), mNeedsGoToStart(false),
mNeedsGoToSystem(false), mNeedsGoToGroupedCollections(false), mInvalidateCachedBackground(false)
{
addChild(&mMenu);
mMenu.addButton("BACK", "back", [this] { delete this; });
@ -96,7 +87,7 @@ void GuiSettings::save()
ViewController::get()->reloadAll();
if (mNeedsGoToStart)
ViewController::get()->goToStart();
ViewController::get()->goToStart(true);
if (mNeedsGoToSystem)
ViewController::get()->goToSystem(mGoToSystem, false);
@ -123,7 +114,7 @@ void GuiSettings::save()
// the safe side.
if (state.getSystem()->isCollection() &&
state.getSystem()->getThemeFolder() != "custom-collections") {
ViewController::get()->goToStart();
ViewController::get()->goToStart(false);
ViewController::get()->goToSystem(SystemData::sSystemVector.front(), false);
// We don't want to invalidate the cached background when there has been a collection
// systen change as that may show a black screen in some circumstances.
@ -133,7 +124,7 @@ void GuiSettings::save()
// system view).
if (std::find(SystemData::sSystemVector.begin(), SystemData::sSystemVector.end(),
state.getSystem()) == SystemData::sSystemVector.end()) {
ViewController::get()->goToStart();
ViewController::get()->goToStart(false);
return;
}
}
@ -183,25 +174,37 @@ void GuiSettings::addEditableTextComponent(const std::string label,
else if (isPassword && newVal == "") {
ed->setValue("");
ed->setHiddenValue("");
}
else if (isPassword) {
} else if (isPassword) {
ed->setValue("********");
ed->setHiddenValue(newVal);
}
else {
} else {
ed->setValue(newVal);
}
};
row.makeAcceptInputHandler([this, label, ed, updateVal, isPassword] {
// Never display the value if it's a password, instead set it to blank.
if (isPassword)
mWindow->pushGui(
new GuiTextEditPopup(mWindow, getHelpStyle(), label, "", updateVal, false));
else
mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), label, ed->getValue(),
updateVal, false));
});
if (Settings::getInstance()->getBool("VirtualKeyboard")) {
row.makeAcceptInputHandler([this, label, ed, updateVal, isPassword] {
// Never display the value if it's a password, instead set it to blank.
if (isPassword)
mWindow->pushGui(new GuiTextEditKeyboardPopup(
mWindow, getHelpStyle(), label, "", updateVal, false, "SAVE", "SAVE CHANGES?"));
else
mWindow->pushGui(new GuiTextEditKeyboardPopup(mWindow, getHelpStyle(), label,
ed->getValue(), updateVal, false,
"SAVE", "SAVE CHANGES?"));
});
} else {
row.makeAcceptInputHandler([this, label, ed, updateVal, isPassword] {
if (isPassword)
mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), label, "", updateVal,
false, "SAVE", "SAVE CHANGES?"));
else
mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), label,
ed->getValue(), updateVal, false, "SAVE",
"SAVE CHANGES?"));
});
}
assert(ed);
addRow(row);

View file

@ -29,7 +29,6 @@
#include "Sound.h"
#include "SystemData.h"
#include "SystemScreensaver.h"
#include "guis/GuiComplexTextEditPopup.h"
#include "guis/GuiDetectDevice.h"
#include "guis/GuiLaunchScreen.h"
#include "guis/GuiMsgBox.h"
@ -133,7 +132,7 @@ bool parseArgs(int argc, char* argv[])
#if defined(_WIN64)
// Print any command line output to the console.
if (argc > 1)
win64ConsoleType consoleType = outputToConsole(false);
outputToConsole(false);
#endif
std::string portableFilePath = Utils::FileSystem::getExePath() + "/portable.txt";
@ -617,7 +616,7 @@ int main(int argc, char* argv[])
// which means that a label is present in the gamelist.xml file which is not matching
// any command tag in es_systems.xml.
for (auto system : SystemData::sSystemVector) {
if (system->getAlternativeEmulator() == "<INVALID>") {
if (system->getAlternativeEmulator().substr(0, 9) == "<INVALID>") {
ViewController::get()->invalidAlternativeEmulatorDialog();
break;
}
@ -637,10 +636,10 @@ int main(int argc, char* argv[])
if (!loadSystemsStatus) {
if (forceInputConfig) {
window.pushGui(new GuiDetectDevice(&window, false, true,
[] { ViewController::get()->goToStart(); }));
[] { ViewController::get()->goToStart(true); }));
}
else {
ViewController::get()->goToStart();
ViewController::get()->goToStart(true);
}
}

View file

@ -147,8 +147,7 @@ void thegamesdb_generate_json_scraper_requests(
// using this regardless of whether the entry is an arcade game.
if (Settings::getInstance()->getBool("ScraperSearchMetadataName")) {
cleanName = Utils::String::removeParenthesis(params.game->metadata.get("name"));
}
else {
} else {
// If not searching based on the metadata name, then check whether it's an
// arcade game and if so expand to the full game name. This is required as
// TheGamesDB has issues with searching using the short MAME names.
@ -158,6 +157,18 @@ void thegamesdb_generate_json_scraper_requests(
cleanName = params.game->getCleanName();
}
}
// Trim leading and trailing whitespaces.
cleanName.erase(cleanName.begin(),
std::find_if(cleanName.begin(), cleanName.end(), [](char c) {
return !std::isspace(static_cast<unsigned char>(c));
}));
cleanName.erase(
std::find_if(cleanName.rbegin(), cleanName.rend(),
[](char c) { return !std::isspace(static_cast<unsigned char>(c)); })
.base(),
cleanName.end());
path += "/Games/ByGameName?" + apiKey +
"&fields=players,publishers,genres,overview,last_updated,rating,"
"platform,coop,youtube,os,processor,ram,hdd,video,sound,alternates&name=" +
@ -443,9 +454,9 @@ void TheGamesDBJSONRequest::process(const std::unique_ptr<HttpReq>& req,
// Find how many more requests we can make before the scraper
// request allowance counter is reset.
if (doc.HasMember("remaining_monthly_allowance") && doc.HasMember("extra_allowance")) {
for (auto i = 0; i < results.size(); i++) {
for (size_t i = 0; i < results.size(); i++) {
results[i].scraperRequestAllowance =
doc["remaining_monthly_allowance"].GetInt() + doc["extra_allowance"].GetInt();
doc["remaining_monthly_allowance"].GetInt() + doc["extra_allowance"].GetInt();
}
LOG(LogDebug) << "TheGamesDBJSONRequest::process(): "
"Remaining monthly scraping allowance: "

View file

@ -327,7 +327,7 @@ MDResolveHandle::MDResolveHandle(const ScraperSearchResult& result,
mFuncs.push_back(ResolvePair(downloadMediaAsync(it->fileURL, filePath,
it->existingMediaFile, it->subDirectory,
it->resizeFile, mResult.savedNewMedia),
[this, filePath] {}));
[filePath] {}));
}
}
}
@ -373,11 +373,11 @@ MediaDownloadHandle::MediaDownloadHandle(const std::string& url,
const std::string& mediaType,
const bool resizeFile,
bool& savedNewMedia)
: mSavePath(path)
: mReq(new HttpReq(url))
, mSavePath(path)
, mExistingMediaFile(existingMediaPath)
, mMediaType(mediaType)
, mResizeFile(resizeFile)
, mReq(new HttpReq(url))
{
mSavedNewMediaPtr = &savedNewMedia;
}

View file

@ -28,10 +28,10 @@ const int logoBuffersRight[] = {1, 2, 5};
SystemView::SystemView(Window* window)
: IList<SystemViewData, SystemData*>(window, LIST_SCROLL_STYLE_SLOW, LIST_ALWAYS_LOOP)
, mSystemInfo(window, "SYSTEM INFO", Font::get(FONT_SIZE_SMALL), 0x33333300, ALIGN_CENTER)
, mPreviousScrollVelocity(0)
, mUpdatedGameCount(false)
, mViewNeedsReload(true)
, mSystemInfo(window, "SYSTEM INFO", Font::get(FONT_SIZE_SMALL), 0x33333300, ALIGN_CENTER)
{
mCamOffset = 0;
mExtrasCamOffset = 0;
@ -181,9 +181,6 @@ void SystemView::goToSystem(SystemData* system, bool animate)
bool SystemView::input(InputConfig* config, Input input)
{
auto it = SystemData::sSystemVector.cbegin();
const std::shared_ptr<ThemeData>& theme = (*it)->getTheme();
if (input.value != 0) {
if (config->getDeviceId() == DEVICE_KEYBOARD && input.value && input.id == SDLK_r &&
SDL_GetModState() & KMOD_LCTRL && Settings::getInstance()->getBool("Debug")) {

View file

@ -26,6 +26,8 @@
#include "animations/MoveCameraAnimation.h"
#include "guis/GuiInfoPopup.h"
#include "guis/GuiMenu.h"
#include "guis/GuiTextEditKeyboardPopup.h"
#include "guis/GuiTextEditPopup.h"
#include "views/SystemView.h"
#include "views/UIModeController.h"
#include "views/gamelist/DetailedGameListView.h"
@ -36,19 +38,25 @@
ViewController* ViewController::sInstance = nullptr;
#if defined(_MSC_VER) // MSVC compiler.
const std::string ViewController::FAVORITE_CHAR = Utils::String::wideStringToString(L"\uF005");
const std::string ViewController::FOLDER_CHAR = Utils::String::wideStringToString(L"\uF07C");
const std::string ViewController::TICKMARK_CHAR = Utils::String::wideStringToString(L"\uF14A");
const std::string ViewController::CONTROLLER_CHAR = Utils::String::wideStringToString(L"\uF11b");
const std::string ViewController::FILTER_CHAR = Utils::String::wideStringToString(L"\uF0b0");
const std::string ViewController::GEAR_CHAR = Utils::String::wideStringToString(L"\uF013");
const std::string ViewController::CONTROLLER_CHAR = Utils::String::wideStringToString(L"\uf11b");
const std::string ViewController::CROSSEDCIRCLE_CHAR = Utils::String::wideStringToString(L"\uf05e");
const std::string ViewController::EXCLAMATION_CHAR = Utils::String::wideStringToString(L"\uf06a");
const std::string ViewController::FAVORITE_CHAR = Utils::String::wideStringToString(L"\uf005");
const std::string ViewController::FILTER_CHAR = Utils::String::wideStringToString(L"\uf0b0");
const std::string ViewController::FOLDER_CHAR = Utils::String::wideStringToString(L"\uf07C");
const std::string ViewController::GEAR_CHAR = Utils::String::wideStringToString(L"\uf013");
const std::string ViewController::KEYBOARD_CHAR = Utils::String::wideStringToString(L"\uf11c");
const std::string ViewController::TICKMARK_CHAR = Utils::String::wideStringToString(L"\uf14A");
#else
const std::string ViewController::FAVORITE_CHAR = "\uF005";
const std::string ViewController::FOLDER_CHAR = "\uF07C";
const std::string ViewController::TICKMARK_CHAR = "\uF14A";
const std::string ViewController::CONTROLLER_CHAR = "\uF11b";
const std::string ViewController::FILTER_CHAR = "\uF0b0";
const std::string ViewController::GEAR_CHAR = "\uF013";
const std::string ViewController::CONTROLLER_CHAR = "\uf11b";
const std::string ViewController::CROSSEDCIRCLE_CHAR = "\uf05e";
const std::string ViewController::EXCLAMATION_CHAR = "\uf06a";
const std::string ViewController::FAVORITE_CHAR = "\uf005";
const std::string ViewController::FILTER_CHAR = "\uf0b0";
const std::string ViewController::FOLDER_CHAR = "\uf07C";
const std::string ViewController::GEAR_CHAR = "\uf013";
const std::string ViewController::KEYBOARD_CHAR = "\uf11c";
const std::string ViewController::TICKMARK_CHAR = "\uf14a";
#endif
ViewController* ViewController::get()
@ -65,9 +73,11 @@ void ViewController::init(Window* window)
ViewController::ViewController(Window* window)
: GuiComponent(window)
, mNoGamesMessageBox(nullptr)
, mCurrentView(nullptr)
, mPreviousView(nullptr)
, mSkipView(nullptr)
, mGameToLaunch(nullptr)
, mCamera(Renderer::getIdentity())
, mSystemViewTransition(false)
, mWrappedViews(false)
@ -75,8 +85,6 @@ ViewController::ViewController(Window* window)
, mCancelledTransition(false)
, mLockInput(false)
, mNextSystem(false)
, mGameToLaunch(nullptr)
, mNoGamesMessageBox(nullptr)
{
mState.viewing = NOTHING;
mState.viewstyle = AUTOMATIC;
@ -133,26 +141,52 @@ void ViewController::noGamesDialog()
#else
currentROMDirectory = FileData::getROMDirectory();
#endif
mWindow->pushGui(new GuiComplexTextEditPopup(
mWindow, HelpStyle(), "ENTER ROM DIRECTORY PATH",
"Currently configured path:", currentROMDirectory, currentROMDirectory,
[this](const std::string& newROMDirectory) {
Settings::getInstance()->setString("ROMDirectory", newROMDirectory);
Settings::getInstance()->saveFile();
if (Settings::getInstance()->getBool("VirtualKeyboard")) {
mWindow->pushGui(new GuiTextEditKeyboardPopup(
mWindow, HelpStyle(), "ENTER ROM DIRECTORY PATH", currentROMDirectory,
[this](const std::string& newROMDirectory) {
Settings::getInstance()->setString("ROMDirectory", newROMDirectory);
Settings::getInstance()->saveFile();
#if defined(_WIN64)
mRomDirectory = Utils::String::replace(FileData::getROMDirectory(), "/", "\\");
mRomDirectory =
Utils::String::replace(FileData::getROMDirectory(), "/", "\\");
#else
mRomDirectory = FileData::getROMDirectory();
mRomDirectory = FileData::getROMDirectory();
#endif
mNoGamesMessageBox->changeText(mNoGamesErrorMessage + mRomDirectory);
mWindow->pushGui(new GuiMsgBox(mWindow, HelpStyle(),
"ROM DIRECTORY SETTING SAVED, RESTART\n"
"THE APPLICATION TO RESCAN THE SYSTEMS",
"OK", nullptr, "", nullptr, "", nullptr, true));
},
false, "SAVE", "SAVE CHANGES?", "LOAD CURRENT", "LOAD CURRENTLY CONFIGURED VALUE",
"CLEAR", "CLEAR (LEAVE BLANK TO RESET TO DEFAULT DIRECTORY)", false));
mNoGamesMessageBox->changeText(mNoGamesErrorMessage + mRomDirectory);
mWindow->pushGui(new GuiMsgBox(mWindow, HelpStyle(),
"ROM DIRECTORY SETTING SAVED, RESTART\n"
"THE APPLICATION TO RESCAN THE SYSTEMS",
"OK", nullptr, "", nullptr, "", nullptr,
true));
},
false, "SAVE", "SAVE CHANGES?", "Currently configured path:",
currentROMDirectory, "LOAD CURRENTLY CONFIGURED PATH",
"CLEAR (LEAVE BLANK TO RESET TO DEFAULT PATH)"));
}
else {
mWindow->pushGui(new GuiTextEditPopup(
mWindow, HelpStyle(), "ENTER ROM DIRECTORY PATH", currentROMDirectory,
[this](const std::string& newROMDirectory) {
Settings::getInstance()->setString("ROMDirectory", newROMDirectory);
Settings::getInstance()->saveFile();
#if defined(_WIN64)
mRomDirectory =
Utils::String::replace(FileData::getROMDirectory(), "/", "\\");
#else
mRomDirectory = FileData::getROMDirectory();
#endif
mNoGamesMessageBox->changeText(mNoGamesErrorMessage + mRomDirectory);
mWindow->pushGui(new GuiMsgBox(mWindow, HelpStyle(),
"ROM DIRECTORY SETTING SAVED, RESTART\n"
"THE APPLICATION TO RESCAN THE SYSTEMS",
"OK", nullptr, "", nullptr, "", nullptr,
true));
},
false, "SAVE", "SAVE CHANGES?", "Currently configured path:",
currentROMDirectory, "LOAD CURRENTLY CONFIGURED PATH",
"CLEAR (LEAVE BLANK TO RESET TO DEFAULT PATH)"));
}
},
"CREATE DIRECTORIES",
[this] {
@ -203,10 +237,10 @@ void ViewController::invalidAlternativeEmulatorDialog()
"WITH NO MATCHING ENTRY IN THE SYSTEMS\n"
"CONFIGURATION FILE, PLEASE REVIEW YOUR\n"
"SETUP USING THE 'ALTERNATIVE EMULATORS'\n"
"ENTRY UNDER THE 'OTHER SETTINGS' MENU"));
"INTERFACE IN THE 'OTHER SETTINGS' MENU"));
}
void ViewController::goToStart()
void ViewController::goToStart(bool playTransition)
{
// If the system view does not exist, then create it. We do this here as it would
// otherwise not be done if jumping directly into a specific game system on startup.
@ -220,6 +254,8 @@ void ViewController::goToStart()
it != SystemData::sSystemVector.cend(); it++) {
if ((*it)->getName() == requestedSystem) {
goToGameList(*it);
if (!playTransition)
cancelViewTransitions();
return;
}
}
@ -594,7 +630,7 @@ void ViewController::playViewTransition(bool instant)
fadeCallback, true);
});
// Fast-forward animation if we're partway faded.
// Fast-forward animation if we're partially faded.
if (target == static_cast<glm::vec3>(-mCamera[3])) {
// Not changing screens, so cancel the first half entirely.
advanceAnimation(0, FADE_DURATION);

View file

@ -15,7 +15,6 @@
#include "FileData.h"
#include "GuiComponent.h"
#include "guis/GuiComplexTextEditPopup.h"
#include "guis/GuiMsgBox.h"
#include "renderers/Renderer.h"
@ -61,7 +60,7 @@ public:
void goToGameList(SystemData* system);
void goToSystemView(SystemData* system, bool playTransition);
void goToSystem(SystemData* system, bool animate);
void goToStart();
void goToStart(bool playTransition);
void ReloadAndGoToStart();
// Functions to make the GUI behave properly.
@ -123,12 +122,16 @@ public:
// Whether to run in the background while a game is launched.
bool runInBackground(SystemData* system);
static const std::string FAVORITE_CHAR;
static const std::string FOLDER_CHAR;
static const std::string TICKMARK_CHAR;
// Font Awesome symbols.
static const std::string CONTROLLER_CHAR;
static const std::string CROSSEDCIRCLE_CHAR;
static const std::string EXCLAMATION_CHAR;
static const std::string FAVORITE_CHAR;
static const std::string FILTER_CHAR;
static const std::string FOLDER_CHAR;
static const std::string GEAR_CHAR;
static const std::string KEYBOARD_CHAR;
static const std::string TICKMARK_CHAR;
private:
ViewController(Window* window);

View file

@ -17,31 +17,12 @@
#define FADE_IN_TIME 650
DetailedGameListView::DetailedGameListView(Window* window, FileData* root)
: BasicGameListView(window, root)
, mDescContainer(window)
, mDescription(window)
, mGamelistInfo(window)
, mThumbnail(window)
, mMarquee(window)
, mImage(window)
, mLblRating(window)
, mLblReleaseDate(window)
, mLblDeveloper(window)
, mLblPublisher(window)
, mLblGenre(window)
, mLblPlayers(window)
, mLblLastPlayed(window)
, mLblPlayCount(window)
, mRating(window)
, mReleaseDate(window)
, mDeveloper(window)
, mPublisher(window)
, mGenre(window)
, mPlayers(window)
, mLastPlayed(window)
, mPlayCount(window)
, mName(window)
, mLastUpdated(nullptr)
: BasicGameListView(window, root), mThumbnail(window), mMarquee(window), mImage(window), mLblRating(window),
mLblReleaseDate(window), mLblDeveloper(window), mLblPublisher(window), mLblGenre(window), mLblPlayers(window),
mLblLastPlayed(window), mLblPlayCount(window), mBadges(window), mRating(window), mReleaseDate(window),
mDeveloper(window),
mPublisher(window), mGenre(window), mPlayers(window), mLastPlayed(window), mPlayCount(window), mName(window),
mDescContainer(window), mDescription(window), mGamelistInfo(window), mLastUpdated(nullptr)
{
const float padding = 0.01f;
@ -93,6 +74,7 @@ DetailedGameListView::DetailedGameListView(Window* window, FileData* root)
mLblPlayers.setText("Players: ");
addChild(&mLblPlayers);
addChild(&mPlayers);
addChild(&mBadges);
mLblLastPlayed.setText("Last played: ");
addChild(&mLblLastPlayed);
mLastPlayed.setDisplayRelative(true);
@ -129,8 +111,7 @@ DetailedGameListView::DetailedGameListView(Window* window, FileData* root)
initMDValues();
}
void DetailedGameListView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
{
void DetailedGameListView::onThemeChanged(const std::shared_ptr<ThemeData>& theme) {
BasicGameListView::onThemeChanged(theme);
using namespace ThemeFlags;
@ -140,24 +121,26 @@ void DetailedGameListView::onThemeChanged(const std::shared_ptr<ThemeData>& them
POSITION | ThemeFlags::SIZE | Z_INDEX | ROTATION | VISIBLE);
mImage.applyTheme(theme, getName(), "md_image",
POSITION | ThemeFlags::SIZE | Z_INDEX | ROTATION | VISIBLE);
mBadges.applyTheme(theme, getName(), "md_badges",
POSITION | ThemeFlags::SIZE | Z_INDEX | DIRECTION | VISIBLE);
mName.applyTheme(theme, getName(), "md_name", ALL);
initMDLabels();
std::vector<TextComponent*> labels = getMDLabels();
std::vector<TextComponent *> labels = getMDLabels();
assert(labels.size() == 8);
std::vector<std::string> lblElements = {
"md_lbl_rating", "md_lbl_releasedate", "md_lbl_developer", "md_lbl_publisher",
"md_lbl_genre", "md_lbl_players", "md_lbl_lastplayed", "md_lbl_playcount"};
"md_lbl_rating", "md_lbl_releasedate", "md_lbl_developer", "md_lbl_publisher",
"md_lbl_genre", "md_lbl_players", "md_lbl_lastplayed", "md_lbl_playcount"};
for (unsigned int i = 0; i < labels.size(); i++)
labels[i]->applyTheme(theme, getName(), lblElements[i], ALL);
initMDValues();
std::vector<GuiComponent*> values = getMDValues();
assert(values.size() == 8);
std::vector<std::string> valElements = {"md_rating", "md_releasedate", "md_developer",
"md_publisher", "md_genre", "md_players",
"md_lastplayed", "md_playcount"};
std::vector<GuiComponent *> values = getMDValues();
assert(values.size() == 9);
std::vector<std::string> valElements = {"md_rating", "md_releasedate", "md_developer",
"md_publisher", "md_genre", "md_players",
"md_badges", "md_lastplayed", "md_playcount"};
for (unsigned int i = 0; i < values.size(); i++)
values[i]->applyTheme(theme, getName(), valElements[i], ALL ^ ThemeFlags::TEXT);
@ -224,6 +207,8 @@ void DetailedGameListView::initMDValues()
mLastPlayed.setFont(defaultFont);
mPlayCount.setFont(defaultFont);
mBadges.setSize(defaultFont->getHeight() * 5.0f, static_cast<float>(defaultFont->getHeight()));
float bottom = 0.0f;
const float colSize = (mSize.x * 0.48f) / 2.0f;
@ -293,6 +278,7 @@ void DetailedGameListView::updateInfoPanel()
mGenre.setVisible(false);
mLblPlayers.setVisible(false);
mPlayers.setVisible(false);
mBadges.setVisible(false);
mLblLastPlayed.setVisible(false);
mLastPlayed.setVisible(false);
mLblPlayCount.setVisible(false);
@ -311,6 +297,7 @@ void DetailedGameListView::updateInfoPanel()
mGenre.setVisible(true);
mLblPlayers.setVisible(true);
mPlayers.setVisible(true);
mBadges.setVisible(true);
mLblLastPlayed.setVisible(true);
mLastPlayed.setVisible(true);
mLblPlayCount.setVisible(true);
@ -397,6 +384,18 @@ void DetailedGameListView::updateInfoPanel()
mPublisher.setValue(file->metadata.get("publisher"));
mGenre.setValue(file->metadata.get("genre"));
mPlayers.setValue(file->metadata.get("players"));
// Generate badges slots value based on the game metadata.
std::stringstream ss;
ss << (file->metadata.get("favorite").compare("true") ? "" : "favorite ");
ss << (file->metadata.get("completed").compare("true") ? "" : "completed ");
ss << (file->metadata.get("kidgame").compare("true") ? "" : "kidgame ");
ss << (file->metadata.get("broken").compare("true") ? "" : "broken ");
std::string slots = ss.str();
if (!slots.empty())
slots.pop_back();
mBadges.setValue(slots);
mName.setValue(file->metadata.get("name"));
if (file->getType() == GAME) {
@ -404,8 +403,7 @@ void DetailedGameListView::updateInfoPanel()
mLastPlayed.setValue(file->metadata.get("lastplayed"));
mPlayCount.setValue(file->metadata.get("playcount"));
}
}
else if (file->getType() == FOLDER) {
} else if (file->getType() == FOLDER) {
if (!hideMetaDataFields) {
mLastPlayed.setValue(file->metadata.get("lastplayed"));
mLblPlayCount.setVisible(false);
@ -467,6 +465,7 @@ std::vector<GuiComponent*> DetailedGameListView::getMDValues()
ret.push_back(&mPublisher);
ret.push_back(&mGenre);
ret.push_back(&mPlayers);
ret.push_back(&mBadges);
ret.push_back(&mLastPlayed);
ret.push_back(&mPlayCount);
return ret;

View file

@ -9,6 +9,7 @@
#ifndef ES_APP_VIEWS_GAME_LIST_DETAILED_GAME_LIST_VIEW_H
#define ES_APP_VIEWS_GAME_LIST_DETAILED_GAME_LIST_VIEW_H
#include "components/BadgesComponent.h"
#include "components/DateTimeComponent.h"
#include "components/RatingComponent.h"
#include "components/ScrollableContainer.h"
@ -46,6 +47,7 @@ private:
TextComponent mLblLastPlayed;
TextComponent mLblPlayCount;
BadgesComponent mBadges;
RatingComponent mRating;
DateTimeComponent mReleaseDate;
TextComponent mDeveloper;

View file

@ -20,30 +20,12 @@
#define FADE_IN_TIME 650
GridGameListView::GridGameListView(Window* window, FileData* root)
: ISimpleGameListView(window, root)
, mGrid(window)
, mMarquee(window)
, mImage(window)
, mDescContainer(window)
, mDescription(window)
, mGamelistInfo(window)
, mLblRating(window)
, mLblReleaseDate(window)
, mLblDeveloper(window)
, mLblPublisher(window)
, mLblGenre(window)
, mLblPlayers(window)
, mLblLastPlayed(window)
, mLblPlayCount(window)
, mRating(window)
, mReleaseDate(window)
, mDeveloper(window)
, mPublisher(window)
, mGenre(window)
, mPlayers(window)
, mLastPlayed(window)
, mPlayCount(window)
, mName(window)
: ISimpleGameListView(window, root), mGrid(window), mMarquee(window), mImage(window), mLblRating(window),
mLblReleaseDate(window), mLblDeveloper(window), mLblPublisher(window), mLblGenre(window), mLblPlayers(window),
mLblLastPlayed(window), mLblPlayCount(window), mBadges(window), mRating(window), mReleaseDate(window),
mDeveloper(window),
mPublisher(window), mGenre(window), mPlayers(window), mLastPlayed(window), mPlayCount(window), mName(window),
mDescContainer(window), mDescription(window), mGamelistInfo(window)
{
const float padding = 0.01f;
@ -55,6 +37,7 @@ GridGameListView::GridGameListView(Window* window, FileData* root)
populateList(root->getChildrenListToDisplay(), root);
// Metadata labels + values.
addChild(&mBadges);
mLblRating.setText("Rating: ");
addChild(&mLblRating);
addChild(&mRating);
@ -490,9 +473,11 @@ void GridGameListView::updateInfoPanel()
// An animation is not playing, then animate if opacity != our target opacity.
if ((comp->isAnimationPlaying(0) && comp->isAnimationReversed(0) != fadingOut) ||
(!comp->isAnimationPlaying(0) && comp->getOpacity() != (fadingOut ? 0 : 255))) {
auto func = [comp](float t) {
// TEMPORARY - This does not seem to work, needs to be reviewed later.
// comp->setOpacity(static_cast<unsigned char>(glm::mix(0.0f, 1.0f, t) * 255));
// TEMPORARY - This does not seem to work, needs to be reviewed later.
// auto func = [comp](float t) {
auto func = [](float t) {
// comp->setOpacity(static_cast<unsigned char>(glm::mix(0.0f, 1.0f, t) * 255));
};
comp->setAnimation(new LambdaAnimation(func, 150), 0, nullptr, fadingOut);
}

View file

@ -9,6 +9,7 @@
#ifndef ES_APP_VIEWS_GAME_LIST_GRID_GAME_LIST_VIEW_H
#define ES_APP_VIEWS_GAME_LIST_GRID_GAME_LIST_VIEW_H
#include "components/BadgesComponent.h"
#include "components/DateTimeComponent.h"
#include "components/ImageGridComponent.h"
#include "components/RatingComponent.h"
@ -67,15 +68,20 @@ protected:
ImageGridComponent<FileData*> mGrid;
// Points to the first game in the list, i.e. the first entry which is of the type 'GAME'.
FileData* firstGameEntry;
FileData *firstGameEntry;
private:
void updateInfoPanel();
const std::string getImagePath(FileData* file);
const std::string getImagePath(FileData *file);
void initMDLabels();
void initMDValues();
ImageComponent mMarquee;
ImageComponent mImage;
TextComponent mLblRating;
TextComponent mLblReleaseDate;
TextComponent mLblDeveloper;
@ -85,8 +91,7 @@ private:
TextComponent mLblLastPlayed;
TextComponent mLblPlayCount;
ImageComponent mMarquee;
ImageComponent mImage;
BadgesComponent mBadges;
RatingComponent mRating;
DateTimeComponent mReleaseDate;
TextComponent mDeveloper;

View file

@ -24,14 +24,10 @@
VideoGameListView::VideoGameListView(Window* window, FileData* root)
: BasicGameListView(window, root)
, mDescContainer(window)
, mDescription(window)
, mGamelistInfo(window)
, mThumbnail(window)
, mMarquee(window)
, mImage(window)
, mVideo(nullptr)
, mVideoPlaying(false)
, mLblRating(window)
, mLblReleaseDate(window)
, mLblDeveloper(window)
@ -46,9 +42,14 @@ VideoGameListView::VideoGameListView(Window* window, FileData* root)
, mPublisher(window)
, mGenre(window)
, mPlayers(window)
, mBadges(window)
, mLastPlayed(window)
, mPlayCount(window)
, mName(window)
, mDescContainer(window)
, mDescription(window)
, mGamelistInfo(window)
, mVideoPlaying(false)
, mLastUpdated(nullptr)
{
const float padding = 0.01f;
@ -110,6 +111,7 @@ VideoGameListView::VideoGameListView(Window* window, FileData* root)
mLblPlayers.setText("Players: ");
addChild(&mLblPlayers);
addChild(&mPlayers);
addChild(&mBadges);
mLblLastPlayed.setText("Last played: ");
addChild(&mLblLastPlayed);
mLastPlayed.setDisplayRelative(true);
@ -162,6 +164,8 @@ void VideoGameListView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
mVideo->applyTheme(theme, getName(), "md_video",
POSITION | ThemeFlags::SIZE | ThemeFlags::DELAY | Z_INDEX | ROTATION |
VISIBLE);
mBadges.applyTheme(theme, getName(), "md_badges",
POSITION | ThemeFlags::SIZE | Z_INDEX | DIRECTION | VISIBLE);
mName.applyTheme(theme, getName(), "md_name", ALL);
initMDLabels();
@ -176,10 +180,10 @@ void VideoGameListView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
initMDValues();
std::vector<GuiComponent*> values = getMDValues();
assert(values.size() == 8);
std::vector<std::string> valElements = {"md_rating", "md_releasedate", "md_developer",
"md_publisher", "md_genre", "md_players",
"md_lastplayed", "md_playcount"};
assert(values.size() == 9);
std::vector<std::string> valElements = {"md_rating", "md_releasedate", "md_developer",
"md_publisher", "md_genre", "md_players",
"md_badges", "md_lastplayed", "md_playcount"};
for (unsigned int i = 0; i < values.size(); i++)
values[i]->applyTheme(theme, getName(), valElements[i], ALL ^ ThemeFlags::TEXT);
@ -243,6 +247,9 @@ void VideoGameListView::initMDValues()
mPublisher.setFont(defaultFont);
mGenre.setFont(defaultFont);
mPlayers.setFont(defaultFont);
mBadges.setSize(defaultFont->getHeight() * 5.0f, static_cast<float>(defaultFont->getHeight()));
mLastPlayed.setFont(defaultFont);
mPlayCount.setFont(defaultFont);
@ -315,6 +322,7 @@ void VideoGameListView::updateInfoPanel()
mGenre.setVisible(false);
mLblPlayers.setVisible(false);
mPlayers.setVisible(false);
mBadges.setVisible(false);
mLblLastPlayed.setVisible(false);
mLastPlayed.setVisible(false);
mLblPlayCount.setVisible(false);
@ -333,6 +341,7 @@ void VideoGameListView::updateInfoPanel()
mGenre.setVisible(true);
mLblPlayers.setVisible(true);
mPlayers.setVisible(true);
mBadges.setVisible(true);
mLblLastPlayed.setVisible(true);
mLastPlayed.setVisible(true);
mLblPlayCount.setVisible(true);
@ -437,6 +446,18 @@ void VideoGameListView::updateInfoPanel()
mPublisher.setValue(file->metadata.get("publisher"));
mGenre.setValue(file->metadata.get("genre"));
mPlayers.setValue(file->metadata.get("players"));
// Generate badges slots value based on the game metadata.
std::stringstream ss;
ss << (file->metadata.get("favorite").compare("true") ? "" : "favorite ");
ss << (file->metadata.get("completed").compare("true") ? "" : "completed ");
ss << (file->metadata.get("kidgame").compare("true") ? "" : "kidgame ");
ss << (file->metadata.get("broken").compare("true") ? "" : "broken ");
std::string slots = ss.str();
if (!slots.empty())
slots.pop_back();
mBadges.setValue(slots);
mName.setValue(file->metadata.get("name"));
if (file->getType() == GAME) {
@ -504,6 +525,7 @@ std::vector<GuiComponent*> VideoGameListView::getMDValues()
ret.push_back(&mPublisher);
ret.push_back(&mGenre);
ret.push_back(&mPlayers);
ret.push_back(&mBadges);
ret.push_back(&mLastPlayed);
ret.push_back(&mPlayCount);
return ret;

View file

@ -9,6 +9,7 @@
#ifndef ES_APP_VIEWS_GAME_LIST_VIDEO_GAME_LIST_VIEW_H
#define ES_APP_VIEWS_GAME_LIST_VIDEO_GAME_LIST_VIEW_H
#include "components/BadgesComponent.h"
#include "components/DateTimeComponent.h"
#include "components/RatingComponent.h"
#include "components/ScrollableContainer.h"
@ -38,8 +39,8 @@ private:
ImageComponent mThumbnail;
ImageComponent mMarquee;
VideoComponent* mVideo;
ImageComponent mImage;
VideoComponent* mVideo;
TextComponent mLblRating;
TextComponent mLblReleaseDate;
@ -50,6 +51,7 @@ private:
TextComponent mLblLastPlayed;
TextComponent mLblPlayCount;
BadgesComponent mBadges;
RatingComponent mRating;
DateTimeComponent mReleaseDate;
TextComponent mDeveloper;

View file

@ -1,3 +1,11 @@
# SPDX-License-Identifier: MIT
#
# EmulationStation Desktop Edition
# CMakeLists.txt (es-core)
#
# CMake configuration for es-core.
#
project("core")
set(CORE_HEADERS
@ -26,12 +34,14 @@ set(CORE_HEADERS
# GUI components
${CMAKE_CURRENT_SOURCE_DIR}/src/components/AnimatedImageComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/BadgesComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/BusyComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ButtonComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ComponentGrid.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ComponentList.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/DateTimeComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/DateTimeEditComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/FlexboxComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GridTileComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/HelpComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/IList.h
@ -52,10 +62,10 @@ set(CORE_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/src/components/VideoVlcComponent.h
# GUIs
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiComplexTextEditPopup.h
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiDetectDevice.h
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiInputConfig.h
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMsgBox.h
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiTextEditKeyboardPopup.h
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiTextEditPopup.h
# Renderers
@ -75,7 +85,7 @@ set(CORE_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/src/utils/MathUtil.h
${CMAKE_CURRENT_SOURCE_DIR}/src/utils/StringUtil.h
${CMAKE_CURRENT_SOURCE_DIR}/src/utils/TimeUtil.h
)
)
set(CORE_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/AudioManager.cpp
@ -100,12 +110,14 @@ set(CORE_SOURCES
# GUI components
${CMAKE_CURRENT_SOURCE_DIR}/src/components/AnimatedImageComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/BadgesComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/BusyComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ButtonComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ComponentGrid.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ComponentList.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/DateTimeComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/DateTimeEditComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/FlexboxComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GridTileComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/HelpComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ImageComponent.cpp
@ -122,10 +134,10 @@ set(CORE_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/components/VideoVlcComponent.cpp
# GUIs
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiComplexTextEditPopup.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiDetectDevice.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiInputConfig.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMsgBox.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiTextEditKeyboardPopup.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiTextEditPopup.cpp
# Renderer
@ -147,7 +159,7 @@ set(CORE_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/utils/MathUtil.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/utils/StringUtil.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/utils/TimeUtil.cpp
)
)
include_directories(${COMMON_INCLUDE_DIRS})
add_library(es-core STATIC ${CORE_SOURCES} ${CORE_HEADERS})

View file

@ -147,6 +147,9 @@ CECInput::CECInput()
mlibCEC = nullptr;
return;
}
#else
// This is simply to get rid of a Clang -Wunused-private-field compiler warning.
mlibCEC = nullptr;
#endif // HAVE_LIBCEC
}

View file

@ -16,22 +16,11 @@
#include <algorithm>
GuiComponent::GuiComponent(Window* window)
: mWindow(window)
, mParent(nullptr)
, mColor(0)
, mColorShift(0)
, mColorShiftEnd(0)
, mOpacity(255)
, mSaturation(1.0f)
, mPosition({})
, mOrigin({})
, mRotationOrigin(0.5f, 0.5f)
, mSize({})
, mTransform(Renderer::getIdentity())
, mIsProcessing(false)
, mVisible(true)
, mEnabled(true)
GuiComponent::GuiComponent(Window *window)
: mWindow(window), mParent(nullptr), mOpacity(255), mColor(0), mSaturation(1.0f), mColorShift(0),
mColorShiftEnd(0),
mPosition({}), mOrigin({}), mRotationOrigin(0.5f, 0.5f), mSize({}), mIsProcessing(false), mVisible(true),
mEnabled(true), mTransform(Renderer::getIdentity())
{
for (unsigned char i = 0; i < MAX_ANIMATIONS; i++)
mAnimationMap[i] = nullptr;

View file

@ -230,10 +230,16 @@ public:
const static unsigned char MAX_ANIMATIONS = 4;
protected:
void renderChildren(const glm::mat4& transform) const;
void renderChildren(const glm::mat4 &transform) const;
void updateSelf(int deltaTime); // Updates animations.
void updateChildren(int deltaTime); // Updates animations.
Window *mWindow;
GuiComponent *mParent;
std::vector<GuiComponent *> mChildren;
unsigned char mOpacity;
unsigned int mColor;
float mSaturation;
@ -243,11 +249,6 @@ protected:
unsigned int mColorOriginalValue;
unsigned int mColorChangedValue;
Window* mWindow;
GuiComponent* mParent;
std::vector<GuiComponent*> mChildren;
glm::vec3 mPosition;
glm::vec2 mOrigin;
glm::vec2 mRotationOrigin;

View file

@ -49,12 +49,16 @@ void HelpStyle::applyTheme(const std::shared_ptr<ThemeData>& theme, const std::s
if (elem->has("textColorDimmed"))
textColorDimmed = elem->get<unsigned int>("textColorDimmed");
else
textColorDimmed = textColor;
if (elem->has("iconColor"))
iconColor = elem->get<unsigned int>("iconColor");
if (elem->has("iconColorDimmed"))
iconColorDimmed = elem->get<unsigned int>("iconColorDimmed");
else
iconColorDimmed = iconColor;
if (elem->has("fontPath") || elem->has("fontSize"))
font = Font::getFromTheme(elem, ThemeFlags::ALL, font);
@ -85,6 +89,10 @@ void HelpStyle::applyTheme(const std::shared_ptr<ThemeData>& theme, const std::s
mCustomButtons.button_r = elem->get<std::string>("button_r");
if (elem->has("button_lr"))
mCustomButtons.button_lr = elem->get<std::string>("button_lr");
if (elem->has("button_lt"))
mCustomButtons.button_lt = elem->get<std::string>("button_lt");
if (elem->has("button_rt"))
mCustomButtons.button_rt = elem->get<std::string>("button_rt");
// SNES.
if (elem->has("button_a_SNES"))

View file

@ -40,6 +40,8 @@ struct HelpStyle {
std::string button_l;
std::string button_r;
std::string button_lr;
std::string button_lt;
std::string button_rt;
// SNES.
std::string button_a_SNES;

View file

@ -79,8 +79,8 @@ private:
static CURLM* s_multi_handle;
CURL* mHandle;
Status mStatus;
CURL *mHandle;
std::stringstream mContent;
std::string mErrorMsg;

View file

@ -411,7 +411,7 @@ bool InputManager::parseEvent(const SDL_Event& event, Window* window)
return false;
// The event filtering below is required as some controllers send button presses
// starting with the state 0 when using the D-pad. I consider this invalid behaviour
// starting with the state 0 when using the D-pad. I consider this invalid behavior
// and the more popular controllers such as those from Microsoft and Sony do not show
// this strange behavior.
int buttonState =

View file

@ -180,6 +180,7 @@ void Settings::setDefaults()
mBoolMap["FavoritesStar"] = {true, true};
mBoolMap["SpecialCharsASCII"] = {false, false};
mBoolMap["ListScrollOverlay"] = {false, false};
mBoolMap["VirtualKeyboard"] = {true, true};
mBoolMap["FavoritesAddButton"] = {true, true};
mBoolMap["RandomAddButton"] = {false, false};
mBoolMap["GamelistFilters"] = {true, true};
@ -240,7 +241,7 @@ void Settings::setDefaults()
mBoolMap["VideoHardwareDecoding"] = {false, false};
#endif
mBoolMap["VideoUpscaleFrameRate"] = {false, false};
mBoolMap["LaunchCommandOverride"] = {true, true};
mBoolMap["AlternativeEmulatorPerGame"] = {true, true};
mBoolMap["ShowHiddenFiles"] = {true, true};
mBoolMap["ShowHiddenGames"] = {true, true};
mBoolMap["CustomEventScripts"] = {false, false};
@ -413,7 +414,7 @@ void Settings::loadFile()
}
// Parameters for the macro defined above.
SETTINGS_GETSET(bool, mBoolMap, getBool, getDefaultBool, setBool);
SETTINGS_GETSET(int, mIntMap, getInt, getDefaultInt, setInt);
SETTINGS_GETSET(float, mFloatMap, getFloat, getDefaultFloat, setFloat);
SETTINGS_GETSET(const std::string&, mStringMap, getString, getDefaultString, setString);
SETTINGS_GETSET(bool, mBoolMap, getBool, getDefaultBool, setBool)
SETTINGS_GETSET(int, mIntMap, getInt, getDefaultInt, setInt)
SETTINGS_GETSET(float, mFloatMap, getFloat, getDefaultFloat, setFloat)
SETTINGS_GETSET(const std::string&, mStringMap, getString, getDefaultString, setString)

View file

@ -218,13 +218,13 @@ void NavigationSounds::loadThemeNavigationSounds(const std::shared_ptr<ThemeData
"Theme set does not include navigation sound support, using fallback sounds";
}
navigationSounds.push_back(std::move(Sound::getFromTheme(theme, "all", "systembrowse")));
navigationSounds.push_back(std::move(Sound::getFromTheme(theme, "all", "quicksysselect")));
navigationSounds.push_back(std::move(Sound::getFromTheme(theme, "all", "select")));
navigationSounds.push_back(std::move(Sound::getFromTheme(theme, "all", "back")));
navigationSounds.push_back(std::move(Sound::getFromTheme(theme, "all", "scroll")));
navigationSounds.push_back(std::move(Sound::getFromTheme(theme, "all", "favorite")));
navigationSounds.push_back(std::move(Sound::getFromTheme(theme, "all", "launch")));
navigationSounds.push_back(Sound::getFromTheme(theme, "all", "systembrowse"));
navigationSounds.push_back(Sound::getFromTheme(theme, "all", "quicksysselect"));
navigationSounds.push_back(Sound::getFromTheme(theme, "all", "select"));
navigationSounds.push_back(Sound::getFromTheme(theme, "all", "back"));
navigationSounds.push_back(Sound::getFromTheme(theme, "all", "scroll"));
navigationSounds.push_back(Sound::getFromTheme(theme, "all", "favorite"));
navigationSounds.push_back(Sound::getFromTheme(theme, "all", "launch"));
}
void NavigationSounds::playThemeNavigationSound(NavigationSoundsID soundID)

View file

@ -146,6 +146,18 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>> The
{"unfilledPath", PATH},
{"visible", BOOLEAN},
{"zIndex", FLOAT}}},
{"badges",
{{"pos", NORMALIZED_PAIR},
{"origin", NORMALIZED_PAIR},
{"direction", STRING},
{"align", STRING},
{"itemsPerLine", FLOAT},
{"itemMargin", NORMALIZED_PAIR},
{"itemWidth", FLOAT},
{"slots", STRING},
{"customBadgeIcon", PATH},
{"visible", BOOLEAN},
{"zIndex", FLOAT}}},
{"sound", {{"path", PATH}}},
{"helpsystem",
{{"pos", NORMALIZED_PAIR},
@ -503,8 +515,8 @@ void ThemeData::parseElement(const pugi::xml_node& root,
"");
}
// Special parsing instruction for customButtonIcon -> save node as it's button
// attribute to prevent nodes overwriting each other.
// Special parsing instruction for recurring options.
// Store as it's attribute to prevent nodes overwriting each other.
if (strcmp(node.name(), "customButtonIcon") == 0) {
const auto btn = node.attribute("button").as_string("");
if (strcmp(btn, "") == 0)
@ -513,6 +525,13 @@ void ThemeData::parseElement(const pugi::xml_node& root,
else
element.properties[btn] = path;
}
else if (strcmp(node.name(), "customBadgeIcon") == 0) {
const auto btn = node.attribute("badge").as_string("");
if (strcmp(btn, "") == 0)
LOG(LogError) << "<customBadgeIcon> element requires the `badge` property.";
else
element.properties[btn] = path;
}
else
element.properties[node.name()] = path;

View file

@ -14,6 +14,7 @@
#include "utils/FileSystemUtil.h"
#include "utils/MathUtil.h"
#include <any>
#include <deque>
#include <map>
#include <memory>
@ -53,6 +54,7 @@ namespace ThemeFlags
Z_INDEX = 8192,
ROTATION = 16384,
VISIBLE = 32768,
DIRECTION = 65536,
ALL = 0xFFFFFFFF
};
}
@ -127,17 +129,17 @@ public:
template <typename T> const T get(const std::string& prop) const
{
if (std::is_same<T, glm::vec2>::value)
return *(const T*)&properties.at(prop).v;
return std::any_cast<const T>(properties.at(prop).v);
else if (std::is_same<T, std::string>::value)
return *(const T*)&properties.at(prop).s;
return std::any_cast<const T>(properties.at(prop).s);
else if (std::is_same<T, unsigned int>::value)
return *(const T*)&properties.at(prop).i;
return std::any_cast<const T>(properties.at(prop).i);
else if (std::is_same<T, float>::value)
return *(const T*)&properties.at(prop).f;
return std::any_cast<const T>(properties.at(prop).f);
else if (std::is_same<T, bool>::value)
return *(const T*)&properties.at(prop).b;
return std::any_cast<const T>(properties.at(prop).b);
else if (std::is_same<T, glm::vec4>::value)
return *(const T*)&properties.at(prop).r;
return std::any_cast<const T>(properties.at(prop).r);
return T();
}

View file

@ -30,13 +30,14 @@ Window::Window()
, mMediaViewer(nullptr)
, mLaunchScreen(nullptr)
, mInfoPopup(nullptr)
, mNormalizeNextUpdate(false)
, mListScrollOpacity(0)
, mFrameTimeElapsed(0)
, mFrameCountElapsed(0)
, mAverageDeltaTime(10)
, mTimeSinceLastInput(0)
, mNormalizeNextUpdate(false)
, mAllowSleep(true)
, mSleeping(false)
, mTimeSinceLastInput(0)
, mRenderScreensaver(false)
, mRenderMediaViewer(false)
, mRenderLaunchScreen(false)
@ -46,11 +47,11 @@ Window::Window()
, mInvalidatedCachedBackground(false)
, mVideoPlayerCount(0)
, mTopScale(0.5)
, mListScrollOpacity(0)
, mChangedThemeSet(false)
{
mHelp = new HelpComponent(this);
mBackgroundOverlay = new ImageComponent(this);
mBackgroundOverlayOpacity = 0;
}
Window::~Window()
@ -561,10 +562,10 @@ void Window::render()
}
if (mRenderMediaViewer)
mMediaViewer->render();
mMediaViewer->render(trans);
if (mRenderLaunchScreen)
mLaunchScreen->render();
mLaunchScreen->render(trans);
if (Settings::getInstance()->getBool("DisplayGPUStatistics") && mFrameDataText) {
Renderer::setMatrix(Renderer::getIdentity());
@ -657,14 +658,16 @@ void Window::setHelpPrompts(const std::vector<HelpPrompt>& prompts, const HelpSt
"b",
"x",
"y",
"l",
"r",
"l",
"rt",
"lt",
"start",
"back"};
int i = 0;
int aVal = 0;
int bVal = 0;
while (i < map.size()) {
while (i < static_cast<int>(map.size())) {
if (a.first == map[i])
aVal = i;
if (b.first == map[i])
@ -790,7 +793,7 @@ int Window::getVideoPlayerCount()
videoPlayerCount = mVideoPlayerCount;
mVideoCountMutex.unlock();
return videoPlayerCount;
};
}
void Window::setLaunchedGame()
{

View file

@ -61,7 +61,7 @@ public:
virtual void showPrevious() = 0;
virtual void update(int deltaTime) = 0;
virtual void render() = 0;
virtual void render(const glm::mat4& parentTrans) = 0;
};
class GuiLaunchScreen
@ -70,7 +70,7 @@ public:
virtual void displayLaunchScreen(FileData* game) = 0;
virtual void closeLaunchScreen() = 0;
virtual void update(int deltaTime) = 0;
virtual void render() = 0;
virtual void render(const glm::mat4& parentTrans) = 0;
};
class InfoPopup
@ -158,31 +158,31 @@ private:
HelpComponent* mHelp;
ImageComponent* mBackgroundOverlay;
unsigned char mBackgroundOverlayOpacity;
Screensaver* mScreensaver;
InfoPopup* mInfoPopup;
std::vector<GuiComponent*> mGuiStack;
std::vector<std::shared_ptr<Font>> mDefaultFonts;
std::unique_ptr<TextCache> mFrameDataText;
Screensaver* mScreensaver;
MediaViewer* mMediaViewer;
bool mRenderMediaViewer;
GuiLaunchScreen* mLaunchScreen;
bool mRenderLaunchScreen;
InfoPopup* mInfoPopup;
std::string mListScrollText;
std::shared_ptr<Font> mListScrollFont;
unsigned char mListScrollOpacity;
bool mNormalizeNextUpdate;
int mFrameTimeElapsed;
int mFrameCountElapsed;
int mAverageDeltaTime;
bool mAllowSleep;
bool mSleeping;
unsigned int mTimeSinceLastInput;
bool mNormalizeNextUpdate;
bool mAllowSleep;
bool mSleeping;
bool mRenderScreensaver;
bool mRenderMediaViewer;
bool mRenderLaunchScreen;
bool mGameLaunchedState;
bool mAllowTextScrolling;
bool mCachedBackground;

View file

@ -17,8 +17,8 @@ class MoveCameraAnimation : public Animation
public:
MoveCameraAnimation(glm::mat4& camera, const glm::vec3& target)
: mCameraStart(camera)
, mTarget(target)
, cameraPosition(camera)
, mTarget(target)
{
}

View file

@ -0,0 +1,106 @@
// SPDX-License-Identifier: MIT
//
// EmulationStation Desktop Edition
// BadgesComponent.cpp
//
// Game badges icons.
// Used by gamelist views.
//
#include "components/BadgesComponent.h"
#include "Settings.h"
#include "ThemeData.h"
#include "resources/TextureResource.h"
BadgesComponent::BadgesComponent(Window* window)
: FlexboxComponent(window)
{
// Define the slots.
mSlots = {SLOT_FAVORITE, SLOT_COMPLETED, SLOT_KIDS, SLOT_BROKEN};
mBadgeIcons = std::map<std::string, std::string>();
mBadgeIcons[SLOT_FAVORITE] = ":/graphics/badge_favorite.svg";
mBadgeIcons[SLOT_COMPLETED] = ":/graphics/badge_completed.svg";
mBadgeIcons[SLOT_KIDS] = ":/graphics/badge_kidgame.svg";
mBadgeIcons[SLOT_BROKEN] = ":/graphics/badge_broken.svg";
// Create the child ImageComponent for every badge.
mImageComponents = std::map<std::string, ImageComponent>();
ImageComponent mImageFavorite = ImageComponent(window);
mImageFavorite.setImage(mBadgeIcons[SLOT_FAVORITE], false, false);
mImageComponents.insert({SLOT_FAVORITE, mImageFavorite});
ImageComponent mImageCompleted = ImageComponent(window);
mImageCompleted.setImage(mBadgeIcons[SLOT_COMPLETED], false, false);
mImageComponents.insert({SLOT_COMPLETED, mImageCompleted});
ImageComponent mImageKids = ImageComponent(window);
mImageKids.setImage(mBadgeIcons[SLOT_KIDS], false, false);
mImageComponents.insert({SLOT_KIDS, mImageKids});
ImageComponent mImageBroken = ImageComponent(window);
mImageBroken.setImage(mBadgeIcons[SLOT_BROKEN], false, false);
mImageComponents.insert({SLOT_BROKEN, mImageBroken});
}
void BadgesComponent::setValue(const std::string& value)
{
mChildren.clear();
if (!value.empty()) {
std::string temp;
std::istringstream ss(value);
while (std::getline(ss, temp, ' ')) {
if (!(temp == SLOT_FAVORITE || temp == SLOT_COMPLETED || temp == SLOT_KIDS ||
temp == SLOT_BROKEN))
LOG(LogError) << "Badge slot '" << temp << "' is invalid.";
else
mChildren.push_back(&mImageComponents.find(temp)->second);
}
}
onSizeChanged();
}
std::string BadgesComponent::getValue() const
{
std::stringstream ss;
for (auto& slot : mSlots)
ss << slot << ' ';
std::string r = ss.str();
r.pop_back();
return r;
}
void BadgesComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
const std::string& view,
const std::string& element,
unsigned int properties)
{
using namespace ThemeFlags;
const ThemeData::ThemeElement* elem = theme->getElement(view, element, "badges");
if (!elem)
return;
bool imgChanged = false;
for (auto& slot : mSlots) {
if (properties & PATH && elem->has(slot)) {
mBadgeIcons[slot] = elem->get<std::string>(slot);
mImageComponents.find(slot)->second.setImage(mBadgeIcons[slot]);
imgChanged = true;
}
}
if (elem->has("slots"))
setValue(elem->get<std::string>("slots"));
// Apply theme on the flexbox component parent.
FlexboxComponent::applyTheme(theme, view, element, properties);
if (imgChanged)
onSizeChanged();
}
std::vector<HelpPrompt> BadgesComponent::getHelpPrompts()
{
std::vector<HelpPrompt> prompts;
return prompts;
}

View file

@ -0,0 +1,48 @@
// SPDX-License-Identifier: MIT
//
// EmulationStation Desktop Edition
// BadgesComponent.h
//
// Game badges icons.
// Used by gamelist views.
//
#ifndef ES_APP_COMPONENTS_BADGES_COMPONENT_H
#define ES_APP_COMPONENTS_BADGES_COMPONENT_H
#include "FlexboxComponent.h"
#include "GuiComponent.h"
#include "ImageComponent.h"
#include "renderers/Renderer.h"
#define NUM_SLOTS 4
#define SLOT_FAVORITE "favorite"
#define SLOT_COMPLETED "completed"
#define SLOT_KIDS "kidgame"
#define SLOT_BROKEN "broken"
class TextureResource;
class BadgesComponent : public FlexboxComponent
{
public:
BadgesComponent(Window* window);
std::string getValue() const override;
// Should be a list of strings.
void setValue(const std::string& value) override;
virtual void applyTheme(const std::shared_ptr<ThemeData>& theme,
const std::string& view,
const std::string& element,
unsigned int properties) override;
virtual std::vector<HelpPrompt> getHelpPrompts() override;
private:
std::vector<std::string> mSlots;
std::map<std::string, std::string> mBadgeIcons;
std::map<std::string, ImageComponent> mImageComponents;
};
#endif // ES_APP_COMPONENTS_BADGES_COMPONENT_H

View file

@ -12,46 +12,51 @@
#include "resources/Font.h"
#include "utils/StringUtil.h"
ButtonComponent::ButtonComponent(Window* window,
const std::string& text,
const std::string& helpText,
const std::function<void()>& func)
: GuiComponent(window)
, mBox(window, ":/graphics/button.svg")
, mFont(Font::get(FONT_SIZE_MEDIUM))
, mFocused(false)
, mEnabled(true)
, mTextColorFocused(0xFFFFFFFF)
, mTextColorUnfocused(0x777777FF)
{
ButtonComponent::ButtonComponent(Window *window,
const std::string &text,
const std::string &helpText,
const std::function<void()> &func,
bool upperCase,
bool flatStyle)
: GuiComponent{window}, mBox{window, ":/graphics/button.svg"}, mFont{Font::get(FONT_SIZE_MEDIUM)}, mPadding{{}},
mFocused{false}, mEnabled{true}, mFlatStyle{flatStyle}, mTextColorFocused{0xFFFFFFFF},
mTextColorUnfocused{0x777777FF}, mFlatColorFocused{0x878787FF}, mFlatColorUnfocused{0x60606025} {
setPressedFunc(func);
setText(text, helpText);
updateImage();
setText(text, helpText, upperCase);
if (!mFlatStyle)
updateImage();
}
void ButtonComponent::onSizeChanged()
{
// Fit to mBox.
mBox.fitTo(mSize, glm::vec3{}, glm::vec2{-32.0f, -32.0f});
void ButtonComponent::onSizeChanged() {
if (mFlatStyle)
return;
auto cornerSize = mBox.getCornerSize();
mBox.fitTo(glm::vec2{mSize.x - mPadding.x - mPadding.z, mSize.y - mPadding.y - mPadding.w},
glm::vec3{mPadding.x, mPadding.y, 0.0f},
glm::vec2{-cornerSize.x * 2.0f, -cornerSize.y * 2.0f});
}
bool ButtonComponent::input(InputConfig* config, Input input)
{
if (config->isMappedTo("a", input) && input.value != 0) {
if (mPressedFunc && mEnabled)
mPressedFunc();
return true;
}
return GuiComponent::input(config, input);
void ButtonComponent::onFocusGained() {
mFocused = true;
if (!mFlatStyle)
updateImage();
}
void ButtonComponent::setText(const std::string& text, const std::string& helpText)
{
mText = Utils::String::toUpper(text);
void ButtonComponent::onFocusLost() {
mFocused = false;
if (!mFlatStyle)
updateImage();
}
void ButtonComponent::setText(const std::string &text, const std::string &helpText, bool upperCase) {
mText = upperCase ? Utils::String::toUpper(text) : text;
mHelpText = helpText;
mTextCache = std::unique_ptr<TextCache>(mFont->buildTextCache(mText, 0, 0, getCurTextColor()));
mTextCache =
std::unique_ptr<TextCache>(mFont->buildTextCache(mText, 0.0f, 0.0f, getCurTextColor()));
float minWidth = mFont->sizeText("DELETE").x + (12.0f * Renderer::getScreenWidthModifier());
setSize(std::max(mTextCache->metrics.size.x + (12.0f * Renderer::getScreenWidthModifier()),
@ -61,43 +66,48 @@ void ButtonComponent::setText(const std::string& text, const std::string& helpTe
updateHelpPrompts();
}
void ButtonComponent::onFocusGained()
{
mFocused = true;
updateImage();
}
void ButtonComponent::onFocusLost()
{
mFocused = false;
updateImage();
}
void ButtonComponent::setEnabled(bool state)
{
void ButtonComponent::setEnabled(bool state) {
mEnabled = state;
updateImage();
if (!mFlatStyle)
updateImage();
}
void ButtonComponent::updateImage()
{
if (!mEnabled || !mPressedFunc) {
mBox.setImagePath(":/graphics/button_filled.svg");
mBox.setCenterColor(0x770000FF);
mBox.setEdgeColor(0x770000FF);
void ButtonComponent::setPadding(const glm::vec4 padding) {
if (mPadding == padding)
return;
mPadding = padding;
onSizeChanged();
}
bool ButtonComponent::input(InputConfig *config, Input input) {
if (config->isMappedTo("a", input) && input.value != 0) {
if (mPressedFunc && mEnabled)
mPressedFunc();
return true;
}
mBox.setCenterColor(0xFFFFFFFF);
mBox.setEdgeColor(0xFFFFFFFF);
mBox.setImagePath(mFocused ? ":/graphics/button_filled.svg" : ":/graphics/button.svg");
return GuiComponent::input(config, input);
}
void ButtonComponent::render(const glm::mat4& parentTrans)
{
void ButtonComponent::render(const glm::mat4 &parentTrans) {
glm::mat4 trans{parentTrans * getTransform()};
mBox.render(trans);
if (mFlatStyle) {
if (mFocused) {
Renderer::setMatrix(trans);
Renderer::drawRect(mPadding.x, mPadding.y, mSize.x - mPadding.x - mPadding.z,
mSize.y - mPadding.y - mPadding.w, mFlatColorFocused,
mFlatColorFocused);
} else {
Renderer::setMatrix(trans);
Renderer::drawRect(mPadding.x, mPadding.y, mSize.x - mPadding.x - mPadding.z,
mSize.y - mPadding.y - mPadding.w, mFlatColorUnfocused,
mFlatColorUnfocused);
}
} else {
mBox.render(trans);
}
if (mTextCache) {
glm::vec3 centerOffset{(mSize.x - mTextCache->metrics.size.x) / 2.0f,
@ -121,17 +131,28 @@ void ButtonComponent::render(const glm::mat4& parentTrans)
renderChildren(trans);
}
unsigned int ButtonComponent::getCurTextColor() const
{
std::vector<HelpPrompt> ButtonComponent::getHelpPrompts() {
std::vector<HelpPrompt> prompts;
prompts.push_back(HelpPrompt("a", mHelpText.empty() ? mText.c_str() : mHelpText.c_str()));
return prompts;
}
unsigned int ButtonComponent::getCurTextColor() const {
if (!mFocused)
return mTextColorUnfocused;
else
return mTextColorFocused;
}
std::vector<HelpPrompt> ButtonComponent::getHelpPrompts()
{
std::vector<HelpPrompt> prompts;
prompts.push_back(HelpPrompt("a", mHelpText.empty() ? mText.c_str() : mHelpText.c_str()));
return prompts;
void ButtonComponent::updateImage() {
if (!mEnabled || !mPressedFunc) {
mBox.setImagePath(":/graphics/button_filled.svg");
mBox.setCenterColor(0x770000FF);
mBox.setEdgeColor(0x770000FF);
return;
}
mBox.setCenterColor(0xFFFFFFFF);
mBox.setEdgeColor(0xFFFFFFFF);
mBox.setImagePath(mFocused ? ":/graphics/button_filled.svg" : ":/graphics/button.svg");
}

View file

@ -14,47 +14,69 @@
class TextCache;
class ButtonComponent : public GuiComponent
{
class ButtonComponent : public GuiComponent {
public:
ButtonComponent(Window* window,
const std::string& text = "",
const std::string& helpText = "",
const std::function<void()>& func = nullptr);
void setPressedFunc(std::function<void()> f) { mPressedFunc = f; }
void setEnabled(bool state) override;
bool input(InputConfig* config, Input input) override;
void render(const glm::mat4& parentTrans) override;
void setText(const std::string& text, const std::string& helpText);
const std::string& getText() const { return mText; }
const std::function<void()>& getPressedFunc() const { return mPressedFunc; }
ButtonComponent(Window *window,
const std::string &text = "",
const std::string &helpText = "",
const std::function<void()> &func = nullptr,
bool upperCase = true,
bool flatStyle = false);
void onSizeChanged() override;
void onFocusGained() override;
void onFocusLost() override;
void setText(const std::string &text, const std::string &helpText, bool upperCase = true);
const std::string &getText() const { return mText; }
void setPressedFunc(std::function<void()> f) { mPressedFunc = f; }
void setEnabled(bool state) override;
void setPadding(const glm::vec4 padding);
glm::vec4 getPadding() { return mPadding; }
void setFlatColorFocused(unsigned int color) { mFlatColorFocused = color; }
void setFlatColorUnfocused(unsigned int color) { mFlatColorUnfocused = color; }
const std::function<void()> &getPressedFunc() const { return mPressedFunc; }
bool input(InputConfig *config, Input input) override;
void render(const glm::mat4 &parentTrans) override;
virtual std::vector<HelpPrompt> getHelpPrompts() override;
private:
unsigned int getCurTextColor() const;
void updateImage();
NinePatchComponent mBox;
std::shared_ptr<Font> mFont;
std::unique_ptr<TextCache> mTextCache;
std::function<void()> mPressedFunc;
bool mFocused;
bool mEnabled;
unsigned int mTextColorFocused;
unsigned int mTextColorUnfocused;
unsigned int getCurTextColor() const;
void updateImage();
glm::vec4 mPadding;
std::string mText;
std::string mHelpText;
std::unique_ptr<TextCache> mTextCache;
NinePatchComponent mBox;
bool mFocused;
bool mEnabled;
bool mFlatStyle;
unsigned int mTextColorFocused;
unsigned int mTextColorUnfocused;
unsigned int mFlatColorFocused;
unsigned int mFlatColorUnfocused;
};
#endif // ES_CORE_COMPONENTS_BUTTON_COMPONENT_H

View file

@ -245,26 +245,31 @@ const ComponentGrid::GridEntry* ComponentGrid::getCellAt(int x, int y) const
bool ComponentGrid::input(InputConfig* config, Input input)
{
const GridEntry* cursorEntry = getCellAt(mCursor);
const GridEntry *cursorEntry = getCellAt(mCursor);
if (cursorEntry && cursorEntry->component->input(config, input))
return true;
if (!input.value)
return false;
bool withinBoundary = false;
if (config->isMappedLike("down", input))
return moveCursor(glm::ivec2{0, 1});
withinBoundary = moveCursor(glm::ivec2{0, 1});
if (config->isMappedLike("up", input))
return moveCursor(glm::ivec2{0, -1});
withinBoundary = moveCursor(glm::ivec2{0, -1});
if (config->isMappedLike("left", input))
return moveCursor(glm::ivec2{-1, 0});
withinBoundary = moveCursor(glm::ivec2{-1, 0});
if (config->isMappedLike("right", input))
return moveCursor(glm::ivec2{1, 0});
withinBoundary = moveCursor(glm::ivec2{1, 0});
return false;
if (!withinBoundary && mPastBoundaryCallback)
return mPastBoundaryCallback(config, input);
return withinBoundary;
}
void ComponentGrid::resetCursor()
@ -282,26 +287,62 @@ void ComponentGrid::resetCursor()
}
}
bool ComponentGrid::moveCursor(glm::ivec2 dir)
{
bool ComponentGrid::moveCursor(glm::ivec2 dir) {
assert(dir.x || dir.y);
const glm::ivec2 origCursor{mCursor};
const GridEntry* currentCursorEntry = getCellAt(mCursor);
const GridEntry *currentCursorEntry = getCellAt(mCursor);
glm::ivec2 searchAxis(dir.x == 0, dir.y == 0);
// Logic to handle entries that span several cells.
if (currentCursorEntry->dim.x > 1) {
if (dir.x < 0 && currentCursorEntry->pos.x == 0 && mCursor.x > currentCursorEntry->pos.x) {
onCursorMoved(mCursor, glm::ivec2{0, mCursor.y});
mCursor.x = 0;
return false;
}
if (dir.x > 0 && currentCursorEntry->pos.x + currentCursorEntry->dim.x == mGridSize.x &&
mCursor.x < currentCursorEntry->pos.x + currentCursorEntry->dim.x - 1) {
onCursorMoved(mCursor, glm::ivec2{mGridSize.x - 1, mCursor.y});
mCursor.x = mGridSize.x - 1;
return false;
}
if (dir.x > 0 && mCursor.x != currentCursorEntry->pos.x + currentCursorEntry->dim.x - 1)
dir.x = currentCursorEntry->dim.x - (mCursor.x - currentCursorEntry->pos.x);
else if (dir.x < 0 && mCursor.x != currentCursorEntry->pos.x)
dir.x = -(mCursor.x - currentCursorEntry->pos.x + 1);
}
if (currentCursorEntry->dim.y > 1) {
if (dir.y > 0 && mCursor.y != currentCursorEntry->pos.y + currentCursorEntry->dim.y - 1)
dir.y = currentCursorEntry->dim.y - (mCursor.y - currentCursorEntry->pos.y);
else if (dir.y < 0 && mCursor.y != currentCursorEntry->pos.y)
dir.y = -(mCursor.y - currentCursorEntry->pos.y + 1);
}
while (mCursor.x >= 0 && mCursor.y >= 0 && mCursor.x < mGridSize.x && mCursor.y < mGridSize.y) {
mCursor = mCursor + dir;
glm::ivec2 curDirPos{mCursor};
const GridEntry* cursorEntry;
const GridEntry *cursorEntry;
// Spread out on search axis+
while (mCursor.x < mGridSize.x && mCursor.y < mGridSize.y && mCursor.x >= 0 &&
mCursor.y >= 0) {
cursorEntry = getCellAt(mCursor);
if (cursorEntry && cursorEntry->canFocus && cursorEntry != currentCursorEntry) {
onCursorMoved(origCursor, mCursor);
return true;
// Multi-cell entries.
if (cursorEntry != nullptr) {
if (dir.x < 0 && cursorEntry->dim.x > 1)
mCursor.x = getCellAt(origCursor)->pos.x - cursorEntry->dim.x;
if (dir.y < 0 && cursorEntry->dim.y > 1)
mCursor.y = getCellAt(origCursor)->pos.y - cursorEntry->dim.y;
if (cursorEntry->canFocus && cursorEntry != currentCursorEntry) {
onCursorMoved(origCursor, mCursor);
return true;
}
}
mCursor += searchAxis;
}
@ -326,16 +367,31 @@ bool ComponentGrid::moveCursor(glm::ivec2 dir)
return false;
}
void ComponentGrid::onFocusLost()
{
const GridEntry* cursorEntry = getCellAt(mCursor);
void ComponentGrid::moveCursorTo(int xPos, int yPos, bool selectLeftCell) {
const glm::ivec2 origCursor{mCursor};
if (xPos != -1)
mCursor.x = xPos;
if (yPos != -1)
mCursor.y = yPos;
const GridEntry *currentCursorEntry = getCellAt(mCursor);
// If requested, select the leftmost cell of entries wider than 1 cell.
if (selectLeftCell && mCursor.x > currentCursorEntry->pos.x)
mCursor.x = currentCursorEntry->pos.x;
onCursorMoved(origCursor, mCursor);
}
void ComponentGrid::onFocusLost() {
const GridEntry *cursorEntry = getCellAt(mCursor);
if (cursorEntry)
cursorEntry->component->onFocusLost();
}
void ComponentGrid::onFocusGained()
{
const GridEntry* cursorEntry = getCellAt(mCursor);
void ComponentGrid::onFocusGained() {
const GridEntry *cursorEntry = getCellAt(mCursor);
if (cursorEntry)
cursorEntry->component->onFocusGained();
}

View file

@ -27,49 +27,63 @@ namespace GridFlags
BORDER_LEFT = 4,
BORDER_RIGHT = 8
};
}; // namespace GridFlags
} // namespace GridFlags
// Provides basic layout of components in an X*Y grid.
class ComponentGrid : public GuiComponent
{
class ComponentGrid : public GuiComponent {
public:
ComponentGrid(Window* window, const glm::ivec2& gridDimensions);
ComponentGrid(Window *window, const glm::ivec2 &gridDimensions);
virtual ~ComponentGrid();
bool removeEntry(const std::shared_ptr<GuiComponent>& comp);
bool removeEntry(const std::shared_ptr<GuiComponent> &comp);
void setEntry(const std::shared_ptr<GuiComponent>& comp,
const glm::ivec2& pos,
void setEntry(const std::shared_ptr<GuiComponent> &comp,
const glm::ivec2 &pos,
bool canFocus,
bool resize = true,
const glm::ivec2& size = glm::ivec2{1, 1},
const glm::ivec2 &size = glm::ivec2{1, 1},
unsigned int border = GridFlags::BORDER_NONE,
GridFlags::UpdateType updateType = GridFlags::UPDATE_ALWAYS);
void textInput(const std::string& text) override;
bool input(InputConfig* config, Input input) override;
void setPastBoundaryCallback(const std::function<bool(InputConfig *config, Input input)> &func) {
mPastBoundaryCallback = func;
}
void textInput(const std::string &text) override;
bool input(InputConfig *config, Input input) override;
void update(int deltaTime) override;
void render(const glm::mat4& parentTrans) override;
void render(const glm::mat4 &parentTrans) override;
void onSizeChanged() override;
void resetCursor();
bool cursorValid();
float getColWidth(int col);
float getRowHeight(int row);
// If update is false, will not call an onSizeChanged() which triggers
// a (potentially costly) repositioning + resizing of every element.
void setColWidthPerc(int col, float width, bool update = true);
// Dito.
void setRowHeightPerc(int row, float height, bool update = true);
bool moveCursor(glm::ivec2 dir);
void setCursorTo(const std::shared_ptr<GuiComponent>& comp);
std::shared_ptr<GuiComponent> getSelectedComponent()
{
const GridEntry* e = getCellAt(mCursor);
// Pass -1 for xPos or yPos to keep its axis cursor position.
void moveCursorTo(int xPos, int yPos, bool selectLeftCell = false);
void setCursorTo(const std::shared_ptr<GuiComponent> &comp);
std::shared_ptr<GuiComponent> getSelectedComponent() {
const GridEntry *e = getCellAt(mCursor);
if (e)
return e->component;
else
@ -77,6 +91,7 @@ public:
}
void onFocusLost() override;
void onFocusGained() override;
virtual std::vector<HelpPrompt> getHelpPrompts() override;
@ -114,20 +129,25 @@ private:
};
// Update position and size.
void updateCellComponent(const GridEntry& cell);
void updateCellComponent(const GridEntry &cell);
void updateSeparators();
void onCursorMoved(glm::ivec2 from, glm::ivec2 to);
const GridEntry* getCellAt(int x, int y) const;
const GridEntry* getCellAt(const glm::ivec2& pos) const { return getCellAt(pos.x, pos.y); }
const GridEntry *getCellAt(int x, int y) const;
const GridEntry *getCellAt(const glm::ivec2 &pos) const { return getCellAt(pos.x, pos.y); }
std::vector<std::vector<float>> mSeparators;
glm::ivec2 mGridSize;
std::vector<GridEntry> mCells;
glm::ivec2 mCursor;
float* mRowHeights;
float* mColWidths;
std::function<bool(InputConfig *config, Input input)> mPastBoundaryCallback;
float *mRowHeights;
float *mColWidths;
};
#endif // ES_CORE_COMPONENTS_COMPONENT_GRID_H

View file

@ -61,15 +61,20 @@ bool ComponentList::input(InputConfig* config, Input input)
if (size() == 0)
return false;
if (input.value &&
(config->isMappedTo("a", input) || config->isMappedLike("lefttrigger", input) ||
config->isMappedLike("righttrigger", input))) {
stopScrolling();
}
// Give it to the current row's input handler.
if (mEntries.at(mCursor).data.input_handler) {
if (mEntries.at(mCursor).data.input_handler(config, input))
return true;
}
else {
} else {
// No input handler assigned, do the default, which is to give it
// to the rightmost element in the row.
auto& row = mEntries.at(mCursor).data;
auto &row = mEntries.at(mCursor).data;
if (row.elements.size()) {
if (row.elements.back().component->input(config, input))
return true;
@ -190,15 +195,16 @@ void ComponentList::render(const glm::mat4& parentTrans)
// Draw our entries.
std::vector<GuiComponent*> drawAfterCursor;
bool drawAll;
for (unsigned int i = 0; i < mEntries.size(); i++) {
auto& entry = mEntries.at(i);
for (size_t i = 0; i < mEntries.size(); i++) {
auto &entry = mEntries.at(i);
drawAll = !mFocused || i != static_cast<unsigned int>(mCursor);
for (auto it = entry.data.elements.cbegin(); it != entry.data.elements.cend(); it++) {
if (drawAll || it->invert_when_selected) {
// For the row where the cursor is at, we want to remove any hue from the
// font or image before inverting, as it would otherwise lead to an ugly
// inverted color (e.g. red inverting to a green hue).
if (i == mCursor && it->component->getValue() != "") {
if (mFocused && i == static_cast<size_t>(mCursor) &&
it->component->getValue() != "") {
// Check if we're dealing with text or an image component.
bool isTextComponent = true;
unsigned int origColor = it->component->getColor();

View file

@ -12,17 +12,10 @@
#include "resources/Font.h"
#include "utils/StringUtil.h"
DateTimeEditComponent::DateTimeEditComponent(Window* window, bool alignRight, DisplayMode dispMode)
: GuiComponent(window)
, mEditing(false)
, mEditIndex(0)
, mDisplayMode(dispMode)
, mRelativeUpdateAccumulator(0)
, mColor(0x777777FF)
, mFont(Font::get(FONT_SIZE_SMALL, FONT_PATH_LIGHT))
, mUppercase(false)
, mAutoSize(true)
, mAlignRight(alignRight)
DateTimeEditComponent::DateTimeEditComponent(Window *window, bool alignRight, DisplayMode dispMode)
: GuiComponent(window), mEditing(false), mEditIndex(0), mDisplayMode(dispMode), mRelativeUpdateAccumulator(0),
mColor(0x777777FF), mFont(Font::get(FONT_SIZE_SMALL, FONT_PATH_LIGHT)), mAlignRight(alignRight),
mUppercase(false), mAutoSize(true)
{
updateTextCache();
}

View file

@ -0,0 +1,219 @@
// SPDX-License-Identifier: MIT
//
// EmulationStation Desktop Edition
// FlexboxComponent.cpp
//
// Flexbox layout component.
// Used by gamelist views.
//
#include "components/FlexboxComponent.h"
#include <numeric>
#include "Settings.h"
#include "ThemeData.h"
#include "resources/TextureResource.h"
FlexboxComponent::FlexboxComponent(Window* window)
: GuiComponent(window)
, mDirection(DEFAULT_DIRECTION)
, mAlign(DEFAULT_ALIGN)
, mItemsPerLine(DEFAULT_ITEMS_PER_LINE)
, mItemWidth(DEFAULT_ITEM_SIZE_X)
{
// Initialize item margins.
mItemMargin = glm::vec2{DEFAULT_MARGIN_X, DEFAULT_MARGIN_Y};
// Layout validity
mLayoutValid = false;
}
// Getters/Setters for rendering options.
void FlexboxComponent::setDirection(std::string value)
{
mDirection = value;
mLayoutValid = false;
}
std::string FlexboxComponent::getDirection() { return mDirection; }
void FlexboxComponent::setAlign(std::string value)
{
mAlign = value;
mLayoutValid = false;
}
std::string FlexboxComponent::getAlign() { return mAlign; }
void FlexboxComponent::setItemsPerLine(unsigned int value)
{
mItemsPerLine = value;
mLayoutValid = false;
}
unsigned int FlexboxComponent::getItemsPerLine() { return mItemsPerLine; }
void FlexboxComponent::setItemMargin(glm::vec2 value)
{
mItemMargin = value;
mLayoutValid = false;
}
glm::vec2 FlexboxComponent::getItemMargin() { return mItemMargin; }
void FlexboxComponent::setItemWidth(float value)
{
mItemWidth = value;
mLayoutValid = false;
}
float FlexboxComponent::getItemWidth() { return mItemWidth; }
void FlexboxComponent::onSizeChanged() {
mLayoutValid = false;
}
void FlexboxComponent::computeLayout()
{
// Start placing items in the top-left.
float anchorX = 0;
float anchorY = 0;
float anchorOriginX = 0;
float anchorOriginY = 0;
// Translation directions when placing items.
glm::vec2 directionLine = {1, 0};
glm::vec2 directionRow = {0, 1};
// Change direction.
if (mDirection == DIRECTION_COLUMN) {
directionLine = {0, 1};
directionRow = {1, 0};
}
// Set children sizes.
glm::vec2 maxItemSize = {0.0f, 0.0f};
for (auto i : mChildren) {
auto oldSize = i->getSize();
if (oldSize.x == 0)
oldSize.x = DEFAULT_ITEM_SIZE_X;
glm::vec2 newSize = {mItemWidth, oldSize.y * (mItemWidth / oldSize.x)};
i->setSize(newSize);
maxItemSize = {std::max(maxItemSize.x, newSize.x), std::max(maxItemSize.y, newSize.y)};
}
// Pre-compute layout parameters.
int n = mChildren.size();
int nLines = std::max(1, (int) std::ceil(n / std::max(1, (int) mItemsPerLine)));
float lineWidth =
(mDirection == "row" ? (maxItemSize.y + mItemMargin.y) : (maxItemSize.x + mItemMargin.x));
float anchorXStart = anchorX;
float anchorYStart = anchorY;
// Compute total container size.
glm::vec2 totalSize = {mItemMargin.x, mItemMargin.y};
if (mDirection == "row") {
totalSize.x += (mItemMargin.x + mItemWidth) * mItemsPerLine;
totalSize.y += (mItemMargin.y + maxItemSize.y) * nLines;
} else {
totalSize.x += (mItemMargin.x + mItemWidth) * nLines;
totalSize.y += (mItemMargin.y + maxItemSize.y) * mItemsPerLine;
}
// Iterate through the children.
for (int i = 0; i < n; i++) {
GuiComponent *child = mChildren[i];
auto size = child->getSize();
// Top-left anchor position.
float x = anchorX - anchorOriginX * size.x;
float y = anchorY - anchorOriginY * size.y;
// Apply item margin.
x += mItemMargin.x * (directionLine.x >= 0.0f ? 1.0f : -1.0f);
y += mItemMargin.y * (directionLine.y >= 0.0f ? 1.0f : -1.0f);
// Apply alignment
if (mAlign == ITEM_ALIGN_END) {
x += directionLine.x == 0 ? (maxItemSize.x - size.x) : 0;
y += directionLine.y == 0 ? (maxItemSize.y - size.y) : 0;
} else if (mAlign == ITEM_ALIGN_CENTER) {
x += directionLine.x == 0 ? (maxItemSize.x - size.x) / 2 : 0;
y += directionLine.y == 0 ? (maxItemSize.y - size.y) / 2 : 0;
} else if (mAlign == ITEM_ALIGN_STRETCH && mDirection == "row") {
child->setSize(child->getSize().x, maxItemSize.y);
}
// Apply origin.
if (mOrigin.x > 0 && mOrigin.x <= 1)
x -= mOrigin.x * totalSize.x;
if (mOrigin.y > 0 && mOrigin.y <= 1)
y -= mOrigin.y * totalSize.y;
// Store final item position.
child->setPosition(getPosition().x + x, getPosition().y + y);
// Translate anchor.
if ((i + 1) % std::max(1, (int) mItemsPerLine) != 0) {
// Translate on same line.
anchorX += (size.x + mItemMargin.x) * directionLine.x;
anchorY += (size.y + mItemMargin.y) * directionLine.y;
}
else {
// Translate to first position of next line.
if (directionRow.x == 0) {
anchorY += lineWidth * directionRow.y;
anchorX = anchorXStart;
} else {
anchorX += lineWidth * directionRow.x;
anchorY = anchorYStart;
}
}
}
mLayoutValid = true;
}
void FlexboxComponent::render(const glm::mat4& parentTrans) {
if (!isVisible())
return;
if (!mLayoutValid)
computeLayout();
renderChildren(parentTrans);
}
void FlexboxComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
const std::string& view,
const std::string& element,
unsigned int properties)
{
using namespace ThemeFlags;
glm::vec2 scale{getParent() ? getParent()->getSize() :
glm::vec2{static_cast<float>(Renderer::getScreenWidth()),
static_cast<float>(Renderer::getScreenHeight())}};
// TODO: How to do this without explicit 'badges' property?
const ThemeData::ThemeElement* elem = theme->getElement(view, element, "badges");
if (!elem)
return;
if (properties & DIRECTION && elem->has("direction"))
mDirection = elem->get<std::string>("direction");
if (elem->has("align"))
mAlign = elem->get<std::string>("align");
if (elem->has("itemsPerLine"))
mItemsPerLine = elem->get<float>("itemsPerLine");
if (elem->has("itemMargin"))
mItemMargin = elem->get<glm::vec2>("itemMargin");
if (elem->has("itemWidth"))
mItemWidth = elem->get<float>("itemWidth") * scale.x;
GuiComponent::applyTheme(theme, view, element, properties);
// Layout no longer valid.
mLayoutValid = false;
}
std::vector<HelpPrompt> FlexboxComponent::getHelpPrompts()
{
std::vector<HelpPrompt> prompts;
return prompts;
}

View file

@ -0,0 +1,72 @@
// SPDX-License-Identifier: MIT
//
// EmulationStation Desktop Edition
// FlexboxComponent.h
//
// Flexbox layout component.
// Used by gamelist views.
//
#ifndef ES_APP_COMPONENTS_FLEXBOX_COMPONENT_H
#define ES_APP_COMPONENTS_FLEXBOX_COMPONENT_H
#include "GuiComponent.h"
#include "renderers/Renderer.h"
// Definitions for the option values.
#define DIRECTION_ROW "row"
#define DIRECTION_COLUMN "column"
#define ITEM_ALIGN_START "start"
#define ITEM_ALIGN_END "end"
#define ITEM_ALIGN_CENTER "center"
#define ITEM_ALIGN_STRETCH "stretch"
// Default values.
#define DEFAULT_DIRECTION DIRECTION_ROW
#define DEFAULT_ALIGN ITEM_ALIGN_CENTER
#define DEFAULT_ITEMS_PER_LINE 4
#define DEFAULT_MARGIN_X 10.0f
#define DEFAULT_MARGIN_Y 10.0f
#define DEFAULT_ITEM_SIZE_X 64.0f
class TextureResource;
class FlexboxComponent : public GuiComponent
{
public:
FlexboxComponent(Window* window);
// Getters/Setters for rendering options.
void setDirection(std::string value);
std::string getDirection();
void setAlign(std::string value);
std::string getAlign();
void setItemsPerLine(unsigned int value);
unsigned int getItemsPerLine();
void setItemMargin(glm::vec2 value);
glm::vec2 getItemMargin();
void setItemWidth(float value);
float getItemWidth();
void onSizeChanged() override;
void render(const glm::mat4& parentTrans) override;
virtual void applyTheme(const std::shared_ptr<ThemeData>& theme,
const std::string& view,
const std::string& element,
unsigned int properties) override;
virtual std::vector<HelpPrompt> getHelpPrompts() override;
private:
// Calculate flexbox layout.
void computeLayout();
// Rendering options.
std::string mDirection;
std::string mAlign;
unsigned int mItemsPerLine;
glm::vec2 mItemMargin;
float mItemWidth;
bool mLayoutValid;
};
#endif // ES_APP_COMPONENTS_FLEXBOX_COMPONENT_H

View file

@ -315,7 +315,7 @@ std::shared_ptr<TextureResource> GridTileComponent::getTexture()
return mImage->getTexture();
return nullptr;
};
}
void GridTileComponent::forceSize(glm::vec2 size, float selectedZoom)
{

View file

@ -37,32 +37,36 @@ void HelpComponent::assignIcons()
":/help/dpad_updown.svg" :
mStyle.mCustomButtons.dpad_updown;
sIconPathMap["left/right"] = mStyle.mCustomButtons.dpad_leftright.empty() ?
":/help/dpad_leftright.svg" :
mStyle.mCustomButtons.dpad_leftright;
":/help/dpad_leftright.svg" :
mStyle.mCustomButtons.dpad_leftright;
sIconPathMap["up/down/left/right"] = mStyle.mCustomButtons.dpad_all.empty() ?
":/help/dpad_all.svg" :
mStyle.mCustomButtons.dpad_all;
":/help/dpad_all.svg" :
mStyle.mCustomButtons.dpad_all;
sIconPathMap["thumbstickclick"] = mStyle.mCustomButtons.thumbstick_click.empty() ?
":/help/thumbstick_click.svg" :
mStyle.mCustomButtons.thumbstick_click;
":/help/thumbstick_click.svg" :
mStyle.mCustomButtons.thumbstick_click;
sIconPathMap["l"] = mStyle.mCustomButtons.button_l.empty() ? ":/help/button_l.svg" :
mStyle.mCustomButtons.button_l;
mStyle.mCustomButtons.button_l;
sIconPathMap["r"] = mStyle.mCustomButtons.button_r.empty() ? ":/help/button_r.svg" :
mStyle.mCustomButtons.button_r;
mStyle.mCustomButtons.button_r;
sIconPathMap["lr"] = mStyle.mCustomButtons.button_lr.empty() ? ":/help/button_lr.svg" :
mStyle.mCustomButtons.button_lr;
mStyle.mCustomButtons.button_lr;
sIconPathMap["lt"] = mStyle.mCustomButtons.button_lt.empty() ? ":/help/button_lt.svg" :
mStyle.mCustomButtons.button_lt;
sIconPathMap["rt"] = mStyle.mCustomButtons.button_rt.empty() ? ":/help/button_rt.svg" :
mStyle.mCustomButtons.button_rt;
// These graphics files are custom per controller type.
if (controllerType == "snes") {
sIconPathMap["a"] = mStyle.mCustomButtons.button_a_SNES.empty() ?
":/help/button_a_SNES.svg" :
mStyle.mCustomButtons.button_a_SNES;
":/help/button_a_SNES.svg" :
mStyle.mCustomButtons.button_a_SNES;
sIconPathMap["b"] = mStyle.mCustomButtons.button_b_SNES.empty() ?
":/help/button_b_SNES.svg" :
mStyle.mCustomButtons.button_b_SNES;
":/help/button_b_SNES.svg" :
mStyle.mCustomButtons.button_b_SNES;
sIconPathMap["x"] = mStyle.mCustomButtons.button_x_SNES.empty() ?
":/help/button_x_SNES.svg" :
mStyle.mCustomButtons.button_x_SNES;
":/help/button_x_SNES.svg" :
mStyle.mCustomButtons.button_x_SNES;
sIconPathMap["y"] = mStyle.mCustomButtons.button_y_SNES.empty() ?
":/help/button_y_SNES.svg" :
mStyle.mCustomButtons.button_y_SNES;

View file

@ -137,7 +137,7 @@ public:
const UserData& getNext() const
{
// If there is a next entry, then return it, otherwise return the current entry.
if (mCursor + 1 < mEntries.size())
if (mCursor + 1 < static_cast<int>(mEntries.size()))
return mEntries.at(mCursor + 1).object;
else
return mEntries.at(mCursor).object;

View file

@ -27,23 +27,11 @@ glm::vec2 ImageComponent::getSize() const
return GuiComponent::getSize() * (mBottomRightCrop - mTopLeftCrop);
}
ImageComponent::ImageComponent(Window* window, bool forceLoad, bool dynamic)
: GuiComponent(window)
, mTargetIsMax(false)
, mTargetIsMin(false)
, mFlipX(false)
, mFlipY(false)
, mTargetSize(0, 0)
, mColorShift(0xFFFFFFFF)
, mColorShiftEnd(0xFFFFFFFF)
, mColorGradientHorizontal(true)
, mForceLoad(forceLoad)
, mDynamic(dynamic)
, mFadeOpacity(0)
, mFading(false)
, mRotateByTargetSize(false)
, mTopLeftCrop(0.0f, 0.0f)
, mBottomRightCrop(1.0f, 1.0f)
ImageComponent::ImageComponent(Window *window, bool forceLoad, bool dynamic)
: GuiComponent(window), mTargetSize({}), mFlipX(false), mFlipY(false), mTargetIsMax(false), mTargetIsMin(false),
mColorShift(0xFFFFFFFF), mColorShiftEnd(0xFFFFFFFF), mColorGradientHorizontal(true), mFadeOpacity(0),
mFading(false), mForceLoad(forceLoad), mDynamic(dynamic), mRotateByTargetSize(false), mTopLeftCrop({}),
mBottomRightCrop(1.0f, 1.0f)
{
updateColors();
}
@ -77,7 +65,7 @@ void ImageComponent::resize()
// This will be mTargetSize.x. We can't exceed it, nor be lower than it.
mSize.x *= resizeScale.x;
// We need to make sure we're not creating an image larger than max size.
mSize.y = std::min(floorf(mSize.y *= resizeScale.x), mTargetSize.y);
mSize.y = std::min(floorf(mSize.y * resizeScale.x), mTargetSize.y);
}
else {
// This will be mTargetSize.y(). We can't exceed it.

View file

@ -101,7 +101,10 @@ public:
private:
glm::vec2 mTargetSize;
bool mFlipX, mFlipY, mTargetIsMax, mTargetIsMin;
bool mFlipX;
bool mFlipY;
bool mTargetIsMax;
bool mTargetIsMin;
// Calculates the correct mSize from our resizing information (set by setResize/setMaxSize).
// Used internally whenever the resizing parameters or texture change.

View file

@ -394,7 +394,7 @@ template <typename T> void ImageGridComponent<T>::onCursorChanged(const CursorSt
bool direction = mCursor >= mLastCursor;
int diff = direction ? mCursor - mLastCursor : mLastCursor - mCursor;
if (isScrollLoop() && diff == mEntries.size() - 1)
if (isScrollLoop() && diff == static_cast<int>(mEntries.size()) - 1)
direction = !direction;
int oldStart = mStartPosition;
@ -426,18 +426,18 @@ template <typename T> void ImageGridComponent<T>::onCursorChanged(const CursorSt
std::shared_ptr<GridTileComponent> newTile = nullptr;
int oldIdx = mLastCursor - mStartPosition + (dimOpposite * EXTRAITEMS);
if (oldIdx >= 0 && oldIdx < mTiles.size())
if (oldIdx >= 0 && oldIdx < static_cast<int>(mTiles.size()))
oldTile = mTiles[oldIdx];
int newIdx = mCursor - mStartPosition + (dimOpposite * EXTRAITEMS);
if (isScrollLoop()) {
if (newIdx < 0)
newIdx += static_cast<int>(mEntries.size());
else if (newIdx >= mTiles.size())
else if (newIdx >= static_cast<int>(mTiles.size()))
newIdx -= static_cast<int>(mEntries.size());
}
if (newIdx >= 0 && newIdx < mTiles.size())
if (newIdx >= 0 && newIdx < static_cast<int>(mTiles.size()))
newTile = mTiles[newIdx];
for (auto it = mTiles.begin(); it != mTiles.end(); it++) {
@ -670,7 +670,7 @@ void ImageGridComponent<T>::updateTileAtPos(int tilePos,
int dif = mCursor - tilePos;
int idx = mLastCursor - dif;
if (idx < 0 || idx >= mTiles.size())
if (idx < 0 || idx >= static_cast<int>(mTiles.size()))
idx = 0;
glm::vec3 pos{mTiles.at(idx)->getBackgroundPosition()};
@ -720,8 +720,10 @@ template <typename T> bool ImageGridComponent<T>::isScrollLoop()
if (!mScrollLoop)
return false;
if (isVertical())
return (mGridDimension.x * (mGridDimension.y - 2 * EXTRAITEMS)) <= mEntries.size();
return (mGridDimension.y * (mGridDimension.x - 2 * EXTRAITEMS)) <= mEntries.size();
return (mGridDimension.x * (mGridDimension.y - 2 * EXTRAITEMS)) <=
static_cast<int>(mEntries.size());
return (mGridDimension.y * (mGridDimension.x - 2 * EXTRAITEMS)) <=
static_cast<int>(mEntries.size());
}
#endif // ES_CORE_COMPONENTS_IMAGE_GRID_COMPONENT_H

View file

@ -17,11 +17,11 @@ NinePatchComponent::NinePatchComponent(Window* window,
unsigned int edgeColor,
unsigned int centerColor)
: GuiComponent(window)
, mVertices(nullptr)
, mPath(path)
, mCornerSize(16.0f, 16.0f)
, mEdgeColor(edgeColor)
, mCenterColor(centerColor)
, mPath(path)
, mVertices(nullptr)
{
if (!mPath.empty())
buildVertices();
@ -95,13 +95,13 @@ void NinePatchComponent::buildVertices()
const glm::vec2 imgPos{imgPosX[sliceX], imgPosY[sliceY]};
const glm::vec2 imgSize{imgSizeX[sliceX], imgSizeY[sliceY]};
const glm::vec2 texPos{texPosX[sliceX], texPosY[sliceY]};
const glm::vec2 texSize{texSizeX[sliceX], texSizeY[sliceY]};
const glm::vec2 texSizeSlice{texSizeX[sliceX], texSizeY[sliceY]};
// clang-format off
mVertices[v + 1] = {{imgPos.x , imgPos.y }, {texPos.x, texPos.y }, 0};
mVertices[v + 2] = {{imgPos.x , imgPos.y + imgSize.y}, {texPos.x, texPos.y + texSize.y}, 0};
mVertices[v + 3] = {{imgPos.x + imgSize.x, imgPos.y }, {texPos.x + texSize.x, texPos.y }, 0};
mVertices[v + 4] = {{imgPos.x + imgSize.x, imgPos.y + imgSize.y}, {texPos.x + texSize.x, texPos.y + texSize.y}, 0};
mVertices[v + 1] = {{imgPos.x , imgPos.y }, {texPos.x, texPos.y }, 0};
mVertices[v + 2] = {{imgPos.x , imgPos.y + imgSize.y}, {texPos.x, texPos.y + texSizeSlice.y}, 0};
mVertices[v + 3] = {{imgPos.x + imgSize.x, imgPos.y }, {texPos.x + texSizeSlice.x, texPos.y }, 0};
mVertices[v + 4] = {{imgPos.x + imgSize.x, imgPos.y + imgSize.y}, {texPos.x + texSizeSlice.x, texPos.y + texSizeSlice.y}, 0};
// clang-format on
// Round vertices.

View file

@ -288,9 +288,9 @@ private:
OptionListComponent<T>* parent,
const std::string& title)
: GuiComponent(window)
, mHelpStyle(helpstyle)
, mMenu(window, title.c_str())
, mParent(parent)
, mHelpStyle(helpstyle)
{
auto font = Font::get(FONT_SIZE_MEDIUM);
ComponentListRow row;

View file

@ -15,12 +15,12 @@
RatingComponent::RatingComponent(Window* window, bool colorizeChanges)
: GuiComponent(window)
, mColorOriginalValue(DEFAULT_COLORSHIFT)
, mColorChangedValue(DEFAULT_COLORSHIFT)
, mColorShift(DEFAULT_COLORSHIFT)
, mColorShiftEnd(DEFAULT_COLORSHIFT)
, mUnfilledColor(DEFAULT_COLORSHIFT)
, mColorizeChanges(colorizeChanges)
, mColorOriginalValue(DEFAULT_COLORSHIFT)
, mColorChangedValue(DEFAULT_COLORSHIFT)
{
mFilledTexture = TextureResource::get(":/graphics/star_filled.svg", true);
mUnfilledTexture = TextureResource::get(":/graphics/star_unfilled.svg", true);

View file

@ -16,13 +16,13 @@
ScrollableContainer::ScrollableContainer(Window* window)
: GuiComponent(window)
, mScrollPos({})
, mScrollDir({})
, mFontSize(0.0f)
, mAutoScrollDelay(0)
, mAutoScrollSpeed(0)
, mAutoScrollAccumulator(0)
, mScrollPos(0, 0)
, mScrollDir(0, 0)
, mAutoScrollResetAccumulator(0)
, mFontSize(0.0f)
{
// Set the modifier to get equivalent scrolling speed regardless of screen resolution.
mResolutionModifier = Renderer::getScreenHeightModifier();

View file

@ -110,8 +110,6 @@ void SliderComponent::setValue(float value)
onValueChanged();
}
float SliderComponent::getValue() { return mValue; }
void SliderComponent::onSizeChanged()
{
if (!mSuffix.empty())

View file

@ -19,13 +19,16 @@ class TextCache;
class SliderComponent : public GuiComponent
{
public:
using GuiComponent::getValue;
using GuiComponent::setValue;
// Minimum value (far left of the slider), maximum value (far right of the slider),
// increment size (how much pressing L/R moves by), unit to display (optional).
SliderComponent(
Window* window, float min, float max, float increment, const std::string& suffix = "");
void setValue(float val);
float getValue();
void setValue(float value);
float getValue() { return mValue; }
bool input(InputConfig* config, Input input) override;
void update(int deltaTime) override;

View file

@ -15,16 +15,16 @@
TextComponent::TextComponent(Window* window)
: GuiComponent(window)
, mFont(Font::get(FONT_SIZE_MEDIUM))
, mUppercase(false)
, mColor(0x000000FF)
, mBgColor(0)
, mMargin(0.0f)
, mRenderBackground(false)
, mUppercase(false)
, mAutoCalcExtent(true, true)
, mHorizontalAlignment(ALIGN_LEFT)
, mVerticalAlignment(ALIGN_CENTER)
, mLineSpacing(1.5f)
, mNoTopMargin(false)
, mBgColor(0)
, mMargin(0.0f)
, mRenderBackground(false)
{
}
@ -39,16 +39,16 @@ TextComponent::TextComponent(Window* window,
float margin)
: GuiComponent(window)
, mFont(nullptr)
, mUppercase(false)
, mColor(0x000000FF)
, mBgColor(0)
, mMargin(margin)
, mRenderBackground(false)
, mUppercase(false)
, mAutoCalcExtent(true, true)
, mHorizontalAlignment(align)
, mVerticalAlignment(ALIGN_CENTER)
, mLineSpacing(1.5f)
, mNoTopMargin(false)
, mBgColor(0)
, mMargin(margin)
, mRenderBackground(false)
{
setFont(font);
setColor(color);

View file

@ -10,25 +10,27 @@
#include "utils/StringUtil.h"
#define TEXT_PADDING_HORIZ 10.0f
#define TEXT_PADDING_HORIZ 12.0f
#define TEXT_PADDING_VERT 2.0f
#define CURSOR_REPEAT_START_DELAY 500
#define CURSOR_REPEAT_SPEED 28 // Lower is faster.
#define BLINKTIME 1000
TextEditComponent::TextEditComponent(Window* window)
: GuiComponent(window)
, mBox(window, ":/graphics/textinput.svg")
, mFocused(false)
, mScrollOffset(0.0f, 0.0f)
, mCursor(0)
, mEditing(false)
, mFont(Font::get(FONT_SIZE_MEDIUM, FONT_PATH_LIGHT))
, mCursorRepeatDir(0)
: GuiComponent{window}
, mFocused{false}
, mEditing{false}
, mCursor{0}
, mBlinkTime{0}
, mCursorRepeatDir{0}
, mScrollOffset{0.0f, 0.0f}
, mBox{window, ":/graphics/textinput.svg"}
, mFont{Font::get(FONT_SIZE_MEDIUM, FONT_PATH_LIGHT)}
{
addChild(&mBox);
onFocusLost();
mResolutionAdjustment = -(34.0f * Renderer::getScreenWidthModifier() - 34.0f);
setSize(4096, mFont->getHeight() + (TEXT_PADDING_VERT * Renderer::getScreenHeightModifier()));
}
@ -36,6 +38,7 @@ void TextEditComponent::onFocusGained()
{
mFocused = true;
mBox.setImagePath(":/graphics/textinput_focused.svg");
startEditing();
}
void TextEditComponent::onFocusLost()
@ -46,9 +49,9 @@ void TextEditComponent::onFocusLost()
void TextEditComponent::onSizeChanged()
{
mBox.fitTo(mSize, glm::vec3{},
glm::vec2{-34.0f + mResolutionAdjustment,
-32.0f - (TEXT_PADDING_VERT * Renderer::getScreenHeightModifier())});
mBox.fitTo(
mSize, glm::vec3{},
glm::vec2{-34.0f, -32.0f - (TEXT_PADDING_VERT * Renderer::getScreenHeightModifier())});
onTextChanged(); // Wrap point probably changed.
}
@ -62,6 +65,7 @@ void TextEditComponent::setValue(const std::string& val)
void TextEditComponent::textInput(const std::string& text)
{
if (mEditing) {
mBlinkTime = 0;
mCursorRepeatDir = 0;
if (text[0] == '\b') {
if (mCursor > 0) {
@ -80,19 +84,35 @@ void TextEditComponent::textInput(const std::string& text)
onCursorChanged();
}
std::string TextEditComponent::getValue() const
{
if (mText.empty())
return "";
// If mText only contains whitespace characters, then return an empty string.
if (std::find_if(mText.cbegin(), mText.cend(), [](char c) {
return !std::isspace(static_cast<unsigned char>(c));
}) == mText.cend()) {
return "";
}
else {
return mText;
}
}
void TextEditComponent::startEditing()
{
if (!isMultiline())
setCursor(mText.size());
SDL_StartTextInput();
mEditing = true;
updateHelpPrompts();
mBlinkTime = BLINKTIME / 6;
}
void TextEditComponent::stopEditing()
{
SDL_StopTextInput();
mEditing = false;
mCursorRepeatDir = 0;
updateHelpPrompts();
}
@ -141,41 +161,33 @@ bool TextEditComponent::input(InputConfig* config, Input input)
return true;
}
// Done editing (accept changes).
if ((config->getDeviceId() == DEVICE_KEYBOARD && input.id == SDLK_ESCAPE) ||
(config->getDeviceId() != DEVICE_KEYBOARD &&
(config->isMappedTo("a", input) || config->isMappedTo("b", input)))) {
mTextOrig = mText;
stopEditing();
return true;
}
else if (cursor_left || cursor_right) {
if (cursor_left || cursor_right) {
mBlinkTime = 0;
mCursorRepeatDir = cursor_left ? -1 : 1;
mCursorRepeatTimer = -(CURSOR_REPEAT_START_DELAY - CURSOR_REPEAT_SPEED);
moveCursor(mCursorRepeatDir);
}
else if (cursor_up) {
// TODO
}
// Stop editing and let the button down event be captured by the parent component.
else if (cursor_down) {
// TODO
stopEditing();
return false;
}
else if (shoulder_left || shoulder_right) {
mBlinkTime = 0;
mCursorRepeatDir = shoulder_left ? -10 : 10;
mCursorRepeatTimer = -(CURSOR_REPEAT_START_DELAY - CURSOR_REPEAT_SPEED);
moveCursor(mCursorRepeatDir);
}
// Jump to beginning of text.
else if (trigger_left) {
mBlinkTime = 0;
setCursor(0);
}
// Jump to end of text.
else if (trigger_right) {
mBlinkTime = 0;
setCursor(mText.length());
}
else if (config->getDeviceId() != DEVICE_KEYBOARD && config->isMappedTo("y", input)) {
textInput("\b");
}
else if (config->getDeviceId() == DEVICE_KEYBOARD) {
switch (input.id) {
case SDLK_HOME: {
@ -187,7 +199,7 @@ bool TextEditComponent::input(InputConfig* config, Input input)
break;
}
case SDLK_DELETE: {
if (mCursor < mText.length()) {
if (mCursor < static_cast<int>(mText.length())) {
// Fake as Backspace one char to the right.
moveCursor(1);
textInput("\b");
@ -207,6 +219,10 @@ void TextEditComponent::update(int deltaTime)
{
updateCursorRepeat(deltaTime);
GuiComponent::update(deltaTime);
mBlinkTime += deltaTime;
if (mBlinkTime >= BLINKTIME)
mBlinkTime = 0;
}
void TextEditComponent::updateCursorRepeat(int deltaTime)
@ -216,6 +232,7 @@ void TextEditComponent::updateCursorRepeat(int deltaTime)
mCursorRepeatTimer += deltaTime;
while (mCursorRepeatTimer >= CURSOR_REPEAT_SPEED) {
mBlinkTime = 0;
moveCursor(mCursorRepeatDir);
mCursorRepeatTimer -= CURSOR_REPEAT_SPEED;
}
@ -244,7 +261,7 @@ void TextEditComponent::onTextChanged()
mFont->buildTextCache(wrappedText, 0.0f, 0.0f, 0x77777700 | getOpacity()));
if (mCursor > static_cast<int>(mText.length()))
mCursor = static_cast<unsigned int>(mText.length());
mCursor = static_cast<int>(mText.length());
}
void TextEditComponent::onCursorChanged()
@ -298,34 +315,39 @@ void TextEditComponent::render(const glm::mat4& parentTrans)
Renderer::popClipRect();
// Draw cursor.
if (mEditing) {
glm::vec2 cursorPos;
if (isMultiline()) {
cursorPos = mFont->getWrappedTextCursorOffset(mText, getTextAreaSize().x, mCursor);
}
else {
cursorPos = mFont->sizeText(mText.substr(0, mCursor));
cursorPos[1] = 0;
}
glm::vec2 cursorPos;
if (isMultiline()) {
cursorPos = mFont->getWrappedTextCursorOffset(mText, getTextAreaSize().x, mCursor);
}
else {
cursorPos = mFont->sizeText(mText.substr(0, mCursor));
cursorPos[1] = 0;
}
float cursorHeight = mFont->getHeight() * 0.8f;
float cursorHeight = mFont->getHeight() * 0.8f;
if (!mEditing) {
Renderer::drawRect(cursorPos.x, cursorPos.y + (mFont->getHeight() - cursorHeight) / 2.0f,
2.0f * Renderer::getScreenWidthModifier(), cursorHeight, 0x000000FF,
0x000000FF);
2.0f * Renderer::getScreenWidthModifier(), cursorHeight, 0xC7C7C7FF,
0xC7C7C7FF);
}
if (mEditing && mBlinkTime < BLINKTIME / 2) {
Renderer::drawRect(cursorPos.x, cursorPos.y + (mFont->getHeight() - cursorHeight) / 2.0f,
2.0f * Renderer::getScreenWidthModifier(), cursorHeight, 0x777777FF,
0x777777FF);
}
}
glm::vec2 TextEditComponent::getTextAreaPos() const
{
return glm::vec2{
(-mResolutionAdjustment + (TEXT_PADDING_HORIZ * Renderer::getScreenWidthModifier())) / 2.0f,
(TEXT_PADDING_VERT * Renderer::getScreenHeightModifier()) / 2.0f};
return glm::vec2{(TEXT_PADDING_HORIZ * Renderer::getScreenWidthModifier()) / 2.0f,
(TEXT_PADDING_VERT * Renderer::getScreenHeightModifier()) / 2.0f};
}
glm::vec2 TextEditComponent::getTextAreaSize() const
{
return glm::vec2{mSize.x + mResolutionAdjustment -
(TEXT_PADDING_HORIZ * Renderer::getScreenWidthModifier()),
return glm::vec2{mSize.x - (TEXT_PADDING_HORIZ * Renderer::getScreenWidthModifier()),
mSize.y - (TEXT_PADDING_VERT * Renderer::getScreenHeightModifier())};
}
@ -333,10 +355,10 @@ std::vector<HelpPrompt> TextEditComponent::getHelpPrompts()
{
std::vector<HelpPrompt> prompts;
if (mEditing) {
prompts.push_back(HelpPrompt("up/down/left/right", "move cursor"));
prompts.push_back(HelpPrompt("y", "backspace"));
prompts.push_back(HelpPrompt("a", "accept changes"));
prompts.push_back(HelpPrompt("b", "accept changes"));
prompts.push_back(HelpPrompt("lt", "first"));
prompts.push_back(HelpPrompt("rt", "last"));
prompts.push_back(HelpPrompt("left/right", "move cursor"));
prompts.push_back(HelpPrompt("b", "back"));
}
else {
prompts.push_back(HelpPrompt("a", "edit"));

View file

@ -33,7 +33,7 @@ public:
void onSizeChanged() override;
void setValue(const std::string& val) override;
std::string getValue() const override { return mText; }
std::string getValue() const override;
void startEditing();
void stopEditing();
@ -60,7 +60,8 @@ private:
std::string mTextOrig;
bool mFocused;
bool mEditing;
unsigned int mCursor; // Cursor position in characters.
int mCursor; // Cursor position in characters.
int mBlinkTime;
int mCursorRepeatTimer;
int mCursorRepeatDir;
@ -68,7 +69,6 @@ private:
glm::vec2 mScrollOffset;
NinePatchComponent mBox;
float mResolutionAdjustment;
std::shared_ptr<Font> mFont;
std::unique_ptr<TextCache> mTextCache;

View file

@ -42,6 +42,7 @@ public:
using IList<TextListData, T>::size;
using IList<TextListData, T>::isScrolling;
using IList<TextListData, T>::stopScrolling;
using GuiComponent::setColor;
TextListComponent(Window* window);
@ -61,7 +62,11 @@ public:
ALIGN_RIGHT
};
void setAlignment(Alignment align) { mAlignment = align; }
void setAlignment(Alignment align)
{
// Set alignment.
mAlignment = align;
}
void setCursorChangedCallback(const std::function<void(CursorState state)>& func)
{

View file

@ -22,8 +22,11 @@ VideoComponent::VideoComponent(Window* window)
: GuiComponent(window)
, mWindow(window)
, mStaticImage(window)
, mVideoHeight(0)
, mVideoWidth(0)
, mVideoHeight(0)
, mTargetSize(0, 0)
, mVideoAreaPos(0, 0)
, mVideoAreaSize(0, 0)
, mStartDelayed(false)
, mIsPlaying(false)
, mIsActuallyPlaying(false)
@ -37,9 +40,6 @@ VideoComponent::VideoComponent(Window* window)
, mBlockPlayer(false)
, mTargetIsMax(false)
, mFadeIn(1.0)
, mTargetSize(0, 0)
, mVideoAreaPos(0, 0)
, mVideoAreaSize(0, 0)
{
// Setup the default configuration.
mConfig.showSnapshotDelay = false;

View file

@ -108,6 +108,8 @@ private:
protected:
Window* mWindow;
ImageComponent mStaticImage;
unsigned mVideoWidth;
unsigned mVideoHeight;
glm::vec2 mTargetSize;
@ -115,7 +117,6 @@ protected:
glm::vec2 mVideoAreaSize;
std::shared_ptr<TextureResource> mTexture;
std::string mStaticImagePath;
ImageComponent mStaticImage;
std::string mVideoPath;
std::string mPlayingVideoPath;

View file

@ -44,9 +44,9 @@ VideoFFmpegComponent::VideoFFmpegComponent(Window* window)
, mAFilterGraph(nullptr)
, mAFilterInputs(nullptr)
, mAFilterOutputs(nullptr)
, mVideoTimeBase(0.0l)
, mVideoTargetQueueSize(0)
, mAudioTargetQueueSize(0)
, mVideoTimeBase(0.0l)
, mAccumulatedTime(0)
, mStartTimeAccumulation(false)
, mDecodedFrame(false)
@ -529,8 +529,9 @@ void VideoFFmpegComponent::readFrames()
return;
if (mVideoCodecContext && mFormatContext) {
if (mVideoFrameQueue.size() < mVideoTargetQueueSize ||
(mAudioStreamIndex >= 0 && mAudioFrameQueue.size() < mAudioTargetQueueSize)) {
if (static_cast<int>(mVideoFrameQueue.size()) < mVideoTargetQueueSize ||
(mAudioStreamIndex >= 0 &&
static_cast<int>(mAudioFrameQueue.size()) < mAudioTargetQueueSize)) {
while ((readFrameReturn = av_read_frame(mFormatContext, mPacket)) >= 0) {
if (mPacket->stream_index == mVideoStreamIndex) {
if (!avcodec_send_packet(mVideoCodecContext, mPacket) &&

View file

@ -34,8 +34,8 @@ libvlc_instance_t* VideoVlcComponent::mVLC = nullptr;
VideoVlcComponent::VideoVlcComponent(Window* window)
: VideoComponent(window)
, mMediaPlayer(nullptr)
, mMedia(nullptr)
, mMediaPlayer(nullptr)
, mContext({})
, mHasSetAudioVolume(false)
{

View file

@ -1,155 +0,0 @@
// SPDX-License-Identifier: MIT
//
// EmulationStation Desktop Edition
// GuiComplexTextEditPopup.cpp
//
// Text edit popup with a title, two text strings, a text input box and buttons
// to load the second text string and to clear the input field.
// Intended for updating settings for configuration files and similar.
//
#include "guis/GuiComplexTextEditPopup.h"
#include "Window.h"
#include "components/ButtonComponent.h"
#include "components/MenuComponent.h"
#include "components/TextEditComponent.h"
#include "guis/GuiMsgBox.h"
GuiComplexTextEditPopup::GuiComplexTextEditPopup(
Window* window,
const HelpStyle& helpstyle,
const std::string& title,
const std::string& infoString1,
const std::string& infoString2,
const std::string& initValue,
const std::function<void(const std::string&)>& okCallback,
bool multiLine,
const std::string& acceptBtnText,
const std::string& saveConfirmationText,
const std::string& loadBtnText,
const std::string& loadBtnHelpText,
const std::string& clearBtnText,
const std::string& clearBtnHelpText,
bool hideCancelButton)
: GuiComponent(window)
, mHelpStyle(helpstyle)
, mBackground(window, ":/graphics/frame.svg")
, mGrid(window, glm::ivec2{1, 5})
, mMultiLine(multiLine)
, mInitValue(initValue)
, mOkCallback(okCallback)
, mSaveConfirmationText(saveConfirmationText)
, mHideCancelButton(hideCancelButton)
{
addChild(&mBackground);
addChild(&mGrid);
mTitle = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(title),
Font::get(FONT_SIZE_MEDIUM), 0x555555FF, ALIGN_CENTER);
mInfoString1 = std::make_shared<TextComponent>(mWindow, infoString1, Font::get(FONT_SIZE_SMALL),
0x555555FF, ALIGN_CENTER);
mInfoString2 = std::make_shared<TextComponent>(mWindow, infoString2, Font::get(FONT_SIZE_SMALL),
0x555555FF, ALIGN_CENTER);
mText = std::make_shared<TextEditComponent>(mWindow);
mText->setValue(initValue);
std::vector<std::shared_ptr<ButtonComponent>> buttons;
buttons.push_back(std::make_shared<ButtonComponent>(mWindow, acceptBtnText, acceptBtnText,
[this, okCallback] {
okCallback(mText->getValue());
delete this;
}));
buttons.push_back(std::make_shared<ButtonComponent>(mWindow, loadBtnText, loadBtnHelpText,
[this, infoString2] {
mText->setValue(infoString2);
mText->setCursor(0);
mText->setCursor(infoString2.size());
}));
buttons.push_back(std::make_shared<ButtonComponent>(mWindow, clearBtnText, clearBtnHelpText,
[this] { mText->setValue(""); }));
if (!mHideCancelButton)
buttons.push_back(std::make_shared<ButtonComponent>(mWindow, "CANCEL", "discard changes",
[this] { delete this; }));
mButtonGrid = makeButtonGrid(mWindow, buttons);
mGrid.setEntry(mTitle, glm::ivec2{0, 0}, false, true);
mGrid.setEntry(mInfoString1, glm::ivec2{0, 1}, false, true);
mGrid.setEntry(mInfoString2, glm::ivec2{0, 2}, false, false);
mGrid.setEntry(mText, glm::ivec2{0, 3}, true, false, glm::ivec2{1, 1},
GridFlags::BORDER_TOP | GridFlags::BORDER_BOTTOM);
mGrid.setEntry(mButtonGrid, glm::ivec2{0, 4}, true, false);
mGrid.setRowHeightPerc(1, 0.15f, true);
float textHeight = mText->getFont()->getHeight();
if (multiLine)
textHeight *= 6.0f;
// Adjust the width relative to the aspect ratio of the screen to make the GUI look coherent
// regardless of screen type. The 1.778 aspect ratio value is the 16:9 reference.
float aspectValue = 1.778f / Renderer::getScreenAspectRatio();
float infoWidth = glm::clamp(0.70f * aspectValue, 0.60f, 0.85f) * Renderer::getScreenWidth();
float windowWidth = glm::clamp(0.75f * aspectValue, 0.65f, 0.90f) * Renderer::getScreenWidth();
mText->setSize(0, textHeight);
mInfoString2->setSize(infoWidth, mInfoString2->getFont()->getHeight());
setSize(windowWidth, mTitle->getFont()->getHeight() + textHeight + mButtonGrid->getSize().y +
mButtonGrid->getSize().y * 1.85f);
setPosition((Renderer::getScreenWidth() - mSize.x) / 2.0f,
(Renderer::getScreenHeight() - mSize.y) / 2.0f);
mText->startEditing();
}
void GuiComplexTextEditPopup::onSizeChanged()
{
mBackground.fitTo(mSize, glm::vec3{}, glm::vec2{-32.0f, -32.0f});
mText->setSize(mSize.x - 40.0f, mText->getSize().y);
// Update grid.
mGrid.setRowHeightPerc(0, mTitle->getFont()->getHeight() / mSize.y);
mGrid.setRowHeightPerc(2, mButtonGrid->getSize().y / mSize.y);
mGrid.setSize(mSize);
}
bool GuiComplexTextEditPopup::input(InputConfig* config, Input input)
{
if (GuiComponent::input(config, input))
return true;
if (!mHideCancelButton) {
// Pressing back when not text editing closes us.
if (config->isMappedTo("b", input) && input.value) {
if (mText->getValue() != mInitValue) {
// Changes were made, ask if the user wants to save them.
mWindow->pushGui(new GuiMsgBox(
mWindow, mHelpStyle, mSaveConfirmationText, "YES",
[this] {
this->mOkCallback(mText->getValue());
delete this;
return true;
},
"NO",
[this] {
delete this;
return false;
}));
}
else {
delete this;
}
}
}
return false;
}
std::vector<HelpPrompt> GuiComplexTextEditPopup::getHelpPrompts()
{
std::vector<HelpPrompt> prompts = mGrid.getHelpPrompts();
if (!mHideCancelButton)
prompts.push_back(HelpPrompt("b", "back"));
return prompts;
}

View file

@ -1,64 +0,0 @@
// SPDX-License-Identifier: MIT
//
// EmulationStation Desktop Edition
// GuiComplexTextEditPopup.h
//
// Text edit popup with a title, two text strings, a text input box and buttons
// to load the second text string and to clear the input field.
// Intended for updating settings for configuration files and similar.
//
#ifndef ES_CORE_GUIS_GUI_COMPLEX_TEXT_EDIT_POPUP_H
#define ES_CORE_GUIS_GUI_COMPLEX_TEXT_EDIT_POPUP_H
#include "GuiComponent.h"
#include "components/ComponentGrid.h"
#include "components/NinePatchComponent.h"
class TextComponent;
class TextEditComponent;
class GuiComplexTextEditPopup : public GuiComponent
{
public:
GuiComplexTextEditPopup(Window* window,
const HelpStyle& helpstyle,
const std::string& title,
const std::string& infoString1,
const std::string& infoString2,
const std::string& initValue,
const std::function<void(const std::string&)>& okCallback,
bool multiLine,
const std::string& acceptBtnText = "OK",
const std::string& saveConfirmationText = "SAVE CHANGES?",
const std::string& loadBtnText = "LOAD",
const std::string& loadBtnHelpText = "load default",
const std::string& clearBtnText = "CLEAR",
const std::string& clearBtnHelpText = "clear",
bool hideCancelButton = false);
bool input(InputConfig* config, Input input) override;
void onSizeChanged() override;
std::vector<HelpPrompt> getHelpPrompts() override;
HelpStyle getHelpStyle() override { return mHelpStyle; }
private:
NinePatchComponent mBackground;
ComponentGrid mGrid;
std::shared_ptr<TextComponent> mTitle;
std::shared_ptr<TextComponent> mInfoString1;
std::shared_ptr<TextComponent> mInfoString2;
std::shared_ptr<TextEditComponent> mText;
std::shared_ptr<ComponentGrid> mButtonGrid;
HelpStyle mHelpStyle;
bool mMultiLine;
bool mHideCancelButton;
std::string mInitValue;
std::function<void(const std::string&)> mOkCallback;
std::string mSaveConfirmationText;
};
#endif // ES_CORE_GUIS_GUI_COMPLEX_TEXT_EDIT_POPUP_H

Some files were not shown because too many files have changed in this diff Show more