From 7201bdb7d6ee7e5156cbd4f1f46c74381e3b1b6a Mon Sep 17 00:00:00 2001 From: Mike Date: Mon, 21 Nov 2022 12:10:46 +0000 Subject: [PATCH 1/7] Added support for Fallout 76 on Xbox Game Pass --- index.js | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 7c639e9..a26d363 100644 --- a/index.js +++ b/index.js @@ -9,6 +9,7 @@ const parser = new IniParser.default(new IniParser.WinapiFormat()); const GAME_ID = 'fallout76'; const STEAM_APP_ID = '1151340'; +const XBOX_ID = 'BethesdaSoftworks.Fallout76-PC'; const ARCHIVE_EXT = '.ba2'; const fallout76CustomINI = 'Fallout76Custom.ini'; const iniPath = path.join(remote.app.getPath('documents'), 'My Games', 'Fallout 76'); @@ -24,7 +25,7 @@ const tools = [ ] function findGame() { - return util.GameStoreHelper.findByAppId(STEAM_APP_ID) + return util.GameStoreHelper.findByAppId(STEAM_APP_ID, XBOX_ID) .then((game) => { return game.path; }) @@ -181,6 +182,17 @@ function deboucedUpdateArchiveList(previous, current, api) { updateArchiveList(changedProfile, api) } +async function findExecutable(api) { + const state = api.getState(); + const discovery = state.settings.gameMode.discovered?.[GAME_ID]; + const store = discovery.store; + + if (!['steam', 'xbox'].includes(store)) log('warn', 'Could not find game store for Fallout 76. Assuming EXE name is Fallout76.exe'); + + if (store === 'xbox') return 'Project76_GamePass.exe'; + else return 'Fallout76.exe'; +} + function main(context) { context.requireVersion('^1.2.0'); context.registerGame({ @@ -192,10 +204,8 @@ function main(context) { queryModPath: () => 'data', setup: () => onGameModeActivated(GAME_ID, context.api), logo: path.join('assets', 'gameart.jpg'), - executable: () => 'Fallout76.exe', - requiredFiles: [ - 'Fallout76.exe', - ], + executable: () => findExecutable(context.api), + requiredFiles: [], environment: { SteamAPPId: STEAM_APP_ID, }, @@ -234,7 +244,7 @@ function migrate200(api, oldVersion) { const state = api.store.getState(); const activatorId = selectors.activatorForGame(state, GAME_ID); const activator = util.getActivator(activatorId); - const discovery = util.getSafe(state, ['settings', 'gameMode', 'discovered', BLOODSTAINED_ID], undefined); + const discovery = util.getSafe(state, ['settings', 'gameMode', 'discovered', GAME_ID], undefined); const mods = util.getSafe(state, ['persistent', 'mods', GAME_ID], undefined); // If we're not managed Fallout 76 yet, do nothing. @@ -270,4 +280,4 @@ function migrate200(api, oldVersion) { module.exports = { default: main, -}; \ No newline at end of file +}; From fbd733820e5917a6e62bb94a57396ae0f954e51e Mon Sep 17 00:00:00 2001 From: Mike Date: Mon, 21 Nov 2022 12:11:14 +0000 Subject: [PATCH 2/7] Added support for Fallout 76 on Xbox Game Pass --- info.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/info.json b/info.json index 14d5569..ec80e7b 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { - "name":"Game: Fallout76", + "name":"Game: Fallout 76", "author":"Netrve, Pickysaurus, MassimoMx", - "version":"2.1.2", + "version":"2.2.0", "description":"An extension for Vortex, enabling support for Fallout 76 mod management through Vortex." } From bf83827322703b1b2ded0fd23520c4ecd429f288 Mon Sep 17 00:00:00 2001 From: Mike Watling Date: Mon, 21 Nov 2022 12:50:24 +0000 Subject: [PATCH 3/7] Discovery can be undefined. --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index a26d363..aee83bb 100644 --- a/index.js +++ b/index.js @@ -108,7 +108,7 @@ function getBA2Mods(payload, excludeModCondition) { const BA2Mods = Object.keys(profile.modState).map(modId => { if (!excludeModCondition(profile, modId)) return; const mod = state.persistent.mods[gameId][modId]; - if (mod && mod.attributes && mod.attributes.ba2archives) return mod; + if (mod && mod?.attributes && mod?.attributes.ba2archives) return mod; else return; }).filter(m => m !== undefined); @@ -185,7 +185,7 @@ function deboucedUpdateArchiveList(previous, current, api) { async function findExecutable(api) { const state = api.getState(); const discovery = state.settings.gameMode.discovered?.[GAME_ID]; - const store = discovery.store; + const store = discovery?.store; if (!['steam', 'xbox'].includes(store)) log('warn', 'Could not find game store for Fallout 76. Assuming EXE name is Fallout76.exe'); From 26d7f123ce9e3d3b2ee30e5c8d8df9680f6aa26f Mon Sep 17 00:00:00 2001 From: Mike Watling Date: Mon, 21 Nov 2022 14:46:28 +0000 Subject: [PATCH 4/7] Fallout 76 for gamepass will now be properly detected. --- index.js | 45 ++++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/index.js b/index.js index aee83bb..f7bf17e 100644 --- a/index.js +++ b/index.js @@ -5,6 +5,7 @@ const winapi = require('winapi-bindings'); const path = require('path'); const semver = require('semver'); const IniParser = require('vortex-parse-ini'); +const { fstatSync } = require('fs'); const parser = new IniParser.default(new IniParser.WinapiFormat()); const GAME_ID = 'fallout76'; @@ -24,12 +25,13 @@ const tools = [ } ] -function findGame() { - return util.GameStoreHelper.findByAppId(STEAM_APP_ID, XBOX_ID) +async function findGame() { + return util.GameStoreHelper.findByAppId([STEAM_APP_ID, XBOX_ID]) .then((game) => { - return game.path; + return game.gamePath; + // return (game.gameStoreId === 'xbox') ? path.join(game.gamePath, 'Content') : game.gamePath; }) - .catch(() => { + .catch((err) => { // Try finding the game on Bethesda.net if the Steam detection fails. const bethNetPath = winapi.RegGetValue('HKEY_LOCAL_MACHINE', 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Fallout 76', @@ -182,15 +184,32 @@ function deboucedUpdateArchiveList(previous, current, api) { updateArchiveList(changedProfile, api) } -async function findExecutable(api) { - const state = api.getState(); - const discovery = state.settings.gameMode.discovered?.[GAME_ID]; - const store = discovery?.store; +function findExecutable(discoveryPath) { + const steamExe = 'Fallout76.exe'; + const xboxExe = 'Project76_GamePass.exe'; + + if (!discoveryPath) return steamExe; - if (!['steam', 'xbox'].includes(store)) log('warn', 'Could not find game store for Fallout 76. Assuming EXE name is Fallout76.exe'); + try { + // Steam version + fs.statSync(path.join(discoveryPath, steamExe)); + return steamExe; + } + catch(err) { + // Could not stat to Steam path + } + + try { + //Xbox version + fs.statSync(path.join(discoveryPath, xboxExe)); + return xboxExe; + } + catch(err) { + // Could not stat the Xbox path + } - if (store === 'xbox') return 'Project76_GamePass.exe'; - else return 'Fallout76.exe'; + log('error', 'Neither the Steam or Xbox EXE paths exist for Fallout 76'); + throw new Error('Neither the Steam or Xbox EXE paths exist for Fallout 76'); } function main(context) { @@ -204,8 +223,8 @@ function main(context) { queryModPath: () => 'data', setup: () => onGameModeActivated(GAME_ID, context.api), logo: path.join('assets', 'gameart.jpg'), - executable: () => findExecutable(context.api), - requiredFiles: [], + executable: findExecutable, + requiredFiles: [ 'Data' ], environment: { SteamAPPId: STEAM_APP_ID, }, From e4eca32e5f62a925e58b43e35f5ed0ae915e1a5c Mon Sep 17 00:00:00 2001 From: Mike Watling Date: Mon, 21 Nov 2022 14:48:08 +0000 Subject: [PATCH 5/7] Removed accidental import. --- index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/index.js b/index.js index f7bf17e..3cc5e11 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,6 @@ const winapi = require('winapi-bindings'); const path = require('path'); const semver = require('semver'); const IniParser = require('vortex-parse-ini'); -const { fstatSync } = require('fs'); const parser = new IniParser.default(new IniParser.WinapiFormat()); const GAME_ID = 'fallout76'; From 5eb8bdbb4962f27ee976d398263eb53578df7e94 Mon Sep 17 00:00:00 2001 From: Mike Watling Date: Mon, 21 Nov 2022 16:19:35 +0000 Subject: [PATCH 6/7] Comment out the error as this crashes the entire app. --- index.js | 3 ++- info.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 3cc5e11..8741ccb 100644 --- a/index.js +++ b/index.js @@ -208,7 +208,8 @@ function findExecutable(discoveryPath) { } log('error', 'Neither the Steam or Xbox EXE paths exist for Fallout 76'); - throw new Error('Neither the Steam or Xbox EXE paths exist for Fallout 76'); + return; + // throw new Error('Neither the Steam or Xbox EXE paths exist for Fallout 76'); } function main(context) { diff --git a/info.json b/info.json index ec80e7b..5d13791 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name":"Game: Fallout 76", "author":"Netrve, Pickysaurus, MassimoMx", - "version":"2.2.0", + "version":"2.2.1", "description":"An extension for Vortex, enabling support for Fallout 76 mod management through Vortex." } From 9893a471da4a96ca0fcdddf0e296304e3ccfa1df Mon Sep 17 00:00:00 2001 From: Mike Watling Date: Mon, 21 Nov 2022 16:20:26 +0000 Subject: [PATCH 7/7] Return the Steam version if all else fails. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 8741ccb..f634825 100644 --- a/index.js +++ b/index.js @@ -208,7 +208,7 @@ function findExecutable(discoveryPath) { } log('error', 'Neither the Steam or Xbox EXE paths exist for Fallout 76'); - return; + return steamExe; // throw new Error('Neither the Steam or Xbox EXE paths exist for Fallout 76'); }