dreamcast

package module
v0.0.0-...-682bba6 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: BSD-3-Clause Imports: 16 Imported by: 0

README

Build Status Coverage Status Go Report Card GoDoc

dreamcast

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GDemuTrackName

func GDemuTrackName(track gdi.Track) string

GDemuTrackName is a track renaming function that names each track how a GDemu device expects them

Types

type DirectoryReader

type DirectoryReader struct {
	// contains filtered or unexported fields
}

DirectoryReader reads a Dreamcast game from a directory

func NewDirectoryReader

func NewDirectoryReader(directory string) (r *DirectoryReader, err error)

NewDirectoryReader returns a DirectoryReader using the passed directory path

func (DirectoryReader) Close

func (r DirectoryReader) Close() error

Close closes the directory

func (DirectoryReader) FileSize

func (r DirectoryReader) FileSize(filename string) (uint64, error)

FileSize returns the size of the named file

func (DirectoryReader) FindCueFile

func (r DirectoryReader) FindCueFile() (io.ReadCloser, string, error)

FindCueFile reads the directory and returns an io.ReadCloser for, and the filename of, the first cue file found

func (DirectoryReader) FindGDIFile

func (r DirectoryReader) FindGDIFile() (io.ReadCloser, string, error)

FindGDIFile reads the directory and returns an io.ReadCloser for, and the filename of, the first GDI file found

func (DirectoryReader) OpenFile

func (r DirectoryReader) OpenFile(filename string) (io.ReadCloser, error)

OpenFile returns an io.ReadCloser for the named file

func (DirectoryReader) Rx

func (r DirectoryReader) Rx() uint64

Rx returns the number of bytes read

type DirectoryWriter

type DirectoryWriter struct {
	// contains filtered or unexported fields
}

DirectoryWriter writes a Dreamcast game to a directory

func NewDirectoryWriter

func NewDirectoryWriter(directory string, config WriterConfig) (*DirectoryWriter, error)

NewDirectoryWriter returns a DirectoryWriter using the passed directory path and config

func (DirectoryWriter) Close

func (w DirectoryWriter) Close() error

Close closes the directory

func (DirectoryWriter) Config

func (w DirectoryWriter) Config() WriterConfig

Config returns the WriterConfig associated with this writer

func (*DirectoryWriter) CreateFile

func (w *DirectoryWriter) CreateFile(filename string) (io.WriteCloser, error)

CreateFile creates the named file in the directory and returns an io.WriteCloser for it

func (DirectoryWriter) Tx

func (w DirectoryWriter) Tx() uint64

Tx returns the number of bytes written

type Game

type Game struct {
	// GDIFile is the name of the GDI file that was read
	GDIFile string
	// CueFile is the name of the cue file that was read
	CueFile string
	// IPBin represents the IP.BIN initial program found in the third track
	IPBin *IPBin
	// contains filtered or unexported fields
}

Game represents a Sega Dreamcast game image

func NewGame

func NewGame(reader Reader) (*Game, error)

NewGame returns a Game object read using the passed Reader. A GDI file is searched for first, followed by a cue sheet.

func (Game) Write

func (g Game) Write(writer Writer) error

type IPBin

type IPBin struct {
	HardwareID     string
	MakerID        string
	CRC            uint16
	Disc           int
	TotalDiscs     int
	Regions        Region
	Peripherals    uint32
	ProductNumber  string
	ProductVersion string
	ReleaseDate    time.Time
	BootFilename   string
	Producer       string
	SoftwareName   string
	TOC            []Track
	// contains filtered or unexported fields
}

IPBin represents the IP.BIN initial program. It implements the encoding.BinaryUnmarshaler interface.

func (IPBin) String

func (ip IPBin) String() string

func (*IPBin) UnmarshalBinary

func (ip *IPBin) UnmarshalBinary(b []byte) error

UnmarshalBinary decodes the IP.BIN from binary form

type Peripheral

type Peripheral int

Peripheral maps to each peripheral option

const (
	PeripheralWindowsCE Peripheral = 1 << iota

	PeripheralVGABox

	PeripheralOtherExpansions
	PeripheralVibrationPack
	PeripheralMicrophone
	PeripheralMemoryCard
	PeripheralStartABDirections
	PeripheralCButton
	PeripheralDButton
	PeripheralXButton
	PeripheralYButton
	PeripheralZButton
	PeripheralExpandedDirections
	PeripheralRTrigger
	PeripheralLTrigger
	PeripheralHorizontal
	PeripheralVertical
	PeripheralExpandedHorizontal
	PeripheralExpandedVertical
	PeripheralGun
	PeripheralKeyboard
	PeripheralMouse
)

These are the individual peripherals

func (Peripheral) IsSet

func (p Peripheral) IsSet(peripherals uint32) bool

IsSet returns true if the given peripheral is set

type Reader

