Skip to content

Commit

Permalink
ResourceManager.DidLoadSuccessfully() -> ResourceManager.IsLoaded() (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenix3 authored Dec 12, 2024
1 parent 9120fe9 commit 8280f41
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void Context::InitResourceManager(const std::vector<std::string>& archivePaths,
GetResourceManager()->Init(archivePaths, validHashes, reservedThreadCount);
}

if (!GetResourceManager()->DidLoadSuccessfully()) {
if (!GetResourceManager()->IsLoaded()) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "OTR file not found",
"Main OTR file not found. Please generate one", nullptr);
SPDLOG_ERROR("Main OTR file not found!");
Expand Down
4 changes: 2 additions & 2 deletions src/public/bridge/resourcebridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ void ResourceUnloadDirectory(const char* name) {
Ship::Context::GetInstance()->GetResourceManager()->UnloadDirectory(name);
}

uint32_t ResourceDoesOtrFileExist() {
return Ship::Context::GetInstance()->GetResourceManager()->DidLoadSuccessfully();
uint32_t IsResourceManagerLoaded() {
return Ship::Context::GetInstance()->GetResourceManager()->IsLoaded();
}
}
2 changes: 1 addition & 1 deletion src/public/bridge/resourcebridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void ResourceUnloadDirectory(const char* name);
void ResourceClearCache();
void ResourceGetGameVersions(uint32_t* versions, size_t versionsSize, size_t* versionsCount);
uint32_t ResourceHasGameVersion(uint32_t hash);
uint32_t ResourceDoesOtrFileExist();
uint32_t IsResourceManagerLoaded();

#ifdef __cplusplus
};
Expand Down
4 changes: 2 additions & 2 deletions src/resource/ResourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void ResourceManager::Init(const std::vector<std::string>& archivePaths,
size_t threadCount = std::max(1, (int32_t)(std::thread::hardware_concurrency() - reservedThreadCount - 1));
mThreadPool = std::make_shared<BS::thread_pool>(threadCount);

if (!DidLoadSuccessfully()) {
if (!IsLoaded()) {
// Nothing ever unpauses the thread pool since nothing will ever try to load the archive again.
mThreadPool->pause();
}
Expand All @@ -60,7 +60,7 @@ ResourceManager::~ResourceManager() {
SPDLOG_INFO("destruct ResourceManager");
}

bool ResourceManager::DidLoadSuccessfully() {
bool ResourceManager::IsLoaded() {
return mArchiveManager != nullptr && mArchiveManager->IsLoaded();
}

Expand Down
3 changes: 2 additions & 1 deletion src/resource/ResourceManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class ResourceManager {
int32_t reservedThreadCount = 1);
~ResourceManager();

bool IsLoaded();

std::shared_ptr<ArchiveManager> GetArchiveManager();
std::shared_ptr<ResourceLoader> GetResourceLoader();

Expand Down Expand Up @@ -81,7 +83,6 @@ class ResourceManager {
void DirtyDirectory(const std::string& searchMask);
void UnloadDirectory(const std::string& searchMask);

bool DidLoadSuccessfully();
bool OtrSignatureCheck(const char* fileName);
bool IsAltAssetsEnabled();
void SetAltAssetsEnabled(bool isEnabled);
Expand Down

0 comments on commit 8280f41

Please sign in to comment.