diff --git a/Makefile.main b/Makefile.main index 5f3b641d..4f514cb7 100644 --- a/Makefile.main +++ b/Makefile.main @@ -22,7 +22,6 @@ SOURCES := source \ source/channel \ source/cheats \ source/config \ - source/data \ source/devicemounter \ source/fileOps \ source/gc \ @@ -40,7 +39,6 @@ SOURCES := source \ source/plugin \ source/sicksaxis-wrapper \ source/unzip \ - source/xml \ source/wstringEx DATA := data \ data/images \ @@ -55,7 +53,7 @@ ios := 249 #--------------------------------------------------------------------------------- # options for code generation #--------------------------------------------------------------------------------- -CFLAGS = -g -ggdb -Os -Wall -Wextra $(MACHDEP) $(INCLUDE) -D_GNU_SOURCE -DHAVE_CONFIG_H +CFLAGS = -g -ggdb -O2 -Wall -Wextra $(MACHDEP) $(INCLUDE) -D_GNU_SOURCE -DHAVE_CONFIG_H CXXFLAGS = $(CFLAGS) LDFLAGS = -g -ggdb $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80620000,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,wiiuse_register @@ -129,8 +127,7 @@ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ #--------------------------------------------------------------------------------- # build a list of library paths #--------------------------------------------------------------------------------- -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) -L$(CURDIR)/source/libs/libfat/ \ - -L$(CURDIR)/source/libs/libntfs/ -L$(CURDIR)/source/libs/libext2fs/ \ +export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ -L$(CURDIR)/source/libwolfssl/ -L$(LIBOGC_LIB) -L$(PORTLIBS)/lib export OUTPUT := $(CURDIR)/out/$(TARGET) diff --git a/out/bins/ext_booter.bin b/out/bins/ext_booter.bin index 33cb07b3..e8fae4ea 100644 Binary files a/out/bins/ext_booter.bin and b/out/bins/ext_booter.bin differ diff --git a/out/boot.dol b/out/boot.dol index 78cf1d11..7566a8a9 100644 Binary files a/out/boot.dol and b/out/boot.dol differ diff --git a/resources/wiiflow_game_booter/source/ChannelHandler.cpp b/resources/wiiflow_game_booter/source/ChannelHandler.cpp index c30756af..63b1e0ea 100644 --- a/resources/wiiflow_game_booter/source/ChannelHandler.cpp +++ b/resources/wiiflow_game_booter/source/ChannelHandler.cpp @@ -53,8 +53,7 @@ char filepath[ISFS_MAXPATH] ATTRIBUTE_ALIGN(32); static u8 *GetDol(u32 bootcontent, u64 title) { - memset(filepath, 0, ISFS_MAXPATH); - sprintf(filepath, "/title/%08lx/%08lx/content/%08lx.app", TITLE_UPPER(title), TITLE_LOWER(title), bootcontent); + snprintf(filepath, ISFS_MAXPATH, "/title/%08lx/%08lx/content/%08lx.app", TITLE_UPPER(title), TITLE_LOWER(title), bootcontent); u32 contentSize = 0; @@ -82,8 +81,7 @@ static bool GetAppNameFromTmd(bool dol, u32 *bootcontent, u64 title, u32 *IOS) { bool ret = false; - memset(filepath, 0, ISFS_MAXPATH); - sprintf(filepath, "/title/%08lx/%08lx/content/title.tmd", TITLE_UPPER(title), TITLE_LOWER(title)); + snprintf(filepath, ISFS_MAXPATH, "/title/%08lx/%08lx/content/title.tmd", TITLE_UPPER(title), TITLE_LOWER(title)); u32 size; u8 *data = ISFS_GetFile(filepath, &size, -1); diff --git a/source/channel/channel_launcher.cpp b/source/channel/channel_launcher.cpp index 7d9936d9..7533a4d0 100644 --- a/source/channel/channel_launcher.cpp +++ b/source/channel/channel_launcher.cpp @@ -40,10 +40,9 @@ bool Identify_GenerateTik(signed_blob **outbuf, u32 *outlen) bool Identify(u64 titleid) { char filepath[ISFS_MAXPATH] ATTRIBUTE_ALIGN(32); - memset(filepath, 0, ISFS_MAXPATH); gprintf("Reading TMD for %08lx %08lx...", TITLE_UPPER(titleid), TITLE_LOWER(titleid)); - sprintf(filepath, "/title/%08lx/%08lx/content/title.tmd", TITLE_UPPER(titleid), TITLE_LOWER(titleid)); + snprintf(filepath, ISFS_MAXPATH, "/title/%08lx/%08lx/content/title.tmd", TITLE_UPPER(titleid), TITLE_LOWER(titleid)); u32 tmdSize; u8 *tmdBuffer = ISFS_GetFile(filepath, &tmdSize, -1); if (tmdBuffer == NULL || tmdSize == 0) diff --git a/source/channel/channels.cpp b/source/channel/channels.cpp index b465c0dc..ed5d1280 100644 --- a/source/channel/channels.cpp +++ b/source/channel/channels.cpp @@ -74,7 +74,7 @@ u8 Channels::GetRequestedIOS(u64 title) else { char tmd[ISFS_MAXPATH] ATTRIBUTE_ALIGN(32); - strncpy(tmd, fmt("/title/%08x/%08x/content/title.tmd", TITLE_UPPER(title), TITLE_LOWER(title)), ISFS_MAXPATH); + snprintf(tmd, ISFS_MAXPATH, "/title/%08lx/%08lx/content/title.tmd", TITLE_UPPER(title), TITLE_LOWER(title)); titleTMD = ISFS_GetFile(tmd, &size, -1); } if(titleTMD == NULL) @@ -118,7 +118,7 @@ bool Channels::GetAppNameFromTmd(u64 title, char *app, u32 *bootcontent) else { char tmd[ISFS_MAXPATH] ATTRIBUTE_ALIGN(32); - strncpy(tmd, fmt("/title/%08x/%08x/content/title.tmd", TITLE_UPPER(title), TITLE_LOWER(title)), ISFS_MAXPATH); + snprintf(tmd, ISFS_MAXPATH, "/title/%08lx/%08lx/content/title.tmd", TITLE_UPPER(title), TITLE_LOWER(title)); data = ISFS_GetFile(tmd, &size, -1); } if(data == NULL || size < 0x208) @@ -134,8 +134,7 @@ bool Channels::GetAppNameFromTmd(u64 title, char *app, u32 *bootcontent) if(tmd_file->contents[i].index == 0) { *bootcontent = tmd_file->contents[i].cid; - strncpy(app, fmt("/title/%08x/%08x/content/%08x.app", - TITLE_UPPER(title), TITLE_LOWER(title), *bootcontent), ISFS_MAXPATH); + snprintf(app, ISFS_MAXPATH, "/title/%08lx/%08lx/content/%08lx.app", TITLE_UPPER(title), TITLE_LOWER(title), *bootcontent); ret = true; break; } diff --git a/source/channel/nand.cpp b/source/channel/nand.cpp index 7bb954b1..61cca9a6 100644 --- a/source/channel/nand.cpp +++ b/source/channel/nand.cpp @@ -486,16 +486,14 @@ u32 Nand::__configsetsetting(const char *item, const char *val) if(strlen(val) > len) { static char buffer[0x100]; - u32 nlen; - nlen = txtbuffer-(curstrt+strlen(val)); - strcpy( buffer, txtbuffer+nlen ); - strncpy( curstrt, val, strlen(val)); + strcpy( buffer, curend ); + memcpy( curstrt, val, strlen(val)); curstrt += strlen(val); - strncpy(curstrt, buffer, strlen(buffer)); + memcpy(curstrt, buffer, strlen(buffer)); } else { - strncpy(curstrt, val, strlen(val)); + memcpy(curstrt, val, strlen(val)); } __configshifttxt(txtbuffer); diff --git a/source/defines.h b/source/defines.h index ffa61137..2118b61c 100644 --- a/source/defines.h +++ b/source/defines.h @@ -52,5 +52,5 @@ uLoader, NeoGamma, Mighty Channels, WiiXplorer, Triiforce, \ postLoader" -#define WIINNERTAG_URL "http://www.wiinnertag.com/wiinnertag_scripts/update_sign.php?key={KEY}&game_id={ID6}" +#define WIINNERTAG_URL "http://tag.rc24.xyz/wii?game={ID6}&key={KEY}"// RiiTag as of 3/11/2020 #define DUTAG_URL "http://tag.darkumbra.net/{KEY}.update={ID6}" diff --git a/source/devicemounter/DeviceHandler.cpp b/source/devicemounter/DeviceHandler.cpp index f22c6654..adeafcd1 100644 --- a/source/devicemounter/DeviceHandler.cpp +++ b/source/devicemounter/DeviceHandler.cpp @@ -112,7 +112,7 @@ void DeviceHandler::SetModes() usb_libogc_mode = 0; /* But not for SD */ if(CurrentIOS.Type != IOS_TYPE_NEEK2O) - sdhc_mode_sd = 1;// don't use cIOS for SD + sdhc_mode_sd = 0;// don't use cIOS for SD } } diff --git a/source/devicemounter/PartitionHandle.cpp b/source/devicemounter/PartitionHandle.cpp index 5e9c899a..e49d5be8 100644 --- a/source/devicemounter/PartitionHandle.cpp +++ b/source/devicemounter/PartitionHandle.cpp @@ -202,12 +202,12 @@ bool PartitionHandle::Mount(int pos, const char *name, bool forceFAT) void PartitionHandle::UnMount(int pos) { - if(!interface || (pos >= (int)MountNameList.size()) || (MountNameList[pos].size() == 0)) + if(!interface || (pos < 0 || pos >= (int)MountNameList.size()) || (MountNameList[pos].size() == 0)) return; WBFS_Close(); char DeviceSyn[10]; - memcpy(DeviceSyn, MountName(pos), 8); + strcpy(DeviceSyn, MountName(pos)); strcat(DeviceSyn, ":"); DeviceSyn[9] = '\0'; diff --git a/source/gc/gc.cpp b/source/gc/gc.cpp index 6ac38d68..b58a271d 100644 --- a/source/gc/gc.cpp +++ b/source/gc/gc.cpp @@ -184,8 +184,8 @@ void Nintendont_SetOptions(const char *gamePath, const char *gameID, const char snprintf(NinCfg.CheatPath, sizeof(NinCfg.CheatPath), strchr(CheatPath, '/')); /* GamePath Setup */ - if(strcmp(gamePath, "di") == 0)// should check for length of gamePath =2 - strncpy(NinCfg.GamePath, gamePath, sizeof(NinCfg.GamePath)); + if(strlen(gamePath) == 2 && strcmp(gamePath, "di") == 0) + strcpy(NinCfg.GamePath, gamePath); else { strncpy(NinCfg.GamePath, strchr(gamePath, '/'), 254); diff --git a/source/gc/gcdisc.cpp b/source/gc/gcdisc.cpp index 9d2c0cb6..de1f665f 100644 --- a/source/gc/gcdisc.cpp +++ b/source/gc/gcdisc.cpp @@ -29,7 +29,7 @@ GC_Disc GC_Disc_Reader; void GC_Disc::init(const char *path) { - strncpy(GamePath, path, MAX_FAT_PATH); + strcpy(GamePath, path); opening_bnr = NULL; FSTable = NULL; diff --git a/source/gui/fanart.cpp b/source/gui/fanart.cpp index 833b57a9..b50231ff 100644 --- a/source/gui/fanart.cpp +++ b/source/gui/fanart.cpp @@ -44,7 +44,7 @@ bool CFanart::load(Config &m_wiiflowConfig, const char *path, const dir_discHdr if(strrchr(hdr->path, '/') != NULL) wcstombs(id, hdr->title, sizeof(id) - 1); else - strncpy(id, hdr->path, sizeof(id) - 1);// scummvm + strcpy(id, hdr->path);// scummvm } else strcpy(id, hdr->id); diff --git a/source/gui/video.cpp b/source/gui/video.cpp index 5deffed8..71411d4f 100644 --- a/source/gui/video.cpp +++ b/source/gui/video.cpp @@ -272,7 +272,7 @@ void CVideo::setup2DProjection(bool setViewPort, bool noScale) if (setViewPort) _setViewPort(0, 0, m_rmode->fbWidth, m_rmode->efbHeight); - guOrtho(projMtx, y, height2D - 1 + y, x, width2D - 1 + x, 0.f, 1000.0f); + guOrtho(projMtx, y, height2D + y, x, width2D + x, 0.f, 1000.0f); GX_LoadProjectionMtx(projMtx, GX_ORTHOGRAPHIC); } diff --git a/source/list/ListGenerator.cpp b/source/list/ListGenerator.cpp index c58acec4..0ce24523 100644 --- a/source/list/ListGenerator.cpp +++ b/source/list/ListGenerator.cpp @@ -356,7 +356,7 @@ void ListGenerator::ParseScummvmINI(Config &ini, const char *Device, const char memset((void*)&ListElement, 0, sizeof(dir_discHdr)); memcpy(ListElement.id, GameID.c_str(), 6); mbstowcs(ListElement.title, GameName, 63); - strncpy(ListElement.path, GameDomain, sizeof(ListElement.path)); + strcpy(ListElement.path, GameDomain); ListElement.settings[0] = m_cacheList.Magic; //scummvm magic ListElement.casecolor = m_cacheList.Color; ListElement.type = TYPE_PLUGIN; diff --git a/source/loader/cios.c b/source/loader/cios.c index e011213b..65b6cd57 100644 --- a/source/loader/cios.c +++ b/source/loader/cios.c @@ -70,7 +70,7 @@ iosinfo_t *IOS_GetInfo(u8 ios) if(TMD == NULL) return NULL; char filepath[ISFS_MAXPATH] ATTRIBUTE_ALIGN(32); - sprintf(filepath, "/title/00000001/%08x/content/%08x.app", ios, *(u8 *)((u32)TMD+0x1E7)); + snprintf(filepath, ISFS_MAXPATH, "/title/00000001/%08x/content/%08x.app", ios, *(u8 *)((u32)TMD+0x1E7)); MEM2_free(TMD); u32 size = 0; diff --git a/source/loader/gc_disc_dump.cpp b/source/loader/gc_disc_dump.cpp index b1f7f81c..e9cb3ef7 100644 --- a/source/loader/gc_disc_dump.cpp +++ b/source/loader/gc_disc_dump.cpp @@ -296,7 +296,7 @@ s32 GCDump::DumpGame() memset(gamepath, 0, sizeof(gamepath)); char basedir[MAX_FAT_PATH]; memset(basedir, 0, sizeof(basedir)); - strncpy(basedir, fmt(gc_gamesDir, gamepartition), MAX_FAT_PATH); + strcpy(basedir, fmt(gc_gamesDir, gamepartition)); while(!gamedone) { diff --git a/source/loader/wbfs_ext.c b/source/loader/wbfs_ext.c index df2d859d..2b5f8e7a 100644 --- a/source/loader/wbfs_ext.c +++ b/source/loader/wbfs_ext.c @@ -39,7 +39,7 @@ struct statvfs wbfs_ext_vfs; #define STRCOPY(DEST,SRC) strcopy(DEST,SRC,sizeof(DEST)) char* strcopy(char *dest, const char *src, int size) { - strncpy(dest,src,size); + memcpy(dest,src,size); dest[size-1] = 0; return dest; } @@ -187,13 +187,13 @@ s32 WBFS_Ext_AddGame(progress_callback_t spinner, void *spinner_data) asprintf(&cleantitle, header.title); for(cp = strpbrk(cleantitle, illegal); cp; cp = strpbrk(cp, illegal)) *cp = '_'; - strncpy(folder, fmt(wii_games_dir, wbfs_fs_drive), sizeof(folder)); + memcpy(folder, fmt(wii_games_dir, wbfs_fs_drive), sizeof(folder)); fsop_MakeFolder(folder); - strncpy(folder, fmt("%s/%s [%s]", folder, cleantitle, header.id), sizeof(folder)); + memcpy(folder, fmt("%s/%s [%s]", folder, cleantitle, header.id), sizeof(folder)); fsop_MakeFolder(folder); free(cleantitle); - strncpy(gamepath, fmt("%s/%s.wbfs", folder, header.id), sizeof(gamepath)); + memcpy(gamepath, fmt("%s/%s.wbfs", folder, header.id), sizeof(gamepath)); u64 size = (u64)143432*2*0x8000ULL; u32 n_sector = size / 512; diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index d675129e..8f8757fc 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -161,6 +161,27 @@ bool CMenu::init(bool usb_mounted) /* Check if we want SD Gecko */ m_use_sd_logging = m_cfg.getBool("DEBUG", "sd_write_log", false); LogToSD_SetBuffer(m_use_sd_logging); + /* Init gamer tags now in case we need to init network on boot */ + m_cfg.setString("GAMERCARD", "gamercards", "wiinnertag"); + m_cfg.getString("GAMERCARD", "wiinnertag_url", WIINNERTAG_URL); + m_cfg.getString("GAMERCARD", "wiinnertag_key", ""); + if (m_cfg.getBool("GAMERCARD", "gamercards_enable", false)) + { + vector gamercards = stringToVector(m_cfg.getString("GAMERCARD", "gamercards"), '|'); + if (gamercards.size() == 0) + { + gamercards.push_back("wiinnertag"); + } + + for (vector::iterator itr = gamercards.begin(); itr != gamercards.end(); itr++) + { + gprintf("Found gamercard provider: %s\n",(*itr).c_str()); + register_card_provider( + m_cfg.getString("GAMERCARD", fmt("%s_url", (*itr).c_str())).c_str(), + m_cfg.getString("GAMERCARD", fmt("%s_key", (*itr).c_str())).c_str() + ); + } + } /* Init Network if wanted */ m_init_network = (has_enabled_providers() || m_use_wifi_gecko); _netInit(); @@ -429,30 +450,6 @@ bool CMenu::init(bool usb_mounted) m_bnrSndVol = m_cfg.getInt("GENERAL", "sound_volume_bnr", 255); m_bnr_settings = m_cfg.getBool("GENERAL", "banner_in_settings", true); - /* Init gamer tags */ - m_cfg.setString("GAMERCARD", "gamercards", "wiinnertag|dutag"); - m_cfg.getString("GAMERCARD", "wiinnertag_url", WIINNERTAG_URL); - m_cfg.getString("GAMERCARD", "wiinnertag_key", ""); - m_cfg.getString("GAMERCARD", "dutag_url", DUTAG_URL); - m_cfg.getString("GAMERCARD", "dutag_key", ""); - if (m_cfg.getBool("GAMERCARD", "gamercards_enable", false)) - { - vector gamercards = stringToVector(m_cfg.getString("GAMERCARD", "gamercards"), '|'); - if (gamercards.size() == 0) - { - gamercards.push_back("wiinnertag"); - gamercards.push_back("dutag"); - } - - for (vector::iterator itr = gamercards.begin(); itr != gamercards.end(); itr++) - { - gprintf("Found gamercard provider: %s\n",(*itr).c_str()); - register_card_provider( - m_cfg.getString("GAMERCARD", fmt("%s_url", (*itr).c_str())).c_str(), - m_cfg.getString("GAMERCARD", fmt("%s_key", (*itr).c_str())).c_str() - ); - } - } return true; } diff --git a/source/menu/menu_categories.cpp b/source/menu/menu_categories.cpp index 939808ee..e0fed060 100644 --- a/source/menu/menu_categories.cpp +++ b/source/menu/menu_categories.cpp @@ -168,7 +168,7 @@ void CMenu::_getGameCategories(void) if(strrchr(hdr->path, '/') != NULL) wcstombs(id, hdr->title, sizeof(id) - 1); else - strncpy(id, hdr->path, sizeof(id) - 1);// scummvm + strcpy(id, hdr->path);// scummvm } else strcpy(id, hdr->id); diff --git a/source/menu/menu_download.cpp b/source/menu/menu_download.cpp index d59eaa68..de2ee393 100644 --- a/source/menu/menu_download.cpp +++ b/source/menu/menu_download.cpp @@ -752,6 +752,9 @@ s32 CMenu::_networkComplete(s32 ok, void *usrData) networkInit = ok == 0; m->m_thrdNetwork = false; + + if(networkInit) + wolfSSL_Init(); gprintf("NET: Network init complete, enabled wifi_gecko: %s\n", m->m_use_wifi_gecko ? "yes" : "no"); if(m->m_use_wifi_gecko) diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index a8ea9dbc..ff7d0c7d 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -404,7 +404,7 @@ void CMenu::_game(bool launch) if(strrchr(hdr->path, '/') != NULL) wcstombs(catID, hdr->title, 63); else - strncpy(catID, hdr->path, 63);// scummvm + strcpy(catID, hdr->path);// scummvm strcpy(id, m_plugin.PluginMagicWord); strcat(id, fmt("/%s", catID)); } @@ -782,7 +782,7 @@ void CMenu::_game(bool launch) if(strrchr(hdr->path, '/') != NULL) wcstombs(catID, hdr->title, 63); else - strncpy(catID, hdr->path, 63);// scummvm + strcpy(catID, hdr->path);// scummvm strcpy(id, m_plugin.PluginMagicWord); strcat(id, fmt("/%s", catID)); } @@ -1131,7 +1131,7 @@ void * CMenu::_gameSoundThread(void *obj) strncpy(m_plugin.PluginMagicWord, fmt("%08x", GameHdr->settings[0]), 8); snprintf(platformName, sizeof(platformName), "%s", m->m_platform.getString("PLUGINS", m_plugin.PluginMagicWord).c_str()); - strncpy(GameID, GameHdr->id, 6); + strcpy(GameID, GameHdr->id); if(strlen(platformName) != 0 && strcasecmp(GameID, "PLUGIN") != 0) { diff --git a/source/menu/menu_game_boot.cpp b/source/menu/menu_game_boot.cpp index 19eb865a..9f820877 100644 --- a/source/menu/menu_game_boot.cpp +++ b/source/menu/menu_game_boot.cpp @@ -322,18 +322,18 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) /* Set game path */ char path[256]; if(disc) - snprintf(path, sizeof(path), "%s", "di"); + strcpy(path, "di"); else - snprintf(path, sizeof(path), "%s", hdr->path); + strcpy(path, hdr->path); + path[255] = '\0'; if(loader == NINTENDONT && !disc)// Check if game has multi Discs { char disc2Path[256]; + strcpy(disc2Path, path); disc2Path[255] = '\0'; - strncpy(disc2Path, path, sizeof(disc2Path) - 1); - char *pathPtr = strrchr(disc2Path, '/'); - if(pathPtr) *pathPtr = 0; - strncpy(disc2Path, fmt("%s/disc2.iso", disc2Path), sizeof(disc2Path) - 1); + *strrchr(disc2Path, '/') = '\0'; + strcat(disc2Path, "/disc2.iso"); // note fst extracted /boot.bin paths will not have disc2.iso if(fsop_FileExist(disc2Path)) { @@ -465,12 +465,15 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) n_config |= NIN_CFG_CHEAT_PATH; n_config |= NIN_CFG_CHEATS; - /* Generate Game Cheat path - usb1:/games/title [id]/ */ - char GC_Path[256]; - GC_Path[255] = '\0'; - if(!disc) + //use wiiflow cheat folder if is a disc or is on same partition as game folder + if(disc || strncasecmp(m_cheatDir.c_str(), DeviceName[currentPartition], strlen(DeviceName[currentPartition])) == 0) + snprintf(CheatPath, sizeof(CheatPath), "%s/%s", m_cheatDir.c_str(), fmt("%s.gct", id)); + else { - strncpy(GC_Path, path, 255); + /* Generate Game Cheat path - usb1:/games/title [id]/ */ + char GC_Path[256]; + strcpy(GC_Path, path); + GC_Path[255] = '\0'; if(strcasestr(path, "boot.bin") != NULL)//usb1:/games/title [id]/sys/boot.bin { *strrchr(GC_Path, '/') = '\0'; //erase /boot.bin @@ -478,14 +481,8 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) } else //usb1:/games/title [id]/game.iso *(strrchr(GC_Path, '/')+1) = '\0'; //erase game.iso - } - //use wiiflow cheat folder if is a disc or is on same partition as game folder - if(disc || strncasecmp(m_cheatDir.c_str(), DeviceName[currentPartition], strlen(DeviceName[currentPartition])) == 0) - snprintf(CheatPath, sizeof(CheatPath), "%s/%s", m_cheatDir.c_str(), fmt("%s.gct", id)); - else - { - // otherwise copy cheat file from wiiflow cheat folder to Game folder + // copy cheat file from wiiflow cheat folder to Game folder char GC_game_dir[strlen(GC_Path) + 11]; snprintf(GC_game_dir, sizeof(GC_game_dir), "%s%s.gct", GC_Path, id); fsop_CopyFile(fmt("%s/%s.gct", m_cheatDir.c_str(), id), GC_game_dir, NULL, NULL); diff --git a/source/menu/menu_gameinfo.cpp b/source/menu/menu_gameinfo.cpp index 2bd77206..b4fa02a2 100644 --- a/source/menu/menu_gameinfo.cpp +++ b/source/menu/menu_gameinfo.cpp @@ -388,7 +388,7 @@ void CMenu::_textGameInfo(void) /* Search platform.ini to find plugin magic to get platformName */ strncpy(m_plugin.PluginMagicWord, fmt("%08x", GameHdr->settings[0]), 8); snprintf(platformName, sizeof(platformName), "%s", m_platform.getString("PLUGINS", m_plugin.PluginMagicWord).c_str()); - strncpy(GameID, GameHdr->id, 6); + strcpy(GameID, GameHdr->id); if(strlen(platformName) == 0 || strcasecmp(GameID, "PLUGIN") == 0) return;// no platform name found to match plugin magic # diff --git a/source/menu/menu_home.cpp b/source/menu/menu_home.cpp index f4956217..468b5282 100644 --- a/source/menu/menu_home.cpp +++ b/source/menu/menu_home.cpp @@ -471,7 +471,7 @@ int CMenu::_cacheCovers() CoverFlow.stopCoverLoader(true); bool m_pluginCacheFolders = m_cfg.getBool(PLUGIN_DOMAIN, "subfolder_cache", true); - char coverPath[MAX_FAT_PATH]; + char coverPath[MAX_FAT_PATH];//1024 char wfcPath[MAX_FAT_PATH+20]; char cachePath[MAX_FAT_PATH]; @@ -502,14 +502,17 @@ int CMenu::_cacheCovers() bool blankCover = false; bool fullCover = true; strlcpy(coverPath, getBoxPath(&(*hdr)), sizeof(coverPath)); + //gprintf("boxpath=%s\n", coverPath); if(!fsop_FileExist(coverPath) || smallBox) { fullCover = false; strlcpy(coverPath, getFrontPath(&(*hdr)), sizeof(coverPath)); + //gprintf("frontpath=%s\n", coverPath); if(!fsop_FileExist(coverPath) && !smallBox) { fullCover = true; strlcpy(coverPath, getBlankCoverPath(&(*hdr)), sizeof(coverPath)); + //gprintf("blankpath=%s\n", coverPath); blankCover = true; if(!fsop_FileExist(coverPath)) continue; @@ -525,6 +528,7 @@ int CMenu::_cacheCovers() snprintf(cachePath, sizeof(cachePath), "%s/homebrew", m_cacheDir.c_str()); else snprintf(cachePath, sizeof(cachePath), "%s", m_cacheDir.c_str()); + //gprintf("cachepath=%s\n", cachePath); /* get game name or ID */ const char *gameNameOrID = NULL; @@ -532,12 +536,14 @@ int CMenu::_cacheCovers() gameNameOrID = CoverFlow.getFilenameId(&(*hdr));// &(*hdr) converts iterator to pointer to mem address else gameNameOrID = strrchr(coverPath, '/') + 1; + //gprintf("nameorid=%s\n", gameNameOrID); /* get cover wfc path */ if(smallBox) snprintf(wfcPath, sizeof(wfcPath), "%s/%s_small.wfc", cachePath, gameNameOrID); else snprintf(wfcPath, sizeof(wfcPath), "%s/%s.wfc", cachePath, gameNameOrID); + //gprintf("wfcpath=%s\n", wfcPath); /* if wfc doesn't exist or is flat and have full cover */ if(!fsop_FileExist(wfcPath) || (!CoverFlow.fullCoverCached(wfcPath) && fullCover)) diff --git a/source/menu/menu_main.cpp b/source/menu/menu_main.cpp index fbb5b4c3..5ee86cbb 100644 --- a/source/menu/menu_main.cpp +++ b/source/menu/menu_main.cpp @@ -375,7 +375,7 @@ int CMenu::main(void) if(m_current_view & i) m_source_cnt++; - if(m_source_cnt == 0 || m_current_view == COVERFLOW_HOMEBREW) + if(m_source_cnt == 0) { m_current_view = COVERFLOW_WII; m_cfg.setUInt("GENERAL", "sources", m_current_view); @@ -521,6 +521,9 @@ int CMenu::main(void) m_current_view = show_homebrew ? COVERFLOW_HOMEBREW : COVERFLOW_WII; else if(m_current_view == COVERFLOW_HOMEBREW || m_source_cnt > 1) m_current_view = COVERFLOW_WII; + sm_numbers_backup = "0"; + sm_tiers_backup = SOURCE_FILENAME; + _restoreSrcTiers(); m_source_cnt = 1; m_cfg.setUInt("GENERAL", "sources", m_current_view); m_catStartPage = 1; diff --git a/source/menu/menu_paths.cpp b/source/menu/menu_paths.cpp index bbc8ef1f..258eeeea 100644 --- a/source/menu/menu_paths.cpp +++ b/source/menu/menu_paths.cpp @@ -188,12 +188,12 @@ void CMenu::_Paths(void) const char *partval = &path[3]; m_cfg.setInt(WII_DOMAIN, "partition", atoi(partval)); } - char tmpPath[MAX_FAT_PATH]; + char tmpPath[64]; strcpy(tmpPath, "%s"); strcat(tmpPath, strchr(path, ':')); + tmpPath[63] = '\0'; m_cfg.setString(WII_DOMAIN, "wii_games_dir", tmpPath); - memset(wii_games_dir, 0, 64); - strncpy(wii_games_dir, tmpPath, 63); + strcpy(wii_games_dir, tmpPath); m_cfg.setBool(WII_DOMAIN, "update_cache", true); if(m_current_view & COVERFLOW_WII) m_refreshGameList = true; @@ -216,12 +216,12 @@ void CMenu::_Paths(void) const char *partval = &path[3]; m_cfg.setInt(GC_DOMAIN, "partition", atoi(partval)); } - char tmpPath[MAX_FAT_PATH]; + char tmpPath[64]; strcpy(tmpPath, "%s"); strcat(tmpPath, strchr(path, ':')); + tmpPath[63] = '\0'; m_cfg.setString(GC_DOMAIN, "gc_games_dir", tmpPath); - memset(gc_games_dir, 0, 64); - strncpy(gc_games_dir, tmpPath, 63); + strcpy(gc_games_dir, tmpPath); m_cfg.setBool(GC_DOMAIN, "update_cache", true); if(m_current_view & COVERFLOW_GAMECUBE) m_refreshGameList = true; diff --git a/source/menu/menu_wbfs.cpp b/source/menu/menu_wbfs.cpp index 5c1b98be..fec4e1fc 100644 --- a/source/menu/menu_wbfs.cpp +++ b/source/menu/menu_wbfs.cpp @@ -183,7 +183,7 @@ int CMenu::_GCgameInstaller() } char partition[6]; - strncpy(partition, fmt("%s:/", DeviceName[currentPartition]), sizeof(partition)); + strcpy(partition, fmt("%s:/", DeviceName[currentPartition])); u32 needed = 0; diff --git a/source/network/gcard.c b/source/network/gcard.c index f60a72d5..f65b7468 100644 --- a/source/network/gcard.c +++ b/source/network/gcard.c @@ -6,12 +6,12 @@ #include "gecko/gecko.hpp" #include "memory/mem2.hpp" -#define MAX_URL_SIZE 178 // 128 + 48 + 6 +#define MAX_URL_SIZE 263 // 128 + 129 + 6 struct provider { char url[128]; - char key[48]; + char key[129]; }; struct provider *providers = NULL; @@ -23,8 +23,8 @@ u8 register_card_provider(const char *url, const char *key) { providers = (struct provider*)MEM2_realloc(providers, (amount_of_providers + 1) * sizeof(struct provider)); memset(&providers[amount_of_providers], 0, sizeof(struct provider)); - strncpy(providers[amount_of_providers].url, url, 128); - strncpy(providers[amount_of_providers].key, key, 48); + strncpy(providers[amount_of_providers].url, url, 127); + strncpy(providers[amount_of_providers].key, key, 128); amount_of_providers++; gprintf("Gamercard provider is valid!\n"); return 0; diff --git a/source/plugin/plugin.cpp b/source/plugin/plugin.cpp index 1673dd4f..eb6b55e7 100644 --- a/source/plugin/plugin.cpp +++ b/source/plugin/plugin.cpp @@ -633,7 +633,7 @@ string Plugin::GenerateCoverLink(dir_discHdr gameHeader, const string& constURL, char gamePath[256]; if(string(gameHeader.path).find_last_of("/") != string::npos) - strncpy(gamePath, &gameHeader.path[string(gameHeader.path).find_last_of("/")+1], sizeof(gamePath)); + strcpy(gamePath, &gameHeader.path[string(gameHeader.path).find_last_of("/")+1]); else strncpy(gamePath, gameHeader.path, sizeof(gamePath)); const string& cachedCRC = Checksums.getString("CHECKSUMS", gamePath);