You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 20, 2021. It is now read-only.
Under Windows, the defaults.go file assumes that the game is installed in the default directory, 'C:\Program Files (x86)\Diablo II', with a hard coded MPQ location of:
(d2core\d2config\defaults.go, line 44)
config.MpqPath = "C:/Program Files/Diablo II"
If Diablo 2 is not installed in the above directory, the 'go run .' fails.
I believe the following solution could fix this:
`package main
import (
"fmt"
"log"
"golang.org/x/sys/windows/registry"
)
func main() {
k, err := registry.OpenKey(registry.LOCAL_MACHINE, SOFTWARE\WOW6432Node\Blizzard Entertainment\Diablo II, registry.QUERY_VALUE)
if err != nil {
log.Fatal(err)
}
s, _, err := k.GetStringValue("InstallPath")
if err != nil {
log.Fatal(err)
}
fmt.Printf("Diablo 2 is installed in: %q\n", s)
}`
I'm not a programmer, but I wrote this to return the D2 install directory by reading it from the appropriate registry file. I don't know how it could be formatted or implemented better, but that should take care of finding the location of the MPQ file.
I hope this is of use, thank you!
The text was updated successfully, but these errors were encountered:
Personally i agree with @willroberts - non-standard locations or backups of installs is a better choice, and it could be done in a platform agnostic way.
Honestly, i think looking for d2data.mpq at runtime, displaying a non_error "config" menu that would alter the MpqPath variable, think would be better.
This would resolve the issue on all platforms and give a starting spot for enabling/editing load-order from runtime in the future.
One of the most difficult things with the current situation is, editing the configuration can only be done from a text editor, and this should be undesirable for the end user experience.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Under Windows, the defaults.go file assumes that the game is installed in the default directory, 'C:\Program Files (x86)\Diablo II', with a hard coded MPQ location of:
(d2core\d2config\defaults.go, line 44)
config.MpqPath = "C:/Program Files/Diablo II"
If Diablo 2 is not installed in the above directory, the 'go run .' fails.
I believe the following solution could fix this:
`package main
import (
"fmt"
"log"
)
func main() {
k, err := registry.OpenKey(registry.LOCAL_MACHINE,
SOFTWARE\WOW6432Node\Blizzard Entertainment\Diablo II
, registry.QUERY_VALUE)if err != nil {
log.Fatal(err)
}
s, _, err := k.GetStringValue("InstallPath")
if err != nil {
log.Fatal(err)
}
fmt.Printf("Diablo 2 is installed in: %q\n", s)
}`
I'm not a programmer, but I wrote this to return the D2 install directory by reading it from the appropriate registry file. I don't know how it could be formatted or implemented better, but that should take care of finding the location of the MPQ file.
I hope this is of use, thank you!
The text was updated successfully, but these errors were encountered: