Music/Sound assets: Every Id is repeated three times

Involved development of the OpenMW construction set.
Post Reply
User avatar
smbas
Posts: 8
Joined: 07 May 2015, 22:31
Location: Ukraine

Music/Sound assets: Every Id is repeated three times

Post by smbas »

See the attached picture.
Is it a bug?
Attachments
Capture.PNG
User avatar
cc9cii
Posts: 523
Joined: 28 Mar 2013, 04:01

Re: Music/Sound assets: Every Id is repeated three times

Post by cc9cii »

Looks like a bug. At the moment I'm looking at the table with 4 repeats rather than 3!
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Music/Sound assets: Every Id is repeated three times

Post by Zini »

Just an idea. Do you have the same resource in multiple places? Multiple data directories, archive vs loose file? This case might not be handled correctly.
User avatar
smbas
Posts: 8
Joined: 07 May 2015, 22:31
Location: Ukraine

Re: Music/Sound assets: Every Id is repeated three times

Post by smbas »

I have one folder of MW data files. But in OpenCS console it's printed three times (on load).
Perhaps, it's happened because OpenCS loads multiple (three in this case) config files?!
Attachments
console.PNG
User avatar
cc9cii
Posts: 523
Joined: 28 Mar 2013, 04:01

Re: Music/Sound assets: Every Id is repeated three times

Post by cc9cii »

Bsa::registerResources() calls Bsa::addDir() without checking if it exists already. Later on, CSMWorld::Resources adds the same file for each of the registered directories. Not sure if this should be fixed here or in Files::Collections instead.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Music/Sound assets: Every Id is repeated three times

Post by scrawl »

Looks like an openmw.cfg config issue. You must have the same path listed multiple times (either in one config file, or strewn across multiple config files).

The new VFS in the osg branch should handle this case more gracefully (as in, the same resource will never be listed more than once).
User avatar
cc9cii
Posts: 523
Joined: 28 Mar 2013, 04:01

Re: Music/Sound assets: Every Id is repeated three times

Post by cc9cii »

I only have one:

Code: Select all

data="C:/Program Files (x86)/Bethesda Softworks/Morrowind/Data Files"
Unless the default ones in the program directory are also being used?

Code: Select all

data="?mw?Data Files"
data=data
data-local="?userdata?data"
User avatar
cc9cii
Posts: 523
Joined: 28 Mar 2013, 04:01

Re: Music/Sound assets: Every Id is repeated three times

Post by cc9cii »

scrawl was right, looks like it is a config file issue. (or a config file processing issue)

The following change at the end of CS::Editor::readConfig() fixes the issue. However boost::filesystem::canonical() was added after v1.48 so we will probably need another solution (I believe some systems are still on v1.46).

Code: Select all

dataDirs.insert (dataDirs.end(), dataLocal.begin(), dataLocal.end());
Files::PathContainer canonicalPaths;

//iterate the data directories and add them to the file dialog for loading
for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter)
{
    boost::filesystem::path p = boost::filesystem::canonical(*iter);
    Files::PathContainer::iterator it =
            std::find(canonicalPaths.begin(), canonicalPaths.end(), p);
    if (it == canonicalPaths.end())
        canonicalPaths.push_back(p);
    else
        continue;
    QString path = QString::fromUtf8 (iter->string().c_str());
    mFileDialog.addFiles(path);
}

return std::make_pair (canonicalPaths, variables["fallback-archive"].as<std::vector<std::string> >());
EDIT: By the way, I'm not working on this, so feel free to grab it (might be good to capture it in the bug tracker as well)

EDIT2: Similar issue exists with config file themselves, i.e. exact same config file can be loaded multiple times (one with absolute path and another with relative path, even though it is the same file)
Post Reply