Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8e4b653
Add optional input system entry
FCare Feb 15, 2016
ed9ba9f
Add a visiblity information regarding the input controler detection
FCare Feb 15, 2016
b0f8272
Update visibility of systems on SDL joystick events
FCare Feb 15, 2016
e12cdcc
Only show visible systems
FCare Feb 15, 2016
8e89bf2
Skip controller config if known device is added after startup
gizmo98 Sep 28, 2015
70a4cb9
trailing whitespace introduced by #9
joolswills Oct 3, 2015
805ac27
don't strip info from the parentheses in the gameslists - it's useful!
joolswills Sep 19, 2015
4368a34
CHG: Additional input types, user-defined input config scripts
petrockblog Apr 19, 2015
d074053
Hide mouse cursor early
cuhsat Sep 27, 2015
440d12c
Force a default sort algorithm
FCare Feb 16, 2016
a887d8b
Revert "CHG: Additional input types, user-defined input config scripts"
FCare Feb 17, 2016
9aec3f5
Revert "trailing whitespace introduced by #9"
FCare Feb 17, 2016
c8cd122
Revert "Skip controller config if known device is added after startup"
FCare Feb 17, 2016
4b61a62
don't call shutdown from ES directly - which causes it to not save th…
joolswills Jan 17, 2016
2379e12
Add an option to hide the settings - Public shall not be able to chan…
FCare Feb 18, 2016
1adc294
Make the dim level configurable
FCare Feb 18, 2016
a6131b9
Add a fanart entry in the gamelist
FCare Feb 21, 2016
cc0bd96
Add a centered entry for images
FCare Feb 21, 2016
16c376c
Add support for a fanart based theme
FCare Feb 21, 2016
79305e4
Add a fullscreen tag support - In case of fanart, do not display the …
FCare Feb 21, 2016
8c748e6
Fix position at startup
FCare Feb 21, 2016
af085f8
In case of fullscreen, use the vertices position and the texture coor…
FCare Feb 22, 2016
40b1cc2
In case of fullscreen, setup the vertices as fullscreen
FCare Feb 22, 2016
80e760b
In case of fullscreen, setup the texture crop to keep aspect ratio - …
FCare Feb 22, 2016
de7de7e
Improve the resize aspect for small picture that have to be magnified
FCare Feb 22, 2016
5ebe9f7
Scraper download the first fanart - might be nice to have the choice
FCare Feb 26, 2016
a1a2bb9
Use a default fanart
FCare Feb 27, 2016
2b1937d
Do not show in scrapper view useless information
FCare Feb 27, 2016
d289ed1
Add fanart view in the scrapper view
FCare Feb 27, 2016
8745f9f
Do not stay dimmed eternally, finally switch to black. For the moment…
FCare Feb 29, 2016
cfbccc6
USe fanart by default
FCare Mar 16, 2016
8ee3ebc
Fix PS3 controleer bad behavior
FCare Jul 27, 2016
4adb2e4
Clear with black
FCare Jul 27, 2016
76f2b12
Force the home location to a specific directory
FCare Jul 29, 2016
8de3605
Log ony errors
FCare Jul 29, 2016
0e45f4c
Fixes libGL problem
mbroncano Jul 23, 2016
ec666db
Remove useless background
FCare Aug 20, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions emulationstation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

