install

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package install manages the player's Diablo II base install and the per-server folders inside it. The base install is only ever read: the launcher creates server folders in it, and nothing else.

Index

Constants

This section is empty.

Variables

View Source
var Archives = []Archive{
	{Name: "d2data.mpq", Required: true},
	{Name: "d2sfx.mpq", Required: true},
	{Name: "d2speech.mpq", Required: true},
	{Name: "d2exp.mpq", Required: true, Expansion: true},
	{Name: "d2char.mpq"},
	{Name: "d2music.mpq"},
	{Name: "d2video.mpq"},
	{Name: "d2xmusic.mpq", Expansion: true},
	{Name: "d2xtalk.mpq", Expansion: true},
	{Name: "d2xvideo.mpq", Expansion: true},
}

Archives are the base archives, required ones first.

View Source
var ErrCrossVolume = errors.New("hard links need the server folder on the same drive as Diablo II")

ErrCrossVolume means the server folder is on a different drive from the base archives, so they can't be hard linked and would have to be copied.

Functions

func BaseFilesToPlace

func BaseFilesToPlace(base, serverDir string, files []spec.BaseFile) ([]string, error)

BaseFilesToPlace checks a server's base files without changing anything: the names of those an update would place, or a BaseFileError for one the player's install is missing or has another version of, which an update can't fix.

func CopyArchives

func CopyArchives(base, serverDir string, expansion, pre114 bool) error

CopyArchives is the fallback when LinkArchives can't link. It uses real disk space, so the launcher asks the player first, showing CopySize. pre114 is as for LinkArchives.

func CopySize

func CopySize(r Report) int64

CopySize is how much disk space CopyArchives would use.

func Detect

func Detect() string

Detect finds nothing outside Windows; the player picks the folder.

func LinkArchives

func LinkArchives(base, serverDir string, expansion, pre114 bool) error

LinkArchives makes the base archives visible inside a server folder as hard links: no extra disk space and no admin rights, but only on the same volume. Archives already linked are left alone.

pre114 is set for a server whose game is older than 1.14. A 1.14 base's d2sfx.mpq has a 1.14-format (attributes) that the older Storm.dll can't read, so that archive gets a corrected copy instead of a link: see placeFixed.

func PlaceBaseFiles

func PlaceBaseFiles(base, serverDir string, files []spec.BaseFile) error

PlaceBaseFiles puts the files a server takes from the player's install (game.baseFiles) into its folder: a hard link where it can, else a copy, each only after checking the player's copy is exactly the one named. A file already in place is left alone.

func ServerDir

func ServerDir(base, id string) string

ServerDir is where a server's files live under the base install.

func Warning

func Warning(base string) string

Warning describes a problem with where Diablo II is installed that won't stop it working but is likely to cause trouble.

Types

type Archive

type Archive struct {
	Name string
	// Required archives stop the game starting when missing. The others make
	// it ask for a disc.
	Required bool
	// Expansion archives are only needed for Lord of Destruction.
	Expansion bool
}

Archive is one of Blizzard's base archives. Servers never ship these; their presence in the base folder is how ownership is checked.

type BaseFileError

type BaseFileError struct {
	Path    string
	Missing bool
}

BaseFileError is a file a server takes from the player's install that isn't there, or isn't the copy the server needs.

func (*BaseFileError) Error

func (e *BaseFileError) Error() string

type Report

type Report struct {
	// Missing required archives: the game won't start.
	Missing []string `json:"missing"`
	// Missing optional archives: the game asks for a disc at some point.
	MissingOptional []string `json:"missingOptional"`
	// Present archives, by name, with their size.
	Present map[string]int64 `json:"present"`
}

Report is the result of checking a base install.

func Check

func Check(dir string, expansion bool) (Report, error)

Check looks for the base archives in dir.

func (Report) OK

func (r Report) OK() bool

OK reports whether the game can start from this base.

Jump to

Keyboard shortcuts

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