Skip to content

Commit

Permalink
GOG Galaxy parser working great on Mac OS
Browse files Browse the repository at this point in the history
  • Loading branch information
cbartondock committed Jul 17, 2024
1 parent ae34290 commit 40ecf04
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ In addition to flexible importing of ROMS, SRM now has several *platform parsers
|[Amazon Games](https://gaming.amazon.com/amazon-games-app)||🟦|🟦|<ul><li>Launch via Amazon Games</li><li>Launch via executable</li>|
|[EA Desktop](https://www.ea.com/ea-app)||🟦|🟦|<ul><li>Launch via EA Desktop</li><li>Launch via executable</li>|
|[Epic](https://store.epicgames.com/en-US/)|||🟦|<ul><li>Launch via Epic</li><li>Launch via executable</li>|
|[GOG Galaxy](https://www.gog.com/galaxy)|||🟦|<ul><li>Launch via GOG Galaxy</li><li>Launch via executable</li>|
|[GOG Galaxy](https://www.gog.com/galaxy)||||🟦|<ul><li>Launch via GOG Galaxy</li><li>Launch via executable</li>|
|[Itch.io](https://itch.io/app)||||<ul><li>Launch via executable</li></ul>|
|[Legendary](https://github.com/derrod/legendary)||||<ul><li>Launch via executable</li></ul>|
|[Ubisoft Connect](https://ubisoftconnect.com/en-US/)|||🟦|<ul><li>Launch via Ubisoft Connect</li><li>Launch via executable</li>|
Expand Down
3 changes: 2 additions & 1 deletion src/lang/en-US/langStrings.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@
},
"gogParser": {
"galaxyExeOverrideTitle": "Galaxy Path Override",
"galaxyExeOverridePlaceholder": "/path/to/GalaxyClient.exe",
"galaxyExeOverridePlaceholderWin": "C:\\path\\to\\GalaxyClient.exe",
"galaxyExeOverridePlaceholderMac": "/path/to/GOG Galaxy.app/Contents/MacOS/GOG Galaxy",
"launcherModeInputTitle": "Launch games via GOG Galaxy",
"parseLinkedExecsTitle": "Parse linked executables from GOG Galaxy",
"errors": {
Expand Down
9 changes: 5 additions & 4 deletions src/lang/en-US/markdown/gog-parser-input.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# GOG Galaxy Parser Specific Inputs

## Galaxy Path Override
By default Steam ROM Manager assumes your Galaxy Client is located at `C:\Program Files (x86)\GOG Galaxy\GalaxyClient.exe`. This field allows you to override that path if your GOG Galaxy installation is elsewhere.
By default Steam ROM Manager assumes your GOG Galaxy executable is located at `C:\Program Files (x86)\GOG Galaxy\GalaxyClient.exe` on Windows and `/Applications/GOG Galaxy.app/Contents/MacOS/GOG Galaxy` on Mac. This field allows you to override that path if your GOG Galaxy executable is elsewhere.

This field is actually only necessary if you enable launch via GOG Galaxy (see below), as otherwise SRM has no need of the location of the Galaxy Client.
Specifying the correct location of GOG Galaxy's executable is only necessary if you enable launch via GOG Galaxy (see below), as otherwise SRM has no need of the location of GOG Galaxy's executable.

## Launch Via GOG Galaxy `[Recommend disabled]`

What it sounds like, this toggle let's you set whether games will launch via GOG Galaxy or directly. Note that for some games launching from GOG Galaxy may fail, and the Steam overlay will most likely not work.
What it sounds like, this toggle determines whether games launch via GOG Galaxy or directly. For some games launching from GOG Galaxy may fail, and the Steam overlay will most likely not work.

## Parse Linked Executables from GOG Galaxy

If enabled, SRM will pull in not only GOG games aquired from GOG Galaxy's store, but also those you have manually linked executables for in GOG Galaxy. This is desirable if those games are not being parsed into SRM elsewhere.
A caveat is that because GOG Galaxy does not store the names of such games, SRM will use the directory name of the executable: `C:\\path\\to\\Hoa\\LaunchHoa.exe` would be assigned the title `Hoa`.

A caveat is that because GOG Galaxy does not store the names linked executables in its database, SRM will use the directory name of the executable on Windows (e.g. `C:\\path\\to\\Hoa\\LaunchHoa.exe` would be assigned the title `Hoa`) and the executable name on Mac (e.g. `/Applications/Symphonia.app` would be assigned the title `Symphonia`).
26 changes: 19 additions & 7 deletions src/lib/parsers/gog-galaxy.parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class GOGParser implements GenericParser {
inputs: {
'galaxyExeOverride': {
label: this.lang.galaxyExeOverrideTitle,
placeholder: this.lang.galaxyExeOverridePlaceholder,
placeholder: os.type()=='Windows_NT' ? this.lang.galaxyExeOverridePlaceholderWin : this.lang.galaxyExeOverridePlaceholderMac,
inputType: 'path',
validationFn: null,
info: this.lang.docs__md.input.join('')
Expand All @@ -41,14 +41,19 @@ export class GOGParser implements GenericParser {

execute(directories: string[], inputs: { [key: string]: any }, cache?: { [key: string]: any }) {
return new Promise<ParsedData>(async (resolve,reject)=>{
let dbPath: string = '';
let galaxyExePath = inputs.galaxyExeOverride || 'C:\\Program Files (x86)\\GOG Galaxy\\GalaxyClient.exe';

let dbPath, galaxyExePath: string;
if(os.type()=='Windows_NT') {
dbPath = 'C:\\ProgramData\\GOG.com\\Galaxy\\storage\\galaxy-2.0.db'
dbPath = 'C:\\ProgramData\\GOG.com\\Galaxy\\storage\\galaxy-2.0.db';
galaxyExePath = 'C:\\Program Files (x86)\\GOG Galaxy\\GalaxyClient.exe';
} else if(os.type()=='Darwin') {
dbPath = '/Users/Shared/GOG.com/Galaxy/Storage/galaxy-2.0.db';
galaxyExePath = '/Applications/GOG Galaxy.app/Contents/MacOS/GOG Galaxy';
} else {
return reject(this.lang.errors.gogNotCompatible);
}
if(inputs.galaxyExeOverride) {
galaxyExePath = inputs.galaxyExeOverride
}
if(!fs.existsSync(dbPath)) {
return reject(this.lang.errors.gogNotInstalled);
}
Expand All @@ -60,10 +65,17 @@ export class GOGParser implements GenericParser {
for(let task of playtasks) {
if(task.params.executablePath) {
const productID = task.productId.toString();
const flag = os.type() == 'Windows_NT' ? '/' : '--';
let fallbackTitle;
if(os.type() == 'Windows_NT') {
fallbackTitle = path.dirname(task.params.executablePath).split(path.sep).pop();
} else {
fallbackTitle = task.params.executablePath.split(path.sep).pop().slice().replace(/\.[^.]*$/, '');
}
parsedData.success.push({
extractedTitle: task.title || path.dirname(task.params.executablePath).split(path.sep).pop(),
extractedTitle: task.title || fallbackTitle,
extractedAppId: productID,
launchOptions: `/command=runGame /gameId=${productID}`,
launchOptions: `${flag}command=runGame ${flag}gameId=${productID}`,
filePath: task.params.executablePath,
fileLaunchOptions: task.params.commandLineArgs
})
Expand Down
3 changes: 2 additions & 1 deletion src/models/language.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ export interface languageStruct {
},
gogParser: {
galaxyExeOverrideTitle: string,
galaxyExeOverridePlaceholder: string,
galaxyExeOverridePlaceholderWin: string,
galaxyExeOverridePlaceholderMac: string,
launcherModeInputTitle: string,
parseLinkedExecsTitle: string,
docs__md: {
Expand Down

0 comments on commit 40ecf04

Please sign in to comment.