while true; do
rm -f /tmp/es-restart /tmp/es-sysrestart /tmp/es-shutdown
./emulationstation "$@"
[ -f /tmp/es-restart ] && continue
if [ -f /tmp/es-sysrestart ]; then
rm -f /tmp/es-sysrestart
sudo reboot
break
fi
if [ -f /tmp/es-shutdown ]; then
rm -f /tmp/es-shutdown
sudo poweroff
break
fi
break
done
2 changes: 2 additions & 0 deletions es-app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ set(ES_HEADERS
# Views
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/BasicGameListView.h
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/DetailedGameListView.h
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/FanartGameListView.h
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/IGameListView.h
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/ISimpleGameListView.h
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/GridGameListView.h
Expand Down Expand Up @@ -81,6 +82,7 @@ set(ES_SOURCES
# Views
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/BasicGameListView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/DetailedGameListView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/FanartGameListView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/IGameListView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/ISimpleGameListView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/GridGameListView.cpp
Expand Down
2 changes: 1 addition & 1 deletion es-app/src/FileData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ std::string FileData::getCleanName() const
if(mSystem && mSystem->hasPlatformId(PlatformIds::ARCADE) || mSystem->hasPlatformId(PlatformIds::NEOGEO))
stem = PlatformIds::getCleanMameName(stem.c_str());

return removeParenthesis(stem);
return stem;
}

const std::string& FileData::getThumbnailPath() const
Expand Down
1 change: 1 addition & 0 deletions es-app/src/MetaData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ MetaDataDecl gameDecls[] = {
{"name", MD_STRING, "", false, "name", "enter game name"},
{"desc", MD_MULTILINE_STRING, "", false, "description", "enter description"},
{"image", MD_IMAGE_PATH, "", false, "image", "enter path to image"},
{"fanart", MD_IMAGE_PATH, "", false, "fanart", "enter path to fanart"},
{"thumbnail", MD_IMAGE_PATH, "", false, "thumbnail", "enter path to thumbnail"},
{"rating", MD_RATING, "0.000000", false, "rating", "enter rating"},
{"releasedate", MD_DATE, "not-a-date-time", false, "release date", "enter release date"},
Expand Down
27 changes: 23 additions & 4 deletions es-app/src/SystemData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ std::vector<SystemData*> SystemData::sSystemVector;

namespace fs = boost::filesystem;

SystemData::SystemData(const std::string& name, const std::string& fullName, const std::string& startPath, const std::vector<std::string>& extensions,
SystemData::SystemData(const std::string& name, const std::string& fullName, const std::string& input, const std::string& startPath, const std::vector<std::string>& extensions,
const std::string& command, const std::vector<PlatformIds::PlatformId>& platformIds, const std::string& themeFolder)
{
mName = name;
mFullName = fullName;
mStartPath = startPath;
mInput = input;
updateVisibility();

//expand home symbol if the startpath contains ~
if(mStartPath[0] == '~')
Expand All @@ -45,11 +47,18 @@ SystemData::SystemData(const std::string& name, const std::string& fullName, con
if(!Settings::getInstance()->getBool("IgnoreGamelist"))
parseGamelist(this);

mRootFolder->sort(FileSorts::SortTypes.at(0));
int sortId = (int)(Settings::getInstance()->getInt("SortTypeDefault"));

mRootFolder->sort(FileSorts::SortTypes.at(sortId));

loadTheme();
}

void SystemData::updateVisibility()
{
mVisible = InputManager::getInstance()->isInputFound(mInput);
}

SystemData::~SystemData()
{
//save changed game data back to xml
Expand Down Expand Up @@ -104,6 +113,15 @@ std::string escapePath(const boost::filesystem::path& path)
#endif
}

void SystemData::updateSystems()
{
for(unsigned int i = 0; i < sSystemVector.size(); i++)
{
SystemData *v = sSystemVector.at(i);
v->updateVisibility();
}
}

void SystemData::launchGame(Window* window, FileData* game)
{
LOG(LogInfo) << "Attempting to launch game...";
Expand Down Expand Up @@ -262,12 +280,13 @@ bool SystemData::loadConfig()

for(pugi::xml_node system = systemList.child("system"); system; system = system.next_sibling("system"))
{
std::string name, fullname, path, cmd, themeFolder;
std::string name, fullname, path, cmd, themeFolder, input;
PlatformIds::PlatformId platformId = PlatformIds::PLATFORM_UNKNOWN;

name = system.child("name").text().get();
fullname = system.child("fullname").text().get();
path = system.child("path").text().get();
input = system.child("input").text().get();

// convert extensions list from a string into a vector of strings
std::vector<std::string> extensions = readList(system.child("extension").text().get());
Expand Down Expand Up @@ -312,7 +331,7 @@ bool SystemData::loadConfig()
boost::filesystem::path genericPath(path);
path = genericPath.generic_string();

SystemData* newSys = new SystemData(name, fullname, path, extensions, cmd, platformIds, themeFolder);
SystemData* newSys = new SystemData(name, fullname, input, path, extensions, cmd, platformIds, themeFolder);
if(newSys->getRootFolder()->getChildren().size() == 0)
{
LOG(LogWarning) << "System \"" << name << "\" has no games! Ignoring it.";
Expand Down
10 changes: 9 additions & 1 deletion es-app/src/SystemData.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
class SystemData
{
public:
SystemData(const std::string& name, const std::string& fullName, const std::string& startPath, const std::vector<std::string>& extensions,
SystemData(const std::string& name, const std::string& fullName, const std::string& input, const std::string& startPath, const std::vector<std::string>& extensions,
const std::string& command, const std::vector<PlatformIds::PlatformId>& platformIds, const std::string& themeFolder);
~SystemData();

inline FileData* getRootFolder() const { return mRootFolder; };
inline const std::string& getName() const { return mName; }
inline const std::string& getFullName() const { return mFullName; }
inline const bool& isVisible() const { return mVisible; }
inline const std::string& getInput() const { return mInput; }
inline const std::string& getStartPath() const { return mStartPath; }
inline const std::vector<std::string>& getExtensions() const { return mSearchExtensions; }
inline const std::string& getThemeFolder() const { return mThemeFolder; }
Expand Down Expand Up @@ -63,17 +65,23 @@ class SystemData

// Load or re-load theme.
void loadTheme();
void updateVisibility();

static void updateSystems();

private:
std::string mName;
std::string mFullName;
std::string mStartPath;
std::string mInput;
std::vector<std::string> mSearchExtensions;
std::string mLaunchCommand;
std::vector<PlatformIds::PlatformId> mPlatformIds;
std::string mThemeFolder;
std::shared_ptr<ThemeData> mTheme;

bool mVisible;

void populateFolder(FileData* folder);

FileData* mRootFolder;
Expand Down
133 changes: 41 additions & 92 deletions es-app/src/components/ScraperSearchComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,43 +32,18 @@ ScraperSearchComponent::ScraperSearchComponent(Window* window, SearchType type)

// selected result thumbnail
mResultThumbnail = std::make_shared<ImageComponent>(mWindow);
mGrid.setEntry(mResultThumbnail, Vector2i(1, 1), false, false, Vector2i(1, 1));
mGrid.setEntry(mResultThumbnail, Vector2i(1, 1), false, false, Vector2i(2, 3));

// selected result fanart
mResultFanart = std::make_shared<ImageComponent>(mWindow);
if(mSearchType != ALWAYS_ACCEPT_FIRST_RESULT)
mGrid.setEntry(mResultFanart, Vector2i(3, 2), false, false, Vector2i(1, 1));

// selected result desc + container
mDescContainer = std::make_shared<ScrollableContainer>(mWindow);
mResultDesc = std::make_shared<TextComponent>(mWindow, "Result desc", Font::get(FONT_SIZE_SMALL), 0x777777FF);
mDescContainer->addChild(mResultDesc.get());
mDescContainer->setAutoScroll(true);

// metadata
auto font = Font::get(FONT_SIZE_SMALL); // this gets replaced in onSizeChanged() so its just a placeholder
const unsigned int mdColor = 0x777777FF;
const unsigned int mdLblColor = 0x666666FF;
mMD_Rating = std::make_shared<RatingComponent>(mWindow);
mMD_ReleaseDate = std::make_shared<DateTimeComponent>(mWindow);
mMD_ReleaseDate->setColor(mdColor);
mMD_Developer = std::make_shared<TextComponent>(mWindow, "", font, mdColor);
mMD_Publisher = std::make_shared<TextComponent>(mWindow, "", font, mdColor);
mMD_Genre = std::make_shared<TextComponent>(mWindow, "", font, mdColor);
mMD_Players = std::make_shared<TextComponent>(mWindow, "", font, mdColor);

mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, "RATING:", font, mdLblColor), mMD_Rating, false));
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, "RELEASED:", font, mdLblColor), mMD_ReleaseDate));
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, "DEVELOPER:", font, mdLblColor), mMD_Developer));
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, "PUBLISHER:", font, mdLblColor), mMD_Publisher));
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, "GENRE:", font, mdLblColor), mMD_Genre));
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, "PLAYERS:", font, mdLblColor), mMD_Players));

