summaryrefslogtreecommitdiff
path: root/apps/codecs/nsf.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/nsf.c')
-rw-r--r--apps/codecs/nsf.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/apps/codecs/nsf.c b/apps/codecs/nsf.c
index b1bfb82dcd..92d0240200 100644
--- a/apps/codecs/nsf.c
+++ b/apps/codecs/nsf.c
@@ -4294,12 +4294,18 @@ jammed:
4294 4294
4295/****************** rockbox interface ******************/ 4295/****************** rockbox interface ******************/
4296 4296
4297/** Operational info **/
4298static int track = 0;
4299static char last_path[MAX_PATH];
4300static int dontresettrack = 0;
4301static bool repeat_one = false;
4302
4297static void set_codec_track(int t, int d) { 4303static void set_codec_track(int t, int d) {
4298 int track,fade,def=0; 4304 int track,fade,def=0;
4299 SetTrack(t); 4305 SetTrack(t);
4300 4306
4301 /* for REPEAT_ONE we disable track limits */ 4307 /* for REPEAT_ONE we disable track limits */
4302 if (ci->global_settings->repeat_mode!=REPEAT_ONE) { 4308 if (!repeat_one) {
4303 if (!bIsExtended || nTrackTime[t]==-1) {track=60*2*1000; def=1;} 4309 if (!bIsExtended || nTrackTime[t]==-1) {track=60*2*1000; def=1;}
4304 else track=nTrackTime[t]; 4310 else track=nTrackTime[t];
4305 if (!bIsExtended || nTrackFade[t]==-1) fade=5*1000; 4311 if (!bIsExtended || nTrackFade[t]==-1) fade=5*1000;
@@ -4310,11 +4316,6 @@ static void set_codec_track(int t, int d) {
4310 ci->set_elapsed(d*1000); /* d is track no to display */ 4316 ci->set_elapsed(d*1000); /* d is track no to display */
4311} 4317}
4312 4318
4313/** Operational info **/
4314static int track = 0;
4315static char last_path[MAX_PATH];
4316static int dontresettrack = 0;
4317
4318/* this is the codec entry point */ 4319/* this is the codec entry point */
4319enum codec_status codec_main(enum codec_entry_call_reason reason) 4320enum codec_status codec_main(enum codec_entry_call_reason reason)
4320{ 4321{
@@ -4356,6 +4357,8 @@ enum codec_status codec_run(void)
4356 DEBUGF("NSF: file load failed\n"); 4357 DEBUGF("NSF: file load failed\n");
4357 return CODEC_ERROR; 4358 return CODEC_ERROR;
4358 } 4359 }
4360
4361 repeat_one = ci->global_settings->repeat_mode == REPEAT_ONE;
4359 4362
4360init_nsf: 4363init_nsf:
4361 if(!NSFCore_Initialize()) { 4364 if(!NSFCore_Initialize()) {
@@ -4368,21 +4371,11 @@ init_nsf:
4368 if(!LoadNSF(nDataBufferSize)) { 4371 if(!LoadNSF(nDataBufferSize)) {
4369 DEBUGF("NSF: LoadNSF failed\n"); return CODEC_ERROR;} 4372 DEBUGF("NSF: LoadNSF failed\n"); return CODEC_ERROR;}
4370 4373
4371 ci->id3->title=szGameTitle;
4372 ci->id3->artist=szArtist;
4373 ci->id3->album=szCopyright;
4374 if (usingplaylist) {
4375 ci->id3->length=nPlaylistSize*1000;
4376 } else {
4377 ci->id3->length=nTrackCount*1000;
4378 }
4379
4380 if (!dontresettrack||strcmp(ci->id3->path,last_path)) { 4374 if (!dontresettrack||strcmp(ci->id3->path,last_path)) {
4381 /* if this is the first time we're seeing this file, or if we haven't 4375 /* if this is the first time we're seeing this file, or if we haven't
4382 been asked to preserve the track number, default to the proper 4376 been asked to preserve the track number, default to the proper
4383 initial track */ 4377 initial track */
4384 if (bIsExtended && 4378 if (bIsExtended && !repeat_one && nPlaylistSize>0) {
4385 ci->global_settings->repeat_mode!=REPEAT_ONE && nPlaylistSize>0) {
4386 /* decide to use the playlist */ 4379 /* decide to use the playlist */
4387 usingplaylist=1; 4380 usingplaylist=1;
4388 track=0; 4381 track=0;
@@ -4447,7 +4440,7 @@ init_nsf:
4447 4440
4448 print_timers(last_path,track); 4441 print_timers(last_path,track);
4449 4442
4450 if (ci->global_settings->repeat_mode==REPEAT_ONE) { 4443 if (repeat_one) {
4451 /* in repeat one mode just advance to the next track */ 4444 /* in repeat one mode just advance to the next track */
4452 track++; 4445 track++;
4453 if (track>=nTrackCount) track=0; 4446 if (track>=nTrackCount) track=0;