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 ¶
- Variables
- func BaseFilesToPlace(base, serverDir string, files []spec.BaseFile) ([]string, error)
- func CopyArchives(base, serverDir string, expansion, pre114 bool) error
- func CopySize(r Report) int64
- func Detect() string
- func LinkArchives(base, serverDir string, expansion, pre114 bool) error
- func PlaceBaseFiles(base, serverDir string, files []spec.BaseFile) error
- func ServerDir(base, id string) string
- func Warning(base string) string
- type Archive
- type BaseFileError
- type Report
Constants ¶
This section is empty.
Variables ¶
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.
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 ¶
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 ¶
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 Detect ¶
func Detect() string
Detect finds nothing outside Windows; the player picks the folder.
func LinkArchives ¶
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 ¶
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.
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 ¶
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.