Merge branch 'golang-dev' of https://gitea.piwalker.net/piwalker/FCLauncher into golang-dev

This commit is contained in:
cuptain 2024-10-31 12:32:31 +11:00
commit 10d373fd4b
11 changed files with 15 additions and 25 deletions

View File

@ -12,6 +12,8 @@ import (
"runtime" "runtime"
"strconv" "strconv"
"strings" "strings"
wruntime "github.com/wailsapp/wails/v2/pkg/runtime"
) )
type Instance struct { type Instance struct {
@ -275,7 +277,9 @@ func (i *InstanceManager)LaunchInstance(instance string) {
} }
fmt.Printf("Args: %+v", args) fmt.Printf("Args: %+v", args)
child := exec.Command(filepath.Join(dir, "java", fmt.Sprintf("java-%d-%s", instanceObject.JavaVersion, suffix), "bin", execName), args...) child := exec.Command(filepath.Join(dir, "java", fmt.Sprintf("java-%d-%s", instanceObject.JavaVersion, suffix), "bin", execName), args...)
wruntime.WindowHide(i.app.Ctx)
data, err := child.CombinedOutput() data, err := child.CombinedOutput()
wruntime.WindowShow(i.app.Ctx)
fmt.Printf("Command Output: %s\n", data) fmt.Printf("Command Output: %s\n", data)
} }

View File

@ -28,7 +28,6 @@ type App struct {
// NewApp creates a new App application struct // NewApp creates a new App application struct
func NewApp() *App { func NewApp() *App {
a := &App{} a := &App{}
a.PrismLauncher = Prism{app: a}
a.Java = JavaManager{app: a} a.Java = JavaManager{app: a}
a.Instance = InstanceManager{app: a} a.Instance = InstanceManager{app: a}
a.Modpacks = ModpackManager{app: a} a.Modpacks = ModpackManager{app: a}
@ -49,26 +48,6 @@ func (a *App) CheckPrerequisites() {
a.Instance.SearchInstances() a.Instance.SearchInstances()
a.Status("Pulling Modpacks") a.Status("Pulling Modpacks")
a.Modpacks.QuerryModpacks() a.Modpacks.QuerryModpacks()
a.Status("Checking Prism")
res := a.PrismLauncher.CheckInstalled()
if res {
a.Status("Prism OK")
} else {
a.Status("Prism MISSING")
a.Status("Installing Prism")
a.PrismLauncher.Install()
a.Status("Prism Installed")
}
a.Status("Checking Java 21")
res = a.Java.CheckJavaVer(21)
if res {
a.Status("Java 21 OK")
} else {
a.Status("Java 21 MISSING")
a.Status("Installing Java 21")
a.Java.InstallJavaVer(21)
a.Status("Java 21 Installed")
}
a.Status("Logging in with Microsoft") a.Status("Logging in with Microsoft")
dir, _ := os.UserConfigDir() dir, _ := os.UserConfigDir()
authenticated := false authenticated := false

View File

@ -33,7 +33,6 @@
$loading = true $loading = true
LaunchInstance(instance).then(() => { LaunchInstance(instance).then(() => {
$loading = false $loading = false
window.runtime.Quit()
}) })
} }

BIN
fclauncher/level.dat Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -451,6 +451,7 @@ func DownloadLoggingConfig(mcVersion string, gameDir string){
resp, err := http.Get(metadata.Logging.Client.File.Url) resp, err := http.Get(metadata.Logging.Client.File.Url)
if err != nil { if err != nil {
fmt.Printf("Error downloading logging config: %s\n", err) fmt.Printf("Error downloading logging config: %s\n", err)
return
} }
defer resp.Body.Close() defer resp.Body.Close()
os.MkdirAll(gameDir, 0755) os.MkdirAll(gameDir, 0755)
@ -534,13 +535,20 @@ func GetBaseLaunchArgs(mcVersion string, libDir string, binDir string, assetDir
args = append(args, "-Djna.tmpdir="+filepath.Join(gameDir, "natives")) args = append(args, "-Djna.tmpdir="+filepath.Join(gameDir, "natives"))
args = append(args, "-Dorg.lwjgl.system.SharedLibraryExtractpath="+filepath.Join(gameDir, "natives")) args = append(args, "-Dorg.lwjgl.system.SharedLibraryExtractpath="+filepath.Join(gameDir, "natives"))
args = append(args, "-Dio.netty.native.workdir="+filepath.Join(gameDir, "natives")) args = append(args, "-Dio.netty.native.workdir="+filepath.Join(gameDir, "natives"))
args = append(args, strings.ReplaceAll(metadata.Logging.Client.Argument, "${path}", filepath.Join(gameDir, "log4j2.xml"))) loggingArg := strings.ReplaceAll(metadata.Logging.Client.Argument, "${path}", filepath.Join(gameDir, "log4j2.xml"))
if loggingArg != "" {
args = append(args, loggingArg)
}
args = append(args, "-Xms512m") args = append(args, "-Xms512m")
args = append(args, "-Xmx1024m") args = append(args, "-Xmx1024m")
args = append(args, "-cp") args = append(args, "-cp")
arg := "" arg := ""
separater := ":"
if runtime.GOOS == "windows" {
separater = ";"
}
for _, lib := range metadata.Libraries { for _, lib := range metadata.Libraries {
arg += filepath.Join(libDir, lib.Downloads.Artifact.Path) + ":" arg += filepath.Join(libDir, lib.Downloads.Artifact.Path) + separater
} }
arg += filepath.Join(binDir, mcVersion, "client.jar") arg += filepath.Join(binDir, mcVersion, "client.jar")
args = append(args, arg) args = append(args, arg)
@ -566,7 +574,7 @@ func GetBaseLaunchArgs(mcVersion string, libDir string, binDir string, assetDir
case "${assets_index_name}": case "${assets_index_name}":
args = append(args, metadata.Assets) args = append(args, metadata.Assets)
case "${user_properties}": case "${user_properties}":
args = append(args, "null") args = append(args, "{}")
default: default:
args = append(args, val) args = append(args, val)
} }