mMD_Grid = std::make_shared<ComponentGrid>(mWindow, Vector2i(2, mMD_Pairs.size()*2 - 1));
unsigned int i = 0;
for(auto it = mMD_Pairs.begin(); it != mMD_Pairs.end(); it++)
{
mMD_Grid->setEntry(it->first, Vector2i(0, i), false, true);
mMD_Grid->setEntry(it->second, Vector2i(1, i), false, it->resize);
i += 2;
}

mGrid.setEntry(mMD_Grid, Vector2i(2, 1), false, false);

// result list
mResultList = std::make_shared<ComponentList>(mWindow);
Expand Down Expand Up @@ -110,7 +85,8 @@ void ScraperSearchComponent::onSizeChanged()

// limit thumbnail size using setMaxHeight - we do this instead of letting mGrid call setSize because it maintains the aspect ratio
// we also pad a little so it doesn't rub up against the metadata labels
mResultThumbnail->setMaxSize(mGrid.getColWidth(1) * boxartCellScale, mGrid.getRowHeight(1));
mResultThumbnail->setMaxSize((mGrid.getColWidth(1)+mGrid.getColWidth(2)) * boxartCellScale, (mGrid.getRowHeight(1)+mGrid.getRowHeight(2)));
mResultFanart->setMaxSize(mGrid.getColWidth(2), mGrid.getRowHeight(2) * boxartCellScale);

