mirror of
https://github.com/geode-sdk/geode.git
synced 2025-04-12 21:14:41 -04:00
Merge branch 'main' of https://github.com/geode-sdk/geode
This commit is contained in:
commit
2db4834fff
2 changed files with 25 additions and 12 deletions
19
entry.cpp
19
entry.cpp
|
@ -24,20 +24,19 @@ namespace {
|
|||
// Without these, the game will very likely crash when the mod tries to free memory allocated by the game (or another non-debug mod).
|
||||
|
||||
static inline void* relallocthrow(size_t size) {
|
||||
// void* p;
|
||||
// while ((p = HeapAlloc(GetProcessHeap(), 0, size)) == 0) {
|
||||
// if (_callnewh(size) == 0) {
|
||||
// static const std::bad_alloc exc;
|
||||
// throw exc;
|
||||
// }
|
||||
// }
|
||||
void* p;
|
||||
while ((p = HeapAlloc(GetProcessHeap(), 0, size)) == 0) {
|
||||
if (_callnewh(size) == 0) {
|
||||
static const std::bad_alloc exc;
|
||||
throw exc;
|
||||
}
|
||||
}
|
||||
|
||||
return geode::stl::operatorNew(size);
|
||||
return p;
|
||||
}
|
||||
|
||||
static inline void relfree(void* block) {
|
||||
// HeapFree(GetProcessHeap(), 0, block);
|
||||
geode::stl::operatorDelete(block);
|
||||
HeapFree(GetProcessHeap(), 0, block);
|
||||
}
|
||||
|
||||
void* operator new(size_t size) {
|
||||
|
|
|
@ -146,13 +146,27 @@ struct CustomLoadingLayer : Modify<CustomLoadingLayer, LoadingLayer> {
|
|||
LoaderImpl::get()->updateResources(true);
|
||||
this->continueLoadAssets();
|
||||
}
|
||||
|
||||
int getLoadedMods() {
|
||||
auto allMods = Loader::get()->getAllMods();
|
||||
return std::count_if(allMods.begin(), allMods.end(), [&](auto& item) {
|
||||
return item->isEnabled();
|
||||
});
|
||||
}
|
||||
|
||||
int getEnabledMods() {
|
||||
auto allMods = Loader::get()->getAllMods();
|
||||
return std::count_if(allMods.begin(), allMods.end(), [&](auto& item) {
|
||||
return item->shouldLoad();
|
||||
});
|
||||
}
|
||||
|
||||
int getCurrentStep() {
|
||||
return m_fields->m_geodeLoadStep + m_loadStep + 1 + LoaderImpl::get()->m_refreshedModCount;
|
||||
return m_fields->m_geodeLoadStep + m_loadStep + getLoadedMods();
|
||||
}
|
||||
|
||||
int getTotalStep() {
|
||||
return 18 + m_fields->m_totalMods;
|
||||
return 3 + 14 + getEnabledMods();
|
||||
}
|
||||
|
||||
void updateLoadingBar() {
|
||||
|
|
Loading…
Add table
Reference in a new issue