diff --git a/Tactility/Private/Tactility/app/files/SupportedFiles.h b/Tactility/Private/Tactility/app/files/SupportedFiles.h index 5c4f2e02..914ee6c3 100644 --- a/Tactility/Private/Tactility/app/files/SupportedFiles.h +++ b/Tactility/Private/Tactility/app/files/SupportedFiles.h @@ -1,3 +1,9 @@ #pragma once #include -namespace tt::app::files { bool isSupportedAppFile(const std::string& filename); bool isSupportedImageFile(const std::string& filename); bool isSupportedTextFile(const std::string& filename); bool isSupportedAudioFile(const std::string& filename); } // namespace +namespace tt::app::files { +bool isSupportedAppFile(const std::string& filename); +bool isSupportedImageFile(const std::string& filename); +bool isSupportedTextFile(const std::string& filename); +bool isSupportedAudioFile(const std::string& filename); +bool isSupportedGameBoyFile(const std::string& filename); +} // namespace diff --git a/Tactility/Source/app/files/SupportedFiles.cpp b/Tactility/Source/app/files/SupportedFiles.cpp index fc43e35e..4a2c85ff 100644 --- a/Tactility/Source/app/files/SupportedFiles.cpp +++ b/Tactility/Source/app/files/SupportedFiles.cpp @@ -1,3 +1,24 @@ #include #include -namespace tt::app::files { constexpr auto* TAG = "Files"; bool isSupportedAppFile(const std::string& filename) { return filename.ends_with(".app"); } bool isSupportedImageFile(const std::string& filename) { return string::lowercase(filename).ends_with(".png"); } bool isSupportedTextFile(const std::string& filename) { std::string l=string::lowercase(filename); return l.ends_with(".txt")||l.ends_with(".ini")||l.ends_with(".json")||l.ends_with(".yaml")||l.ends_with(".yml")||l.ends_with(".lua")||l.ends_with(".js")||l.ends_with(".properties"); } bool isSupportedAudioFile(const std::string& filename) { std::string l=string::lowercase(filename); return l.ends_with(".mp3")||l.ends_with(".wav")||l.ends_with(".ogg")||l.ends_with(".flac"); } } // namespace +namespace tt::app::files { +constexpr auto* TAG = "Files"; +bool isSupportedAppFile(const std::string& filename) { + return filename.ends_with(".app"); +} +bool isSupportedImageFile(const std::string& filename) { + return string::lowercase(filename).ends_with(".png"); +} +bool isSupportedTextFile(const std::string& filename) { + std::string l = string::lowercase(filename); + return l.ends_with(".txt") || l.ends_with(".ini") || l.ends_with(".json") || l.ends_with(".yaml") || l.ends_with(".yml") || + l.ends_with(".lua") || l.ends_with(".js") || l.ends_with(".properties"); +} +bool isSupportedAudioFile(const std::string& filename) { + std::string l = string::lowercase(filename); + return l.ends_with(".mp3") || l.ends_with(".wav") || l.ends_with(".ogg") || l.ends_with(".flac"); +} +bool isSupportedGameBoyFile(const std::string& filename) { + std::string l = string::lowercase(filename); + return l.ends_with(".gb") || l.ends_with(".gbc") || l.ends_with(".sgb"); +} +} // namespace diff --git a/Tactility/Source/app/files/View.cpp b/Tactility/Source/app/files/View.cpp index 790b65d3..70ffe8e4 100644 --- a/Tactility/Source/app/files/View.cpp +++ b/Tactility/Source/app/files/View.cpp @@ -239,6 +239,15 @@ void View::viewFile(const std::string& path, const std::string& filename) { if (loader) { loader->start("one.tactility.mp3player", bundle); } +#endif + } else if (isSupportedGameBoyFile(filename)) { +#ifdef ESP_PLATFORM + auto bundle = std::make_shared(); + bundle->putString("file", processed_filepath); + auto loader = service::loader::findLoaderService(); + if (loader) { + loader->start("one.tactility.gameboy", bundle); + } #endif } else { LOG_W(TAG, "Opening files of this type is not supported");