Skip to content

Commit

Permalink
fix uncaptured character parameters #26
Browse files Browse the repository at this point in the history
  • Loading branch information
chinosk6 committed Jul 18, 2024
1 parent 90d33d8 commit ae99c7a
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1495,6 +1495,18 @@ namespace

}

int getCharacterParamAliveCount(const std::string& objName) {
int aliveCount = 0;
for (auto& i : charaParam) {
if (i.first.starts_with(objName)) {
if (i.second.checkObjAlive()) {
aliveCount++;
}
}
}
return aliveCount;
}

void AssembleCharacter_ApplyParam_hook(void* mdl, float height, float bust, float head, float arm, float hand) {
if (g_enable_chara_param_edit) {
static auto get_ObjectName = reinterpret_cast<Il2CppString * (*)(void*)>(il2cpp_resolve_icall("UnityEngine.Object::GetName(UnityEngine.Object)"));
Expand All @@ -1509,7 +1521,17 @@ namespace
else {
showObjName = objName;
}
showObjName = std::format("{} ({:p})", showObjName, mdl);

const auto objAliveCount = getCharacterParamAliveCount(showObjName);
if (objAliveCount > 0) {
showObjName = std::format("{} [{}]", showObjName, objAliveCount);
}
/*
if (auto it = charaParam.find(showObjName); it != charaParam.end()) {
if (it->second.checkObjAlive()) {
showObjName = std::format("{} ({:p})", showObjName, mdl);
}
}*/
}
else {
showObjName = objName;
Expand Down

0 comments on commit ae99c7a

Please sign in to comment.