diff --git a/source/gui/coverflow.cpp b/source/gui/coverflow.cpp index 82b575d6..474e7db8 100644 --- a/source/gui/coverflow.cpp +++ b/source/gui/coverflow.cpp @@ -2559,11 +2559,13 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq) if(NoGameID(m_items[i].hdr->type)) { if(string(m_items[i].hdr->path).find_last_of("/") != string::npos) - strncpy(gamePath, &m_items[i].hdr->path[string(m_items[i].hdr->path).find_last_of("/")], sizeof(gamePath)); + strncpy(gamePath, &m_items[i].hdr->path[string(m_items[i].hdr->path).find_last_of("/")+1], sizeof(gamePath)); else strncpy(gamePath, m_items[i].hdr->path, sizeof(gamePath)); } - FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), (NoGameID(m_items[i].hdr->type) ? gamePath : (char*)m_items[i].hdr->id)), "wb"); + else + strncpy(gamePath, m_items[i].hdr->id, sizeof(gamePath)); + FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), gamePath), "wb"); if (file != 0) { SWFCHeader header(tex, box, m_compressCache); @@ -2634,11 +2636,13 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq) if(NoGameID(m_items[i].hdr->type)) { if(string(m_items[i].hdr->path).find_last_of("/") != string::npos) - strncpy(gamePath, &m_items[i].hdr->path[string(m_items[i].hdr->path).find_last_of("/")], sizeof(gamePath)); + strncpy(gamePath, &m_items[i].hdr->path[string(m_items[i].hdr->path).find_last_of("/")+1], sizeof(gamePath)); else strncpy(gamePath, m_items[i].hdr->path, sizeof(gamePath)); } - FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), (NoGameID(m_items[i].hdr->type) ? gamePath : (char*)m_items[i].hdr->id)), "rb"); + else + strncpy(gamePath, m_items[i].hdr->id, sizeof(gamePath)); + FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), gamePath), "rb"); if(file != 0) { bool success = false; diff --git a/source/menu/menu_download.cpp b/source/menu/menu_download.cpp index dd6dfe01..cf75713d 100644 --- a/source/menu/menu_download.cpp +++ b/source/menu/menu_download.cpp @@ -511,7 +511,7 @@ int CMenu::_coverDownloader(bool missingOnly) { char gamePath[256]; if(string(m_gameList[i].path).find_last_of("/") != string::npos) - strncpy(gamePath, &m_gameList[i].path[string(m_gameList[i].path).find_last_of("/")], sizeof(gamePath)); + strncpy(gamePath, &m_gameList[i].path[string(m_gameList[i].path).find_last_of("/")+1], sizeof(gamePath)); else strncpy(gamePath, m_gameList[i].path, sizeof(gamePath)); path = sfmt("%s/%s.png", m_boxPicDir.c_str(), gamePath); @@ -1222,7 +1222,7 @@ void CMenu::_download(string gameId) { char gamePath[256]; if(string(m_cf.getHdr()->path).find_last_of("/") != string::npos) - strncpy(gamePath, &m_cf.getHdr()->path[string(m_cf.getHdr()->path).find_last_of("/")], sizeof(gamePath)); + strncpy(gamePath, &m_cf.getHdr()->path[string(m_cf.getHdr()->path).find_last_of("/")+1], sizeof(gamePath)); else strncpy(gamePath, m_cf.getHdr()->path, sizeof(gamePath)); m_coverDLGameId = gamePath; diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 2ddf56ec..22ad18ef 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -664,7 +664,7 @@ void CMenu::_launch(dir_discHdr *hdr) arguments.push_back(sfmt("%s/WiiFlowLoader.dol",m_pluginsDir.c_str())); else arguments.push_back(wiiflow_dol); - m_cfg.setString("EMULATOR", "current_item", &hdr->path[string(hdr->path).find_last_of("/")]); + m_cfg.setString("EMULATOR", "current_item", title); } else { diff --git a/source/plugin/plugin.cpp b/source/plugin/plugin.cpp index 5f900c63..08afee28 100644 --- a/source/plugin/plugin.cpp +++ b/source/plugin/plugin.cpp @@ -291,7 +291,7 @@ string Plugin::GenerateCoverLink(dir_discHdr gameHeader, string url, Config &Che char gamePath[256]; if(string(gameHeader.path).find_last_of("/") != string::npos) - strncpy(gamePath, &gameHeader.path[string(gameHeader.path).find_last_of("/")], sizeof(gamePath)); + strncpy(gamePath, &gameHeader.path[string(gameHeader.path).find_last_of("/")+1], sizeof(gamePath)); else strncpy(gamePath, gameHeader.path, sizeof(gamePath)); string cachedCRC = Checksums.getString("CHECKSUMS", gamePath, emptyString);