Improved custom script execution for the game-start and game-end events.

Also did some minor cosmetic changes to the script logging.
This commit is contained in:
Leon Styhre 2020-08-05 14:49:54 +02:00
parent e4556f57ee
commit 5283881edf
2 changed files with 5 additions and 4 deletions

View file

@ -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();

View file

@ -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<std::string> 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);
}
}