Remove header order requirement and debug

Signed-off-by: Mahyar Koshkouei <deltabeard@users.noreply.github.com>
This commit is contained in:
Mahyar Koshkouei
2017-02-14 17:34:48 +00:00
parent 711864cfa9
commit b7f3a70406
4 changed files with 20 additions and 12 deletions

View File

@@ -13,7 +13,7 @@
err, strerror(errno)); } while (0) err, strerror(errno)); } while (0)
#define delete(ptr) \ #define delete(ptr) \
free(ptr); ptr = NULL free((void*) ptr); ptr = NULL
struct decoder_fn struct decoder_fn
{ {

View File

@@ -17,9 +17,8 @@
#include "all.h" #include "all.h"
#include "error.h" #include "error.h"
// TODO: Remove order requirement.
#include "playback.h"
#include "main.h" #include "main.h"
#include "playback.h"
volatile bool runThreads = true; volatile bool runThreads = true;
@@ -35,7 +34,7 @@ int main(int argc, char **argv)
struct watchdogInfo watchdogInfoIn; struct watchdogInfo watchdogInfoIn;
struct errInfo_t errInfo; struct errInfo_t errInfo;
struct playbackInfo_t playbackInfo; struct playbackInfo_t playbackInfo;
int error = 0; volatile int error = 0;
gfxInitDefault(); gfxInitDefault();
sdmcInit(); sdmcInit();
@@ -50,7 +49,8 @@ int main(int argc, char **argv)
watchdogInfoIn.screen = &topScreen; watchdogInfoIn.screen = &topScreen;
watchdogInfoIn.errInfo = &errInfo; watchdogInfoIn.errInfo = &errInfo;
watchdogThread = threadCreate(playbackWatchdog, &watchdogInfoIn, 4 * 1024, 0x20, -2, true); watchdogThread = threadCreate(playbackWatchdog,
&watchdogInfoIn, 4 * 1024, 0x20, -2, true);
playbackInfo.file = NULL; playbackInfo.file = NULL;
playbackInfo.errInfo = &errInfo; playbackInfo.errInfo = &errInfo;
@@ -65,8 +65,6 @@ int main(int argc, char **argv)
fileMax = getNumberFiles(); fileMax = getNumberFiles();
consoleSelect(&bottomScreen);
/** /**
* This allows for music to continue playing through the headphones whilst * This allows for music to continue playing through the headphones whilst
* the 3DS is closed. * the 3DS is closed.
@@ -280,17 +278,15 @@ void playbackWatchdog(void* infoIn)
while(runThreads) while(runThreads)
{ {
printf("%s:%d\n", __func__, __LINE__);
svcWaitSynchronization(*info->errInfo->failEvent, U64_MAX); svcWaitSynchronization(*info->errInfo->failEvent, U64_MAX);
printf("%s:%d\n", __func__, __LINE__);
svcClearEvent(*info->errInfo->failEvent); svcClearEvent(*info->errInfo->failEvent);
printf("%s:%d\n", __func__, __LINE__);
consoleSelect(info->screen); consoleSelect(info->screen);
printf("Here %s:%d err:%d\n", __func__, __LINE__, *info->errInfo->error);
if(*info->errInfo->error != 0) if(*info->errInfo->error != 0)
{ {
printf("An error occurred: %s", ctrmus_strerror(*info->errInfo->error)); printf("Error %d: %s", *info->errInfo->error,
ctrmus_strerror(*info->errInfo->error));
if(info->errInfo->errstr != NULL) if(info->errInfo->errstr != NULL)
{ {
printf(" %s", info->errInfo->errstr); printf(" %s", info->errInfo->errstr);

View File

@@ -7,6 +7,11 @@
* LICENSE file. * LICENSE file.
*/ */
#ifndef ctrmus_main_h
#define ctrmus_main_h
#include "playback.h"
/* Default folder */ /* Default folder */
#define DEFAULT_DIR "sdmc:/" #define DEFAULT_DIR "sdmc:/"
@@ -42,3 +47,5 @@ int getNumberFiles(void);
* \return Number of entries listed or negative on error. * \return Number of entries listed or negative on error.
*/ */
int listDir(int from, int max, int select); int listDir(int from, int max, int select);
#endif

View File

@@ -1,3 +1,6 @@
#ifndef ctrmus_playback_h
#define ctrmus_playback_h
enum file_types enum file_types
{ {
FILE_TYPE_ERROR = -1, FILE_TYPE_ERROR = -1,
@@ -34,3 +37,5 @@ bool isPlaying(void);
* \return File type, else negative. * \return File type, else negative.
*/ */
int getFileType(const char *file); int getFileType(const char *file);
#endif