Skip to content

Commit

Permalink
- Actually allow title selector to work if it is ever needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
suloku committed Oct 13, 2015
1 parent fadc5dd commit 96b6a76
Showing 1 changed file with 42 additions and 40 deletions.
82 changes: 42 additions & 40 deletions source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,9 @@ int main()
getTitleTitle(0x0,2,titleTitle);
titleTitle_set = 1;
} else {
aptOpenSession();
APT_GetProgramID(NULL, &tid2);
aptCloseSession();
aptOpenSession();
APT_GetProgramID(NULL, &tid2);
aptCloseSession();
/*
//Fetch title from /svdt/tid.bin
FILE * pFile;
Expand All @@ -599,23 +599,23 @@ int main()
}
fclose (pFile);
*/
getTitleList(mediatype,&titleTitles_available);
if (titleTitle_set < 0){
if (tid2 != 0){
lsTitle* currentTitle = firstTitle;
int i = 0;
while(currentTitle != NULL){
if (currentTitle->thisTitle == tid2){
titleTitle_set = i;
getTitleTitle(tid2, mediatype, titleTitle);
tid = tid2;
break;
}
currentTitle = currentTitle->nextTitle;
i++;
}
}
}
getTitleList(mediatype,&titleTitles_available);
if (titleTitle_set < 0){
if (tid2 != 0){
lsTitle* currentTitle = firstTitle;
int i = 0;
while(currentTitle != NULL){
if (currentTitle->thisTitle == tid2){
titleTitle_set = i;
getTitleTitle(tid2, mediatype, titleTitle);
tid = tid2;
break;
}
currentTitle = currentTitle->nextTitle;
i++;
}
}
}
AM_GetTitleProductCode(mediatype,tid2,productCodeBuffer);
strncpy(productCode,productCodeBuffer,9);
secureGameFromProductCode(productCode);
Expand Down Expand Up @@ -778,22 +778,22 @@ int main()
gotoxy(0,10);
int i;
for (i=0;i<BOTTOM_WIDTH;i++) { printf(" "); }
if (titleTitle_set < 0){
if (tid2 != 0){
lsTitle* currentTitle = firstTitle;
int i = 0;
while(currentTitle != NULL){
if (currentTitle->thisTitle == tid2){
titleTitle_set = i;
getTitleTitle(tid2, mediatype, titleTitle);
tid = tid2;
break;
}
currentTitle = currentTitle->nextTitle;
i++;
}
}
}
if (titleTitle_set < 0){
if (tid2 != 0){
lsTitle* currentTitle = firstTitle;
int i = 0;
while(currentTitle != NULL){
if (currentTitle->thisTitle == tid2){
titleTitle_set = i;
getTitleTitle(tid2, mediatype, titleTitle);
tid = tid2;
break;
}
currentTitle = currentTitle->nextTitle;
i++;
}
}
}
if (titleTitle_set < 0)
nthTitleInList(titleTitle_set,mediatype,titleTitle,&tid);
AM_GetTitleProductCode(mediatype,tid,productCodeBuffer);
Expand All @@ -817,6 +817,7 @@ int main()

int heldU = 0;
int heldD = 0;
bool firstloop = false;
while (aptMainLoop())
{
hidScanInput();
Expand Down Expand Up @@ -859,7 +860,7 @@ int main()
printf(productCode);
printf(" - %016llX", tid);
}
if(hidKeysDown() & KEY_A || titleTitle_set > -1)
if(hidKeysDown() & KEY_A || (titleTitle_set > -1 && !firstloop))
{
printInstructions();
printTarget();
Expand Down Expand Up @@ -921,6 +922,7 @@ int main()
// Flush and swap framebuffers
gfxFlushBuffers();
gfxSwapBuffers();
firstloop = true;
continue;
}
if(machine_state == CONFIRM_SECURE_VALUE)
Expand Down Expand Up @@ -1253,10 +1255,10 @@ int main()
gotoParentDirectory(ccwd);
debugOut("Navigating to parent directory.");
cwd_needs_update = 1;
break;
break;
}
if (ccwd->lsOffset == 0)
break;
if (ccwd->lsOffset == 0)
break;
default: ;
lsLine* selection = ccwd->firstLine;
int i;
Expand Down

0 comments on commit 96b6a76

Please sign in to comment.