@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* ctrmus - 3DS Music Player
|
||||
* mice - 3DS Music Player
|
||||
* Copyright (C) 2016 Mahyar Koshkouei
|
||||
*
|
||||
* This program comes with ABSOLUTELY NO WARRANTY and is free software. You are
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "error.h"
|
||||
#include "file.h"
|
||||
#include "main.h"
|
||||
#include "metadata.h"
|
||||
#include "playback.h"
|
||||
|
||||
volatile bool runThreads = true;
|
||||
@@ -58,7 +59,7 @@ void playbackWatchdog(void* infoIn)
|
||||
continue;
|
||||
consoleSelect(info->screen);
|
||||
printf("Error %d: %s\n", *info->errInfo->error,
|
||||
ctrmus_strerror(*info->errInfo->error));
|
||||
mice_strerror(*info->errInfo->error));
|
||||
}
|
||||
else if (*info->errInfo->error == -1)
|
||||
{
|
||||
@@ -118,7 +119,8 @@ static int changeFile(const char* ep_file, struct playbackInfo_t* playbackInfo)
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("Playing: %s\n", playbackInfo->file);
|
||||
/* Remove "Playing:" message that was causing display issues */
|
||||
/* printf("Playing: %s\n", playbackInfo->file); */
|
||||
playbackInfo->samples_total = 0;
|
||||
playbackInfo->samples_played = 0;
|
||||
playbackInfo->samples_per_second = 0;
|
||||
@@ -301,6 +303,7 @@ int main(int argc, char **argv)
|
||||
struct playbackInfo_t playbackInfo = { 0 };
|
||||
volatile int error = 0;
|
||||
struct dirList_t dirList = { 0 };
|
||||
struct metadata_t currentMetadata = { 0 };
|
||||
|
||||
/* ignore key release of L/R if L+R or L+down was pressed */
|
||||
bool keyLComboPressed = false;
|
||||
@@ -318,6 +321,9 @@ int main(int argc, char **argv)
|
||||
|
||||
consoleSelect(&bottomScreen);
|
||||
|
||||
/* Display version in bottom right corner */
|
||||
printf("\033[28;30H%s", MICE_VERSION);
|
||||
|
||||
svcCreateEvent(&playbackFailEvent, RESET_ONESHOT);
|
||||
errInfo.error = &error;
|
||||
errInfo.failEvent = &playbackFailEvent;
|
||||
@@ -376,7 +382,7 @@ int main(int argc, char **argv)
|
||||
|
||||
consoleSelect(&bottomScreen);
|
||||
|
||||
/* Exit ctrmus */
|
||||
/* Exit mice */
|
||||
if(kDown & KEY_START)
|
||||
break;
|
||||
|
||||
@@ -571,6 +577,13 @@ int main(int argc, char **argv)
|
||||
{
|
||||
consoleSelect(&topScreenInfo);
|
||||
consoleClear();
|
||||
|
||||
/* Extract and display metadata */
|
||||
char fullPath[512];
|
||||
snprintf(fullPath, sizeof(fullPath), "%s", dirList.files[fileNum - dirList.dirNum - 1]);
|
||||
extractMetadata(fullPath, ¤tMetadata);
|
||||
displayMetadata(¤tMetadata, dirList.files[fileNum - dirList.dirNum - 1]);
|
||||
|
||||
consoleSelect(&topScreenLog);
|
||||
//consoleClear();
|
||||
|
||||
@@ -597,6 +610,13 @@ int main(int argc, char **argv)
|
||||
from++;
|
||||
consoleSelect(&topScreenInfo);
|
||||
consoleClear();
|
||||
|
||||
/* Extract and display metadata */
|
||||
char fullPath[512];
|
||||
snprintf(fullPath, sizeof(fullPath), "%s", dirList.files[fileNum - dirList.dirNum - 1]);
|
||||
extractMetadata(fullPath, ¤tMetadata);
|
||||
displayMetadata(¤tMetadata, dirList.files[fileNum - dirList.dirNum - 1]);
|
||||
|
||||
consoleSelect(&topScreenLog);
|
||||
//consoleClear();
|
||||
changeFile(dirList.files[fileNum - dirList.dirNum - 1], &playbackInfo);
|
||||
@@ -621,6 +641,13 @@ int main(int argc, char **argv)
|
||||
from--;
|
||||
consoleSelect(&topScreenInfo);
|
||||
consoleClear();
|
||||
|
||||
/* Extract and display metadata */
|
||||
char fullPath[512];
|
||||
snprintf(fullPath, sizeof(fullPath), "%s", dirList.files[fileNum - dirList.dirNum - 1]);
|
||||
extractMetadata(fullPath, ¤tMetadata);
|
||||
displayMetadata(¤tMetadata, dirList.files[fileNum - dirList.dirNum - 1]);
|
||||
|
||||
consoleSelect(&topScreenLog);
|
||||
//consoleClear();
|
||||
changeFile(dirList.files[fileNum - dirList.dirNum - 1], &playbackInfo);
|
||||
@@ -640,6 +667,13 @@ int main(int argc, char **argv)
|
||||
fileNum += 1;
|
||||
consoleSelect(&topScreenInfo);
|
||||
consoleClear();
|
||||
|
||||
/* Extract and display metadata */
|
||||
char fullPath[512];
|
||||
snprintf(fullPath, sizeof(fullPath), "%s", dirList.files[fileNum - dirList.dirNum - 1]);
|
||||
extractMetadata(fullPath, ¤tMetadata);
|
||||
displayMetadata(¤tMetadata, dirList.files[fileNum - dirList.dirNum - 1]);
|
||||
|
||||
consoleSelect(&topScreenLog);
|
||||
//consoleClear();
|
||||
changeFile(dirList.files[fileNum - dirList.dirNum - 1], &playbackInfo);
|
||||
@@ -652,9 +686,9 @@ int main(int argc, char **argv)
|
||||
/* After 1000ms, update playback time. */
|
||||
while(osGetTime() - mill > 1000)
|
||||
{
|
||||
consoleSelect(&topScreenInfo);
|
||||
/* Reset cursor position and print status. */
|
||||
printf("\033[0;0H");
|
||||
consoleSelect(&topScreenLog);
|
||||
/* Position cursor at bottom of log area for time display */
|
||||
printf("\033[29;0H\033[K"); /* Move to line 29, clear line */
|
||||
|
||||
/* Avoid divide by zero. */
|
||||
if(playbackInfo.samples_per_second == 0)
|
||||
@@ -694,6 +728,7 @@ int main(int argc, char **argv)
|
||||
out:
|
||||
puts("Exiting...");
|
||||
runThreads = false;
|
||||
clearMetadata(¤tMetadata);
|
||||
svcSignalEvent(playbackFailEvent);
|
||||
changeFile(NULL, &playbackInfo);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user