base code for various tes format loaders