Skip to content

Commit

Permalink
Fixed a bug where Extension doesn't recognize if the Game Engine was …
Browse files Browse the repository at this point in the history
…changed
  • Loading branch information
Der-Floh authored Aug 11, 2023
1 parent 1215550 commit 4b3093f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const melon_loader = "https://github.com/LavaGang/MelonLoader/releases";

let IS_NEW_ENGINE;
let CONTEXT_API;
let DISCOVERY_PATH;

const winapi = require("winapi-bindings");
const { fs, util, log } = require("vortex-api");
Expand Down Expand Up @@ -54,8 +55,9 @@ function findGame() {
}

async function prepareForModding(discovery) {
DISCOVERY_PATH = discovery;
const modloaderpath = path.join(discovery.path, "resources", "app", ".webpack", "renderer", "mod_loader");
const isNew = await isNewEngine(discovery);
let isNew = await isNewEngine(discovery);
log("info", `Is New Engine: "${isNew}"`);
if (isNew) {
return fs.ensureDirWritableAsync(path.join(discovery.path, "MelonLoader")).then(() => checkForMelonLoader(path.join(discovery.path, "MelonLoader", "MelonLoader.xml")));
Expand All @@ -65,12 +67,9 @@ async function prepareForModding(discovery) {
}

async function isNewEngine(discovery) {
const isNew = await fs
.statAsync(path.join(discovery.path, "UnityCrashHandler64.exe"))
.then(() => {
let isNew = await fs.statAsync(path.join(discovery.path, "UnityCrashHandler64.exe")).then(() => {
return true;
})
.catch(() => {
}).catch(() => {
return false;
});
IS_NEW_ENGINE = isNew;
Expand Down Expand Up @@ -112,6 +111,7 @@ function checkForMelonLoader(melonloaderpath) {
}

async function testSupportedContentOldEngine(files, gameId, modPath) {
await isNewEngine(DISCOVERY_PATH);
const supported = gameId === GAME_ID && files.some((file) => path.extname(file).toLowerCase() === OLD_MOD_EXT);
if (supported && IS_NEW_ENGINE) {
CONTEXT_API.sendNotification({
Expand Down Expand Up @@ -155,6 +155,7 @@ async function installContentOldEngine(files) {
}*/

async function testSupportedContentNewEngine(files, gameId, modPath) {
await isNewEngine(DISCOVERY_PATH);
const supported = gameId === GAME_ID && files.some((file) => path.extname(file).toLowerCase() === NEW_MOD_EXT);
if (supported && !IS_NEW_ENGINE) {
CONTEXT_API.sendNotification({
Expand Down
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Vampire Survivors Support",
"author": "DerrFloh",
"version": "1.0.0",
"version": "2.1.1",
"description": "Vortex support for Vampire Survivors"
}

0 comments on commit 4b3093f

Please sign in to comment.