Skip to content

Commit

Permalink
Fixed parser specific inputs not running validation fns, improved lan…
Browse files Browse the repository at this point in the history
…guage placeholders for parser specific inputs
  • Loading branch information
cbartondock committed Oct 16, 2024
1 parent 7199e79 commit eed52fb
Show file tree
Hide file tree
Showing 19 changed files with 121 additions and 178 deletions.
9 changes: 5 additions & 4 deletions .todo
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ To update all the config presets at once:
4) Commit changes and `git push`

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


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


# Parsers (LM - Launcher Mode, EM - Executable Mode)
Amazon Games (LM, EM)
Battle.net (LM)
Battle.net (LM - EM not possible)
EA Desktop (LM, EM)
Epic (LM, EM)
GOG Galaxy (LM, EM)
Legendary (EM)
Legendary (LM, EM)
Itch.io (EM - missing fileLaunchOptions)
UPlay (LM, EM - missing fileLaunchOptions)
UWP (LM, EM - missing fileLaunchOptions)
UWP (LM, EM - missing fileLaunchOptions)
112 changes: 78 additions & 34 deletions src/lang/en-US/langStrings.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,24 @@
},
"manualParser": {
"manifestsInputTitle": "Manifests Directory",
"manifestsInputPlaceholder": "/path/to/your/manifests/",
"manifestsInputPlaceholder":
{
"Windows_NT": "C:\\path\\to\\your\\manifests\\",
"Darwin": "/path/to/your/manifests/",
"Linux": "/path/to/your/manifests/"
},
"errors": {
"fatalError__i": "> Manual parser failed with fatal error:\n ${error}"
}
},
"epicParser": {
"manifestsInputTitle": "Epic Manifests Directory Override",
"manifestsInputPlaceholder": "/path/to/Manifests/",
"manifestsInputPlaceholder":
{
"Windows_NT": "C:\\path\\to\\your\\manifests\\",
"Darwin": "/path/to/your/manifests/",
"Linux": "/path/to/your/manifests/"
},
"launcherModeInputTitle": "Launch games via Epic for online services",
"errors": {
"invalidManifestsOverride": "> Manifests Override is not a valid directory.",
Expand All @@ -120,27 +130,42 @@
"legendaryParser": {
"launcherModeInputTitle": "Launch games via Legendary for online services",
"legendaryInstalledFileTitle": "Legendary installed.json Path Override",
"legendaryInstalledFilePlaceholderUnix": "/path/to/legendary/installed.json",
"legendaryInstalledFilePlaceholderWin": "C:\\path\\to\\legendary\\installed.json",
"legendaryInstalledFilePlaceholder":
{
"Windows_NT": "C:\\path\\to\\legendary\\installed.json",
"Darwin": "/path/to/legendary/installed.json",
"Linux": "/path/to/legendary/installed.json"
},
"legendaryExeOverrideTitle": "Legendary Path Override",
"legendaryExeOverridePlaceholderWin": "C:\\path\\to\\legendary.exe",
"legendaryExeOverridePlaceholderUnix": "/path/to/legendary",
"legendaryExeOverridePlaceholder": {
"Windows_NT": "C:\\path\\to\\legendary.exe",
"Darwin": "/path/to/legendary",
"Linux": "/path/to/legendary"
},
"errors": {
"legendaryNotInstalled": "> Legendary installed.json not found",
"fatalError__i": "> Legendary parser failed with fatal error:\n ${error}"
}
},
"battleNetParser": {
"battleExeOverrideTitle": "Battle.net.exe Path Override",
"battleExeOverridePlaceholder": "/path/to/Battle.net/Battle.net.exe",
"battleExeOverridePlaceholder": {
"Windows_NT": "C:\\path\\to\\Battle.net\\Battle.net.exe",
"Darwin": "/path/to/Battle.net.app/Contents/MacOS/Battle.net",
"Linux": "/path/to/Battle.net"
},
"errors": {
"battleNotCompatible": "> Battle.net parser is only available on Windows.",
"fatalError__i": "> Battle.net parser failed with fatal error:\n ${error}"
}
},
"UWPParser": {
"UWPDirTitle": "XboxGames Directory Override",
"UWPDirPlaceholder": "/path/to/XboxGames or /path/to/WindowsApps",
"UWPDirPlaceholder": {
"Windows_NT": "C:\\path\\to\\XboxGames\\ or C:\\path\\to\\WindowsApps\\",
"Darwin": "/path/to/XboxGames/ or /path/to/WindowsApps/",
"Linux": "/path/to/XboxGames/ or /path/to/WindowsApps/"
},
"UWPLauncherModeTitle": "Launch game as UWP instead of launcher helper",
"errors": {
"fatalError__i": "> UWP parser failed with fatal error:\n ${error}",
Expand All @@ -149,7 +174,11 @@
},
"uplayParser": {
"uplayDirTitle": "Ubisoft Directory Override",
"uplayDirPlaceholder": "/path/to/Ubisoft/",
"uplayDirPlaceholder": {
"Windows_NT": "C:\\path\\to\\Ubisoft\\",
"Darwin": "/path/to/Ubisoft/",
"Linux": "/path/to/Ubisoft/"
},
"launcherModeInputTitle": "Launch games via UPlay for online services",
"errors": {
"invalidManifestsOverride": "> Uplay Directory Override is not a valid directory.",
Expand All @@ -161,8 +190,11 @@
},
"gogParser": {
"galaxyExeOverrideTitle": "Galaxy Path Override",
"galaxyExeOverridePlaceholderWin": "C:\\path\\to\\GalaxyClient.exe",
"galaxyExeOverridePlaceholderMac": "/path/to/GOG Galaxy.app/Contents/MacOS/GOG Galaxy",
"galaxyExeOverridePlaceholder": {
"Windows_NT": "C:\\path\\to\\GalaxyClient.exe",
"Darwin": "/path/to/GOG Galaxy.app/Contents/MacOS/GOG Galaxy",
"Linux": "/path/to/GalaxyClient"
},
"launcherModeInputTitle": "Launch games via GOG Galaxy",
"parseLinkedExecsTitle": "Parse linked executables from GOG Galaxy",
"parseRegistryEntries": "Parse using Registry instead of Galaxy DB",
Expand All @@ -175,7 +207,11 @@
},
"amazonGamesParser": {
"exeOverrideTitle": "Amazon Games Path Override",
"exeOverridePlaceholder": "/path/to/Amazon Games.exe",
"exeOverridePlaceholder": {
"Windows_NT": "C:\\path\\to\\Amazon Games.exe",
"Darwin": "/path/to/Amazon Games.app/Contents/MacOS/Amazon Games",
"Linux": "/path/to/Amazon Games"
},
"launcherModeInputTitle": "Launch games via Amazon Games",
"errors": {
"invalidExeOverride": "> Amazon Games Installation Override is not a valid directory.",
Expand All @@ -186,7 +222,11 @@
},
"itchIoParser": {
"itchIoAppDataOverrideTitle": "itch.io AppData Directory Override",
"itchIoAppDataOverridePlaceholder": "/path/to/itch",
"itchIoAppDataOverridePlaceholder": {
"Windows_NT": "C:\\AppData\\itch\\",
"Darwin": "~/Library/Application Support/itch/",
"Linux": "~/.config/itch/"
},
"itchIoWindowsOnLinuxInstallDriveRedirectTitle": "Windows-on-Linux Install Drive Redirect",
"itchIoWindowsOnLinuxInstallDriveRedirectPlaceholder": "/mnt/d/",
"errors": {
Expand All @@ -199,7 +239,11 @@
},
"eaDesktopParser": {
"eaGamesDirTitle": "EA Games Directory Override",
"eaGamesDirPlaceholder": "/path/to/EA Games/",
"eaGamesDirPlaceholder": {
"Windows_NT": "C:\\path\\to\\EA Games\\",
"Darwin": "/path/to/EA Games/",
"Linux": "/path/to/EA Games/"
},
"eaLauncherModeTitle": "Launch games via EA Desktop",
"errors": {
"fatalError__i": "> EA Desktop parser failed with fatal error:\n ${error}",
Expand Down Expand Up @@ -329,25 +373,25 @@
"userAccounts": "For example ${steamlogin}",
"bySystem": {
"Windows_NT": {
"steamDirectory": "Typically C:\\Program Files (x86)\\Steam",
"romsDirectory": "For example D:\\ROMs",
"retroarchPath": "For example C:\\Path\\To\\retroarch.exe",
"raCoresDirectory": "Typically C:\\Users\\UserName\\AppData\\Roaming\\RetroArch\\cores",
"localImagesDirectory": "For example C:\\Path\\To\\LocalArtwork"
"steamDirectory": "Typically C:\\Program Files (x86)\\Steam\\",
"romsDirectory": "For example D:\\ROMs\\",
"retroarchPath": "For example C:\\Path\\To\\Retroarch.exe",
"raCoresDirectory": "Typically C:\\Users\\UserName\\AppData\\Roaming\\RetroArch\\cores\\",
"localImagesDirectory": "For example C:\\Path\\To\\LocalArtwork\\"
},
"Darwin": {
"steamDirectory": "Typically ~/Library/Application Support/Steam",
"romsDirectory": "For example ~/ROMs",
"steamDirectory": "Typically ~/Library/Application Support/Steam/",
"romsDirectory": "For example ~/ROMs/",
"retroarchPath": "For example /path/to/retroarch",
"raCoresDirectory": "Typically /Applications/Retroarch.app/Contents/Resources/cores",
"localImagesDirectory": "For example ~/path/to/localartwork"
"raCoresDirectory": "Typically /Applications/Retroarch.app/Contents/Resources/cores/",
"localImagesDirectory": "For example ~/path/to/localartwork/"
},
"Linux": {
"steamDirectory": "Typically /home/user/.steam/steam",
"romsDirectory": "For example ~/ROMs",
"steamDirectory": "Typically /home/user/.steam/steam/",
"romsDirectory": "For example ~/ROMs/",
"retroarchPath": "For example /path/to/retroarch",
"raCoresDirectory": "Typically /lib/x86_64-linux-gnu/libretro/cores",
"localImagesDirectory": "For example ~/path/to/localartwork"
"raCoresDirectory": "Typically /lib/x86_64-linux-gnu/libretro/cores/",
"localImagesDirectory": "For example ~/path/to/localartwork/"
}
}
}
Expand Down Expand Up @@ -489,18 +533,18 @@
"placeholder": {
"parserType": "Select parser...",
"configTitle": "My Awesome Parser",
"steamDirectory": "${steamdirglobal} or /path/to/steam",
"steamDirectory": "${steamdirglobal} or /path/to/steam/",
"userAccounts": "${steamuser1}${steamuser2} or ${${accountsglobal}}",
"titleFromVariable": "${variableGroup1}${variableGroup2}",
"titleModifier": "${fuzzyTitle} or ${title}",
"defaultImage__i": "/path/to/fallback_${artworkType}.png",
"localImages__i": "/path/to/art/${artworkType}/\\${title}.@(png|jpg)",
"romDirectory": "/path/to/games/",
"glob": "${title}.@(iso|ISO)",
"executableLocation": "Example: /path/to/emulator.exe",
"executableLocation": "/path/to/emulator.exe",
"executableArgs": "--arg1 --arg2",
"executableModifier": "\"${exePath}\"",
"startInDirectory": "/path/to/start/in/dir",
"startInDirectory": "/path/to/start/in/dir/",
"imageProviders": "None",
"multiAPIPlaceholder": "No Filter"
},
Expand Down Expand Up @@ -547,11 +591,11 @@
"defaultImage__md": "> Default image is an invalid path!",
"titleModifier__md": "> Title modifier field is required!",
"executableModifier__md": "> Executable modifier must not be empty!",
"variableString__md": "> Uneven number of `${` and `}` pairs. Use `\\` to escape `${` or `}` if you want to use them as characters.",
"variableString__md": "> Uneven number of `${` and `}` pairs! Use `\\` to escape `${` or `}` if you want to use them as characters.",
"imageProviders__md": "> Incorrect image providers type!",
"unhandledValidationKey__md": "> Input's validation is unhandled",
"genericDir__md": "> Directory is invalid",
"genericPath__md": "> Path is invalid"
"unhandledValidationKey__md": "> Input's validation is unhandled!",
"genericDir__md": "> Directory is invalid!",
"genericPath__md": "> Path is invalid!"
},
"text": {
"noTitle": "No title!"
Expand Down
12 changes: 0 additions & 12 deletions src/lib/file-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,6 @@ export class FileParser {
).trim();
})
: null;
/*const doubleVarRegex = /^\$\{\$\{.+\}\}$/;
if(doubleVarRegex.test(config.userAccounts.specifiedAccounts)) {
config.userAccounts.specifiedAccounts = preParser.setInput(config.userAccounts.specifiedAccounts).parse() ? preParser.replaceVariables((variable)=>{
return this.getEnvironmentVariable(variable as EnvironmentVariables, settings).trim();
}): null;
}*/
if (superType === parserInfo.ROMType) {
config.romDirectory = preParser.setInput(config.romDirectory).parse()
? preParser.replaceVariables((variable) => {
Expand Down Expand Up @@ -179,12 +173,6 @@ export class FileParser {
})
: null;
}
if (parser.inputs[inputName].forcedInput) {
config.parserInputs[inputName] =
parser.inputs[inputName].forcedInput;
} else if (config.parserInputs[inputName] === undefined) {
config.parserInputs[inputName] = "";
}
}
}
resolve({ superType: superType, config: config, settings: settings });
Expand Down
6 changes: 1 addition & 5 deletions src/lib/parsers/UWP.parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,13 @@ export class UWPParser implements GenericParser {
inputs: {
UWPDir: {
label: this.lang.UWPDirTitle,
placeholder: this.lang.UWPDirPlaceholder,
placeholder: this.lang.UWPDirPlaceholder[os.type()],
inputType: "dir",
validationFn: null,
info: this.lang.docs__md.input.join(""),
},
UWPLauncherMode: {
label: this.lang.UWPLauncherModeTitle,
inputType: "toggle",
validationFn: (input: any) => {
return null;
},
info: this.lang.docs__md.input.join(""),
},
},
Expand Down
15 changes: 1 addition & 14 deletions src/lib/parsers/amazon-games.parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,13 @@ export class AmazonGamesParser implements GenericParser {
inputs: {
amazonGamesExeOverride: {
label: this.lang.exeOverrideTitle,
placeholder: this.lang.exeOverridePlaceholder,
placeholder: this.lang.exeOverridePlaceholder[os.type()],
inputType: "dir",
validationFn: (input: string) => {
if (
!input ||
(fs.existsSync(input) && fs.lstatSync(input).isFile())
) {
return null;
} else {
return this.lang.errors.invalidExeOverride;
}
},
info: this.lang.docs__md.input.join(""),
},
amazonGamesLauncherMode: {
label: this.lang.launcherModeInputTitle,
inputType: "toggle",
validationFn: (input: any) => {
return null;
},
info: this.lang.docs__md.input.join(""),
},
},
Expand Down
3 changes: 1 addition & 2 deletions src/lib/parsers/battle-net.parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,8 @@ export class BattleNetParser implements GenericParser {
inputs: {
battleExeOverride: {
label: this.lang.battleExeOverrideTitle,
placeholder: this.lang.battleExeOverridePlaceholder,
placeholder: this.lang.battleExeOverridePlaceholder[os.type()],
inputType: "path",
validationFn: null,
info: this.lang.docs__md.input.join(""),
},
},
Expand Down
4 changes: 1 addition & 3 deletions src/lib/parsers/ea-desktop.parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ export class EADesktopParser implements GenericParser {
inputs: {
eaGamesDir: {
label: this.lang.eaGamesDirTitle,
placeholder: this.lang.eaGamesDirPlaceholder,
placeholder: this.lang.eaGamesDirPlaceholder[os.type()],
inputType: "dir",
validationFn: null,
info: this.lang.docs__md.input.join(""),
},
eaLauncherMode: {
label: this.lang.eaLauncherModeTitle,
inputType: "toggle",
validationFn: null,
info: this.lang.docs__md.input.join(""),
},
},
Expand Down
6 changes: 1 addition & 5 deletions src/lib/parsers/epic.parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,13 @@ export class EpicParser implements GenericParser {
inputs: {
epicManifests: {
label: this.lang.manifestsInputTitle,
placeholder: this.lang.manifestsInputPlaceholder,
placeholder: this.lang.manifestsInputPlaceholder[os.type()],
inputType: "dir",
validationFn: null,
info: this.lang.docs__md.input.join(""),
},
epicLauncherMode: {
label: this.lang.launcherModeInputTitle,
inputType: "toggle",
validationFn: (input: any) => {
return null;
},
info: this.lang.docs__md.input.join(""),
},
},
Expand Down
Loading

0 comments on commit eed52fb

Please sign in to comment.