From 66194a447e6c1d4afbd0c40d4d22e06b9ccb0432 Mon Sep 17 00:00:00 2001 From: w3irDv <170813473+w3irDv@users.noreply.github.com> Date: Sat, 8 Jun 2024 20:16:51 +0200 Subject: [PATCH] avoid black banners due to filepath size limit --- source/Channels/channels.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/source/Channels/channels.cpp b/source/Channels/channels.cpp index c498ef83..04aa3d88 100755 --- a/source/Channels/channels.cpp +++ b/source/Channels/channels.cpp @@ -707,13 +707,22 @@ u8 *Channels::GetOpeningBnr(const u64 &title, u32 *outsize, const char *pathPref u32 high = TITLE_UPPER(title); u32 low = TITLE_LOWER(title); + + // avoid black banners - add path prefix length to ISFS_MAXPATH when loading from emuNAND + int customMaxPath; + if (pathPrefix && *pathPrefix != 0) + customMaxPath = ISFS_MAXPATH + strlen(pathPrefix); + else + customMaxPath = ISFS_MAXPATH; + + // avoid black banners - we don't change filepath definition, it was already of this size for both cases... char *filepath = (char *)memalign(32, ISFS_MAXPATH + strlen(pathPrefix)); if (!filepath) return NULL; do { - snprintf(filepath, ISFS_MAXPATH, "%s/title/%08x/%08x/content/title.tmd", pathPrefix, (unsigned int)high, (unsigned int)low); + snprintf(filepath, customMaxPath, "%s/title/%08x/%08x/content/title.tmd", pathPrefix, (unsigned int)high, (unsigned int)low); u8 *buffer = NULL; u32 filesize = 0; @@ -748,7 +757,7 @@ u8 *Channels::GetOpeningBnr(const u64 &title, u32 *outsize, const char *pathPref if (!found) break; - snprintf(filepath, ISFS_MAXPATH, "%s/title/%08x/%08x/content/%08x.app", pathPrefix, (unsigned int)high, (unsigned int)low, (unsigned int)bootcontent); + snprintf(filepath, customMaxPath, "%s/title/%08x/%08x/content/%08x.app", pathPrefix, (unsigned int)high, (unsigned int)low, (unsigned int)bootcontent); if (pathPrefix && *pathPrefix != 0) ret = LoadFileToMem(filepath, &buffer, &filesize);