From 5283881edf08f0d0c60e0fa70467182886cf3aa2 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Wed, 5 Aug 2020 14:49:54 +0200 Subject: [PATCH] Improved custom script execution for the game-start and game-end events. Also did some minor cosmetic changes to the script logging. --- es-app/src/FileData.cpp | 4 ++-- es-core/src/Scripting.cpp | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/es-app/src/FileData.cpp b/es-app/src/FileData.cpp index dcec9e426..53e93567f 100644 --- a/es-app/src/FileData.cpp +++ b/es-app/src/FileData.cpp @@ -612,7 +612,7 @@ void FileData::launchGame(Window* window) std::wstring commandWide = Utils::String::stringToWideString(command); #endif - Scripting::fireEvent("game-start", rom, basename); + Scripting::fireEvent("game-start", rom, getSourceFileData()->metadata.get("name")); int returnValue = 0; if (command.find("%EMUPATH%") != std::string::npos) { @@ -710,7 +710,7 @@ void FileData::launchGame(Window* window) #endif } - Scripting::fireEvent("game-end"); + Scripting::fireEvent("game-end", rom, getSourceFileData()->metadata.get("name")); // Update number of times the game has been launched. FileData* gameToUpdate = getSourceFileData(); diff --git a/es-core/src/Scripting.cpp b/es-core/src/Scripting.cpp index 3d986268c..1d79378c8 100644 --- a/es-core/src/Scripting.cpp +++ b/es-core/src/Scripting.cpp @@ -24,7 +24,8 @@ namespace Scripting if (!Settings::getInstance()->getBool("CustomEventScripts")) return; - LOG(LogDebug) << "fireEvent: " << eventName << " " << arg1 << " " << arg2; + LOG(LogDebug) << "Scripting::fireEvent(): " << eventName << " \"" << arg1 << + "\" \"" << arg2 << "\""; std::list scriptDirList; std::string test; @@ -41,7 +42,7 @@ namespace Scripting it != scripts.cend(); ++it) { // Append folder to path. std::string script = *it + " \"" + arg1 + "\" \"" + arg2 + "\""; - LOG(LogDebug) << " executing: " << script; + LOG(LogDebug) << "Executing: " << script; runSystemCommand(script); } }