Skip to content

Commit b4fb8ff

Browse files
committed
Merge remote-tracking branch 'retropie/master' into stable
2 parents 3a9297a + 6defa8e commit b4fb8ff

35 files changed

Lines changed: 286 additions & 136 deletions

CMakeLists.txt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,23 @@ elseif(GL)
2020
set(GLSystem "Desktop OpenGL" CACHE STRING "The OpenGL system to be used")
2121
#-------------------------------------------------------------------------------
2222
#check if we're running on Raspberry Pi
23-
elseif(EXISTS "/opt/vc/include/bcm_host.h")
23+
elseif(EXISTS "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/bcm_host.h")
2424
MESSAGE("bcm_host.h found")
2525
set(BCMHOST found)
2626
set(GLSystem "OpenGL ES" CACHE STRING "The OpenGL system to be used")
2727
#-------------------------------------------------------------------------------
2828
#check if we're running on OSMC Vero4K
29-
elseif(EXISTS "/opt/vero3/lib/libMali.so")
29+
elseif(EXISTS "${CMAKE_FIND_ROOT_PATH}/opt/vero3/lib/libMali.so")
3030
MESSAGE("libMali.so found")
3131
set(VERO4K found)
3232
set(GLSystem "OpenGL ES" CACHE STRING "The OpenGL system to be used")
3333
#-------------------------------------------------------------------------------
3434
#check if we're running on olinuxino / odroid / etc
35-
elseif(EXISTS "/usr/lib/libMali.so" OR
36-
EXISTS "/usr/lib/arm-linux-gnueabihf/libMali.so" OR
37-
EXISTS "/usr/lib/aarch64-linux-gnu/libMali.so" OR
38-
EXISTS "/usr/lib/arm-linux-gnueabihf/mali-egl/libmali.so" OR
39-
EXISTS "/usr/lib/arm-linux-gnueabihf/libmali.so")
35+
elseif(EXISTS "${CMAKE_FIND_ROOT_PATH}/usr/lib/libMali.so" OR
36+
EXISTS "${CMAKE_FIND_ROOT_PATH}/usr/lib/arm-linux-gnueabihf/libMali.so" OR
37+
EXISTS "${CMAKE_FIND_ROOT_PATH}/usr/lib/aarch64-linux-gnu/libMali.so" OR
38+
EXISTS "${CMAKE_FIND_ROOT_PATH}/usr/lib/arm-linux-gnueabihf/mali-egl/libmali.so" OR
39+
EXISTS "${CMAKE_FIND_ROOT_PATH}/usr/lib/arm-linux-gnueabihf/libmali.so")
4040
MESSAGE("libMali.so found")
4141
set(GLSystem "OpenGL ES" CACHE STRING "The OpenGL system to be used")
4242
else()
@@ -142,15 +142,15 @@ endif()
142142

143143
if(DEFINED BCMHOST)
144144
LIST(APPEND COMMON_INCLUDE_DIRS
145-
"/opt/vc/include"
146-
"/opt/vc/include/interface/vcos"
147-
"/opt/vc/include/interface/vmcs_host/linux"
148-
"/opt/vc/include/interface/vcos/pthreads"
145+
"${CMAKE_FIND_ROOT_PATH}/opt/vc/include"
146+
"${CMAKE_FIND_ROOT_PATH}/opt/vc/include/interface/vcos"
147+
"${CMAKE_FIND_ROOT_PATH}/opt/vc/include/interface/vmcs_host/linux"
148+
"${CMAKE_FIND_ROOT_PATH}/opt/vc/include/interface/vcos/pthreads"
149149
)
150150
#add include directory for Vero4K
151151
elseif(DEFINED VERO4K)
152152
LIST(APPEND COMMON_INCLUDE_DIRS
153-
"/opt/vero3/include"
153+
"${CMAKE_FIND_ROOT_PATH}/opt/vero3/include"
154154
)
155155
else()
156156
if(${GLSystem} MATCHES "Desktop OpenGL")
@@ -168,11 +168,11 @@ endif()
168168
#define libraries and directories
169169
if(DEFINED BCMHOST)
170170
link_directories(
171-
"/opt/vc/lib"
171+
"${CMAKE_FIND_ROOT_PATH}/opt/vc/lib"
172172
)
173173
elseif(DEFINED VERO4K)
174174
link_directories(
175-
"/opt/vero3/lib"
175+
"${CMAKE_FIND_ROOT_PATH}/opt/vero3/lib"
176176
)
177177
endif()
178178

