func DetectFormat(filePath string) (*FormatInfo, error) {
	return detectFormat(filePath, ENCAPSULATION_NONE, true)
}
Determines the format of the specified file based on its name,
or based on the names of embedded files in case the file is an archive.
Returns an error if the format could not be detected.
package formats
import (
	"errors"
	"io/ioutil"
	"path"
	"strings"
)
const (
	TStatesPerFrame = 69888
	InterruptLength = 32
)
type CpuState struct {
	A, F, B, C, D, E, H, L         byte
	A_, F_, B_, C_, D_, E_, H_, L_ byte
	IX, IY                         uint16
	I, R, IFF1, IFF2, IM           byte
	SP, PC                         uint16
	Tstate uint
}
type UlaState struct {
	Border byte
}
type Snapshot interface {
	CpuState() CpuState
	UlaState() UlaState
	Memory() *[48 * 1024]byte
}
type FullSnapshot struct {
	Cpu CpuState
	Ula UlaState
	Mem [48 * 1024]byte
}
func (s *FullSnapshot) CpuState() CpuState {
	return s.Cpu
}
func (s *FullSnapshot) UlaState() UlaState {
	return s.Ula
}
func (s *FullSnapshot) Memory() *[48 * 1024]byte {
	return &s.Mem
}
type SnapshotData []byte
type Archive interface {
	Filenames() []string
	Read(fileIndex int) ([]byte, error)
}
const (
	FORMAT_SNA = iota
	FORMAT_Z80
	FORMAT_TAP
)
const (
	ENCAPSULATION_NONE = iota
	ENCAPSULATION_ZIP
)
type FormatInfo struct {
	Format        int
	Encapsulation int
}