/* Start application */
int start_application(char *filename)
{
  rb->strcpy( szRomName, filename );

  if(InfoNES_Load(szRomName)==0) {
    LoadSRAM();
    return 1;
  }
  return 0;
}
BOOL InfoNES_LoadRomFile(
		JNIEnv * pEnv,
		NES_CONTEXT *pNesContext,
		const char *pFilename,
		BOOL bLoadRAM)
{
	LOGV("InfoNES_LoadRomFile start");
	if( (0 == pEnv) 
		|| (0 == pNesContext)
		|| (0 == InfoNES_CheckContext(pNesContext)) 
		||(NULL == pFilename) )
	{
//		InfoNES_PrintErrInfo("InfoNES_LoadRomFile failed 1");
		return FALSE;
	}

	// �����NES�߳������У��ȹر�
	InfoNES_StopThread(pEnv, pNesContext, FALSE);

	if ( sizeof(szRomName) < strlen(pFilename) ) {
//		InfoNES_PrintErrInfo("InfoNES_LoadRomFile failed 2");
		return FALSE;
	}

	// Load cassette
	if ( 0 != InfoNES_Load( pFilename ) )
	{
//		InfoNES_PrintErrInfo("InfoNES_LoadRomFile failed 3");
		return FALSE;
	}
	// Set a ROM image name
	strcpy( szRomName, pFilename );
	// The preparation of the SRAM file name
	strcpy( szSaveName, pFilename );
//	strcpy( strrchr( szSaveName, '.' ) + 1, "srm" );
	strcat( szSaveName, ".srm" );
	// Load SRAM
	LOGI("InfoNES_LoadRomFile() bLoadRAM = %d", bLoadRAM );
	// Initialize InfoNES
	InfoNES_Init();
	if( bLoadRAM )
	{
		InfoNES_LoadSRAM(szSaveName);
	}

	return InfoNES_StartThread(pEnv, pNesContext);
}