mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-24 20:26:53 +01:00
Fixed multiple errors
This commit is contained in:
parent
fdf0704d43
commit
3f4c41c913
@ -447,15 +447,11 @@ extern "C" bool RemoveDirectory(const char *path)
|
||||
RemoveFile(dir.GetFilepath(i));
|
||||
done++;
|
||||
}
|
||||
}
|
||||
|
||||
//! now remove all folders
|
||||
for(int i = 0; i < fileCount; i++)
|
||||
{
|
||||
if(dir.IsDir(i))
|
||||
else
|
||||
{
|
||||
//! remove all folders
|
||||
ShowProgress(tr("Deleting directories..."), dir.GetFilename(i), 0, done, fileCount, false, false);
|
||||
RemoveFile(dir.GetFilepath(i));
|
||||
rmdir(dir.GetFilepath(i));
|
||||
done++;
|
||||
gprintf("%s\n", dir.GetFilepath(i));
|
||||
}
|
||||
@ -464,11 +460,11 @@ extern "C" bool RemoveDirectory(const char *path)
|
||||
ProgressStop();
|
||||
ProgressCancelEnable(false);
|
||||
|
||||
return (remove(folderpath.c_str()) == 0);
|
||||
return (rmdir(folderpath.c_str()) == 0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* RemoveDirectory
|
||||
* CopyDirectory
|
||||
***************************************************************************/
|
||||
extern "C" int CopyDirectory(const char *path, const char *dst)
|
||||
{
|
||||
|
@ -238,18 +238,18 @@ void GuiText::SetFontSize(int s)
|
||||
size = s;
|
||||
}
|
||||
|
||||
void GuiText::SetMaxWidth(int width, int w)
|
||||
void GuiText::SetMaxWidth(int w, int m)
|
||||
{
|
||||
//! no need to reset timer on false set
|
||||
if(wrapMode == w && maxWidth == width)
|
||||
if(wrapMode == m && maxWidth == w)
|
||||
return;
|
||||
|
||||
LOCK( this );
|
||||
|
||||
maxWidth = width;
|
||||
wrapMode = w;
|
||||
maxWidth = w;
|
||||
wrapMode = m;
|
||||
|
||||
if (w == SCROLL_HORIZONTAL)
|
||||
if (m == SCROLL_HORIZONTAL)
|
||||
{
|
||||
textScrollPos = 0;
|
||||
textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY;
|
||||
|
@ -264,16 +264,16 @@ s32 GCDumper::InstallGame(const char *installpath, u32 game, const char *install
|
||||
|
||||
char gamepath[512];
|
||||
// snprintf(gamepath, sizeof(gamepath), "%s%s [%.6s]%s/", installpath, gametitle, gcheader.id, Disc ? "2" : ""); // Disc2 currently needs to be on the same folder.
|
||||
snprintf(gamepath, sizeof(gamepath), "%s%s [%.6s]/", installpath, gametitle, gcheader.id);
|
||||
int n = snprintf(gamepath, sizeof(gamepath), "%s%s [%.6s]/", installpath, gametitle, gcheader.id);
|
||||
|
||||
// If another Disc from the same gameID already exists, let's use that path
|
||||
if(strlen((char *)installedGamePath) != 0)
|
||||
snprintf(gamepath, sizeof(gamepath), "%s/", installedGamePath);
|
||||
n = snprintf(gamepath, sizeof(gamepath), "%s/", installedGamePath);
|
||||
|
||||
CreateSubfolder(gamepath);
|
||||
|
||||
// snprintf(gamepath, sizeof(gamepath), "%s%s [%.6s]%s/game.iso", installpath, gametitle, gcheader.id, Disc ? "2" : ""); // Disc2 currently needs to be on the same folder.
|
||||
snprintf(gamepath, sizeof(gamepath), "%s%s.iso", gamepath, Disc ? "disc2" : "game");
|
||||
snprintf(gamepath + n, sizeof(gamepath) - n, "%s.iso", Disc ? "disc2" : "game");
|
||||
|
||||
FILE *f = fopen(gamepath, "wb");
|
||||
if(!f)
|
||||
|
@ -402,10 +402,10 @@ bool GCGames::IsInstalled(const char *gameID, u8 disc_number) const
|
||||
else if(disc_number == 1) // Check if the second Game Disc exists in the same folder than Disc1.
|
||||
{
|
||||
char filepath[512];
|
||||
snprintf(filepath, sizeof(filepath), "%s", GetPath(gameID));
|
||||
int n = snprintf(filepath, sizeof(filepath), "%s", GetPath(gameID));
|
||||
char *pathPtr = strrchr(filepath, '/');
|
||||
if(pathPtr) *pathPtr = 0;
|
||||
snprintf(filepath, sizeof(filepath), "%s/disc2.iso", filepath);
|
||||
snprintf(filepath + n, sizeof(filepath) - n, "/disc2.iso");
|
||||
|
||||
if(CheckFile(filepath))
|
||||
return true;
|
||||
|
@ -145,7 +145,11 @@ int GCTCheats::openTxtfile(const char * filename)
|
||||
|
||||
const int max_line_size = 4096;
|
||||
char *line = new (std::nothrow) char[max_line_size];
|
||||
if(!line) return -1;
|
||||
if (!line)
|
||||
{
|
||||
fclose(pFile);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fgets(line, max_line_size, pFile);
|
||||
RemoveLineEnds(line);
|
||||
@ -158,7 +162,7 @@ int GCTCheats::openTxtfile(const char * filename)
|
||||
{
|
||||
RemoveLineEnds(line);
|
||||
|
||||
if(*line == 0)
|
||||
if (*line == 0)
|
||||
continue;
|
||||
|
||||
// first line is the cheat name
|
||||
@ -169,7 +173,7 @@ int GCTCheats::openTxtfile(const char * filename)
|
||||
{
|
||||
RemoveLineEnds(line);
|
||||
|
||||
if(*line == 0) // empty line means start of new cheat
|
||||
if (*line == 0) // empty line means start of new cheat
|
||||
break;
|
||||
|
||||
if (IsCode(line))
|
||||
@ -187,7 +191,7 @@ int GCTCheats::openTxtfile(const char * filename)
|
||||
}
|
||||
}
|
||||
|
||||
if(!cheatEntry.sCheats.empty())
|
||||
if (!cheatEntry.sCheats.empty())
|
||||
cheatList.push_back(cheatEntry);
|
||||
}
|
||||
fclose(pFile);
|
||||
|
@ -172,6 +172,7 @@ int BootHomebrew(const char * filepath)
|
||||
fclose(file);
|
||||
DeviceHandler::DestroyInstance();
|
||||
Sys_BackToLoader();
|
||||
return -1;
|
||||
}
|
||||
|
||||
homebrewsize = filesize;
|
||||
|
@ -68,8 +68,6 @@ int HomebrewXML::LoadHomebrewXMLData(const char* filename)
|
||||
snprintf(ReleaseText, sizeof(ReleaseText), "%c%c/%c%c/%c%c%c%c", ReleaseText[4], ReleaseText[5], ReleaseText[6], ReleaseText[7], ReleaseText[0], ReleaseText[1], ReleaseText[2], ReleaseText[3]);
|
||||
else if (len == 6)
|
||||
snprintf(ReleaseText, sizeof(ReleaseText), "%c%c/%c%c%c%c", ReleaseText[4], ReleaseText[5], ReleaseText[0], ReleaseText[1], ReleaseText[2], ReleaseText[3]);
|
||||
else
|
||||
snprintf(ReleaseText, sizeof(ReleaseText), "%s", ReleaseText);
|
||||
|
||||
Releasedate = ReleaseText;
|
||||
|
||||
|
@ -342,7 +342,7 @@ u32 wbfs_count_usedblocks(wbfs_t*p)
|
||||
if (v == ~0U)
|
||||
count += 32;
|
||||
else if (v != 0) for (j = 0; j < 32; j++)
|
||||
if (v & (1 << j)) count++;
|
||||
if (v & (1U << j)) count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
@ -369,7 +369,7 @@ static u32 alloc_block(wbfs_t*p)
|
||||
if (v != 0)
|
||||
{
|
||||
for (j = 0; j < 32; j++)
|
||||
if (v & (1 << j))
|
||||
if (v & (1U << j))
|
||||
{
|
||||
p->freeblks[i] = wbfs_htonl( v & ~( 1 << j ) );
|
||||
return (i * 32) + j + 1;
|
||||
|
@ -215,7 +215,8 @@ bool shadow_mload()
|
||||
{
|
||||
int ios = IOS_GetVersion();
|
||||
|
||||
if(ios != 222 || ios != 223 || ios != 224)
|
||||
// Allow only Hermes cIOS 222, 223 & 224
|
||||
if (ios < 222 || ios > 224)
|
||||
return false;
|
||||
|
||||
int v51 = (5 << 4) & 1;
|
||||
|
@ -360,7 +360,7 @@ u32 do_new_wiimmfi()
|
||||
// Binary blobs with Wiimmfi patches. Do not modify.
|
||||
// Provided by Leseratte on 2018-12-14.
|
||||
|
||||
int binary[] = { 0x37C849A2, 0x8BC32FA4, 0xC9A34B71, 0x1BCB49A2,
|
||||
u32 binary[] = { 0x37C849A2, 0x8BC32FA4, 0xC9A34B71, 0x1BCB49A2,
|
||||
0x2F119304, 0x5F402684, 0x3E4FDA29, 0x50849A21,
|
||||
0xB88B3452, 0x627FC9C1, 0xDC24D119, 0x5844350F,
|
||||
0xD893444F, 0x19A588DC, 0x16C91184, 0x0C3E237C,
|
||||
|
@ -740,11 +740,11 @@ void GameWindow::BootGame(struct discHdr *header)
|
||||
if (game_cfg->loadalternatedol == 2)
|
||||
{
|
||||
char filepath[200];
|
||||
snprintf(filepath, sizeof(filepath), "%s%s.dol", Settings.dolpath, IDfull);
|
||||
int n = snprintf(filepath, sizeof(filepath), "%s%s.dol", Settings.dolpath, IDfull);
|
||||
if (CheckFile(filepath) == false)
|
||||
{
|
||||
sprintf(filepath, "%s %s", filepath, tr( "does not exist!" ));
|
||||
if(!WindowPrompt(tr( "Error" ), filepath, tr( "Continue" ), tr( "Cancel")))
|
||||
snprintf(filepath + n, sizeof(filepath) - n, " %s", tr( "does not exist!" ));
|
||||
if (!WindowPrompt(tr( "Error" ), filepath, tr( "Continue" ), tr( "Cancel")))
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -762,10 +762,10 @@ void GameWindow::BootGame(struct discHdr *header)
|
||||
if (game_cfg->ocarina == ON || (game_cfg->ocarina == INHERIT && Settings.ocarina == ON))
|
||||
{
|
||||
char filepath[200];
|
||||
snprintf(filepath, sizeof(filepath), "%s%s.gct", Settings.Cheatcodespath, IDfull);
|
||||
int n = snprintf(filepath, sizeof(filepath), "%s%s.gct", Settings.Cheatcodespath, IDfull);
|
||||
if (CheckFile(filepath) == false)
|
||||
{
|
||||
sprintf(filepath, "%s %s", filepath, tr( "does not exist! Loading game without cheats." ));
|
||||
snprintf(filepath + n, sizeof(filepath) - n, " %s", tr( "does not exist! Loading game without cheats." ));
|
||||
if(!WindowPrompt(tr( "Error" ), filepath, tr( "Continue" ), tr( "Cancel")))
|
||||
return;
|
||||
}
|
||||
|
@ -298,9 +298,9 @@ void WindowCredits()
|
||||
|
||||
char SvnRev[80];
|
||||
#ifdef FULLCHANNEL
|
||||
snprintf(SvnRev, sizeof(SvnRev), "Rev%sc IOS%u (Rev %u)%s", GetRev(), IOS_GetVersion(), IOS_GetRevision(), (*(vu32*)0xcd800064 == 0xFFFFFFFF)? " + AHB" : "" );
|
||||
snprintf(SvnRev, sizeof(SvnRev), "Rev%sc IOS%d (Rev %d)%s", GetRev(), (int)IOS_GetVersion(), (int)IOS_GetRevision(), (*(vu32*)0xcd800064 == 0xFFFFFFFF)? " + AHB" : "" );
|
||||
#else
|
||||
snprintf(SvnRev, sizeof(SvnRev), "Rev%s IOS%u (Rev %u)%s", GetRev(), (unsigned int)IOS_GetVersion(), (int)IOS_GetRevision(), (*(vu32*)0xcd800064 == 0xFFFFFFFF)? " + AHB" : "" );
|
||||
snprintf(SvnRev, sizeof(SvnRev), "Rev%s IOS%d (Rev %d)%s", GetRev(), (int)IOS_GetVersion(), (int)IOS_GetRevision(), (*(vu32*)0xcd800064 == 0xFFFFFFFF)? " + AHB" : "" );
|
||||
#endif
|
||||
|
||||
char IosInfo[80] = "";
|
||||
@ -333,7 +333,7 @@ void WindowCredits()
|
||||
char *ptr = strchr(version, ' ');
|
||||
if(ptr) *ptr = 0;
|
||||
else version[4] = 0;
|
||||
snprintf(GCInfo, sizeof(GCInfo), "%s%sDevolution r%d", GCInfo, strlen(GCInfo) > 1 ? " / " : "", atoi(version));
|
||||
snprintf(GCInfo + strlen(GCInfo), sizeof(GCInfo) - strlen(GCInfo), "%sDevolution r%d", strlen(GCInfo) > 1 ? " / " : "", atoi(version));
|
||||
}
|
||||
|
||||
// Check if Nintendont is available
|
||||
@ -393,7 +393,7 @@ void WindowCredits()
|
||||
currentTxt->SetFont(creditsFont, creditsFontSize);
|
||||
txt.push_back(currentTxt);
|
||||
|
||||
currentTxt = new GuiText("http://sourceforge.net/p/usbloadergx/", 20, ( GXColor ) {255, 255, 255, 255});
|
||||
currentTxt = new GuiText("https://sourceforge.net/p/usbloadergx/", 20, ( GXColor ) {255, 255, 255, 255});
|
||||
currentTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
currentTxt->SetPosition(160, y);
|
||||
currentTxt->SetFont(creditsFont, creditsFontSize);
|
||||
@ -1199,7 +1199,7 @@ int FormatingPartition(const char *title, int part_num)
|
||||
int portPart = DeviceHandler::PartitionToPortPartition(part_num);
|
||||
|
||||
char text[255];
|
||||
sprintf(text, "%s: %.2fGB", tr( "Partition" ), usbHandle->GetSize(portPart) / GB_SIZE);
|
||||
int n = sprintf(text, "%s: %.2fGB", tr( "Partition" ), usbHandle->GetSize(portPart) / GB_SIZE);
|
||||
int choice = WindowPrompt(tr( "Do you want to format:" ), text, tr( "Yes" ), tr( "No" ));
|
||||
if (choice == 0)
|
||||
return -666;
|
||||
@ -1248,7 +1248,7 @@ int FormatingPartition(const char *title, int part_num)
|
||||
partition->FSName = "WBFS";
|
||||
sleep(1);
|
||||
ret = WBFS_OpenPart(part_num);
|
||||
sprintf(text, "%s %s", text, tr( "formatted!" ));
|
||||
snprintf(text + n, sizeof(text) - n, " %s", tr( "formatted!" ));
|
||||
WindowPrompt(tr( "Success:" ), text, tr( "OK" ));
|
||||
if (ret < 0)
|
||||
{
|
||||
@ -1457,67 +1457,63 @@ int CodeDownload(const char *id)
|
||||
if (IsNetworkInit())
|
||||
{
|
||||
char txtpath[250];
|
||||
snprintf(txtpath, sizeof(txtpath), "%s%s.txt", Settings.TxtCheatcodespath, id);
|
||||
int txtLen = snprintf(txtpath, sizeof(txtpath), "%s%s.txt", Settings.TxtCheatcodespath, id);
|
||||
|
||||
char codeurl[250];
|
||||
char codeurl[80];
|
||||
snprintf(codeurl, sizeof(codeurl), "https://www.geckocodes.org/txt.php?txt=%s", id);
|
||||
|
||||
struct download file = {};
|
||||
downloadfile(codeurl, &file);
|
||||
if (file.size <= 0) {
|
||||
gprintf("Trying backup...\n");
|
||||
char codeurl_backup[250];
|
||||
snprintf(codeurl_backup, sizeof(codeurl_backup), "https://web.archive.org/web/3000if_/geckocodes.org/txt.php?txt=%s", id);
|
||||
downloadfile(codeurl_backup, &file);
|
||||
snprintf(codeurl, sizeof(codeurl), "https://web.archive.org/web/3000if_/geckocodes.org/txt.php?txt=%s", id);
|
||||
downloadfile(codeurl, &file);
|
||||
}
|
||||
|
||||
if (file.size > 0)
|
||||
{
|
||||
bool validUrl = false;
|
||||
if(file.size > 0)
|
||||
{
|
||||
char *textCpy = new (std::nothrow) char[file.size+1];
|
||||
if(textCpy)
|
||||
if (textCpy)
|
||||
{
|
||||
memcpy(textCpy, file.data, file.size);
|
||||
textCpy[file.size] = '\0';
|
||||
validUrl = (strcasestr(textCpy, "404 Not Found") == 0);
|
||||
delete [] textCpy;
|
||||
}
|
||||
}
|
||||
|
||||
if(!validUrl)
|
||||
if (!validUrl)
|
||||
{
|
||||
snprintf(codeurl, sizeof(codeurl), "%s%s", codeurl, tr( " is not on the server." ));
|
||||
snprintf(codeurl, sizeof(codeurl), "%s.txt%s", id, tr( " is not on the server." ));
|
||||
WindowPrompt(tr( "Error" ), codeurl, tr( "OK" ));
|
||||
}
|
||||
else
|
||||
{
|
||||
FILE * pfile = fopen(txtpath, "wb");
|
||||
if(pfile)
|
||||
if (pfile)
|
||||
{
|
||||
fwrite(file.data, 1, file.size, pfile);
|
||||
fclose(pfile);
|
||||
|
||||
// verify downloaded content - thanks airline38
|
||||
pfile = fopen(txtpath, "rb");
|
||||
if(pfile)
|
||||
if (pfile)
|
||||
{
|
||||
char target[4];
|
||||
fseek(pfile,0,SEEK_SET);
|
||||
fseek(pfile, 0, SEEK_SET);
|
||||
fread(target, sizeof(char), 4, pfile);
|
||||
fclose(pfile);
|
||||
//printf("target=%s game id=%s\n",target,id);
|
||||
if (strncmp(target,id,4)== 0 )
|
||||
if (strncmp(target, id, 4)== 0 )
|
||||
{
|
||||
snprintf(txtpath, sizeof(txtpath), "%s%s", txtpath, tr(" has been Saved. The text has not been verified. Some of the code may not work right with each other. If you experience trouble, open the text in a real text editor for more information." ));
|
||||
snprintf(txtpath + txtLen, sizeof(txtpath) - txtLen, "%s", tr(" has been Saved. The text has not been verified. Some of the code may not work right with each other. If you experience trouble, open the text in a real text editor for more information." ));
|
||||
WindowPrompt(0, txtpath, tr( "OK" ));
|
||||
ret = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
RemoveFile(txtpath);
|
||||
snprintf(codeurl, sizeof(codeurl), "%s%s", codeurl, tr( " is not on the server." ));
|
||||
snprintf(codeurl, sizeof(codeurl), "%s.txt%s", id, tr( " is not on the server." ));
|
||||
WindowPrompt(tr( "Error" ), codeurl, tr( "OK" ));
|
||||
}
|
||||
}
|
||||
@ -1529,7 +1525,9 @@ int CodeDownload(const char *id)
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(codeurl, sizeof(codeurl), "%s%s", codeurl, tr(" could not be downloaded."));
|
||||
if (file.size > 0)
|
||||
free(file.data);
|
||||
snprintf(codeurl, sizeof(codeurl), "%s.txt%s", id, tr(" could not be downloaded."));
|
||||
WindowPrompt(tr( "Error" ), codeurl, tr( "OK" ));
|
||||
}
|
||||
}
|
||||
|
@ -83,8 +83,7 @@ int InitBrowsers()
|
||||
if ( DIR *dir = opendir( rootdir ) )
|
||||
{
|
||||
closedir(dir);
|
||||
BROWSERINFO browser;
|
||||
memset(&browser, 0, sizeof(BROWSERINFO));
|
||||
BROWSERINFO browser = {};
|
||||
strcpy(browser.rootdir, rootdir);
|
||||
ResetBrowser(&browser);
|
||||
browsers.push_back(browser);
|
||||
@ -445,7 +444,8 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*=
|
||||
< MAXPATHLEN)
|
||||
{
|
||||
/* update current directory name */
|
||||
sprintf(browser->dir, "%s%s/", browser->dir, browser->browserList[clickedIndex].filename);
|
||||
strcat(browser->dir, browser->browserList[clickedIndex].filename);
|
||||
sprintf(browser->dir + strlen(browser->dir), "/");
|
||||
pathCanged = true;
|
||||
}
|
||||
}
|
||||
|
@ -677,51 +677,51 @@ static int InternalShowGameInfo(struct discHdr *header)
|
||||
}
|
||||
|
||||
//date
|
||||
snprintf(linebuf2, sizeof(linebuf2), " ");
|
||||
int n = snprintf(linebuf2, sizeof(linebuf2), " ");
|
||||
if (GameInfo.PublishDate != 0)
|
||||
{
|
||||
int year = GameInfo.PublishDate >> 16;
|
||||
int day = GameInfo.PublishDate & 0xFF;
|
||||
int month = (GameInfo.PublishDate >> 8) & 0xFF;
|
||||
snprintf(linebuf2, sizeof(linebuf2), "%02i ", day);
|
||||
n += snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%02i ", day);
|
||||
|
||||
switch (month)
|
||||
{
|
||||
case 1:
|
||||
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Jan" ));
|
||||
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "Jan" ));
|
||||
break;
|
||||
case 2:
|
||||
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Feb" ));
|
||||
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "Feb" ));
|
||||
break;
|
||||
case 3:
|
||||
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Mar" ));
|
||||
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "Mar" ));
|
||||
break;
|
||||
case 4:
|
||||
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Apr" ));
|
||||
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "Apr" ));
|
||||
break;
|
||||
case 5:
|
||||
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "May" ));
|
||||
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "May" ));
|
||||
break;
|
||||
case 6:
|
||||
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "June" ));
|
||||
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "June" ));
|
||||
break;
|
||||
case 7:
|
||||
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "July" ));
|
||||
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "July" ));
|
||||
break;
|
||||
case 8:
|
||||
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Aug" ));
|
||||
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "Aug" ));
|
||||
break;
|
||||
case 9:
|
||||
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Sept" ));
|
||||
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "Sept" ));
|
||||
break;
|
||||
case 10:
|
||||
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Oct" ));
|
||||
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "Oct" ));
|
||||
break;
|
||||
case 11:
|
||||
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Nov" ));
|
||||
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "Nov" ));
|
||||
break;
|
||||
case 12:
|
||||
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Dec" ));
|
||||
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "Dec" ));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ bool Theme::Load(const char * theme_file_path)
|
||||
char * ptr = strrchr(theme_path, '/');
|
||||
if(ptr) *ptr = '\0';
|
||||
|
||||
snprintf(theme_path, sizeof(theme_path), "%s/%s", theme_path, Foldername);
|
||||
snprintf(theme_path + strlen(theme_path), sizeof(theme_path) - strlen(theme_path), "/%s", Foldername);
|
||||
if(!Resources::LoadFiles(theme_path))
|
||||
{
|
||||
const char * ThemeFilename = strrchr(theme_file_path, '/')+1;
|
||||
@ -137,7 +137,7 @@ bool Theme::Load(const char * theme_file_path)
|
||||
|
||||
char * ptr = strrchr(theme_path, '/');
|
||||
*ptr = 0;
|
||||
snprintf(theme_path, sizeof(theme_path), "%s/%s", theme_path, Filename);
|
||||
snprintf(theme_path + strlen(theme_path), sizeof(theme_path) - strlen(theme_path), "/%s", Filename);
|
||||
Resources::LoadFiles(theme_path);
|
||||
}
|
||||
|
||||
|
@ -642,7 +642,7 @@ int GameBooter::BootDIOSMIOS(struct discHdr *gameHdr)
|
||||
snprintf(disc2Path, sizeof(disc2Path), "%s", RealPath);
|
||||
char *pathPtr = strrchr(disc2Path, '/');
|
||||
if(pathPtr) *pathPtr = 0;
|
||||
snprintf(disc2Path, sizeof(disc2Path), "%s/disc2.iso", disc2Path);
|
||||
snprintf(disc2Path + strlen(disc2Path), sizeof(disc2Path) - strlen(disc2Path), "/disc2.iso");
|
||||
if(CheckFile(disc2Path))
|
||||
{
|
||||
int choice = WindowPrompt(gameHdr->title, tr("This game has multiple discs. Please select the disc to launch."), tr("Disc 1"), tr("Disc 2"), tr("Cancel"));
|
||||
@ -663,7 +663,7 @@ int GameBooter::BootDIOSMIOS(struct discHdr *gameHdr)
|
||||
{
|
||||
char *pathPtr = strrchr(gamePath, '/');
|
||||
if(pathPtr) *pathPtr = 0;
|
||||
snprintf(gamePath, sizeof(gamePath), "%s/disc2.iso", gamePath);
|
||||
snprintf(gamePath + strlen(gamePath), sizeof(gamePath) - strlen(gamePath), "/disc2.iso");
|
||||
}
|
||||
|
||||
ExitApp();
|
||||
@ -873,7 +873,7 @@ int GameBooter::BootDevolution(struct discHdr *gameHdr)
|
||||
snprintf(disc2, sizeof(disc2), "%s", RealPath);
|
||||
char *pathPtr = strrchr(disc2, '/');
|
||||
if(pathPtr) *pathPtr = 0;
|
||||
snprintf(disc2, sizeof(disc2), "%s/disc2.iso", disc2);
|
||||
snprintf(disc2 + strlen(disc2), sizeof(disc2) - strlen(disc2), "/disc2.iso");
|
||||
if(CheckFile(disc2))
|
||||
multiDisc = true;
|
||||
|
||||
@ -935,7 +935,7 @@ int GameBooter::BootDevolution(struct discHdr *gameHdr)
|
||||
{
|
||||
if(devoMCEmulation == DEVO_MC_INDIVIDUAL)
|
||||
{
|
||||
snprintf(DEVO_memCard, sizeof(DEVO_memCard), "%s/memcard_%.6s.bin", DEVO_memCard, (const char *) gameHdr->id);
|
||||
snprintf(DEVO_memCard + strlen(DEVO_memCard), sizeof(DEVO_memCard) - strlen(DEVO_memCard), "/memcard_%.6s.bin", (const char *) gameHdr->id);
|
||||
}
|
||||
else // same for all games
|
||||
{
|
||||
@ -1395,7 +1395,7 @@ int GameBooter::BootNintendont(struct discHdr *gameHdr)
|
||||
snprintf(disc2Path, sizeof(disc2Path), "%s", RealPath);
|
||||
char *pathPtr = strrchr(disc2Path, '/');
|
||||
if(pathPtr) *pathPtr = 0;
|
||||
snprintf(disc2Path, sizeof(disc2Path), "%s/disc2.iso", disc2Path);
|
||||
snprintf(disc2Path + strlen(disc2Path), sizeof(disc2Path) - strlen(disc2Path), "/disc2.iso");
|
||||
if(CheckFile(disc2Path))
|
||||
{
|
||||
int choice = WindowPrompt(gameHdr->title, tr("This game has multiple discs. Please select the disc to launch."), tr("Disc 1"), tr("Disc 2"), tr("Cancel"));
|
||||
@ -1415,7 +1415,7 @@ int GameBooter::BootNintendont(struct discHdr *gameHdr)
|
||||
{
|
||||
char *pathPtr = strrchr(gamePath, '/');
|
||||
if(pathPtr) *pathPtr = 0;
|
||||
snprintf(gamePath, sizeof(gamePath), "%s/disc2.iso", gamePath);
|
||||
snprintf(gamePath + strlen(gamePath), sizeof(gamePath) - strlen(gamePath), "/disc2.iso");
|
||||
}
|
||||
|
||||
if(gameHdr->type == TYPE_GAME_GC_DISC)
|
||||
|
@ -25,7 +25,6 @@ typedef struct _dolheader
|
||||
static bool Remove_001_Protection(void *Address, int Size)
|
||||
{
|
||||
u8 SearchPattern[16] = { 0x40, 0x82, 0x00, 0x0C, 0x38, 0x60, 0x00, 0x01, 0x48, 0x00, 0x02, 0x44, 0x38, 0x61, 0x00, 0x18 };
|
||||
u8 PatchData[16] = { 0x40, 0x82, 0x00, 0x04, 0x38, 0x60, 0x00, 0x01, 0x48, 0x00, 0x02, 0x44, 0x38, 0x61, 0x00, 0x18 };
|
||||
|
||||
void *Addr = Address;
|
||||
void *Addr_end = Address + Size;
|
||||
@ -34,7 +33,8 @@ static bool Remove_001_Protection(void *Address, int Size)
|
||||
{
|
||||
if (memcmp(Addr, SearchPattern, sizeof(SearchPattern)) == 0)
|
||||
{
|
||||
memcpy(Addr, PatchData, sizeof(PatchData));
|
||||
SearchPattern[3] = 0x04;
|
||||
memcpy(Addr, SearchPattern, sizeof(SearchPattern));
|
||||
return true;
|
||||
}
|
||||
Addr += 4;
|
||||
@ -56,10 +56,7 @@ bool Load_Dol(void **buffer, int* dollen, const char * filepath)
|
||||
|
||||
file = fopen(fullpath, "rb");
|
||||
if (file == NULL)
|
||||
{
|
||||
fclose(file);
|
||||
return false;
|
||||
}
|
||||
|
||||
int filesize;
|
||||
fseek(file, 0, SEEK_END);
|
||||
|
@ -75,6 +75,7 @@ bool neekLoadKernel (const char* nandpath)
|
||||
kernel = (u32 *) MEM2_alloc(fsize);
|
||||
if(!kernel)
|
||||
{
|
||||
fclose(f);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ s32 split_read_sector(void *_fp, u32 lba, u32 count, void*buf)
|
||||
ret = read(fd, ptr, chunk * 512);
|
||||
if (ret != chunk * 512)
|
||||
{
|
||||
fprintf(stderr, "error reading %u %u [%u] %u = %u\n", (unsigned int)lba, (unsigned int)count, i, (unsigned int)chunk, ret);
|
||||
fprintf(stderr, "error reading %u %u [%i] %u = %lu\n", (unsigned int)lba, (unsigned int)count, i, (unsigned int)chunk, (unsigned long)ret);
|
||||
split_error( "error reading disc" );
|
||||
return 1;
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ s32 Wbfs_Fat::RemoveGame(u8 *discid)
|
||||
closedir(dir);
|
||||
// remove game subdir
|
||||
remove(path);
|
||||
|
||||
rmdir(path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -79,6 +79,7 @@ const wchar_t * wfmt(const char * format, ...)
|
||||
if(bt > 0)
|
||||
{
|
||||
strWChar[bt] = 0;
|
||||
va_end(va);
|
||||
return (const wchar_t *) strWChar;
|
||||
}
|
||||
}
|
||||
|
@ -376,9 +376,16 @@ U8NandArchive::~U8NandArchive()
|
||||
bool U8NandArchive::SetFile( const char* nandPath )
|
||||
{
|
||||
if(fst)
|
||||
{
|
||||
free(fst);
|
||||
fst = NULL;
|
||||
}
|
||||
|
||||
if(name_table)
|
||||
{
|
||||
free(name_table);
|
||||
name_table = NULL;
|
||||
}
|
||||
CloseFile();
|
||||
|
||||
// open file
|
||||
@ -438,9 +445,13 @@ bool U8NandArchive::SetFile( const char* nandPath )
|
||||
dataOffset = 0;
|
||||
free( buffer );
|
||||
if( fst )
|
||||
{
|
||||
free( fst );
|
||||
fst = NULL;
|
||||
}
|
||||
CloseFile();
|
||||
gprintf( "U8NandArchive: error reading fst\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
// set name table pointer
|
||||
|
@ -84,7 +84,6 @@ u8* DecompressAsh( const u8 *stuff, u32 &len )
|
||||
memset( (void*)workingBuffer, 0, 0x100000 );
|
||||
//printf("r[8] :%08X\n", r[8]);
|
||||
|
||||
r[8] = r[8];
|
||||
r[9] = r[8] + 0x07FE;
|
||||
r[10] = r[9] + 0x07FE;
|
||||
r[11] = r[10] + 0x1FFE;
|
||||
|
@ -462,7 +462,9 @@ int Wad::CheckContentMap(const char *installpath, tmd_content *content, char *fi
|
||||
content_map_size++;
|
||||
|
||||
map = (map_entry_t *) content_map;
|
||||
sprintf(map[next_entry].name, "%08x", (unsigned int)next_entry);
|
||||
char name[9];
|
||||
sprintf(name, "%08x", (unsigned int)next_entry);
|
||||
memcpy(map[next_entry].name, name, 8);
|
||||
memcpy(map[next_entry].hash, content->hash, 20);
|
||||
|
||||
// write new content.map
|
||||
|
Loading…
Reference in New Issue
Block a user