From 21cca55e4f5c92a6cb56ef82d45d78d41cb58537 Mon Sep 17 00:00:00 2001 From: EthanB Date: Mon, 7 Sep 2020 17:46:25 -0700 Subject: [PATCH] Add macros to field in es_systems.cfg Adds `%ES_HOME%` and `%ROM_DIR%` macros to `` fields in `es_systems.cfg`. Fixes #680. --- es-app/src/FileData.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/es-app/src/FileData.cpp b/es-app/src/FileData.cpp index 31b9848b8d..d1db70373e 100644 --- a/es-app/src/FileData.cpp +++ b/es-app/src/FileData.cpp @@ -279,10 +279,14 @@ void FileData::launchGame(Window* window) const std::string rom = Utils::FileSystem::getEscapedPath(getPath()); const std::string basename = Utils::FileSystem::getStem(getPath()); const std::string rom_raw = Utils::FileSystem::getPreferredPath(getPath()); + const std::string es_home = Utils::FileSystem::getHomePath(); + const std::string rom_dir = Utils::FileSystem::getParent(getPath()); command = Utils::String::replace(command, "%ROM%", rom); command = Utils::String::replace(command, "%BASENAME%", basename); command = Utils::String::replace(command, "%ROM_RAW%", rom_raw); + command = Utils::String::replace(command, "%ES_HOME%", es_home); + command = Utils::String::replace(command, "%ROM_DIR%", rom_dir); Scripting::fireEvent("game-start", rom, basename);