Skip to content

Commit

Permalink
We need Node Gyp dependencies
Browse files Browse the repository at this point in the history
Set game store manually
Corrected module info reading
  • Loading branch information
Aragas committed Nov 15, 2023
1 parent 9fe8353 commit eb93f73
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
26 changes: 24 additions & 2 deletions src/utils/VortexLauncherManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<types.IInstallResult> => {
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<string>();
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/utils/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down

0 comments on commit eb93f73

Please sign in to comment.