Skip to content

Commit eed52fb

Browse files
committed
Fixed parser specific inputs not running validation fns, improved language placeholders for parser specific inputs
1 parent 7199e79 commit eed52fb

19 files changed

+121
-178
lines changed

.todo

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ To update all the config presets at once:
88
4) Commit changes and `git push`
99

1010
# Fixes
11-
Steam parser only works for steam apps that are in a category
11+
Steam parser only works for steam apps that have been installed at least once.
1212

1313

1414
# Features and Changes
@@ -17,15 +17,16 @@ Steam parser only works for steam apps that are in a category
1717
2) Assign an sgdbId to sgdb game much earlier (and have fix match alter it as necessary)
1818
3) Make global accounts and steam directory mandatory, rework the UI around accounts.
1919
4) Rework fileParser to make each stage of the title modification process immutable and trackable.
20+
5) Re work the parser validation code to not suck.
2021

2122

2223
# Parsers (LM - Launcher Mode, EM - Executable Mode)
2324
Amazon Games (LM, EM)
24-
Battle.net (LM)
25+
Battle.net (LM - EM not possible)
2526
EA Desktop (LM, EM)
2627
Epic (LM, EM)
2728
GOG Galaxy (LM, EM)
28-
Legendary (EM)
29+
Legendary (LM, EM)
2930
Itch.io (EM - missing fileLaunchOptions)
3031
UPlay (LM, EM - missing fileLaunchOptions)
31-
UWP (LM, EM - missing fileLaunchOptions)
32+
UWP (LM, EM - missing fileLaunchOptions)

src/lang/en-US/langStrings.json

