From eb93f732da60e8ab45464b5659974373d45eb2aa Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Wed, 15 Nov 2023 15:12:53 +0200 Subject: [PATCH] We need Node Gyp dependencies Set game store manually Corrected module info reading --- .devcontainer/devcontainer.json | 2 +- src/utils/VortexLauncherManager.ts | 26 ++++++++++++++++++++++++-- src/utils/util.ts | 1 + 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 54718bd..3f2242b 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,7 +6,7 @@ "features": { "ghcr.io/devcontainers/features/node:1": { "version": "16.19.1", - "nodeGypDependencies": "false" + "nodeGypDependencies": "true" }, "ghcr.io/devcontainers/features/powershell:1": { "version": "latest" diff --git a/src/utils/VortexLauncherManager.ts b/src/utils/VortexLauncherManager.ts index 5ac1bb6..60e2c98 100644 --- a/src/utils/VortexLauncherManager.ts +++ b/src/utils/VortexLauncherManager.ts @@ -213,9 +213,11 @@ export class VortexLauncherManager { * Calls LauncherManager's installModule and converts the result to Vortex data */ public installModuleVortex = (files: string[], destinationPath: string): Bluebird => { - const subModuleFilePath = files.find(x => x.endsWith("SubModule.xml"))!; + const subModuleRelFilePath = files.find(x => x.endsWith("SubModule.xml"))!; + const subModuleFilePath = path.join(destinationPath, subModuleRelFilePath); const subModuleFile = readFileSync(subModuleFilePath, { encoding: "utf-8" }); - const moduleInfo = BannerlordModuleManager.getModuleInfoWithPath(subModuleFile, subModuleFilePath)!; + const moduleInfo = BannerlordModuleManager.getModuleInfoWithPath(subModuleFile, subModuleRelFilePath)!; + moduleInfo.path = subModuleRelFilePath; // TODO: fix the library const result = this._launcherManager.installModule(files, [moduleInfo]); const subModsIds = Array(); @@ -291,6 +293,26 @@ export class VortexLauncherManager { return this._launcherManager.localizeString(template, values); } + /** + * Sets the game store manually, since the launcher manager is not perfect. + */ + public setStore = (STORE_ID: string) => { + switch(STORE_ID){ + case `steam`: + this._launcherManager.setGameStore(`Steam`); + break; + case `gog`: + this._launcherManager.setGameStore(`GOG`); + break; + case `xbox`: + this._launcherManager.setGameStore(`Xbox`); + break; + case `xbox`: + this._launcherManager.setGameStore(`Xbox`); + break; + } + }; + /** * Callback diff --git a/src/utils/util.ts b/src/utils/util.ts index 131548e..3d5ee24 100644 --- a/src/utils/util.ts +++ b/src/utils/util.ts @@ -64,6 +64,7 @@ export const prepareForModding = async (context: types.IExtensionContext, discov // Check if we've already set the load order object for this profile and create it if we haven't. return startSteam().finally(() => { + manager.setStore(STORE_ID); manager.initializeModuleViewModels(); manager.orderBySavedLoadOrder(); });