2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 06:27:43 +00:00

Various updates:

- Simplify Layers logic with hecl bugfix
- Show About window with error message on launch with no game
- Use high_resolution_clock for FPS & load logic (increased resolution on Windows)
This commit is contained in:
2021-05-30 15:03:35 -04:00
parent 052c1888cb
commit 78bcba85e2
8 changed files with 121 additions and 105 deletions

View File

@@ -75,21 +75,24 @@ void CResFactory::BuildAsync(const SObjectTag& tag, const CVParamTransfer& xfer,
}
}
void CResFactory::AsyncIdle() {
bool CResFactory::AsyncIdle(std::chrono::nanoseconds target) {
OPTICK_EVENT();
if (m_loadList.empty())
return;
auto startTime = std::chrono::steady_clock::now();
while (std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - startTime).count() <
5) {
if (m_loadList.empty()) {
return false;
}
auto startTime = std::chrono::high_resolution_clock::now();
do {
auto& task = m_loadList.front();
if (PumpResource(task)) {
m_loadMap.erase(task.x0_tag);
m_loadList.pop_front();
if (m_loadList.empty())
return;
if (m_loadList.empty()) {
return false;
}
}
}
} while (std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::steady_clock::now() - startTime) <
target);
return true;
}
void CResFactory::CancelBuild(const SObjectTag& tag) {