Fix error and line clear bugs
Fixed a bug whereby error messages may appear on the bottom screen. Fixed a bug whereby some lines on the bottom screen would not be cleared whilst browsing files, causing some file names to appear where they shouldn't. Signed-off-by: Mahyar Koshkouei <deltabeard@users.noreply.github.com>
This commit is contained in:
@@ -51,10 +51,10 @@ void playbackWatchdog(void* infoIn)
|
|||||||
{
|
{
|
||||||
svcWaitSynchronization(*info->errInfo->failEvent, U64_MAX);
|
svcWaitSynchronization(*info->errInfo->failEvent, U64_MAX);
|
||||||
svcClearEvent(*info->errInfo->failEvent);
|
svcClearEvent(*info->errInfo->failEvent);
|
||||||
consoleSelect(info->screen);
|
|
||||||
|
|
||||||
if(*info->errInfo->error != 0)
|
if(*info->errInfo->error != 0)
|
||||||
{
|
{
|
||||||
|
consoleSelect(info->screen);
|
||||||
printf("Error %d: %s", *info->errInfo->error,
|
printf("Error %d: %s", *info->errInfo->error,
|
||||||
ctrmus_strerror(*info->errInfo->error));
|
ctrmus_strerror(*info->errInfo->error));
|
||||||
|
|
||||||
@@ -204,7 +204,6 @@ static int listDir(int from, int max, int select, struct dirList_t dirList)
|
|||||||
int fileNum = 0;
|
int fileNum = 0;
|
||||||
int listed = 0;
|
int listed = 0;
|
||||||
|
|
||||||
//consoleClear();
|
|
||||||
printf("\033[0;0H");
|
printf("\033[0;0H");
|
||||||
printf("Dir: %.33s\n", dirList.currentDir);
|
printf("Dir: %.33s\n", dirList.currentDir);
|
||||||
|
|
||||||
@@ -212,9 +211,8 @@ static int listDir(int from, int max, int select, struct dirList_t dirList)
|
|||||||
{
|
{
|
||||||
printf("\33[2K%c../\n", select == 0 ? '>' : ' ');
|
printf("\33[2K%c../\n", select == 0 ? '>' : ' ');
|
||||||
listed++;
|
listed++;
|
||||||
|
max--;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
max++;
|
|
||||||
|
|
||||||
while(dirList.fileNum + dirList.dirNum > fileNum)
|
while(dirList.fileNum + dirList.dirNum > fileNum)
|
||||||
{
|
{
|
||||||
@@ -246,10 +244,6 @@ static int listDir(int from, int max, int select, struct dirList_t dirList)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Remove crappy bodge to stop last line from not being cleared. */
|
|
||||||
if(from != 0)
|
|
||||||
printf("\33[2K");
|
|
||||||
|
|
||||||
return listed;
|
return listed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,15 +312,12 @@ int main(int argc, char **argv)
|
|||||||
chdir(DEFAULT_DIR);
|
chdir(DEFAULT_DIR);
|
||||||
chdir("MUSIC");
|
chdir("MUSIC");
|
||||||
|
|
||||||
consoleSelect(&topScreen);
|
/* TODO: Not actually possible to get less than 0 */
|
||||||
if(getDir(&dirList) > 0)
|
if(getDir(&dirList) < 0)
|
||||||
{
|
{
|
||||||
printf("Fourth/%d file: %s\n", dirList.dirNum, dirList.files[3]);
|
puts("Unable to obtain directory information");
|
||||||
|
goto err;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
puts("didn't work");
|
|
||||||
|
|
||||||
consoleSelect(&bottomScreen);
|
|
||||||
|
|
||||||
if(listDir(from, MAX_LIST, 0, dirList) < 0)
|
if(listDir(from, MAX_LIST, 0, dirList) < 0)
|
||||||
{
|
{
|
||||||
@@ -446,6 +437,7 @@ int main(int argc, char **argv)
|
|||||||
fileNum -= skip;
|
fileNum -= skip;
|
||||||
|
|
||||||
/* 26 is the maximum number of entries that can be printed */
|
/* 26 is the maximum number of entries that can be printed */
|
||||||
|
/* TODO: Not using MAX_LIST here? */
|
||||||
if(fileMax - fileNum > 26 && from != 0)
|
if(fileMax - fileNum > 26 && from != 0)
|
||||||
{
|
{
|
||||||
from -= skip;
|
from -= skip;
|
||||||
@@ -519,7 +511,6 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
consoleSelect(&topScreen);
|
consoleSelect(&topScreen);
|
||||||
changeFile(dirList.files[fileNum - dirList.dirNum - 1], &playbackInfo);
|
changeFile(dirList.files[fileNum - dirList.dirNum - 1], &playbackInfo);
|
||||||
consoleSelect(&bottomScreen);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
#define DEFAULT_DIR "sdmc:/"
|
#define DEFAULT_DIR "sdmc:/"
|
||||||
|
|
||||||
/* Maximum number of lines that can be displayed */
|
/* Maximum number of lines that can be displayed */
|
||||||
#define MAX_LIST 27
|
#define MAX_LIST 28
|
||||||
|
|
||||||
struct watchdogInfo
|
struct watchdogInfo
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user