diff options
| author | Tannin <devnull@localhost> | 2013-05-19 11:36:36 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2013-05-19 11:36:36 +0200 |
| commit | 0beb88760b4c258b89daf5791069dc885c0c27aa (patch) | |
| tree | e86596d032ef4bc6ba7f2ce5823becd42adcbaca /src/profile.cpp | |
| parent | 4fbfc9aa54ed4499f54eb7b3cd942337f6b49e58 (diff) | |
- added hook for GetModuleFileName
- downloads are now identifiable by ID
- fixed a bug with the multi-select categories list
- fixed a problem with the nexus-login code breaking support for certain passwords
- fixed a bug where detection of archive invalidation didn't work correctly
- fixed ncc plugin trying to handle archives that aren't actually fomods
Diffstat (limited to 'src/profile.cpp')
| -rw-r--r-- | src/profile.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/profile.cpp b/src/profile.cpp index 24c6d943..38899cba 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -547,6 +547,9 @@ bool Profile::invalidationActive(bool *supported) const *supported = true; wchar_t buffer[1024]; std::wstring iniFileName = ToWString(QDir::toNativeSeparators(getIniFileName())); + // epic ms fail: GetPrivateProfileString uses errno (for whatever reason) to signal a fail since the return value + // has a different meaning (number of bytes copied). HOWEVER, it will not set errno to 0 if NO error occured + errno = 0; if (::GetPrivateProfileStringW(L"Archive", GameInfo::instance().archiveListKey().c_str(), L"", buffer, 1024, iniFileName.c_str()) == 0) { if (errno != 0x02) { @@ -555,8 +558,7 @@ bool Profile::invalidationActive(bool *supported) const } return false; } else { - qCritical("failed to parse \"%ls\"", iniFileName.c_str()); - QString errorMessage = tr("failed to parse ini file (%1): %2").arg(QDir::toNativeSeparators(getIniFileName())).arg(::GetLastError()); + QString errorMessage = tr("failed to parse ini file (%1)").arg(ToQString(iniFileName)); throw windows_error(errorMessage.toUtf8().constData()); } } @@ -580,6 +582,7 @@ void Profile::deactivateInvalidation() const if (GameInfo::instance().requiresBSAInvalidation()) { wchar_t buffer[1024]; std::wstring iniFileName = ToWString(QDir::toNativeSeparators(getIniFileName())); + errno = 0; if (::GetPrivateProfileStringW(L"Archive", GameInfo::instance().archiveListKey().c_str(), L"", buffer, 1024, iniFileName.c_str()) == 0) { if (errno == 0x02) { @@ -619,9 +622,15 @@ void Profile::activateInvalidation(const QString& dataDirectory) const if (GameInfo::instance().requiresBSAInvalidation()) { wchar_t buffer[1024]; std::wstring iniFileName = ToWString(QDir::toNativeSeparators(getIniFileName())); + errno = 0; if (::GetPrivateProfileStringW(L"Archive", GameInfo::instance().archiveListKey().c_str(), L"", buffer, 1024, iniFileName.c_str()) == 0) { - throw windows_error("failed to parse ini file"); + if (errno == 0x02) { + throw windows_error("failed to parse ini file"); + } else { + // ignore. shouldn't have gotten here anyway + return; + } } QStringList archives = ToQString(buffer).split(", "); |
