#include "classes.h" // 0069d290 void Menu_Mods::Update() { std_string *displayName; byte *b; void *freeBlock; uint size; undefined1 *nameSize; Menu_Mods playersBegin; byte *a; int iVar2; Menu_Mods playersEnd; undefined1 local_74 [4]; uint playerIndex; Menu_Mods *self; undefined1 *nameMapHead; undefined4 local_64; undefined1 *local_60; uint local_5c; void *displayNameBuf [3]; undefined1 local_4c [8]; undefined1 *local_44; void *nameKey; undefined4 uStack_3c; undefined4 uStack_38; undefined4 uStack_34; uint nameKeySize; uint nameKeyCapacity; uint local_28; uint securityCookie; undefined1 *puStack_20; void *local_1c; undefined1 *puStack_18; undefined4 local_14; uint *nameSize; EntityConfig_Player *playerConfig; puStack_20 = local_4c + 0x48; local_14 = 0xffffffff; puStack_18 = &LAB_00af9dbd; local_1c = ExceptionList; securityCookie = __security_cookie ^ GHIDRA_UINT((local_4c + 0x3c)); ExceptionList = &local_1c; nameMapHead = GHIDRA_CAST(0x0); local_64 = 0; self = this; nameMapHead = operator_new(0x2c); *GHIDRA_CAST(nameMapHead) = nameMapHead; *GHIDRA_CAST((nameMapHead + 4)) = nameMapHead; *GHIDRA_CAST((nameMapHead + 8)) = nameMapHead; *GHIDRA_CAST((nameMapHead + 0xc)) = 0x101; (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0; (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))) = 0; playersEnd = this[3]; playersBegin = this[2]; local_5c = 0x29; local_60 = nameMapHead; if (0x29 < GHIDRA_UINT(((GHIDRA_INT(playersEnd) - GHIDRA_INT(playersBegin)) / 0x148))) { iVar2 = 0x3488; do { playerConfig = GHIDRA_CAST((iVar2 + GHIDRA_INT(playersBegin))); if ((*GHIDRA_CAST((iVar2 + 0x128 + GHIDRA_INT(playersBegin))) == '\0') && ((playerConfig->_bSkinParentName)._size == 0)) { displayName = EntityConfig_Player::GetDisplayName (playerConfig,GHIDRA_CAST(displayNameBuf),playerConfig); nameKey = *(void **)displayName->_buf; uStack_3c = *GHIDRA_CAST((displayName->_buf + 4)); uStack_38 = *GHIDRA_CAST((displayName->_buf + 8)); uStack_34 = *GHIDRA_CAST((displayName->_buf + 0xc)); nameKeySize = displayName->_size; nameKeyCapacity = displayName->_capacity; displayName->_size = 0; displayName->_capacity = 0xf; displayName->_buf[0] = '\0'; local_28 = local_5c; (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 2; FUN_006a00d0(local_74,&nameKey); (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 1; if (0xf < nameKeyCapacity) { size = nameKeyCapacity + 1; freeBlock = nameKey; if (0xfff < size) { freeBlock = *(void **)(GHIDRA_CAST(nameKey) + -4); size = nameKeyCapacity + 0x24; if (0x1f < GHIDRA_UINT((GHIDRA_INT(nameKey) + (-4 - GHIDRA_INT(freeBlock))))) goto LAB_0069d502; } operator_delete(freeBlock,size); } (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0; if (&DAT_0000000f < local_44) { nameSize = local_44 + 1; freeBlock = displayNameBuf[0]; if (GHIDRA_CAST(0xfff) < nameSize) { freeBlock = *(void **)(GHIDRA_INT(displayNameBuf[0]) + -4); nameSize = local_44 + 0x24; if (0x1f < GHIDRA_UINT((GHIDRA_INT(displayNameBuf[0]) + (-4 - GHIDRA_INT(freeBlock))))) { LAB_0069d502: /* WARNING: Subroutine does not return */ _invalid_parameter_noinfo_noreturn(); } } operator_delete(freeBlock,GHIDRA_UINT(nameSize)); } } iVar2 = iVar2 + 0x148; local_5c = local_5c + 1; playersEnd = self[3]; playersBegin = self[2]; } while (local_5c < GHIDRA_UINT(((GHIDRA_INT(playersEnd) - GHIDRA_INT(playersBegin)) / 0x148))); local_60 = nameMapHead; } playerIndex = 0x29; nameSize = local_60; nameMapHead = local_60; if (0x29 < GHIDRA_UINT(((GHIDRA_INT(playersEnd) - GHIDRA_INT(playersBegin)) / 0x148))) { local_5c = 0x3488; do { if ((*GHIDRA_CAST((local_5c + 0x128 + GHIDRA_INT(playersBegin))) == '\0') && (*GHIDRA_CAST((local_5c + 0x11c + GHIDRA_INT(playersBegin))) != 0)) { a = GHIDRA_CAST((GHIDRA_INT(playersBegin) + local_5c + 0x10c)); std::map::_Find_lower_bound(local_4c,a); nameSize = local_44; if (local_44[0xd] == '\0') { b = local_44 + 0x10; if (0xf < *GHIDRA_CAST((local_44 + 0x24))) { b = *GHIDRA_CAST(b); } nameSize = GHIDRA_CAST((a + 0x10)); if (0xf < *GHIDRA_CAST((a + 0x14))) { a = *GHIDRA_CAST(a); } iVar2 = string_compare(a,*nameSize,b,*GHIDRA_CAST((local_44 + 0x20))); if ((-1 < iVar2) && (nameSize != local_60)) { *GHIDRA_CAST((*GHIDRA_CAST((nameSize + 0x28)) * 0x148 + 0x124 + GHIDRA_INT(self[2]))) = playerIndex; local_60 = nameMapHead; } } nameSize = local_60; } local_5c = local_5c + 0x148; playerIndex = playerIndex + 1; playersBegin = self[2]; } while (playerIndex < GHIDRA_UINT(((GHIDRA_INT(self[3]) - GHIDRA_INT(playersBegin)) / 0x148))); } FUN_004235c0(&nameMapHead,*GHIDRA_CAST((nameSize + 4))); operator_delete(nameMapHead,0x2c); ExceptionList = local_1c; return; } // 008e4970 void Menu_Mods::reset() { byte bVar1; Menu_Mods currentName; uint compareResult; byte *defaultName; bool isLess; Menu_Mods animData; MenuManager *menuManager; animData = this[0x11]; if (animData != (Menu_Mods)0x0) { currentName = animData; if (0xf < *GHIDRA_CAST((GHIDRA_CAST(animData) + 0x14))) { currentName = *GHIDRA_CAST(animData); } defaultName = &DAT_00b6767c; do { bVar1 = *GHIDRA_CAST(currentName); isLess = bVar1 < *defaultName; if (bVar1 != *defaultName) { LAB_008e49b0: compareResult = -GHIDRA_UINT(isLess) | 1; goto LAB_008e49b5; } if (bVar1 == 0) break; bVar1 = *GHIDRA_CAST((GHIDRA_CAST(currentName) + 1)); isLess = bVar1 < defaultName[1]; if (bVar1 != defaultName[1]) goto LAB_008e49b0; currentName = (Menu_Mods)(GHIDRA_INT(currentName) + 2); defaultName = defaultName + 2; } while (bVar1 != 0); compareResult = 0; LAB_008e49b5: if ((compareResult == 0) && ((*GHIDRA_CAST((GHIDRA_CAST(animData) + 0x34)) == 0 || (*GHIDRA_CAST((this + 0x15)) != '\0')))) goto LAB_008e49e2; } bVar1 = (GHIDRA_CAST((GHIDRA_CAST((this + 4)))))->ANM2::SetAnimation(&DAT_00b6767c,1); if (bVar1 != 0) { (GHIDRA_CAST((GHIDRA_CAST((this + 0x10)))))->AnimationState::Rewind(); *GHIDRA_CAST((this + 0x15)) = 1; } LAB_008e49e2: menuManager = g_menuManager; *this = (Menu_Mods)0x0; this[1] = (Menu_Mods)0x0; menuManager->_viewPositionSet[7].y = -216.0; menuManager->_state = 1; *GHIDRA_CAST((this + 0x4a)) = g_manager->_modManager; *GHIDRA_CAST((this + 0x49)) = 0; return; }