Mercurial > audlegacy
diff Plugins/Input/console/Audacious_Driver.cpp @ 1196:ec7998847818 trunk
[svn] - some JMA stuff
| author | nenolod |
|---|---|
| date | Tue, 13 Jun 2006 22:16:47 -0700 |
| parents | 69b1707d83a5 |
| children | 311c4a27c3dd |
line wrap: on
line diff
--- a/Plugins/Input/console/Audacious_Driver.cpp Tue Jun 13 21:23:52 2006 -0700 +++ b/Plugins/Input/console/Audacious_Driver.cpp Tue Jun 13 22:16:47 2006 -0700 @@ -32,6 +32,7 @@ #include "Track_Emu.h" #include "Vfs_File.h" #include "Gzip_File.h" +#include "Jma_File.h" #include "blargg_endian.h" //typedef Vfs_File_Reader Audacious_Reader; // will use VFS once it handles gzip transparently @@ -73,6 +74,7 @@ int length; // in msec, -1 = unknown int loop; // in msec, -1 = unknown, 0 = not looped int intro; // in msec, -1 = unknown + gchar *jma_spec; TitleInput* ti; }; @@ -394,7 +396,7 @@ // File identification -enum { type_none = 0, type_spc, type_nsf, type_nsfe, type_vgm, type_gbs, type_gym }; +enum { type_none = 0, type_spc, type_nsf, type_nsfe, type_vgm, type_gbs, type_gym, type_jma }; int const tag_size = 4; typedef char tag_t [tag_size]; @@ -413,6 +415,7 @@ if ( !memcmp( tag, "GYMX", 4 ) ) result = type_gym; if ( !memcmp( tag, "GBS" , 3 ) ) result = type_gbs; if ( !memcmp( tag, "Vgm ", 4 ) ) result = type_vgm; + if ( !memcmp( tag, "JMA" , 3 ) ) result = type_jma; return result; } @@ -583,22 +586,34 @@ // open and identify file unload_file(); Audacious_Reader in; + Jma_File_Reader in_jma; // to do: integrate somehow into Audacious_Reader (?) tag_t tag; // extract the subsong id from the virtual path gchar *path2 = g_strdup(path); gchar *_path = strchr(path2, '?'); + gchar *jmaspec = NULL; if (_path != NULL && *_path == '?') { *_path = '\0'; _path++; track = atoi(_path); + jmaspec = _path; } - if ( in.open( path2 ) || in.read( tag, sizeof tag ) ) - return; int type = identify_file( path2, tag ); + + if ( type != type_jma ) + { + if ( in.open( path2 ) || in.read( tag, sizeof tag ) ) + return; + } + else + { + if ( in_jma.open( path2, jmaspec ) || in.read( tag, sizeof tag ) ) + return; + } // setup info long sample_rate = 44100; @@ -620,6 +635,7 @@ case type_gym: load_file( tag, in, sample_rate, &info, (Gym_Emu*) 0 ); break; case type_vgm: load_file( tag, in, sample_rate, &info, (Vgm_Emu*) 0 ); break; case type_spc: load_file( tag, in, sample_rate, &info, (Spc_Emu*) 0 ); break; + case type_jma: load_file( tag, in_jma, sample_rate, &info, (Spc_Emu*) 0 ); break; } in.close(); if ( !emu )
