gme_err_t Music_Player::load_file( const char* path ) { stop(); RETURN_ERR( gme_open_file( path, &emu_, sample_rate ) ); char m3u_path [256 + 5]; strncpy( m3u_path, path, 256 ); m3u_path [256] = 0; char* p = strrchr( m3u_path, '.' ); if ( !p ) p = m3u_path + strlen( m3u_path ); strcpy( p, ".m3u" ); if ( gme_load_m3u( emu_, m3u_path ) ) { } // ignore error return 0; }
jint Java_de_illogical_modo_GmeDecoder_gmeLoadM3u(JNIEnv* env, jclass clazz, jstring path) { if (emu == NULL) return 0; char cpath[1024]; memset(cpath, 0, 1024); int clen = (*env)->GetStringLength(env, path); if (clen > 1023) return 0; (*env)->GetStringUTFRegion(env, path, 0, clen, cpath); gme_err_t err = gme_load_m3u(emu, cpath); //__android_log_print(ANDROID_LOG_VERBOSE, "gme", "LoadM3u: %s", err == NULL ? "null" : err); return err == NULL; }