Skip to content

Commit 7c02142

Browse files
committed
fix fonts
1 parent c53e6b1 commit 7c02142

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

src/resource/archive/ArchiveManager.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,28 @@ std::shared_ptr<File> ArchiveManager::LoadFile(uint64_t hash) {
6161
return archive->LoadFile(hash);
6262
}
6363

64+
std::shared_ptr<File> ArchiveManager::LoadFileRaw(const std::string& filePath) {
65+
if (filePath == "") {
66+
return nullptr;
67+
}
68+
69+
const auto archive = mFileToArchive[CRC64(filePath.c_str())];
70+
if (archive == nullptr) {
71+
return nullptr;
72+
}
73+
74+
return archive->LoadFileRaw(filePath);
75+
}
76+
77+
std::shared_ptr<File> ArchiveManager::LoadFileRaw(uint64_t hash) {
78+
const auto archive = mFileToArchive[hash];
79+
if (archive == nullptr) {
80+
return nullptr;
81+
}
82+
83+
return archive->LoadFileRaw(hash);
84+
}
85+
6486
bool ArchiveManager::HasFile(const std::string& filePath) {
6587
return HasFile(CRC64(filePath.c_str()));
6688
}

src/resource/archive/ArchiveManager.h

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class ArchiveManager {
2121
bool IsArchiveLoaded();
2222
std::shared_ptr<File> LoadFile(const std::string& filePath);
2323
std::shared_ptr<File> LoadFile(uint64_t hash);
24+
std::shared_ptr<File> LoadFileRaw(const std::string& filePath);
25+
std::shared_ptr<File> LoadFileRaw(uint64_t hash);
2426
bool HasFile(const std::string& filePath);
2527
bool HasFile(uint64_t hash);
2628
std::shared_ptr<std::vector<std::string>> ListFiles(const std::string& filter);

src/window/gui/GameOverlay.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ GameOverlay::~GameOverlay() {
1717

1818
void GameOverlay::LoadFont(const std::string& name, const std::string& path, float fontSize) {
1919
ImGuiIO& io = ImGui::GetIO();
20-
std::shared_ptr<File> font = Context::GetInstance()->GetResourceManager()->GetArchiveManager()->LoadFile(path);
20+
std::shared_ptr<File> font = Context::GetInstance()->GetResourceManager()->GetArchiveManager()->LoadFileRaw(path);
2121
if (font->IsLoaded) {
2222
// TODO: Nothing is ever unloading the font or this fontData array.
2323
char* fontData = new char[font->Buffer->size()];

0 commit comments

Comments
 (0)