mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14:15:38 +00:00
Added custom event script triggers on application startup, screensaver start and screensaver end.
This commit is contained in:
parent
09992b5bee
commit
6a0b1bad5b
|
@ -25,6 +25,7 @@
|
||||||
#include "MameNames.h"
|
#include "MameNames.h"
|
||||||
#include "MediaViewer.h"
|
#include "MediaViewer.h"
|
||||||
#include "Screensaver.h"
|
#include "Screensaver.h"
|
||||||
|
#include "Scripting.h"
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
#include "Sound.h"
|
#include "Sound.h"
|
||||||
#include "SystemData.h"
|
#include "SystemData.h"
|
||||||
|
@ -550,6 +551,8 @@ int main(int argc, char* argv[])
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Scripting::fireEvent("startup");
|
||||||
|
|
||||||
#if defined(__EMSCRIPTEN__)
|
#if defined(__EMSCRIPTEN__)
|
||||||
// TODO: Remove when application window resizing has been implemented.
|
// TODO: Remove when application window resizing has been implemented.
|
||||||
Settings::getInstance()->setBool("Debug", true);
|
Settings::getInstance()->setBool("Debug", true);
|
||||||
|
|
|
@ -119,7 +119,7 @@ bool SystemView::input(InputConfig* config, Input input)
|
||||||
if (!mWindow->isScreensaverActive()) {
|
if (!mWindow->isScreensaverActive()) {
|
||||||
ViewController::getInstance()->stopScrolling();
|
ViewController::getInstance()->stopScrolling();
|
||||||
ViewController::getInstance()->cancelViewTransitions();
|
ViewController::getInstance()->cancelViewTransitions();
|
||||||
mWindow->startScreensaver();
|
mWindow->startScreensaver(false);
|
||||||
mWindow->renderScreensaver();
|
mWindow->renderScreensaver();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include "InputManager.h"
|
#include "InputManager.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
#include "Scripting.h"
|
||||||
#include "Sound.h"
|
#include "Sound.h"
|
||||||
#include "components/HelpComponent.h"
|
#include "components/HelpComponent.h"
|
||||||
#include "components/ImageComponent.h"
|
#include "components/ImageComponent.h"
|
||||||
|
@ -200,12 +201,14 @@ void Window::input(InputConfig* config, Input input)
|
||||||
}
|
}
|
||||||
else if (config->isMappedTo("a", input) && input.value != 0) {
|
else if (config->isMappedTo("a", input) && input.value != 0) {
|
||||||
// Launch game.
|
// Launch game.
|
||||||
|
Scripting::fireEvent("screensaver-end", "game-start");
|
||||||
stopScreensaver();
|
stopScreensaver();
|
||||||
mScreensaver->launchGame();
|
mScreensaver->launchGame();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (config->isMappedTo("y", input) && input.value != 0) {
|
else if (config->isMappedTo("y", input) && input.value != 0) {
|
||||||
// Jump to the game in its gamelist, but do not launch it.
|
// Jump to the game in its gamelist, but do not launch it.
|
||||||
|
Scripting::fireEvent("screensaver-end", "game-jump");
|
||||||
stopScreensaver();
|
stopScreensaver();
|
||||||
NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND);
|
NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND);
|
||||||
mScreensaver->goToGame();
|
mScreensaver->goToGame();
|
||||||
|
@ -217,6 +220,7 @@ void Window::input(InputConfig* config, Input input)
|
||||||
|
|
||||||
// Any keypress cancels the screensaver.
|
// Any keypress cancels the screensaver.
|
||||||
if (input.value != 0 && isScreensaverActive()) {
|
if (input.value != 0 && isScreensaverActive()) {
|
||||||
|
Scripting::fireEvent("screensaver-end", "cancel");
|
||||||
stopScreensaver();
|
stopScreensaver();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -566,7 +570,7 @@ void Window::render()
|
||||||
else if (mGameLaunchedState)
|
else if (mGameLaunchedState)
|
||||||
mTimeSinceLastInput = 0;
|
mTimeSinceLastInput = 0;
|
||||||
else if (!isProcessing() && !mScreensaver->isScreensaverActive())
|
else if (!isProcessing() && !mScreensaver->isScreensaverActive())
|
||||||
startScreensaver();
|
startScreensaver(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mInfoPopup)
|
if (mInfoPopup)
|
||||||
|
@ -713,9 +717,13 @@ void Window::stopInfoPopup()
|
||||||
std::queue<std::pair<std::string, int>>().swap(mInfoPopupQueue);
|
std::queue<std::pair<std::string, int>>().swap(mInfoPopupQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::startScreensaver()
|
void Window::startScreensaver(bool onTimer)
|
||||||
{
|
{
|
||||||
if (mScreensaver && !mRenderScreensaver) {
|
if (mScreensaver && !mRenderScreensaver) {
|
||||||
|
if (onTimer)
|
||||||
|
Scripting::fireEvent("screensaver-start", "timer");
|
||||||
|
else
|
||||||
|
Scripting::fireEvent("screensaver-start", "manual");
|
||||||
setAllowTextScrolling(false);
|
setAllowTextScrolling(false);
|
||||||
setAllowFileAnimation(false);
|
setAllowFileAnimation(false);
|
||||||
mScreensaver->startScreensaver(true);
|
mScreensaver->startScreensaver(true);
|
||||||
|
|
|
@ -107,7 +107,7 @@ public:
|
||||||
}
|
}
|
||||||
void stopInfoPopup();
|
void stopInfoPopup();
|
||||||
|
|
||||||
void startScreensaver();
|
void startScreensaver(bool onTimer);
|
||||||
bool stopScreensaver();
|
bool stopScreensaver();
|
||||||
void renderScreensaver();
|
void renderScreensaver();
|
||||||
void screensaverTriggerNextGame() { mScreensaver->triggerNextGame(); }
|
void screensaverTriggerNextGame() { mScreensaver->triggerNextGame(); }
|
||||||
|
|
Loading…
Reference in a new issue