Skip to content

Commit

Permalink
Add medium plugin support (Starfield)
Browse files Browse the repository at this point in the history
- Coopt the overlay support for the new 'medium' / ESH plugin flag
- Update various displays to include ESH info
  • Loading branch information
Holt59 authored and Silarn committed Jun 11, 2024
1 parent fff03d3 commit 6f69951
Show file tree
Hide file tree
Showing 10 changed files with 159 additions and 151 deletions.
7 changes: 6 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ mo2_configure_executable(organizer
target_link_libraries(organizer PUBLIC Shlwapi)
mo2_install_target(organizer)

install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/dlls.manifest.qt5"
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/dlls.manifest.qt6"
DESTINATION bin/dlls
CONFIGURATIONS Release RelWithDebInfo
RENAME dlls.manifest)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/dlls.manifest.debug.qt6"
DESTINATION bin/dlls
CONFIGURATIONS Debug
RENAME dlls.manifest)

install(DIRECTORY
Expand Down
46 changes: 0 additions & 46 deletions src/dlls.manifest.debug.qt5

This file was deleted.

46 changes: 46 additions & 0 deletions src/dlls.manifest.debug.qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" name="dlls" version="1.0.0.0" processorArchitecture="x86" />
<file name="7z.dll" />
<file name="archive.dll" />
<file name="d3dcompiler_47.dll" />
<file name="libbsarch.dll" />
<file name="libcrypto-3-x64.dll" />
<file name="libEGL.dll" />
<file name="libGLESV2.dll" />
<file name="liblz4.dll" />
<file name="libssl-3-x64.dll" />
<file name="opengl32sw.dll" />
<file name="Qt6Concurrentd.dll" />
<file name="Qt6Cored.dll" />
<file name="Qt6Core5Compatd.dll" />
<file name="Qt6Guid.dll" />
<file name="Qt6Networkd.dll" />
<file name="Qt6OpenGLd.dll" />
<file name="Qt6OpenGLWidgetsd.dll" />
<file name="Qt6Positioningd.dll" />
<file name="Qt6PrintSupportd.dll" />
<file name="Qt6Qmld.dll" />
<file name="Qt6QmlLocalStoraged.dll" />
<file name="Qt6QmlModelsd.dll" />
<file name="Qt6QmlWorkerScriptd.dll" />
<file name="Qt6QmlXmlListModeld.dll" />
<file name="Qt6Quickd.dll" />
<file name="Qt6QuickControls2d.dll" />
<file name="Qt6QuickControls2Impld.dll" />
<file name="Qt6QuickDialogs2d.dll" />
<file name="Qt6QuickDialogs2QuickImpld.dll" />
<file name="Qt6QuickDialogs2Utilsd.dll" />
<file name="Qt6QuickLayoutsd.dll" />
<file name="Qt6QuickParticlesd.dll" />
<file name="Qt6QuickShapesd.dll" />
<file name="Qt6QuickTemplates2d.dll" />
<file name="Qt6QuickWidgetsd.dll" />
<file name="Qt6Sqld.dll" />
<file name="Qt6Svgd.dll" />
<file name="Qt6WebChanneld.dll" />
<file name="Qt6WebEngineCored.dll" />
<file name="Qt6WebEngineWidgetsd.dll" />
<file name="Qt6WebSocketsd.dll" />
<file name="Qt6Widgetsd.dll" />
</assembly>
46 changes: 0 additions & 46 deletions src/dlls.manifest.qt5

This file was deleted.

46 changes: 46 additions & 0 deletions src/dlls.manifest.qt6
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" name="dlls" version="1.0.0.0" processorArchitecture="x86" />
<file name="7z.dll" />
<file name="archive.dll" />
<file name="d3dcompiler_47.dll" />
<file name="libbsarch.dll" />
<file name="libcrypto-3-x64.dll" />
<file name="libEGL.dll" />
<file name="libGLESV2.dll" />
<file name="liblz4.dll" />
<file name="libssl-3-x64.dll" />
<file name="opengl32sw.dll" />
<file name="Qt6Concurrent.dll" />
<file name="Qt6Core.dll" />
<file name="Qt6Core5Compat.dll" />
<file name="Qt6Gui.dll" />
<file name="Qt6Network.dll" />
<file name="Qt6OpenGL.dll" />
<file name="Qt6OpenGLWidgets.dll" />
<file name="Qt6Positioning.dll" />
<file name="Qt6PrintSupport.dll" />
<file name="Qt6Qml.dll" />
<file name="Qt6QmlLocalStorage.dll" />
<file name="Qt6QmlModels.dll" />
<file name="Qt6QmlWorkerScript.dll" />
<file name="Qt6QmlXmlListModel.dll" />
<file name="Qt6Quick.dll" />
<file name="Qt6QuickControls2.dll" />
<file name="Qt6QuickControls2Impl.dll" />
<file name="Qt6QuickDialogs2.dll" />
<file name="Qt6QuickDialogs2QuickImpl.dll" />
<file name="Qt6QuickDialogs2Utils.dll" />
<file name="Qt6QuickLayouts.dll" />
<file name="Qt6QuickParticles.dll" />
<file name="Qt6QuickShapes.dll" />
<file name="Qt6QuickTemplates2.dll" />
<file name="Qt6QuickWidgets.dll" />
<file name="Qt6Sql.dll" />
<file name="Qt6Svg.dll" />
<file name="Qt6WebChannel.dll" />
<file name="Qt6WebEngineCore.dll" />
<file name="Qt6WebEngineWidgets.dll" />
<file name="Qt6WebSockets.dll" />
<file name="Qt6Widgets.dll" />
</assembly>
83 changes: 43 additions & 40 deletions src/pluginlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ void PluginList::refresh(const QString& profileName,
auto gamePlugins = m_Organizer.gameFeatures().gameFeature<GamePlugins>();
const bool lightPluginsAreSupported =
gamePlugins ? gamePlugins->lightPluginsAreSupported() : false;
const bool overridePluginsAreSupported =
gamePlugins ? gamePlugins->overridePluginsAreSupported() : false;
const bool mediumPluginsAreSupported =
gamePlugins ? gamePlugins->mediumPluginsAreSupported() : false;
const bool loadOrderMechanismNone =
m_GamePlugin->loadOrderMechanism() == IPluginGame::LoadOrderMechanism::None;

Expand Down Expand Up @@ -245,7 +245,7 @@ void PluginList::refresh(const QString& profileName,
m_ESPs.emplace_back(filename, forceLoaded, forceEnabled, forceDisabled,
originName, ToQString(current->getFullPath()), hasIni,
loadedArchives, lightPluginsAreSupported,
overridePluginsAreSupported);
mediumPluginsAreSupported);
m_ESPs.rbegin()->priority = -1;
} catch (const std::exception& e) {
reportError(tr("failed to update esp info for file %1 (source id: %2), error: %3")
Expand Down Expand Up @@ -998,23 +998,23 @@ bool PluginList::isMasterFlagged(const QString& name) const
}
}

bool PluginList::isLightFlagged(const QString& name) const
bool PluginList::isMediumFlagged(const QString& name) const
{
auto iter = m_ESPsByName.find(name);
if (iter == m_ESPsByName.end()) {
return false;
} else {
return m_ESPs[iter->second].isLightFlagged;
return m_ESPs[iter->second].isMediumFlagged;
}
}

bool PluginList::isOverlayFlagged(const QString& name) const
bool PluginList::isLightFlagged(const QString& name) const
{
auto iter = m_ESPsByName.find(name);
if (iter == m_ESPsByName.end()) {
return false;
} else {
return m_ESPs[iter->second].isOverlayFlagged;
return m_ESPs[iter->second].isLightFlagged;
}
}

Expand Down Expand Up @@ -1082,13 +1082,14 @@ void PluginList::updateIndices()
void PluginList::generatePluginIndexes()
{
int numESLs = 0;
int numESHs = 0;
int numSkipped = 0;

auto gamePlugins = m_Organizer.gameFeatures().gameFeature<GamePlugins>();
const bool lightPluginsSupported =
gamePlugins ? gamePlugins->lightPluginsAreSupported() : false;
const bool overridePluginsSupported =
gamePlugins ? gamePlugins->overridePluginsAreSupported() : false;
const bool mediumPluginsSupported =
gamePlugins ? gamePlugins->mediumPluginsAreSupported() : false;

for (int l = 0; l < m_ESPs.size(); ++l) {
int i = m_ESPsByPriority.at(l);
Expand All @@ -1097,20 +1098,22 @@ void PluginList::generatePluginIndexes()
++numSkipped;
continue;
}
if (lightPluginsSupported &&
if (mediumPluginsSupported && m_ESPs[i].isMediumFlagged) {
int ESHpos = 253 + ((numESHs + 1) / 256);
m_ESPs[i].index = QString("%1:%2")
.arg(ESHpos, 2, 16, QChar('0'))
.arg(numESHs % 256, 2, 16, QChar('0'))
.toUpper();
++numESHs;

} else if (lightPluginsSupported &&
(m_ESPs[i].hasLightExtension || m_ESPs[i].isLightFlagged)) {
int ESLpos = 254 + ((numESLs + 1) / 4096);
m_ESPs[i].index = QString("%1:%2")
.arg(ESLpos, 2, 16, QChar('0'))
.arg((numESLs) % 4096, 3, 16, QChar('0'))
.arg(numESLs % 4096, 3, 16, QChar('0'))
.toUpper();
++numESLs;
// This logic may still be used if overlay plugins are fixed to longer consume a
// load order slot
//
//} else if (overridePluginsSupported && m_ESPs[i].isOverlayFlagged) {
// m_ESPs[i].index = QString("XX");
// ++numSkipped;
} else {
m_ESPs[i].index =
QString("%1").arg(l - numESLs - numSkipped, 2, 16, QChar('0')).toUpper();
Expand Down Expand Up @@ -1245,6 +1248,8 @@ QVariant PluginList::fontData(const QModelIndex& modelIndex) const
if (m_ESPs[index].hasMasterExtension || m_ESPs[index].isMasterFlagged ||
m_ESPs[index].hasLightExtension)
result.setWeight(QFont::Bold);
if (m_ESPs[index].isMediumFlagged)
result.setUnderline(true);
if (m_ESPs[index].isLightFlagged || m_ESPs[index].hasLightExtension)
result.setItalic(true);

Expand Down Expand Up @@ -1332,24 +1337,22 @@ QVariant PluginList::tooltipData(const QModelIndex& modelIndex) const
"be added to your game settings, overwriting in case of conflicts.");
}

if (esp.isMediumFlagged && esp.hasMasterExtension) {
toolTip += "<br><br>" +
tr("This ESM is flagged as a medium plugin (ESH). It adheres to the ESM "
"load order but loads records in ESH space (FD). You can have 256 "
"medium plugins in addition to other plugin types.");
}

if (esp.isLightFlagged && !esp.hasLightExtension) {
QString type = esp.hasMasterExtension ? "ESM" : "ESP";
toolTip +=
"<br><br>" + tr("This %1 is flagged as an ESL. It will adhere to the %1 load "
"order but the records will be loaded in ESL space.")
.arg(type);
}

// This logic may still be used if overlay plugins are fixed to longer consume a load
// order slot
//
// if (esp.isOverlayFlagged) {
// toolTip +=
// "<br><br>" + tr("This plugin is flagged as an overlay plugin. It contains
// only "
// "modified records and will overlay those changes onto the "
// "existing records in memory. It takes no memory space.");
// }
"<br><br>" +
tr("This %1 is flagged as a light plugin (ESL). It will adhere to the %1 load "
"order but the records will be loaded in ESL space (FE/FF). You can have up "
"to 4096 light plugins in addition to other plugin types.")
.arg(type);
}

if (esp.hasNoRecords) {
toolTip += "<br><br>" + tr("This is a dummy plugin. It contains no records and is "
Expand Down Expand Up @@ -1477,6 +1480,10 @@ QVariant PluginList::iconData(const QModelIndex& modelIndex) const
result.append(":/MO/gui/archive_conflict_neutral");
}

if (esp.isMediumFlagged) {
result.append(":/MO/gui/run");
}

if (esp.isLightFlagged && !esp.hasLightExtension) {
result.append(":/MO/gui/awaiting");
}
Expand All @@ -1485,10 +1492,6 @@ QVariant PluginList::iconData(const QModelIndex& modelIndex) const
result.append(":/MO/gui/unchecked-checkbox");
}

if (esp.isOverlayFlagged) {
result.append(":/MO/gui/instance_switch");
}

if (info && !info->loot.dirty.empty()) {
result.append(":/MO/gui/edit_clear");
}
Expand Down Expand Up @@ -1801,7 +1804,7 @@ PluginList::ESPInfo::ESPInfo(const QString& name, bool forceLoaded, bool forceEn
bool forceDisabled, const QString& originName,
const QString& fullPath, bool hasIni,
std::set<QString> archives, bool lightSupported,
bool overlaySupported)
bool mediumSupported)
: name(name), fullPath(fullPath), enabled(forceLoaded), forceLoaded(forceLoaded),
forceEnabled(forceEnabled), forceDisabled(forceDisabled), priority(0),
loadOrder(-1), originName(originName), hasIni(hasIni),
Expand All @@ -1813,9 +1816,9 @@ PluginList::ESPInfo::ESPInfo(const QString& name, bool forceLoaded, bool forceEn
hasMasterExtension = (extension == "esm");
hasLightExtension = (extension == "esl");
isMasterFlagged = file.isMaster();
isOverlayFlagged = overlaySupported && file.isOverlay();
isMediumFlagged = mediumSupported && file.isMedium();
isLightFlagged =
lightSupported && !isOverlayFlagged && file.isLight(overlaySupported);
lightSupported && !isMediumFlagged && file.isLight(mediumSupported);
hasNoRecords = file.isDummy();

author = QString::fromLatin1(file.author().c_str());
Expand All @@ -1829,7 +1832,7 @@ PluginList::ESPInfo::ESPInfo(const QString& name, bool forceLoaded, bool forceEn
hasMasterExtension = false;
hasLightExtension = false;
isMasterFlagged = false;
isOverlayFlagged = false;
isMediumFlagged = false;
isLightFlagged = false;
hasNoRecords = false;
}
Expand Down
Loading

0 comments on commit 6f69951

Please sign in to comment.