Documentation ¶
Overview ¶
Package gdi implements parsing of Sega Dreamcast GDI files. Basic checks are performed pre-marshalling or post-unmarshalling to ensure it is valid.
Index ¶
Examples ¶
Constants ¶
View Source
const ( // Extension is the conventional file extension used Extension = ".gdi" // SectorSize is the standard sector size used for tracks SectorSize = 2352 // TrackThreeStart is the starting sector for track three, the // beginning of the high density area TrackThreeStart = 45000 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct { // Count is the number of tracks in the GDI file Count int // Tracks contains each track Tracks []Track // Flags manages any additional formatting tweaks Flags Flag }
File represents a GDI file
func (File) IsValid ¶
IsValid checks if the GDI file is valid or not
Example ¶
file := File{ Count: 3, Tracks: []Track{ { Number: 1, Start: 0, Type: TypeData, SectorSize: SectorSize, Name: "track01.bin", Zero: 0, }, { Number: 2, Start: 756, Type: TypeAudio, SectorSize: SectorSize, Name: "track02.raw", Zero: 0, }, { Number: 3, Start: TrackThreeStart, Type: TypeData, SectorSize: SectorSize, Name: "track03.bin", Zero: 0, }, }, Flags: 0, } fmt.Println(file.IsValid())
Output: true
func (File) MarshalText ¶
MarshalText encodes the GDI file into textual form
Example ¶
file := File{ Count: 3, Tracks: []Track{ { Number: 1, Start: 0, Type: TypeData, SectorSize: SectorSize, Name: "track01.bin", Zero: 0, }, { Number: 2, Start: 756, Type: TypeAudio, SectorSize: SectorSize, Name: "track02.raw", Zero: 0, }, { Number: 3, Start: TrackThreeStart, Type: TypeData, SectorSize: SectorSize, Name: "track03.bin", Zero: 0, }, }, Flags: 0, } gdi, err := file.MarshalText() if err != nil { panic(err) } fmt.Println(string(gdi))
Output: 3 1 0 4 2352 track01.bin 0 2 756 0 2352 track02.raw 0 3 45000 4 2352 track03.bin 0
func (*File) UnmarshalText ¶
UnmarshalText decodes the GDI file from textual form
Example ¶
gdi := `3 1 0 4 2352 track01.bin 0 2 756 0 2352 track02.raw 0 3 45000 4 2352 track03.bin 0 ` file := new(File) if err := file.UnmarshalText([]byte(gdi)); err != nil { panic(err) } fmt.Println(file)
Output: &{3 [{1 0 4 2352 track01.bin 0} {2 756 0 2352 track02.raw 0} {3 45000 4 2352 track03.bin 0}] 0}
type Track ¶
type Track struct { // Number is the track number Number int // Start refers to the first sector of the track Start int // Type refers to the type of track, audio or data Type Type // SectorSize is the sector size used by the track SectorSize int // Name is the filename of the track relative to the GDI file Name string // Zero is always set to zero Zero int }
Track represents a single track within a GDI file
func (Track) IsAudioTrack ¶
IsAudioTrack returns true if the track is audio
Example ¶
track := Track{ Number: 2, Start: 756, Type: TypeAudio, SectorSize: SectorSize, Name: "track02.raw", Zero: 0, } fmt.Println(track.IsAudioTrack())
Output: true
func (Track) IsDataTrack ¶
IsDataTrack returns true if the track is data
Example ¶
track := Track{ Number: 1, Start: 0, Type: TypeData, SectorSize: SectorSize, Name: "track01.bin", Zero: 0, } fmt.Println(track.IsDataTrack())
Output: true
Click to show internal directories.
Click to hide internal directories.