mirror of
https://github.com/ModOrganizer2/modorganizer-game_starfield.git
synced 2026-07-27 14:08:51 -07:00
Various updates
- Allow plugin management automatically - Updates to reading archives from INIs - Remove version check for light plugin parser - Add some notes for save file headers
This commit is contained in:
+5
-14
@@ -125,17 +125,12 @@ QString GameStarfield::description() const
|
||||
|
||||
MOBase::VersionInfo GameStarfield::version() const
|
||||
{
|
||||
return VersionInfo(0, 5, 0, VersionInfo::RELEASE_BETA);
|
||||
return VersionInfo(1, 0, 0, VersionInfo::RELEASE_CANDIDATE);
|
||||
}
|
||||
|
||||
QList<PluginSetting> GameStarfield::settings() const
|
||||
{
|
||||
return QList<PluginSetting>()
|
||||
<< PluginSetting("enable_plugin_management",
|
||||
tr("Turn on plugin management. As of Starfield 1.7.33 this "
|
||||
"REQUIRES fixing 'plugins.txt' with a SFSE plugin. This "
|
||||
"will do nothing otherwise."),
|
||||
false)
|
||||
<< PluginSetting(
|
||||
"enable_esp_warning",
|
||||
tr("Show a warning when ESP plugins are enabled in the load order."),
|
||||
@@ -153,8 +148,7 @@ QList<PluginSetting> GameStarfield::settings() const
|
||||
MappingType GameStarfield::mappings() const
|
||||
{
|
||||
MappingType result;
|
||||
if (m_Organizer->pluginSetting(name(), "enable_plugin_management").toBool() &&
|
||||
testFilePlugins().isEmpty()) {
|
||||
if (testFilePlugins().isEmpty()) {
|
||||
for (const QString& profileFile : {"plugins.txt", "loadorder.txt"}) {
|
||||
result.push_back({m_Organizer->profilePath() + "/" + profileFile,
|
||||
localAppFolder() + "/" + gameShortName() + "/" + profileFile,
|
||||
@@ -300,16 +294,14 @@ QStringList GameStarfield::CCPlugins() const
|
||||
|
||||
IPluginGame::SortMechanism GameStarfield::sortMechanism() const
|
||||
{
|
||||
if (m_Organizer->pluginSetting(name(), "enable_plugin_management").toBool() &&
|
||||
testFilePlugins().isEmpty())
|
||||
if (testFilePlugins().isEmpty())
|
||||
return IPluginGame::SortMechanism::LOOT;
|
||||
return IPluginGame::SortMechanism::NONE;
|
||||
}
|
||||
|
||||
IPluginGame::LoadOrderMechanism GameStarfield::loadOrderMechanism() const
|
||||
{
|
||||
if (m_Organizer->pluginSetting(name(), "enable_plugin_management").toBool() &&
|
||||
testFilePlugins().isEmpty())
|
||||
if (testFilePlugins().isEmpty())
|
||||
return IPluginGame::LoadOrderMechanism::PluginsTxt;
|
||||
return IPluginGame::LoadOrderMechanism::None;
|
||||
}
|
||||
@@ -422,8 +414,7 @@ bool GameStarfield::activeOverlay() const
|
||||
|
||||
bool GameStarfield::testFilePresent() const
|
||||
{
|
||||
if (m_Organizer->pluginSetting(name(), "enable_plugin_management").toBool() &&
|
||||
!testFilePlugins().isEmpty())
|
||||
if (!testFilePlugins().isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -71,30 +71,33 @@ QStringList StarfieldDataArchives::archives(const MOBase::IProfile* profile) con
|
||||
{
|
||||
QStringList result;
|
||||
|
||||
QString iniFile = m_GamePath.absoluteFilePath("Starfield.ini");
|
||||
result.append(getArchivesFromKey(iniFile, "SResourceArchiveList"));
|
||||
result.append(getArchivesFromKey(iniFile, "sResourceIndexFileList"));
|
||||
result.append(getArchivesFromKey(iniFile, "SResourceArchiveMemoryCacheList"));
|
||||
result.append(getArchivesFromKey(iniFile, "sResourceStartUpArchiveList"));
|
||||
result.append(getArchivesFromKey(iniFile, "sResourceEnglishVoiceList"));
|
||||
QString defaultIniFile = m_GamePath.absoluteFilePath("Starfield.ini");
|
||||
QString customIniFile =
|
||||
profile->localSettingsEnabled()
|
||||
? QDir(profile->absolutePath()).absoluteFilePath("StarfieldCustom.ini")
|
||||
: m_LocalGameDir.absoluteFilePath("StarfieldCustom.ini");
|
||||
QStringList archiveSettings = {"SResourceArchiveList", "sResourceIndexFileList",
|
||||
"SResourceArchiveMemoryCacheList",
|
||||
"sResourceStartUpArchiveList",
|
||||
"sResourceEnglishVoiceList"};
|
||||
for (auto setting : archiveSettings) {
|
||||
auto archives = getArchivesFromKey(customIniFile, setting, 1023);
|
||||
if (archives.isEmpty())
|
||||
archives = getArchivesFromKey(defaultIniFile, setting, 1023);
|
||||
result.append(archives);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void StarfieldDataArchives::writeArchiveList(MOBase::IProfile* profile,
|
||||
const QStringList& before)
|
||||
{
|
||||
QString list = before.join(", ");
|
||||
{}
|
||||
|
||||
QString iniFile =
|
||||
profile->localSettingsEnabled()
|
||||
? QDir(profile->absolutePath()).absoluteFilePath("Starfield.ini")
|
||||
: m_LocalGameDir.absoluteFilePath("Starfield.ini");
|
||||
if (list.length() > 255) {
|
||||
int splitIdx = list.lastIndexOf(",", 256);
|
||||
setArchivesToKey(iniFile, "SResourceArchiveList", list.mid(0, splitIdx));
|
||||
setArchivesToKey(iniFile, "SResourceArchiveList2", list.mid(splitIdx + 2));
|
||||
} else {
|
||||
setArchivesToKey(iniFile, "SResourceArchiveList", list);
|
||||
}
|
||||
}
|
||||
void StarfieldDataArchives::addArchive(MOBase::IProfile* profile, int index,
|
||||
const QString& archiveName)
|
||||
{}
|
||||
|
||||
void StarfieldDataArchives::removeArchive(MOBase::IProfile* profile,
|
||||
const QString& archiveName)
|
||||
{}
|
||||
@@ -20,6 +20,10 @@ public:
|
||||
public:
|
||||
virtual QStringList vanillaArchives() const override;
|
||||
virtual QStringList archives(const MOBase::IProfile* profile) const override;
|
||||
virtual void addArchive(MOBase::IProfile* profile, int index,
|
||||
const QString& archiveName) override;
|
||||
virtual void removeArchive(MOBase::IProfile* profile,
|
||||
const QString& archiveName) override;
|
||||
|
||||
protected:
|
||||
const QDir m_GamePath;
|
||||
|
||||
+21
-13
@@ -28,16 +28,26 @@ StarfieldSaveGame::StarfieldSaveGame(QString const& fileName, GameStarfield cons
|
||||
void StarfieldSaveGame::getData(FileWrapper& file) const
|
||||
{
|
||||
file.skip<uint32_t>(); // header version
|
||||
file.skip<uint64_t>(); // zip start location
|
||||
file.skip<uint64_t>(); // unknown
|
||||
file.skip<uint64_t>(); // chunk compressed size array start location
|
||||
file.skip<uint64_t>(); // unknown (0?)
|
||||
file.setCompressionType(1);
|
||||
file.openCompressedData(); // long = start, long = size
|
||||
// double
|
||||
// float
|
||||
// long
|
||||
// long
|
||||
// short
|
||||
return;
|
||||
/*
|
||||
* Parse following variables then begin decompressing data
|
||||
* - 64-bit int = compressed data start location
|
||||
* - 64-bit int = complete uncompressed data size
|
||||
*/
|
||||
file.openCompressedData();
|
||||
/*
|
||||
* Remaining headers before start of compressed data:
|
||||
* - 32-bit float (version? appears to be 2.0)
|
||||
* - 64-bit int - size of uncompressed chunks (250 KiB)
|
||||
* - 64-bit int - size of byte rows? (16 bytes) used to determine start of each
|
||||
* compressed chunk
|
||||
* - 32-bit int - number of chunks?
|
||||
* - 'ZIP ' - denotes start of chunk compressed size array
|
||||
* - compressed size array - array of 32-bit ints containing the compressed size of
|
||||
* each compressed chunk (see number of chunks above)
|
||||
*/
|
||||
}
|
||||
|
||||
void StarfieldSaveGame::fetchInformationFields(
|
||||
@@ -102,10 +112,8 @@ std::unique_ptr<GamebryoSaveGame::DataFields> StarfieldSaveGame::fetchDataFields
|
||||
file.read(ignore); // game version again?
|
||||
file.readInt(); // plugin info size
|
||||
|
||||
fields->Plugins = file.readPlugins();
|
||||
if (saveGameVersion >= 82) {
|
||||
fields->LightPlugins = file.readLightPlugins();
|
||||
}
|
||||
fields->Plugins = file.readPlugins();
|
||||
fields->LightPlugins = file.readLightPlugins();
|
||||
file.closeCompressedData();
|
||||
file.close();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user