From 892070f3dec1dc690983fd862880e37e711c2516 Mon Sep 17 00:00:00 2001 From: SulfurNitride Date: Sun, 12 Apr 2026 17:55:56 -0500 Subject: Add BSA in-memory extraction and nested preview support bsatk: - Archive::extractToMemory() extracts a file directly into a byte buffer instead of a filesystem path, backed by a std::ostringstream sink. - Archive::findFile() locates a file by relative path, case-insensitive and separator-agnostic, walking the folder tree recursively. - extractDirect/extractCompressed now take std::ostream& so both the ofstream and ostringstream paths share the same implementation. libbsarch: shim rewrite on Linux to map the Windows API surface onto bsatk::Archive, enabling preview_bsa to open vanilla BSAs via the same interface as other plugins. preview_bsa: double-click on a file in the BSA tree now extracts the bytes via extractToMemory() and hands them to IOrganizer::previewFileData for nested preview rendering (e.g. NIF inside a BSA). uibase + organizerproxy + organizercore: new IOrganizer::previewFileData virtual that routes in-memory file bytes through the first registered IPluginPreview matching the extension. Uses heap + WA_DeleteOnClose + open() to avoid nested exec() softlock from mod info filetree -> preview_bsa tree -> nif preview. docker/build-inner.sh: stage preview_nif shaders into plugin_data/shaders so ShaderManager can load them via IOrganizer::getPluginDataPath(). Co-Authored-By: Claude Opus 4.6 (1M context) --- libs/uibase/include/uibase/imoinfo.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'libs/uibase') diff --git a/libs/uibase/include/uibase/imoinfo.h b/libs/uibase/include/uibase/imoinfo.h index a9ec3d8..1725410 100644 --- a/libs/uibase/include/uibase/imoinfo.h +++ b/libs/uibase/include/uibase/imoinfo.h @@ -21,11 +21,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #ifndef IMOINFO_H #define IMOINFO_H +#include #include #include #include #include #include +#include #include #include #include @@ -369,6 +371,25 @@ public: */ virtual IGameFeatures* gameFeatures() const = 0; + /** + * @brief show a preview dialog for a file loaded from an in-memory buffer. + * + * Routes @p fileData through the first registered IPluginPreview that + * supports @p fileName's extension and archives. Used by plugins that have + * already extracted a blob from a container (e.g. preview_bsa) and want to + * hand it off to another preview plugin (e.g. preview_nif) without writing + * it to a temp file. + * + * @param parent parent for the modal preview dialog + * @param fileName virtual filename; used for extension dispatch and as the + * dialog title + * @param fileData raw file bytes + * @return true if a preview plugin was found and the dialog was shown; + * false otherwise (no suitable plugin / empty data). + */ + virtual bool previewFileData(QWidget* parent, const QString& fileName, + const QByteArray& fileData) = 0; + /** * @brief runs a program using the virtual filesystem * -- cgit v1.3.1