Documentation
¶
Overview ¶
Package wud implements reading of Nintendo Wii-U disc images. These can either be a regular 23 GB file, split into 2 GB parts, or compressed.
Example usage:
import (
"io"
"os"
"github.com/bodgit/wud"
"github.com/bodgit/wud/wux"
"github.com/hashicorp/go-multierror"
)
// openFile will first try and open name as a compressed image, then as
// a regular or split image.
func openFile(name string) (wud.Reader, io.Closer, error) {
f, err := os.Open(name)
if err != nil {
return nil, nil ,err
}
if r, err := wux.NewReader(f); err != nil {
if err != wux.ErrBadMagic {
return nil, nil, multierror.Append(err, f.Close())
}
if err = f.Close(); err != nil {
return nil, nil, err
}
} else {
return r, f, nil
}
rc, err := wud.OpenReader(name)
if err != nil {
return nil, nil, err
}
return rc, rc, nil
}
func main() {
r, c, err := openFile(os.Args[1])
if err != nil {
panic(err)
}
defer c.Close()
commonKey, err := os.ReadFile(os.Args[2])
if err != nil {
panic(err)
}
gameKey, err := os.ReadFile(os.Args[3])
if err != nil {
panic(err)
}
w, err := wud.NewWUD(r, commonKey, gameKey)
if err != nil {
panic(err)
}
if err = w.Extract(os.Args[4]); err != nil {
panic(err)
}
}
Index ¶
Constants ¶
View Source
const ( // Extension is the conventional file extension used Extension = ".wud" // SectorSize is the sector size for Wii-U disc images SectorSize uint32 = 0x8000 // UncompressedSize is the uncompressed size for Wii-U disc images UncompressedSize uint64 = 25025314816 // CommonKeyFile represents the standard "common.key" filename CommonKeyFile = "common.key" // GameKeyFile represents the standard "game.key" filename GameKeyFile = "game.key" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReadCloser ¶
A ReadCloser extends the Reader interface to also have a Close method.
func OpenReader ¶
func OpenReader(name string) (ReadCloser, error)
OpenReader opens the disc image indicated by name and returns a new ReadCloser. If name matches "game_part1.wud" then the image is assumed to be split into 2 GB parts and each sequential part will also be opened.
type Reader ¶
type Reader interface {
io.Reader
io.Seeker
readerutil.SizeReaderAt
}
A Reader has Read, Seek, ReadAt, and Size methods.
type WUD ¶
type WUD struct {
// contains filtered or unexported fields
}
WUD represents a Wii-U disc image
func NewWUD ¶
func NewWUD(r readerutil.SizeReaderAt, commonKey, gameKey []byte) (*WUD, error)
NewWUD returns a WUD read from the provided r, using the commonKey and gameKey to decrypt where necessary.
Click to show internal directories.
Click to hide internal directories.