es-app/src/CollectionSystemManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ void CollectionSystemManager::updateCollectionSystem(FileData* file, CollectionS
292292
void CollectionSystemManager::trimCollectionCount(FileData* rootFolder, int limit)
293293
{
294294
SystemData* curSys = rootFolder->getSystem();
295-
while (rootFolder->getChildren().size() > limit)
295+
while ((int)rootFolder->getChildrenListToDisplay().size() > limit)
296296
{
297297
CollectionFileData* gameToRemove = (CollectionFileData*)rootFolder->getChildrenListToDisplay().back();
298298
ViewController::get()->getGameListView(curSys).get()->remove(gameToRemove, false);

es-app/src/FileData.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "Log.h"
1111
#include "MameNames.h"
1212
#include "platform.h"
13+
#include "Scripting.h"
1314
#include "SystemData.h"
1415
#include "VolumeControl.h"
1516
#include "Window.h"
@@ -282,6 +283,8 @@ void FileData::launchGame(Window* window)
282283
command = Utils::String::replace(command, "%BASENAME%", basename);
283284
command = Utils::String::replace(command, "%ROM_RAW%", rom_raw);
284285

286+
Scripting::fireEvent("game-start", rom, basename);
287+
285288
LOG(LogInfo) << " " << command;
286289
int exitCode = runSystemCommand(command);
287290

@@ -290,6 +293,8 @@ void FileData::launchGame(Window* window)
290293
LOG(LogWarning) << "...launch terminated with nonzero exit code " << exitCode << "!";
291294
}
292295

296+
Scripting::fireEvent("game-end");
297+
293298
window->init();
294299
VolumeControl::getInstance()->init();
295300
window->normalizeNextUpdate();

es-app/src/Gamelist.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,9 @@ void updateGamelist(SystemData* system)
237237
continue;
238238
}
239239

240-
std::string nodePath = Utils::FileSystem::resolveRelativePath(pathNode.text().get(), system->getStartPath(), true);
241-
std::string gamePath = (*fit)->getPath();
242-
if(nodePath == gamePath || (Utils::FileSystem::exists(nodePath) &&
243-
Utils::FileSystem::exists(gamePath) &&
244-
Utils::FileSystem::isEquivalent(nodePath, gamePath)))
240+
std::string nodePath = Utils::FileSystem::getCanonicalPath(Utils::FileSystem::resolveRelativePath(pathNode.text().get(), system->getStartPath(), true));
241+
std::string gamePath = Utils::FileSystem::getCanonicalPath((*fit)->getPath());
242+
if(nodePath == gamePath)
245243
{
246244
// found it
247245
root.remove_child(fileNode);

es-app/src/guis/GuiMenu.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "views/ViewController.h"
1414
#include "CollectionSystemManager.h"
1515
#include "EmulationStation.h"
16+
#include "Scripting.h"
1617
#include "SystemData.h"
1718
#include "VolumeControl.h"
1819
#include <SDL_events.h>
@@ -296,13 +297,15 @@ void GuiMenu::openUISettings()
296297
s->addSaveFunc([window, theme_set]
297298
{
298299
bool needReload = false;
299-
if(Settings::getInstance()->getString("ThemeSet") != theme_set->getSelected())
300+
std::string oldTheme = Settings::getInstance()->getString("ThemeSet");
301+
if(oldTheme != theme_set->getSelected())
300302
needReload = true;
301303

302304
Settings::getInstance()->setString("ThemeSet", theme_set->getSelected());
303305

304306
if(needReload)
305307
{
308+
Scripting::fireEvent("theme-changed", theme_set->getSelected(), oldTheme);
306309
CollectionSystemManager::get()->updateSystemsList();
307310
ViewController::get()->goToStart();
308311
ViewController::get()->reloadAll(); // TODO - replace this with some sort of signal-based implementation
@@ -472,6 +475,7 @@ void GuiMenu::openQuitMenu()
472475
row.makeAcceptInputHandler([window] {
473476
window->pushGui(new GuiMsgBox(window, "REALLY RESTART?", "YES",
474477
[] {
478+
Scripting::fireEvent("quit");
475479
if(quitES("/tmp/es-restart") != 0)
476480
LOG(LogWarning) << "Restart terminated with non-zero result!";
477481
}, "NO", nullptr));
@@ -487,9 +491,8 @@ void GuiMenu::openQuitMenu()
487491
row.makeAcceptInputHandler([window] {
488492
window->pushGui(new GuiMsgBox(window, "REALLY QUIT?", "YES",
489493
[] {
490-
SDL_Event ev;
491-
ev.type = SDL_QUIT;
492-
SDL_PushEvent(&ev);
494+
Scripting::fireEvent("quit");
495+
quitES("");
493496
}, "NO", nullptr));
494497
});
495498
row.addElement(std::make_shared<TextComponent>(window, "QUIT EMULATIONSTATION", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
@@ -500,6 +503,8 @@ void GuiMenu::openQuitMenu()
500503
row.makeAcceptInputHandler([window] {
501504
window->pushGui(new GuiMsgBox(window, "REALLY RESTART?", "YES",
502505
[] {
506+
Scripting::fireEvent("quit", "reboot");
507+
Scripting::fireEvent("reboot");
503508
if (quitES("/tmp/es-sysrestart") != 0)
504509
LOG(LogWarning) << "Restart terminated with non-zero result!";
505510
}, "NO", nullptr));
@@ -511,6 +516,8 @@ void GuiMenu::openQuitMenu()
511516
row.makeAcceptInputHandler([window] {
512517
window->pushGui(new GuiMsgBox(window, "REALLY SHUTDOWN?", "YES",
513518
[] {
519+
Scripting::fireEvent("quit", "shutdown");
520+
Scripting::fireEvent("shutdown");
514521
if (quitES("/tmp/es-shutdown") != 0)
515522
LOG(LogWarning) << "Shutdown terminated with non-zero result!";
516523
}, "NO", nullptr));

es-app/src/guis/GuiScreensaverOptions.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "guis/GuiScreensaverOptions.h"
22

3+
#include "guis/GuiTextEditPopup.h"
34
#include "views/ViewController.h"
45
#include "Settings.h"
56
#include "SystemData.h"
@@ -67,3 +68,30 @@ std::vector<HelpPrompt> GuiScreensaverOptions::getHelpPrompts()
6768

6869
return prompts;
6970
}
71+
72+
void GuiScreensaverOptions::addEditableTextComponent(ComponentListRow row, const std::string label, std::shared_ptr<GuiComponent> ed, std::string value)
73+
{
74+
row.elements.clear();
75+
76+
auto lbl = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(label), Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
77+
row.addElement(lbl, true); // label
78+
79+
row.addElement(ed, true);
80+
81+
auto spacer = std::make_shared<GuiComponent>(mWindow);
82+
spacer->setSize(Renderer::getScreenWidth() * 0.005f, 0);
83+
row.addElement(spacer, false);
84+
85+
auto bracket = std::make_shared<ImageComponent>(mWindow);
86+
bracket->setImage(":/arrow.svg");
87+
bracket->setResize(Vector2f(0, lbl->getFont()->getLetterHeight()));
88+
row.addElement(bracket, false);
89+
90+
auto updateVal = [ed](const std::string& newVal) { ed->setValue(newVal); }; // ok callback (apply new value to ed)
91+
row.makeAcceptInputHandler([this, label, ed, updateVal] {
92+
mWindow->pushGui(new GuiTextEditPopup(mWindow, label, ed->getValue(), updateVal, false));
93+
});
94+
assert(ed);
95+
addRow(row);
96+
ed->setValue(value);
97+
}

es-app/src/guis/GuiScreensaverOptions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class GuiScreensaverOptions : public GuiComponent
1515
inline void addRow(const ComponentListRow& row) { mMenu.addRow(row); };
1616
inline void addWithLabel(const std::string& label, const std::shared_ptr<GuiComponent>& comp) { mMenu.addWithLabel(label, comp); };
1717
inline void addSaveFunc(const std::function<void()>& func) { mSaveFuncs.push_back(func); };
18+
void addEditableTextComponent(ComponentListRow row, const std::string label, std::shared_ptr<GuiComponent> ed, std::string value);
1819

1920
bool input(InputConfig* config, Input input) override;
2021
std::vector<HelpPrompt> getHelpPrompts() override;

es-app/src/guis/GuiSlideshowScreensaverOptions.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -80,31 +80,3 @@ void GuiSlideshowScreensaverOptions::addWithLabel(ComponentListRow row, const st
8080

8181
addRow(row);
8282
}
83-
84-
void GuiSlideshowScreensaverOptions::addEditableTextComponent(ComponentListRow row, const std::string label, std::shared_ptr<GuiComponent> ed, std::string value)
85-
{
86-
row.elements.clear();
87-
88-
auto lbl = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(label), Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
89-
row.addElement(lbl, true); // label
90-
91-
row.addElement(ed, true);
92-
93-
auto spacer = std::make_shared<GuiComponent>(mWindow);
94-
spacer->setSize(Renderer::getScreenWidth() * 0.005f, 0);
95-
row.addElement(spacer, false);
96-
97-
auto bracket = std::make_shared<ImageComponent>(mWindow);
98-
bracket->setImage(":/arrow.svg");
99-
bracket->setResize(Vector2f(0, lbl->getFont()->getLetterHeight()));
100-
row.addElement(bracket, false);
101-
102-
auto updateVal = [ed](const std::string& newVal) { ed->setValue(newVal); }; // ok callback (apply new value to ed)
103-
row.makeAcceptInputHandler([this, label, ed, updateVal] {
104-
mWindow->pushGui(new GuiTextEditPopup(mWindow, label, ed->getValue(), updateVal, false));
105-
});
106-
107-
assert(ed);
108-
addRow(row);
109-
ed->setValue(value);
110-
}

es-app/src/guis/GuiSlideshowScreensaverOptions.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class GuiSlideshowScreensaverOptions : public GuiScreensaverOptions
1212

1313
private:
1414
void addWithLabel(ComponentListRow row, const std::string label, std::shared_ptr<GuiComponent> component);
15-
void addEditableTextComponent(ComponentListRow row, const std::string label, std::shared_ptr<GuiComponent> ed, std::string value);
1615
};
1716

1817
#endif // ES_APP_GUIS_GUI_SLIDESHOW_SCREENSAVER_OPTIONS_H

es-app/src/guis/GuiVideoScreensaverOptions.cpp

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ GuiVideoScreensaverOptions::GuiVideoScreensaverOptions(Window* window, const cha
1818
PowerSaver::updateTimeouts();
1919
});
2020

21+
auto stretch_screensaver = std::make_shared<SwitchComponent>(mWindow);
22+
stretch_screensaver->setState(Settings::getInstance()->getBool("StretchVideoOnScreenSaver"));
23+
addWithLabel("STRETCH VIDEO ON SCREENSAVER", stretch_screensaver);
24+
addSaveFunc([stretch_screensaver] { Settings::getInstance()->setBool("StretchVideoOnScreenSaver", stretch_screensaver->getState()); });
25+
2126
#ifdef _RPI_
2227
auto ss_omx = std::make_shared<SwitchComponent>(mWindow);
2328
ss_omx->setState(Settings::getInstance()->getBool("ScreenSaverOmxPlayer"));
@@ -36,17 +41,49 @@ GuiVideoScreensaverOptions::GuiVideoScreensaverOptions(Window* window, const cha
3641
addWithLabel("SHOW GAME INFO ON SCREENSAVER", ss_info);
3742
addSaveFunc([ss_info, this] { Settings::getInstance()->setString("ScreenSaverGameInfo", ss_info->getSelected()); });
3843

44+
#ifdef _RPI_
45+
ComponentListRow row;
46+
47+
// Set subtitle position
48+
auto ss_omx_subs_align = std::make_shared< OptionListComponent<std::string> >(mWindow, "GAME INFO ALIGNMENT", false);
49+
std::vector<std::string> align_mode;
50+
align_mode.push_back("left");
51+
align_mode.push_back("center");
52+
for(auto it = align_mode.cbegin(); it != align_mode.cend(); it++)
53+
ss_omx_subs_align->add(*it, *it, Settings::getInstance()->getString("SubtitleAlignment") == *it);
54+
addWithLabel("GAME INFO ALIGNMENT", ss_omx_subs_align);
55+
addSaveFunc([ss_omx_subs_align, this] { Settings::getInstance()->setString("SubtitleAlignment", ss_omx_subs_align->getSelected()); });
56+
57+
// Set font size
58+
auto ss_omx_font_size = std::make_shared<SliderComponent>(mWindow, 1.f, 64.f, 1.f, "h");
59+
ss_omx_font_size->setValue((float)(Settings::getInstance()->getInt("SubtitleSize")));
60+
addWithLabel("GAME INFO FONT SIZE", ss_omx_font_size);
61+
addSaveFunc([ss_omx_font_size] {
62+
int subSize = (int)Math::round(ss_omx_font_size->getValue());
63+
Settings::getInstance()->setInt("SubtitleSize", subSize);
64+
});
65+
66+
// Define subtitle font
67+
auto ss_omx_font_file = std::make_shared<TextComponent>(mWindow, "", Font::get(FONT_SIZE_SMALL), 0x777777FF);
68+
addEditableTextComponent(row, "PATH TO FONT FILE", ss_omx_font_file, Settings::getInstance()->getString("SubtitleFont"));
69+
addSaveFunc([ss_omx_font_file] {
70+
Settings::getInstance()->setString("SubtitleFont", ss_omx_font_file->getValue());
71+
});
72+
73+
// Define subtitle italic font
74+
auto ss_omx_italic_font_file = std::make_shared<TextComponent>(mWindow, "", Font::get(FONT_SIZE_SMALL), 0x777777FF);
75+
addEditableTextComponent(row, "PATH TO ITALIC FONT FILE", ss_omx_italic_font_file, Settings::getInstance()->getString("SubtitleItalicFont"));
76+
addSaveFunc([ss_omx_italic_font_file] {
77+
Settings::getInstance()->setString("SubtitleItalicFont", ss_omx_italic_font_file->getValue());
78+
});
79+
#endif
80+
3981
#ifndef _RPI_
4082
auto captions_compatibility = std::make_shared<SwitchComponent>(mWindow);
4183
captions_compatibility->setState(Settings::getInstance()->getBool("CaptionsCompatibility"));
4284
addWithLabel("USE COMPATIBLE LOW RESOLUTION FOR CAPTIONS", captions_compatibility);
4385
addSaveFunc([captions_compatibility] { Settings::getInstance()->setBool("CaptionsCompatibility", captions_compatibility->getState()); });
4486
#endif
45-
46-
auto stretch_screensaver = std::make_shared<SwitchComponent>(mWindow);
47-
stretch_screensaver->setState(Settings::getInstance()->getBool("StretchVideoOnScreenSaver"));
48-
addWithLabel("STRETCH VIDEO ON SCREENSAVER", stretch_screensaver);
49-
addSaveFunc([stretch_screensaver] { Settings::getInstance()->setBool("StretchVideoOnScreenSaver", stretch_screensaver->getState()); });
5087
}
5188

5289
GuiVideoScreensaverOptions::~GuiVideoScreensaverOptions()

0 commit comments

Comments
 (0)