dat

package
v0.16.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package dat is a parser for dat files, a binary database of games with metadata also used by RetroArch.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CRC

type CRC uint32

CRC is the CRC32 checksum of a ROM

func (*CRC) UnmarshalXMLAttr

func (s *CRC) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr is used to parse a hex number in string form to uint

type DB

type DB map[string]Dat

DB is a database that contains many Dats, mapped to their system name

func (*DB) FindByCRC

func (db *DB) FindByCRC(romPath string, romName string, crc uint32, games chan (Game))

FindByCRC loops over the Dats in the DB and concurrently matches CRC checksums.

func (*DB) FindByROMName

func (db *DB) FindByROMName(romPath string, romName string, crc uint32, games chan (Game))

FindByROMName loops over the Dats in the DB and concurrently matches ROM names.

type Dat

type Dat struct {
	XMLName xml.Name `xml:"datafile"`
	Games   []Game   `xml:"game"`
}

Dat is a list of the games of a system

func Parse

func Parse(dat []byte) Dat

Parse parses a .dat file content and returns an array of Entries

type Game

type Game struct {
	XMLName     xml.Name `xml:"game"`
	Name        string   `xml:"name,attr"`
	Description string   `xml:"description"` // The human readable name of the game
	ROMs        []ROM    `xml:"rom"`

	Path   string
	System string
}

Game represents a game and can contain a list of ROMs

type ROM

type ROM struct {
	XMLName xml.Name `xml:"rom"`
	Name    string   `xml:"name,attr"`
	CRC     CRC      `xml:"crc,attr"`
}

ROM can be a game file or part of a game

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL