aboutsummaryrefslogtreecommitdiff
path: root/libs/game_bethesda/src/games/fallout4/fallout4unmanagedmods.cpp
blob: 61b7b2a8ff07b664924e7932564a25c4bc0382e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "fallout4unmanagedmods.h"

Fallout4UnmangedMods::Fallout4UnmangedMods(const GameGamebryo* game)
    : GamebryoUnmangedMods(game)
{}

Fallout4UnmangedMods::~Fallout4UnmangedMods() {}

QStringList Fallout4UnmangedMods::mods(bool onlyOfficial) const
{
  QStringList result;

  QStringList pluginList   = game()->primaryPlugins();
  QStringList otherPlugins = game()->DLCPlugins();
  otherPlugins.append(game()->CCPlugins());
  for (QString plugin : otherPlugins) {
    pluginList.removeAll(plugin);
  }
  QDir dataDir(game()->dataDirectory());
  for (const QString& fileName : dataDir.entryList({"*.esp", "*.esl", "*.esm"})) {
    if (!pluginList.contains(fileName, Qt::CaseInsensitive)) {
      if (!onlyOfficial || pluginList.contains(fileName, Qt::CaseInsensitive)) {
        result.append(fileName.chopped(4));  // trims the extension off
      }
    }
  }

  return result;
}

QStringList Fallout4UnmangedMods::secondaryFiles(const QString& modName) const
{
  // file extension in FO4 is .ba2 instead of bsa
  QStringList archives;
  QDir dataDir = game()->dataDirectory();
  for (const QString& archiveName : dataDir.entryList({modName + "*.ba2"})) {
    archives.append(dataDir.absoluteFilePath(archiveName));
  }
  return archives;
}

QString Fallout4UnmangedMods::displayName(const QString& modName) const
{
  // unlike in earlier games, in fallout 4 the file name doesn't correspond to
  // the public name
  if (modName.compare("dlcrobot", Qt::CaseInsensitive) == 0) {
    return "Automatron";
  } else if (modName.compare("dlcworkshop01", Qt::CaseInsensitive) == 0) {
    return "Wasteland Workshop";
  } else if (modName.compare("dlccoast", Qt::CaseInsensitive) == 0) {
    return "Far Harbor";
  } else if (modName.compare("dlcworkshop02", Qt::CaseInsensitive) == 0) {
    return "Contraptions Workshop";
  } else if (modName.compare("dlcworkshop03", Qt::CaseInsensitive) == 0) {
    return "Vault-Tec Workshop";
  } else if (modName.compare("dlcnukaworld", Qt::CaseInsensitive) == 0) {
    return "Nuka-World";
  } else if (modName.compare("dlcultrahighresolution", Qt::CaseInsensitive) == 0) {
    return "Ultra High Resolution Texture Pack";
  } else {
    return modName;
  }
}