Skip to content

Commit

Permalink
Fix for unintentional filename conflicts within raw_models in streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
rokuniichi committed Nov 4, 2024
1 parent 18f85c2 commit b1d01bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/plugins/gta3/std.stream/data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ std::string CAbstractStreaming::TryLoadNonStreamedResource(std::string filepath,

if(!this->bHasInitializedStreaming)
{
auto it = this->raw_models.find(filename);
auto it = std::find_if(this->raw_models.begin(), this->raw_models.end(),
[&filename](const std::pair<std::string, const modloader::file *>& pair) {
auto model_filename = std::string(pair.second->filename());
return model_filename == filename;
});

if(it != this->raw_models.end())
{
// Log about non streamed resource and make sure it's unique
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/gta3/std.stream/streaming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ bool CAbstractStreaming::InstallFile(const modloader::file& file)
// Just push it to this list and it will get loaded when the streaming initializes
// At this point we don't know if this is a clothing item or an model, for that reason "raw"
// The initializer will take care of filtering clothes and models from the list
this->raw_models[file.filename()] = &file;
this->raw_models[file.filepath()] = &file;
return true;
}
else
Expand Down Expand Up @@ -242,7 +242,7 @@ bool CAbstractStreaming::UninstallFile(const modloader::file& file)
return false;

// Streaming hasn't initialized, just remove it from our raw list
raw_models.erase(file.filename());
raw_models.erase(file.filepath());
return true;
}
else
Expand Down

0 comments on commit b1d01bc

Please sign in to comment.