Skip to content

Commit

Permalink
fix map image loading
Browse files Browse the repository at this point in the history
  • Loading branch information
matiascalegaris committed Nov 7, 2023
1 parent 4e4f33a commit bf95888
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
19 changes: 19 additions & 0 deletions BabelSlave/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ namespace Babel {
mCompressedMiniMaps = std::make_unique<AO::Compressor>();
mCompressedMiniMaps->Open(GetFilePath("OUTPUT/MiniMapas").u8string().c_str(),
"ht5PutasTdyRk6BSJcucumelo234583013lalivn2FRjYYBzPhnMrkmUfLMgm4TDX");

mCompressedInterface = std::make_unique<AO::Compressor>();
mCompressedInterface->Open(GetFilePath("OUTPUT/Interface").u8string().c_str(),
"ht5PutasTdyRk6BSJcucumelo234583013lalivn2FRjYYBzPhnMrkmUfLMgm4TDX");
}
sActiveFS = this;
}
Expand Down Expand Up @@ -119,6 +123,11 @@ namespace Babel {
file = file.substr(start);
return mCompressedMiniMaps->HasFile(file.c_str());
}
if (file.rfind("/Interface/", 0) == 0) {
auto start = file.rfind("/") + 1;
file = file.substr(start);
return mCompressedInterface->HasFile(file.c_str());
}
}
return getFindData(GetRelative(path).get(), findData);
}
Expand Down Expand Up @@ -207,6 +216,16 @@ namespace Babel {
return Buffer::Create(it.first->second->data.data(), it.first->second->data.size(), it.first->second.get(),
FileSystemWin_DestroyDecompressedFileData);
}
if (file.rfind("/Interface/", 0) == 0) {
auto start = file.rfind("/") + 1;
file = file.substr(start);
mNextIndex++;
auto it = mOpenFileMap.insert(std::make_pair(mNextIndex, std::make_unique<CompressedData>()));
it.first->second->Id = mNextIndex;
mCompressedInterface->GetFileData(file.c_str(), it.first->second->data);
return Buffer::Create(it.first->second->data.data(), it.first->second->data.size(), it.first->second.get(),
FileSystemWin_DestroyDecompressedFileData);
}
}
hFile = CreateFileW(pathStr.get(),
GENERIC_READ, // dwDesiredAccess
Expand Down
2 changes: 2 additions & 0 deletions BabelSlave/FileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ namespace Babel {
std::unique_ptr<AO::Compressor> mCompressedGraphics;
std::unique_ptr<AO::Compressor> mCompressedInit;
std::unique_ptr<AO::Compressor> mCompressedMiniMaps;
std::unique_ptr<AO::Compressor> mCompressedMaps;
std::unique_ptr<AO::Compressor> mCompressedInterface;
int mNextIndex = { 0 };
std::map<int, std::unique_ptr<CompressedData>> mOpenFileMap;
};
Expand Down
2 changes: 1 addition & 1 deletion BabelSlave/html/static/css/main.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion BabelSlave/html/static/js/main.js

Large diffs are not rendered by default.

0 comments on commit bf95888

Please sign in to comment.