void InitDecoder() { CleanupDecoder(); fex_init(); const fex_type_t * type_list = fex_type_list(); for(unsigned int i = 0; type_list[i]; i++) { ArchiveFormatInfo info; const char * extension = fex_type_extension(type_list[i]); if (strlen(extension) == 0) continue; info.name = fex_type_name(type_list[i]); info.extensions.push_back(extension + 1); // all extensions have a period on them info.type = type_list[i]; const char ** signatures = fex_type_signatures(type_list[i]); for (unsigned int j = 0; signatures[j]; j++) { info.signatures.push_back(signatures[j]); } s_formatInfos.push_back(info); } }
BLARGG_EXPORT fex_err_t fex_init( void ) { static bool inited; if ( !inited ) { for ( fex_type_t const* t = fex_type_list(); *t != NULL; ++t ) { if ( (*t)->init ) RETURN_ERR( (*t)->init() ); } inited = true; } return blargg_ok; }
BLARGG_EXPORT fex_type_t fex_identify_extension( const char str [] ) { size_t str_len = strlen( str ); for ( fex_type_t const* types = fex_type_list(); *types; types++ ) { if ( fex_has_extension_( str, (*types)->extension, str_len ) ) { // Avoid treating known archive type as binary if ( *(*types)->extension || !is_archive_extension( str ) ) return *types; } } return NULL; }