Skip to content

Commit bc72990

Browse files
committed
Changed 'emulationstation' folder to 'es-app' because I forgot executables don't have extensions on Linux
Half of the ES code has been missing for 5 days because I am incompetent
1 parent dbdbcde commit bc72990

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+37935
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,4 @@ set(LIBRARY_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE)
185185

186186
add_subdirectory("external")
187187
add_subdirectory("es-core")
188-
add_subdirectory("emulationstation")
188+
add_subdirectory("es-app")

es-app/CMakeLists.txt

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
project("emulationstation")
2+
3+
set(ES_HEADERS
4+
${CMAKE_CURRENT_SOURCE_DIR}/src/EmulationStation.h
5+
${CMAKE_CURRENT_SOURCE_DIR}/src/FileData.h
6+
${CMAKE_CURRENT_SOURCE_DIR}/src/FileSorts.h
7+
${CMAKE_CURRENT_SOURCE_DIR}/src/MetaData.h
8+
${CMAKE_CURRENT_SOURCE_DIR}/src/PlatformId.h
9+
${CMAKE_CURRENT_SOURCE_DIR}/src/ScraperCmdLine.h
10+
${CMAKE_CURRENT_SOURCE_DIR}/src/SystemData.h
11+
${CMAKE_CURRENT_SOURCE_DIR}/src/VolumeControl.h
12+
${CMAKE_CURRENT_SOURCE_DIR}/src/Gamelist.h
13+
14+
# GuiComponents
15+
${CMAKE_CURRENT_SOURCE_DIR}/src/components/AsyncReqComponent.h
16+
${CMAKE_CURRENT_SOURCE_DIR}/src/components/RatingComponent.h
17+
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ScraperSearchComponent.h
18+
${CMAKE_CURRENT_SOURCE_DIR}/src/components/TextListComponent.h
19+
20+
# Guis
21+
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiFastSelect.h
22+
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMetaDataEd.h
23+
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGameScraper.h
24+
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGamelistOptions.h
25+
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMenu.h
26+
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiSettings.h
27+
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiScraperMulti.h
28+
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiScraperStart.h
29+
30+
# Scrapers
31+
${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/Scraper.h
32+
${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/GamesDBScraper.h
33+
${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/TheArchiveScraper.h
34+
35+
# Views
36+
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/BasicGameListView.h
37+
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/DetailedGameListView.h
38+
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/IGameListView.h
39+
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/ISimpleGameListView.h
40+
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/GridGameListView.h
41+
${CMAKE_CURRENT_SOURCE_DIR}/src/views/SystemView.h
42+
${CMAKE_CURRENT_SOURCE_DIR}/src/views/ViewController.h
43+
44+
# Animations
45+
${CMAKE_CURRENT_SOURCE_DIR}/src/animations/LaunchAnimation.h
46+
${CMAKE_CURRENT_SOURCE_DIR}/src/animations/MoveCameraAnimation.h
47+
)
48+
49+
set(ES_SOURCES
50+
${CMAKE_CURRENT_SOURCE_DIR}/src/FileData.cpp
51+
${CMAKE_CURRENT_SOURCE_DIR}/src/FileSorts.cpp
52+
${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp
53+
${CMAKE_CURRENT_SOURCE_DIR}/src/MameNameMap.cpp
54+
${CMAKE_CURRENT_SOURCE_DIR}/src/MetaData.cpp
55+
${CMAKE_CURRENT_SOURCE_DIR}/src/PlatformId.cpp
56+
${CMAKE_CURRENT_SOURCE_DIR}/src/ScraperCmdLine.cpp
57+
${CMAKE_CURRENT_SOURCE_DIR}/src/SystemData.cpp
58+
${CMAKE_CURRENT_SOURCE_DIR}/src/VolumeControl.cpp
59+
${CMAKE_CURRENT_SOURCE_DIR}/src/Gamelist.cpp
60+
61+
# GuiComponents
62+
${CMAKE_CURRENT_SOURCE_DIR}/src/components/AsyncReqComponent.cpp
63+
${CMAKE_CURRENT_SOURCE_DIR}/src/components/RatingComponent.cpp
64+
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ScraperSearchComponent.cpp
65+
66+
# Guis
67+
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiFastSelect.cpp
68+
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMetaDataEd.cpp
69+
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGameScraper.cpp
70+
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGamelistOptions.cpp
71+
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMenu.cpp
72+
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiSettings.cpp
73+
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiScraperMulti.cpp
74+
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiScraperStart.cpp
75+
76+
# Scrapers
77+
${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/Scraper.cpp
78+
${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/GamesDBScraper.cpp
79+
${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/TheArchiveScraper.cpp
80+
81+
# Views
82+
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/BasicGameListView.cpp
83+
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/DetailedGameListView.cpp
84+
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/IGameListView.cpp
85+
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/ISimpleGameListView.cpp
86+
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/GridGameListView.cpp
87+
${CMAKE_CURRENT_SOURCE_DIR}/src/views/SystemView.cpp
88+
${CMAKE_CURRENT_SOURCE_DIR}/src/views/ViewController.cpp
89+
)
90+
91+
#-------------------------------------------------------------------------------
92+
# define OS specific sources and headers
93+
if(MSVC)
94+
LIST(APPEND ES_SOURCES
95+
${CMAKE_CURRENT_SOURCE_DIR}/src/EmulationStation.rc
96+
)
97+
endif()
98+
99+
#-------------------------------------------------------------------------------
100+
# define target
101+
include_directories(${COMMON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/src)
102+
add_executable(emulationstation ${ES_SOURCES} ${ES_HEADERS})
103+
target_link_libraries(emulationstation ${COMMON_LIBRARIES} es-core)
104+
105+
# special properties for Windows builds
106+
if(MSVC)
107+
#show console in debug builds, but not in proper release builds
108+
#Note that up to CMake 2.8.10 this feature is broken: http://public.kitware.com/Bug/view.php?id=12566
109+
set_target_properties(emulationstation PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE")
110+
set_target_properties(emulationstation PROPERTIES COMPILE_DEFINITIONS_DEBUG "_CONSOLE")
111+
set_target_properties(emulationstation PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:CONSOLE")
112+
set_target_properties(emulationstation PROPERTIES COMPILE_DEFINITIONS_RELWITHDEBINFO "_CONSOLE")
113+
set_target_properties(emulationstation PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
114+
set_target_properties(emulationstation PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS")
115+
endif()
116+
117+
118+
#-------------------------------------------------------------------------------
119+
# set up CPack install stuff so `make install` does something useful
120+
121+
install(TARGETS emulationstation
122+
RUNTIME
123+
DESTINATION bin)
124+
125+
INCLUDE(InstallRequiredSystemLibraries)
126+
127+
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A flexible graphical emulator front-end")
128+
SET(CPACK_PACKAGE_DESCRIPTION "EmulationStation is a flexible, graphical front-end designed for keyboardless navigation of your multi-platform retro game collection.")
129+
130+
SET(CPACK_RESOURCE_FILE LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md")
131+
SET(CPACK_RESOURCE_FILE README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
132+
133+
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Alec Lofquist <allofquist@yahoo.com>")
134+
SET(CPACK_DEBIAN_PACKAGE_SECTION "misc")
135+
SET(CPACK_DEBIAN_PACKAGE_PRIORITY "extra")
136+
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libsdl2-2.0-0, libboost-system1.54.0, libboost-filesystem1.54.0, libfreeimage3, libfreetype6, libcurl3, libasound2")
137+
SET(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS "debhelper (>= 8.0.0), cmake, g++ (>= 4.8), libsdl2-dev, libboost-system-dev, libboost-filesystem-dev, libboost-date-time-dev, libfreeimage-dev, libfreetype6-dev, libeigen3-dev, libcurl4-openssl-dev, libasound2-dev, libgl1-mesa-dev")
138+
139+
SET(CPACK_PACKAGE_VENDOR "emulationstation.org")
140+
SET(CPACK_PACKAGE_VERSION "2.0.0~rc1")
141+
SET(CPACK_PACKAGE_VERSION_MAJOR "2")
142+
SET(CPACK_PACKAGE_VERSION_MINOR "0")
143+
SET(CPACK_PACKAGE_VERSION_PATCH "0")
144+
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "emulationstation_${CMAKE_PACKAGE_VERSION}")
145+
SET(CPACK_PACKAGE_EXECUTABLES "emulationstation" "emulationstation")
146+
147+
SET(CPACK_GENERATOR "TGZ;DEB")
148+
149+
INCLUDE(CPack)

es-app/src/EmulationStation.aps

348 KB
Binary file not shown.

es-app/src/EmulationStation.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#pragma once
2+
3+
// These numbers and strings need to be manually updated for a new version.
4+
// Do this version number update as the very last commit for the new release version.
5+
#define PROGRAM_VERSION_MAJOR 2
6+
#define PROGRAM_VERSION_MINOR 0
7+
#define PROGRAM_VERSION_MAINTENANCE 0
8+
#define PROGRAM_VERSION_STRING "2.0.0-rc1"
9+
10+
#define PROGRAM_BUILT_STRING __DATE__ " - " __TIME__
11+
12+
#define RESOURCE_VERSION_STRING "2,0,0\0"
13+
#define RESOURCE_VERSION PROGRAM_VERSION_MAJOR,PROGRAM_VERSION_MINOR,PROGRAM_VERSION_MAINTENANCE

es-app/src/EmulationStation.rc

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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 "../data/es_icon.ico"

es-app/src/FileData.cpp

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
#include "FileData.h"
2+
#include "SystemData.h"
3+
4+
namespace fs = boost::filesystem;
5+
6+
std::string removeParenthesis(const std::string& str)
7+
{
8+
// remove anything in parenthesis or brackets
9+
// should be roughly equivalent to the regex replace "\((.*)\)|\[(.*)\]" with ""
10+
// I would love to just use regex, but it's not worth pulling in another boost lib for one function that is used once
11+
12+
std::string ret = str;
13+
size_t start, end;
14+
15+
static const int NUM_TO_REPLACE = 2;
16+
static const char toReplace[NUM_TO_REPLACE*2] = { '(', ')', '[', ']' };
17+
18+
bool done = false;
19+
while(!done)
20+
{
21+
done = true;
22+
for(int i = 0; i < NUM_TO_REPLACE; i++)
23+
{
24+
end = ret.find_first_of(toReplace[i*2+1]);
25+
start = ret.find_last_of(toReplace[i*2], end);
26+
27+
if(start != std::string::npos && end != std::string::npos)
28+
{
29+
ret.erase(start, end - start + 1);
30+
done = false;
31+
}
32+
}
33+
}
34+
35+
// also strip whitespace
36+
end = ret.find_last_not_of(' ');
37+
if(end != std::string::npos)
38+
end++;
39+
40+
ret = ret.substr(0, end);
41+
42+
return ret;
43+
}
44+
45+
46+
FileData::FileData(FileType type, const fs::path& path, SystemData* system)
47+
: mType(type), mPath(path), mSystem(system), mParent(NULL), metadata(type == GAME ? GAME_METADATA : FOLDER_METADATA) // metadata is REALLY set in the constructor!
48+
{
49+
// metadata needs at least a name field (since that's what getName() will return)
50+
if(metadata.get("name").empty())
51+
metadata.set("name", getCleanName());
52+
}
53+
54+
FileData::~FileData()
55+
{
56+
if(mParent)
57+
mParent->removeChild(this);
58+
59+
while(mChildren.size())
60+
delete mChildren.back();
61+
}
62+
63+
std::string FileData::getCleanName() const
64+
{
65+
std::string stem = mPath.stem().generic_string();
66+
if(mSystem && mSystem->hasPlatformId(PlatformIds::ARCADE) || mSystem->hasPlatformId(PlatformIds::NEOGEO))
67+
stem = PlatformIds::getCleanMameName(stem.c_str());
68+
69+
return removeParenthesis(stem);
70+
}
71+
72+
const std::string& FileData::getThumbnailPath() const
73+
{
74+
if(!metadata.get("thumbnail").empty())
75+
return metadata.get("thumbnail");
76+
else
77+
return metadata.get("image");
78+
}
79+
80+
81+
std::vector<FileData*> FileData::getFilesRecursive(unsigned int typeMask) const
82+
{
83+
std::vector<FileData*> out;
84+
85+
for(auto it = mChildren.begin(); it != mChildren.end(); it++)
86+
{
87+
if((*it)->getType() & typeMask)
88+
out.push_back(*it);
89+
90+
if((*it)->getChildren().size() > 0)
91+
{
92+
std::vector<FileData*> subchildren = (*it)->getFilesRecursive(typeMask);
93+
out.insert(out.end(), subchildren.cbegin(), subchildren.cend());
94+
}
95+
}
96+
97+
return out;
98+
}
99+
100+
void FileData::addChild(FileData* file)
101+
{
102+
assert(mType == FOLDER);
103+
assert(file->getParent() == NULL);
104+
105+
mChildren.push_back(file);
106+
file->mParent = this;
107+
}
108+
109+
void FileData::removeChild(FileData* file)
110+
{
111+
assert(mType == FOLDER);
112+
assert(file->getParent() == this);
113+
114+
for(auto it = mChildren.begin(); it != mChildren.end(); it++)
115+
{
116+
if(*it == file)
117+
{
118+
mChildren.erase(it);
119+
return;
120+
}
121+
}
122+
123+
// File somehow wasn't in our children.
124+
assert(false);
125+
}
126+
127+
void FileData::sort(ComparisonFunction& comparator, bool ascending)
128+
{
129+
std::sort(mChildren.begin(), mChildren.end(), comparator);
130+
131+
for(auto it = mChildren.begin(); it != mChildren.end(); it++)
132+
{
133+
if((*it)->getChildren().size() > 0)
134+
(*it)->sort(comparator, ascending);
135+
}
136+
137+
if(!ascending)
138+
std::reverse(mChildren.begin(), mChildren.end());
139+
}
140+
141+
void FileData::sort(const SortType& type)
142+
{
143+
sort(*type.comparisonFunction, type.ascending);
144+
}

0 commit comments

Comments
 (0)