Mercurial > audlegacy
comparison Plugins/Input/console/Audacious_Driver.cpp @ 1125:790c3a23eea2 trunk
[svn] - allow paths like /home/nenolod/moo/ff3/ff3.nsf?6 to play subsong 6 from ff3.nsf.
| author | nenolod |
|---|---|
| date | Sat, 03 Jun 2006 11:13:29 -0700 |
| parents | 8f1b7d07bef5 |
| children | 537e8cc47060 |
comparison
equal
deleted
inserted
replaced
| 1124:a63e0fdb3d1e | 1125:790c3a23eea2 |
|---|---|
| 402 { | 402 { |
| 403 // GYM file format doesn't require *any* header, just the ".gym" extension | 403 // GYM file format doesn't require *any* header, just the ".gym" extension |
| 404 if ( g_str_has_suffix( path, ".gym" ) ) // to do: is pathname in unicode? | 404 if ( g_str_has_suffix( path, ".gym" ) ) // to do: is pathname in unicode? |
| 405 return type_gym; | 405 return type_gym; |
| 406 // to do: trust suffix for all file types, avoiding having to look inside files? | 406 // to do: trust suffix for all file types, avoiding having to look inside files? |
| 407 | 407 |
| 408 int result = type_none; | 408 int result = type_none; |
| 409 if ( !memcmp( tag, "SNES", 4 ) ) result = type_spc; | 409 if ( !memcmp( tag, "SNES", 4 ) ) result = type_spc; |
| 410 if ( !memcmp( tag, "NESM", 4 ) ) result = type_nsf; | 410 if ( !memcmp( tag, "NESM", 4 ) ) result = type_nsf; |
| 411 if ( !memcmp( tag, "NSFE", 4 ) ) result = type_nsfe; | 411 if ( !memcmp( tag, "NSFE", 4 ) ) result = type_nsfe; |
| 412 if ( !memcmp( tag, "GYMX", 4 ) ) result = type_gym; | 412 if ( !memcmp( tag, "GYMX", 4 ) ) result = type_gym; |
| 417 | 417 |
| 418 static gint is_our_file( gchar* path ) | 418 static gint is_our_file( gchar* path ) |
| 419 { | 419 { |
| 420 Audacious_Reader in; | 420 Audacious_Reader in; |
| 421 tag_t tag; | 421 tag_t tag; |
| 422 | |
| 423 printf("path: %s\n", path); | |
| 424 | |
| 425 // extract the subsong id from the virtual path | |
| 426 gchar *_path = strchr(path, '?'); | |
| 427 | |
| 428 if (_path != NULL && *_path == '?') | |
| 429 { | |
| 430 *_path = '\0'; | |
| 431 _path++; | |
| 432 } | |
| 433 | |
| 434 printf("modified path: %s\n", path); | |
| 435 | |
| 422 return !in.open( path ) && !in.read( tag, sizeof tag ) && identify_file( path, tag ); | 436 return !in.open( path ) && !in.read( tag, sizeof tag ) && identify_file( path, tag ); |
| 423 } | 437 } |
| 424 | 438 |
| 425 // Get info | 439 // Get info |
| 426 | 440 |
| 571 | 585 |
| 572 // open and identify file | 586 // open and identify file |
| 573 unload_file(); | 587 unload_file(); |
| 574 Audacious_Reader in; | 588 Audacious_Reader in; |
| 575 tag_t tag; | 589 tag_t tag; |
| 590 | |
| 591 // extract the subsong id from the virtual path | |
| 592 gchar *_path = strchr(path, '?'); | |
| 593 | |
| 594 if (_path != NULL && *_path == '?') | |
| 595 { | |
| 596 *_path = '\0'; | |
| 597 _path++; | |
| 598 track = atoi(_path); | |
| 599 } | |
| 600 | |
| 601 printf("path: %s\nsubsong: %d\n", path, track); | |
| 602 | |
| 576 if ( in.open( path ) || in.read( tag, sizeof tag ) ) | 603 if ( in.open( path ) || in.read( tag, sizeof tag ) ) |
| 577 return; | 604 return; |
| 578 int type = identify_file( path, tag ); | 605 int type = identify_file( path, tag ); |
| 579 | 606 |
| 580 // setup info | 607 // setup info |