// metadata
resizeMetadata();
Expand All @@ -129,44 +105,6 @@ void ScraperSearchComponent::onSizeChanged()

void ScraperSearchComponent::resizeMetadata()
{
mMD_Grid->setSize(mGrid.getColWidth(2), mGrid.getRowHeight(1));
if(mMD_Grid->getSize().y() > mMD_Pairs.size())
{
const int fontHeight = (int)(mMD_Grid->getSize().y() / mMD_Pairs.size() * 0.8f);
auto fontLbl = Font::get(fontHeight, FONT_PATH_REGULAR);
auto fontComp = Font::get(fontHeight, FONT_PATH_LIGHT);

// update label fonts
float maxLblWidth = 0;
for(auto it = mMD_Pairs.begin(); it != mMD_Pairs.end(); it++)
{
it->first->setFont(fontLbl);
it->first->setSize(0, 0);
if(it->first->getSize().x() > maxLblWidth)
maxLblWidth = it->first->getSize().x() + 6;
}

for(unsigned int i = 0; i < mMD_Pairs.size(); i++)
{
mMD_Grid->setRowHeightPerc(i*2, (fontLbl->getLetterHeight() + 2) / mMD_Grid->getSize().y());
}

// update component fonts
mMD_ReleaseDate->setFont(fontComp);
mMD_Developer->setFont(fontComp);
mMD_Publisher->setFont(fontComp);
mMD_Genre->setFont(fontComp);
mMD_Players->setFont(fontComp);

mMD_Grid->setColWidthPerc(0, maxLblWidth / mMD_Grid->getSize().x());

// rating is manually sized
mMD_Rating->setSize(mMD_Grid->getColWidth(1), fontLbl->getHeight() * 0.65f);
mMD_Grid->onSizeChanged();

// make result font follow label font
mResultDesc->setFont(Font::get(fontHeight, FONT_PATH_REGULAR));
}
}

void ScraperSearchComponent::updateViewStyle()
Expand All @@ -191,15 +129,8 @@ void ScraperSearchComponent::updateViewStyle()
mGrid.setEntry(mDescContainer, Vector2i(3, 0), false, false, Vector2i(1, 3), GridFlags::BORDER_TOP | GridFlags::BORDER_BOTTOM);
mResultDesc->setSize(mDescContainer->getSize().x(), 0); // make desc text wrap at edge of container
}else{
// fake row where name would be
mGrid.setEntry(std::make_shared<GuiComponent>(mWindow), Vector2i(1, 0), false, true, Vector2i(2, 1), GridFlags::BORDER_TOP);

// show result list on the right
mGrid.setEntry(mResultList, Vector2i(3, 0), true, true, Vector2i(1, 3), GridFlags::BORDER_LEFT | GridFlags::BORDER_TOP | GridFlags::BORDER_BOTTOM);

// show description under image/info
mGrid.setEntry(mDescContainer, Vector2i(1, 2), false, false, Vector2i(2, 1), GridFlags::BORDER_BOTTOM);
mResultDesc->setSize(mDescContainer->getSize().x(), 0); // make desc text wrap at edge of container
mGrid.setEntry(mResultList, Vector2i(3, 0), true, true, Vector2i(1, 2), GridFlags::BORDER_LEFT | GridFlags::BORDER_TOP | GridFlags::BORDER_BOTTOM);
}
}

