Anvillior Posted March 28 Share Posted March 28 Ages ago I made the Battlefleet Gothic Armada 2 extension for Vortex using add game wizard. It worked great. Recently I tried recoding it in the more standard way and it works, but there's one thing I can't get it to do: Launch through steam. BFGA2 modded requires launch commands for its mods to work, but recently it also now crashes unless another line of code is added to its launch commands. As such, launching through vortex, through the executable, is no longer viable unless the play button on vortex routes through the steam app, and thus, runs your launch commands. I've tried grabbing the code from the old index.js and it doesn't work, likely because the two files are structured differently. I'm stumbling through javascript, so I can barely read and understand the code as it's already written. If someone knows the code to make the vortex extension launch through the steam app, or can guide me on how to code it, I'd be grateful, and so would all 3 of the people still playing Warhammer 40k: Battleboats. Link to comment Share on other sites More sharing options...
ChemBoy1 Posted April 22 Share Posted April 22 You can set up a tool with the command line argument to pass to the game executable. Here's an example from my Alan Wake 2 extension. For launching in Steam, you need to add this to your game spec. "requiresLauncher": "steam" The Add Game Wizard extension already has this function that will pass that value to the game registration function: function makeRequiresLauncher(api, gameSpec) { return () => Promise.resolve((gameSpec.game.requiresLauncher !== undefined) ? { launcher: gameSpec.game.requiresLauncher } : undefined); const tools = [ { id: "AlanWake2", name: "Alan Wake 2", logo: "icon.png", executable: () => "AlanWake2.exe", parameters: [ '-EpicPortal', ], requiredFiles: ["AlanWake2.exe"], detach: true, relative: true, exclusive: true, defaultPrimary: true, }, ]; 1 Link to comment Share on other sites More sharing options...
Anvillior Posted April 22 Author Share Posted April 22 Hey, thanks for responding. So this is what my code looks like: //Import some assets from Vortex we'll need. const path = require('path'); const { fs, log, util } = require('vortex-api'); // Nexus Mods domain for the game. e.g. nexusmods.com/battlefleetgothicarmada2 const GAME_ID = 'battlefleetgothicarmada2'; //Steam Application ID, you can get this from https://steamdb.info/apps/ const STEAMAPP_ID = '573100'; function findGame() { return util.GameStoreHelper.findByAppId([STEAMAPP_ID]) .then(game => game.gamePath); } function prepareForModding(discovery) { return fs.ensureDirWritableAsync(path.join(discovery.path, 'BattlefleetGothic2', 'Content', 'Paks', 'Stock')); } function main(context) { //This is the main function Vortex will run when detecting the game extension. context.registerGame({ id: GAME_ID, name: 'Battlefleet Gothic: Armada 2', mergeMods: true, queryPath: findGame, supportedTools: [], queryModPath: () => 'BattlefleetGothic2', logo: 'gameart.jpg', executable: () => 'BattlefleetGothic2.exe', requiredFiles: [ 'BattlefleetGothic2.exe', ], setup: prepareForModding, environment: { SteamAPPId: STEAMAPP_ID, }, details: { steamAppId: STEAMAPP_ID, stopPatterns: ['(^|/)Content(/|$)'], }, }); return true; } module.exports = { default: main, }; I did try including the line about required launcher and the function above, but it would lead to the extension failing to load. I did try changing function makeRequiresLauncher(api, gameSpec) { return () => Promise.resolve((gameSpec.game.requiresLauncher !== undefined) ? { launcher: gameSpec.game.requiresLauncher } : undefined); to function makeRequiresLauncher(api, main) { return () => Promise.resolve((main.requiresLauncher !== undefined) ? { launcher: main.requiresLauncher } : undefined); and while it detected the extension that time, attempting to run it gave me: game.requiresLauncher is not a function I do notice that AddGameWizard structures the main part as a constant, so I'm guessing that could have something to do with it, but I'm barely wrapping my head around javascript. Link to comment Share on other sites More sharing options...
Solution ChemBoy1 Posted April 23 Solution Share Posted April 23 This post was recognized by Pickysaurus! ChemBoy1 was awarded the badge 'Helpful' and 10 points. So the thing you need is the function call to the "RequiresLauncher" function in the registerGame function: requiresLauncher: makeRequiresLauncher(context.api, gameSpec), If you are not using the "Add Game Wizard" structure, you can literally just skip the function call and write this: requiresLauncher: () => { launcher: 'steam' }, This should work in this case since steam launcher requires no additional parameters to function. If it were Epic or Xbox app, you would need to have additional parameters there. You also need to have the "findGame" function return an arrow function to the value, like below. Notice the arrow function after "return". function makeFindGame(api, gameSpec) { return () => util.GameStoreHelper.findByAppId(gameSpec.discovery.ids) //.catch(() => util.GameStoreHelper.findByName(gameSpec.discovery.names)) .then((game) => game.gamePath); } 1 1 Link to comment Share on other sites More sharing options...
Anvillior Posted April 29 Author Share Posted April 29 Thanks for the help! My extension launches through steam now and works just fine! Link to comment Share on other sites More sharing options...
ChemBoy1 Posted April 29 Share Posted April 29 Awesome! Glad to hear it's working. 1 Link to comment Share on other sites More sharing options...
Anvillior Posted April 29 Author Share Posted April 29 Out of curiosity, how does one tell the file what launcher the game is installed to? It'd be useful to know for any future updates or other games I tried to make an extension for. You said there were more parameters that'd need to be set up? Link to comment Share on other sites More sharing options...
ChemBoy1 Posted April 29 Share Posted April 29 I am actually working on that particular question myself for my Prey (2017) extension needs to be able to tell which version of the game was discovered (Steam, Epic, or GOG) since they all have different folder names for the executable (WHY!?!?!). Might help to dig into the extensions for a game like Fallout 3/4 since it has good support for multiple game stores. Link to comment Share on other sites More sharing options...
Pickysaurus Posted April 30 Share Posted April 30 If Vortex discovers it automatically the game store will be specified and can be retrieved from the state. If the user manually sets the game path it'll be marked as "Unknown". Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now