Jump to content

Help with adding game to Extensions


lornlynx

Recommended Posts

Hey, I tried adding "Nier: Automata" to as a custom game to the extensions, as it isn't included in the games tab.

I followed this guide (wihtout the user environmnent and installation patterns): https://wiki.nexusmods.com/index.php/Creating_a_game_extension_for_Vortex

It appears in the list but vortex tells me it failed with the implementation.

 

Here's the file's I've added to appdata:

 

 

The info.json and the index.js code:

{
  "name": "Game: Nier: Automata",
  "author": "lornlynx",
  "version": "0.0.1",
  "description": "Nier: Automata"
}
// Nexus Mods domain for the game. e.g. nexusmods.com/nierautomata
const GAME_ID = 'nierautomata';

//Steam Application ID, you can get this from https://steamdb.info/apps/
const STEAMAPP_ID = '524220';

//GOG Application ID, you can get this from https://www.gogdb.org/
//const GOGAPP_ID = '1133514031';


//Import some assets from Vortex we'll need.
const path = require('path');
const { fs, log, util } = require('vortex-api');


//Add this to the top of the file
const winapi = require('winapi-bindings');

function findGame() {
  try {
    const instPath = winapi.RegGetValue(
      'HKEY_LOCAL_MACHINE',
      'SOFTWARE\\WOW6432Node\\Valve\\Steam\\Apps\\' + STEAM_ID,
      'PATH');
    if (!instPath) {
      throw new Error('empty registry key');
    }
    return Promise.resolve(instPath.value);
  } catch (err) {
    return util.GameStoreHelper.findByAppId([STEAMAPP_ID])
      .then(game => game.gamePath);
  }
}

function prepareForModding(discovery) {
    return fs.readdirAsync(path.join(discovery.path, 'NieRAutomata'.));
}

function main(context) {
    //This is the main function Vortex will run when detecting the game extension. 
    
    context.registerGame({
        id: GAME_ID,
        name: 'Nier: Automata',
        mergeMods: true,
        queryPath: findGame,
        supportedTools: [],
        queryModPath: () => 'NieRAutomata',
        logo: 'gameart.jpg',
        executable: () => 'NieRAutomata.exe',
        requiredFiles: [
          'NieRAutomata.exe'
        ],
        setup: undefined,
        environment: {
          SteamAPPId: STEAMAPP_ID,
        },
        details: {
          steamAppId: STEAMAPP_ID,
        },
    });

    return true
}

module.exports = {
    default: main,
  };

any help appreciated

Link to comment
Share on other sites

I don't have a copy of Nier to test with, but the reason it won't load is because you have a syntax error on line 36 of your index.js file: there's an extra '.' that shouldn't be there.

 

The only other thing that jumps out at me is that you're not actually using your prepareForModding function. You need to change line 54 from setup: undefined to setup: prepareForModding to actually use it.

 

At least on my machine I can change those two things and the extension successfully loads (I don't have the game though, so that's the best I can tell you).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...