Expand Down Expand Up @@ -311,26 +242,24 @@ void ScraperSearchComponent::updateInfoPane()
mThumbnailReq.reset();
}

if(mSearchType != ALWAYS_ACCEPT_FIRST_RESULT) {
mResultFanart->setImage("");
const std::string& fanarturl = res.fanartUrl;
if(!fanarturl.empty())
{
mFanartReq = std::unique_ptr<HttpReq>(new HttpReq(fanarturl));
}else{
mFanartReq.reset();
}
}

// metadata
mMD_Rating->setValue(strToUpper(res.mdl.get("rating")));
mMD_ReleaseDate->setValue(strToUpper(res.mdl.get("releasedate")));
mMD_Developer->setText(strToUpper(res.mdl.get("developer")));
mMD_Publisher->setText(strToUpper(res.mdl.get("publisher")));
mMD_Genre->setText(strToUpper(res.mdl.get("genre")));
mMD_Players->setText(strToUpper(res.mdl.get("players")));
mGrid.onSizeChanged();
}else{
mResultName->setText("");
mResultDesc->setText("");
mResultThumbnail->setImage("");

// metadata
mMD_Rating->setValue("");
mMD_ReleaseDate->setValue("");
mMD_Developer->setText("");
mMD_Publisher->setText("");
mMD_Genre->setText("");
mMD_Players->setText("");
mResultFanart->setImage("");
}
}

Expand Down Expand Up @@ -390,6 +319,11 @@ void ScraperSearchComponent::update(int deltaTime)
updateThumbnail();
}

if(mFanartReq && mFanartReq->status() != HttpReq::REQ_IN_PROGRESS)
{
updateFanart();
}

if(mSearchHandle && mSearchHandle->status() != ASYNC_IN_PROGRESS)
{
auto status = mSearchHandle->status();
Expand Down Expand Up @@ -441,6 +375,21 @@ void ScraperSearchComponent::updateThumbnail()
mThumbnailReq.reset();
}

void ScraperSearchComponent::updateFanart()
{
if(mFanartReq && mFanartReq->status() == HttpReq::REQ_SUCCESS)
{
std::string content = mFanartReq->getContent();
mResultFanart->setImage(content.data(), content.length());
mGrid.onSizeChanged(); // a hack to fix the thumbnail position since its size changed
}else{
LOG(LogWarning) << "fanart req failed: " << mFanartReq->getErrorMsg();
mResultFanart->setImage("");
}

mFanartReq.reset();
}

void ScraperSearchComponent::openInputScreen(ScraperSearchParams& params)
{
auto searchForFunc = [&](const std::string& name)
Expand Down
10 changes: 3 additions & 7 deletions es-app/src/components/ScraperSearchComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class ScraperSearchComponent : public GuiComponent
private:
void updateViewStyle();
void updateThumbnail();
void updateFanart();
void updateInfoPane();

void resizeMetadata();
Expand All @@ -66,15 +67,9 @@ class ScraperSearchComponent : public GuiComponent
std::shared_ptr<ScrollableContainer> mDescContainer;
std::shared_ptr<TextComponent> mResultDesc;
std::shared_ptr<ImageComponent> mResultThumbnail;
std::shared_ptr<ImageComponent> mResultFanart;
std::shared_ptr<ComponentList> mResultList;

std::shared_ptr<ComponentGrid> mMD_Grid;
std::shared_ptr<RatingComponent> mMD_Rating;
std::shared_ptr<DateTimeComponent> mMD_ReleaseDate;
std::shared_ptr<TextComponent> mMD_Developer;
std::shared_ptr<TextComponent> mMD_Publisher;
std::shared_ptr<TextComponent> mMD_Genre;
std::shared_ptr<TextComponent> mMD_Players;

// label-component pair
struct MetaDataPair
Expand All @@ -99,6 +94,7 @@ class ScraperSearchComponent : public GuiComponent
std::unique_ptr<MDResolveHandle> mMDResolveHandle;
std::vector<ScraperSearchResult> mScraperResults;
std::unique_ptr<HttpReq> mThumbnailReq;
std::unique_ptr<HttpReq> mFanartReq;

BusyComponent mBusyAnim;
};
Loading