Nexus-Mods / Vortex

Vortex Development
GNU General Public License v3.0
830 stars 127 forks source link

Review: DOOM Eternal #15618

Open ChemGuy1611 opened 2 weeks ago

ChemGuy1611 commented 2 weeks ago

Nexus Username

ChemBoy1

Extension URL

https://www.nexusmods.com/site/mods/865

Game URL

https://www.nexusmods.com/doometernal

Existing Extension URL

deleted

New features

There was an extension previously, but it appears to be deleted from Nexus.

This version does add some features that extension did not have:

  1. Automatic download of the EternalModInjector (required for modding the game files)
  2. Built-in tool for the mod injector

Information

Packaging

Testing

If a task fails, contact the author to request changes before continuing.

When reviewed and passed, please complete the following tasks:

insomnious commented 1 week ago

DOOM Eternal Vortex Extension-865-0-1-0-1714401946.zip

IDCs commented 1 week ago

Hey there @ChemGuy1611,

Went through your extension and there are a few changes that are required before we add the extension to the manifest.

This is specifically to help out with the automatic download/install of the eternal mod injector.

First of all, your custom installer will currently kick off for all archives, including the injector - we can easily fix that using the custom installer's test function.

async function testZipContent(files, gameId) {
  const isInjector = files.some(file => path.basename(file).toLocaleLowerCase() === 'eternalmodmanager.exe');
  return Promise.resolve({
    supported: (gameId === spec.game.id) && !isInjector,
    requiredFiles: []
  });
}

Next step is to make sure that the modType is set correctly after mod installation.

In the downloadEternalModInjector function, replace the try/catch block with this:

try {
      const dlInfo = {
        game: gameSpec.game.id,
        name: 'EternalModInjector',
      };
      const URL = `https://gamebanana.com/dl/1057297`;
      const dlId = await util.toPromise(cb =>
        api.events.emit('start-download', [URL], dlInfo, undefined, cb, undefined, { allowInstall: false }));
      const modId = await util.toPromise(cb =>
        api.events.emit('start-install-download', dlId, { allowAutoEnable: false }, cb));
      const profileId = selectors.lastActiveProfileForGame(api.getState(), gameSpec.game.id);
      const batched = [
        actions.setModsEnabled(api, profileId, [modId], true, {
          allowAutoDeploy: true,
          installed: true,
        }),
        actions.setModType(gameSpec.game.id, modId, 'doometernal-binaries'), // Set the modType
      ];
      util.batchDispatch(api.store, batched); // Will dispatch both actions.
    //Show the user the download page if the download/install process fails
    } catch (err) {
      const errPage = `https://gamebanana.com/tools/7475`;
      api.showErrorNotification('Failed to download/install EternalModInjector. You must download manually.', err);
      util.opn(errPage).catch(() => null);
    } finally {
      api.dismissNotification('doometernal-eternalmodinjector-installing');
    }

Finally, I can see you're using turbowalk to check if the staging folder has the mod injector executable; this is fine, but there's a simpler way now that it should be installing correctly and assigned the binaries mod type automatically.

Add the following function:

function isEternalModInjectorInstalled(api, spec) {
  const state = api.getState();
  const mods = state.persistent.mods[spec.game.id] || {};
  return Object.keys(mods).some(id => mods[id]?.type === 'doometernal-binaries');
}

And replace the turbowalk call like so:

let modLoaderInstalled = isEternalModInjectorInstalled(api, gameSpec);
// await turbowalk.default(installPath, async (entries) => {
//   if (modLoaderInstalled === true) {
//     return Promise.resolve();
//   }
//   for (const entry of entries) {
//     if (path.basename(entry.filePath).toLowerCase() === modLoaderFile) {
//       modLoaderInstalled = true;
//       return Promise.resolve();
//     }
//   }
// });

if (!modLoaderInstalled) { ... }

Let us know once these changes are made and I'll re-review the extension.

Thanks again for your contributions!

ChemGuy1611 commented 1 week ago

That is very helpful, thank you! I can use this structure for my Doom 2016 extension as well with the automatic mod loader download to set the mod type. Was not exactly sure how to accomplish that.

New version is on the Nexus!

ChemGuy1611 commented 1 week ago

Also, just a heads up that there are 4 other extensions that have been reviewed previously that should be ready for approval. I know you guys have been busy the last few weeks, just didn't want these to fall through the cracks.

Lies of P: https://github.com/Nexus-Mods/Vortex/issues/15531 Helldivers 2: https://github.com/Nexus-Mods/Vortex/issues/15504 Witchfire: https://github.com/Nexus-Mods/Vortex/issues/15497 Alan Wake 2: https://github.com/Nexus-Mods/Vortex/issues/15473