├── .gitignore ├── .gitmodules ├── CMake ├── Packages │ ├── FindFreeImage.cmake │ ├── FindOpenGLES.cmake │ ├── FindRapidJSON.cmake │ ├── FindSDL2.cmake │ ├── FindSDL2MIXER.cmake │ ├── FindVLC.cmake │ ├── FindlibCEC.cmake │ └── MacroEnsureVersion.cmake └── Utils │ └── FindPkgMacros.cmake ├── CMakeLists.txt ├── CREDITS.md ├── DEVNOTES.md ├── GAMELISTS.md ├── LICENSE.md ├── README.md ├── SYSTEMS.md ├── THEMES.md ├── emulationstation.sh ├── es-app ├── CMakeLists.txt └── src │ ├── ApiSystem.cpp │ ├── ApiSystem.h │ ├── CollectionSystemManager.cpp │ ├── CollectionSystemManager.h │ ├── ContentInstaller.cpp │ ├── ContentInstaller.h │ ├── EmulationStation.aps │ ├── EmulationStation.h │ ├── EmulationStation.rc │ ├── FileData.cpp │ ├── FileData.h │ ├── FileFilterIndex.cpp │ ├── FileFilterIndex.h │ ├── FileSorts.cpp │ ├── FileSorts.h │ ├── Gamelist.cpp │ ├── Gamelist.h │ ├── MetaData.cpp │ ├── MetaData.h │ ├── NetworkThread.cpp │ ├── NetworkThread.h │ ├── PlatformId.cpp │ ├── PlatformId.h │ ├── ScraperCmdLine.cpp │ ├── ScraperCmdLine.h │ ├── SystemData.cpp │ ├── SystemData.h │ ├── SystemScreenSaver.cpp │ ├── SystemScreenSaver.h │ ├── VolumeControl.cpp │ ├── VolumeControl.h │ ├── animations │ ├── LaunchAnimation.h │ └── MoveCameraAnimation.h │ ├── components │ ├── AsyncReqComponent.cpp │ ├── AsyncReqComponent.h │ ├── RatingComponent.cpp │ ├── RatingComponent.h │ ├── ScraperSearchComponent.cpp │ ├── ScraperSearchComponent.h │ └── TextListComponent.h │ ├── es_icon.ico │ ├── guis │ ├── GuiCollectionSystemsOptions.cpp │ ├── GuiCollectionSystemsOptions.h │ ├── GuiFastSelect.cpp │ ├── GuiFastSelect.h │ ├── GuiGameScraper.cpp │ ├── GuiGameScraper.h │ ├── GuiGamelistFilter.cpp │ ├── GuiGamelistFilter.h │ ├── GuiGamelistOptions.cpp │ ├── GuiGamelistOptions.h │ ├── GuiGeneralScreensaverOptions.cpp │ ├── GuiGeneralScreensaverOptions.h │ ├── GuiMenu.cpp │ ├── GuiMenu.h │ ├── GuiMetaDataEd.cpp │ ├── GuiMetaDataEd.h │ ├── GuiScraperMulti.cpp │ ├── GuiScraperMulti.h │ ├── GuiScraperStart.cpp │ ├── GuiScraperStart.h │ ├── GuiScreensaverOptions.cpp │ ├── GuiScreensaverOptions.h │ ├── GuiSettings.cpp │ ├── GuiSettings.h │ ├── GuiSlideshowScreensaverOptions.cpp │ ├── GuiSlideshowScreensaverOptions.h │ ├── GuiThemeInstall.cpp │ ├── GuiThemeInstall.h │ ├── GuiVideoScreensaverOptions.cpp │ └── GuiVideoScreensaverOptions.h │ ├── main.cpp │ ├── scrapers │ ├── GamesDBJSONScraper.cpp │ ├── GamesDBJSONScraper.h │ ├── GamesDBJSONScraperResources.cpp │ ├── GamesDBJSONScraperResources.h │ ├── Scraper.cpp │ ├── Scraper.h │ ├── ScreenScraper.cpp │ ├── ScreenScraper.h │ ├── ThreadedScraper.cpp │ ├── ThreadedScraper.h │ ├── md5.cpp │ └── md5.h │ └── views │ ├── SystemView.cpp │ ├── SystemView.h │ ├── UIModeController.cpp │ ├── UIModeController.h │ ├── ViewController.cpp │ ├── ViewController.h │ └── gamelist │ ├── BasicGameListView.cpp │ ├── BasicGameListView.h │ ├── DetailedGameListView.cpp │ ├── DetailedGameListView.h │ ├── GridGameListView.cpp │ ├── GridGameListView.h │ ├── IGameListView.cpp │ ├── IGameListView.h │ ├── ISimpleGameListView.cpp │ ├── ISimpleGameListView.h │ ├── VideoGameListView.cpp │ └── VideoGameListView.h ├── es-core ├── CMakeLists.txt └── src │ ├── AsyncHandle.h │ ├── AudioManager.cpp │ ├── AudioManager.h │ ├── CECInput.cpp │ ├── CECInput.h │ ├── EsLocale.cpp │ ├── EsLocale.h │ ├── GuiComponent.cpp │ ├── GuiComponent.h │ ├── HelpPrompt.h │ ├── HelpStyle.cpp │ ├── HelpStyle.h │ ├── HttpReq.cpp │ ├── HttpReq.h │ ├── ImageIO.cpp │ ├── ImageIO.h │ ├── InputConfig.cpp │ ├── InputConfig.h │ ├── InputManager.cpp │ ├── InputManager.h │ ├── Log.cpp │ ├── Log.h │ ├── MameNames.cpp │ ├── MameNames.h │ ├── PowerSaver.cpp │ ├── PowerSaver.h │ ├── Scripting.cpp │ ├── Scripting.h │ ├── Settings.cpp │ ├── Settings.h │ ├── Sound.cpp │ ├── Sound.h │ ├── ThemeData.cpp │ ├── ThemeData.h │ ├── Window.cpp │ ├── Window.h │ ├── animations │ ├── Animation.h │ ├── AnimationController.cpp │ ├── AnimationController.h │ └── LambdaAnimation.h │ ├── components │ ├── AnimatedImageComponent.cpp │ ├── AnimatedImageComponent.h │ ├── AsyncNotificationComponent.cpp │ ├── AsyncNotificationComponent.h │ ├── BusyComponent.cpp │ ├── BusyComponent.h │ ├── ButtonComponent.cpp │ ├── ButtonComponent.h │ ├── ComponentGrid.cpp │ ├── ComponentGrid.h │ ├── ComponentList.cpp │ ├── ComponentList.h │ ├── DateTimeComponent.cpp │ ├── DateTimeComponent.h │ ├── DateTimeEditComponent.cpp │ ├── DateTimeEditComponent.h │ ├── GridTileComponent.cpp │ ├── GridTileComponent.h │ ├── HelpComponent.cpp │ ├── HelpComponent.h │ ├── IList.h │ ├── ImageComponent.cpp │ ├── ImageComponent.h │ ├── ImageGridComponent.h │ ├── MenuComponent.cpp │ ├── MenuComponent.h │ ├── MultiLineMenuEntry.h │ ├── NinePatchComponent.cpp │ ├── NinePatchComponent.h │ ├── OptionListComponent.h │ ├── ScrollableContainer.cpp │ ├── ScrollableContainer.h │ ├── SliderComponent.cpp │ ├── SliderComponent.h │ ├── SwitchComponent.cpp │ ├── SwitchComponent.h │ ├── TextComponent.cpp │ ├── TextComponent.h │ ├── TextEditComponent.cpp │ ├── TextEditComponent.h │ ├── VideoComponent.cpp │ ├── VideoComponent.h │ ├── VideoPlayerComponent.cpp │ ├── VideoPlayerComponent.h │ ├── VideoVlcComponent.cpp │ └── VideoVlcComponent.h │ ├── guis │ ├── GuiDetectDevice.cpp │ ├── GuiDetectDevice.h │ ├── GuiInfoPopup.cpp │ ├── GuiInfoPopup.h │ ├── GuiInputConfig.cpp │ ├── GuiInputConfig.h │ ├── GuiMsgBox.cpp │ ├── GuiMsgBox.h │ ├── GuiTextEditPopup.cpp │ ├── GuiTextEditPopup.h │ ├── GuiTextEditPopupKeyboard.cpp │ └── GuiTextEditPopupKeyboard.h │ ├── math │ ├── Misc.cpp │ ├── Misc.h │ ├── Transform4x4f.cpp │ ├── Transform4x4f.h │ ├── Vector2f.cpp │ ├── Vector2f.h │ ├── Vector2i.cpp │ ├── Vector2i.h │ ├── Vector3f.cpp │ ├── Vector3f.h │ ├── Vector4f.cpp │ └── Vector4f.h │ ├── platform.cpp │ ├── platform.h │ ├── renderers │ ├── Renderer.cpp │ ├── Renderer.h │ ├── Renderer_GL21.cpp │ └── Renderer_GLES10.cpp │ ├── resources │ ├── Font.cpp │ ├── Font.h │ ├── ResourceManager.cpp │ ├── ResourceManager.h │ ├── TextureData.cpp │ ├── TextureData.h │ ├── TextureDataManager.cpp │ ├── TextureDataManager.h │ ├── TextureResource.cpp │ └── TextureResource.h │ └── utils │ ├── FileSystemUtil.cpp │ ├── FileSystemUtil.h │ ├── StringUtil.cpp │ ├── StringUtil.h │ ├── ThreadPool.cpp │ ├── ThreadPool.h │ ├── TimeUtil.cpp │ └── TimeUtil.h ├── external ├── CMakeLists.txt └── nanosvg │ ├── CMakeLists.txt │ ├── nanosvg.h │ ├── nanosvg_license.txt │ ├── nanosvgrast.h │ └── src │ └── nanosvg_impl.cpp ├── opensans_license.txt └── resources ├── DroidSansFallbackFull.ttf ├── NanumMyeongjo.ttf ├── OpenSans-CondBold.ttf ├── OpenSans-CondLight.ttf ├── alert.svg ├── arrow.svg ├── busy_0.svg ├── busy_1.svg ├── busy_2.svg ├── busy_3.svg ├── button.png ├── button_filled.png ├── cartridge.svg ├── checkbox_checked.svg ├── checkbox_unchecked.svg ├── fav_add.svg ├── fav_remove.svg ├── folder.svg ├── frame.png ├── glyphs.ttf ├── help ├── analog_down.svg ├── analog_left.svg ├── analog_right.svg ├── analog_stick.svg ├── analog_thumb.svg ├── analog_up.svg ├── button_1.svg ├── button_2.svg ├── button_3.svg ├── button_4.svg ├── button_a.svg ├── button_b.svg ├── button_circle.svg ├── button_cross.svg ├── button_hotkey.svg ├── button_l.svg ├── button_lr.svg ├── button_lt.svg ├── button_r.svg ├── button_rt.svg ├── button_select.svg ├── button_square.svg ├── button_start.svg ├── button_triangle.svg ├── button_x.svg ├── button_y.svg ├── buttons_east.svg ├── buttons_north.svg ├── buttons_south.svg ├── buttons_west.svg ├── dpad_all.svg ├── dpad_down.svg ├── dpad_left.svg ├── dpad_leftright.svg ├── dpad_right.svg ├── dpad_up.svg └── dpad_updown.svg ├── info.svg ├── locale ├── br │ └── emulationstation2.po ├── es │ └── emulationstation2.po ├── fr │ └── emulationstation2.po └── ko │ └── emulationstation2.po ├── mamebioses.xml ├── mamedevices.xml ├── mamenames.xml ├── off.svg ├── on.svg ├── opensans_hebrew_condensed_light.ttf ├── opensans_hebrew_condensed_regular.ttf ├── option_arrow.svg ├── question.svg ├── scroll_gradient.png ├── search.svg ├── slider_knob.svg ├── splash.svg ├── star_filled.svg ├── star_unfilled.svg ├── textinput_ninepatch.png ├── textinput_ninepatch_active.png ├── warning.svg └── window_icon_256.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.mo 6 | 7 | # Compiled Dynamic libraries 8 | *.so 9 | 10 | # Compiled Static libraries 11 | *.lai 12 | *.la 13 | *.a 14 | 15 | # Dependency makefiles 16 | *.d 17 | 18 | # Compiled executable 19 | emulationstation 20 | 21 | # build directory 22 | build 23 | Debug 24 | Release 25 | MinSizeRel 26 | RelWithDebInfo 27 | 28 | # CMake 29 | CMakeCache.txt 30 | CMakeFiles 31 | cmake_install.cmake 32 | Makefile 33 | 34 | # Eclipse 35 | .cproject 36 | .project 37 | .settings/ 38 | 39 | # Clion 40 | .idea/ 41 | CPackConfig.cmake 42 | CPackSourceConfig.cmake 43 | *.cbp 44 | /.vs 45 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "external/pugixml"] 2 | path = external/pugixml 3 | url = https://github.com/zeux/pugixml.git 4 | -------------------------------------------------------------------------------- /CMake/Packages/FindFreeImage.cmake: -------------------------------------------------------------------------------- 1 | #snapped from: https://bitbucket.org/sinbad/ogre/src/0bba4f7cdb95/CMake/Packages/FindFreeImage.cmake?at=default 2 | #------------------------------------------------------------------- 3 | # This file is part of the CMake build system for OGRE 4 | # (Object-oriented Graphics Rendering Engine) 5 | # For the latest info, see httpwww.ogre3d.org 6 | # 7 | # The contents of this file are placed in the public domain. Feel 8 | # free to make use of it in any way you like. 9 | #------------------------------------------------------------------- 10 | 11 | # - Try to find FreeImage 12 | # Once done, this will define 13 | # 14 | # FreeImage_FOUND - system has FreeImage 15 | # FreeImage_INCLUDE_DIRS - the FreeImage include directories 16 | # FreeImage_LIBRARIES - link these to use FreeImage 17 | 18 | include(FindPkgMacros) 19 | findpkg_begin(FreeImage) 20 | 21 | # Get path, convert backslashes as ${ENV_${var}} 22 | getenv_path(FREEIMAGE_HOME) 23 | 24 | # construct search paths 25 | set(FreeImage_PREFIX_PATH ${FREEIMAGE_HOME} ${ENV_FREEIMAGE_HOME}) 26 | create_search_paths(FreeImage) 27 | # redo search if prefix path changed 28 | clear_if_changed(FreeImage_PREFIX_PATH 29 | FreeImage_LIBRARY_FWK 30 | FreeImage_LIBRARY_REL 31 | FreeImage_LIBRARY_DBG 32 | FreeImage_INCLUDE_DIR 33 | ) 34 | 35 | set(FreeImage_LIBRARY_NAMES freeimage freeimageLib) 36 | get_debug_names(FreeImage_LIBRARY_NAMES) 37 | 38 | use_pkgconfig(FreeImage_PKGC freeimage) 39 | 40 | findpkg_framework(FreeImage) 41 | 42 | find_path(FreeImage_INCLUDE_DIR NAMES FreeImage.h HINTS ${FreeImage_INC_SEARCH_PATH} ${FreeImage_PKGC_INCLUDE_DIRS}) 43 | 44 | find_library(FreeImage_LIBRARY_REL NAMES ${FreeImage_LIBRARY_NAMES} HINTS ${FreeImage_LIB_SEARCH_PATH} ${FreeImage_PKGC_LIBRARY_DIRS} PATH_SUFFIXES release relwithdebinfo minsizerel) 45 | find_library(FreeImage_LIBRARY_DBG NAMES ${FreeImage_LIBRARY_NAMES_DBG} HINTS ${FreeImage_LIB_SEARCH_PATH} ${FreeImage_PKGC_LIBRARY_DIRS} PATH_SUFFIXES debug) 46 | 47 | make_library_set(FreeImage_LIBRARY) 48 | 49 | findpkg_finish(FreeImage) -------------------------------------------------------------------------------- /CMake/Packages/FindRapidJSON.cmake: -------------------------------------------------------------------------------- 1 | #.rst: 2 | # FindRapidjson 3 | # -------- 4 | # 5 | # Find the native rapidjson includes and library. 6 | # 7 | # IMPORTED Targets 8 | # ^^^^^^^^^^^^^^^^ 9 | # 10 | # 11 | # Result Variables 12 | # ^^^^^^^^^^^^^^^^ 13 | # 14 | # This module defines the following variables: 15 | # 16 | # :: 17 | # 18 | # RAPIDJSON_INCLUDE_DIRS - where to find rapidjson/document.h, etc. 19 | # RAPIDJSON_LIBRARIES - List of libraries when using rapidjson. 20 | # RAPIDJSON_FOUND - True if rapidjson found. 21 | # 22 | # :: 23 | # 24 | # 25 | # Hints 26 | # ^^^^^ 27 | # 28 | # A user may set ``RAPIDJSON_ROOT`` to a rapidjson installation root to tell this 29 | # module where to look. 30 | 31 | #============================================================================= 32 | # Copyright 2018 OWenT. 33 | # 34 | # Distributed under the OSI-approved BSD License (the "License"); 35 | # see accompanying file Copyright.txt for details. 36 | # 37 | # This software is distributed WITHOUT ANY WARRANTY; without even the 38 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 39 | # See the License for more information. 40 | #============================================================================= 41 | # (To distribute this file outside of CMake, substitute the full 42 | # License text for the above reference.) 43 | 44 | unset(_RAPIDJSON_SEARCH_ROOT_INC) 45 | unset(_RAPIDJSON_SEARCH_ROOT_LIB) 46 | 47 | # Search RAPIDJSON_ROOT first if it is set. 48 | if (Rapidjson_ROOT) 49 | set(RAPIDJSON_ROOT ${Rapidjson_ROOT}) 50 | endif() 51 | 52 | if(RAPIDJSON_ROOT) 53 | set(_RAPIDJSON_SEARCH_ROOT_INC PATHS ${RAPIDJSON_ROOT} ${RAPIDJSON_ROOT}/include NO_DEFAULT_PATH) 54 | endif() 55 | 56 | # Try each search configuration. 57 | find_path(RAPIDJSON_INCLUDE_DIRS NAMES rapidjson/document.h ${_RAPIDJSON_SEARCH_ROOT_INC}) 58 | 59 | mark_as_advanced(RAPIDJSON_INCLUDE_DIRS) 60 | 61 | # handle the QUIETLY and REQUIRED arguments and set RAPIDJSON_FOUND to TRUE if 62 | # all listed variables are TRUE 63 | include("FindPackageHandleStandardArgs") 64 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(Rapidjson 65 | REQUIRED_VARS RAPIDJSON_INCLUDE_DIRS 66 | FOUND_VAR Rapidjson_FOUND 67 | ) 68 | 69 | if(Rapidjson_FOUND) 70 | set(RAPIDJSON_FOUND ${Rapidjson_FOUND}) 71 | endif() 72 | -------------------------------------------------------------------------------- /CMake/Packages/FindSDL2MIXER.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # this module look for SDL2_Mixer (http://www.libsdl.org) support 3 | # it will define the following values 4 | # 5 | # SDLMIXER_INCLUDE_DIR = where SDL_mixer.h can be found 6 | # SDLMIXER_LIBRARY = the library to link against SDL2_mixer 7 | # SDLMIXER_FOUND = set to 1 if SDL2_mixer is found 8 | # 9 | 10 | IF(SDL2_Mixer_INCLUDE_DIRS) 11 | 12 | FIND_PATH(SDLMIXER_INCLUDE_DIR SDL2/SDL_mixer.h ${SDL2_Mixer_INCLUDE_DIRS}) 13 | FIND_LIBRARY(SDLMIXER_LIBRARY SDL2_mixer ${SDL2_Mixer_LIBRARY_DIRS}) 14 | 15 | ELSE(SDL2_Mixer_INCLUDE_DIRS) 16 | 17 | SET(TRIAL_LIBRARY_PATHS 18 | $ENV{SDL2_MIXER_HOME}/lib 19 | /usr/lib 20 | /usr/local/lib 21 | /sw/lib 22 | ) 23 | SET(TRIAL_INCLUDE_PATHS 24 | $ENV{SDL2_MIXER_HOME}/include/SDL2 25 | /usr/include/SDL2 26 | /usr/local/include/SDL2 27 | /sw/include/SDL2 28 | ) 29 | 30 | FIND_LIBRARY(SDLMIXER_LIBRARY SDL2_mixer ${TRIAL_LIBRARY_PATHS}) 31 | FIND_PATH(SDLMIXER_INCLUDE_DIR SDL_mixer.h ${TRIAL_INCLUDE_PATHS}) 32 | 33 | ENDIF(SDL2_Mixer_INCLUDE_DIRS) 34 | 35 | IF(SDLMIXER_INCLUDE_DIR AND SDLMIXER_LIBRARY) 36 | SET(SDLMIXER_FOUND 1 CACHE BOOL "Found SDL2_Mixer library") 37 | ELSE(SDLMIXER_INCLUDE_DIR AND SDLMIXER_LIBRARY) 38 | SET(SDLMIXER_FOUND 0 CACHE BOOL "Not fount SDL2_Mixer library") 39 | ENDIF(SDLMIXER_INCLUDE_DIR AND SDLMIXER_LIBRARY) 40 | 41 | MARK_AS_ADVANCED( 42 | SDLMIXER_INCLUDE_DIR 43 | SDLMIXER_LIBRARY 44 | SDLMIXER_FOUND 45 | ) 46 | 47 | INCLUDE(FindPackageHandleStandardArgs) 48 | 49 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLMIXER REQUIRED_VARS SDLMIXER_INCLUDE_DIR SDLMIXER_LIBRARY) 50 | -------------------------------------------------------------------------------- /CMake/Packages/FindVLC.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find VLC library 2 | # Once done this will define 3 | # 4 | # VLC_FOUND - system has VLC 5 | # VLC_INCLUDE_DIR - The VLC include directory 6 | # VLC_LIBRARIES - The libraries needed to use VLC 7 | # VLC_DEFINITIONS - Compiler switches required for using VLC 8 | # 9 | # Copyright (C) 2008, Tanguy Krotoff 10 | # Copyright (C) 2008, Lukas Durfina 11 | # Copyright (c) 2009, Fathi Boudra 12 | # 13 | # Redistribution and use is allowed according to the terms of the BSD license. 14 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 15 | # 16 | 17 | if(VLC_INCLUDE_DIR AND VLC_LIBRARIES) 18 | # in cache already 19 | set(VLC_FIND_QUIETLY TRUE) 20 | endif(VLC_INCLUDE_DIR AND VLC_LIBRARIES) 21 | 22 | # use pkg-config to get the directories and then use these values 23 | # in the FIND_PATH() and FIND_LIBRARY() calls 24 | if(NOT WIN32) 25 | find_package(PkgConfig) 26 | pkg_check_modules(VLC libvlc>=1.0.0) 27 | set(VLC_DEFINITIONS ${VLC_CFLAGS}) 28 | set(VLC_LIBRARIES ${VLC_LDFLAGS}) 29 | endif(NOT WIN32) 30 | 31 | # TODO add argument support to pass version on find_package 32 | include(MacroEnsureVersion) 33 | macro_ensure_version(1.0.0 ${VLC_VERSION} VLC_VERSION_OK) 34 | if(VLC_VERSION_OK) 35 | set(VLC_FOUND TRUE) 36 | message(STATUS "VLC library found") 37 | else(VLC_VERSION_OK) 38 | set(VLC_FOUND FALSE) 39 | message(FATAL_ERROR "VLC library not found") 40 | endif(VLC_VERSION_OK) 41 | 42 | find_path(VLC_INCLUDE_DIR 43 | NAMES vlc.h 44 | PATHS ${VLC_INCLUDE_DIRS} 45 | PATH_SUFFIXES vlc) 46 | 47 | find_library(VLC_LIBRARIES 48 | NAMES vlc 49 | PATHS ${VLC_LIBRARY_DIRS}) 50 | 51 | include(FindPackageHandleStandardArgs) 52 | find_package_handle_standard_args(VLC DEFAULT_MSG VLC_INCLUDE_DIR VLC_LIBRARIES) 53 | 54 | # show the VLC_INCLUDE_DIR and VLC_LIBRARIES variables only in the advanced view 55 | mark_as_advanced(VLC_INCLUDE_DIR VLC_LIBRARIES) 56 | -------------------------------------------------------------------------------- /CMake/Packages/FindlibCEC.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find libCEC 2 | # Once done, this will define 3 | # 4 | # libCEC_FOUND - system has libCEC 5 | # libCEC_INCLUDE_DIRS - the libCEC include directories 6 | # libCEC_LIBRARIES - link these to use libCEC 7 | 8 | include(FindPkgMacros) 9 | findpkg_begin(libCEC) 10 | 11 | # Get path, convert backslashes as ${ENV_${var}} 12 | getenv_path(LIBCEC_HOME) 13 | 14 | # construct search paths 15 | set(libCEC_PREFIX_PATH ${LIBCEC_HOME} ${ENV_LIBCEC_HOME}) 16 | create_search_paths(LIBCEC) 17 | # redo search if prefix path changed 18 | clear_if_changed(libCEC_PREFIX_PATH 19 | libCEC_LIBRARY_FWK 20 | libCEC_LIBRARY_REL 21 | libCEC_LIBRARY_DBG 22 | libCEC_INCLUDE_DIR 23 | ) 24 | 25 | set(libCEC_LIBRARY_NAMES libcec.so) 26 | get_debug_names(libCEC_LIBRARY_NAMES) 27 | 28 | use_pkgconfig(libCEC_PKGC libcec) 29 | 30 | findpkg_framework(libCEC) 31 | 32 | find_path(libCEC_INCLUDE_DIR NAMES cec.h HINTS ${libCEC_INC_SEARCH_PATH} ${libCEC_PKGC_INCLUDE_DIRS}) 33 | 34 | find_library(libCEC_LIBRARY_REL NAMES ${libCEC_LIBRARY_NAMES} HINTS ${libCEC_LIB_SEARCH_PATH} ${libCEC_PKGC_LIBRARY_DIRS} PATH_SUFFIXES release relwithdebinfo minsizerel) 35 | find_library(libCEC_LIBRARY_DBG NAMES ${libCEC_LIBRARY_NAMES_DBG} HINTS ${libCEC_LIB_SEARCH_PATH} ${libCEC_PKGC_LIBRARY_DIRS} PATH_SUFFIXES debug) 36 | 37 | make_library_set(libCEC_LIBRARY) 38 | 39 | findpkg_finish(libCEC) -------------------------------------------------------------------------------- /CREDITS.md: -------------------------------------------------------------------------------- 1 | Programming 2 | Alec "Aloshi" Lofquist - http://www.aloshi.com 3 | 4 | UI Art & Design 5 | Nils Bonenberger 6 | 7 | 8 | Libraries 9 | ========= 10 | 11 | PugiXML 12 | http://pugixml.org/ 13 | 14 | SDL 2 15 | http://www.libsdl.org/ 16 | 17 | FreeImage 18 | http://www.freeimage.sourceforge.net 19 | 20 | FreeType 21 | http://www.freetype.org 22 | 23 | cURL 24 | http://curl.haxx.se/ 25 | 26 | nanosvg 27 | https://github.com/memononen/nanosvg 28 | 29 | Resources 30 | ========= 31 | 32 | Open Sans font 33 | http://www.google.com/fonts/specimen/Open+Sans -------------------------------------------------------------------------------- /DEVNOTES.md: -------------------------------------------------------------------------------- 1 | Also known as "Really Bad Technical Documentation" 2 | 3 | These are mostly notes I create as I go along, marking potential gotchas for people who might try to extend my code. 4 | Some day I'll try and add an overview of the code structure, what each class does, etc. 5 | 6 | Development Environment 7 | ======================= 8 | 9 | I personally launch ES in windowed mode with a smaller resolution than my monitor and with debug text enabled. 10 | 11 | `emulationstation --windowed --debug --resolution 1280 720` 12 | 13 | 14 | Creating a new GuiComponent 15 | =========================== 16 | 17 | You probably want to override: 18 | 19 | `bool input(InputConfig* config, Input input);` 20 | Check if some input is mapped to some action with `config->isMappedTo("a", input);`. 21 | Check if an input is "pressed" with `input.value != 0` (input.value *can* be negative in the case of axes). 22 | 23 | `void update(int deltaTime);` 24 | `deltaTime` is in milliseconds. 25 | 26 | `void render(const Transform4x4f& parentTrans);` 27 | You probably want to do `Transform4x4f trans = parentTrans * getTransform();` to get your final "modelview" matrix. 28 | Apply the modelview matrix with `Renderer::setMatrix(const Transform4x4f&)`. 29 | Render any children the component may have with `renderChildren(parentTrans);`. 30 | 31 | 32 | Creating a new GameListView Class 33 | ================================= 34 | 35 | 1. Don't allow the user to navigate to the root node's parent. If you use a stack of some sort to keep track of past cursor states this will be a natural side effect. 36 | 37 | 38 | 39 | Creating a new Component 40 | ======================== 41 | 42 | If your component is not made up of other components, and you draw something to the screen with OpenGL, make sure: 43 | 44 | * Your vertex positions are rounded before you render (you can use round(float) in Util.h to do this). 45 | * Your transform matrix's translation is rounded (you can use roundMatrix(affine3f) in Util.h to do this). -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Alec Lofquist 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /emulationstation.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | esdir="$(dirname $0)" 4 | while true; do 5 | rm -f /tmp/es-restart /tmp/es-sysrestart /tmp/es-shutdown 6 | "$esdir/emulationstation" "$@" 7 | ret=$? 8 | [ -f /tmp/es-restart ] && continue 9 | if [ -f /tmp/es-sysrestart ]; then 10 | rm -f /tmp/es-sysrestart 11 | sudo reboot 12 | break 13 | fi 14 | if [ -f /tmp/es-shutdown ]; then 15 | rm -f /tmp/es-shutdown 16 | sudo poweroff 17 | break 18 | fi 19 | break 20 | done 21 | exit $ret 22 | -------------------------------------------------------------------------------- /es-app/src/ApiSystem.h: -------------------------------------------------------------------------------- 1 | #ifndef API_SYSTEM 2 | #define API_SYSTEM 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class Window; 9 | 10 | namespace UpdateState 11 | { 12 | enum State 13 | { 14 | NO_UPDATE, 15 | UPDATER_RUNNING, 16 | UPDATE_READY 17 | }; 18 | } 19 | 20 | struct ThemeDownloadInfo 21 | { 22 | bool installed; 23 | std::string name; 24 | std::string url; 25 | }; 26 | 27 | class ApiSystem 28 | { 29 | public: 30 | static UpdateState::State state; 31 | 32 | static std::pair updateSystem(const std::function& func = nullptr); 33 | static std::string checkUpdateVersion(); 34 | static void startUpdate(Window* c); 35 | 36 | static std::vector getThemesList(); 37 | static std::pair installTheme(std::string themeName, const std::function& func = nullptr); 38 | }; 39 | 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /es-app/src/ContentInstaller.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class Window; 10 | class AsyncNotificationComponent; 11 | 12 | 13 | class ContentInstaller 14 | { 15 | public: 16 | enum ContentType : int 17 | { 18 | CONTENT_THEME = 0 19 | }; 20 | 21 | static void Enqueue(Window* window, ContentType type, const std::string contentName); 22 | 23 | private: // Methods 24 | ContentInstaller(Window* window); 25 | ~ContentInstaller(); 26 | 27 | void updateNotificationComponentTitle(bool incQueueSize); 28 | void updateNotificationComponentContent(const std::string info); 29 | 30 | void threadUpdate(); 31 | 32 | private: 33 | AsyncNotificationComponent* mWndNotification; 34 | Window* mWindow; 35 | std::thread* mHandle; 36 | 37 | int mCurrent; 38 | int mQueueSize; 39 | 40 | private: 41 | static ContentInstaller* mInstance; 42 | static std::mutex mLock; 43 | static std::list> mQueue; 44 | static std::list> mProcessingQueue; 45 | }; 46 | -------------------------------------------------------------------------------- /es-app/src/EmulationStation.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabricecaruso/old-EmulationStation-fork---see-batocera-emulationstation-instead/09936b0ad01bfef4696416d70de552e00dce3850/es-app/src/EmulationStation.aps -------------------------------------------------------------------------------- /es-app/src/EmulationStation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_EMULATION_STATION_H 3 | #define ES_APP_EMULATION_STATION_H 4 | 5 | // These numbers and strings need to be manually updated for a new version. 6 | // Do this version number update as the very last commit for the new release version. 7 | #define PROGRAM_VERSION_MAJOR 2 8 | #define PROGRAM_VERSION_MINOR 10 9 | #define PROGRAM_VERSION_MAINTENANCE 2 10 | #define PROGRAM_VERSION_BUILD 2 11 | 12 | #define PROGRAM_VERSION_STRING "2.10.2.2 FCAMOD" 13 | #define SCRAPER_VERSION_STRING "2.10.2.2" 14 | 15 | #define PROGRAM_BUILT_STRING __DATE__ " - " __TIME__ 16 | 17 | #define RESOURCE_VERSION_STRING "2,10,2,2\0" 18 | #define RESOURCE_VERSION PROGRAM_VERSION_MAJOR,PROGRAM_VERSION_MINOR,PROGRAM_VERSION_MAINTENANCE,PROGRAM_VERSION_BUILD 19 | 20 | #endif // ES_APP_EMULATION_STATION_H 21 | -------------------------------------------------------------------------------- /es-app/src/EmulationStation.rc: -------------------------------------------------------------------------------- 1 | #include "EmulationStation.h" 2 | 3 | #include "windows.h" 4 | 5 | VS_VERSION_INFO VERSIONINFO 6 | FILEVERSION RESOURCE_VERSION 7 | PRODUCTVERSION RESOURCE_VERSION 8 | FILEFLAGSMASK 0x3fL 9 | #ifdef _DEBUG 10 | FILEFLAGS 0x1L 11 | #else 12 | FILEFLAGS 0x0L 13 | #endif 14 | FILEOS VOS_NT_WINDOWS32 15 | FILETYPE VFT_APP 16 | FILESUBTYPE VFT2_UNKNOWN 17 | BEGIN 18 | BLOCK "StringFileInfo" 19 | BEGIN 20 | BLOCK "040904E4" 21 | BEGIN 22 | VALUE "Comments", "\0" 23 | VALUE "FileDescription", "EmulationStation - emulator frontend\0" 24 | VALUE "FileVersion", RESOURCE_VERSION_STRING 25 | VALUE "InternalName", "emulationstation.exe\0" 26 | VALUE "LegalCopyright", "\0" 27 | VALUE "LegalTrademarks", "\0" 28 | VALUE "OriginalFilename", "emulationstation.exe\0" 29 | VALUE "ProductName", "EmulationStation\0" 30 | VALUE "ProductVersion", PROGRAM_VERSION_STRING 31 | END 32 | END 33 | BLOCK "VarFileInfo" 34 | BEGIN 35 | VALUE "Translation", 0x409, 1252 36 | END 37 | END 38 | 39 | IDI_ES_LOGO ICON DISCARDABLE "es_icon.ico" -------------------------------------------------------------------------------- /es-app/src/FileSorts.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_FILE_SORTS_H 3 | #define ES_APP_FILE_SORTS_H 4 | 5 | #include "FileData.h" 6 | #include 7 | 8 | namespace FileSorts 9 | { 10 | enum SortId : unsigned int 11 | { 12 | FILENAME_ASCENDING = 0, 13 | FILENAME_DESCENDING = 1, 14 | RATING_ASCENDING = 2, 15 | RATING_DESCENDING = 3, 16 | TIMESPLAYED_ASCENDING = 4, 17 | TIMESPLAYED_DESCENDING = 5, 18 | LASTPLAYED_ASCENDING = 6, 19 | LASTPLAYED_DESCENDING = 7, 20 | NUMBERPLAYERS_ASCENDING = 8, 21 | NUMBERPLAYERS_DESCENDING = 9, 22 | RELEASEDATE_ASCENDING = 10, 23 | RELEASEDATE_DESCENDING = 11, 24 | GENRE_ASCENDING = 12, 25 | GENRE_DESCENDING = 13, 26 | DEVELOPER_ASCENDING = 14, 27 | DEVELOPER_DESCENDING = 15, 28 | PUBLISHER_ASCENDING = 16, 29 | PUBLISHER_DESCENDING = 17, 30 | SYSTEM_ASCENDING = 18, 31 | SYSTEM_DESCENDING = 19 32 | }; 33 | 34 | typedef bool ComparisonFunction(const FileData* a, const FileData* b); 35 | 36 | struct SortType 37 | { 38 | int id; 39 | ComparisonFunction* comparisonFunction; 40 | bool ascending; 41 | std::string description; 42 | std::string icon; 43 | 44 | SortType(int sortId, ComparisonFunction* sortFunction, bool sortAscending, const std::string & sortDescription, const std::string & iconId = "") 45 | : id(sortId), comparisonFunction(sortFunction), ascending(sortAscending), description(sortDescription), icon(iconId) {} 46 | }; 47 | 48 | class Singleton 49 | { 50 | public: 51 | Singleton(); 52 | 53 | std::vector mSortTypes; 54 | }; 55 | 56 | void reset(); 57 | SortType getSortType(int sortId); 58 | const std::vector& getSortTypes(); 59 | 60 | bool compareName(const FileData* file1, const FileData* file2); 61 | bool compareRating(const FileData* file1, const FileData* file2); 62 | bool compareTimesPlayed(const FileData* file1, const FileData* fil2); 63 | bool compareLastPlayed(const FileData* file1, const FileData* file2); 64 | bool compareNumPlayers(const FileData* file1, const FileData* file2); 65 | bool compareReleaseDate(const FileData* file1, const FileData* file2); 66 | bool compareGenre(const FileData* file1, const FileData* file2); 67 | bool compareDeveloper(const FileData* file1, const FileData* file2); 68 | bool comparePublisher(const FileData* file1, const FileData* file2); 69 | bool compareSystem(const FileData* file1, const FileData* file2); 70 | }; 71 | #endif // ES_APP_FILE_SORTS_H 72 | -------------------------------------------------------------------------------- /es-app/src/Gamelist.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_GAME_LIST_H 3 | #define ES_APP_GAME_LIST_H 4 | 5 | #include 6 | 7 | class SystemData; 8 | class FileData; 9 | 10 | // Loads gamelist.xml data into a SystemData. 11 | void parseGamelist(SystemData* system, std::unordered_map& fileMap); 12 | 13 | // Writes currently loaded metadata for a SystemData to gamelist.xml. 14 | void updateGamelist(SystemData* system); 15 | 16 | bool saveToGamelistRecovery(FileData* file); 17 | bool hasDirtyFile(SystemData* system); 18 | 19 | #endif // ES_APP_GAME_LIST_H 20 | -------------------------------------------------------------------------------- /es-app/src/NetworkThread.cpp: -------------------------------------------------------------------------------- 1 | #include "NetworkThread.h" 2 | #include "ApiSystem.h" 3 | #include "guis/GuiMsgBox.h" 4 | #include "Log.h" 5 | #include 6 | #include 7 | 8 | NetworkThread::NetworkThread(Window* window) : mWindow(window) 9 | { 10 | LOG(LogDebug) << "NetworkThread : Starting"; 11 | 12 | // creer le thread 13 | mFirstRun = true; 14 | mRunning = true; 15 | mThread = new std::thread(&NetworkThread::run, this); 16 | } 17 | 18 | NetworkThread::~NetworkThread() 19 | { 20 | LOG(LogDebug) << "NetworkThread : Exit"; 21 | 22 | mRunning = false; 23 | mThread->join(); 24 | delete mThread; 25 | } 26 | 27 | void NetworkThread::run() 28 | { 29 | while (mRunning) 30 | { 31 | if (mFirstRun) 32 | { 33 | std::this_thread::sleep_for(std::chrono::seconds(5)); 34 | mFirstRun = false; 35 | } 36 | else 37 | std::this_thread::sleep_for(std::chrono::hours(1)); 38 | 39 | if (Settings::getInstance()->getBool("updates.enabled")) 40 | { 41 | LOG(LogDebug) << "NetworkThread : Checking for updates"; 42 | 43 | std::string version = ApiSystem::checkUpdateVersion(); 44 | if (!version.empty()) 45 | { 46 | mWindow->displayNotificationMessage(_U("\uF019 ") + _("UPDATE AVAILABLE") + std::string(": ") + version); 47 | mRunning = false; 48 | } 49 | else 50 | { 51 | LOG(LogDebug) << "NetworkThread : No update found"; 52 | } 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /es-app/src/NetworkThread.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Window.h" 4 | #include 5 | 6 | class NetworkThread 7 | { 8 | public: 9 | NetworkThread(Window * window); 10 | virtual ~NetworkThread(); 11 | 12 | private: 13 | Window* mWindow; 14 | bool mRunning; 15 | bool mFirstRun; 16 | std::thread* mThread; 17 | 18 | void run(); 19 | }; 20 | 21 | 22 | -------------------------------------------------------------------------------- /es-app/src/ScraperCmdLine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_SCRAPER_CMD_LINE_H 3 | #define ES_APP_SCRAPER_CMD_LINE_H 4 | 5 | int run_scraper_cmdline(); 6 | 7 | #endif // ES_APP_SCRAPER_CMD_LINE_H 8 | -------------------------------------------------------------------------------- /es-app/src/VolumeControl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_VOLUME_CONTROL_H 3 | #define ES_APP_VOLUME_CONTROL_H 4 | 5 | #include 6 | 7 | #if defined (__APPLE__) 8 | #error TODO: Not implemented for MacOS yet!!! 9 | #elif defined(__linux__) 10 | #include 11 | #include 12 | #include 13 | #elif defined(WIN32) || defined(_WIN32) 14 | #include 15 | #include 16 | #include 17 | #endif 18 | 19 | /*! 20 | Singleton pattern. Call getInstance() to get an object. 21 | */ 22 | class VolumeControl 23 | { 24 | #if defined (__APPLE__) 25 | #error TODO: Not implemented for MacOS yet!!! 26 | #elif defined(__linux__) 27 | static const char * mixerName; 28 | static const char * mixerCard; 29 | int mixerIndex; 30 | snd_mixer_t* mixerHandle; 31 | snd_mixer_elem_t* mixerElem; 32 | snd_mixer_selem_id_t* mixerSelemId; 33 | #elif defined(WIN32) || defined(_WIN32) 34 | HMIXER mixerHandle; 35 | MIXERCONTROL mixerControl; 36 | IAudioEndpointVolume * endpointVolume; 37 | #endif 38 | 39 | int originalVolume; 40 | int internalVolume; 41 | 42 | static std::weak_ptr sInstance; 43 | 44 | VolumeControl(); 45 | VolumeControl(const VolumeControl & right); 46 | VolumeControl & operator=(const VolumeControl & right); 47 | 48 | public: 49 | static std::shared_ptr & getInstance(); 50 | 51 | void init(); 52 | void deinit(); 53 | 54 | int getVolume() const; 55 | void setVolume(int volume); 56 | 57 | ~VolumeControl(); 58 | }; 59 | 60 | #endif // ES_APP_VOLUME_CONTROL_H 61 | -------------------------------------------------------------------------------- /es-app/src/animations/MoveCameraAnimation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_ANIMATIONS_MOVE_CAMERA_ANIMATION_H 3 | #define ES_APP_ANIMATIONS_MOVE_CAMERA_ANIMATION_H 4 | 5 | #include "animations/Animation.h" 6 | 7 | class MoveCameraAnimation : public Animation 8 | { 9 | public: 10 | MoveCameraAnimation(Transform4x4f& camera, const Vector3f& target) : mCameraStart(camera), mTarget(target), cameraOut(camera) {} 11 | 12 | int getDuration() const override { return 400; } 13 | 14 | void apply(float t) override 15 | { 16 | // cubic ease out 17 | t -= 1; 18 | cameraOut.translation() = -Vector3f().lerp(-mCameraStart.translation(), mTarget, t*t*t + 1); 19 | } 20 | 21 | private: 22 | Transform4x4f mCameraStart; 23 | Vector3f mTarget; 24 | 25 | Transform4x4f& cameraOut; 26 | }; 27 | 28 | #endif // ES_APP_ANIMATIONS_MOVE_CAMERA_ANIMATION_H 29 | -------------------------------------------------------------------------------- /es-app/src/components/AsyncReqComponent.cpp: -------------------------------------------------------------------------------- 1 | #include "components/AsyncReqComponent.h" 2 | 3 | #include "renderers/Renderer.h" 4 | #include "HttpReq.h" 5 | 6 | AsyncReqComponent::AsyncReqComponent(Window* window, std::shared_ptr req, std::function)> onSuccess, std::function onCancel) 7 | : GuiComponent(window), 8 | mSuccessFunc(onSuccess), mCancelFunc(onCancel), mTime(0), mRequest(req) 9 | { 10 | 11 | } 12 | 13 | bool AsyncReqComponent::input(InputConfig* config, Input input) 14 | { 15 | if(input.value != 0 && config->isMappedTo("b", input)) 16 | { 17 | if(mCancelFunc) 18 | mCancelFunc(); 19 | 20 | delete this; 21 | } 22 | 23 | return true; 24 | } 25 | 26 | void AsyncReqComponent::update(int deltaTime) 27 | { 28 | if(mRequest->status() != HttpReq::REQ_IN_PROGRESS) 29 | { 30 | mSuccessFunc(mRequest); 31 | delete this; 32 | return; 33 | } 34 | 35 | mTime += deltaTime; 36 | } 37 | 38 | void AsyncReqComponent::render(const Transform4x4f& /*parentTrans*/) 39 | { 40 | Transform4x4f trans = Transform4x4f::Identity(); 41 | trans = trans.translate(Vector3f(Renderer::getScreenWidth() / 2.0f, Renderer::getScreenHeight() / 2.0f, 0)); 42 | Renderer::setMatrix(trans); 43 | 44 | Vector3f point(Math::cosf(mTime * 0.01f) * 12, Math::sinf(mTime * 0.01f) * 12, 0); 45 | Renderer::drawRect(point.x(), point.y(), 8.0f, 8.0f, 0x0000FFFF, 0x0000FFFF); 46 | } 47 | 48 | std::vector AsyncReqComponent::getHelpPrompts() 49 | { 50 | std::vector prompts; 51 | prompts.push_back(HelpPrompt("b", "cancel")); 52 | return prompts; 53 | } 54 | -------------------------------------------------------------------------------- /es-app/src/components/AsyncReqComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_COMPONENTS_ASYNC_REQ_COMPONENT_H 3 | #define ES_APP_COMPONENTS_ASYNC_REQ_COMPONENT_H 4 | 5 | #include "GuiComponent.h" 6 | 7 | class HttpReq; 8 | 9 | /* 10 | Used to asynchronously run an HTTP request. 11 | Displays a simple animation on the UI to show the application hasn't frozen. Can be canceled by the user pressing B. 12 | 13 | Usage example: 14 | std::shared_ptr httpreq = std::make_shared("cdn.garcya.us", "/wp-content/uploads/2010/04/TD250.jpg"); 15 | AsyncReqComponent* req = new AsyncReqComponent(mWindow, httpreq, 16 | [] (std::shared_ptr r) 17 | { 18 | LOG(LogInfo) << "Request completed"; 19 | LOG(LogInfo) << " error, if any: " << r->getErrorMsg(); 20 | }, [] () 21 | { 22 | LOG(LogInfo) << "Request canceled"; 23 | }); 24 | 25 | mWindow->pushGui(req); 26 | //we can forget about req, since it will always delete itself 27 | */ 28 | 29 | class AsyncReqComponent : public GuiComponent 30 | { 31 | public: 32 | 33 | AsyncReqComponent(Window* window, std::shared_ptr req, std::function)> onSuccess, std::function onCancel = nullptr); 34 | 35 | bool input(InputConfig* config, Input input) override; 36 | void update(int deltaTime) override; 37 | void render(const Transform4x4f& parentTrans) override; 38 | 39 | virtual std::vector getHelpPrompts() override; 40 | private: 41 | std::function)> mSuccessFunc; 42 | std::function mCancelFunc; 43 | 44 | unsigned int mTime; 45 | std::shared_ptr mRequest; 46 | }; 47 | 48 | #endif // ES_APP_COMPONENTS_ASYNC_REQ_COMPONENT_H 49 | -------------------------------------------------------------------------------- /es-app/src/components/RatingComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_COMPONENTS_RATING_COMPONENT_H 3 | #define ES_APP_COMPONENTS_RATING_COMPONENT_H 4 | 5 | #include "renderers/Renderer.h" 6 | #include "GuiComponent.h" 7 | 8 | class TextureResource; 9 | 10 | #define NUM_RATING_STARS 5 11 | 12 | // Used to visually display/edit some sort of "score" - e.g. 5/10, 3/5, etc. 13 | // setSize(x, y) works a little differently than you might expect: 14 | // * (0, y != 0) - x will be automatically calculated (5*y). 15 | // * (x != 0, 0) - y will be automatically calculated (x/5). 16 | // * (x != 0, y != 0) - you better be sure x = y*5 17 | class RatingComponent : public GuiComponent 18 | { 19 | public: 20 | RatingComponent(Window* window); 21 | 22 | std::string getValue() const override; 23 | void setValue(const std::string& value) override; // Should be a normalized float (in the range [0..1]) - if it's not, it will be clamped. 24 | 25 | bool input(InputConfig* config, Input input) override; 26 | void render(const Transform4x4f& parentTrans); 27 | 28 | void onSizeChanged() override; 29 | 30 | void setOpacity(unsigned char opacity) override; 31 | 32 | // Multiply all pixels in the image by this color when rendering. 33 | void setColorShift(unsigned int color); 34 | 35 | virtual void applyTheme(const std::shared_ptr& theme, const std::string& view, const std::string& element, unsigned int properties) override; 36 | 37 | virtual std::vector getHelpPrompts() override; 38 | 39 | private: 40 | void updateVertices(); 41 | void updateColors(); 42 | 43 | float mValue; 44 | 45 | Renderer::Vertex mVertices[8]; 46 | 47 | unsigned int mColorShift; 48 | unsigned int mUnfilledColor; 49 | 50 | std::shared_ptr mFilledTexture; 51 | std::shared_ptr mUnfilledTexture; 52 | }; 53 | 54 | #endif // ES_APP_COMPONENTS_RATING_COMPONENT_H 55 | -------------------------------------------------------------------------------- /es-app/src/es_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabricecaruso/old-EmulationStation-fork---see-batocera-emulationstation-instead/09936b0ad01bfef4696416d70de552e00dce3850/es-app/src/es_icon.ico -------------------------------------------------------------------------------- /es-app/src/guis/GuiCollectionSystemsOptions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_GUIS_GUI_COLLECTION_SYSTEM_OPTIONS_H 3 | #define ES_APP_GUIS_GUI_COLLECTION_SYSTEM_OPTIONS_H 4 | 5 | #include "components/MenuComponent.h" 6 | #include "GuiSettings.h" 7 | 8 | template 9 | class OptionListComponent; 10 | class SwitchComponent; 11 | class SystemData; 12 | 13 | class GuiCollectionSystemsOptions : public GuiSettings 14 | { 15 | public: 16 | GuiCollectionSystemsOptions(Window* window); 17 | ~GuiCollectionSystemsOptions(); 18 | 19 | private: 20 | void initializeMenu(); 21 | void addSystemsToMenu(); 22 | 23 | void updateSettings(std::string newAutoSettings, std::string newCustomSettings); 24 | void createCollection(std::string inName); 25 | void exitEditMode(); 26 | std::shared_ptr< OptionListComponent > autoOptionList; 27 | std::shared_ptr< OptionListComponent > customOptionList; 28 | 29 | SystemData* mSystem; 30 | }; 31 | 32 | #endif // ES_APP_GUIS_GUI_COLLECTION_SYSTEM_OPTIONS_H 33 | -------------------------------------------------------------------------------- /es-app/src/guis/GuiFastSelect.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_GUIS_GUI_FAST_SELECT_H 3 | #define ES_APP_GUIS_GUI_FAST_SELECT_H 4 | 5 | #include "components/NinePatchComponent.h" 6 | #include "components/TextComponent.h" 7 | #include "GuiComponent.h" 8 | 9 | class IGameListView; 10 | 11 | class GuiFastSelect : public GuiComponent 12 | { 13 | public: 14 | GuiFastSelect(Window* window, IGameListView* gamelist); 15 | 16 | bool input(InputConfig* config, Input input); 17 | void update(int deltaTime); 18 | 19 | private: 20 | void setScrollDir(int dir); 21 | void scroll(); 22 | void updateGameListCursor(); 23 | void updateGameListSort(); 24 | void updateSortText(); 25 | 26 | int mSortId; 27 | size_t mLetterId; 28 | 29 | int mScrollDir; 30 | int mScrollAccumulator; 31 | 32 | NinePatchComponent mBackground; 33 | TextComponent mSortText; 34 | TextComponent mLetterText; 35 | 36 | IGameListView* mGameList; 37 | }; 38 | 39 | #endif // ES_APP_GUIS_GUI_FAST_SELECT_H 40 | -------------------------------------------------------------------------------- /es-app/src/guis/GuiGameScraper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_GUIS_GUI_GAME_SCRAPER_H 3 | #define ES_APP_GUIS_GUI_GAME_SCRAPER_H 4 | 5 | #include "components/NinePatchComponent.h" 6 | #include "components/ScraperSearchComponent.h" 7 | #include "GuiComponent.h" 8 | 9 | class GuiGameScraper : public GuiComponent 10 | { 11 | public: 12 | GuiGameScraper(Window* window, ScraperSearchParams params, std::function doneFunc); 13 | 14 | void onSizeChanged() override; 15 | 16 | bool input(InputConfig* config, Input input) override; 17 | void update(int deltaTime); 18 | virtual std::vector getHelpPrompts() override; 19 | 20 | private: 21 | bool mClose; 22 | void close(); 23 | 24 | ComponentGrid mGrid; 25 | NinePatchComponent mBox; 26 | 27 | std::shared_ptr mGameName; 28 | std::shared_ptr mSystemName; 29 | std::shared_ptr mSearch; 30 | std::shared_ptr mButtonGrid; 31 | 32 | ScraperSearchParams mSearchParams; 33 | 34 | std::function mCancelFunc; 35 | }; 36 | 37 | #endif // ES_APP_GUIS_GUI_GAME_SCRAPER_H 38 | -------------------------------------------------------------------------------- /es-app/src/guis/GuiGamelistFilter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_GUIS_GUI_GAME_LIST_FILTER_H 3 | #define ES_APP_GUIS_GUI_GAME_LIST_FILTER_H 4 | 5 | #include "components/MenuComponent.h" 6 | #include "FileFilterIndex.h" 7 | #include "GuiComponent.h" 8 | 9 | template 10 | class OptionListComponent; 11 | class SystemData; 12 | 13 | class GuiGamelistFilter : public GuiComponent 14 | { 15 | public: 16 | GuiGamelistFilter(Window* window, SystemData* system); 17 | ~GuiGamelistFilter(); 18 | bool input(InputConfig* config, Input input) override; 19 | 20 | virtual std::vector getHelpPrompts() override; 21 | 22 | private: 23 | void initializeMenu(); 24 | void applyFilters(); 25 | void resetAllFilters(); 26 | void addFiltersToMenu(); 27 | 28 | std::map >> mFilterOptions; 29 | 30 | MenuComponent mMenu; 31 | SystemData* mSystem; 32 | FileFilterIndex* mFilterIndex; 33 | }; 34 | 35 | #endif // ES_APP_GUIS_GUI_GAME_LIST_FILTER_H 36 | -------------------------------------------------------------------------------- /es-app/src/guis/GuiGamelistOptions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_GUIS_GUI_GAME_LIST_OPTIONS_H 3 | #define ES_APP_GUIS_GUI_GAME_LIST_OPTIONS_H 4 | 5 | #include "components/MenuComponent.h" 6 | #include "components/OptionListComponent.h" 7 | #include "components/SliderComponent.h" 8 | #include "FileData.h" 9 | #include "GuiComponent.h" 10 | 11 | class IGameListView; 12 | class SystemData; 13 | 14 | class GuiGamelistOptions : public GuiComponent 15 | { 16 | public: 17 | GuiGamelistOptions(Window* window, SystemData* system, bool showGridFeatures = false); 18 | virtual ~GuiGamelistOptions(); 19 | 20 | virtual bool input(InputConfig* config, Input input) override; 21 | virtual std::vector getHelpPrompts() override; 22 | virtual HelpStyle getHelpStyle() override; 23 | 24 | static std::vector gridSizes; 25 | 26 | private: 27 | inline void addSaveFunc(const std::function& func) { mSaveFuncs.push_back(func); }; 28 | 29 | void addTextFilterToMenu(); 30 | void openGamelistFilter(); 31 | void openMetaDataEd(); 32 | void startEditMode(); 33 | void exitEditMode(); 34 | void jumpToLetter(); 35 | 36 | MenuComponent mMenu; 37 | 38 | typedef OptionListComponent LetterList; 39 | std::shared_ptr mJumpToLetterList; 40 | 41 | typedef OptionListComponent SortList; 42 | std::shared_ptr mListSort; 43 | 44 | std::shared_ptr mTextFilter; 45 | std::shared_ptr> mViewMode; 46 | std::shared_ptr> mGridSize; 47 | 48 | SystemData* mSystem; 49 | IGameListView* getGamelist(); 50 | bool fromPlaceholder; 51 | bool mFiltersChanged; 52 | 53 | std::vector< std::function > mSaveFuncs; 54 | bool mReloadAll; 55 | }; 56 | 57 | #endif // ES_APP_GUIS_GUI_GAME_LIST_OPTIONS_H 58 | -------------------------------------------------------------------------------- /es-app/src/guis/GuiGeneralScreensaverOptions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_GUIS_GUI_GENERAL_SCREENSAVER_OPTIONS_H 3 | #define ES_APP_GUIS_GUI_GENERAL_SCREENSAVER_OPTIONS_H 4 | 5 | #include "GuiScreensaverOptions.h" 6 | 7 | class GuiGeneralScreensaverOptions : public GuiScreensaverOptions 8 | { 9 | public: 10 | GuiGeneralScreensaverOptions(Window* window, std::string title); 11 | virtual ~GuiGeneralScreensaverOptions(); 12 | 13 | private: 14 | void openVideoScreensaverOptions(); 15 | void openSlideshowScreensaverOptions(); 16 | }; 17 | 18 | #endif // ES_APP_GUIS_GUI_GENERAL_SCREENSAVER_OPTIONS_H 19 | -------------------------------------------------------------------------------- /es-app/src/guis/GuiMenu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_GUIS_GUI_MENU_H 3 | #define ES_APP_GUIS_GUI_MENU_H 4 | 5 | #include "components/MenuComponent.h" 6 | #include "components/OptionListComponent.h" 7 | #include "GuiComponent.h" 8 | 9 | class GuiSettings; 10 | class SystemData; 11 | 12 | class GuiMenu : public GuiComponent 13 | { 14 | public: 15 | GuiMenu(Window* window, bool animate = true); 16 | 17 | bool input(InputConfig* config, Input input) override; 18 | void onSizeChanged() override; 19 | std::vector getHelpPrompts() override; 20 | HelpStyle getHelpStyle() override; 21 | 22 | static void openThemeConfiguration(Window* mWindow, GuiComponent* s, std::shared_ptr> theme_set, const std::string systemTheme = ""); 23 | 24 | private: 25 | void addEntry(std::string name, bool add_arrow, const std::function& func, const std::string iconName = ""); 26 | 27 | void addVersionInfo(); 28 | void openCollectionSystemSettings(); 29 | void openConfigInput(); 30 | void openOtherSettings(); 31 | void openQuitMenu(); 32 | void openScraperSettings(); 33 | void openScreensaverOptions(); 34 | void openSoundSettings(); 35 | void openUISettings(); 36 | void openUpdateSettings(); 37 | void openEmulatorSettings(); 38 | void openSystemEmulatorSettings(SystemData* system); 39 | 40 | void createInputTextRow(GuiSettings *gui, std::string title, const char *settingsID, bool password); 41 | 42 | MenuComponent mMenu; 43 | TextComponent mVersion; 44 | 45 | }; 46 | 47 | #endif // ES_APP_GUIS_GUI_MENU_H 48 | -------------------------------------------------------------------------------- /es-app/src/guis/GuiMetaDataEd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_GUIS_GUI_META_DATA_ED_H 3 | #define ES_APP_GUIS_GUI_META_DATA_ED_H 4 | 5 | #include "components/ComponentGrid.h" 6 | #include "components/NinePatchComponent.h" 7 | #include "scrapers/Scraper.h" 8 | #include "components/MenuComponent.h" 9 | #include "components/OptionListComponent.h" 10 | #include "GuiComponent.h" 11 | #include "MetaData.h" 12 | 13 | class ComponentList; 14 | class TextComponent; 15 | class FileData; 16 | 17 | class GuiMetaDataEd : public GuiComponent 18 | { 19 | public: 20 | GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector& mdd, ScraperSearchParams params, 21 | const std::string& header, std::function savedCallback, std::function deleteFunc, FileData* file); 22 | 23 | bool input(InputConfig* config, Input input) override; 24 | void onSizeChanged() override; 25 | virtual std::vector getHelpPrompts() override; 26 | 27 | private: 28 | void save(); 29 | void fetch(); 30 | void fetchDone(const ScraperSearchResult& result); 31 | void close(bool closeAllWindows); 32 | 33 | NinePatchComponent mBackground; 34 | ComponentGrid mGrid; 35 | 36 | std::shared_ptr mTitle; 37 | std::shared_ptr mSubtitle; 38 | std::shared_ptr mHeaderGrid; 39 | std::shared_ptr mList; 40 | std::shared_ptr mButtons; 41 | 42 | ScraperSearchParams mScraperParams; 43 | 44 | // typedef OptionListComponent CoreList; 45 | //std::shared_ptr mCoreList; 46 | 47 | std::vector< std::shared_ptr > mEditors; 48 | 49 | std::vector mMetaDataDecl; 50 | MetaDataList* mMetaData; 51 | std::function mSavedCallback; 52 | std::function mDeleteFunc; 53 | }; 54 | 55 | #endif // ES_APP_GUIS_GUI_META_DATA_ED_H 56 | -------------------------------------------------------------------------------- /es-app/src/guis/GuiScraperMulti.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_GUIS_GUI_SCRAPER_MULTI_H 3 | #define ES_APP_GUIS_GUI_SCRAPER_MULTI_H 4 | 5 | #include "components/ComponentGrid.h" 6 | #include "components/NinePatchComponent.h" 7 | #include "scrapers/Scraper.h" 8 | #include "GuiComponent.h" 9 | 10 | class ScraperSearchComponent; 11 | class TextComponent; 12 | 13 | class GuiScraperMulti : public GuiComponent 14 | { 15 | public: 16 | GuiScraperMulti(Window* window, const std::queue& searches, bool approveResults); 17 | virtual ~GuiScraperMulti(); 18 | 19 | void onSizeChanged() override; 20 | std::vector getHelpPrompts() override; 21 | 22 | private: 23 | void acceptResult(const ScraperSearchResult& result); 24 | void skip(); 25 | void doNextSearch(); 26 | 27 | void finish(); 28 | 29 | unsigned int mTotalGames; 30 | unsigned int mCurrentGame; 31 | unsigned int mTotalSuccessful; 32 | unsigned int mTotalSkipped; 33 | std::queue mSearchQueue; 34 | 35 | NinePatchComponent mBackground; 36 | ComponentGrid mGrid; 37 | 38 | std::shared_ptr mTitle; 39 | std::shared_ptr mSystem; 40 | std::shared_ptr mSubtitle; 41 | std::shared_ptr mSearchComp; 42 | std::shared_ptr mButtonGrid; 43 | }; 44 | 45 | #endif // ES_APP_GUIS_GUI_SCRAPER_MULTI_H 46 | -------------------------------------------------------------------------------- /es-app/src/guis/GuiScraperStart.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_GUIS_GUI_SCRAPER_START_H 3 | #define ES_APP_GUIS_GUI_SCRAPER_START_H 4 | 5 | #include "components/MenuComponent.h" 6 | #include "scrapers/Scraper.h" 7 | 8 | class FileData; 9 | template 10 | class OptionListComponent; 11 | class SwitchComponent; 12 | class SystemData; 13 | 14 | typedef std::function GameFilterFunc; 15 | 16 | //The starting point for a multi-game scrape. 17 | //Allows the user to set various parameters (to set filters, to set which systems to scrape, to enable manual mode). 18 | //Generates a list of "searches" that will be carried out by GuiScraperLog. 19 | class GuiScraperStart : public GuiComponent 20 | { 21 | public: 22 | GuiScraperStart(Window* window); 23 | 24 | bool input(InputConfig* config, Input input) override; 25 | 26 | virtual std::vector getHelpPrompts() override; 27 | 28 | private: 29 | void pressedStart(); 30 | void start(); 31 | std::queue getSearches(std::vector systems, GameFilterFunc selector); 32 | 33 | std::shared_ptr< OptionListComponent > mFilters; 34 | std::shared_ptr< OptionListComponent > mSystems; 35 | std::shared_ptr mApproveResults; 36 | 37 | MenuComponent mMenu; 38 | bool mOverwriteMedias; 39 | }; 40 | 41 | #endif // ES_APP_GUIS_GUI_SCRAPER_START_H 42 | -------------------------------------------------------------------------------- /es-app/src/guis/GuiScreensaverOptions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_GUIS_GUI_SCREENSAVER_OPTIONS_H 3 | #define ES_APP_GUIS_GUI_SCREENSAVER_OPTIONS_H 4 | 5 | #include "components/MenuComponent.h" 6 | 7 | // This is just a really simple template for a GUI that calls some save functions when closed. 8 | class GuiScreensaverOptions : public GuiComponent 9 | { 10 | public: 11 | GuiScreensaverOptions(Window* window, std::string title); 12 | virtual ~GuiScreensaverOptions(); // just calls save(); 13 | 14 | virtual void save(); 15 | inline void addRow(const ComponentListRow& row) { mMenu.addRow(row); }; 16 | inline void addWithLabel(const std::string& label, const std::shared_ptr& comp) { mMenu.addWithLabel(label, comp); }; 17 | inline void addSaveFunc(const std::function& func) { mSaveFuncs.push_back(func); }; 18 | void addEditableTextComponent(ComponentListRow row, const std::string label, std::shared_ptr ed, std::string value); 19 | 20 | bool input(InputConfig* config, Input input) override; 21 | std::vector getHelpPrompts() override; 22 | HelpStyle getHelpStyle() override; 23 | 24 | protected: 25 | MenuComponent mMenu; 26 | std::vector< std::function > mSaveFuncs; 27 | }; 28 | 29 | #endif // ES_APP_GUIS_GUI_SCREENSAVER_OPTIONS_H 30 | -------------------------------------------------------------------------------- /es-app/src/guis/GuiSettings.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_GUIS_GUI_SETTINGS_H 3 | #define ES_APP_GUIS_GUI_SETTINGS_H 4 | 5 | #include "components/MenuComponent.h" 6 | 7 | // This is just a really simple template for a GUI that calls some save functions when closed. 8 | class GuiSettings : public GuiComponent 9 | { 10 | public: 11 | GuiSettings(Window* window, const std::string title); 12 | virtual ~GuiSettings(); // just calls save(); 13 | 14 | void close(); 15 | void save(); 16 | 17 | inline void addRow(const ComponentListRow& row) { mMenu.addRow(row); }; 18 | inline void addWithLabel(const std::string& label, const std::shared_ptr& comp, bool setCursorHere = false) { mMenu.addWithLabel(label, comp, "", setCursorHere); }; 19 | inline void addSaveFunc(const std::function& func) { mSaveFuncs.push_back(func); }; 20 | inline void addEntry(const std::string name, bool add_arrow = false, const std::function& func = nullptr, const std::string iconName = "") { mMenu.addEntry(name, add_arrow, func, iconName); }; 21 | 22 | void addSubMenu(const std::string& label, const std::function& func); 23 | 24 | inline void setSave(bool sav) { mDoSave = sav; }; // batocera 25 | 26 | bool input(InputConfig* config, Input input) override; 27 | std::vector getHelpPrompts() override; 28 | HelpStyle getHelpStyle() override; 29 | 30 | MenuComponent& getMenu() { return mMenu; } 31 | 32 | inline void onFinalize(const std::function& func) { mOnFinalizeFunc = func; }; 33 | 34 | bool getVariable(const std::string name) 35 | { 36 | if (mVariableMap.find(name) == mVariableMap.cend()) 37 | return false; 38 | 39 | return mVariableMap[name]; 40 | } 41 | 42 | void setCloseButton(const std::string name) { mCloseButton = name; } 43 | void setVariable(const std::string name, bool value) { mVariableMap[name] = value; } 44 | void updatePosition(); 45 | 46 | void setTitle(const std::string title) { mMenu.setTitle(title); } 47 | void setSubTitle(const std::string text) { mMenu.setSubTitle(text); } 48 | 49 | protected: 50 | MenuComponent mMenu; 51 | 52 | private: 53 | bool mDoSave = true; // batocera 54 | 55 | std::vector< std::function > mSaveFuncs; 56 | std::function mOnFinalizeFunc; 57 | 58 | std::map mVariableMap; 59 | 60 | std::string mCloseButton; 61 | }; 62 | 63 | #endif // ES_APP_GUIS_GUI_SETTINGS_H 64 | -------------------------------------------------------------------------------- /es-app/src/guis/GuiSlideshowScreensaverOptions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_GUIS_GUI_SLIDESHOW_SCREENSAVER_OPTIONS_H 3 | #define ES_APP_GUIS_GUI_SLIDESHOW_SCREENSAVER_OPTIONS_H 4 | 5 | #include "GuiScreensaverOptions.h" 6 | 7 | class GuiSlideshowScreensaverOptions : public GuiScreensaverOptions 8 | { 9 | public: 10 | GuiSlideshowScreensaverOptions(Window* window, const char* title); 11 | virtual ~GuiSlideshowScreensaverOptions(); 12 | 13 | private: 14 | void addEditableTextComponent(ComponentListRow row, const std::string label, std::shared_ptr ed, std::string value); 15 | void addWithLabel(ComponentListRow row, const std::string label, std::shared_ptr component); 16 | }; 17 | 18 | #endif // ES_APP_GUIS_GUI_SLIDESHOW_SCREENSAVER_OPTIONS_H 19 | -------------------------------------------------------------------------------- /es-app/src/guis/GuiThemeInstall.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "GuiComponent.h" 5 | #include "components/MenuComponent.h" 6 | #include "components/ComponentGrid.h" 7 | #include "components/TextComponent.h" 8 | 9 | template 10 | class OptionListComponent; 11 | 12 | // Batocera 13 | class GuiThemeInstall : public GuiComponent 14 | { 15 | public: 16 | GuiThemeInstall(Window* window); 17 | bool input(InputConfig* config, Input input) override; 18 | 19 | virtual std::vector getHelpPrompts() override; 20 | 21 | private: 22 | void start(std::string themeName); 23 | 24 | MenuComponent mMenu; 25 | }; 26 | -------------------------------------------------------------------------------- /es-app/src/guis/GuiVideoScreensaverOptions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_GUIS_GUI_VIDEO_SCREENSAVER_OPTIONS_H 3 | #define ES_APP_GUIS_GUI_VIDEO_SCREENSAVER_OPTIONS_H 4 | 5 | #include "GuiScreensaverOptions.h" 6 | 7 | class GuiVideoScreensaverOptions : public GuiScreensaverOptions 8 | { 9 | public: 10 | GuiVideoScreensaverOptions(Window* window, const char* title); 11 | virtual ~GuiVideoScreensaverOptions(); 12 | 13 | void save() override; 14 | }; 15 | 16 | #endif // ES_APP_GUIS_GUI_VIDEO_SCREENSAVER_OPTIONS_H 17 | -------------------------------------------------------------------------------- /es-app/src/scrapers/GamesDBJSONScraper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_SCRAPERS_GAMES_DB_JSON_SCRAPER_H 3 | #define ES_APP_SCRAPERS_GAMES_DB_JSON_SCRAPER_H 4 | 5 | #include "scrapers/Scraper.h" 6 | 7 | namespace pugi 8 | { 9 | class xml_document; 10 | } 11 | 12 | void thegamesdb_generate_json_scraper_requests(const ScraperSearchParams& params, 13 | std::queue>& requests, std::vector& results); 14 | 15 | class TheGamesDBJSONRequest : public ScraperHttpRequest 16 | { 17 | public: 18 | // ctor for a GetGameList request 19 | TheGamesDBJSONRequest(std::queue>& requestsWrite, 20 | std::vector& resultsWrite, const std::string& url) 21 | : ScraperHttpRequest(resultsWrite, url), mRequestQueue(&requestsWrite) 22 | { 23 | } 24 | // ctor for a GetGame request 25 | TheGamesDBJSONRequest(std::vector& resultsWrite, const std::string& url) 26 | : ScraperHttpRequest(resultsWrite, url), mRequestQueue(nullptr) 27 | { 28 | } 29 | 30 | protected: 31 | bool process(HttpReq* request, std::vector& results) override; 32 | bool isGameRequest() { return !mRequestQueue; } 33 | 34 | std::queue>* mRequestQueue; 35 | }; 36 | 37 | #endif // ES_APP_SCRAPERS_GAMES_DB_JSON_SCRAPER_H 38 | -------------------------------------------------------------------------------- /es-app/src/scrapers/GamesDBJSONScraperResources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_SCRAPERS_GAMES_DB_JSON_SCRAPER_RESOURCES_H 3 | #define ES_APP_SCRAPERS_GAMES_DB_JSON_SCRAPER_RESOURCES_H 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "HttpReq.h" 11 | 12 | 13 | struct TheGamesDBJSONRequestResources 14 | { 15 | TheGamesDBJSONRequestResources() = default; 16 | 17 | void prepare(); 18 | void ensureResources(); 19 | std::string getApiKey() const; 20 | 21 | std::unordered_map gamesdb_new_developers_map; 22 | std::unordered_map gamesdb_new_publishers_map; 23 | std::unordered_map gamesdb_new_genres_map; 24 | 25 | private: 26 | bool checkLoaded(); 27 | 28 | bool saveResource(HttpReq* req, std::unordered_map& resource, const std::string& resource_name, 29 | const std::string& file_name); 30 | std::unique_ptr fetchResource(const std::string& endpoint); 31 | 32 | int loadResource( 33 | std::unordered_map& resource, const std::string& resource_name, const std::string& file_name); 34 | 35 | std::unique_ptr gamesdb_developers_resource_request; 36 | std::unique_ptr gamesdb_publishers_resource_request; 37 | std::unique_ptr gamesdb_genres_resource_request; 38 | }; 39 | 40 | std::string getScrapersResouceDir(); 41 | 42 | #endif // ES_APP_SCRAPERS_GAMES_DB_JSON_SCRAPER_H 43 | -------------------------------------------------------------------------------- /es-app/src/scrapers/ThreadedScraper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "Scraper.h" 5 | #include "components/AsyncNotificationComponent.h" 6 | 7 | class ThreadedScraper 8 | { 9 | public: 10 | static void start(Window* window, const std::queue& searches); 11 | static void stop(); 12 | static bool isRunning() { return mInstance != nullptr; } 13 | 14 | static void pause() { mPaused = true; } 15 | static void resume() { mPaused = false; } 16 | 17 | private: 18 | ThreadedScraper(Window* window, const std::queue& searches); 19 | ~ThreadedScraper(); 20 | 21 | Window* mWindow; 22 | AsyncNotificationComponent* mWndNotification; 23 | std::string mCurrentAction; 24 | 25 | std::vector mErrors; 26 | 27 | void run(); 28 | 29 | std::thread* mHandle; 30 | std::queue mSearchQueue; 31 | 32 | ScraperSearchParams mLastSearch; 33 | std::unique_ptr mSearchHandle; 34 | std::unique_ptr mMDResolveHandle; 35 | 36 | void search(const ScraperSearchParams& params); 37 | void processMedias(ScraperSearchResult result); 38 | void acceptResult(const ScraperSearchResult& result); 39 | void processError(int status, const std::string statusString); 40 | 41 | std::string formatGameName(FileData* game); 42 | 43 | int mTotal; 44 | bool mExit; 45 | 46 | static bool mPaused; 47 | static ThreadedScraper* mInstance; 48 | }; 49 | 50 | -------------------------------------------------------------------------------- /es-app/src/views/UIModeController.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_VIEWS_UI_MODE_CONTROLLER_H 3 | #define ES_APP_VIEWS_UI_MODE_CONTROLLER_H 4 | 5 | #include 6 | #include 7 | 8 | class FileData; 9 | class InputConfig; 10 | class ViewController; 11 | 12 | struct Input; 13 | 14 | class UIModeController { 15 | public: 16 | static UIModeController* getInstance(); 17 | 18 | // Monitor input for UI mode change, returns true (consumes input) when UI mode change is triggered. 19 | bool listen(InputConfig* config, Input input); 20 | 21 | // Get the current Passphrase as a (unicode) formatted, comma-separated, string. 22 | std::string getFormattedPassKeyStr(); 23 | 24 | // Check for change in UI mode. 25 | void monitorUIMode(); 26 | 27 | bool isUIModeFull(); 28 | bool isUIModeKid(); 29 | bool isUIModeKiosk(); 30 | inline std::vector getUIModes() { return mUIModes; }; 31 | private: 32 | UIModeController(); 33 | bool inputIsMatch(InputConfig * config, Input input); 34 | bool isValidInput(InputConfig * config, Input input); 35 | void logInput(InputConfig * config, Input input); 36 | 37 | // Return UI mode to 'FULL' 38 | void unlockUIMode(); 39 | 40 | static UIModeController * sInstance; 41 | const std::vector mUIModes = { "Full", "Kiosk", "Kid" }; 42 | 43 | // default passkeyseq = "uuddlrlrba", as defined in the setting 'UIMode_passkey'. 44 | std::string mPassKeySequence; 45 | int mPassKeyCounter; 46 | const std::vector mInputVals = { "up", "down", "left", "right", "a", "b", "x", "y" }; 47 | std::string mCurrentUIMode; 48 | }; 49 | 50 | #endif // ES_APP_VIEWS_UI_MODE_CONTROLLER_H 51 | -------------------------------------------------------------------------------- /es-app/src/views/gamelist/BasicGameListView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_VIEWS_GAME_LIST_BASIC_GAME_LIST_VIEW_H 3 | #define ES_APP_VIEWS_GAME_LIST_BASIC_GAME_LIST_VIEW_H 4 | 5 | #include "components/TextListComponent.h" 6 | #include "views/gamelist/ISimpleGameListView.h" 7 | 8 | class BasicGameListView : public ISimpleGameListView 9 | { 10 | public: 11 | BasicGameListView(Window* window, FolderData* root); 12 | 13 | // Called when a FileData* is added, has its metadata changed, or is removed 14 | virtual void onFileChanged(FileData* file, FileChangeType change); 15 | 16 | virtual void onThemeChanged(const std::shared_ptr& theme); 17 | 18 | virtual FileData* getCursor() override; 19 | virtual void setCursor(FileData* file) override; 20 | 21 | virtual const char* getName() const override 22 | { 23 | if (!mCustomThemeName.empty()) 24 | return mCustomThemeName.c_str(); 25 | 26 | return "basic"; 27 | } 28 | 29 | virtual std::vector getHelpPrompts() override; 30 | virtual void launch(FileData* game) override; 31 | 32 | virtual void setThemeName(std::string name); 33 | virtual void onShow() override; 34 | 35 | protected: 36 | virtual std::vector getFileDataEntries() override; 37 | 38 | virtual std::string getQuickSystemSelectRightButton() override; 39 | virtual std::string getQuickSystemSelectLeftButton() override; 40 | virtual void populateList(const std::vector& files) override; 41 | virtual void remove(FileData* game, bool deleteFile) override; 42 | virtual void addPlaceholder(); 43 | 44 | TextListComponent mList; 45 | bool mLoaded; 46 | }; 47 | 48 | #endif // ES_APP_VIEWS_GAME_LIST_BASIC_GAME_LIST_VIEW_H 49 | -------------------------------------------------------------------------------- /es-app/src/views/gamelist/DetailedGameListView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_VIEWS_GAME_LIST_DETAILED_GAME_LIST_VIEW_H 3 | #define ES_APP_VIEWS_GAME_LIST_DETAILED_GAME_LIST_VIEW_H 4 | 5 | #include "components/DateTimeComponent.h" 6 | #include "components/RatingComponent.h" 7 | #include "components/ScrollableContainer.h" 8 | #include "views/gamelist/BasicGameListView.h" 9 | 10 | class VideoComponent; 11 | 12 | class DetailedGameListView : public BasicGameListView 13 | { 14 | public: 15 | DetailedGameListView(Window* window, FolderData* root); 16 | ~DetailedGameListView(); 17 | 18 | virtual void onThemeChanged(const std::shared_ptr& theme) override; 19 | virtual void onShow() override; 20 | 21 | virtual const char* getName() const override 22 | { 23 | if (!mCustomThemeName.empty()) 24 | return mCustomThemeName.c_str(); 25 | 26 | return "detailed"; 27 | } 28 | 29 | virtual void launch(FileData* game) override; 30 | 31 | private: 32 | void updateInfoPanel(); 33 | 34 | void createVideo(); 35 | void createMarquee(); 36 | void createImage(); 37 | void createThumbnail(); 38 | 39 | void initMDLabels(); 40 | void initMDValues(); 41 | std::string getMetadata(FileData* file, std::string name); 42 | 43 | ImageComponent* mImage; 44 | ImageComponent* mThumbnail; 45 | ImageComponent* mMarquee; 46 | VideoComponent* mVideo; 47 | 48 | TextComponent mLblRating, mLblReleaseDate, mLblDeveloper, mLblPublisher, mLblGenre, mLblPlayers, mLblLastPlayed, mLblPlayCount; 49 | 50 | RatingComponent mRating; 51 | DateTimeComponent mReleaseDate; 52 | TextComponent mDeveloper; 53 | TextComponent mPublisher; 54 | TextComponent mGenre; 55 | TextComponent mPlayers; 56 | DateTimeComponent mLastPlayed; 57 | TextComponent mPlayCount; 58 | TextComponent mName; 59 | 60 | std::vector getMDLabels(); 61 | std::vector getMDValues(); 62 | 63 | ScrollableContainer mDescContainer; 64 | TextComponent mDescription; 65 | 66 | 67 | }; 68 | 69 | #endif // ES_APP_VIEWS_GAME_LIST_DETAILED_GAME_LIST_VIEW_H 70 | -------------------------------------------------------------------------------- /es-app/src/views/gamelist/IGameListView.cpp: -------------------------------------------------------------------------------- 1 | #include "views/gamelist/IGameListView.h" 2 | 3 | #include "guis/GuiGamelistOptions.h" 4 | #include "views/UIModeController.h" 5 | #include "views/ViewController.h" 6 | #include "Sound.h" 7 | #include "Window.h" 8 | 9 | void IGameListView::setThemeName(std::string name) 10 | { 11 | mCustomThemeName = name; 12 | } 13 | 14 | bool IGameListView::input(InputConfig* config, Input input) 15 | { 16 | // select to open GuiGamelistOptions 17 | if(!UIModeController::getInstance()->isUIModeKid() && config->isMappedTo("select", input) && input.value) 18 | { 19 | Sound::getFromTheme(mTheme, getName(), "menuOpen")->play(); 20 | mWindow->pushGui(new GuiGamelistOptions(mWindow, this->mRoot->getSystem())); 21 | return true; 22 | 23 | // Ctrl-R to reload a view when debugging 24 | }else if(Settings::getInstance()->getBool("Debug") && config->getDeviceId() == DEVICE_KEYBOARD && 25 | (SDL_GetModState() & (KMOD_LCTRL | KMOD_RCTRL)) && input.id == SDLK_r && input.value != 0) 26 | { 27 | LOG(LogDebug) << "reloading view"; 28 | ViewController::get()->reloadGameListView(this, true); 29 | return true; 30 | } 31 | 32 | return GuiComponent::input(config, input); 33 | } 34 | 35 | void IGameListView::setTheme(const std::shared_ptr& theme) 36 | { 37 | mTheme = theme; 38 | onThemeChanged(theme); 39 | } 40 | 41 | HelpStyle IGameListView::getHelpStyle() 42 | { 43 | HelpStyle style; 44 | style.applyTheme(mTheme, getName()); 45 | return style; 46 | } 47 | 48 | void IGameListView::render(const Transform4x4f& parentTrans) 49 | { 50 | Transform4x4f trans = parentTrans * getTransform(); 51 | 52 | float scaleX = trans.r0().x(); 53 | float scaleY = trans.r1().y(); 54 | 55 | Vector2i pos((int)Math::round(trans.translation()[0]), (int)Math::round(trans.translation()[1])); 56 | Vector2i size((int)Math::round(mSize.x() * scaleX), (int)Math::round(mSize.y() * scaleY)); 57 | 58 | Vector2f clipPos(trans.translation().x(), trans.translation().y()); 59 | if (!Renderer::isVisibleOnScreen(clipPos.x(), clipPos.y(), size.x(), size.y())) 60 | return; 61 | 62 | Renderer::pushClipRect(pos, size); 63 | renderChildren(trans); 64 | Renderer::popClipRect(); 65 | } 66 | -------------------------------------------------------------------------------- /es-app/src/views/gamelist/IGameListView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_VIEWS_GAME_LIST_IGAME_LIST_VIEW_H 3 | #define ES_APP_VIEWS_GAME_LIST_IGAME_LIST_VIEW_H 4 | 5 | #include "renderers/Renderer.h" 6 | #include "FileData.h" 7 | #include "GuiComponent.h" 8 | 9 | class ThemeData; 10 | class Window; 11 | 12 | // This is an interface that defines the minimum for a GameListView. 13 | class IGameListView : public GuiComponent 14 | { 15 | public: 16 | IGameListView(Window* window, FolderData* root) : GuiComponent(window), mRoot(root) 17 | { setSize((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight()); } 18 | 19 | virtual ~IGameListView() {} 20 | 21 | // Called when a new file is added, a file is removed, a file's metadata changes, or a file's children are sorted. 22 | // NOTE: FILE_SORTED is only reported for the topmost FileData, where the sort started. 23 | // Since sorts are recursive, that FileData's children probably changed too. 24 | virtual void onFileChanged(FileData* file, FileChangeType change) = 0; 25 | 26 | // Called whenever the theme changes. 27 | virtual void onThemeChanged(const std::shared_ptr& theme) = 0; 28 | 29 | void setTheme(const std::shared_ptr& theme); 30 | inline const std::shared_ptr& getTheme() const { return mTheme; } 31 | 32 | virtual FileData* getCursor() = 0; 33 | virtual void setCursor(FileData*) = 0; 34 | 35 | virtual bool input(InputConfig* config, Input input) override; 36 | virtual void remove(FileData* game, bool deleteFile) = 0; 37 | 38 | virtual const char* getName() const = 0; 39 | virtual void launch(FileData* game) = 0; 40 | 41 | virtual HelpStyle getHelpStyle() override; 42 | 43 | void render(const Transform4x4f& parentTrans) override; 44 | 45 | virtual void setThemeName(std::string name); 46 | 47 | virtual std::vector getEntriesLetters() = 0; 48 | 49 | protected: 50 | std::string mCustomThemeName; 51 | 52 | FolderData* mRoot; 53 | std::shared_ptr mTheme; 54 | }; 55 | 56 | #endif // ES_APP_VIEWS_GAME_LIST_IGAME_LIST_VIEW_H 57 | -------------------------------------------------------------------------------- /es-app/src/views/gamelist/ISimpleGameListView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_VIEWS_GAME_LIST_ISIMPLE_GAME_LIST_VIEW_H 3 | #define ES_APP_VIEWS_GAME_LIST_ISIMPLE_GAME_LIST_VIEW_H 4 | 5 | #include "components/ImageComponent.h" 6 | #include "components/TextComponent.h" 7 | #include "views/gamelist/IGameListView.h" 8 | #include 9 | 10 | class ISimpleGameListView : public IGameListView 11 | { 12 | public: 13 | ISimpleGameListView(Window* window, FolderData* root); 14 | virtual ~ISimpleGameListView() {} 15 | 16 | // Called when a new file is added, a file is removed, a file's metadata changes, or a file's children are sorted. 17 | // NOTE: FILE_SORTED is only reported for the topmost FileData, where the sort started. 18 | // Since sorts are recursive, that FileData's children probably changed too. 19 | virtual void onFileChanged(FileData* file, FileChangeType change); 20 | 21 | // Called whenever the theme changes. 22 | virtual void onThemeChanged(const std::shared_ptr& theme); 23 | 24 | virtual FileData* getCursor() = 0; 25 | virtual void setCursor(FileData*) = 0; 26 | 27 | virtual bool input(InputConfig* config, Input input) override; 28 | virtual void launch(FileData* game) = 0; 29 | 30 | virtual std::vector getEntriesLetters() override; 31 | 32 | protected: 33 | virtual std::vector getFileDataEntries() = 0; 34 | 35 | virtual std::string getQuickSystemSelectRightButton() = 0; 36 | virtual std::string getQuickSystemSelectLeftButton() = 0; 37 | virtual void populateList(const std::vector& files) = 0; 38 | 39 | TextComponent mHeaderText; 40 | ImageComponent mHeaderImage; 41 | ImageComponent mBackground; 42 | 43 | 44 | std::vector mThemeExtras; 45 | 46 | std::stack mCursorStack; 47 | }; 48 | 49 | #endif // ES_APP_VIEWS_GAME_LIST_ISIMPLE_GAME_LIST_VIEW_H 50 | -------------------------------------------------------------------------------- /es-app/src/views/gamelist/VideoGameListView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_VIEWS_GAME_LIST_VIDEO_GAME_LIST_VIEW_H 3 | #define ES_APP_VIEWS_GAME_LIST_VIDEO_GAME_LIST_VIEW_H 4 | 5 | #include "components/DateTimeComponent.h" 6 | #include "components/RatingComponent.h" 7 | #include "components/ScrollableContainer.h" 8 | #include "views/gamelist/BasicGameListView.h" 9 | 10 | class VideoComponent; 11 | 12 | class VideoGameListView : public BasicGameListView 13 | { 14 | public: 15 | VideoGameListView(Window* window, FolderData* root); 16 | virtual ~VideoGameListView(); 17 | 18 | virtual void onShow() override; 19 | 20 | virtual void onThemeChanged(const std::shared_ptr& theme) override; 21 | 22 | virtual const char* getName() const override 23 | { 24 | if (!mCustomThemeName.empty()) 25 | return mCustomThemeName.c_str(); 26 | 27 | return "video"; 28 | } 29 | 30 | virtual void launch(FileData* game) override; 31 | 32 | protected: 33 | virtual void update(int deltaTime) override; 34 | 35 | private: 36 | void updateInfoPanel(); 37 | void createImage(); 38 | void createThumbnail(); 39 | 40 | void initMDLabels(); 41 | void initMDValues(); 42 | 43 | ImageComponent mMarquee; 44 | VideoComponent* mVideo; 45 | ImageComponent* mImage; 46 | ImageComponent* mThumbnail; 47 | 48 | TextComponent mLblRating, mLblReleaseDate, mLblDeveloper, mLblPublisher, mLblGenre, mLblPlayers, mLblLastPlayed, mLblPlayCount; 49 | 50 | RatingComponent mRating; 51 | DateTimeComponent mReleaseDate; 52 | TextComponent mDeveloper; 53 | TextComponent mPublisher; 54 | TextComponent mGenre; 55 | TextComponent mPlayers; 56 | DateTimeComponent mLastPlayed; 57 | TextComponent mPlayCount; 58 | TextComponent mName; 59 | 60 | std::vector getMDLabels(); 61 | std::vector getMDValues(); 62 | 63 | ScrollableContainer mDescContainer; 64 | TextComponent mDescription; 65 | 66 | bool mVideoPlaying; 67 | 68 | }; 69 | 70 | #endif // ES_APP_VIEWS_GAME_LIST_VIDEO_GAME_LIST_VIEW_H 71 | -------------------------------------------------------------------------------- /es-core/src/AsyncHandle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_ASYNC_HANDLE_H 3 | #define ES_CORE_ASYNC_HANDLE_H 4 | 5 | #include 6 | 7 | enum AsyncHandleStatus 8 | { 9 | ASYNC_IN_PROGRESS, 10 | ASYNC_ERROR, 11 | ASYNC_DONE 12 | }; 13 | 14 | // Handle for some asynchronous operation. 15 | class AsyncHandle 16 | { 17 | public: 18 | AsyncHandle() : mStatus(ASYNC_IN_PROGRESS), mErrorCode(200) {}; 19 | virtual ~AsyncHandle() {}; 20 | 21 | virtual void update() = 0; 22 | 23 | // Update and return the latest status. 24 | inline AsyncHandleStatus status() { update(); return mStatus; } 25 | 26 | virtual int getPercent() { return -1; } 27 | 28 | int getErrorCode() { return mErrorCode; } 29 | 30 | // User-friendly string of our current status. Will return error message if status() == SEARCH_ERROR. 31 | inline std::string getStatusString() 32 | { 33 | switch(mStatus) 34 | { 35 | case ASYNC_IN_PROGRESS: 36 | return "in progress"; 37 | case ASYNC_ERROR: 38 | return mError; 39 | case ASYNC_DONE: 40 | return "done"; 41 | default: 42 | return "something impossible has occured; row, row, fight the power"; 43 | } 44 | } 45 | 46 | protected: 47 | inline void setStatus(AsyncHandleStatus status) { mStatus = status; } 48 | 49 | inline void setError(const std::string& error) { setStatus(ASYNC_ERROR); mError = error; } 50 | inline void setError(int errorCode, const std::string& error) { setStatus(ASYNC_ERROR); mError = error; mErrorCode = errorCode; } 51 | 52 | int mErrorCode; 53 | std::string mError; 54 | AsyncHandleStatus mStatus; 55 | }; 56 | 57 | #endif // ES_CORE_ASYNC_HANDLE_H 58 | -------------------------------------------------------------------------------- /es-core/src/AudioManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_AUDIO_MANAGER_H 3 | #define ES_CORE_AUDIO_MANAGER_H 4 | 5 | #include 6 | #include 7 | #include 8 | #include "SDL_mixer.h" 9 | #include "ThemeData.h" 10 | #include 11 | 12 | class Sound; 13 | 14 | class AudioManager 15 | { 16 | 17 | public: 18 | static std::shared_ptr & getInstance(); 19 | static bool isInitialized(); 20 | 21 | void init(); 22 | void deinit(); 23 | 24 | void registerSound(std::shared_ptr & sound); 25 | void unregisterSound(std::shared_ptr & sound); 26 | 27 | void play(); 28 | void stop(); 29 | 30 | void playRandomMusic(bool continueIfPlaying = true); 31 | void stopMusic(); 32 | void themeChanged(const std::shared_ptr& theme, bool force=false); 33 | 34 | void setSystemName(std::string name) { 35 | mSystemName = name; 36 | } 37 | 38 | std::string popSongName() 39 | { 40 | if (!mCurrentSong.empty()) 41 | { 42 | std::string ret = mCurrentSong; 43 | mCurrentSong = ""; 44 | return ret; 45 | } 46 | 47 | return ""; 48 | } 49 | 50 | virtual ~AudioManager(); 51 | 52 | float mMusicVolume; 53 | int mVideoPlaying; 54 | 55 | static void setVideoPlaying(bool state); 56 | static void update(int deltaTime); 57 | 58 | private: 59 | AudioManager(); 60 | 61 | static std::vector> sSoundVector; 62 | static std::shared_ptr sInstance; 63 | 64 | 65 | static void onMusicFinished(); 66 | 67 | void findMusic(const std::string &path, std::vector& all_matching_files); 68 | void playMusic(std::string path); 69 | 70 | std::string mCurrentSong; 71 | std::string mCurrentMusicPath; 72 | std::string mSystemName; 73 | std::string mCurrentThemeMusicDirectory; 74 | bool mRunningFromPlaylist; 75 | bool mInitialized; 76 | 77 | Mix_Music* mCurrentMusic; 78 | 79 | 80 | }; 81 | 82 | #endif // ES_CORE_AUDIO_MANAGER_H 83 | -------------------------------------------------------------------------------- /es-core/src/CECInput.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_CECINPUT_H 3 | #define ES_CORE_CECINPUT_H 4 | 5 | #include 6 | 7 | namespace CEC { class ICECAdapter; } 8 | 9 | class CECInput 10 | { 11 | public: 12 | 13 | static void init (); 14 | static void deinit (); 15 | static std::string getAlertTypeString(const unsigned int _type); 16 | static std::string getOpCodeString (const unsigned int _opCode); 17 | static std::string getKeyCodeString (const unsigned int _keyCode); 18 | 19 | private: 20 | 21 | CECInput(); 22 | ~CECInput(); 23 | 24 | static CECInput* sInstance; 25 | 26 | CEC::ICECAdapter* mlibCEC; 27 | 28 | }; // CECInput 29 | 30 | #endif // ES_CORE_CECINPUT_H 31 | -------------------------------------------------------------------------------- /es-core/src/EsLocale.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include "utils/StringUtil.h" 7 | 8 | struct PluralRule 9 | { 10 | std::string key; 11 | std::string rule; 12 | std::function evaluate; 13 | }; 14 | 15 | class EsLocale 16 | { 17 | public: 18 | static const std::string getText(const std::string text); 19 | static const std::string nGetText(const std::string msgid, const std::string msgid_plural, int n); 20 | 21 | static const std::string getLanguage() { return mCurrentLanguage; } 22 | 23 | static const void reset() { mCurrentLanguageLoaded = false; } 24 | 25 | private: 26 | static void checkLocalisationLoaded(); 27 | static std::map mItems; 28 | static std::string mCurrentLanguage; 29 | static bool mCurrentLanguageLoaded; 30 | 31 | static PluralRule mPluralRule; 32 | }; 33 | 34 | 35 | #if defined(_WIN32) 36 | #define UNICODE_CHARTYPE wchar_t* 37 | #define _L(x) L ## x 38 | #define _U(x) Utils::String::convertFromWideString(L ## x) 39 | 40 | #define _(x) EsLocale::getText(x) 41 | #else 42 | 43 | #define UNICODE_CHARTYPE char* 44 | #define _L(x) x 45 | #define _U(x) x 46 | 47 | #define _(x) EsLocale::getText(x) 48 | #endif // _WIN32 49 | 50 | -------------------------------------------------------------------------------- /es-core/src/HelpPrompt.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_HELP_PROMPT_H 3 | #define ES_CORE_HELP_PROMPT_H 4 | 5 | #include 6 | 7 | typedef std::pair HelpPrompt; 8 | 9 | #endif // ES_CORE_HELP_PROMPT_H 10 | -------------------------------------------------------------------------------- /es-core/src/HelpStyle.cpp: -------------------------------------------------------------------------------- 1 | #include "HelpStyle.h" 2 | 3 | #include "resources/Font.h" 4 | 5 | HelpStyle::HelpStyle() 6 | { 7 | position = Vector2f(Renderer::getScreenWidth() * 0.012f, Renderer::getScreenHeight() * 0.9515f); 8 | origin = Vector2f(0.0f, 0.0f); 9 | iconColor = 0x777777FF; 10 | textColor = 0x777777FF; 11 | font = nullptr; 12 | 13 | if (FONT_SIZE_SMALL != 0) 14 | font = Font::get(FONT_SIZE_SMALL); 15 | } 16 | 17 | void HelpStyle::applyTheme(const std::shared_ptr& theme, const std::string& view) 18 | { 19 | auto elem = theme->getElement(view, "help", "helpsystem"); 20 | if(!elem) 21 | return; 22 | 23 | if(elem->has("pos")) 24 | position = elem->get("pos") * Vector2f((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight()); 25 | 26 | if(elem->has("origin")) 27 | origin = elem->get("origin"); 28 | 29 | if(elem->has("textColor")) 30 | textColor = elem->get("textColor"); 31 | 32 | if(elem->has("iconColor")) 33 | iconColor = elem->get("iconColor"); 34 | 35 | if(elem->has("fontPath") || elem->has("fontSize")) 36 | font = Font::getFromTheme(elem, ThemeFlags::ALL, font); 37 | 38 | if (elem->has("iconUpDown")) 39 | iconMap["up/down"] = elem->get("iconUpDown"); 40 | 41 | if (elem->has("iconLeftRight")) 42 | iconMap["left/right"] = elem->get("iconLeftRight"); 43 | 44 | if (elem->has("iconUpDownLeftRight")) 45 | iconMap["up/down/left/right"] = elem->get("iconUpDownLeftRight"); 46 | 47 | if (elem->has("iconA")) 48 | iconMap["a"] = elem->get("iconA"); 49 | 50 | if (elem->has("iconB")) 51 | iconMap["b"] = elem->get("iconB"); 52 | 53 | if (elem->has("iconX")) 54 | iconMap["x"] = elem->get("iconX"); 55 | 56 | if (elem->has("iconY")) 57 | iconMap["y"] = elem->get("iconY"); 58 | 59 | if (elem->has("iconL")) 60 | iconMap["l"] = elem->get("iconL"); 61 | 62 | if (elem->has("iconR")) 63 | iconMap["r"] = elem->get("iconR"); 64 | 65 | if (elem->has("iconStart")) 66 | iconMap["start"] = elem->get("iconStart"); 67 | 68 | if (elem->has("iconSelect")) 69 | iconMap["select"] = elem->get("iconSelect"); 70 | } 71 | -------------------------------------------------------------------------------- /es-core/src/HelpStyle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_HELP_STYLE_H 3 | #define ES_CORE_HELP_STYLE_H 4 | 5 | #include "math/Vector2f.h" 6 | #include 7 | #include 8 | #include 9 | 10 | class Font; 11 | class ThemeData; 12 | 13 | struct HelpStyle 14 | { 15 | Vector2f position; 16 | Vector2f origin; 17 | unsigned int iconColor; 18 | unsigned int textColor; 19 | std::shared_ptr font; 20 | std::map iconMap; 21 | 22 | HelpStyle(); // default values 23 | void applyTheme(const std::shared_ptr& theme, const std::string& view); 24 | }; 25 | 26 | #endif // ES_CORE_HELP_STYLE_H 27 | -------------------------------------------------------------------------------- /es-core/src/ImageIO.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_IMAGE_IO 3 | #define ES_CORE_IMAGE_IO 4 | 5 | #include 6 | #include 7 | 8 | #include "math/Vector2i.h" 9 | #include "math/Vector2f.h" 10 | 11 | class ImageIO 12 | { 13 | public: 14 | static std::vector loadFromMemoryRGBA32(const unsigned char * data, const size_t size, size_t & width, size_t & height); 15 | static unsigned char* loadFromMemoryRGBA32Ex(const unsigned char * data, const size_t size, size_t & width, size_t & height, int maxWidth, int maxHeight, bool externZoom, Vector2i& baseSize, Vector2i& packedSize); 16 | 17 | static bool getImageSize(const char *fn, unsigned int *x, unsigned int *y); 18 | 19 | static void flipPixelsVert(unsigned char* imagePx, const size_t& width, const size_t& height); 20 | static Vector2i adjustPictureSize(Vector2i imageSize, Vector2i maxSize, bool externSize = false); 21 | static Vector2f adjustExternPictureSizef(Vector2f imageSize, Vector2f maxSize); 22 | static Vector2f adjustPictureSizef(Vector2f imageSize, Vector2f maxSize); 23 | 24 | static void loadImageCache(); 25 | static void saveImageCache(); 26 | 27 | static void updateImageCache(const std::string fn, int sz, int x, int y); 28 | }; 29 | 30 | #endif // ES_CORE_IMAGE_IO 31 | -------------------------------------------------------------------------------- /es-core/src/InputManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_INPUT_MANAGER_H 3 | #define ES_CORE_INPUT_MANAGER_H 4 | 5 | #include 6 | #include 7 | 8 | class InputConfig; 9 | class Window; 10 | union SDL_Event; 11 | 12 | //you should only ever instantiate one of these, by the way 13 | class InputManager 14 | { 15 | private: 16 | InputManager(); 17 | 18 | static InputManager* mInstance; 19 | 20 | static const int DEADZONE = 23000; 21 | 22 | void loadDefaultKBConfig(); 23 | 24 | std::map mJoysticks; 25 | std::map mInputConfigs; 26 | InputConfig* mKeyboardInputConfig; 27 | InputConfig* mCECInputConfig; 28 | 29 | std::map mPrevAxisValues; 30 | 31 | bool initialized() const; 32 | 33 | void addJoystickByDeviceIndex(int id); 34 | void removeJoystickByJoystickID(SDL_JoystickID id); 35 | bool loadInputConfig(InputConfig* config); // returns true if successfully loaded, false if not (or didn't exist) 36 | 37 | public: 38 | virtual ~InputManager(); 39 | 40 | static InputManager* getInstance(); 41 | 42 | void writeDeviceConfig(InputConfig* config); 43 | void doOnFinish(); 44 | static std::string getConfigPath(); 45 | static std::string getTemporaryConfigPath(); 46 | 47 | void init(); 48 | void deinit(); 49 | 50 | int getNumJoysticks(); 51 | int getAxisCountByDevice(int deviceId); 52 | int getButtonCountByDevice(int deviceId); 53 | int getNumConfiguredDevices(); 54 | 55 | std::string getDeviceGUIDString(int deviceId); 56 | 57 | InputConfig* getInputConfigByDevice(int deviceId); 58 | 59 | bool parseEvent(const SDL_Event& ev, Window* window); 60 | }; 61 | 62 | #endif // ES_CORE_INPUT_MANAGER_H 63 | -------------------------------------------------------------------------------- /es-core/src/Log.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_LOG_H 3 | #define ES_CORE_LOG_H 4 | 5 | #include 6 | #include 7 | 8 | #define LOG(level) if(!Log::Enabled() || level > Log::getReportingLevel()) ; else Log().get(level) 9 | 10 | #define TRYCATCH(m, x) try { x; } \ 11 | catch (const std::exception& e) { LOG(LogError) << m << " Exception " << e.what(); Log::flush(); throw e; } \ 12 | catch (...) { LOG(LogError) << m << " Unknown Exception occured"; Log::flush(); throw; } 13 | 14 | enum LogLevel { LogError, LogWarning, LogInfo, LogDebug }; 15 | 16 | class Log 17 | { 18 | public: 19 | //Log(); 20 | ~Log(); 21 | std::ostringstream& get(LogLevel level = LogInfo); 22 | 23 | static LogLevel getReportingLevel(); 24 | static void setReportingLevel(LogLevel level); 25 | static void setupReportingLevel(); 26 | 27 | static std::string getLogPath(); 28 | 29 | static void flush(); 30 | static void init(); 31 | static void close(); 32 | 33 | static inline bool Enabled() { return file != NULL; } 34 | 35 | protected: 36 | std::ostringstream os; 37 | static FILE* file; 38 | 39 | private: 40 | static LogLevel reportingLevel; 41 | static bool dirty; 42 | 43 | LogLevel messageLevel; 44 | }; 45 | 46 | #endif // ES_CORE_LOG_H 47 | -------------------------------------------------------------------------------- /es-core/src/MameNames.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_MAMENAMES_H 3 | #define ES_CORE_MAMENAMES_H 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | class MameNames 10 | { 11 | public: 12 | 13 | static void init (); 14 | static void deinit (); 15 | static MameNames* getInstance(); 16 | std::string getRealName(const std::string& _mameName); 17 | const bool isBios(const std::string& _biosName); 18 | const bool isDevice(const std::string& _deviceName); 19 | 20 | private: 21 | 22 | struct NamePair 23 | { 24 | std::string mameName; 25 | std::string realName; 26 | }; 27 | 28 | typedef std::vector namePairVector; 29 | 30 | MameNames(); 31 | ~MameNames(); 32 | 33 | static MameNames* sInstance; 34 | 35 | namePairVector mNamePairs; 36 | 37 | std::unordered_set mMameBioses; 38 | std::unordered_set mMameDevices; 39 | 40 | }; // MameNames 41 | 42 | #endif // ES_CORE_MAMENAMES_H 43 | -------------------------------------------------------------------------------- /es-core/src/PowerSaver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_POWER_SAVER_H 3 | #define ES_CORE_POWER_SAVER_H 4 | 5 | class PowerSaver 6 | { 7 | public: 8 | enum mode : int { DISABLED = -1, INSTANT = 200, ENHANCED = 3000, DEFAULT = 10000 }; 9 | 10 | // Call when you want PS to reload all state and settings 11 | static void init(); 12 | 13 | // Get timeout to wake up from for the next event 14 | static int getTimeout(); 15 | // Update currently set timeouts after User changes Timeout settings 16 | static void updateTimeouts(); 17 | 18 | // Use this to check which mode you are in or get the mode timeout 19 | static mode getMode(); 20 | // Called when user changes mode from Settings 21 | static void updateMode(); 22 | 23 | // Get current state of PS. Not to be confused with Mode 24 | static bool getState(); 25 | // State is used to temporarily pause and resume PS 26 | static void setState(bool state); 27 | 28 | // Paired calls when you want to pause PS briefly till you finish animating 29 | // or processing over cycles 30 | static void pause() { setState(false); } 31 | static void resume() { setState(true); } 32 | 33 | // This is used by ScreenSaver to let PS know when to switch to SS timeouts 34 | static void runningScreenSaver(bool state); 35 | static bool isScreenSaverActive(); 36 | 37 | private: 38 | static bool mState; 39 | static bool mRunningScreenSaver; 40 | 41 | static mode mMode; 42 | static int mWakeupTimeout; 43 | static int mScreenSaverTimeout; 44 | 45 | static void loadWakeupTime(); 46 | }; 47 | 48 | #endif // ES_CORE_POWER_SAVER_H 49 | -------------------------------------------------------------------------------- /es-core/src/Scripting.cpp: -------------------------------------------------------------------------------- 1 | #include "Scripting.h" 2 | #include "Log.h" 3 | #include "platform.h" 4 | #include "utils/FileSystemUtil.h" 5 | 6 | namespace Scripting 7 | { 8 | void fireEvent(const std::string& eventName, const std::string& arg1, const std::string& arg2) 9 | { 10 | LOG(LogDebug) << "fireEvent: " << eventName << " " << arg1 << " " << arg2; 11 | 12 | std::list scriptDirList; 13 | std::string test; 14 | 15 | // check in exepath 16 | test = Utils::FileSystem::getExePath() + "/scripts/" + eventName; 17 | if(Utils::FileSystem::exists(test)) 18 | scriptDirList.push_back(test); 19 | 20 | // check in homepath 21 | test = Utils::FileSystem::getHomePath() + "/.emulationstation/scripts/" + eventName; 22 | if(Utils::FileSystem::exists(test)) 23 | scriptDirList.push_back(test); 24 | 25 | for(std::list::const_iterator dirIt = scriptDirList.cbegin(); dirIt != scriptDirList.cend(); ++dirIt) { 26 | std::list scripts = Utils::FileSystem::getDirContent(*dirIt); 27 | for (std::list::const_iterator it = scripts.cbegin(); it != scripts.cend(); ++it) { 28 | // append folder to path 29 | std::string script = *it + " \"" + arg1 + "\" \"" + arg2 + "\""; 30 | LOG(LogDebug) << " executing: " << script; 31 | runSystemCommand(script, "", NULL); 32 | } 33 | } 34 | } 35 | 36 | } // Scripting:: 37 | -------------------------------------------------------------------------------- /es-core/src/Scripting.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_SCRIPTING_H 3 | #define ES_CORE_SCRIPTING_H 4 | 5 | #include 6 | 7 | namespace Scripting 8 | { 9 | void fireEvent(const std::string& eventName, const std::string& arg1="", const std::string& arg2=""); 10 | } // Scripting:: 11 | 12 | #endif //ES_CORE_SCRIPTING_H 13 | -------------------------------------------------------------------------------- /es-core/src/Settings.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_SETTINGS_H 3 | #define ES_CORE_SETTINGS_H 4 | 5 | #include 6 | 7 | //This is a singleton for storing settings. 8 | class Settings 9 | { 10 | public: 11 | static Settings* getInstance(); 12 | 13 | void loadFile(); 14 | bool saveFile(); 15 | 16 | //You will get a warning if you try a get on a key that is not already present. 17 | bool getBool(const std::string& name); 18 | int getInt(const std::string& name); 19 | float getFloat(const std::string& name); 20 | const std::string& getString(const std::string& name); 21 | 22 | bool setBool(const std::string& name, bool value); 23 | bool setInt(const std::string& name, int value); 24 | bool setFloat(const std::string& name, float value); 25 | bool setString(const std::string& name, const std::string& value); 26 | 27 | std::map& getStringMap() { return mStringMap; } 28 | 29 | private: 30 | static Settings* sInstance; 31 | 32 | Settings(); 33 | 34 | //Clear everything and load default values. 35 | void setDefaults(); 36 | 37 | std::map mBoolMap; 38 | std::map mIntMap; 39 | std::map mFloatMap; 40 | std::map mStringMap; 41 | 42 | 43 | std::map mDefaultBoolMap; 44 | std::map mDefaultIntMap; 45 | std::map mDefaultFloatMap; 46 | std::map mDefaultStringMap; 47 | 48 | bool mWasChanged; 49 | bool mHasConfigRoot; 50 | }; 51 | 52 | #endif // ES_CORE_SETTINGS_H 53 | -------------------------------------------------------------------------------- /es-core/src/Sound.cpp: -------------------------------------------------------------------------------- 1 | #include "Sound.h" 2 | #include "AudioManager.h" 3 | #include "Log.h" 4 | #include "Settings.h" 5 | #include "ThemeData.h" 6 | 7 | std::map< std::string, std::shared_ptr > Sound::sMap; 8 | 9 | std::shared_ptr Sound::get(const std::string& path) 10 | { 11 | auto it = sMap.find(path); 12 | if(it != sMap.cend()) 13 | return it->second; 14 | 15 | std::shared_ptr sound = std::shared_ptr(new Sound(path)); 16 | AudioManager::getInstance()->registerSound(sound); 17 | sMap[path] = sound; 18 | return sound; 19 | } 20 | 21 | std::shared_ptr Sound::getFromTheme(const std::shared_ptr& theme, const std::string& view, const std::string& element) 22 | { 23 | LOG(LogInfo) << " req sound [" << view << "." << element << "]"; 24 | 25 | const ThemeData::ThemeElement* elem = theme->getElement(view, element, "sound"); 26 | if(elem == nullptr || !elem->has("path")) 27 | { 28 | LOG(LogInfo) << " (missing)"; 29 | return get(""); 30 | } 31 | 32 | return get(elem->get("path")); 33 | } 34 | 35 | Sound::Sound(const std::string & path) : mSampleData(NULL), mPlaying(false) 36 | { 37 | loadFile(path); 38 | } 39 | 40 | Sound::~Sound() 41 | { 42 | deinit(); 43 | } 44 | 45 | void Sound::loadFile(const std::string & path) 46 | { 47 | mPath = path; 48 | init(); 49 | } 50 | 51 | void Sound::init() 52 | { 53 | deinit(); 54 | 55 | if (!AudioManager::isInitialized()) 56 | return; 57 | 58 | if (mPath.empty() || !Utils::FileSystem::exists(mPath)) 59 | return; 60 | 61 | if (!Settings::getInstance()->getBool("EnableSounds")) 62 | return; 63 | 64 | //load wav file via SDL 65 | mSampleData = Mix_LoadWAV(mPath.c_str()); 66 | if (mSampleData == nullptr) 67 | { 68 | LOG(LogError) << "Error loading sound \"" << mPath << "\"!\n" << " " << SDL_GetError(); 69 | return; 70 | } 71 | } 72 | 73 | void Sound::deinit() 74 | { 75 | mPlaying = false; 76 | 77 | if (mSampleData == nullptr) 78 | return; 79 | 80 | Mix_FreeChunk(mSampleData); 81 | mSampleData = nullptr; 82 | } 83 | 84 | void Sound::play() 85 | { 86 | if (mSampleData == nullptr) 87 | return; 88 | 89 | if (!AudioManager::isInitialized()) 90 | return; 91 | 92 | if (!Settings::getInstance()->getBool("EnableSounds")) 93 | return; 94 | 95 | mPlaying = true; 96 | Mix_PlayChannel(-1, mSampleData, 0); 97 | } 98 | 99 | bool Sound::isPlaying() const 100 | { 101 | return mPlaying; 102 | } 103 | 104 | void Sound::stop() 105 | { 106 | mPlaying = false; 107 | } -------------------------------------------------------------------------------- /es-core/src/Sound.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_SOUND_H 3 | #define ES_CORE_SOUND_H 4 | 5 | #include 6 | #include 7 | #include "SDL_mixer.h" 8 | 9 | class ThemeData; 10 | 11 | class Sound 12 | { 13 | std::string mPath; 14 | Mix_Chunk* mSampleData; 15 | bool mPlaying; 16 | 17 | public: 18 | static std::shared_ptr get(const std::string& path); 19 | static std::shared_ptr getFromTheme(const std::shared_ptr& theme, const std::string& view, const std::string& elem); 20 | 21 | ~Sound(); 22 | 23 | void init(); 24 | void deinit(); 25 | 26 | void loadFile(const std::string & path); 27 | 28 | void play(); 29 | bool isPlaying() const; 30 | void stop(); 31 | 32 | private: 33 | Sound(const std::string & path = ""); 34 | static std::map< std::string, std::shared_ptr > sMap; 35 | }; 36 | 37 | #endif // ES_CORE_SOUND_H 38 | -------------------------------------------------------------------------------- /es-core/src/animations/Animation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_ANIMATIONS_ANIMATION_H 3 | #define ES_CORE_ANIMATIONS_ANIMATION_H 4 | 5 | class Animation 6 | { 7 | public: 8 | virtual int getDuration() const = 0; 9 | virtual void apply(float t) = 0; 10 | }; 11 | 12 | #endif // ES_CORE_ANIMATIONS_ANIMATION_H 13 | -------------------------------------------------------------------------------- /es-core/src/animations/AnimationController.cpp: -------------------------------------------------------------------------------- 1 | #include "animations/AnimationController.h" 2 | 3 | #include "animations/Animation.h" 4 | 5 | AnimationController::AnimationController(Animation* anim, int delay, std::function finishedCallback, bool reverse) 6 | : mAnimation(anim), mFinishedCallback(finishedCallback), mReverse(reverse), mTime(-delay), mDelay(delay) 7 | { 8 | } 9 | 10 | AnimationController::~AnimationController() 11 | { 12 | if(mFinishedCallback) 13 | mFinishedCallback(); 14 | 15 | delete mAnimation; 16 | } 17 | 18 | bool AnimationController::update(int deltaTime) 19 | { 20 | mTime += deltaTime; 21 | 22 | if(mTime < 0) // are we still in delay? 23 | return false; 24 | 25 | float t = (float)mTime / mAnimation->getDuration(); 26 | 27 | if(t > 1.0f) 28 | t = 1.0f; 29 | else if(t < 0.0f) 30 | t = 0.0f; 31 | 32 | mAnimation->apply(mReverse ? 1.0f - t : t); 33 | 34 | if(t == 1.0f) 35 | return true; 36 | 37 | return false; 38 | } 39 | -------------------------------------------------------------------------------- /es-core/src/animations/AnimationController.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_ANIMATIONS_ANIMATION_CONTROLLER_H 3 | #define ES_CORE_ANIMATIONS_ANIMATION_CONTROLLER_H 4 | 5 | #include 6 | 7 | class Animation; 8 | 9 | class AnimationController 10 | { 11 | public: 12 | // Takes ownership of anim (will delete in destructor). 13 | AnimationController(Animation* anim, int delay = 0, std::function finishedCallback = nullptr, bool reverse = false); 14 | virtual ~AnimationController(); 15 | 16 | // Returns true if the animation is complete. 17 | bool update(int deltaTime); 18 | 19 | inline bool isReversed() const { return mReverse; } 20 | inline int getTime() const { return mTime; } 21 | inline int getDelay() const { return mDelay; } 22 | inline const std::function& getFinishedCallback() const { return mFinishedCallback; } 23 | inline Animation* getAnimation() const { return mAnimation; } 24 | 25 | inline void removeFinishedCallback() { mFinishedCallback = nullptr; } 26 | 27 | private: 28 | Animation* mAnimation; 29 | std::function mFinishedCallback; 30 | bool mReverse; 31 | int mTime; 32 | int mDelay; 33 | }; 34 | 35 | #endif // ES_CORE_ANIMATIONS_ANIMATION_CONTROLLER_H 36 | -------------------------------------------------------------------------------- /es-core/src/animations/LambdaAnimation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_ANIMATIONS_LAMBDA_ANIMATION_H 3 | #define ES_CORE_ANIMATIONS_LAMBDA_ANIMATION_H 4 | 5 | #include "animations/Animation.h" 6 | 7 | // Useful for simple one-off animations, you can supply the animation's apply(t) method right in the constructor as a lambda. 8 | class LambdaAnimation : public Animation 9 | { 10 | public: 11 | LambdaAnimation(const std::function& func, int duration) : mFunction(func), mDuration(duration) {} 12 | 13 | virtual ~LambdaAnimation() = default; 14 | 15 | int getDuration() const override { return mDuration; } 16 | 17 | void apply(float t) override 18 | { 19 | mFunction(t); 20 | } 21 | 22 | private: 23 | std::function mFunction; 24 | int mDuration; 25 | }; 26 | 27 | #endif // ES_CORE_ANIMATIONS_LAMBDA_ANIMATION_H 28 | -------------------------------------------------------------------------------- /es-core/src/components/AnimatedImageComponent.cpp: -------------------------------------------------------------------------------- 1 | #include "components/AnimatedImageComponent.h" 2 | 3 | #include "components/ImageComponent.h" 4 | #include "resources/ResourceManager.h" 5 | #include "Log.h" 6 | 7 | AnimatedImageComponent::AnimatedImageComponent(Window* window) : GuiComponent(window), mEnabled(false) 8 | { 9 | } 10 | 11 | void AnimatedImageComponent::load(const AnimationDef* def) 12 | { 13 | mFrames.clear(); 14 | 15 | assert(def->frameCount >= 1); 16 | 17 | for(size_t i = 0; i < def->frameCount; i++) 18 | { 19 | if(def->frames[i].path != NULL && !ResourceManager::getInstance()->fileExists(def->frames[i].path)) 20 | { 21 | LOG(LogError) << "Missing animation frame " << i << " (\"" << def->frames[i].path << "\")"; 22 | continue; 23 | } 24 | 25 | auto img = std::unique_ptr(new ImageComponent(mWindow)); 26 | img->setResize(mSize.x(), mSize.y()); 27 | img->setImage(std::string(def->frames[i].path), false); 28 | 29 | mFrames.push_back(ImageFrame(std::move(img), def->frames[i].time)); 30 | } 31 | 32 | mLoop = def->loop; 33 | 34 | mCurrentFrame = 0; 35 | mFrameAccumulator = 0; 36 | mEnabled = true; 37 | } 38 | 39 | void AnimatedImageComponent::reset() 40 | { 41 | mCurrentFrame = 0; 42 | mFrameAccumulator = 0; 43 | } 44 | 45 | void AnimatedImageComponent::onSizeChanged() 46 | { 47 | for(auto it = mFrames.cbegin(); it != mFrames.cend(); it++) 48 | { 49 | it->first->setResize(mSize.x(), mSize.y()); 50 | } 51 | } 52 | 53 | void AnimatedImageComponent::update(int deltaTime) 54 | { 55 | if(!mEnabled || mFrames.size() == 0) 56 | return; 57 | 58 | mFrameAccumulator += deltaTime; 59 | 60 | while(mFrames.at(mCurrentFrame).second <= mFrameAccumulator) 61 | { 62 | mCurrentFrame++; 63 | 64 | if(mCurrentFrame == (int)mFrames.size()) 65 | { 66 | if(mLoop) 67 | { 68 | // restart 69 | mCurrentFrame = 0; 70 | }else{ 71 | // done, stop at last frame 72 | mCurrentFrame--; 73 | mEnabled = false; 74 | break; 75 | } 76 | } 77 | 78 | mFrameAccumulator -= mFrames.at(mCurrentFrame).second; 79 | } 80 | } 81 | 82 | void AnimatedImageComponent::render(const Transform4x4f& trans) 83 | { 84 | if(mFrames.size()) 85 | mFrames.at(mCurrentFrame).first->render(getTransform() * trans); 86 | } 87 | -------------------------------------------------------------------------------- /es-core/src/components/AnimatedImageComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_COMPONENTS_ANIMATED_IMAGE_COMPONENT_H 3 | #define ES_CORE_COMPONENTS_ANIMATED_IMAGE_COMPONENT_H 4 | 5 | #include "GuiComponent.h" 6 | 7 | class ImageComponent; 8 | 9 | struct AnimationFrame 10 | { 11 | const char* path; 12 | int time; 13 | }; 14 | 15 | struct AnimationDef 16 | { 17 | AnimationFrame* frames; 18 | size_t frameCount; 19 | bool loop; 20 | }; 21 | 22 | class AnimatedImageComponent : public GuiComponent 23 | { 24 | public: 25 | AnimatedImageComponent(Window* window); 26 | 27 | void load(const AnimationDef* def); // no reference to def is kept after loading is complete 28 | 29 | void reset(); // set to frame 0 30 | 31 | void update(int deltaTime) override; 32 | void render(const Transform4x4f& trans) override; 33 | 34 | void onSizeChanged() override; 35 | 36 | private: 37 | typedef std::pair, int> ImageFrame; 38 | 39 | std::vector mFrames; 40 | 41 | bool mLoop; 42 | bool mEnabled; 43 | int mFrameAccumulator; 44 | int mCurrentFrame; 45 | }; 46 | 47 | #endif // ES_CORE_COMPONENTS_ANIMATED_IMAGE_COMPONENT_H 48 | -------------------------------------------------------------------------------- /es-core/src/components/AsyncNotificationComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "GuiComponent.h" 5 | 6 | class ComponentGrid; 7 | class NinePatchComponent; 8 | class TextComponent; 9 | class Window; 10 | 11 | class AsyncNotificationComponent : public GuiComponent 12 | { 13 | public: 14 | AsyncNotificationComponent(Window* window, bool actionLine = true); 15 | ~AsyncNotificationComponent(); 16 | 17 | void updateTitle(const std::string text); 18 | void updateText(const std::string text, const std::string action = ""); 19 | void updatePercent(int percent); 20 | 21 | void render(const Transform4x4f& parentTrans) override; 22 | 23 | private: 24 | std::shared_ptr mTitle; 25 | std::shared_ptr mGameName; 26 | std::shared_ptr mAction; 27 | 28 | std::string mNextGameName; 29 | std::string mNextTitle; 30 | std::string mNextAction; 31 | 32 | ComponentGrid* mGrid; 33 | NinePatchComponent* mFrame; 34 | 35 | std::mutex mMutex; 36 | 37 | int mPercent; 38 | }; -------------------------------------------------------------------------------- /es-core/src/components/BusyComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_COMPONENTS_BUSY_COMPONENT_H 3 | #define ES_CORE_COMPONENTS_BUSY_COMPONENT_H 4 | 5 | #include "components/ComponentGrid.h" 6 | #include "components/NinePatchComponent.h" 7 | #include "GuiComponent.h" 8 | #include 9 | 10 | class AnimatedImageComponent; 11 | class TextComponent; 12 | 13 | class BusyComponent : public GuiComponent 14 | { 15 | public: 16 | BusyComponent(Window* window); 17 | ~BusyComponent(); 18 | 19 | void onSizeChanged() override; 20 | void setText(std::string txt); 21 | 22 | void reset(); // reset to frame 0 23 | 24 | virtual void render(const Transform4x4f& parentTrans); 25 | 26 | private: 27 | NinePatchComponent mBackground; 28 | ComponentGrid mGrid; 29 | 30 | std::shared_ptr mAnimation; 31 | std::shared_ptr mText; 32 | 33 | SDL_mutex *mutex; 34 | bool threadMessagechanged; 35 | std::string threadMessage; 36 | }; 37 | 38 | #endif // ES_CORE_COMPONENTS_BUSY_COMPONENT_H 39 | -------------------------------------------------------------------------------- /es-core/src/components/ButtonComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_COMPONENTS_BUTTON_COMPONENT_H 3 | #define ES_CORE_COMPONENTS_BUTTON_COMPONENT_H 4 | 5 | #include "components/NinePatchComponent.h" 6 | #include "GuiComponent.h" 7 | 8 | class TextCache; 9 | 10 | class ButtonComponent : public GuiComponent 11 | { 12 | public: 13 | ButtonComponent(Window* window, const std::string& text = "", const std::string& helpText = "", const std::function& func = nullptr, bool upperCase = true); 14 | 15 | void setPressedFunc(std::function f); 16 | 17 | void setEnabled(bool enable); 18 | 19 | bool input(InputConfig* config, Input input) override; 20 | void render(const Transform4x4f& parentTrans) override; 21 | 22 | void setText(const std::string& text, const std::string& helpText, bool upperCase = true); 23 | 24 | inline const std::string& getText() const { return mText; }; 25 | inline const std::function& getPressedFunc() const { return mPressedFunc; }; 26 | 27 | void onSizeChanged() override; 28 | void onFocusGained() override; 29 | void onFocusLost() override; 30 | 31 | void setColorShift(unsigned int color) { mModdedColor = color; mNewColor = true; updateImage(); } 32 | void removeColorShift() { mNewColor = false; updateImage(); } 33 | 34 | virtual std::vector getHelpPrompts() override; 35 | 36 | void setRenderNonFocusedBackground(bool value) { mRenderNonFocusedBackground = value; } 37 | 38 | private: 39 | std::shared_ptr mFont; 40 | std::function mPressedFunc; 41 | 42 | bool mFocused; 43 | bool mEnabled; 44 | bool mNewColor = false; 45 | bool mRenderNonFocusedBackground; 46 | 47 | unsigned int mTextColorFocused; 48 | unsigned int mTextColorUnfocused; 49 | unsigned int mModdedColor; 50 | 51 | unsigned int getCurTextColor() const; 52 | unsigned int getCurBackColor() const; 53 | 54 | void updateImage(); 55 | 56 | std::string mText; 57 | std::string mHelpText; 58 | std::unique_ptr mTextCache; 59 | NinePatchComponent mBox; 60 | 61 | unsigned int mColor; 62 | unsigned int mColorFocused; 63 | }; 64 | 65 | #endif // ES_CORE_COMPONENTS_BUTTON_COMPONENT_H 66 | -------------------------------------------------------------------------------- /es-core/src/components/DateTimeComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_COMPONENTS_DATE_TIME_COMPONENT_H 3 | #define ES_CORE_COMPONENTS_DATE_TIME_COMPONENT_H 4 | 5 | #include "utils/TimeUtil.h" 6 | #include "TextComponent.h" 7 | 8 | class ThemeData; 9 | 10 | // Used to display date times. 11 | class DateTimeComponent : public TextComponent 12 | { 13 | public: 14 | DateTimeComponent(Window* window); 15 | DateTimeComponent(Window* window, const std::string& text, const std::shared_ptr& font, unsigned int color = 0x000000FF, Alignment align = ALIGN_LEFT, 16 | Vector3f pos = Vector3f::Zero(), Vector2f size = Vector2f::Zero(), unsigned int bgcolor = 0x00000000); 17 | 18 | void render(const Transform4x4f& parentTrans) override; 19 | 20 | void setValue(const std::string& val) override; 21 | std::string getValue() const override; 22 | 23 | void setFormat(const std::string& format); 24 | void setDisplayRelative(bool displayRelative); 25 | 26 | virtual void applyTheme(const std::shared_ptr& theme, const std::string& view, const std::string& element, unsigned int properties) override; 27 | 28 | protected: 29 | void onTextChanged() override; 30 | 31 | private: 32 | std::string getDisplayString() const; 33 | 34 | Utils::Time::DateTime mTime; 35 | std::string mFormat; 36 | bool mDisplayRelative; 37 | }; 38 | 39 | #endif // ES_CORE_COMPONENTS_DATE_TIME_COMPONENT_H 40 | -------------------------------------------------------------------------------- /es-core/src/components/DateTimeEditComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_COMPONENTS_DATE_TIME_EDIT_COMPONENT_H 3 | #define ES_CORE_COMPONENTS_DATE_TIME_EDIT_COMPONENT_H 4 | 5 | #include "utils/TimeUtil.h" 6 | #include "GuiComponent.h" 7 | 8 | class TextCache; 9 | 10 | // Used to enter or display a specific point in time. 11 | class DateTimeEditComponent : public GuiComponent 12 | { 13 | public: 14 | enum DisplayMode 15 | { 16 | DISP_DATE, 17 | DISP_DATE_TIME, 18 | DISP_RELATIVE_TO_NOW 19 | }; 20 | 21 | DateTimeEditComponent(Window* window, DisplayMode dispMode = DISP_DATE); 22 | 23 | void setValue(const std::string& val) override; 24 | std::string getValue() const override; 25 | 26 | bool input(InputConfig* config, Input input) override; 27 | void update(int deltaTime) override; 28 | void render(const Transform4x4f& parentTrans) override; 29 | void onSizeChanged() override; 30 | 31 | // Set how the point in time will be displayed: 32 | // * DISP_DATE - only display the date. 33 | // * DISP_DATE_TIME - display both the date and the time on that date. 34 | // * DISP_RELATIVE_TO_NOW - intelligently display the point in time relative to right now (e.g. "5 secs ago", "3 minutes ago", "1 day ago". Automatically updates as time marches on. 35 | // The initial value is DISP_DATE. 36 | void setDisplayMode(DisplayMode mode); 37 | 38 | void setColor(unsigned int color); // Text color. 39 | void setFont(std::shared_ptr font); // Font to display with. Default is Font::get(FONT_SIZE_MEDIUM). 40 | void setUppercase(bool uppercase); // Force text to be uppercase when in DISP_RELATIVE_TO_NOW mode. 41 | 42 | virtual void applyTheme(const std::shared_ptr& theme, const std::string& view, const std::string& element, unsigned int properties) override; 43 | 44 | private: 45 | std::shared_ptr getFont() const; 46 | 47 | std::string getDisplayString(DisplayMode mode) const; 48 | DisplayMode getCurrentDisplayMode() const; 49 | 50 | void updateTextCache(); 51 | 52 | Utils::Time::DateTime mTime; 53 | Utils::Time::DateTime mTimeBeforeEdit; 54 | 55 | bool mEditing; 56 | int mEditIndex; 57 | DisplayMode mDisplayMode; 58 | 59 | int mRelativeUpdateAccumulator; 60 | 61 | std::unique_ptr mTextCache; 62 | std::vector mCursorBoxes; 63 | 64 | unsigned int mColor; 65 | std::shared_ptr mFont; 66 | bool mUppercase; 67 | 68 | bool mAutoSize; 69 | }; 70 | 71 | #endif // ES_CORE_COMPONENTS_DATE_TIME_COMPONENT_H 72 | -------------------------------------------------------------------------------- /es-core/src/components/HelpComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_COMPONENTS_HELP_COMPONENT_H 3 | #define ES_CORE_COMPONENTS_HELP_COMPONENT_H 4 | 5 | #include "GuiComponent.h" 6 | #include "HelpStyle.h" 7 | 8 | class ComponentGrid; 9 | class ImageComponent; 10 | class TextureResource; 11 | 12 | class HelpComponent : public GuiComponent 13 | { 14 | public: 15 | HelpComponent(Window* window); 16 | 17 | void clearPrompts(); 18 | void setPrompts(const std::vector& prompts); 19 | 20 | void render(const Transform4x4f& parent) override; 21 | void setOpacity(unsigned char opacity) override; 22 | 23 | void setStyle(const HelpStyle& style); 24 | 25 | std::shared_ptr getGrid() { return mGrid; }; 26 | 27 | private: 28 | std::shared_ptr getIconTexture(const char* name); 29 | std::map< std::string, std::shared_ptr > mIconCache; 30 | 31 | std::shared_ptr mGrid; 32 | void updateGrid(); 33 | 34 | std::vector mPrompts; 35 | HelpStyle mStyle; 36 | }; 37 | 38 | #endif // ES_CORE_COMPONENTS_HELP_COMPONENT_H 39 | -------------------------------------------------------------------------------- /es-core/src/components/MultiLineMenuEntry.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "Window.h" 5 | #include "components/TextComponent.h" 6 | #include "components/ComponentGrid.h" 7 | #include "math/Vector2i.h" 8 | #include "math/Vector2f.h" 9 | #include "ThemeData.h" 10 | 11 | class MultiLineMenuEntry : public ComponentGrid 12 | { 13 | public: 14 | MultiLineMenuEntry(Window* window, const std::string& text, const std::string& substring) : 15 | ComponentGrid(window, Vector2i(1, 2)) 16 | { 17 | auto theme = ThemeData::getMenuTheme(); 18 | 19 | mText = std::make_shared(mWindow, text.c_str(), theme->Text.font, theme->Text.color); 20 | mText->setVerticalAlignment(ALIGN_TOP); 21 | 22 | mSubstring = std::make_shared(mWindow, substring.c_str(), theme->TextSmall.font, theme->Text.color); 23 | mSubstring->setOpacity(192); 24 | 25 | setEntry(mText, Vector2i(0, 0), true, true); 26 | setEntry(mSubstring, Vector2i(0, 1), false, true); 27 | 28 | setSize(Vector2f(0, mText->getSize().y() + mSubstring->getSize().y())); 29 | } 30 | 31 | virtual void setColor(unsigned int color) 32 | { 33 | mText->setColor(color); 34 | mSubstring->setColor(color); 35 | } 36 | 37 | std::shared_ptr mText; 38 | std::shared_ptr mSubstring; 39 | }; 40 | -------------------------------------------------------------------------------- /es-core/src/components/ScrollableContainer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_COMPONENTS_SCROLLABLE_CONTAINER_H 3 | #define ES_CORE_COMPONENTS_SCROLLABLE_CONTAINER_H 4 | 5 | #include "GuiComponent.h" 6 | 7 | class ScrollableContainer : public GuiComponent 8 | { 9 | public: 10 | ScrollableContainer(Window* window); 11 | 12 | Vector2f getScrollPos() const; 13 | void setScrollPos(const Vector2f& pos); 14 | void setAutoScroll(bool autoScroll); 15 | void reset(); 16 | 17 | void update(int deltaTime) override; 18 | void render(const Transform4x4f& parentTrans) override; 19 | 20 | private: 21 | Vector2f getContentSize(); 22 | 23 | Vector2f mScrollPos; 24 | Vector2f mScrollDir; 25 | int mAutoScrollDelay; // ms to wait before starting to autoscroll 26 | int mAutoScrollSpeed; // ms to wait before scrolling down by mScrollDir 27 | int mAutoScrollAccumulator; 28 | bool mAtEnd; 29 | int mAutoScrollResetAccumulator; 30 | }; 31 | 32 | #endif // ES_CORE_COMPONENTS_SCROLLABLE_CONTAINER_H 33 | -------------------------------------------------------------------------------- /es-core/src/components/SliderComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_COMPONENTS_SLIDER_COMPONENT_H 3 | #define ES_CORE_COMPONENTS_SLIDER_COMPONENT_H 4 | 5 | #include "components/ImageComponent.h" 6 | #include "GuiComponent.h" 7 | 8 | class Font; 9 | class TextCache; 10 | 11 | // Used to display/edit a value between some min and max values. 12 | class SliderComponent : public GuiComponent 13 | { 14 | public: 15 | //Minimum value (far left of the slider), maximum value (far right of the slider), increment size (how much just pressing L/R moves by), unit to display (optional). 16 | SliderComponent(Window* window, float min, float max, float increment, const std::string& suffix = ""); 17 | 18 | void setValue(float val); 19 | float getValue(); 20 | 21 | bool input(InputConfig* config, Input input) override; 22 | void update(int deltaTime) override; 23 | void render(const Transform4x4f& parentTrans) override; 24 | 25 | void onSizeChanged() override; 26 | 27 | virtual std::vector getHelpPrompts() override; 28 | virtual void setColor(unsigned int color); 29 | 30 | inline void setOnValueChanged(const std::function& callback) { mValueChanged = callback; } 31 | 32 | private: 33 | void onValueChanged(); 34 | 35 | float mMin, mMax; 36 | float mValue; 37 | float mSingleIncrement; 38 | float mMoveRate; 39 | int mMoveAccumulator; 40 | 41 | ImageComponent mKnob; 42 | 43 | std::string mSuffix; 44 | std::shared_ptr mFont; 45 | std::shared_ptr mValueCache; 46 | 47 | unsigned int mColor; 48 | std::function mValueChanged; 49 | }; 50 | 51 | #endif // ES_CORE_COMPONENTS_SLIDER_COMPONENT_H 52 | -------------------------------------------------------------------------------- /es-core/src/components/SwitchComponent.cpp: -------------------------------------------------------------------------------- 1 | #include "SwitchComponent.h" 2 | 3 | #include "resources/Font.h" 4 | 5 | SwitchComponent::SwitchComponent(Window* window, bool state) : GuiComponent(window), mImage(window), mState(state) 6 | { 7 | auto menuTheme = ThemeData::getMenuTheme(); 8 | 9 | float height = Font::get(FONT_SIZE_MEDIUM)->getLetterHeight(); 10 | 11 | mImage.setImage(ThemeData::getMenuTheme()->Icons.off); 12 | mImage.setResize(0, height); 13 | mImage.setColorShift(menuTheme->Text.color); 14 | 15 | mSize = mImage.getSize(); 16 | } 17 | 18 | void SwitchComponent::setColor(unsigned int color) { 19 | mImage.setColorShift(color); 20 | } 21 | 22 | void SwitchComponent::onSizeChanged() 23 | { 24 | mImage.setSize(mSize); 25 | } 26 | 27 | bool SwitchComponent::input(InputConfig* config, Input input) 28 | { 29 | if(config->isMappedTo("a", input) && input.value) 30 | { 31 | mState = !mState; 32 | onStateChanged(); 33 | return true; 34 | } 35 | 36 | return false; 37 | } 38 | 39 | void SwitchComponent::render(const Transform4x4f& parentTrans) 40 | { 41 | Transform4x4f trans = parentTrans * getTransform(); 42 | 43 | mImage.render(trans); 44 | 45 | renderChildren(trans); 46 | } 47 | 48 | bool SwitchComponent::getState() const 49 | { 50 | return mState; 51 | } 52 | 53 | void SwitchComponent::setState(bool state) 54 | { 55 | mState = state; 56 | onStateChanged(); 57 | } 58 | 59 | std::string SwitchComponent::getValue() const 60 | { 61 | return mState ? "true" : "false"; 62 | } 63 | 64 | void SwitchComponent::setValue(const std::string& statestring) 65 | { 66 | if (statestring == "true") 67 | { 68 | mState = true; 69 | }else 70 | { 71 | mState = false; 72 | } 73 | onStateChanged(); 74 | } 75 | 76 | void SwitchComponent::onStateChanged() 77 | { 78 | auto theme = ThemeData::getMenuTheme(); 79 | mImage.setImage(mState ? theme->Icons.on : theme->Icons.off); 80 | 81 | if (mOnChangedCallback != nullptr) 82 | mOnChangedCallback(); 83 | } 84 | 85 | std::vector SwitchComponent::getHelpPrompts() 86 | { 87 | std::vector prompts; 88 | prompts.push_back(HelpPrompt("a", "MODIFIER")); 89 | return prompts; 90 | } 91 | -------------------------------------------------------------------------------- /es-core/src/components/SwitchComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_COMPONENTS_SWITCH_COMPONENT_H 3 | #define ES_CORE_COMPONENTS_SWITCH_COMPONENT_H 4 | 5 | #include "components/ImageComponent.h" 6 | #include "GuiComponent.h" 7 | 8 | // A very simple "on/off" switch. 9 | // Should hopefully be switched to use images instead of text in the future. 10 | class SwitchComponent : public GuiComponent 11 | { 12 | public: 13 | SwitchComponent(Window* window, bool state = false); 14 | 15 | bool input(InputConfig* config, Input input) override; 16 | void render(const Transform4x4f& parentTrans) override; 17 | void onSizeChanged() override; 18 | 19 | bool getState() const; 20 | void setState(bool state); 21 | std::string getValue() const; 22 | void setValue(const std::string& statestring) override; 23 | 24 | virtual std::vector getHelpPrompts() override; 25 | 26 | void setColor(unsigned int color); 27 | 28 | inline void setOnChangedCallback(const std::function& callback) { 29 | mOnChangedCallback = callback; 30 | } 31 | 32 | private: 33 | void onStateChanged(); 34 | 35 | ImageComponent mImage; 36 | bool mState; 37 | 38 | std::function mOnChangedCallback; // batocera 39 | }; 40 | 41 | #endif // ES_CORE_COMPONENTS_SWITCH_COMPONENT_H 42 | -------------------------------------------------------------------------------- /es-core/src/components/TextEditComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_COMPONENTS_TEXT_EDIT_COMPONENT_H 3 | #define ES_CORE_COMPONENTS_TEXT_EDIT_COMPONENT_H 4 | 5 | #include "components/NinePatchComponent.h" 6 | #include "GuiComponent.h" 7 | 8 | class Font; 9 | class TextCache; 10 | 11 | // Used to enter text. 12 | class TextEditComponent : public GuiComponent 13 | { 14 | public: 15 | TextEditComponent(Window* window); 16 | 17 | void textInput(const char* text) override; 18 | bool input(InputConfig* config, Input input) override; 19 | void update(int deltaTime) override; 20 | void render(const Transform4x4f& parentTrans) override; 21 | 22 | void onFocusGained() override; 23 | void onFocusLost() override; 24 | 25 | void onSizeChanged() override; 26 | 27 | void setValue(const std::string& val) override; 28 | std::string getValue() const override; 29 | 30 | inline bool isEditing() const { return mEditing; }; 31 | inline const std::shared_ptr& getFont() const { return mFont; } 32 | 33 | void setCursor(size_t pos); 34 | 35 | virtual std::vector getHelpPrompts() override; 36 | 37 | void startEditing(); // batocera 38 | void stopEditing(); // batocera 39 | private: 40 | 41 | void onTextChanged(); 42 | void onCursorChanged(); 43 | 44 | void updateCursorRepeat(int deltaTime); 45 | void moveCursor(int amt); 46 | 47 | bool isMultiline(); 48 | Vector2f getTextAreaPos() const; 49 | Vector2f getTextAreaSize() const; 50 | 51 | std::string mText; 52 | bool mFocused; 53 | bool mEditing; 54 | unsigned int mCursor; // cursor position in characters 55 | 56 | int mCursorRepeatTimer; 57 | int mCursorRepeatDir; 58 | 59 | Vector2f mScrollOffset; 60 | 61 | NinePatchComponent mBox; 62 | 63 | std::shared_ptr mFont; 64 | std::unique_ptr mTextCache; 65 | 66 | int mBlinkTime; 67 | }; 68 | 69 | #endif // ES_CORE_COMPONENTS_TEXT_EDIT_COMPONENT_H 70 | -------------------------------------------------------------------------------- /es-core/src/components/VideoPlayerComponent.h: -------------------------------------------------------------------------------- 1 | #ifdef _RPI_ 2 | #pragma once 3 | #ifndef ES_CORE_COMPONENTS_VIDEO_PLAYER_COMPONENT_H 4 | #define ES_CORE_COMPONENTS_VIDEO_PLAYER_COMPONENT_H 5 | 6 | #include "components/VideoComponent.h" 7 | 8 | void catch_child(int sig_num); 9 | 10 | class VideoPlayerComponent : public VideoComponent 11 | { 12 | public: 13 | VideoPlayerComponent(Window* window, std::string path); 14 | virtual ~VideoPlayerComponent(); 15 | 16 | void render(const Transform4x4f& parentTrans) override; 17 | 18 | // Resize the video to fit this size. If one axis is zero, scale that axis to maintain aspect ratio. 19 | // If both are non-zero, potentially break the aspect ratio. If both are zero, no resizing. 20 | // Can be set before or after a video is loaded. 21 | // setMaxSize() and setResize() are mutually exclusive. 22 | void setResize(float width, float height); 23 | 24 | // Resize the video to be as large as possible but fit within a box of this size. 25 | // Can be set before or after a video is loaded. 26 | // Never breaks the aspect ratio. setMaxSize() and setResize() are mutually exclusive. 27 | void setMaxSize(float width, float height); 28 | void setMinSize(float width, float height); 29 | 30 | private: 31 | // Start the video Immediately 32 | virtual void startVideo(); 33 | // Stop the video 34 | virtual void stopVideo(); 35 | 36 | private: 37 | pid_t mPlayerPid; 38 | std::string subtitlePath; 39 | }; 40 | 41 | #endif // ES_CORE_COMPONENTS_VIDEO_PLAYER_COMPONENT_H 42 | #endif // _RPI_ 43 | -------------------------------------------------------------------------------- /es-core/src/guis/GuiDetectDevice.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_GUIS_GUI_DETECT_DEVICE_H 3 | #define ES_CORE_GUIS_GUI_DETECT_DEVICE_H 4 | 5 | #include "components/ComponentGrid.h" 6 | #include "components/NinePatchComponent.h" 7 | #include "GuiComponent.h" 8 | 9 | class TextComponent; 10 | 11 | class GuiDetectDevice : public GuiComponent 12 | { 13 | public: 14 | GuiDetectDevice(Window* window, bool firstRun, const std::function& doneCallback); 15 | 16 | bool input(InputConfig* config, Input input) override; 17 | void update(int deltaTime) override; 18 | void onSizeChanged() override; 19 | 20 | private: 21 | bool mFirstRun; 22 | InputConfig* mHoldingConfig; 23 | int mHoldTime; 24 | 25 | NinePatchComponent mBackground; 26 | ComponentGrid mGrid; 27 | 28 | std::shared_ptr mTitle; 29 | std::shared_ptr mMsg1; 30 | std::shared_ptr mMsg2; 31 | std::shared_ptr mDeviceInfo; 32 | std::shared_ptr mDeviceHeld; 33 | 34 | std::function mDoneCallback; 35 | }; 36 | 37 | #endif // ES_CORE_GUIS_GUI_DETECT_DEVICE_H 38 | -------------------------------------------------------------------------------- /es-core/src/guis/GuiInfoPopup.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_APP_GUIS_GUI_INFO_POPUP_H 3 | #define ES_APP_GUIS_GUI_INFO_POPUP_H 4 | 5 | #include "GuiComponent.h" 6 | #include "Window.h" 7 | 8 | class ComponentGrid; 9 | class NinePatchComponent; 10 | 11 | class GuiInfoPopup : public GuiComponent, public Window::InfoPopup 12 | { 13 | public: 14 | GuiInfoPopup(Window* window, std::string message, int duration); 15 | ~GuiInfoPopup(); 16 | void render(const Transform4x4f& parentTrans) override; 17 | inline void stop() { running = false; }; 18 | private: 19 | std::string mMessage; 20 | int mDuration; 21 | int alpha; 22 | bool updateState(); 23 | int mStartTime; 24 | ComponentGrid* mGrid; 25 | NinePatchComponent* mFrame; 26 | bool running; 27 | unsigned int mBackColor; 28 | }; 29 | 30 | #endif // ES_APP_GUIS_GUI_INFO_POPUP_H 31 | -------------------------------------------------------------------------------- /es-core/src/guis/GuiInputConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_GUIS_GUI_INPUT_CONFIG_H 3 | #define ES_CORE_GUIS_GUI_INPUT_CONFIG_H 4 | 5 | #include "components/BusyComponent.h" 6 | #include "components/ComponentGrid.h" 7 | #include "components/NinePatchComponent.h" 8 | #include "GuiComponent.h" 9 | 10 | class ComponentList; 11 | class TextComponent; 12 | 13 | class GuiInputConfig : public GuiComponent 14 | { 15 | public: 16 | GuiInputConfig(Window* window, InputConfig* target, bool reconfigureAll, const std::function& okCallback); 17 | 18 | void update(int deltaTime) override; 19 | 20 | void onSizeChanged() override; 21 | 22 | private: 23 | void error(const std::shared_ptr& text, const std::string& msg); // set text to "msg" + not greyed out 24 | 25 | void setPress(const std::shared_ptr& text); // set text to "PRESS ANYTHING" + not greyed out 26 | void setNotDefined(const std::shared_ptr& text); // set text to -NOT DEFINED- + greyed out 27 | void setAssignedTo(const std::shared_ptr& text, Input input); // set text to "BUTTON 2"/"AXIS 2+", etc. 28 | 29 | bool assign(Input input, int inputId); 30 | void clearAssignment(int inputId); 31 | bool filterTrigger(Input input, InputConfig* config); 32 | 33 | void rowDone(); 34 | 35 | NinePatchComponent mBackground; 36 | ComponentGrid mGrid; 37 | 38 | std::shared_ptr mTitle; 39 | std::shared_ptr mSubtitle1; 40 | std::shared_ptr mSubtitle2; 41 | std::shared_ptr mList; 42 | std::vector< std::shared_ptr > mMappings; 43 | std::shared_ptr mButtonGrid; 44 | 45 | InputConfig* mTargetConfig; 46 | bool mConfiguringRow; // next input captured by mList will be interpretted as a remap 47 | bool mConfiguringAll; // move the cursor down after configuring a row and start configuring the next row until we reach the bottom 48 | 49 | bool mHoldingInput; 50 | Input mHeldInput; 51 | int mHeldTime; 52 | int mHeldInputId; 53 | 54 | BusyComponent mBusyAnim; 55 | }; 56 | 57 | #endif // ES_CORE_GUIS_GUI_INPUT_CONFIG_H 58 | -------------------------------------------------------------------------------- /es-core/src/guis/GuiMsgBox.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_GUIS_GUI_MSG_BOX_H 3 | #define ES_CORE_GUIS_GUI_MSG_BOX_H 4 | 5 | #include "components/ComponentGrid.h" 6 | #include "components/NinePatchComponent.h" 7 | #include "GuiComponent.h" 8 | 9 | class ButtonComponent; 10 | class TextComponent; 11 | class ImageComponent; 12 | 13 | enum GuiMsgBoxIcon 14 | { 15 | ICON_AUTOMATIC, 16 | ICON_INFORMATION, 17 | ICON_QUESTION, 18 | ICON_WARNING, 19 | ICON_ERROR 20 | }; 21 | 22 | class GuiMsgBox : public GuiComponent 23 | { 24 | public: 25 | GuiMsgBox(Window* window, const std::string& text, 26 | const std::string& name1, const std::function& func1, 27 | const std::string& name2, const std::function& func2, 28 | const std::string& name3, const std::function& func3, 29 | GuiMsgBoxIcon icon = ICON_AUTOMATIC); 30 | 31 | 32 | GuiMsgBox(Window* window, const std::string& text, 33 | const std::string& name1, const std::function& func1, 34 | const std::string& name2, const std::function& func2, 35 | GuiMsgBoxIcon icon = ICON_AUTOMATIC); 36 | 37 | GuiMsgBox(Window* window, const std::string& text, 38 | const std::string& name1 = "OK", const std::function& func1 = nullptr, 39 | GuiMsgBoxIcon icon = ICON_AUTOMATIC); 40 | 41 | bool input(InputConfig* config, Input input) override; 42 | void onSizeChanged() override; 43 | std::vector getHelpPrompts() override; 44 | 45 | std::string getValue() const override { return "GuiMsgBox"; } 46 | 47 | private: 48 | void deleteMeAndCall(const std::function& func); 49 | 50 | NinePatchComponent mBackground; 51 | ComponentGrid mGrid; 52 | 53 | std::shared_ptr mImage; 54 | std::shared_ptr mMsg; 55 | std::vector< std::shared_ptr > mButtons; 56 | std::shared_ptr mButtonGrid; 57 | std::function mAcceleratorFunc; 58 | }; 59 | 60 | #endif // ES_CORE_GUIS_GUI_MSG_BOX_H 61 | -------------------------------------------------------------------------------- /es-core/src/guis/GuiTextEditPopup.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_GUIS_GUI_TEXT_EDIT_POPUP_H 3 | #define ES_CORE_GUIS_GUI_TEXT_EDIT_POPUP_H 4 | 5 | #include "components/ComponentGrid.h" 6 | #include "components/NinePatchComponent.h" 7 | #include "GuiComponent.h" 8 | 9 | class TextComponent; 10 | class TextEditComponent; 11 | 12 | class GuiTextEditPopup : public GuiComponent 13 | { 14 | public: 15 | GuiTextEditPopup(Window* window, const std::string& title, const std::string& initValue, 16 | const std::function& okCallback, bool multiLine, const char* acceptBtnText = "OK"); 17 | 18 | bool input(InputConfig* config, Input input); 19 | void onSizeChanged(); 20 | std::vector getHelpPrompts() override; 21 | 22 | private: 23 | NinePatchComponent mBackground; 24 | ComponentGrid mGrid; 25 | 26 | std::shared_ptr mTitle; 27 | std::shared_ptr mText; 28 | std::shared_ptr mButtonGrid; 29 | 30 | bool mMultiLine; 31 | }; 32 | 33 | #endif // ES_CORE_GUIS_GUI_TEXT_EDIT_POPUP_H 34 | -------------------------------------------------------------------------------- /es-core/src/guis/GuiTextEditPopupKeyboard.h: -------------------------------------------------------------------------------- 1 | #include "GuiComponent.h" 2 | 3 | #include "components/NinePatchComponent.h" 4 | #include "components/ButtonComponent.h" 5 | #include "components/ComponentGrid.h" 6 | #include "components/TextEditComponent.h" 7 | #include "components/TextComponent.h" 8 | #include 9 | 10 | class GuiTextEditPopupKeyboard : public GuiComponent 11 | { 12 | public: 13 | GuiTextEditPopupKeyboard(Window* window, const std::string& title, const std::string& initValue, 14 | const std::function& okCallback, bool multiLine, const std::string acceptBtnText = "OK"); 15 | 16 | bool input(InputConfig* config, Input input); 17 | //void update(int deltatime) override; 18 | void onSizeChanged(); 19 | std::vector getHelpPrompts() override; 20 | 21 | private: 22 | class KeyboardButton 23 | { 24 | public: 25 | std::shared_ptr button; 26 | const std::string key; 27 | const std::string shiftedKey; 28 | KeyboardButton(const std::shared_ptr b, const std::string& k, const std::string& sk) : button(b), key(k), shiftedKey(sk) {}; 29 | }; 30 | 31 | std::shared_ptr makeButton(const std::string& key, const std::string& shiftedKey); 32 | std::vector keyboardButtons; 33 | std::shared_ptr mShiftButton; 34 | const Vector2f getButtonSize(); 35 | 36 | void shiftKeys(); 37 | 38 | NinePatchComponent mBackground; 39 | ComponentGrid mGrid; 40 | 41 | std::shared_ptr mTitle; 42 | std::shared_ptr mText; 43 | std::shared_ptr mKeyboardGrid; 44 | std::shared_ptr mButtons; 45 | 46 | std::function mOkCallback; 47 | 48 | bool mMultiLine; 49 | bool mShift = false; 50 | }; 51 | 52 | -------------------------------------------------------------------------------- /es-core/src/math/Misc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_MATH_MISC_H 3 | #define ES_CORE_MATH_MISC_H 4 | 5 | #define ES_PI (3.1415926535897932384626433832795028841971693993751058209749445923) 6 | #define ES_RAD_TO_DEG(_x) ((_x) * (180.0 / ES_PI)) 7 | #define ES_DEG_TO_RAD(_x) ((_x) * (ES_PI / 180.0)) 8 | 9 | namespace Math 10 | { 11 | // added here to avoid including math.h whenever these are used 12 | float cosf (const float _num); 13 | float sinf (const float _num); 14 | float floorf (const float _num); 15 | float ceilf (const float _num); 16 | 17 | int min (const int _num1, const int _num2); 18 | int max (const int _num1, const int _num2); 19 | float min (const float _num1, const float _num2); 20 | float max (const float _num1, const float _num2); 21 | float clamp (const float _num, const float _min, const float _max); 22 | float round (const float _num); 23 | float lerp (const float _start, const float _end, const float _fraction); 24 | float smoothStep (const float _left, const float _right, const float _x); 25 | float smootherStep(const float _left, const float _right, const float _x); 26 | 27 | namespace Scroll 28 | { 29 | float bounce(const float _delayTime, const float _scrollTime, const float _currentTime, const float _scrollLength); 30 | float loop (const float _delayTime, const float _scrollTime, const float _currentTime, const float _scrollLength); 31 | 32 | } // Scroll:: 33 | 34 | } // Math:: 35 | 36 | #endif // ES_CORE_MATH_MISC_H 37 | -------------------------------------------------------------------------------- /es-core/src/math/Transform4x4f.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_MATH_TRANSFORM4X4F_H 3 | #define ES_CORE_MATH_TRANSFORM4X4F_H 4 | 5 | #include "math/Vector4f.h" 6 | #include "math/Vector3f.h" 7 | 8 | class Transform4x4f 9 | { 10 | public: 11 | 12 | Transform4x4f() { } 13 | Transform4x4f(const Vector4f& _r0, const Vector4f& _r1, const Vector4f& _r2, const Vector4f& _r3) : mR0(_r0), mR1(_r1), mR2(_r2), mR3(_r3) { } 14 | 15 | const Transform4x4f operator* (const Transform4x4f& _other) const; 16 | const Vector3f operator* (const Vector3f& _other) const; 17 | Transform4x4f& operator*=(const Transform4x4f& _other) { *this = *this * _other; return *this; } 18 | 19 | inline Vector4f& r0() { return mR0; } 20 | inline Vector4f& r1() { return mR1; } 21 | inline Vector4f& r2() { return mR2; } 22 | inline Vector4f& r3() { return mR3; } 23 | inline const Vector4f& r0() const { return mR0; } 24 | inline const Vector4f& r1() const { return mR1; } 25 | inline const Vector4f& r2() const { return mR2; } 26 | inline const Vector4f& r3() const { return mR3; } 27 | 28 | Transform4x4f& orthoProjection(float _left, float _right, float _bottom, float _top, float _near, float _far); 29 | Transform4x4f& invert (const Transform4x4f& _other); 30 | Transform4x4f& scale (const Vector3f& _scale); 31 | Transform4x4f& rotate (const float _angle, const Vector3f& _axis); 32 | Transform4x4f& rotateX (const float _angle); 33 | Transform4x4f& rotateY (const float _angle); 34 | Transform4x4f& rotateZ (const float _angle); 35 | Transform4x4f& translate (const Vector3f& _translation); 36 | Transform4x4f& round (); 37 | 38 | inline Vector3f& translation() { return mR3.v3(); } 39 | inline const Vector3f& translation() const { return mR3.v3(); } 40 | 41 | static const Transform4x4f Identity() { return { { 1, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 0, 1, 0 }, { 0, 0, 0, 1 } }; } 42 | 43 | protected: 44 | 45 | Vector4f mR0; 46 | Vector4f mR1; 47 | Vector4f mR2; 48 | Vector4f mR3; 49 | 50 | }; // Transform4x4f 51 | 52 | #endif // ES_CORE_MATH_TRANSFORM4X4F_H 53 | -------------------------------------------------------------------------------- /es-core/src/math/Vector2f.cpp: -------------------------------------------------------------------------------- 1 | #include "math/Vector2f.h" 2 | 3 | Vector2f& Vector2f::round() 4 | { 5 | mX = (float)(int)(mX + 0.5f); 6 | mY = (float)(int)(mY + 0.5f); 7 | 8 | return *this; 9 | 10 | } // round 11 | 12 | Vector2f& Vector2f::lerp(const Vector2f& _start, const Vector2f& _end, const float _fraction) 13 | { 14 | mX = Math::lerp(_start.x(), _end.x(), _fraction); 15 | mY = Math::lerp(_start.y(), _end.y(), _fraction); 16 | 17 | return *this; 18 | 19 | } // lerp 20 | 21 | const Vector2f Vector2f::parseString(const std::string& _input) 22 | { 23 | Vector2f ret = Vector2f(0, 0); 24 | 25 | size_t divider = _input.find(' '); 26 | if (divider != std::string::npos) 27 | { 28 | std::string first = _input.substr(0, divider); 29 | std::string second = _input.substr(divider, std::string::npos); 30 | 31 | ret = Vector2f((float)atof(first.c_str()), (float)atof(second.c_str())); 32 | } 33 | 34 | return ret; 35 | } 36 | 37 | 38 | const std::string Vector2f::toString() 39 | { 40 | return std::to_string(mX) + " " + std::to_string(mY); 41 | } -------------------------------------------------------------------------------- /es-core/src/math/Vector2i.cpp: -------------------------------------------------------------------------------- 1 | #include "math/Vector2i.h" 2 | -------------------------------------------------------------------------------- /es-core/src/math/Vector3f.cpp: -------------------------------------------------------------------------------- 1 | #include "math/Vector3f.h" 2 | 3 | Vector3f& Vector3f::round() 4 | { 5 | mX = (float)(int)(mX + 0.5f); 6 | mY = (float)(int)(mY + 0.5f); 7 | mZ = (float)(int)(mZ + 0.5f); 8 | 9 | return *this; 10 | 11 | } // round 12 | 13 | Vector3f& Vector3f::lerp(const Vector3f& _start, const Vector3f& _end, const float _fraction) 14 | { 15 | mX = Math::lerp(_start.x(), _end.x(), _fraction); 16 | mY = Math::lerp(_start.y(), _end.y(), _fraction); 17 | mZ = Math::lerp(_start.z(), _end.z(), _fraction); 18 | 19 | return *this; 20 | 21 | } // lerp 22 | -------------------------------------------------------------------------------- /es-core/src/math/Vector4f.cpp: -------------------------------------------------------------------------------- 1 | #include "math/Vector4f.h" 2 | 3 | Vector4f& Vector4f::round() 4 | { 5 | mX = (float)(int)(mX + 0.5f); 6 | mY = (float)(int)(mY + 0.5f); 7 | mZ = (float)(int)(mZ + 0.5f); 8 | mW = (float)(int)(mW + 0.5f); 9 | 10 | return *this; 11 | 12 | } // round 13 | 14 | Vector4f& Vector4f::lerp(const Vector4f& _start, const Vector4f& _end, const float _fraction) 15 | { 16 | mX = Math::lerp(_start.x(), _end.x(), _fraction); 17 | mY = Math::lerp(_start.y(), _end.y(), _fraction); 18 | mZ = Math::lerp(_start.z(), _end.z(), _fraction); 19 | mW = Math::lerp(_start.w(), _end.w(), _fraction); 20 | 21 | return *this; 22 | 23 | } // lerp 24 | -------------------------------------------------------------------------------- /es-core/src/platform.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_PLATFORM_H 3 | #define ES_CORE_PLATFORM_H 4 | 5 | #include 6 | 7 | //why the hell this naming inconsistency exists is well beyond me 8 | #ifdef WIN32 9 | #define sleep Sleep 10 | #endif 11 | 12 | class Window; 13 | 14 | enum QuitMode 15 | { 16 | QUIT = 0, 17 | RESTART = 1, 18 | SHUTDOWN = 2, 19 | REBOOT = 3 20 | }; 21 | 22 | int runSystemCommand(const std::string& cmd_utf8, const std::string& name, Window* window); // run a utf-8 encoded in the shell (requires wstring conversion on Windows) 23 | int quitES(QuitMode mode = QuitMode::QUIT); 24 | void processQuitMode(); 25 | 26 | #if defined(WIN32) 27 | #include 28 | #include 29 | #include "Log.h" 30 | #endif 31 | 32 | #if !defined(TRACE) 33 | #if defined(WIN32) && defined(_DEBUG) 34 | #include 35 | 36 | #define TRACE( s ) \ 37 | { \ 38 | std::ostringstream os_; \ 39 | os_ << s << std::endl; \ 40 | OutputDebugStringA( os_.str().c_str() ); \ 41 | } 42 | #else 43 | #define TRACE(s) 44 | #endif 45 | #endif 46 | 47 | class StopWatch 48 | { 49 | public: 50 | StopWatch(std::string name) 51 | { 52 | #if defined(WIN32) 53 | mName = name; 54 | mTicks = ::GetTickCount(); 55 | #endif 56 | } 57 | 58 | ~StopWatch() 59 | { 60 | #if defined(WIN32) 61 | int now = ::GetTickCount(); 62 | 63 | mTicks = now - mTicks; 64 | 65 | LOG(LogInfo) << mName << " " << mTicks << " ms" << " on CPU " << GetCurrentProcessorNumber(); 66 | TRACE(mName << " " << mTicks << " ms" << " on CPU " << GetCurrentProcessorNumber()); 67 | #endif 68 | } 69 | 70 | private: 71 | #if defined(WIN32) 72 | DWORD GetCurrentProcessorNumber() 73 | { 74 | int CPUInfo[4]; 75 | __cpuid(CPUInfo, 1); 76 | if ((CPUInfo[3] & (1 << 9)) == 0) return -1; // no APIC on chip 77 | return (unsigned)CPUInfo[1] >> 24; 78 | } 79 | #endif 80 | int mTicks; 81 | std::string mName; 82 | }; 83 | #endif // ES_CORE_PLATFORM_H 84 | -------------------------------------------------------------------------------- /es-core/src/resources/ResourceManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_RESOURCES_RESOURCE_MANAGER_H 3 | #define ES_CORE_RESOURCES_RESOURCE_MANAGER_H 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | //The ResourceManager exists to... 11 | //Allow loading resources embedded into the executable like an actual file. 12 | //Allow embedded resources to be optionally remapped to actual files for further customization. 13 | 14 | struct ResourceData 15 | { 16 | const std::shared_ptr ptr; 17 | const size_t length; 18 | }; 19 | 20 | class ResourceManager; 21 | 22 | class IReloadable 23 | { 24 | public: 25 | virtual bool unload() = 0; 26 | virtual void reload() = 0; 27 | }; 28 | 29 | class ResourceManager 30 | { 31 | public: 32 | static std::shared_ptr& getInstance(); 33 | 34 | void addReloadable(std::weak_ptr reloadable); 35 | void removeReloadable(std::weak_ptr reloadable); 36 | 37 | void unloadAll(); 38 | void reloadAll(); 39 | 40 | std::string getResourcePath(const std::string& path) const; 41 | const ResourceData getFileData(const std::string& path) const; 42 | bool fileExists(const std::string& path) const; 43 | 44 | static std::mutex FileSystemLock; 45 | 46 | private: 47 | ResourceManager(); 48 | 49 | static std::shared_ptr sInstance; 50 | 51 | ResourceData loadFile(const std::string& path, size_t size) const; 52 | 53 | class ReloadableInfo 54 | { 55 | public: 56 | std::weak_ptr data; 57 | bool reload; 58 | bool locked; 59 | }; 60 | 61 | std::list> mReloadables; // std::weak_ptr 62 | }; 63 | 64 | #endif // ES_CORE_RESOURCES_RESOURCE_MANAGER_H 65 | -------------------------------------------------------------------------------- /es-core/src/resources/TextureData.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_RESOURCES_TEXTURE_DATA_H 3 | #define ES_CORE_RESOURCES_TEXTURE_DATA_H 4 | 5 | #include 6 | #include 7 | 8 | #include "math/Vector2f.h" 9 | #include "math/Vector2i.h" 10 | #include "resources/TextureResource.h" 11 | 12 | // class TextureResource; 13 | 14 | class TextureData 15 | { 16 | public: 17 | TextureData(bool tile, bool linear); 18 | ~TextureData(); 19 | 20 | static bool OPTIMIZEVRAM; 21 | 22 | // These functions populate mDataRGBA but do not upload the texture to VRAM 23 | 24 | //!!!! Needs to be canonical path. Caller should check for duplicates before calling this 25 | void initFromPath(const std::string& path); 26 | bool initSVGFromMemory(const unsigned char* fileData, size_t length); 27 | bool initImageFromMemory(const unsigned char* fileData, size_t length); 28 | bool initFromRGBA(const unsigned char* dataRGBA, size_t width, size_t height); 29 | bool initFromRGBAEx(unsigned char* dataRGBA, size_t width, size_t height); 30 | bool initFromExternalRGBA(unsigned char* dataRGBA, size_t width, size_t height); 31 | 32 | // Read the data into memory if necessary 33 | bool load(bool updateCache = false); 34 | 35 | bool isLoaded(); 36 | 37 | // Upload the texture to VRAM if necessary and bind. Returns true if bound ok or 38 | // false if either not loaded 39 | bool uploadAndBind(); 40 | 41 | // Release the texture from VRAM 42 | void releaseVRAM(); 43 | 44 | // Release the texture from conventional RAM 45 | void releaseRAM(); 46 | 47 | void setMaxSize(MaxSizeInfo maxSize); 48 | 49 | // Get the amount of VRAM currenty used by this texture 50 | size_t getVRAMUsage(); 51 | 52 | size_t width(); 53 | size_t height(); 54 | float sourceWidth(); 55 | float sourceHeight(); 56 | void setSourceSize(float width, float height); 57 | 58 | void setTemporarySize(float width, float height); 59 | 60 | bool tiled() { return mTile; } 61 | 62 | bool isRequiredTextureSizeOk(); 63 | 64 | std::string mPath; 65 | unsigned int mTextureID; 66 | 67 | unsigned char* getDataRGBA() { 68 | return mDataRGBA; 69 | } 70 | 71 | private: 72 | std::mutex mMutex; 73 | bool mTile; 74 | bool mLinear; 75 | unsigned char* mDataRGBA; 76 | size_t mWidth; 77 | size_t mHeight; 78 | float mSourceWidth; 79 | float mSourceHeight; 80 | bool mScalable; 81 | bool mReloadable; 82 | 83 | Vector2i mPackedSize; 84 | Vector2i mBaseSize; 85 | MaxSizeInfo mMaxSize; 86 | 87 | bool mIsExternalDataRGBA; 88 | }; 89 | 90 | #endif // ES_CORE_RESOURCES_TEXTURE_DATA_H 91 | -------------------------------------------------------------------------------- /es-core/src/utils/StringUtil.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ES_CORE_UTILS_STRING_UTIL_H 3 | #define ES_CORE_UTILS_STRING_UTIL_H 4 | 5 | #include 6 | #include 7 | 8 | namespace Utils 9 | { 10 | namespace String 11 | { 12 | typedef std::vector stringVector; 13 | 14 | unsigned int chars2Unicode (const std::string& _string, size_t& _cursor); 15 | std::string unicode2Chars (const unsigned int _unicode); 16 | size_t nextCursor (const std::string& _string, const size_t _cursor); 17 | size_t prevCursor (const std::string& _string, const size_t _cursor); 18 | size_t moveCursor (const std::string& _string, const size_t _cursor, const int _amount); 19 | std::string toLower (const std::string& _string); 20 | std::string toUpper (const std::string& _string); 21 | std::string trim (const std::string& _string); 22 | std::string replace (const std::string& _string, const std::string& _replace, const std::string& _with); 23 | bool startsWith (const std::string& _string, const std::string& _start); 24 | bool endsWith (const std::string& _string, const std::string& _end); 25 | std::string removeParenthesis (const std::string& _string); 26 | stringVector commaStringToVector(const std::string& _string); 27 | std::string vectorToCommaString(stringVector _vector); 28 | std::string format (const char* _string, ...); 29 | std::string scramble (const std::string& _input, const std::string& key); 30 | std::vector split (const std::string& s, char seperator); 31 | std::vector splitAny(const std::string& s, const std::string& seperator); 32 | 33 | #if defined(_WIN32) 34 | const std::string convertFromWideString(const std::wstring wstring); 35 | const std::wstring convertToWideString(const std::string string); 36 | #endif 37 | } // String:: 38 | 39 | } // Utils:: 40 | 41 | #endif // ES_CORE_UTILS_STRING_UTIL_H 42 | -------------------------------------------------------------------------------- /es-core/src/utils/ThreadPool.cpp: -------------------------------------------------------------------------------- 1 | #include "ThreadPool.h" 2 | 3 | #if WIN32 4 | #include 5 | #endif 6 | 7 | namespace Utils 8 | { 9 | ThreadPool::ThreadPool() : mRunning(true), mWaiting(false), mNumWork(0) 10 | { 11 | size_t num_threads = std::thread::hardware_concurrency() * 2; 12 | 13 | auto doWork = [&](size_t id) 14 | { 15 | #if WIN32 16 | auto mask = (static_cast(1) << id); 17 | SetThreadAffinityMask(GetCurrentThread(), mask); 18 | #endif 19 | 20 | while (mRunning) 21 | { 22 | _mutex.lock(); 23 | if (!mWorkQueue.empty()) 24 | { 25 | auto work = mWorkQueue.front(); 26 | mWorkQueue.pop(); 27 | _mutex.unlock(); 28 | 29 | try 30 | { 31 | work(); 32 | } 33 | catch (...) {} 34 | 35 | mNumWork--; 36 | } 37 | else 38 | { 39 | _mutex.unlock(); 40 | 41 | // Extra code : Exit finished threads 42 | if (mWaiting) 43 | return; 44 | 45 | std::this_thread::yield(); 46 | std::this_thread::sleep_for(std::chrono::milliseconds(1)); 47 | } 48 | } 49 | }; 50 | 51 | mThreads.reserve(num_threads); 52 | 53 | for (size_t i = 0; i < num_threads; i++) 54 | mThreads.push_back(std::thread(doWork, i)); 55 | } 56 | 57 | ThreadPool::~ThreadPool() 58 | { 59 | mRunning = false; 60 | 61 | for (std::thread& t : mThreads) 62 | if (t.joinable()) 63 | t.join(); 64 | } 65 | 66 | void ThreadPool::queueWorkItem(work_function work) 67 | { 68 | _mutex.lock(); 69 | mWorkQueue.push(work); 70 | mNumWork++; 71 | _mutex.unlock(); 72 | } 73 | 74 | void ThreadPool::wait() 75 | { 76 | mWaiting = true; 77 | while (mNumWork.load() > 0) 78 | std::this_thread::yield(); 79 | } 80 | 81 | void ThreadPool::wait(work_function work, int delay) 82 | { 83 | mWaiting = true; 84 | 85 | while (mNumWork.load() > 0) 86 | { 87 | work(); 88 | 89 | std::this_thread::yield(); 90 | std::this_thread::sleep_for(std::chrono::milliseconds(delay)); 91 | } 92 | } 93 | } -------------------------------------------------------------------------------- /es-core/src/utils/ThreadPool.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace Utils 10 | { 11 | class ThreadPool 12 | { 13 | public: 14 | typedef std::function work_function; 15 | 16 | ThreadPool(); 17 | ~ThreadPool(); 18 | 19 | void queueWorkItem(work_function work); 20 | void wait(); 21 | void wait(work_function work, int delay = 50); 22 | 23 | private: 24 | bool mRunning; 25 | bool mWaiting; 26 | std::queue mWorkQueue; 27 | std::atomic mNumWork; 28 | std::mutex _mutex; 29 | std::vector mThreads; 30 | 31 | }; 32 | } -------------------------------------------------------------------------------- /external/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # set up the external libraries that aren't popular enough to be found on most 2 | # package managers are included with the project (in the 'external' folder) 3 | 4 | add_subdirectory("nanosvg") 5 | add_subdirectory("pugixml") 6 | -------------------------------------------------------------------------------- /external/nanosvg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project("nanosvg") 2 | 3 | set(NSVG_HEADERS 4 | ${CMAKE_CURRENT_SOURCE_DIR}/nanosvg.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/nanosvgrast.h 6 | ) 7 | 8 | set(NSVG_SOURCES 9 | ${CMAKE_CURRENT_SOURCE_DIR}/src/nanosvg_impl.cpp 10 | ) 11 | 12 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 13 | add_library(nanosvg STATIC ${NSVG_SOURCES} ${NSVG_HEADERS}) 14 | -------------------------------------------------------------------------------- /external/nanosvg/nanosvg_license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-14 Mikko Mononen memon@inside.org 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 2. Altered source versions must be plainly marked as such, and must not be 16 | misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. 18 | 19 | -------------------------------------------------------------------------------- /external/nanosvg/src/nanosvg_impl.cpp: -------------------------------------------------------------------------------- 1 | #define NANOSVG_IMPLEMENTATION 2 | #define NANOSVGRAST_IMPLEMENTATION 3 | 4 | #include 5 | #include "nanosvg.h" 6 | #include "nanosvgrast.h" 7 | -------------------------------------------------------------------------------- /opensans_license.txt: -------------------------------------------------------------------------------- 1 | Regarding the Open Sans font (located in data/resources/ and data/converted): 2 | 3 | Copyright 2010 Steve Matteson 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. -------------------------------------------------------------------------------- /resources/DroidSansFallbackFull.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabricecaruso/old-EmulationStation-fork---see-batocera-emulationstation-instead/09936b0ad01bfef4696416d70de552e00dce3850/resources/DroidSansFallbackFull.ttf -------------------------------------------------------------------------------- /resources/NanumMyeongjo.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabricecaruso/old-EmulationStation-fork---see-batocera-emulationstation-instead/09936b0ad01bfef4696416d70de552e00dce3850/resources/NanumMyeongjo.ttf -------------------------------------------------------------------------------- /resources/OpenSans-CondBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabricecaruso/old-EmulationStation-fork---see-batocera-emulationstation-instead/09936b0ad01bfef4696416d70de552e00dce3850/resources/OpenSans-CondBold.ttf -------------------------------------------------------------------------------- /resources/OpenSans-CondLight.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabricecaruso/old-EmulationStation-fork---see-batocera-emulationstation-instead/09936b0ad01bfef4696416d70de552e00dce3850/resources/OpenSans-CondLight.ttf -------------------------------------------------------------------------------- /resources/alert.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /resources/arrow.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/busy_0.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /resources/busy_1.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /resources/busy_2.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /resources/busy_3.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /resources/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabricecaruso/old-EmulationStation-fork---see-batocera-emulationstation-instead/09936b0ad01bfef4696416d70de552e00dce3850/resources/button.png -------------------------------------------------------------------------------- /resources/button_filled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabricecaruso/old-EmulationStation-fork---see-batocera-emulationstation-instead/09936b0ad01bfef4696416d70de552e00dce3850/resources/button_filled.png -------------------------------------------------------------------------------- /resources/cartridge.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /resources/checkbox_unchecked.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/fav_add.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/fav_remove.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/folder.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/frame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabricecaruso/old-EmulationStation-fork---see-batocera-emulationstation-instead/09936b0ad01bfef4696416d70de552e00dce3850/resources/frame.png -------------------------------------------------------------------------------- /resources/glyphs.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabricecaruso/old-EmulationStation-fork---see-batocera-emulationstation-instead/09936b0ad01bfef4696416d70de552e00dce3850/resources/glyphs.ttf -------------------------------------------------------------------------------- /resources/help/analog_down.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /resources/help/analog_left.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /resources/help/analog_right.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /resources/help/analog_stick.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /resources/help/analog_thumb.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /resources/help/analog_up.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /resources/help/button_1.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/help/button_2.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/help/button_3.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/help/button_4.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/help/button_a.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/help/button_b.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/help/button_circle.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/help/button_cross.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/help/button_hotkey.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/help/button_l.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/help/button_lr.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/help/button_lt.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /resources/help/button_r.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/help/button_rt.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /resources/help/button_select.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/help/button_square.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/help/button_start.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /resources/help/button_triangle.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/help/button_x.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/help/button_y.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/help/buttons_east.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /resources/help/buttons_north.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /resources/help/buttons_south.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /resources/help/buttons_west.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /resources/help/dpad_all.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/help/dpad_down.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/help/dpad_left.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/help/dpad_leftright.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/help/dpad_right.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/help/dpad_up.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/help/dpad_updown.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/info.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /resources/mamebioses.xml: -------------------------------------------------------------------------------- 1 | 3dobios 2 | airlbios 3 | aleck64 4 | alg_bios 5 | allied 6 | ar_bios 7 | aristmk5 8 | aristmk6 9 | atarisy1 10 | atluspsx 11 | atpsx 12 | awbios 13 | bctvidbs 14 | bubsys 15 | cd32 16 | cdibios 17 | cedmag 18 | chihiro 19 | coh1000a 20 | coh1000c 21 | coh1000t 22 | coh1000w 23 | coh1001l 24 | coh1002e 25 | coh1002m 26 | coh1002v 27 | coh3002c 28 | coh3002t 29 | cpzn1 30 | cpzn2 31 | crysbios 32 | cubo 33 | decocass 34 | f355bios 35 | f355dlx 36 | galgbios 37 | gp_110 38 | gq863 39 | gts1 40 | gts1s 41 | hikaru 42 | hng64 43 | hod2bios 44 | isgsm 45 | iteagle 46 | konamigv 47 | konamigx 48 | kviper 49 | lindbios 50 | list.txt 51 | mac2bios 52 | macsbios 53 | maxaflex 54 | megaplay 55 | megatech 56 | naomi2 57 | naomi 58 | naomigd 59 | neogeo 60 | nss 61 | pgm 62 | playch10 63 | psarc95 64 | pyson 65 | sammymdl 66 | segasp 67 | sfcbox 68 | shtzone 69 | skns 70 | stvbios 71 | su2000 72 | sys246 73 | sys256 74 | sys573 75 | taitofx1 76 | taitogn 77 | taitotz 78 | tourvis 79 | tps 80 | triforce 81 | v4bios 82 | vspsx 83 | -------------------------------------------------------------------------------- /resources/on.svg: -------------------------------------------------------------------------------- 1 | 2 | 16 | 18 | 19 | 21 | image/svg+xml 22 | 24 | 25 | 26 | 27 | 29 | 49 | 54 | 55 | -------------------------------------------------------------------------------- /resources/opensans_hebrew_condensed_light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabricecaruso/old-EmulationStation-fork---see-batocera-emulationstation-instead/09936b0ad01bfef4696416d70de552e00dce3850/resources/opensans_hebrew_condensed_light.ttf -------------------------------------------------------------------------------- /resources/opensans_hebrew_condensed_regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabricecaruso/old-EmulationStation-fork---see-batocera-emulationstation-instead/09936b0ad01bfef4696416d70de552e00dce3850/resources/opensans_hebrew_condensed_regular.ttf -------------------------------------------------------------------------------- /resources/option_arrow.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/question.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 9 | 12 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /resources/scroll_gradient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabricecaruso/old-EmulationStation-fork---see-batocera-emulationstation-instead/09936b0ad01bfef4696416d70de552e00dce3850/resources/scroll_gradient.png -------------------------------------------------------------------------------- /resources/search.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /resources/slider_knob.svg: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Layer 1 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /resources/star_filled.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/star_unfilled.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/textinput_ninepatch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabricecaruso/old-EmulationStation-fork---see-batocera-emulationstation-instead/09936b0ad01bfef4696416d70de552e00dce3850/resources/textinput_ninepatch.png -------------------------------------------------------------------------------- /resources/textinput_ninepatch_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabricecaruso/old-EmulationStation-fork---see-batocera-emulationstation-instead/09936b0ad01bfef4696416d70de552e00dce3850/resources/textinput_ninepatch_active.png -------------------------------------------------------------------------------- /resources/warning.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 9 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /resources/window_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabricecaruso/old-EmulationStation-fork---see-batocera-emulationstation-instead/09936b0ad01bfef4696416d70de552e00dce3850/resources/window_icon_256.png --------------------------------------------------------------------------------