Skip to content

Commit 25806f9

Browse files
Bug fixes related to adding a new launcher
1 parent f02c309 commit 25806f9

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

Lib/Launchpad/Config/AppConfig.ahk

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,13 @@
196196

197197
SelectLauncherFile(existingFile) {
198198
MsgBox("Launchpad uses a Launcher File to keep a list of games and settings for your launchers. The file is in JSON format and can be edited by hand or through the Launcher Manager in Launchpad.`n`nIf you have an existing Launcher File, select it on the following screen. If you want to create a new one, browse to the folder you would like and type in a new .json filename to use.", "Launchpad Launcher File", "OK")
199-
return FileSelect(3, existingFile, "Select the or create the Launcher File you would like Launchpad to use.", "JSON Documents (*.json)")
199+
path := FileSelect(8, existingFile, "Select or create the Launcher File you would like Launchpad to use.", "JSON Documents (*.json)")
200+
201+
if (!FileExist(path)) {
202+
FileAppend("{`"Games`": {}}", path)
203+
}
204+
205+
return path
200206
}
201207

202208
OpenAssetsDir() {

Lib/Launchpad/Entity/LauncherEntity.ahk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class LauncherEntity extends EntityBase {
6666
__New(app, key, config, requiredConfigKeys := "", parentEntity := "") {
6767
super.__New(app, key, config, requiredConfigKeys, parentEntity)
6868
this.children["ManagedLauncher"] := ManagedLauncherEntity.new(app, key, config, "", this)
69+
this.entityData.SetLayer("auto", this.AutoDetectValues()) ; Re-detect values now that children are loaded, @todo make this run only once
6970
}
7071

7172
/**
@@ -155,7 +156,7 @@ class LauncherEntity extends EntityBase {
155156

156157
if (FileExist(checkPath)) {
157158
detectedValues["IconSrc"] := checkPath
158-
} else if (this.ManagedLauncher.ManagedGame.GetValue("Exe") != "") {
159+
} else if (this.children.Has("ManagedLauncher") and this.ManagedLauncher.ManagedGame.GetConfigValue("Exe") != "") {
159160
detectedValues["IconSrc"] := this.ManagedLauncher.ManagedGame.LocateExe()
160161
}
161162
}

Lib/Launchpad/Window/LauncherEditor.ahk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class LauncherEditor extends EntityEditorBase {
116116

117117
if (diff != "" and diff.HasChanges()) {
118118
if (diff.ValueIsModified("LauncherType")) {
119-
this.guiObj["LauncherType"].Value := this.GetItemIndex(this.launcherTypes, entity.GetValue("Type"))
119+
this.guiObj["LauncherType"].Value := this.GetItemIndex(this.launcherTypes, entity.GetConfigValue("Type"))
120120
}
121121
}
122122
}
@@ -127,7 +127,7 @@ class LauncherEditor extends EntityEditorBase {
127127

128128
if (diff != "" and diff.HasChanges()) {
129129
if (diff.ValueIsModified("GameType")) {
130-
this.guiObj["GameType"].Value := this.GetItemIndex(this.gameTypes, entity.GetValue("Type"))
130+
this.guiObj["GameType"].Value := this.GetItemIndex(this.gameTypes, entity.GetConfigValue("Type"))
131131
}
132132
}
133133
}

0 commit comments

Comments
 (0)