mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 18:29:55 +00:00
Use the correct filenames for FO4 string tables
This commit is contained in:
parent
cb7e9f4a01
commit
b7efdc4add
1 changed files with 32 additions and 17 deletions
|
@ -61,11 +61,11 @@ namespace ESM4
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case LocalizedStringType::Strings:
|
case LocalizedStringType::Strings:
|
||||||
return u8"_English.STRINGS";
|
return u8".STRINGS";
|
||||||
case LocalizedStringType::ILStrings:
|
case LocalizedStringType::ILStrings:
|
||||||
return u8"_English.ILSTRINGS";
|
return u8".ILSTRINGS";
|
||||||
case LocalizedStringType::DLStrings:
|
case LocalizedStringType::DLStrings:
|
||||||
return u8"_English.DLSTRINGS";
|
return u8".DLSTRINGS";
|
||||||
}
|
}
|
||||||
|
|
||||||
throw std::logic_error("Unsupported LocalizedStringType: " + std::to_string(static_cast<int>(type)));
|
throw std::logic_error("Unsupported LocalizedStringType: " + std::to_string(static_cast<int>(type)));
|
||||||
|
@ -322,34 +322,49 @@ namespace ESM4
|
||||||
void Reader::buildLStringIndex(LocalizedStringType stringType, const std::u8string& prefix)
|
void Reader::buildLStringIndex(LocalizedStringType stringType, const std::u8string& prefix)
|
||||||
{
|
{
|
||||||
static const std::filesystem::path strings("Strings");
|
static const std::filesystem::path strings("Strings");
|
||||||
|
const std::u8string language(u8"_En");
|
||||||
|
const std::u8string altLanguage(u8"_English");
|
||||||
const std::u8string suffix(getStringsSuffix(stringType));
|
const std::u8string suffix(getStringsSuffix(stringType));
|
||||||
std::filesystem::path path = strings / (prefix + suffix);
|
std::filesystem::path path = strings / (prefix + language + suffix);
|
||||||
|
|
||||||
if (mVFS != nullptr)
|
if (mVFS != nullptr)
|
||||||
{
|
{
|
||||||
const std::string vfsPath = Files::pathToUnicodeString(path);
|
std::string vfsPath = Files::pathToUnicodeString(path);
|
||||||
|
if (!mVFS->exists(vfsPath))
|
||||||
|
{
|
||||||
|
path = strings / (prefix + altLanguage + suffix);
|
||||||
|
vfsPath = Files::pathToUnicodeString(path);
|
||||||
|
}
|
||||||
|
|
||||||
if (mIgnoreMissingLocalizedStrings && !mVFS->exists(vfsPath))
|
if (mVFS->exists(vfsPath))
|
||||||
|
{
|
||||||
|
const Files::IStreamPtr stream = mVFS->get(vfsPath);
|
||||||
|
buildLStringIndex(stringType, *stream);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mIgnoreMissingLocalizedStrings)
|
||||||
{
|
{
|
||||||
Log(Debug::Warning) << "Ignore missing VFS strings file: " << vfsPath;
|
Log(Debug::Warning) << "Ignore missing VFS strings file: " << vfsPath;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const Files::IStreamPtr stream = mVFS->get(vfsPath);
|
std::filesystem::path fsPath = mCtx.filename.parent_path() / path;
|
||||||
|
if (!std::filesystem::exists(fsPath))
|
||||||
|
{
|
||||||
|
path = strings / (prefix + altLanguage + suffix);
|
||||||
|
fsPath = mCtx.filename.parent_path() / path;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (std::filesystem::exists(fsPath))
|
||||||
|
{
|
||||||
|
const Files::IStreamPtr stream = Files::openConstrainedFileStream(fsPath);
|
||||||
buildLStringIndex(stringType, *stream);
|
buildLStringIndex(stringType, *stream);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::filesystem::path fsPath = mCtx.filename.parent_path() / path;
|
if (mIgnoreMissingLocalizedStrings)
|
||||||
|
|
||||||
if (mIgnoreMissingLocalizedStrings && !std::filesystem::exists(fsPath))
|
|
||||||
{
|
|
||||||
Log(Debug::Warning) << "Ignore missing strings file: " << fsPath;
|
Log(Debug::Warning) << "Ignore missing strings file: " << fsPath;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Files::IStreamPtr stream = Files::openConstrainedFileStream(fsPath);
|
|
||||||
buildLStringIndex(stringType, *stream);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Reader::buildLStringIndex(LocalizedStringType stringType, std::istream& stream)
|
void Reader::buildLStringIndex(LocalizedStringType stringType, std::istream& stream)
|
||||||
|
|
Loading…
Reference in a new issue