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); diff --git a/source/menu/GameBrowseMenu.cpp b/source/menu/GameBrowseMenu.cpp index 6a02a77b..9f849a1c 100644 --- a/source/menu/GameBrowseMenu.cpp +++ b/source/menu/GameBrowseMenu.cpp @@ -40,6 +40,7 @@ #include "sys.h" struct discHdr *dvdheader = NULL; +bool allowUsedSpaceTxtUpdate; GameBrowseMenu::GameBrowseMenu() : GuiWindow(screenwidth, screenheight) @@ -525,6 +526,7 @@ int GameBrowseMenu::Execute() GameBrowseMenu * Menu = new GameBrowseMenu(); mainWindow->Append(Menu); + allowUsedSpaceTxtUpdate = true; if(Settings.ShowFreeSpace) { ThreadedTask::Instance()->AddCallback(&Menu->HDDSizeCallback); @@ -543,6 +545,8 @@ int GameBrowseMenu::Execute() retMenu = Menu->MainLoop(); } + // to avoid that the async thread updates usedSpaceText after menu deletion + allowUsedSpaceTxtUpdate = false; delete Menu; return retMenu; @@ -1689,10 +1693,15 @@ void GameBrowseMenu::UpdateCallback(void * e) void GameBrowseMenu::SetFreeSpace(float freespace, float used) { - if (strcmp(Settings.db_language, "JA") == 0) - usedSpaceTxt->SetText(fmt("%.2fGB %s %.2fGB %s", freespace + used, tr( "of" ), freespace, tr( "free" ))); + + if (strcmp(Settings.db_language, "JA") == 0) { + if ( allowUsedSpaceTxtUpdate == true ) + usedSpaceTxt->SetText(fmt("%.2fGB %s %.2fGB %s", freespace + used, tr( "of" ), freespace, tr( "free" ))); + } else - usedSpaceTxt->SetText(fmt("%.2fGB %s %.2fGB %s", freespace, tr( "of" ), freespace + used, tr( "free" ))); + if ( allowUsedSpaceTxtUpdate == true ) + usedSpaceTxt->SetText(fmt("%.2fGB %s %.2fGB %s", freespace, tr( "of" ), freespace + used, tr( "free" ))); + } void GameBrowseMenu::UpdateFreeSpace(void * arg) @@ -1700,7 +1709,8 @@ void GameBrowseMenu::UpdateFreeSpace(void * arg) if (Settings.ShowFreeSpace) { float freespace = 0.0, used = 0.0; - usedSpaceTxt->SetVisible(true); + if ( allowUsedSpaceTxtUpdate == true ) + usedSpaceTxt->SetVisible(true); int ret = WBFS_DiskSpace(&used, &freespace); if (ret >= 0) SetFreeSpace(freespace, used); diff --git a/source/settings/CSettings.cpp b/source/settings/CSettings.cpp index cde66efe..4facb429 100644 --- a/source/settings/CSettings.cpp +++ b/source/settings/CSettings.cpp @@ -79,7 +79,7 @@ void CSettings::SetDefault() strlcpy(GameCubePath, "usb1:/games/", sizeof(GameCubePath)); strlcpy(GameCubeSDPath, "sd:/games/", sizeof(GameCubeSDPath)); strlcpy(CustomAddress, "wiimmfi.de", sizeof(CustomAddress)); - strlcpy(URL_Banners, "https://banner.rc24.xyz/", sizeof(URL_Banners)); + strlcpy(URL_Banners, "http://banner.rc24.xyz/", sizeof(URL_Banners)); strlcpy(URL_Covers2D, "https://art.gametdb.com/wii/cover/", sizeof(URL_Covers2D)); strlcpy(URL_Covers3D, "https://art.gametdb.com/wii/cover3D/", sizeof(URL_Covers3D)); strlcpy(URL_CoversFull, "https://art.gametdb.com/wii/coverfull/", sizeof(URL_CoversFull)); diff --git a/source/wad/wad.cpp b/source/wad/wad.cpp index 06a1ed96..19c7ba81 100644 --- a/source/wad/wad.cpp +++ b/source/wad/wad.cpp @@ -322,13 +322,14 @@ bool Wad::InstallContents(const char *installpath) // Install content if(content->type == 0x8001) { // shared content - int result = CheckContentMap(installpath, content, filepath); + int result = CheckContentMap(installpath, content, filepath); if(result == 1) // exists already, skip file continue; else if(result < 0) // failure return false; // else it does not exist...install it + snprintf(filepath, sizeof(filepath), "%s/shared1/%08x.app", installpath, (unsigned int)content_map_size); } else { // private content @@ -419,6 +420,16 @@ bool Wad::InstallContents(const char *installpath) ShowError(tr("File read/write error.")); return false; } + + if(content->type == 0x8001) { + // shared content installed ok. It's time to update content.map + int result = UpdateContentMap(installpath, content, filepath); + if(result == 1) // exists already, skip file + continue; + + else if(result < 0) // failure + return false; + } } return true; @@ -448,6 +459,16 @@ int Wad::CheckContentMap(const char *installpath, tmd_content *content, char *fi return 1; // content exists already } + // Content does not exists + return 0; +} + +int Wad::UpdateContentMap(const char *installpath, tmd_content *content, char *filepath) +{ + int result = CheckContentMap(installpath,content,filepath); + if ( result != 0 ) + return result; // content already exists or error + // Content does not exists, append it. u32 next_entry = content_map_size; u8 *tmp = (u8 *) realloc(content_map, (next_entry + 1) * sizeof(map_entry_t)); @@ -461,7 +482,7 @@ int Wad::CheckContentMap(const char *installpath, tmd_content *content, char *fi content_map = tmp; content_map_size++; - map = (map_entry_t *) content_map; + map_entry_t *map = (map_entry_t *) content_map; char name[9]; sprintf(name, "%08x", (unsigned int)next_entry); memcpy(map[next_entry].name, name, 8); @@ -472,8 +493,6 @@ int Wad::CheckContentMap(const char *installpath, tmd_content *content, char *fi if(!WriteFile(filepath, content_map, content_map_size * sizeof(map_entry_t))) return -1; - snprintf(filepath, 1024, "%s/shared1/%08x.app", installpath, (unsigned int)next_entry); - return 0; } diff --git a/source/wad/wad.h b/source/wad/wad.h index dab23006..740efa51 100644 --- a/source/wad/wad.h +++ b/source/wad/wad.h @@ -49,6 +49,7 @@ class Wad private: bool InstallContents(const char *installpath); int CheckContentMap(const char *installpath, tmd_content *content, char *filepath); + int UpdateContentMap(const char *installpath, tmd_content *content, char *filepath); bool WriteFile(const char *filepath, u8 *buffer, u32 len); bool SetTitleUID(const char *intallpath, const u64 &tid);