type Reader interface {
	// Close closes the source
	Close() error
	// FindGDIFile returns an io.ReadCloser opened on, and the filename
	// of, the first GDI file found
	FindGDIFile() (io.ReadCloser, string, error)
	// FindCueFile returns an io.ReadCloser opened on, and the filename
	// of, the first cue sheet found
	FindCueFile() (io.ReadCloser, string, error)
	// OpenFile returns an io.ReadCloser opened on the named file
	OpenFile(string) (io.ReadCloser, error)
	// FileSize returns the size of the named file
	FileSize(string) (uint64, error)
	// Rx returns the number of bytes read
	Rx() uint64
}

Reader is the interface implemented by an object that can be used as a source for reading a Dreamcast game image from disk

type Region

type Region [offsetPeripherals - offsetAreaSymbols]byte

Region represents the permitted regions

func (Region) IsRegionEurope

func (r Region) IsRegionEurope() bool

IsRegionEurope returns true if Europe region is permitted

func (Region) IsRegionJapan

func (r Region) IsRegionJapan() bool

IsRegionJapan returns true if Japan region is permitted

func (Region) IsRegionUSA

func (r Region) IsRegionUSA() bool

IsRegionUSA returns true if USA region is permitted

func (Region) String

func (r Region) String() string

type Track

type Track struct {
	// Start refers to the first sector of the track
	Start int
	// Length refers to the length of the track in sectors
	Length int
	// Type is the type of track, audio or data
	Type int
}

Track represents a TOC entry found in the IP.BIN initial program

func (Track) IsAudioTrack

func (t Track) IsAudioTrack() bool

IsAudioTrack returns true if the track is an audio track

func (Track) IsDataTrack

func (t Track) IsDataTrack() bool

IsDataTrack returns true if the track is a data track

type Writer

type Writer interface {
	// Close closes the destination
	Close() error
	// CreateFile returns an io.WriteCloser opened on the named file
	CreateFile(string) (io.WriteCloser, error)
	// Config returns the WriterConfig associated with this writer
	Config() WriterConfig
	// Tx returns the number of bytes written
	Tx() uint64
}

Writer is the interface implemented by an object that can be used as a destination for writing a Dreamcast game image to disk

type WriterConfig

type WriterConfig struct {
	// CueFile is the target filename for a cue file
	CueFile string
	// GDIFile is the target filename for a GDI file
	GDIFile string
	// TrackRename is a function to rename tracks. The function is passed
	// a gdi.Track object and returns a string representing the desired
	// filename
	TrackRename func(gdi.Track) string
	// TrimWhitespace controls whether extra passing whitespace is removed
	// from either the GDI or cue file where applicable
	TrimWhitespace bool
}

WriterConfig contains the configuration of the Writer

type ZipFileReader

type ZipFileReader struct {
	// contains filtered or unexported fields
}

ZipFileReader reads a Dreamcast game from a zip archive

func NewZipFileReader

func NewZipFileReader(zipFile string) (r *ZipFileReader, err error)

NewZipFileReader returns a ZipFileReader using the passed zip file path

func (ZipFileReader) Close

func (r ZipFileReader) Close() error

Close closes the zip file

func (ZipFileReader) FileSize

func (r ZipFileReader) FileSize(filename string) (uint64, error)

FileSize returns the size of the named file

func (ZipFileReader) FindCueFile

func (r ZipFileReader) FindCueFile() (io.ReadCloser, string, error)

FindCueFile reads the zip file and returns an io.ReadCloser for, and the filename of, the first cue file found

func (ZipFileReader) FindGDIFile

func (r ZipFileReader) FindGDIFile() (io.ReadCloser, string, error)

FindGDIFile reads the zip file and returns an io.ReadCloser for, and the filename of, the first GDI file found

func (ZipFileReader) OpenFile

func (r ZipFileReader) OpenFile(filename string) (io.ReadCloser, error)

OpenFile returns an io.ReadCloser for the named file

func (ZipFileReader) Rx

func (r ZipFileReader) Rx() uint64

Rx returns the number of bytes read

type ZipFileWriter

type ZipFileWriter struct {
	// contains filtered or unexported fields
}

ZipFileWriter writes a Dreamcast game to a zip archive

func NewZipFileWriter

func NewZipFileWriter(filename string, config WriterConfig) (*ZipFileWriter, error)

NewZipFileWriter returns a ZipFileWriter using the passed zip file path and config

func (ZipFileWriter) Close

func (w ZipFileWriter) Close() error

Close closes the zip file

func (ZipFileWriter) Config

func (w ZipFileWriter) Config() WriterConfig

Config returns the WriterConfig associated with this writer

func (ZipFileWriter) CreateFile

func (w ZipFileWriter) CreateFile(filename string) (io.WriteCloser, error)

CreateFile create the named file in the zip file and returns an io.WriteCloser for it

func (ZipFileWriter) Tx

func (w ZipFileWriter) Tx() uint64

Tx returns the number of bytes written

Directories

Path Synopsis
Package gdi implements parsing of Sega Dreamcast GDI files.
Package gdi implements parsing of Sega Dreamcast GDI files.

Jump to

Keyboard shortcuts

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