marquee

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2020 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package marquee implements support for encoding and decoding .mrq Marquee files as found on the RetroHQ Jaguar SD/GD cartridge.

Index

Examples

Constants

View Source
const (
	// Extension is the file extension used
	Extension = ".mrq"
	// BoxWidth is the width of the box artwork image
	BoxWidth = 88
	// BoxHeight is the height of the box artwork image
	BoxHeight = 124
	// ScreenshotWidth is the width of the screenshot image
	ScreenshotWidth = 88
	// ScreenshotHeight is the height of the screenshot image
	ScreenshotHeight = 56
)
View Source
const (
	EEPROM128 uint = iota
	EEPROM256or512
	EEPROM1024or2048
	MemoryTrack
)

These are the various EEPROM sizes that cartridges/ROM images may have

Variables

This section is empty.

Functions

This section is empty.

Types

type Marquee

type Marquee struct {
	Title      string
	Developer  string
	Publisher  string
	Year       string
	EEPROM     uint
	LoadAddr   uint32
	ExecAddr   uint32
	Box        image.Image
	Screenshot image.Image
	// contains filtered or unexported fields
}

Marquee represents a .mrq file. It implements the encoding.BinaryMarshaler and encoding.BinaryUnmarshaler interfaces.

func NewMarquee

func NewMarquee() (*Marquee, error)

NewMarquee returns an empty Marquee with the two images initialised to the correct dimensions

func (*Marquee) MarshalBinary

func (m *Marquee) MarshalBinary() ([]byte, error)

MarshalBinary encodes the marquee into binary form and returns the result

Example
m, err := NewMarquee()
if err != nil {
	panic(err)
}

m.Title = "Tempest 2000"
m.Developer = "Llamasoft"
m.Publisher = "Atari Corporation"
m.Year = "1994"

b, err := m.MarshalBinary()
if err != nil {
	panic(err)
}

// Not including the box art and screenshot
fmt.Print(hex.Dump(b[:0x72]))
Output:

00000000  4d 51 00 00 54 65 6d 70  65 73 74 20 32 30 30 30  |MQ..Tempest 2000|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 4c 6c 61 6d  61 73 6f 66 74 00 00 00  |....Llamasoft...|
00000040  00 00 00 00 00 00 00 00  00 00 00 00 41 74 61 72  |............Atar|
00000050  69 20 43 6f 72 70 6f 72  61 74 69 6f 6e 00 00 00  |i Corporation...|
00000060  00 00 00 00 31 39 39 34  00 00 00 00 00 00 00 00  |....1994........|
00000070  00 00                                             |..|

func (*Marquee) UnmarshalBinary

func (m *Marquee) UnmarshalBinary(b []byte) error

UnmarshalBinary decodes the marquee from binary form

Example
m, err := NewMarquee()
if err != nil {
	panic(err)
}

b, err := ioutil.ReadFile(filepath.Join("testdata", "Tempest 2000"+Extension))
if err != nil {
	panic(err)
}

if err := m.UnmarshalBinary(b); err != nil {
	panic(err)
}

fmt.Println(m.Title)
Output:

Tempest 2000

Jump to

Keyboard shortcuts

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