-added a few missing +1 in name generation, may produced some "//"

in generated plugin cover paths
This commit is contained in:
fix94.1 2012-06-17 11:23:55 +00:00
parent a87244c93a
commit 1bcd0ce2c0
4 changed files with 12 additions and 8 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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
{

View File

@ -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);