Lines changed: 78 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,24 @@
101101
},
102102
"manualParser": {
103103
"manifestsInputTitle": "Manifests Directory",
104-
"manifestsInputPlaceholder": "/path/to/your/manifests/",
104+
"manifestsInputPlaceholder":
105+
{
106+
"Windows_NT": "C:\\path\\to\\your\\manifests\\",
107+
"Darwin": "/path/to/your/manifests/",
108+
"Linux": "/path/to/your/manifests/"
109+
},
105110
"errors": {
106111
"fatalError__i": "> Manual parser failed with fatal error:\n ${error}"
107112
}
108113
},
109114
"epicParser": {
110115
"manifestsInputTitle": "Epic Manifests Directory Override",
111-
"manifestsInputPlaceholder": "/path/to/Manifests/",
116+
"manifestsInputPlaceholder":
117+
{
118+
"Windows_NT": "C:\\path\\to\\your\\manifests\\",
119+
"Darwin": "/path/to/your/manifests/",
120+
"Linux": "/path/to/your/manifests/"
121+
},
112122
"launcherModeInputTitle": "Launch games via Epic for online services",
113123
"errors": {
114124
"invalidManifestsOverride": "> Manifests Override is not a valid directory.",
@@ -120,27 +130,42 @@
120130
"legendaryParser": {
121131
"launcherModeInputTitle": "Launch games via Legendary for online services",
122132
"legendaryInstalledFileTitle": "Legendary installed.json Path Override",
123-
"legendaryInstalledFilePlaceholderUnix": "/path/to/legendary/installed.json",
124-
"legendaryInstalledFilePlaceholderWin": "C:\\path\\to\\legendary\\installed.json",
133+
"legendaryInstalledFilePlaceholder":
134+
{
135+
"Windows_NT": "C:\\path\\to\\legendary\\installed.json",
136+
"Darwin": "/path/to/legendary/installed.json",
137+
"Linux": "/path/to/legendary/installed.json"
138+
},
125139
"legendaryExeOverrideTitle": "Legendary Path Override",
126-
"legendaryExeOverridePlaceholderWin": "C:\\path\\to\\legendary.exe",
127-
"legendaryExeOverridePlaceholderUnix": "/path/to/legendary",
140+
"legendaryExeOverridePlaceholder": {
141+
"Windows_NT": "C:\\path\\to\\legendary.exe",
142+
"Darwin": "/path/to/legendary",
143+
"Linux": "/path/to/legendary"
144+
},
128145
"errors": {
129146
"legendaryNotInstalled": "> Legendary installed.json not found",
130147
"fatalError__i": "> Legendary parser failed with fatal error:\n ${error}"
131148
}
132149
},
133150
"battleNetParser": {
134151
"battleExeOverrideTitle": "Battle.net.exe Path Override",
135-
"battleExeOverridePlaceholder": "/path/to/Battle.net/Battle.net.exe",
152+
"battleExeOverridePlaceholder": {
153+
"Windows_NT": "C:\\path\\to\\Battle.net\\Battle.net.exe",
154+
"Darwin": "/path/to/Battle.net.app/Contents/MacOS/Battle.net",
155+
"Linux": "/path/to/Battle.net"
156+
},
136157
"errors": {
137158
"battleNotCompatible": "> Battle.net parser is only available on Windows.",
138159
"fatalError__i": "> Battle.net parser failed with fatal error:\n ${error}"
139160
}
140161
},
141162
"UWPParser": {
142163
"UWPDirTitle": "XboxGames Directory Override",
143-
"UWPDirPlaceholder": "/path/to/XboxGames or /path/to/WindowsApps",
164+
"UWPDirPlaceholder": {
165+
"Windows_NT": "C:\\path\\to\\XboxGames\\ or C:\\path\\to\\WindowsApps\\",
166+
"Darwin": "/path/to/XboxGames/ or /path/to/WindowsApps/",
167+
"Linux": "/path/to/XboxGames/ or /path/to/WindowsApps/"
168+
},
144169
"UWPLauncherModeTitle": "Launch game as UWP instead of launcher helper",
145170
"errors": {
146171
"fatalError__i": "> UWP parser failed with fatal error:\n ${error}",
@@ -149,7 +174,11 @@
149174
},
150175
"uplayParser": {
151176
"uplayDirTitle": "Ubisoft Directory Override",
152-
"uplayDirPlaceholder": "/path/to/Ubisoft/",
177+
"uplayDirPlaceholder": {
178+
"Windows_NT": "C:\\path\\to\\Ubisoft\\",
179+
"Darwin": "/path/to/Ubisoft/",
180+
"Linux": "/path/to/Ubisoft/"
181+
},
153182
"launcherModeInputTitle": "Launch games via UPlay for online services",
154183
"errors": {
155184
"invalidManifestsOverride": "> Uplay Directory Override is not a valid directory.",
@@ -161,8 +190,11 @@
161190
},
162191
"gogParser": {
163192
"galaxyExeOverrideTitle": "Galaxy Path Override",
164-
"galaxyExeOverridePlaceholderWin": "C:\\path\\to\\GalaxyClient.exe",
165-
"galaxyExeOverridePlaceholderMac": "/path/to/GOG Galaxy.app/Contents/MacOS/GOG Galaxy",
193+
"galaxyExeOverridePlaceholder": {
194+
"Windows_NT": "C:\\path\\to\\GalaxyClient.exe",
195+
"Darwin": "/path/to/GOG Galaxy.app/Contents/MacOS/GOG Galaxy",
196+
"Linux": "/path/to/GalaxyClient"
197+
},
166198
"launcherModeInputTitle": "Launch games via GOG Galaxy",
167199
"parseLinkedExecsTitle": "Parse linked executables from GOG Galaxy",
168200
"parseRegistryEntries": "Parse using Registry instead of Galaxy DB",
@@ -175,7 +207,11 @@
175207
},
176208
"amazonGamesParser": {
177209
"exeOverrideTitle": "Amazon Games Path Override",
178-
"exeOverridePlaceholder": "/path/to/Amazon Games.exe",
210+
"exeOverridePlaceholder": {
211+
"Windows_NT": "C:\\path\\to\\Amazon Games.exe",
212+
"Darwin": "/path/to/Amazon Games.app/Contents/MacOS/Amazon Games",
213+
"Linux": "/path/to/Amazon Games"
214+
},
179215
"launcherModeInputTitle": "Launch games via Amazon Games",
180216
"errors": {
181217
"invalidExeOverride": "> Amazon Games Installation Override is not a valid directory.",
@@ -186,7 +222,11 @@
186222
},
187223
"itchIoParser": {
188224
"itchIoAppDataOverrideTitle": "itch.io AppData Directory Override",
189-
"itchIoAppDataOverridePlaceholder": "/path/to/itch",
225+
"itchIoAppDataOverridePlaceholder": {
226+
"Windows_NT": "C:\\AppData\\itch\\",
227+
"Darwin": "~/Library/Application Support/itch/",
228+
"Linux": "~/.config/itch/"
229+
},
190230
"itchIoWindowsOnLinuxInstallDriveRedirectTitle": "Windows-on-Linux Install Drive Redirect",
191231
"itchIoWindowsOnLinuxInstallDriveRedirectPlaceholder": "/mnt/d/",
192232
"errors": {
@@ -199,7 +239,11 @@
199239
},
200240
"eaDesktopParser": {
201241
"eaGamesDirTitle": "EA Games Directory Override",
202-
"eaGamesDirPlaceholder": "/path/to/EA Games/",
242+
"eaGamesDirPlaceholder": {
243+
"Windows_NT": "C:\\path\\to\\EA Games\\",
244+
"Darwin": "/path/to/EA Games/",
245+
"Linux": "/path/to/EA Games/"
246+
},
203247
"eaLauncherModeTitle": "Launch games via EA Desktop",
204248
"errors": {
205249
"fatalError__i": "> EA Desktop parser failed with fatal error:\n ${error}",
@@ -329,25 +373,25 @@
329373
"userAccounts": "For example ${steamlogin}",
330374
"bySystem": {
331375
"Windows_NT": {
332-
"steamDirectory": "Typically C:\\Program Files (x86)\\Steam",
333-
"romsDirectory": "For example D:\\ROMs",
334-
"retroarchPath": "For example C:\\Path\\To\\retroarch.exe",
335-
"raCoresDirectory": "Typically C:\\Users\\UserName\\AppData\\Roaming\\RetroArch\\cores",
336-
"localImagesDirectory": "For example C:\\Path\\To\\LocalArtwork"
376+
"steamDirectory": "Typically C:\\Program Files (x86)\\Steam\\",
377+
"romsDirectory": "For example D:\\ROMs\\",
378+
"retroarchPath": "For example C:\\Path\\To\\Retroarch.exe",
379+
"raCoresDirectory": "Typically C:\\Users\\UserName\\AppData\\Roaming\\RetroArch\\cores\\",
380+
"localImagesDirectory": "For example C:\\Path\\To\\LocalArtwork\\"
337381
},
338382
"Darwin": {
339-
"steamDirectory": "Typically ~/Library/Application Support/Steam",
340-
"romsDirectory": "For example ~/ROMs",
383+
"steamDirectory": "Typically ~/Library/Application Support/Steam/",
384+
"romsDirectory": "For example ~/ROMs/",
341385
"retroarchPath": "For example /path/to/retroarch",
342-
"raCoresDirectory": "Typically /Applications/Retroarch.app/Contents/Resources/cores",
343-
"localImagesDirectory": "For example ~/path/to/localartwork"
386+
"raCoresDirectory": "Typically /Applications/Retroarch.app/Contents/Resources/cores/",
387+
"localImagesDirectory": "For example ~/path/to/localartwork/"
344388
},
345389
"Linux": {
346-
"steamDirectory": "Typically /home/user/.steam/steam",
347-
"romsDirectory": "For example ~/ROMs",
390+
"steamDirectory": "Typically /home/user/.steam/steam/",
391+
"romsDirectory": "For example ~/ROMs/",
348392
"retroarchPath": "For example /path/to/retroarch",
349-
"raCoresDirectory": "Typically /lib/x86_64-linux-gnu/libretro/cores",
350-
"localImagesDirectory": "For example ~/path/to/localartwork"
393+
"raCoresDirectory": "Typically /lib/x86_64-linux-gnu/libretro/cores/",
394+
"localImagesDirectory": "For example ~/path/to/localartwork/"
351395
}
352396
}
353397
}
@@ -489,18 +533,18 @@
489533
"placeholder": {
490534
"parserType": "Select parser...",
491535
"configTitle": "My Awesome Parser",
492-
"steamDirectory": "${steamdirglobal} or /path/to/steam",
536+
"steamDirectory": "${steamdirglobal} or /path/to/steam/",
493537
"userAccounts": "${steamuser1}${steamuser2} or ${${accountsglobal}}",
494538
"titleFromVariable": "${variableGroup1}${variableGroup2}",
495539
"titleModifier": "${fuzzyTitle} or ${title}",
496540
"defaultImage__i": "/path/to/fallback_${artworkType}.png",
497541
"localImages__i": "/path/to/art/${artworkType}/\\${title}.@(png|jpg)",
498542
"romDirectory": "/path/to/games/",
499543
"glob": "${title}.@(iso|ISO)",
500-
"executableLocation": "Example: /path/to/emulator.exe",
544+
"executableLocation": "/path/to/emulator.exe",
501545
"executableArgs": "--arg1 --arg2",
502546
"executableModifier": "\"${exePath}\"",
503-
"startInDirectory": "/path/to/start/in/dir",
547+
"startInDirectory": "/path/to/start/in/dir/",
504548
"imageProviders": "None",
505549
"multiAPIPlaceholder": "No Filter"
506550
},
@@ -547,11 +591,11 @@
547591
"defaultImage__md": "> Default image is an invalid path!",
548592
"titleModifier__md": "> Title modifier field is required!",
549593
"executableModifier__md": "> Executable modifier must not be empty!",
550-
"variableString__md": "> Uneven number of `${` and `}` pairs. Use `\\` to escape `${` or `}` if you want to use them as characters.",
594+
"variableString__md": "> Uneven number of `${` and `}` pairs! Use `\\` to escape `${` or `}` if you want to use them as characters.",
551595
"imageProviders__md": "> Incorrect image providers type!",
552-
"unhandledValidationKey__md": "> Input's validation is unhandled",
553-
"genericDir__md": "> Directory is invalid",
554-
"genericPath__md": "> Path is invalid"
596+
"unhandledValidationKey__md": "> Input's validation is unhandled!",
597+
"genericDir__md": "> Directory is invalid!",
598+
"genericPath__md": "> Path is invalid!"
555599
},
556600
"text": {
557601
"noTitle": "No title!"

src/lib/file-parser.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,6 @@ export class FileParser {
125125
).trim();
126126
})
127127
: null;
128-
/*const doubleVarRegex = /^\$\{\$\{.+\}\}$/;
129-
if(doubleVarRegex.test(config.userAccounts.specifiedAccounts)) {
130-
config.userAccounts.specifiedAccounts = preParser.setInput(config.userAccounts.specifiedAccounts).parse() ? preParser.replaceVariables((variable)=>{
131-
return this.getEnvironmentVariable(variable as EnvironmentVariables, settings).trim();
132-
}): null;
133-
}*/
134128
if (superType === parserInfo.ROMType) {
135129
config.romDirectory = preParser.setInput(config.romDirectory).parse()
136130
? preParser.replaceVariables((variable) => {
@@ -179,12 +173,6 @@ export class FileParser {
179173
})
180174
: null;
181175
}
182-
if (parser.inputs[inputName].forcedInput) {
183-
config.parserInputs[inputName] =
184-
parser.inputs[inputName].forcedInput;
185-
} else if (config.parserInputs[inputName] === undefined) {
186-
config.parserInputs[inputName] = "";
187-
}
188176
}
189177
}
190178
resolve({ superType: superType, config: config, settings: settings });

src/lib/parsers/UWP.parser.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,13 @@ export class UWPParser implements GenericParser {
2121
inputs: {
2222
UWPDir: {
2323
label: this.lang.UWPDirTitle,
24-
placeholder: this.lang.UWPDirPlaceholder,
24+
placeholder: this.lang.UWPDirPlaceholder[os.type()],
2525
inputType: "dir",
26-
validationFn: null,
2726
info: this.lang.docs__md.input.join(""),
2827
},
2928
UWPLauncherMode: {
3029
label: this.lang.UWPLauncherModeTitle,
3130
inputType: "toggle",
32-
validationFn: (input: any) => {
33-
return null;
34-
},
3531
info: this.lang.docs__md.input.join(""),
3632
},
3733
},

src/lib/parsers/amazon-games.parser.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,13 @@ export class AmazonGamesParser implements GenericParser {
1717
inputs: {
1818
amazonGamesExeOverride: {
1919
label: this.lang.exeOverrideTitle,
20-
placeholder: this.lang.exeOverridePlaceholder,
20+
placeholder: this.lang.exeOverridePlaceholder[os.type()],
2121
inputType: "dir",
22-
validationFn: (input: string) => {
23-
if (
24-
!input ||
25-
(fs.existsSync(input) && fs.lstatSync(input).isFile())
26-
) {
27-
return null;
28-
} else {
29-
return this.lang.errors.invalidExeOverride;
30-
}
31-
},
3222
info: this.lang.docs__md.input.join(""),
3323
},
3424
amazonGamesLauncherMode: {
3525
label: this.lang.launcherModeInputTitle,
3626
inputType: "toggle",
37-
validationFn: (input: any) => {
38-
return null;
39-
},
4027
info: this.lang.docs__md.input.join(""),
4128
},
4229
},

src/lib/parsers/battle-net.parser.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,8 @@ export class BattleNetParser implements GenericParser {
107107
inputs: {
108108
battleExeOverride: {
109109
label: this.lang.battleExeOverrideTitle,
110-
placeholder: this.lang.battleExeOverridePlaceholder,
110+
placeholder: this.lang.battleExeOverridePlaceholder[os.type()],
111111
inputType: "path",
112-
validationFn: null,
113112
info: this.lang.docs__md.input.join(""),
114113
},
115114
},

src/lib/parsers/ea-desktop.parser.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ export class EADesktopParser implements GenericParser {
2020
inputs: {
2121
eaGamesDir: {
2222
label: this.lang.eaGamesDirTitle,
23-
placeholder: this.lang.eaGamesDirPlaceholder,
23+
placeholder: this.lang.eaGamesDirPlaceholder[os.type()],
2424
inputType: "dir",
25-
validationFn: null,
2625
info: this.lang.docs__md.input.join(""),
2726
},
2827
eaLauncherMode: {
2928
label: this.lang.eaLauncherModeTitle,
3029
inputType: "toggle",
31-
validationFn: null,
3230
info: this.lang.docs__md.input.join(""),
3331
},
3432
},

src/lib/parsers/epic.parser.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,13 @@ export class EpicParser implements GenericParser {
1717
inputs: {
1818
epicManifests: {
1919
label: this.lang.manifestsInputTitle,
20-
placeholder: this.lang.manifestsInputPlaceholder,
20+
placeholder: this.lang.manifestsInputPlaceholder[os.type()],
2121
inputType: "dir",
22-
validationFn: null,
2322
info: this.lang.docs__md.input.join(""),
2423
},
2524
epicLauncherMode: {
2625
label: this.lang.launcherModeInputTitle,
2726
inputType: "toggle",
28-
validationFn: (input: any) => {
29-
return null;
30-
},
3127
info: this.lang.docs__md.input.join(""),
3228
},
3329
},

0 commit comments

Comments
 (0)