Files
isaac-port/generated-src/mod_manager.cpp
T
shweetandClaude Opus 5.5 9d4d4f5c64 Build 29: zero-length placeholder structs, generated-src with standard types
--check: 938/3256 method bodies compile for x86_64 (28.8%), 32-bit layout asserts hold; boot path 3/626 curated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 21:41:34 -05:00

4984 lines
247 KiB
C++

#include "classes.h"
// 008f2ff0
ModManager::~ModManager()
{
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
puStack_c = &LAB_00af0b40;
local_10 = ExceptionList;
ExceptionList = &local_10;
local_8 = 0;
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((this + 0xab18)))))->ANM2::Reset();
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[0xab32])) + 0x2)))))))->AnimationState::~AnimationState();
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((this + 0xab28)))))->AnimationState::~AnimationState();
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((this + 0xab20)))))->msvc::string::_Tidy_deallocate();
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((this + 0xab18)))))->msvc::string::_Tidy_deallocate();
local_8 = 1;
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((this + 0xaabc)))))->ANM2::Reset();
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[0xaad6])) + 0x2)))))))->AnimationState::~AnimationState();
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((this + 0xaacc)))))->AnimationState::~AnimationState();
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((this + 0xaac4)))))->msvc::string::_Tidy_deallocate();
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((this + 0xaabc)))))->msvc::string::_Tidy_deallocate();
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((this + 0xaab4)))))->msvc::string::_Tidy_deallocate();
(GHIDRA_CAST<KAGE::Thread *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[0xaaae])) + 0x2))))))->KAGE::Thread::~Thread();
FUN_008fc570();
FID_conflict__Tidy(this);
ExceptionList = local_10;
return;
}
// 008f30d0
void ModManager::LoadModContent()
{
uint64_t qVar1;
uint32_t uVar2;
uint32_t uVar3;
uint8_t *pbVar4;
uint8_t isFileFound;
uint32_t uVar5;
uint8_t *pbVar6;
std_string *psVar7;
char *pcVar8;
void *pvVar9;
std_string *psVar10;
uint8_t *pbVar11;
uint32_t uVar12;
uint64_t *allocatedBytes;
int *modSlot;
std_string local_84;
std_string pathTmp;
std_string local_54;
std_string contentPath;
uint32_t local_24;
char *pcStack_20;
void *local_1c;
uint8_t *puStack_18;
uint32_t local_14;
uint32_t *dirNameSize;
pcStack_20 = GHIDRA_CAST<char *>((GHIDRA_INT(register0x00000010) + 0xfffffffc));
local_14 = 0xffffffff;
puStack_18 = &LAB_00b0773d;
local_1c = ExceptionList;
uVar5 = __security_cookie ^ GHIDRA_UINT((GHIDRA_INT(register0x00000010) + 0xfffffff0U));
ExceptionList = &local_1c;
modSlot = *GHIDRA_CAST<int **>(this);
local_24 = uVar5;
pcVar8 = GHIDRA_CAST<char *>((GHIDRA_INT(register0x00000010) + 0xfffffffc));
if (modSlot != *GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1))))) {
do {
if (*GHIDRA_CAST<char *>((*modSlot + 0xfd)) != '\0') {
Mod::load_menu_sprites(uVar5);
builtin_strncpy(local_54._buf,"entities2.xml",0xe);
local_54._capacity = 0xf;
local_54._size = 0xd;
local_14 = 0;
(GHIDRA_CAST<Mod *>(((void *)*modSlot)))->Mod::GetContentPath(&contentPath,&local_54);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
if (0xf < local_54._capacity) {
uVar12 = local_54._capacity + 1;
pvVar9 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)local_54._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar9 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + -4);
uVar12 = local_54._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar9))))) goto LAB_008f46dd;
}
operator_delete(pvVar9,uVar12);
}
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
pbVar6 = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(psVar7));
if (pbVar6 != GHIDRA_CAST<uint8_t *>(0x0)) {
if (g_mainHeap == (void *)0x0) {
allocatedBytes = &g_allocatedBytesNoHeap;
}
else {
allocatedBytes = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar12 = *GHIDRA_CAST<uint32_t *>((pbVar6 + -4));
qVar1 = *allocatedBytes;
*GHIDRA_CAST<uint32_t *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar12;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar12));
free(pbVar6 + -4);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
}
if (pbVar6 != GHIDRA_CAST<uint8_t *>(0x0)) {
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
(GHIDRA_CAST<EntityConfig *>((&g_manager->_entityConfig)))->EntityConfig::LoadEntities(GHIDRA_CAST<uint8_t *>(psVar7),(void *)*modSlot);
}
local_54._capacity = 0xf;
local_54._size = 9;
builtin_strncpy(local_54._buf,"items.xm",8);
local_54._buf[8] = 'l';
local_54._buf[9] = '\0';
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 4;
psVar7 = (GHIDRA_CAST<Mod *>(((void *)*modSlot)))->Mod::GetContentPath(&pathTmp,&local_54);
if (&contentPath != psVar7) {
(GHIDRA_CAST<msvc::string *>((contentPath._buf)))->msvc::string::_Tidy_deallocate();
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) = *GHIDRA_CAST<uint32_t *>(psVar7->_buf);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x4))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 4));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x8))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 8));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0xc))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 0xc));
contentPath._size = psVar7->_size;
contentPath._capacity = psVar7->_capacity;
psVar7->_size = 0;
psVar7->_capacity = 0xf;
psVar7->_buf[0] = '\0';
}
if (0xf < pathTmp._capacity) {
uVar12 = pathTmp._capacity + 1;
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(pathTmp._buf))) + 0x0)));
if (0xfff < uVar12) {
psVar7 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0))) + -0x18)))->_capacity);
uVar12 = pathTmp._capacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar7))))) goto LAB_008f46dd;
}
operator_delete(psVar7,uVar12);
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
pathTmp._size = 0;
pathTmp._capacity = 0xf;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0))) & 0xffffff00;
if (0xf < local_54._capacity) {
uVar12 = local_54._capacity + 1;
pvVar9 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)local_54._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar9 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + -4);
uVar12 = local_54._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar9))))) goto LAB_008f46dd;
}
operator_delete(pvVar9,uVar12);
}
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
pbVar6 = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(psVar7));
if (pbVar6 != GHIDRA_CAST<uint8_t *>(0x0)) {
if (g_mainHeap == (void *)0x0) {
allocatedBytes = &g_allocatedBytesNoHeap;
}
else {
allocatedBytes = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar12 = *GHIDRA_CAST<uint32_t *>((pbVar6 + -4));
qVar1 = *allocatedBytes;
*GHIDRA_CAST<uint32_t *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar12;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar12));
free(pbVar6 + -4);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
}
if (pbVar6 != GHIDRA_CAST<uint8_t *>(0x0)) {
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
(GHIDRA_CAST<ItemConfig *>((&g_manager->_itemConfig)))->ItemConfig::Load(GHIDRA_CAST<uint8_t *>(psVar7),(void *)*modSlot);
}
pvVar9 = (void *)*modSlot;
pcVar8 = msvc::_Allocate(0x20);
local_54._size = 0x10;
local_54._capacity = 0x1f;
builtin_strncpy(pcVar8,"info_display.xml",0x11);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) = pcVar8;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 6;
psVar7 = (GHIDRA_CAST<Mod *>((pvVar9)))->Mod::GetContentPath(&pathTmp,&local_54);
if (&contentPath != psVar7) {
if (0xf < contentPath._capacity) {
uVar12 = contentPath._capacity + 1;
psVar10 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
if (0xfff < uVar12) {
psVar10 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + -0x18)))->_capacity);
uVar12 = contentPath._capacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar10)))))
goto LAB_008f46dd;
}
operator_delete(psVar10,uVar12);
}
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) = *GHIDRA_CAST<uint32_t *>(psVar7->_buf);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x4))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 4));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x8))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 8));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0xc))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 0xc));
contentPath._size = psVar7->_size;
contentPath._capacity = psVar7->_capacity;
psVar7->_size = 0;
psVar7->_capacity = 0xf;
psVar7->_buf[0] = '\0';
}
if (0xf < pathTmp._capacity) {
uVar12 = pathTmp._capacity + 1;
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(pathTmp._buf))) + 0x0)));
if (0xfff < uVar12) {
psVar7 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0))) + -0x18)))->_capacity);
uVar12 = pathTmp._capacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar7))))) goto LAB_008f46dd;
}
operator_delete(psVar7,uVar12);
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
pathTmp._size = 0;
pathTmp._capacity = 0xf;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0))) & 0xffffff00;
if (0xf < local_54._capacity) {
uVar12 = local_54._capacity + 1;
pvVar9 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)local_54._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar9 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + -4);
uVar12 = local_54._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar9))))) goto LAB_008f46dd;
}
operator_delete(pvVar9,uVar12);
}
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
pbVar6 = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(psVar7));
if (pbVar6 != GHIDRA_CAST<uint8_t *>(0x0)) {
if (g_mainHeap == (void *)0x0) {
allocatedBytes = &g_allocatedBytesNoHeap;
}
else {
allocatedBytes = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar12 = *GHIDRA_CAST<uint32_t *>((pbVar6 + -4));
qVar1 = *allocatedBytes;
*GHIDRA_CAST<uint32_t *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar12;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar12));
free(pbVar6 + -4);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
}
if (pbVar6 != GHIDRA_CAST<uint8_t *>(0x0)) {
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
(GHIDRA_CAST<InfoDisplay *>((&g_manager->_infoDisplay)))->InfoDisplay::load_xml(GHIDRA_CAST<uint8_t *>(psVar7),(void *)*modSlot);
}
builtin_strncpy(local_54._buf,"pocketitems.xml",0x10);
local_54._capacity = 0xf;
local_54._size = 0xf;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 8;
psVar7 = (GHIDRA_CAST<Mod *>(((void *)*modSlot)))->Mod::GetContentPath(&pathTmp,&local_54);
if (&contentPath != psVar7) {
if (0xf < contentPath._capacity) {
uVar12 = contentPath._capacity + 1;
psVar10 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
if (0xfff < uVar12) {
psVar10 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + -0x18)))->_capacity);
uVar12 = contentPath._capacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar10)))))
goto LAB_008f46dd;
}
operator_delete(psVar10,uVar12);
}
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) = *GHIDRA_CAST<uint32_t *>(psVar7->_buf);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x4))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 4));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x8))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 8));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0xc))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 0xc));
contentPath._size = psVar7->_size;
contentPath._capacity = psVar7->_capacity;
psVar7->_size = 0;
psVar7->_capacity = 0xf;
psVar7->_buf[0] = '\0';
}
if (0xf < pathTmp._capacity) {
uVar12 = pathTmp._capacity + 1;
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(pathTmp._buf))) + 0x0)));
if (0xfff < uVar12) {
psVar7 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0))) + -0x18)))->_capacity);
uVar12 = pathTmp._capacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar7))))) goto LAB_008f46dd;
}
operator_delete(psVar7,uVar12);
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
pathTmp._size = 0;
pathTmp._capacity = 0xf;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0))) & 0xffffff00;
if (0xf < local_54._capacity) {
uVar12 = local_54._capacity + 1;
pvVar9 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)local_54._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar9 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + -4);
uVar12 = local_54._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar9))))) goto LAB_008f46dd;
}
operator_delete(pvVar9,uVar12);
}
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
pbVar6 = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(psVar7));
if (pbVar6 != GHIDRA_CAST<uint8_t *>(0x0)) {
if (g_mainHeap == (void *)0x0) {
allocatedBytes = &g_allocatedBytesNoHeap;
}
else {
allocatedBytes = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar12 = *GHIDRA_CAST<uint32_t *>((pbVar6 + -4));
qVar1 = *allocatedBytes;
*GHIDRA_CAST<uint32_t *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar12;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar12));
free(pbVar6 + -4);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
}
if (pbVar6 != GHIDRA_CAST<uint8_t *>(0x0)) {
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
(GHIDRA_CAST<ItemConfig *>((&g_manager->_itemConfig)))->ItemConfig::load_pocketitems_xml(GHIDRA_CAST<uint8_t *>(psVar7),(void *)*modSlot);
}
builtin_strncpy(local_54._buf,"costumes2.xml",0xe);
local_54._capacity = 0xf;
local_54._size = 0xd;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 10;
psVar7 = (GHIDRA_CAST<Mod *>(((void *)*modSlot)))->Mod::GetContentPath(&pathTmp,&local_54);
if (&contentPath != psVar7) {
if (0xf < contentPath._capacity) {
uVar12 = contentPath._capacity + 1;
psVar10 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
if (0xfff < uVar12) {
psVar10 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + -0x18)))->_capacity);
uVar12 = contentPath._capacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar10)))))
goto LAB_008f46dd;
}
operator_delete(psVar10,uVar12);
}
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) = *GHIDRA_CAST<uint32_t *>(psVar7->_buf);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x4))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 4));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x8))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 8));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0xc))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 0xc));
contentPath._size = psVar7->_size;
contentPath._capacity = psVar7->_capacity;
psVar7->_size = 0;
psVar7->_capacity = 0xf;
psVar7->_buf[0] = '\0';
}
if (0xf < pathTmp._capacity) {
uVar12 = pathTmp._capacity + 1;
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(pathTmp._buf))) + 0x0)));
if (0xfff < uVar12) {
psVar7 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0))) + -0x18)))->_capacity);
uVar12 = pathTmp._capacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar7))))) goto LAB_008f46dd;
}
operator_delete(psVar7,uVar12);
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
pathTmp._size = 0;
pathTmp._capacity = 0xf;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0))) & 0xffffff00;
if (0xf < local_54._capacity) {
uVar12 = local_54._capacity + 1;
pvVar9 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)local_54._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar9 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + -4);
uVar12 = local_54._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar9))))) goto LAB_008f46dd;
}
operator_delete(pvVar9,uVar12);
}
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
pbVar6 = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(psVar7));
if (pbVar6 != GHIDRA_CAST<uint8_t *>(0x0)) {
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xb;
tracked_alloc(1,pbVar6,0);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
(GHIDRA_CAST<ItemConfig *>((&g_manager->_itemConfig)))->ItemConfig::load_costumes_xml(GHIDRA_CAST<uint8_t *>(psVar7),(void *)*modSlot);
}
pvVar9 = (void *)*modSlot;
local_54._size = 0;
local_54._capacity = 0xf;
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) = (*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) & 0xffffffff00000000;
(GHIDRA_CAST<msvc::string *>((local_54._buf)))->msvc::string::assign(GHIDRA_CAST<uint8_t *>("items_metadata.xml"),0x12);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xc;
psVar7 = (GHIDRA_CAST<Mod *>((pvVar9)))->Mod::GetContentPath(&local_84,&local_54);
if (&contentPath != psVar7) {
if (0xf < contentPath._capacity) {
uVar12 = contentPath._capacity + 1;
psVar10 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
if (0xfff < uVar12) {
psVar10 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + -0x18)))->_capacity);
uVar12 = contentPath._capacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar10)))))
goto LAB_008f46dd;
}
operator_delete(psVar10,uVar12);
}
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) = *GHIDRA_CAST<uint32_t *>(psVar7->_buf);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x4))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 4));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x8))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 8));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0xc))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 0xc));
contentPath._size = psVar7->_size;
contentPath._capacity = psVar7->_capacity;
psVar7->_size = 0;
psVar7->_capacity = 0xf;
psVar7->_buf[0] = '\0';
}
(GHIDRA_CAST<msvc::string *>((local_84._buf)))->msvc::string::_Tidy_deallocate();
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
if (0xf < local_54._capacity) {
uVar12 = local_54._capacity + 1;
pvVar9 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)local_54._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar9 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + -4);
uVar12 = local_54._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar9))))) goto LAB_008f46dd;
}
operator_delete(pvVar9,uVar12);
}
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
pbVar6 = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(psVar7));
if (pbVar6 != GHIDRA_CAST<uint8_t *>(0x0)) {
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xd;
tracked_alloc(1,pbVar6,0);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
(GHIDRA_CAST<ItemConfig *>((&g_manager->_itemConfig)))->ItemConfig::load_metadata_xml(GHIDRA_CAST<uint8_t *>(psVar7),(void *)*modSlot);
}
pvVar9 = (void *)*modSlot;
local_54._size = 0;
local_54._capacity = 0xf;
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) = (*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) & 0xffffffff00000000;
(GHIDRA_CAST<msvc::string *>((local_54._buf)))->msvc::string::assign(GHIDRA_CAST<uint8_t *>("wisps.xml"),9);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xe;
psVar7 = (GHIDRA_CAST<Mod *>((pvVar9)))->Mod::GetContentPath(&local_84,&local_54);
if (&contentPath != psVar7) {
if (0xf < contentPath._capacity) {
uVar12 = contentPath._capacity + 1;
psVar10 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
if (0xfff < uVar12) {
psVar10 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + -0x18)))->_capacity);
uVar12 = contentPath._capacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar10)))))
goto LAB_008f46dd;
}
operator_delete(psVar10,uVar12);
}
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) = *GHIDRA_CAST<uint32_t *>(psVar7->_buf);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x4))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 4));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x8))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 8));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0xc))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 0xc));
contentPath._size = psVar7->_size;
contentPath._capacity = psVar7->_capacity;
psVar7->_size = 0;
psVar7->_capacity = 0xf;
psVar7->_buf[0] = '\0';
}
(GHIDRA_CAST<msvc::string *>((local_84._buf)))->msvc::string::_Tidy_deallocate();
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
if (0xf < local_54._capacity) {
uVar12 = local_54._capacity + 1;
pvVar9 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)local_54._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar9 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + -4);
uVar12 = local_54._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar9))))) goto LAB_008f46dd;
}
operator_delete(pvVar9,uVar12);
}
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
pbVar6 = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(psVar7));
if (pbVar6 != GHIDRA_CAST<uint8_t *>(0x0)) {
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xf;
tracked_alloc(1,pbVar6,0);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
(GHIDRA_CAST<ItemConfig *>((&g_manager->_itemConfig)))->ItemConfig::load_wisps_xml(GHIDRA_CAST<uint8_t *>(psVar7),(void *)*modSlot);
}
pvVar9 = (void *)*modSlot;
local_54._size = 0;
local_54._capacity = 0xf;
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) = (*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) & 0xffffffff00000000;
(GHIDRA_CAST<msvc::string *>((local_54._buf)))->msvc::string::assign(GHIDRA_CAST<uint8_t *>("locusts.xml"),0xb);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0x10;
psVar7 = (GHIDRA_CAST<Mod *>((pvVar9)))->Mod::GetContentPath(&local_84,&local_54);
if (&contentPath != psVar7) {
if (0xf < contentPath._capacity) {
uVar12 = contentPath._capacity + 1;
psVar10 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
if (0xfff < uVar12) {
psVar10 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + -0x18)))->_capacity);
uVar12 = contentPath._capacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar10)))))
goto LAB_008f46dd;
}
operator_delete(psVar10,uVar12);
}
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) = *GHIDRA_CAST<uint32_t *>(psVar7->_buf);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x4))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 4));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x8))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 8));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0xc))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 0xc));
contentPath._size = psVar7->_size;
contentPath._capacity = psVar7->_capacity;
psVar7->_size = 0;
psVar7->_capacity = 0xf;
psVar7->_buf[0] = '\0';
}
(GHIDRA_CAST<msvc::string *>((local_84._buf)))->msvc::string::_Tidy_deallocate();
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
if (0xf < local_54._capacity) {
uVar12 = local_54._capacity + 1;
pvVar9 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)local_54._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar9 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + -4);
uVar12 = local_54._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar9))))) goto LAB_008f46dd;
}
operator_delete(pvVar9,uVar12);
}
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
pbVar6 = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(psVar7));
if (pbVar6 != GHIDRA_CAST<uint8_t *>(0x0)) {
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0x11;
tracked_alloc(1,pbVar6,0);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
(GHIDRA_CAST<ItemConfig *>((&g_manager->_itemConfig)))->ItemConfig::LoadLocustConfig(GHIDRA_CAST<uint8_t *>(psVar7),GHIDRA_CAST<ModEntry *>(*modSlot));
}
pvVar9 = (void *)*modSlot;
local_54._size = 0;
local_54._capacity = 0xf;
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) = (*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) & 0xffffffff00000000;
(GHIDRA_CAST<msvc::string *>((local_54._buf)))->msvc::string::assign(GHIDRA_CAST<uint8_t *>("recipes.xml"),0xb);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0x12;
psVar7 = (GHIDRA_CAST<Mod *>((pvVar9)))->Mod::GetContentPath(&local_84,&local_54);
if (&contentPath != psVar7) {
if (0xf < contentPath._capacity) {
uVar12 = contentPath._capacity + 1;
psVar10 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
if (0xfff < uVar12) {
psVar10 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + -0x18)))->_capacity);
uVar12 = contentPath._capacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar10)))))
goto LAB_008f46dd;
}
operator_delete(psVar10,uVar12);
}
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) = *GHIDRA_CAST<uint32_t *>(psVar7->_buf);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x4))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 4));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x8))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 8));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0xc))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 0xc));
contentPath._size = psVar7->_size;
contentPath._capacity = psVar7->_capacity;
psVar7->_size = 0;
psVar7->_capacity = 0xf;
psVar7->_buf[0] = '\0';
}
(GHIDRA_CAST<msvc::string *>((local_84._buf)))->msvc::string::_Tidy_deallocate();
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
if (0xf < local_54._capacity) {
uVar12 = local_54._capacity + 1;
pvVar9 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)local_54._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar9 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + -4);
uVar12 = local_54._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar9))))) goto LAB_008f46dd;
}
operator_delete(pvVar9,uVar12);
}
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
pbVar6 = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(psVar7));
if (pbVar6 != GHIDRA_CAST<uint8_t *>(0x0)) {
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0x13;
tracked_alloc(1,pbVar6,0);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
(GHIDRA_CAST<ItemConfig *>((&g_manager->_itemConfig)))->ItemConfig::load_recipes_xml(GHIDRA_CAST<uint8_t *>(psVar7),(void *)*modSlot);
}
pvVar9 = (void *)*modSlot;
local_54._size = 0;
local_54._capacity = 0xf;
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) = (*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) & 0xffffffff00000000;
(GHIDRA_CAST<msvc::string *>((local_54._buf)))->msvc::string::assign(GHIDRA_CAST<uint8_t *>("bombcostumes.xml"),0x10);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0x14;
psVar7 = (GHIDRA_CAST<Mod *>((pvVar9)))->Mod::GetContentPath(&local_84,&local_54);
if (&contentPath != psVar7) {
if (0xf < contentPath._capacity) {
uVar12 = contentPath._capacity + 1;
psVar10 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
if (0xfff < uVar12) {
psVar10 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + -0x18)))->_capacity);
uVar12 = contentPath._capacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar10)))))
goto LAB_008f46dd;
}
operator_delete(psVar10,uVar12);
}
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) = *GHIDRA_CAST<uint32_t *>(psVar7->_buf);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x4))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 4));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x8))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 8));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0xc))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 0xc));
contentPath._size = psVar7->_size;
contentPath._capacity = psVar7->_capacity;
psVar7->_size = 0;
psVar7->_capacity = 0xf;
psVar7->_buf[0] = '\0';
}
(GHIDRA_CAST<msvc::string *>((local_84._buf)))->msvc::string::_Tidy_deallocate();
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
if (0xf < local_54._capacity) {
uVar12 = local_54._capacity + 1;
pvVar9 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)local_54._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar9 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + -4);
uVar12 = local_54._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar9))))) goto LAB_008f46dd;
}
operator_delete(pvVar9,uVar12);
}
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
pbVar6 = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(psVar7));
if (pbVar6 != GHIDRA_CAST<uint8_t *>(0x0)) {
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0x15;
tracked_alloc(1,pbVar6,0);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
(GHIDRA_CAST<ItemConfig *>((&g_manager->_itemConfig)))->ItemConfig::LoadBombCostumes(GHIDRA_CAST<uint8_t *>(psVar7),1);
}
pvVar9 = (void *)*modSlot;
local_54._size = 0;
local_54._capacity = 0xf;
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) = (*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) & 0xffffffff00000000;
(GHIDRA_CAST<msvc::string *>((local_54._buf)))->msvc::string::assign(GHIDRA_CAST<uint8_t *>("challenges.xml"),0xe);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0x16;
psVar7 = (GHIDRA_CAST<Mod *>((pvVar9)))->Mod::GetContentPath(&local_84,&local_54);
if (&contentPath != psVar7) {
if (0xf < contentPath._capacity) {
uVar12 = contentPath._capacity + 1;
psVar10 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
if (0xfff < uVar12) {
psVar10 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + -0x18)))->_capacity);
uVar12 = contentPath._capacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar10)))))
goto LAB_008f46dd;
}
operator_delete(psVar10,uVar12);
}
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) = *GHIDRA_CAST<uint32_t *>(psVar7->_buf);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x4))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 4));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x8))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 8));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0xc))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 0xc));
contentPath._size = psVar7->_size;
contentPath._capacity = psVar7->_capacity;
psVar7->_size = 0;
psVar7->_capacity = 0xf;
psVar7->_buf[0] = '\0';
}
(GHIDRA_CAST<msvc::string *>((local_84._buf)))->msvc::string::_Tidy_deallocate();
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
if (0xf < local_54._capacity) {
uVar12 = local_54._capacity + 1;
pvVar9 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)local_54._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar9 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + -4);
uVar12 = local_54._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar9))))) goto LAB_008f46dd;
}
operator_delete(pvVar9,uVar12);
}
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
pbVar6 = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(psVar7));
if (pbVar6 != GHIDRA_CAST<uint8_t *>(0x0)) {
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0x17;
tracked_alloc(1,pbVar6,0);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
challenges_xml_load(g_manager,GHIDRA_CAST<uint8_t *>(psVar7),1);
}
pvVar9 = (void *)*modSlot;
local_54._size = 0;
local_54._capacity = 0xf;
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) = (*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) & 0xffffffff00000000;
(GHIDRA_CAST<msvc::string *>((local_54._buf)))->msvc::string::assign(GHIDRA_CAST<uint8_t *>("players.xml"),0xb);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0x18;
psVar7 = (GHIDRA_CAST<Mod *>((pvVar9)))->Mod::GetContentPath(&local_84,&local_54);
if (&contentPath != psVar7) {
if (0xf < contentPath._capacity) {
uVar12 = contentPath._capacity + 1;
psVar10 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
if (0xfff < uVar12) {
psVar10 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + -0x18)))->_capacity);
uVar12 = contentPath._capacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar10)))))
goto LAB_008f46dd;
}
operator_delete(psVar10,uVar12);
}
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) = *GHIDRA_CAST<uint32_t *>(psVar7->_buf);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x4))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 4));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x8))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 8));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0xc))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 0xc));
contentPath._size = psVar7->_size;
contentPath._capacity = psVar7->_capacity;
psVar7->_size = 0;
psVar7->_capacity = 0xf;
psVar7->_buf[0] = '\0';
}
(GHIDRA_CAST<msvc::string *>((local_84._buf)))->msvc::string::_Tidy_deallocate();
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
if (0xf < local_54._capacity) {
uVar12 = local_54._capacity + 1;
pvVar9 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)local_54._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar9 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + -4);
uVar12 = local_54._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar9))))) goto LAB_008f46dd;
}
operator_delete(pvVar9,uVar12);
}
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
pbVar6 = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(psVar7));
if (pbVar6 != GHIDRA_CAST<uint8_t *>(0x0)) {
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0x19;
tracked_alloc(1,pbVar6,0);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
(GHIDRA_CAST<EntityConfig *>((&g_manager->_entityConfig)))->EntityConfig::load_players_xml(GHIDRA_CAST<uint8_t *>(psVar7),(void *)*modSlot);
}
pvVar9 = (void *)*modSlot;
local_54._size = 0;
local_54._capacity = 0xf;
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) = (*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) & 0xffffffff00000000;
(GHIDRA_CAST<msvc::string *>((local_54._buf)))->msvc::string::assign(GHIDRA_CAST<uint8_t *>("sounds.xml"),10);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0x1a;
psVar7 = (GHIDRA_CAST<Mod *>((pvVar9)))->Mod::GetContentPath(&local_84,&local_54);
if (&contentPath != psVar7) {
if (0xf < contentPath._capacity) {
uVar12 = contentPath._capacity + 1;
psVar10 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
if (0xfff < uVar12) {
psVar10 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + -0x18)))->_capacity);
uVar12 = contentPath._capacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar10)))))
goto LAB_008f46dd;
}
operator_delete(psVar10,uVar12);
}
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) = *GHIDRA_CAST<uint32_t *>(psVar7->_buf);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x4))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 4));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x8))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 8));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0xc))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 0xc));
contentPath._size = psVar7->_size;
contentPath._capacity = psVar7->_capacity;
psVar7->_size = 0;
psVar7->_capacity = 0xf;
psVar7->_buf[0] = '\0';
}
(GHIDRA_CAST<msvc::string *>((local_84._buf)))->msvc::string::_Tidy_deallocate();
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
if (0xf < local_54._capacity) {
uVar12 = local_54._capacity + 1;
pvVar9 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)local_54._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar9 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + -4);
uVar12 = local_54._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar9))))) goto LAB_008f46dd;
}
operator_delete(pvVar9,uVar12);
}
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
pbVar6 = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(psVar7));
if (pbVar6 != GHIDRA_CAST<uint8_t *>(0x0)) {
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0x1b;
tracked_alloc(1,pbVar6,0);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
(GHIDRA_CAST<SFXManager *>((&g_manager->_sfxManager)))->SFXManager::load_xml(GHIDRA_CAST<uint8_t *>(psVar7),1);
}
pvVar9 = (void *)*modSlot;
local_54._size = 0;
local_54._capacity = 0xf;
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) = (*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) & 0xffffffff00000000;
(GHIDRA_CAST<msvc::string *>((local_54._buf)))->msvc::string::assign(GHIDRA_CAST<uint8_t *>("music.xml"),9);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0x1c;
psVar7 = (GHIDRA_CAST<Mod *>((pvVar9)))->Mod::GetContentPath(&local_84,&local_54);
if (&contentPath != psVar7) {
if (0xf < contentPath._capacity) {
uVar12 = contentPath._capacity + 1;
psVar10 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
if (0xfff < uVar12) {
psVar10 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + -0x18)))->_capacity);
uVar12 = contentPath._capacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar10)))))
goto LAB_008f46dd;
}
operator_delete(psVar10,uVar12);
}
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) = *GHIDRA_CAST<uint32_t *>(psVar7->_buf);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x4))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 4));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x8))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 8));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0xc))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 0xc));
contentPath._size = psVar7->_size;
contentPath._capacity = psVar7->_capacity;
psVar7->_size = 0;
psVar7->_capacity = 0xf;
psVar7->_buf[0] = '\0';
}
(GHIDRA_CAST<msvc::string *>((local_84._buf)))->msvc::string::_Tidy_deallocate();
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
if (0xf < local_54._capacity) {
uVar12 = local_54._capacity + 1;
pvVar9 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)local_54._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar9 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + -4);
uVar12 = local_54._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar9))))) goto LAB_008f46dd;
}
operator_delete(pvVar9,uVar12);
}
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
isFileFound = file_exists(GHIDRA_CAST<uint8_t *>(psVar7));
if (isFileFound != 0) {
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
(GHIDRA_CAST<Music *>((GHIDRA_CAST<Music *>(&g_manager->_musicManager))))->Music::LoadConfig(GHIDRA_CAST<uint8_t *>(psVar7),1);
}
pvVar9 = (void *)*modSlot;
local_54._size = 0;
local_54._capacity = 0xf;
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) = (*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) & 0xffffffff00000000;
(GHIDRA_CAST<msvc::string *>((local_54._buf)))->msvc::string::assign(GHIDRA_CAST<uint8_t *>("nightmares.xml"),0xe);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0x1d;
psVar7 = (GHIDRA_CAST<Mod *>((pvVar9)))->Mod::GetContentPath(&local_84,&local_54);
if (&contentPath != psVar7) {
if (0xf < contentPath._capacity) {
uVar12 = contentPath._capacity + 1;
psVar10 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
if (0xfff < uVar12) {
psVar10 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + -0x18)))->_capacity);
uVar12 = contentPath._capacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar10)))))
goto LAB_008f46dd;
}
operator_delete(psVar10,uVar12);
}
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) = *GHIDRA_CAST<uint32_t *>(psVar7->_buf);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x4))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 4));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x8))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 8));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0xc))) = *GHIDRA_CAST<uint32_t *>((psVar7->_buf + 0xc));
contentPath._size = psVar7->_size;
contentPath._capacity = psVar7->_capacity;
psVar7->_size = 0;
psVar7->_capacity = 0xf;
psVar7->_buf[0] = '\0';
}
(GHIDRA_CAST<msvc::string *>((local_84._buf)))->msvc::string::_Tidy_deallocate();
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
if (0xf < local_54._capacity) {
uVar12 = local_54._capacity + 1;
pvVar9 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)local_54._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar9 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + -4);
uVar12 = local_54._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar9))))) goto LAB_008f46dd;
}
operator_delete(pvVar9,uVar12);
}
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
isFileFound = file_exists(GHIDRA_CAST<uint8_t *>(psVar7));
if (isFileFound != 0) {
psVar7 = &contentPath;
if (0xf < contentPath._capacity) {
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
}
(GHIDRA_CAST<NightmareScene *>((&g_manager->_nightmareScene)))->NightmareScene::load_nightmares_xml(GHIDRA_CAST<uint8_t *>(psVar7));
}
pbVar6 = GHIDRA_CAST<uint8_t *>(*modSlot);
local_54._size = 0;
local_54._capacity = 0xf;
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) = (*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) & 0xffffffff00000000;
pbVar4 = g_modsDirectory;
do {
pbVar11 = pbVar4;
pbVar4 = pbVar11 + 1;
} while (*pbVar11 != 0);
(GHIDRA_CAST<msvc::string *>((local_54._buf)))->msvc::string::assign(g_modsDirectory,GHIDRA_UINT((pbVar11 + -0xc72e28)));
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0x1e;
dirNameSize = GHIDRA_CAST<uint32_t *>((pbVar6 + 0x10));
if (0xf < *GHIDRA_CAST<uint32_t *>((pbVar6 + 0x14))) {
pbVar6 = *GHIDRA_CAST<uint8_t **>(pbVar6);
}
pvVar9 = (GHIDRA_CAST<msvc::string *>((local_54._buf)))->msvc::string::append(pbVar6,*dirNameSize);
FUN_00417100(pvVar9);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0x1f;
pvVar9 = (GHIDRA_CAST<msvc::string *>((local_84._buf)))->msvc::string::append(GHIDRA_CAST<uint8_t *>("/main.lua"),9);
FUN_00417100(pvVar9);
if (0xf < contentPath._capacity) {
uVar12 = contentPath._capacity + 1;
psVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(contentPath._buf))) + 0x0)));
if (0xfff < uVar12) {
psVar7 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + -0x18)))->_capacity);
uVar12 = contentPath._capacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contentPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar7)))))
goto LAB_008f46dd;
}
operator_delete(psVar7,uVar12);
}
uVar2 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0)));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0))) & 0xffffff00;
uVar3 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0)));
pathTmp._buf[0] = (char)uVar2;
pathTmp._buf[1] = SUB41(uVar2,1);
pathTmp._buf[2] = SUB41(uVar2,2);
pathTmp._buf[3] = SUB41(uVar2,3);
contentPath._buf[0] = pathTmp._buf[0];
contentPath._buf[1] = pathTmp._buf[1];
contentPath._buf[2] = pathTmp._buf[2];
contentPath._buf[3] = pathTmp._buf[3];
contentPath._buf[4] = pathTmp._buf[4];
contentPath._buf[5] = pathTmp._buf[5];
contentPath._buf[6] = pathTmp._buf[6];
contentPath._buf[7] = pathTmp._buf[7];
contentPath._buf[8] = pathTmp._buf[8];
contentPath._buf[9] = pathTmp._buf[9];
contentPath._buf[10] = pathTmp._buf[10];
contentPath._buf[0xb] = pathTmp._buf[0xb];
contentPath._buf[0xc] = pathTmp._buf[0xc];
contentPath._buf[0xd] = pathTmp._buf[0xd];
contentPath._buf[0xe] = pathTmp._buf[0xe];
contentPath._buf[0xf] = pathTmp._buf[0xf];
contentPath._capacity = pathTmp._capacity;
contentPath._size = pathTmp._size;
pathTmp._size = 0;
pathTmp._capacity = 0xf;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(pathTmp._buf)) + 0x0))) = uVar3;
(GHIDRA_CAST<msvc::string *>((pathTmp._buf)))->msvc::string::_Tidy_deallocate();
(GHIDRA_CAST<msvc::string *>((local_84._buf)))->msvc::string::_Tidy_deallocate();
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
if (0xf < local_54._capacity) {
uVar12 = local_54._capacity + 1;
pvVar9 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)local_54._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar9 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + -4);
uVar12 = local_54._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar9))))) {
LAB_008f46dd:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pvVar9,uVar12);
}
pbVar6 = (GHIDRA_CAST<msvc::string *>((contentPath._buf)))->msvc::string::c_str();
isFileFound = file_exists(pbVar6);
if (isFileFound != 0) {
DAT_00c71698 = *modSlot;
pbVar6 = (GHIDRA_CAST<msvc::string *>((contentPath._buf)))->msvc::string::c_str();
FUN_0086e6c0(pbVar6);
DAT_00c71698 = 0;
}
local_14 = 0xffffffff;
(GHIDRA_CAST<msvc::string *>((contentPath._buf)))->msvc::string::_Tidy_deallocate();
}
modSlot = modSlot + 1;
pcVar8 = pcStack_20;
} while (modSlot != *GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1)))));
}
pcStack_20 = pcVar8;
(GHIDRA_CAST<Menu_Mods *>((GHIDRA_CAST<Menu_Mods *>(&g_manager->_entityConfig))))->Menu_Mods::Update();
(GHIDRA_CAST<msvc::string *>((local_84._buf)))->msvc::string::string_from_cstr(GHIDRA_CAST<uint8_t *>("gfx/ui/mod_defaults.anm2"));
local_14 = 0x20;
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((this + 0xab18)))))->ANM2::Load(&local_84,1);
(GHIDRA_CAST<msvc::string *>((local_84._buf)))->msvc::string::_Tidy_deallocate();
ExceptionList = local_1c;
return;
}
// 008f46f0
void ModManager::LoadModItemPools()
{
uint8_t *resolvedPath;
std_string *psVar1;
void *resolvedPath;
uint32_t uVar2;
uint32_t *modSlot;
std_string *contentPath [5];
uint32_t contentPathCapacity;
std_string fileName;
uint32_t local_14;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
puStack_c = &LAB_00b07785;
local_10 = ExceptionList;
local_14 = __security_cookie ^ GHIDRA_UINT(&(&fileName)[1]._size);
ExceptionList = &local_10;
if ((g_game != GHIDRA_CAST<Game *>(0x0)) &&
(modSlot = *GHIDRA_CAST<uint32_t **>(this), modSlot != *GHIDRA_CAST<uint32_t **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1)))))) {
do {
if (*GHIDRA_CAST<char *>((GHIDRA_INT(*modSlot) + 0xfd)) != '\0') {
builtin_strncpy(fileName._buf + 8,"s.xml",6);
fileName._capacity = 0xf;
fileName._size = 0xd;
builtin_strncpy(fileName._buf,"itempool",8);
local_8 = 0;
(GHIDRA_CAST<Mod *>(((void *)*modSlot)))->Mod::GetContentPath(GHIDRA_CAST<std_string *>(contentPath),&fileName);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 2;
if (0xf < fileName._capacity) {
uVar2 = fileName._capacity + 1;
resolvedPath = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)fileName._buf)) + 0x0)));
if (0xfff < uVar2) {
resolvedPath = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(fileName._buf)) + 0x0))) + -4);
uVar2 = fileName._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(fileName._buf)) + 0x0))) + (-4 - GHIDRA_INT(resolvedPath))))) goto LAB_008f4883;
}
operator_delete(resolvedPath,uVar2);
}
psVar1 = GHIDRA_CAST<std_string *>(contentPath);
if (0xf < contentPathCapacity) {
psVar1 = contentPath[0];
}
resolvedPath = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(psVar1));
if (resolvedPath != GHIDRA_CAST<uint8_t *>(0x0)) {
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 3;
tracked_alloc(1,resolvedPath,0);
local_8 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),2);
psVar1 = GHIDRA_CAST<std_string *>(contentPath);
if (0xf < contentPathCapacity) {
psVar1 = contentPath[0];
}
(GHIDRA_CAST<ItemPool *>((&g_game->_itemPool)))->ItemPool::load_pools(GHIDRA_CAST<uint8_t *>(psVar1),1);
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 0xff;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))) = 0xffffff;
if (0xf < contentPathCapacity) {
uVar2 = contentPathCapacity + 1;
psVar1 = contentPath[0];
if (0xfff < uVar2) {
psVar1 = GHIDRA_CAST<std_string *>(contentPath[0][-1]._capacity);
uVar2 = contentPathCapacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(contentPath[0]) + (-4 - GHIDRA_INT(psVar1))))) {
LAB_008f4883:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(psVar1,uVar2);
}
}
modSlot = modSlot + 1;
} while (modSlot != *GHIDRA_CAST<uint32_t **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1)))));
}
ExceptionList = local_10;
return;
}
// 008f4890
void ModManager::LoadModBossPools()
{
uint8_t *resolvedPath;
std_string *psVar1;
int *in_ECX;
void *allocBase;
uint32_t allocSize;
uint32_t *modSlot;
std_string *contentPath [5];
uint32_t contentPathCapacity;
std_string fileName;
uint32_t local_14;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
puStack_c = &LAB_00b07785;
local_10 = ExceptionList;
local_14 = __security_cookie ^ GHIDRA_UINT(&(&fileName)[1]._size);
ExceptionList = &local_10;
if ((g_game != GHIDRA_CAST<Game *>(0x0)) &&
(modSlot = GHIDRA_CAST<uint32_t *>(*in_ECX), modSlot != GHIDRA_CAST<uint32_t *>(in_ECX[1]))) {
do {
if (*GHIDRA_CAST<char *>((GHIDRA_INT(*modSlot) + 0xfd)) != '\0') {
builtin_strncpy(fileName._buf + 8,"s.xml",6);
fileName._capacity = 0xf;
fileName._size = 0xd;
builtin_strncpy(fileName._buf,"bosspool",8);
local_8 = 0;
(GHIDRA_CAST<Mod *>(((void *)*modSlot)))->Mod::GetContentPath(GHIDRA_CAST<std_string *>(contentPath),&fileName);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 2;
if (0xf < fileName._capacity) {
allocSize = fileName._capacity + 1;
allocBase = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)fileName._buf)) + 0x0)));
if (0xfff < allocSize) {
allocBase = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(fileName._buf)) + 0x0))) + -4);
allocSize = fileName._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(fileName._buf)) + 0x0))) + (-4 - GHIDRA_INT(allocBase))))) goto LAB_008f4a23;
}
operator_delete(allocBase,allocSize);
}
psVar1 = GHIDRA_CAST<std_string *>(contentPath);
if (0xf < contentPathCapacity) {
psVar1 = contentPath[0];
}
resolvedPath = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(psVar1));
if (resolvedPath != GHIDRA_CAST<uint8_t *>(0x0)) {
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 3;
tracked_alloc(1,resolvedPath,0);
local_8 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),2);
psVar1 = GHIDRA_CAST<std_string *>(contentPath);
if (0xf < contentPathCapacity) {
psVar1 = contentPath[0];
}
BossPool::load_xml(psVar1,*modSlot);
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 0xff;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))) = 0xffffff;
if (0xf < contentPathCapacity) {
allocSize = contentPathCapacity + 1;
psVar1 = contentPath[0];
if (0xfff < allocSize) {
psVar1 = GHIDRA_CAST<std_string *>(contentPath[0][-1]._capacity);
allocSize = contentPathCapacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(contentPath[0]) + (-4 - GHIDRA_INT(psVar1))))) {
LAB_008f4a23:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(psVar1,allocSize);
}
}
modSlot = modSlot + 1;
} while (modSlot != GHIDRA_CAST<uint32_t *>(in_ECX[1]));
}
ExceptionList = local_10;
return;
}
// 008f4a30
void ModManager::LoadShaders()
{
char cVar1;
int iVar2;
int iVar3;
uint64_t uVar4;
uint32_t uVar5;
uint8_t *pbVar6;
std_string *pathCStr;
int iVar7;
void *pvVar8;
int *piVar9;
uint32_t *puVar10;
int *piVar11;
uint32_t uVar12;
uint64_t *allocCounter;
uint8_t *childNode;
uint8_t *pbVar13;
char *pcVar14;
int *curModIt;
bool isLess;
char *pcVar15;
uint8_t bVar16;
std_string *vertexSource;
uint32_t uStack_10124;
std_string *fragmentSource;
uint32_t uStack_1011c;
int *modIt;
uint8_t *fileBuffer;
uint32_t cleanupFlags;
std_string *psStack_1010c;
uint64_t uStack_10108;
int *piStack_100fc;
uint8_t *shaderEntry;
uint8_t *pbStack_100f4;
uint8_t *pbStack_100f0;
uint8_t bStack_100e9;
uint8_t xmlDoc [48];
uint8_t auStack_100b8 [65560];
uint32_t local_a0;
char acStack_9c [4];
char acStack_98 [4];
char acStack_94 [4];
uint32_t uStack_90;
uint32_t uStack_8c;
std_string configPath;
std_string vertexText;
std_string fragmentText;
std_string tmpString;
uint32_t stackCookie;
std_string **ppsStack_20;
void *local_1c;
uint8_t *puStack_18;
uint32_t local_14;
uint64_t allocatedBytes;
int64_t attribArrayBytes;
ppsStack_20 = GHIDRA_CAST<std_string **>((GHIDRA_INT(&configPath) + 0x80));
puStack_18 = &LAB_00b0783f;
local_1c = ExceptionList;
stackCookie = __security_cookie ^ GHIDRA_INT(&configPath) + 0x74U;
ExceptionList = &local_1c;
modIt = *GHIDRA_CAST<int **>(this);
cleanupFlags = 0;
if (modIt != *GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1))))) {
do {
curModIt = modIt;
if (*GHIDRA_CAST<char *>((*modIt + 0xfd)) != '\0') {
builtin_strncpy(tmpString._buf + 8,"xml",4);
tmpString._capacity = 0xf;
tmpString._size = 0xb;
builtin_strncpy(tmpString._buf,"shaders.",8);
local_14 = 0;
(GHIDRA_CAST<Mod *>(((void *)*modIt)))->Mod::GetContentPath(&configPath,&tmpString);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
if (0xf < tmpString._capacity) {
uVar12 = tmpString._capacity + 1;
pvVar8 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)tmpString._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar8 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString._buf)) + 0x0))) + -4);
uVar12 = tmpString._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar8))))) {
LAB_008f5943:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pvVar8,uVar12);
}
pathCStr = &configPath;
if (0xf < configPath._capacity) {
pathCStr = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(configPath._buf))) + 0x0)));
}
pbVar6 = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(pathCStr));
bStack_100e9 = pbVar6 != GHIDRA_CAST<uint8_t *>(0x0);
if (pbVar6 != GHIDRA_CAST<uint8_t *>(0x0)) {
if (g_mainHeap == (void *)0x0) {
allocCounter = &g_allocatedBytesNoHeap;
}
else {
allocCounter = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar12 = *GHIDRA_CAST<uint32_t *>((pbVar6 + -4));
allocatedBytes = *allocCounter;
*GHIDRA_CAST<uint32_t *>(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar12;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocCounter) + 4)) =
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBytes) < uVar12));
free(pbVar6 + -4);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
}
if (bStack_100e9 != 0) {
pathCStr = &configPath;
if (0xf < configPath._capacity) {
pathCStr = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(configPath._buf))) + 0x0)));
}
piStack_100fc = (GHIDRA_CAST<FileSystem *>((&PTR_vftable_00c37a10)))->FileSystem::Open(GHIDRA_CAST<uint8_t *>(pathCStr),GHIDRA_CAST<int *>(0x0));
if (piStack_100fc == GHIDRA_CAST<int *>(0x0)) {
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("[warn] Failed to open shader config file %s\n"));
}
else {
iVar7 = (**(code **)(*piStack_100fc + 4))();
fileBuffer = operator_new_tracked(iVar7 + 1);
(**(code **)(*piStack_100fc + 0x14))(fileBuffer,1,iVar7);
fileBuffer[iVar7] = 0;
(**(code **)*piStack_100fc)(1);
FUN_00413b90();
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 4;
pcVar15 = GHIDRA_CAST<char *>(0x8f4c1d);
pbVar6 = fileBuffer;
(GHIDRA_CAST<rapidxml::xml_document *>((xmlDoc)))->rapidxml::xml_document::parse(fileBuffer);
bVar16 = (uint8_t)pbVar6;
pvVar8 = (GHIDRA_CAST<xml_node *>((xmlDoc)))->xml_node::first_node(GHIDRA_CAST<uint8_t *>("shaders"),GHIDRA_INT(pcVar15),bVar16);
if (pvVar8 == (void *)0x0) {
piVar9 = GHIDRA_CAST<int *>(*curModIt);
if (0xf < GHIDRA_UINT(piVar9[5])) {
piVar9 = GHIDRA_CAST<int *>(*piVar9);
}
bVar16 = (uint8_t)piVar9;
pcVar15 = "Could not find root node \'shaders\' in mod %s\n";
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("Could not find root node \'shaders\' in mod %s\n"));
}
for (piStack_100fc = (GHIDRA_CAST<xml_node *>((pvVar8)))->xml_node::first_node(GHIDRA_CAST<uint8_t *>("shader"),GHIDRA_INT(pcVar15),bVar16);
piStack_100fc != GHIDRA_CAST<int *>(0x0); piStack_100fc = GHIDRA_CAST<int *>(piStack_100fc[0xb])) {
pbVar6 = operator_new(0x80);
if (pbVar6 == GHIDRA_CAST<uint8_t *>(0x0)) {
shaderEntry = GHIDRA_CAST<uint8_t *>(0x0);
}
else {
shaderEntry = pbVar6;
memset(pbVar6,0,0x80);
pbVar6[0] = 0;
pbVar6[1] = 0;
pbVar6[2] = 0;
pbVar6[3] = 0;
pbVar6[0x10] = 0;
pbVar6[0x11] = 0;
pbVar6[0x12] = 0;
pbVar6[0x13] = 0;
pbVar6[0x14] = 0xf;
pbVar6[0x15] = 0;
pbVar6[0x16] = 0;
pbVar6[0x17] = 0;
*pbVar6 = 0;
FUN_00a245b0();
pbVar6[0x68] = 0;
pbVar6[0x69] = 0;
pbVar6[0x6a] = 0;
pbVar6[0x6b] = 0;
pbVar6[0x6c] = 0;
pbVar6[0x6d] = 0;
pbVar6[0x6e] = 0;
pbVar6[0x6f] = 0;
pbVar13 = pbVar6 + 0x70;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 8;
uStack_10108 = CONCAT44(pbVar13,(uint32_t)uStack_10108);
pbVar13[0] = 0;
pbVar13[1] = 0;
pbVar13[2] = 0;
pbVar13[3] = 0;
pbVar6[0x74] = 0;
pbVar6[0x75] = 0;
pbVar6[0x76] = 0;
pbVar6[0x77] = 0;
pvVar8 = operator_new(0x2c);
*(void **)pvVar8 = pvVar8;
*(void **)(GHIDRA_CAST<char *>(pvVar8) + 4) = pvVar8;
*(void **)(GHIDRA_CAST<char *>(pvVar8) + 8) = pvVar8;
*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(pvVar8) + 0xc)) = 0x101;
*(void **)pbVar13 = pvVar8;
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 4;
pbVar6 = s_name;
do {
pbStack_100f4 = pbVar6;
pbVar6 = pbStack_100f4 + 1;
} while (*pbVar6 != 0);
pbStack_100f4 = pbStack_100f4 + -0xb1c13b;
for (pbStack_100f0 = GHIDRA_CAST<uint8_t *>(piStack_100fc[8]); pbStack_100f0 != GHIDRA_CAST<uint8_t *>(0x0);
pbStack_100f0 = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pbStack_100f0) + 0x18))) {
pbVar6 = *GHIDRA_CAST<uint8_t **>(pbStack_100f0);
if (pbVar6 == GHIDRA_CAST<uint8_t *>(0x0)) {
pbVar13 = GHIDRA_CAST<uint8_t *>(0x0);
pbVar6 = &g_xmlNullStr;
}
else {
pbVar13 = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pbStack_100f0) + 8));
}
if (pbVar13 == pbStack_100f4) {
pbVar13 = pbVar13 + GHIDRA_INT(pbVar6);
puVar10 = GHIDRA_CAST<uint32_t *>(pbStack_100f0);
if (pbVar13 <= pbVar6) goto LAB_008f4d93;
iVar7 = GHIDRA_INT(s_name) - GHIDRA_INT(pbVar6);
while (*pbVar6 == pbVar6[iVar7]) {
pbVar6 = pbVar6 + 1;
if (pbVar13 <= pbVar6) goto LAB_008f4d93;
}
}
}
puVar10 = GHIDRA_CAST<uint32_t *>(0x0);
LAB_008f4d93:
pbVar6 = &g_xmlNullStr;
if (GHIDRA_CAST<uint8_t *>(puVar10[1]) != GHIDRA_CAST<uint8_t *>(0x0)) {
pbVar6 = GHIDRA_CAST<uint8_t *>(puVar10[1]);
}
pbVar13 = pbVar6;
do {
bVar16 = *pbVar13;
pbVar13 = pbVar13 + 1;
} while (bVar16 != 0);
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(shaderEntry))))->msvc::string::assign(pbVar6,GHIDRA_INT(pbVar13) - GHIDRA_INT((pbVar6 + 1)));
pcVar15 = "parameters";
do {
pcVar14 = pcVar15;
pcVar15 = pcVar14 + 1;
} while (*pcVar15 != '\0');
pbStack_100f0 = GHIDRA_CAST<uint8_t *>(piStack_100fc[6]);
if (pbStack_100f0 != GHIDRA_CAST<uint8_t *>(0x0)) {
LAB_008f4df0:
pbVar6 = *GHIDRA_CAST<uint8_t **>(pbStack_100f0);
if (pbVar6 == GHIDRA_CAST<uint8_t *>(0x0)) {
pcVar15 = GHIDRA_CAST<char *>(0x0);
pbVar6 = &g_xmlNullStr;
}
else {
pcVar15 = *GHIDRA_CAST<char **>((GHIDRA_CAST<char *>(pbStack_100f0) + 8));
}
if (pcVar15 != pcVar14 + -0xb76d4b) goto LAB_008f4e81;
pbVar13 = GHIDRA_CAST<uint8_t *>((pcVar15 + GHIDRA_INT(pbVar6)));
if (pbVar6 < pbVar13) {
iVar7 = GHIDRA_INT("parameters") - GHIDRA_INT(pbVar6);
while (*pbVar6 == pbVar6[iVar7]) {
pbVar6 = pbVar6 + 1;
if (pbVar13 <= pbVar6) goto LAB_008f4e26;
}
goto LAB_008f4e81;
}
LAB_008f4e26:
shaderEntry[0x78] = 0;
shaderEntry[0x79] = 0;
shaderEntry[0x7a] = 0;
shaderEntry[0x7b] = 0;
if (pbStack_100f0 != GHIDRA_CAST<uint8_t *>(0x0)) {
pcVar15 = "param";
do {
pcVar14 = pcVar15;
pcVar15 = pcVar14 + 1;
} while (*pcVar15 != '\0');
for (pbStack_100f4 = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pbStack_100f0) + 0x18));
pbStack_100f4 != GHIDRA_CAST<uint8_t *>(0x0); pbStack_100f4 = *GHIDRA_CAST<uint8_t **>((pbStack_100f4 + 0x2c))
) {
pbVar6 = *GHIDRA_CAST<uint8_t **>(pbStack_100f4);
if (pbVar6 == GHIDRA_CAST<uint8_t *>(0x0)) {
pcVar15 = GHIDRA_CAST<char *>(0x0);
pbVar6 = &g_xmlNullStr;
}
else {
pcVar15 = *GHIDRA_CAST<char **>((pbStack_100f4 + 8));
}
if (pcVar15 == pcVar14 + -0xb76d43) {
pbVar13 = GHIDRA_CAST<uint8_t *>((pcVar15 + GHIDRA_INT(pbVar6)));
if (pbVar13 <= pbVar6) goto joined_r0x008f4f6b;
iVar7 = GHIDRA_INT("param") - GHIDRA_INT(pbVar6);
while (*pbVar6 == pbVar6[iVar7]) {
pbVar6 = pbVar6 + 1;
if (pbVar13 <= pbVar6) goto joined_r0x008f4f6b;
}
}
}
pbStack_100f4 = GHIDRA_CAST<uint8_t *>(0x0);
joined_r0x008f4f6b:
do {
if (pbStack_100f4 == GHIDRA_CAST<uint8_t *>(0x0)) break;
pbVar6 = s_name;
do {
pbVar13 = pbVar6;
pbVar6 = pbVar13 + 1;
} while (*pbVar6 != 0);
psStack_1010c = GHIDRA_CAST<std_string *>((pbVar13 + -0xb1c13b));
for (pbStack_100f0 = *GHIDRA_CAST<uint8_t **>((pbStack_100f4 + 0x20));
pbStack_100f0 != GHIDRA_CAST<uint8_t *>(0x0);
pbStack_100f0 = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pbStack_100f0) + 0x18))) {
pbVar6 = *GHIDRA_CAST<uint8_t **>(pbStack_100f0);
if (pbVar6 == GHIDRA_CAST<uint8_t *>(0x0)) {
pbVar13 = GHIDRA_CAST<uint8_t *>(0x0);
pbVar6 = &g_xmlNullStr;
}
else {
pbVar13 = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pbStack_100f0) + 8));
}
if (GHIDRA_CAST<std_string *>(pbVar13) == psStack_1010c) {
pbVar13 = pbVar13 + GHIDRA_INT(pbVar6);
puVar10 = GHIDRA_CAST<uint32_t *>(pbStack_100f0);
if (pbVar13 <= pbVar6) goto LAB_008f4fef;
iVar7 = GHIDRA_INT(s_name) - GHIDRA_INT(pbVar6);
while (*pbVar6 == pbVar6[iVar7]) {
pbVar6 = pbVar6 + 1;
if (pbVar13 <= pbVar6) goto LAB_008f4fef;
}
}
}
puVar10 = GHIDRA_CAST<uint32_t *>(0x0);
LAB_008f4fef:
tmpString._size = 0;
pbVar6 = &g_xmlNullStr;
if (GHIDRA_CAST<uint8_t *>(puVar10[1]) != GHIDRA_CAST<uint8_t *>(0x0)) {
pbVar6 = GHIDRA_CAST<uint8_t *>(puVar10[1]);
}
tmpString._capacity = 0xf;
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(tmpString._buf)) + 0x0))) = (*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(tmpString._buf)) + 0x0))) & 0xffffffff00000000;
pbVar13 = pbVar6;
do {
bVar16 = *pbVar13;
pbVar13 = pbVar13 + 1;
} while (bVar16 != 0);
(GHIDRA_CAST<msvc::string *>((tmpString._buf)))->msvc::string::assign(pbVar6,GHIDRA_INT(pbVar13) - GHIDRA_INT((pbVar6 + 1)));
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 9;
uStack_10108 = uStack_10108 & 0xffffffff;
uVar4 = uStack_10108;
pcVar15 = "type";
do {
pcVar14 = pcVar15;
pcVar15 = pcVar14 + 1;
} while (*pcVar15 != '\0');
psStack_1010c = GHIDRA_CAST<std_string *>((pcVar14 + -0xb69a0b));
for (puVar10 = *GHIDRA_CAST<uint32_t **>((pbStack_100f4 + 0x20));
puVar10 != GHIDRA_CAST<uint32_t *>(0x0); puVar10 = GHIDRA_CAST<uint32_t *>(puVar10[6])) {
pbVar6 = GHIDRA_CAST<uint8_t *>(*puVar10);
if (pbVar6 == GHIDRA_CAST<uint8_t *>(0x0)) {
pathCStr = GHIDRA_CAST<std_string *>(0x0);
pbVar6 = &g_xmlNullStr;
}
else {
pathCStr = GHIDRA_CAST<std_string *>(puVar10[2]);
}
if (pathCStr == psStack_1010c) {
pbVar13 = pbVar6 + GHIDRA_INT(pathCStr);
if (pbVar13 <= pbVar6) goto LAB_008f50c3;
iVar7 = GHIDRA_INT(&DAT_00b69a0c) - GHIDRA_INT(pbVar6);
while (*pbVar6 == pbVar6[iVar7]) {
pbVar6 = pbVar6 + 1;
if (pbVar13 <= pbVar6) goto LAB_008f50c3;
}
}
}
puVar10 = GHIDRA_CAST<uint32_t *>(0x0);
LAB_008f50c3:
pcVar15 = "float";
pbStack_100f0 = &g_xmlNullStr;
if (GHIDRA_CAST<uint8_t *>(puVar10[1]) != GHIDRA_CAST<uint8_t *>(0x0)) {
pbStack_100f0 = GHIDRA_CAST<uint8_t *>(puVar10[1]);
}
pbVar6 = pbStack_100f0;
do {
bStack_100e9 = *pbVar6;
isLess = bStack_100e9 < (uint8_t)*pcVar15;
if (bStack_100e9 != *pcVar15) {
LAB_008f5122:
uVar12 = -GHIDRA_UINT(isLess) | 1;
goto LAB_008f5127;
}
if (bStack_100e9 == 0) break;
bStack_100e9 = pbVar6[1];
isLess = bStack_100e9 < (uint8_t)pcVar15[1];
if (bStack_100e9 != pcVar15[1]) goto LAB_008f5122;
pbVar6 = pbVar6 + 2;
pcVar15 = pcVar15 + 2;
} while (bStack_100e9 != 0);
uVar12 = 0;
LAB_008f5127:
if (uVar12 == 0) {
iVar7 = 1;
}
else {
pbVar13 = &DAT_00b76d3c;
pbVar6 = pbStack_100f0;
do {
bStack_100e9 = *pbVar6;
isLess = bStack_100e9 < *pbVar13;
if (bStack_100e9 != *pbVar13) {
LAB_008f5182:
uVar12 = -GHIDRA_UINT(isLess) | 1;
goto LAB_008f5187;
}
if (bStack_100e9 == 0) break;
bStack_100e9 = pbVar6[1];
isLess = bStack_100e9 < pbVar13[1];
if (bStack_100e9 != pbVar13[1]) goto LAB_008f5182;
pbVar6 = pbVar6 + 2;
pbVar13 = pbVar13 + 2;
} while (bStack_100e9 != 0);
uVar12 = 0;
LAB_008f5187:
if (uVar12 == 0) {
iVar7 = 2;
}
else {
pbVar13 = &DAT_00b76d34;
pbVar6 = pbStack_100f0;
do {
bStack_100e9 = *pbVar6;
isLess = bStack_100e9 < *pbVar13;
if (bStack_100e9 != *pbVar13) {
LAB_008f51e2:
uVar12 = -GHIDRA_UINT(isLess) | 1;
goto LAB_008f51e7;
}
if (bStack_100e9 == 0) break;
bStack_100e9 = pbVar6[1];
isLess = bStack_100e9 < pbVar13[1];
if (bStack_100e9 != pbVar13[1]) goto LAB_008f51e2;
pbVar6 = pbVar6 + 2;
pbVar13 = pbVar13 + 2;
} while (bStack_100e9 != 0);
uVar12 = 0;
LAB_008f51e7:
if (uVar12 == 0) {
iVar7 = 3;
}
else {
pbVar13 = &DAT_00b76e54;
pbVar6 = pbStack_100f0;
do {
bVar16 = *pbVar6;
isLess = bVar16 < *pbVar13;
if (bVar16 != *pbVar13) {
LAB_008f5215:
uVar12 = -GHIDRA_UINT(isLess) | 1;
goto LAB_008f521a;
}
if (bVar16 == 0) break;
bVar16 = pbVar6[1];
isLess = bVar16 < pbVar13[1];
if (bVar16 != pbVar13[1]) goto LAB_008f5215;
pbVar6 = pbVar6 + 2;
pbVar13 = pbVar13 + 2;
} while (bVar16 != 0);
uVar12 = 0;
LAB_008f521a:
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(uStack_10108)) + 0x4))) = 0;
iVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(uStack_10108)) + 0x4)));
if (uVar12 == 0) {
iVar7 = 4;
}
}
}
}
uStack_10108 = uVar4;
piVar9 = GHIDRA_CAST<int *>(FUN_008fc6e0(&tmpString));
*piVar9 = iVar7;
*GHIDRA_CAST<int *>((shaderEntry + 0x78)) = *GHIDRA_CAST<int *>((shaderEntry + 0x78)) + iVar7;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 4;
if (0xf < tmpString._capacity) {
uVar12 = tmpString._capacity + 1;
pvVar8 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)tmpString._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar8 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString._buf)) + 0x0))) + -4);
uVar12 = tmpString._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar8)))))
goto LAB_008f5943;
}
operator_delete(pvVar8,uVar12);
}
pbStack_100f4 = *GHIDRA_CAST<uint8_t **>((pbStack_100f4 + 0x2c));
} while( true );
}
goto LAB_008f4e9f;
}
LAB_008f4e92:
shaderEntry[0x78] = 0;
shaderEntry[0x79] = 0;
shaderEntry[0x7a] = 0;
shaderEntry[0x7b] = 0;
LAB_008f4e9f:
uStack_10124 = 0;
uStack_1011c = 0;
pcVar15 = "vertex";
do {
pcVar14 = pcVar15;
pcVar15 = pcVar14 + 1;
} while (*pcVar15 != '\0');
pbStack_100f0 = GHIDRA_CAST<uint8_t *>(piStack_100fc[6]);
for (pbStack_100f4 = pbStack_100f0; pbStack_100f4 != GHIDRA_CAST<uint8_t *>(0x0);
pbStack_100f4 = *GHIDRA_CAST<uint8_t **>((pbStack_100f4 + 0x2c))) {
pbVar6 = *GHIDRA_CAST<uint8_t **>(pbStack_100f4);
if (pbVar6 == GHIDRA_CAST<uint8_t *>(0x0)) {
pcVar15 = GHIDRA_CAST<char *>(0x0);
pbVar6 = &g_xmlNullStr;
}
else {
pcVar15 = *GHIDRA_CAST<char **>((pbStack_100f4 + 8));
}
if (pcVar15 == pcVar14 + -0xb76e4b) {
pbVar13 = GHIDRA_CAST<uint8_t *>((pcVar15 + GHIDRA_INT(pbVar6)));
childNode = pbStack_100f4;
if (pbVar13 <= pbVar6) goto LAB_008f52e7;
iVar7 = GHIDRA_INT("vertex") - GHIDRA_INT(pbVar6);
while (*pbVar6 == pbVar6[iVar7]) {
pbVar6 = pbVar6 + 1;
if (pbVar13 <= pbVar6) goto LAB_008f52e7;
}
}
}
childNode = GHIDRA_CAST<uint8_t *>(0x0);
LAB_008f52e7:
pcVar15 = "fragment";
vertexSource = GHIDRA_CAST<std_string *>(&g_xmlNullStr);
if (*GHIDRA_CAST<std_string **>((*GHIDRA_CAST<int *>((childNode + 0x18)) + 4)) != GHIDRA_CAST<std_string *>(0x0)) {
vertexSource = *GHIDRA_CAST<std_string **>((*GHIDRA_CAST<int *>((childNode + 0x18)) + 4));
}
do {
pcVar14 = pcVar15;
pcVar15 = pcVar14 + 1;
} while (*pcVar15 != '\0');
pcVar14 = pcVar14 + -0xb76e3f;
uStack_10108 = CONCAT44(pcVar14,(uint32_t)uStack_10108);
for (; pbStack_100f0 != GHIDRA_CAST<uint8_t *>(0x0); pbStack_100f0 = *GHIDRA_CAST<uint8_t **>((pbStack_100f0 + 0x2c)))
{
pbVar6 = *GHIDRA_CAST<uint8_t **>(pbStack_100f0);
if (pbVar6 == GHIDRA_CAST<uint8_t *>(0x0)) {
pcVar15 = GHIDRA_CAST<char *>(0x0);
pbVar6 = &g_xmlNullStr;
}
else {
pcVar15 = *GHIDRA_CAST<char **>((pbStack_100f0 + 8));
}
if (pcVar15 == pcVar14) {
pbVar13 = GHIDRA_CAST<uint8_t *>((pcVar15 + GHIDRA_INT(pbVar6)));
childNode = pbStack_100f0;
if (pbVar13 <= pbVar6) goto LAB_008f5377;
iVar7 = GHIDRA_INT("fragment") - GHIDRA_INT(pbVar6);
while (*pbVar6 == pbVar6[iVar7]) {
pbVar6 = pbVar6 + 1;
if (pbVar13 <= pbVar6) goto LAB_008f5377;
}
}
}
childNode = GHIDRA_CAST<uint8_t *>(0x0);
LAB_008f5377:
fragmentSource = GHIDRA_CAST<std_string *>(&g_xmlNullStr);
if (*GHIDRA_CAST<std_string **>((*GHIDRA_CAST<int *>((childNode + 0x18)) + 4)) != GHIDRA_CAST<std_string *>(0x0)) {
fragmentSource = *GHIDRA_CAST<std_string **>((*GHIDRA_CAST<int *>((childNode + 0x18)) + 4));
}
vertexText._size = 0;
vertexText._capacity = 0xf;
vertexText._buf[0] = '\0';
vertexText._buf[1] = '\0';
vertexText._buf[2] = '\0';
vertexText._buf[3] = '\0';
fragmentText._size = 0;
fragmentText._capacity = 0xf;
fragmentText._buf[0] = '\0';
fragmentText._buf[1] = '\0';
fragmentText._buf[2] = '\0';
fragmentText._buf[3] = '\0';
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xb;
psStack_1010c = vertexSource;
if (vertexSource->_buf[0] != 0x23) {
tmpString._size = 0;
tmpString._capacity = 0xf;
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(tmpString._buf)) + 0x0))) = (*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(tmpString._buf)) + 0x0))) & 0xffffffff00000000;
pcVar15 = msvc::_Allocate(0x40);
tmpString._size = 0x3c;
tmpString._capacity = 0x3f;
builtin_strncpy(pcVar15,
"#ifndef GL_ES\n#define lowp \n#define mediump \n#endif\n#line 1\n",
0x3d);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString._buf)) + 0x0))) = pcVar15;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xc;
pathCStr = vertexSource;
do {
pcVar15 = pathCStr->_buf;
pathCStr = GHIDRA_CAST<std_string *>((pathCStr->_buf + 1));
} while (*pcVar15 != '\0');
pcVar15 = (GHIDRA_CAST<msvc::string *>((tmpString._buf)))->msvc::string::append(GHIDRA_CAST<uint8_t *>(vertexSource),
GHIDRA_INT(pathCStr) - GHIDRA_INT((vertexSource->_buf + 1)));
cleanupFlags = cleanupFlags | 1;
acStack_98 = *(char (*) [4])pcVar15;
acStack_94 = *(char (*) [4])(pcVar15 + 4);
uStack_90 = *GHIDRA_CAST<uint32_t *>((pcVar15 + 8));
uStack_8c = *GHIDRA_CAST<uint32_t *>((pcVar15 + 0xc));
uStack_10108 = *GHIDRA_CAST<uint64_t *>((pcVar15 + 0x10));
pcVar15[0x10] = '\0';
pcVar15[0x11] = '\0';
pcVar15[0x12] = '\0';
pcVar15[0x13] = '\0';
pcVar15[0x14] = '\x0f';
pcVar15[0x15] = '\0';
pcVar15[0x16] = '\0';
pcVar15[0x17] = '\0';
*pcVar15 = '\0';
if (0xf < vertexText._capacity) {
uVar12 = vertexText._capacity + 1;
pvVar8 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)vertexText._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar8 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(vertexText._buf)) + 0x0))) + -4);
uVar12 = vertexText._capacity + 0x24;
if (0x1f < ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(vertexText._buf)) + 0x0))) - GHIDRA_INT(pvVar8)) - 4U) goto LAB_008f5943;
}
operator_delete(pvVar8,uVar12);
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xb;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(vertexText._buf)) + 0x0))) = acStack_98;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(vertexText._buf)) + 0x4))) = acStack_94;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(vertexText._buf)) + 0x8))) = uStack_90;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(vertexText._buf)) + 0xc))) = uStack_8c;
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(vertexText)) + 0x10))) = uStack_10108;
if (0xf < tmpString._capacity) {
uVar12 = tmpString._capacity + 1;
pvVar8 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)tmpString._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar8 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString._buf)) + 0x0))) + -4);
uVar12 = tmpString._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar8))))) goto LAB_008f5943;
}
operator_delete(pvVar8,uVar12);
}
vertexSource = &vertexText;
if (0xf < vertexText._capacity) {
vertexSource = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(vertexText._buf))) + 0x0)));
}
}
if (fragmentSource->_buf[0] != 0x23) {
tmpString._size = 0;
tmpString._capacity = 0xf;
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(tmpString._buf)) + 0x0))) = (*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(tmpString._buf)) + 0x0))) & 0xffffffff00000000;
(GHIDRA_CAST<msvc::string *>((tmpString._buf)))->msvc::string::assign((uint8_t *)
"#ifndef GL_ES\n#define lowp \n#define mediump \n#endif\n#line 1\n"
,0x3c);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xd;
pathCStr = fragmentSource;
do {
pcVar15 = pathCStr->_buf;
pathCStr = GHIDRA_CAST<std_string *>((pathCStr->_buf + 1));
} while (*pcVar15 != '\0');
pvVar8 = (GHIDRA_CAST<msvc::string *>((tmpString._buf)))->msvc::string::append(GHIDRA_CAST<uint8_t *>(fragmentSource),
GHIDRA_INT(pathCStr) - GHIDRA_INT((fragmentSource->_buf + 1)));
FUN_00417100(pvVar8);
cleanupFlags = cleanupFlags | 2;
if (0xf < fragmentText._capacity) {
uVar12 = fragmentText._capacity + 1;
pvVar8 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)fragmentText._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar8 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(fragmentText._buf)) + 0x0))) + -4);
uVar12 = fragmentText._capacity + 0x24;
if (0x1f < ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(fragmentText._buf)) + 0x0))) - GHIDRA_INT(pvVar8)) - 4U) goto LAB_008f5943;
}
operator_delete(pvVar8,uVar12);
}
uVar12 = local_a0;
local_a0 = local_a0 & 0xffffff00;
uVar5 = local_a0;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_a0)) + 0x0))) = (uint8_t)uVar12;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_a0)) + 0x1))) = SUB41(uVar12,1);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_a0)) + 0x2))) = SUB41(uVar12,2);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_a0)) + 0x3))) = SUB41(uVar12,3);
fragmentText._buf[0] = (uint8_t)local_a0;
fragmentText._buf[1] = (*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_a0)) + 0x1)));
fragmentText._buf[2] = (*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_a0)) + 0x2)));
fragmentText._buf[3] = (*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_a0)) + 0x3)));
fragmentText._buf[4] = acStack_9c[0];
fragmentText._buf[5] = acStack_9c[1];
fragmentText._buf[6] = acStack_9c[2];
fragmentText._buf[7] = acStack_9c[3];
fragmentText._buf[8] = acStack_98[0];
fragmentText._buf[9] = acStack_98[1];
fragmentText._buf[10] = acStack_98[2];
fragmentText._buf[0xb] = acStack_98[3];
fragmentText._buf[0xc] = acStack_94[0];
fragmentText._buf[0xd] = acStack_94[1];
fragmentText._buf[0xe] = acStack_94[2];
fragmentText._buf[0xf] = acStack_94[3];
fragmentText._size = uStack_90;
fragmentText._capacity = uStack_8c;
uStack_90 = 0;
uStack_8c = 0xf;
local_a0 = uVar5;
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(&local_a0))))->msvc::string::_Tidy_deallocate();
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xb;
if (0xf < tmpString._capacity) {
uVar12 = tmpString._capacity + 1;
pvVar8 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)tmpString._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar8 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString._buf)) + 0x0))) + -4);
uVar12 = tmpString._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar8))))) goto LAB_008f5943;
}
operator_delete(pvVar8,uVar12);
}
fragmentSource = &fragmentText;
if (0xf < fragmentText._capacity) {
fragmentSource = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(fragmentText._buf))) + 0x0)));
}
}
attribArrayBytes = (uint64_t)(*GHIDRA_CAST<int *>((shaderEntry + 0x74)) + 6) * 8;
puVar10 = operator_new_tracked
(-GHIDRA_UINT((GHIDRA_INT(((uint64_t)attribArrayBytes >> 0x20)) != 0)) |
GHIDRA_UINT(attribArrayBytes));
*GHIDRA_CAST<uint32_t **>((shaderEntry + 0x7c)) = puVar10;
*puVar10 = "Position";
puVar10[1] = 5;
iVar7 = *GHIDRA_CAST<int *>((shaderEntry + 0x7c));
*GHIDRA_CAST<char **>((iVar7 + 8)) = "Color";
*GHIDRA_CAST<uint32_t *>((iVar7 + 0xc)) = 6;
iVar7 = *GHIDRA_CAST<int *>((shaderEntry + 0x7c));
*GHIDRA_CAST<char **>((iVar7 + 0x10)) = "TexCoord";
*GHIDRA_CAST<uint32_t *>((iVar7 + 0x14)) = 7;
iVar7 = *GHIDRA_CAST<int *>((shaderEntry + 0x7c));
*GHIDRA_CAST<char **>((iVar7 + 0x18)) = "RenderData";
*GHIDRA_CAST<uint32_t *>((iVar7 + 0x1c)) = 4;
iVar7 = *GHIDRA_CAST<int *>((shaderEntry + 0x7c));
*GHIDRA_CAST<char **>((iVar7 + 0x20)) = "Scale";
*GHIDRA_CAST<uint32_t *>((iVar7 + 0x24)) = 1;
iVar7 = *GHIDRA_CAST<int *>((shaderEntry + 0x74));
iVar2 = *GHIDRA_CAST<int *>((shaderEntry + 0x7c));
*GHIDRA_CAST<uint8_t **>((iVar2 + 0x28 + iVar7 * 8)) = &s_empty;
*GHIDRA_CAST<uint32_t *>((iVar2 + 0x2c + iVar7 * 8)) = 0;
piVar9 = GHIDRA_CAST<int *>(**GHIDRA_CAST<int **>((shaderEntry + 0x70)));
if (piVar9 != *GHIDRA_CAST<int **>((shaderEntry + 0x70))) {
iVar7 = 0x28;
do {
pvVar8 = operator_new_tracked(piVar9[8] + 1);
curModIt = piVar9 + 4;
uStack_10108 = CONCAT44(pvVar8,(uint32_t)uStack_10108);
if (0xf < GHIDRA_UINT(piVar9[9])) {
curModIt = GHIDRA_CAST<int *>(*curModIt);
}
piVar11 = curModIt;
do {
iVar2 = *piVar11;
piVar11 = GHIDRA_CAST<int *>((GHIDRA_INT(piVar11) + 1));
*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(pvVar8) + (-1 - GHIDRA_INT(curModIt)) + GHIDRA_INT(piVar11))) = (char)iVar2;
} while ((char)iVar2 != '\0');
iVar2 = piVar9[10];
iVar3 = *GHIDRA_CAST<int *>((shaderEntry + 0x7c));
*(void **)(iVar7 + iVar3) = pvVar8;
*GHIDRA_CAST<int *>((iVar7 + 4 + iVar3)) = iVar2;
iVar7 = iVar7 + 8;
curModIt = GHIDRA_CAST<int *>(piVar9[2]);
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(curModIt) + 0xd)) == '\0') {
cVar1 = *GHIDRA_CAST<char *>((*curModIt + 0xd));
piVar9 = curModIt;
curModIt = GHIDRA_CAST<int *>(*curModIt);
while (cVar1 == '\0') {
cVar1 = *GHIDRA_CAST<char *>((*curModIt + 0xd));
piVar9 = curModIt;
curModIt = GHIDRA_CAST<int *>(*curModIt);
}
}
else {
cVar1 = *GHIDRA_CAST<char *>((piVar9[1] + 0xd));
piVar11 = GHIDRA_CAST<int *>(piVar9[1]);
curModIt = piVar9;
while ((piVar9 = piVar11, cVar1 == '\0' && (curModIt == GHIDRA_CAST<int *>(piVar9[2])))) {
cVar1 = *GHIDRA_CAST<char *>((piVar9[1] + 0xd));
piVar11 = GHIDRA_CAST<int *>(piVar9[1]);
curModIt = piVar9;
}
}
} while (piVar9 != *GHIDRA_CAST<int **>((shaderEntry + 0x70)));
curModIt = modIt;
}
pbVar6 = shaderEntry;
if (0xf < *GHIDRA_CAST<uint32_t *>((shaderEntry + 0x14))) {
pbVar6 = *GHIDRA_CAST<uint8_t **>(shaderEntry);
}
(GHIDRA_CAST<Shader *>((shaderEntry + 0x18)))->Shader::load(pbVar6,*(void **)(shaderEntry + 0x7c),&vertexSource);
KAGE::SmartPointer<RenderTargetBase>::reset(shaderEntry + 0x68);
iVar7 = *curModIt;
uStack_10108 = CONCAT44(*GHIDRA_CAST<uint32_t *>((iVar7 + 0xe4)),(uint32_t)uStack_10108);
if (*GHIDRA_CAST<int *>((iVar7 + 0xe8)) == 0x15555555) {
/* WARNING: Subroutine does not return */
msvc::_Xlength_error("list too long");
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xe;
piVar9 = operator_new(0xc);
piVar9[2] = GHIDRA_INT(shaderEntry);
*GHIDRA_CAST<int *>((iVar7 + 0xe8)) = *GHIDRA_CAST<int *>((iVar7 + 0xe8)) + 1;
puVar10 = *GHIDRA_CAST<uint32_t **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(uStack_10108)) + 0x4))) + 4));
*piVar9 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(uStack_10108)) + 0x4)));
piVar9[1] = GHIDRA_INT(puVar10);
*GHIDRA_CAST<int **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(uStack_10108)) + 0x4))) + 4)) = piVar9;
*puVar10 = piVar9;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 10;
if (0xf < fragmentText._capacity) {
uVar12 = fragmentText._capacity + 1;
pvVar8 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)fragmentText._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar8 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(fragmentText._buf)) + 0x0))) + -4);
uVar12 = fragmentText._capacity + 0x24;
if (0x1f < ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(fragmentText._buf)) + 0x0))) - GHIDRA_INT(pvVar8)) - 4U) goto LAB_008f5943;
}
operator_delete(pvVar8,uVar12);
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 4;
fragmentText._size = 0;
fragmentText._capacity = 0xf;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(fragmentText._buf)) + 0x0))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(fragmentText._buf)) + 0x0))) & 0xffffff00;
if (0xf < vertexText._capacity) {
uVar12 = vertexText._capacity + 1;
pvVar8 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)vertexText._buf)) + 0x0)));
if (0xfff < uVar12) {
pvVar8 = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(vertexText._buf)) + 0x0))) + -4);
uVar12 = vertexText._capacity + 0x24;
if (0x1f < ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(vertexText._buf)) + 0x0))) - GHIDRA_INT(pvVar8)) - 4U) goto LAB_008f5943;
}
operator_delete(pvVar8,uVar12);
}
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xf;
tracked_alloc(1,fileBuffer,0);
local_14 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),0x10);
(GHIDRA_CAST<xml_memory_pool *>((auStack_100b8)))->xml_memory_pool::clear();
}
}
local_14 = 0xffffffff;
(GHIDRA_CAST<msvc::string *>((configPath._buf)))->msvc::string::_Tidy_deallocate();
}
modIt = curModIt + 1;
} while (modIt != *GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1)))));
}
ExceptionList = local_1c;
return;
LAB_008f4e81:
pbStack_100f0 = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pbStack_100f0) + 0x2c));
if (pbStack_100f0 == GHIDRA_CAST<uint8_t *>(0x0)) goto LAB_008f4e92;
goto LAB_008f4df0;
}
// 008f5ad0
void ModManager::TryRedirectPath(std_string *result, std_string *filePath)
{
uint32_t uVar1;
uint32_t uVar2;
uint32_t uVar3;
uint32_t *cacheEntry;
uint32_t *appended;
uint8_t *resolvedPath;
uint8_t ****ppppbVar4;
uint32_t ****ppppuVar5;
int iVar6;
uint32_t extraout_ECX;
void *pvVar7;
std_string *filePathStr;
uint32_t slot;
uint32_t *modIt;
uint32_t *modDirStr;
uint32_t ****fallbackPath;
uint32_t uStack_98;
uint32_t uStack_94;
uint32_t uStack_90;
uint32_t local_8c;
uint32_t uStack_88;
void *modDirCopy [4];
uint32_t modDirCopySize;
uint32_t modDirCopyCapacity;
void *dlcDir;
uint32_t uStack_68;
uint32_t uStack_64;
uint32_t uStack_60;
uint64_t local_5c;
uint8_t ****modDir;
uint32_t uStack_50;
uint32_t uStack_4c;
uint32_t uStack_48;
uint32_t modDirSize;
uint32_t modDirCapacity;
uint32_t ****candidatePath;
uint32_t uStack_38;
uint32_t uStack_34;
uint32_t uStack_30;
uint64_t local_2c;
uint32_t local_24;
uint8_t *puStack_20;
void *local_1c;
uint8_t *puStack_18;
void *local_14;
puStack_20 = GHIDRA_CAST<uint8_t *>((modDirCopy + 0x20));
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xff;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))) = 0xffffff;
puStack_18 = &LAB_00b07895;
local_1c = ExceptionList;
uVar1 = __security_cookie ^ GHIDRA_UINT((modDirCopy + 0x1d));
ExceptionList = &local_1c;
filePathStr = filePath;
if (0xf < filePath->_capacity) {
filePathStr = *GHIDRA_CAST<std_string **>(filePath->_buf);
}
local_24 = uVar1;
uVar2 = KAGE_Filesys_FileManager::GetPrimaryFilePathHash(GHIDRA_CAST<uint8_t *>(filePathStr));
uVar1 = FUN_00a15ab0(extraout_ECX,uVar1);
slot = uVar2 & 0x7fff;
uVar3 = 0;
cacheEntry = *GHIDRA_CAST<uint32_t **>((GHIDRA_CAST<char *>(this) + slot * 4 + 0xc));
if (cacheEntry != GHIDRA_CAST<uint32_t *>(0x0)) {
do {
if (((*cacheEntry == uVar2) && (cacheEntry[1] == uVar1)) || (0x7fff < uVar3)) break;
slot = slot + 1 & 0x7fff;
uVar3 = uVar3 + 1;
cacheEntry = *GHIDRA_CAST<uint32_t **>((GHIDRA_CAST<char *>(this) + slot * 4 + 0xc));
} while (cacheEntry != GHIDRA_CAST<uint32_t *>(0x0));
if (uVar3 == 0x8000) {
if (cacheEntry != GHIDRA_CAST<uint32_t *>(0x0)) {
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((cacheEntry + 3)))))->msvc::string::_Tidy_deallocate();
operator_delete(cacheEntry,0x24);
}
}
else if (cacheEntry != GHIDRA_CAST<uint32_t *>(0x0)) goto LAB_008f608f;
}
cacheEntry = operator_new(0x24);
if (cacheEntry == GHIDRA_CAST<uint32_t *>(0x0)) {
cacheEntry = GHIDRA_CAST<uint32_t *>(0x0);
}
else {
cacheEntry[3] = 0;
cacheEntry[7] = 0;
cacheEntry[8] = 0xf;
}
*cacheEntry = uVar2;
cacheEntry[1] = uVar1;
cacheEntry[2] = 0;
*GHIDRA_CAST<uint32_t **>((GHIDRA_CAST<char *>(this) + slot * 4 + 0xc)) = cacheEntry;
modIt = *GHIDRA_CAST<uint32_t **>(this);
if (modIt != *GHIDRA_CAST<uint32_t **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1))))) {
do {
uVar1 = *modIt;
if (*GHIDRA_CAST<char *>((uVar1 + 0xfd)) != '\0') {
uVar2 = *GHIDRA_CAST<uint32_t *>((uVar1 + 0x40));
modDirStr = GHIDRA_CAST<uint32_t *>((uVar1 + 0x30));
if (0xf < *GHIDRA_CAST<uint32_t *>((uVar1 + 0x44))) {
modDirStr = GHIDRA_CAST<uint32_t *>(*modDirStr);
}
if (uVar2 < 0x10) {
modDir = GHIDRA_CAST<uint8_t ****>(*modDirStr);
uStack_50 = modDirStr[1];
uStack_4c = modDirStr[2];
uStack_48 = modDirStr[3];
uVar1 = 0xf;
}
else {
uVar1 = uVar2 | 0xf;
if (0x7fffffff < uVar1) {
uVar1 = 0x7fffffff;
}
modDir = msvc::_Allocate(uVar1 + 1);
memcpy(modDir,modDirStr,uVar2 + 1);
}
local_14 = (void *)0x0;
uVar3 = uVar2 - 1;
if (uVar2 < uVar2 - 1) {
uVar3 = uVar2;
}
ppppbVar4 = GHIDRA_CAST<uint8_t ****>(&modDir);
if (0xf < uVar1) {
ppppbVar4 = modDir;
}
modDirCopySize = 0;
modDirCopyCapacity = 0xf;
modDirCopy[0] = (void *)0x0;
modDirSize = uVar2;
modDirCapacity = uVar1;
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(modDirCopy))))->msvc::string::assign(GHIDRA_CAST<uint8_t *>(ppppbVar4),uVar3);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 1;
appended = (GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(modDirCopy))))->msvc::string::append(GHIDRA_CAST<uint8_t *>("-dlc3/"),6);
dlcDir = (void *)*appended;
uStack_68 = appended[1];
uStack_64 = appended[2];
uStack_60 = appended[3];
local_5c = *GHIDRA_CAST<uint64_t *>((appended + 4));
appended[4] = 0;
appended[5] = 0xf;
*GHIDRA_CAST<uint8_t *>(appended) = 0;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
filePathStr = filePath;
if (0xf < filePath->_capacity) {
filePathStr = *GHIDRA_CAST<std_string **>(filePath->_buf);
}
appended = (GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(&dlcDir))))->msvc::string::append(GHIDRA_CAST<uint8_t *>(filePathStr),filePath->_size);
candidatePath = GHIDRA_CAST<uint32_t ****>(*appended);
uStack_38 = appended[1];
uStack_34 = appended[2];
uStack_30 = appended[3];
local_2c = *GHIDRA_CAST<uint64_t *>((appended + 4));
appended[4] = 0;
appended[5] = 0xf;
*GHIDRA_CAST<uint8_t *>(appended) = 0;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 4;
if (0xf < (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_5c)) + 0x4)))) {
uVar1 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_5c)) + 0x4))) + 1;
pvVar7 = dlcDir;
if (0xfff < uVar1) {
pvVar7 = *(void **)(GHIDRA_CAST<char *>(dlcDir) + -4);
uVar1 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_5c)) + 0x4))) + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(dlcDir) + (-4 - GHIDRA_INT(pvVar7))))) goto LAB_008f6140;
}
operator_delete(pvVar7,uVar1);
}
local_5c = 0xf00000000;
dlcDir = (void *)(GHIDRA_UINT(dlcDir) & 0xffffff00);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 5;
if (0xf < modDirCopyCapacity) {
uVar1 = modDirCopyCapacity + 1;
pvVar7 = modDirCopy[0];
if (0xfff < uVar1) {
pvVar7 = *(void **)(GHIDRA_INT(modDirCopy[0]) + -4);
uVar1 = modDirCopyCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(modDirCopy[0]) + (-4 - GHIDRA_INT(pvVar7))))) goto LAB_008f6140;
}
operator_delete(pvVar7,uVar1);
}
modDirCopySize = 0;
ppppuVar5 = GHIDRA_CAST<uint32_t ****>(&candidatePath);
if (0xf < (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c)) + 0x4)))) {
ppppuVar5 = candidatePath;
}
modDirCopyCapacity = 0xf;
modDirCopy[0] = (void *)(GHIDRA_UINT(modDirCopy[0]) & 0xffffff00);
resolvedPath = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(ppppuVar5));
if (resolvedPath == GHIDRA_CAST<uint8_t *>(0x0)) {
if (0x7fffffff - modDirSize < filePath->_size) {
/* WARNING: Subroutine does not return */
msvc::string::_Xlen();
}
ppppbVar4 = GHIDRA_CAST<uint8_t ****>(&modDir);
if (0xf < modDirCapacity) {
ppppbVar4 = modDir;
}
filePathStr = filePath;
if (0xf < filePath->_capacity) {
filePathStr = *GHIDRA_CAST<std_string **>(filePath->_buf);
}
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(&fallbackPath))))->msvc::string::concat(GHIDRA_INT(result),filePathStr,GHIDRA_CAST<uint8_t *>(ppppbVar4),
modDirSize,GHIDRA_CAST<uint8_t *>(filePathStr),filePath->_size);
if (0xf < (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c)) + 0x4)))) {
uVar1 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c)) + 0x4))) + 1;
ppppuVar5 = candidatePath;
if (0xfff < uVar1) {
ppppuVar5 = GHIDRA_CAST<uint32_t ****>(candidatePath[-1]);
uVar1 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c)) + 0x4))) + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(candidatePath) + (-4 - GHIDRA_INT(ppppuVar5))))) goto LAB_008f6140;
}
operator_delete(ppppuVar5,uVar1);
}
candidatePath = fallbackPath;
uStack_38 = uStack_98;
uStack_34 = uStack_94;
uStack_30 = uStack_90;
ppppuVar5 = GHIDRA_CAST<uint32_t ****>(&candidatePath);
if (0xf < uStack_88) {
ppppuVar5 = fallbackPath;
}
local_2c = CONCAT44(uStack_88,local_8c);
resolvedPath = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(ppppuVar5));
if (resolvedPath != GHIDRA_CAST<uint8_t *>(0x0)) {
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 7;
tracked_alloc(1,resolvedPath,0);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 5;
}
if (resolvedPath == GHIDRA_CAST<uint8_t *>(0x0)) {
if (0xf < (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c)) + 0x4)))) {
uVar1 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c)) + 0x4))) + 1;
ppppuVar5 = candidatePath;
if (0xfff < uVar1) {
ppppuVar5 = GHIDRA_CAST<uint32_t ****>(candidatePath[-1]);
uVar1 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c)) + 0x4))) + 0x24;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(candidatePath) + (-4 - GHIDRA_INT(ppppuVar5))))) goto LAB_008f6140;
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = resolvedPath != GHIDRA_CAST<uint8_t *>(0x0);
operator_delete(ppppuVar5,uVar1);
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xff;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))) = 0xffffff;
local_2c = 0xf00000000;
candidatePath = GHIDRA_CAST<uint32_t ****>((GHIDRA_UINT(candidatePath) & 0xffffff00));
if (0xf < modDirCapacity) {
uVar1 = modDirCapacity + 1;
ppppbVar4 = modDir;
if (0xfff < uVar1) {
ppppbVar4 = GHIDRA_CAST<uint8_t ****>(modDir[-1]);
uVar1 = modDirCapacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(modDir) + (-4 - GHIDRA_INT(ppppbVar4))))) goto LAB_008f6140;
}
operator_delete(ppppbVar4,uVar1);
}
goto LAB_008f5fd3;
}
cacheEntry[2] = *modIt;
if (GHIDRA_CAST<uint32_t *****>((cacheEntry + 3)) != &candidatePath) {
ppppuVar5 = GHIDRA_CAST<uint32_t ****>(&candidatePath);
if (0xf < (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c)) + 0x4)))) {
ppppuVar5 = candidatePath;
}
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((cacheEntry + 3)))))->msvc::string::assign(GHIDRA_CAST<uint8_t *>(ppppuVar5),GHIDRA_UINT(local_2c));
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0;
if (0xf < (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c)) + 0x4)))) {
uVar1 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c)) + 0x4))) + 1;
ppppuVar5 = candidatePath;
if (0xfff < uVar1) {
ppppuVar5 = GHIDRA_CAST<uint32_t ****>(candidatePath[-1]);
uVar1 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c)) + 0x4))) + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(candidatePath) + (-4 - GHIDRA_INT(ppppuVar5))))) goto LAB_008f6140;
}
operator_delete(ppppuVar5,uVar1);
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xff;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))) = 0xffffff;
local_2c = 0xf00000000;
candidatePath = GHIDRA_CAST<uint32_t ****>((GHIDRA_UINT(candidatePath) & 0xffffff00));
if (modDirCapacity < 0x10) break;
uVar1 = modDirCapacity + 1;
ppppbVar4 = modDir;
if (0xfff < uVar1) {
ppppbVar4 = GHIDRA_CAST<uint8_t ****>(modDir[-1]);
iVar6 = GHIDRA_INT(modDir) - GHIDRA_INT(ppppbVar4);
goto joined_r0x008f613a;
}
}
else {
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 6;
tracked_alloc(1,resolvedPath,0);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 5;
cacheEntry[2] = *modIt;
if (GHIDRA_CAST<uint32_t *****>((cacheEntry + 3)) != &candidatePath) {
ppppuVar5 = GHIDRA_CAST<uint32_t ****>(&candidatePath);
if (0xf < (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c)) + 0x4)))) {
ppppuVar5 = candidatePath;
}
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((cacheEntry + 3)))))->msvc::string::assign(GHIDRA_CAST<uint8_t *>(ppppuVar5),GHIDRA_UINT(local_2c));
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0;
if (0xf < (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c)) + 0x4)))) {
uVar1 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c)) + 0x4))) + 1;
ppppuVar5 = candidatePath;
if (0xfff < uVar1) {
ppppuVar5 = GHIDRA_CAST<uint32_t ****>(candidatePath[-1]);
uVar1 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c)) + 0x4))) + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(candidatePath) + (-4 - GHIDRA_INT(ppppuVar5))))) goto LAB_008f6140;
}
operator_delete(ppppuVar5,uVar1);
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xff;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))) = 0xffffff;
local_2c = 0xf00000000;
candidatePath = GHIDRA_CAST<uint32_t ****>((GHIDRA_UINT(candidatePath) & 0xffffff00));
if (modDirCapacity < 0x10) break;
uVar1 = modDirCapacity + 1;
ppppbVar4 = modDir;
if (0xfff < uVar1) {
ppppbVar4 = GHIDRA_CAST<uint8_t ****>(modDir[-1]);
iVar6 = GHIDRA_INT(modDir) - GHIDRA_INT(ppppbVar4);
joined_r0x008f613a:
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))) = 0xffffff;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xff;
local_2c = 0xf00000000;
uVar1 = modDirCapacity + 0x24;
if (0x1f < iVar6 - 4U) {
LAB_008f6140:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
}
local_2c = 0xf00000000;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))) = 0xffffff;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xff;
operator_delete(ppppbVar4,uVar1);
break;
}
LAB_008f5fd3:
modIt = modIt + 1;
} while (modIt != *GHIDRA_CAST<uint32_t **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1)))));
}
LAB_008f608f:
if (cacheEntry[2] != 0) {
filePath = GHIDRA_CAST<std_string *>((cacheEntry + 3));
}
(GHIDRA_CAST<msvc::string *>((result->_buf)))->msvc::string::string(filePath);
ExceptionList = local_1c;
return;
}
// 008f61d0
void ModManager::ListMods()
{
uint32_t *ptr;
uint8_t bVar1;
char cVar2;
uint32_t uVar3;
uint8_t *pbVar4;
int *piVar5;
ModEntry *pMVar6;
ModEntry *extraout_EAX;
ModEntry **fileSize;
uint32_t *node;
void *pvVar7;
ModEntry *pMVar8;
uint32_t newModState;
uint8_t *pbVar9;
std_string *psVar10;
uint8_t *puVar11;
uint8_t *node;
char *pcVar13;
uint32_t uVar14;
uint32_t size;
uint64_t *allocatedBytes;
int ptrDelta;
char *pcVar15;
ModEntry **ppMVar16;
int enabledModCount;
ModEntry *pMStack_100fc;
uint32_t cleanupFlags;
code *tolowerFn;
uint32_t dirIndex;
void *dirEntries;
int saveDirSize;
uint8_t *pbStack_100e4;
ModEntry *pMStack_100e0;
ModEntry *modEntry;
ModEntry *pMStack_100d8;
char cStack_100d1;
uint32_t xmlDoc;
uint32_t uStack_100cc;
uint32_t uStack_100c0;
uint32_t uStack_100bc;
uint32_t *docFirstNode;
uint32_t *docLastNode;
uint32_t uStack_100b0;
uint8_t *xmlPool;
uint8_t *puStack_1009c;
uint32_t *puStack_10098;
uint8_t xmlPoolBuffer [65536];
uint32_t uStack_94;
uint32_t uStack_90;
void *modSaveDirTmp [5];
uint32_t modSaveDirTmpCapacity;
void *pvStack_70;
int iStack_6c;
uint32_t uStack_68;
uint32_t uStack_64;
int saveDirTmpSize;
uint8_t *saveDirTmpCapacity;
ModEntry *modPath [4];
std_string *modPathSize;
uint32_t modPathCapacity;
uint8_t tmpString [12];
int iStack_34;
uint32_t tmpStringSize;
uint32_t tmpStringCapacity;
uint32_t stackCookie;
uint8_t *puStack_20;
void *savedExceptionList;
uint8_t *puStack_18;
uint32_t ehState;
uint8_t *cmpEnd;
ModEntry *dirEntryCount;
code *freeFn;
uint64_t prevAllocated;
puStack_20 = tmpString + 0x3c;
ehState = 0xffffffff;
puStack_18 = &LAB_00b0790d;
savedExceptionList = ExceptionList;
uVar3 = __security_cookie ^ GHIDRA_UINT((tmpString + 0x30));
ExceptionList = &savedExceptionList;
cleanupFlags = 0;
pMStack_100e0 = GHIDRA_CAST<ModEntry *>(0x0);
stackCookie = uVar3;
dirEntries = filesys_list_directory(&s_empty,g_modsDirectory,GHIDRA_CAST<int *>(&pMStack_100e0));
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("begin list mods\n"));
dirEntryCount = pMStack_100e0;
freeFn = free_exref;
enabledModCount = 0;
dirIndex = 0;
if (pMStack_100e0 != GHIDRA_CAST<ModEntry *>(0x0)) {
tolowerFn = tolower_exref;
pvVar7 = dirEntries;
do {
uVar14 = dirIndex;
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(pvVar7) + dirIndex * 8)) & 2) != 0) {
modPathSize = GHIDRA_CAST<std_string *>(0x0);
modPathCapacity = 0xf;
modPath[0] = GHIDRA_CAST<ModEntry *>(0x0);
pbVar4 = g_modsDirectory;
do {
pbVar9 = pbVar4;
pbVar4 = pbVar9 + 1;
} while (*pbVar9 != 0);
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(modPath))))->msvc::string::assign(g_modsDirectory,GHIDRA_UINT((pbVar9 + -0xc72e28)));
ehState = 0;
pbVar4 = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pvVar7) + uVar14 * 8 + 4));
pbVar9 = pbVar4;
do {
bVar1 = *pbVar9;
pbVar9 = pbVar9 + 1;
} while (bVar1 != 0);
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(modPath))))->msvc::string::append(pbVar4,GHIDRA_INT(pbVar9) - GHIDRA_INT((pbVar4 + 1)));
pMVar6 = GHIDRA_CAST<ModEntry *>(modPath);
if (0xf < modPathCapacity) {
pMVar6 = modPath[0];
}
pMStack_100fc = GHIDRA_CAST<ModEntry *>((modPathSize->_buf + GHIDRA_INT(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x0))))));
pMVar8 = GHIDRA_CAST<ModEntry *>(modPath);
if (0xf < modPathCapacity) {
pMVar8 = modPath[0];
}
if (pMVar8 != pMStack_100fc) {
ptrDelta = GHIDRA_INT(pMVar6) - GHIDRA_INT(pMVar8);
do {
bVar1 = (*tolowerFn)(GHIDRA_INT((char)*GHIDRA_CAST<uint8_t *>(pMVar8)));
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(pMVar8) + ptrDelta)) = bVar1;
pMVar8 = GHIDRA_CAST<ModEntry *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar8)) + 0x1))));
} while (pMVar8 != pMStack_100fc);
}
pMVar6 = GHIDRA_CAST<ModEntry *>(modPath);
if (0xf < modPathCapacity) {
pMVar6 = modPath[0];
}
pbVar4 = path_join(GHIDRA_CAST<uint8_t *>("/metadata.xml"),GHIDRA_CAST<uint8_t *>(pMVar6),0,0);
piVar5 = (GHIDRA_CAST<FileSystem *>((&PTR_vftable_00c37a10)))->FileSystem::Open(pbVar4,GHIDRA_CAST<int *>(0x0));
if (pbVar4 != GHIDRA_CAST<uint8_t *>(0x0)) {
operator_delete(pbVar4,1);
}
pMVar6 = operator_new(0xf04);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 1;
if (pMVar6 == GHIDRA_CAST<ModEntry *>(0x0)) {
modEntry = GHIDRA_CAST<ModEntry *>(0x0);
}
else {
(GHIDRA_CAST<ModEntry *>((pMVar6)))->ModEntry::ModEntry();
modEntry = extraout_EAX;
}
ehState = (*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(ehState))) + 0x1))) << 8;
pMStack_100fc = modEntry;
if (piVar5 != GHIDRA_CAST<int *>(0x0)) {
fileSize = GHIDRA_CAST<ModEntry **>((**(code **)(*piVar5 + 4))());
pMStack_100e0 = operator_new_tracked(GHIDRA_INT(fileSize) + 1);
pbVar4 = GHIDRA_CAST<uint8_t *>(0x1);
ppMVar16 = fileSize;
(**(code **)(*piVar5 + 0x14))(pMStack_100e0);
(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMStack_100e0)) + 0x0))))[GHIDRA_INT(fileSize)] = 0;
(**(code **)*piVar5)(1);
xmlPool = xmlPoolBuffer;
xmlDoc = 0;
puStack_1009c = xmlPoolBuffer;
uStack_100cc = 0;
uStack_100c0 = 0;
uStack_100bc = 0;
puStack_10098 = &uStack_94;
uStack_94 = 0;
uStack_90 = 0;
ehState = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x1))),2);
docFirstNode = GHIDRA_CAST<uint32_t *>(0x0);
uStack_100b0 = 0;
pMStack_100d8 = pMStack_100e0;
if (((*GHIDRA_CAST<uint8_t *>(pMStack_100e0) == 0xef) && ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMStack_100e0)) + 0x1))) == -0x45)) &&
((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMStack_100e0)) + 0x2))) == -0x41)) {
pMStack_100d8 = GHIDRA_CAST<ModEntry *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMStack_100e0)) + 0x3))));
}
while( true ) {
bVar1 = (uint8_t)ppMVar16;
cVar2 = (&DAT_00b1b060)[*GHIDRA_CAST<uint8_t *>(pMStack_100d8)];
while (cVar2 != '\0') {
node = &(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMStack_100d8)) + 0x1)));
pMStack_100d8 = GHIDRA_CAST<ModEntry *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMStack_100d8)) + 0x1))));
cVar2 = (&DAT_00b1b060)[(uint8_t)*node];
}
if (*GHIDRA_CAST<uint8_t *>(pMStack_100d8) == 0) goto LAB_008f6571;
if (*GHIDRA_CAST<uint8_t *>(pMStack_100d8) != 0x3c) break;
pMStack_100d8 = GHIDRA_CAST<ModEntry *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMStack_100d8)) + 0x1))));
ppMVar16 = &pMStack_100d8;
pbVar4 = GHIDRA_CAST<uint8_t *>(0x8f650e);
node = GHIDRA_CAST<uint32_t *>(rapidxml)::xml_document::parse_node(ppMVar16);
if (node == GHIDRA_CAST<uint32_t *>(0x0)) {
}
else {
if (docFirstNode == GHIDRA_CAST<uint32_t *>(0x0)) {
node[10] = 0;
docFirstNode = node;
}
else {
node[10] = docLastNode;
docLastNode[0xb] = node;
}
node[4] = &xmlDoc;
node[0xb] = 0;
docLastNode = node;
}
}
g_xmlParseError = GHIDRA_CAST<uint8_t *>(s_expected_)<_00b1b66c;
LAB_008f6571:
pcVar13 = "metadata";
do {
pcVar15 = pcVar13;
pcVar13 = pcVar15 + 1;
} while (*pcVar13 != '\0');
pMStack_100d8 = GHIDRA_CAST<ModEntry *>((pcVar15 + -0xb76e9f));
node = docFirstNode;
if (docFirstNode != GHIDRA_CAST<uint32_t *>(0x0)) {
LAB_008f6596:
pbVar9 = GHIDRA_CAST<uint8_t *>(*node);
if (pbVar9 == GHIDRA_CAST<uint8_t *>(0x0)) {
pMVar6 = GHIDRA_CAST<ModEntry *>(0x0);
pbVar9 = &g_xmlNullStr;
}
else {
pMVar6 = GHIDRA_CAST<ModEntry *>(node[2]);
}
if (pMVar6 != pMStack_100d8) goto LAB_008f67da;
cmpEnd = pbVar9 + GHIDRA_INT(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x0))));
if (pbVar9 < cmpEnd) {
ptrDelta = GHIDRA_INT("metadata") - GHIDRA_INT(pbVar9);
while (*pbVar9 == pbVar9[ptrDelta]) {
pbVar9 = pbVar9 + 1;
if (cmpEnd <= pbVar9) goto LAB_008f65d0;
}
goto LAB_008f67da;
}
LAB_008f65d0:
pvVar7 = (GHIDRA_CAST<xml_node *>((node)))->xml_node::first_node(s_name,GHIDRA_INT(pbVar4),bVar1);
if (pvVar7 != (void *)0x0) {
pbVar4 = &g_xmlNullStr;
if (*GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pvVar7) + 4)) != GHIDRA_CAST<uint8_t *>(0x0)) {
pbVar4 = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pvVar7) + 4));
}
pMStack_100d8 = GHIDRA_CAST<ModEntry *>((pbVar4 + 1));
pbVar9 = pbVar4;
do {
bVar1 = *pbVar9;
pbVar9 = pbVar9 + 1;
} while (bVar1 != 0);
uVar14 = GHIDRA_INT(pbVar9) - GHIDRA_INT(pMStack_100d8);
(GHIDRA_CAST<msvc::string *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x18))))))->msvc::string::assign(pbVar4,uVar14);
bVar1 = (uint8_t)uVar14;
}
pvVar7 = (GHIDRA_CAST<xml_node *>((node)))->xml_node::first_node(GHIDRA_CAST<uint8_t *>("directory"),GHIDRA_INT(pbVar4),bVar1);
if (pvVar7 != (void *)0x0) {
pbVar4 = &g_xmlNullStr;
if (*GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pvVar7) + 4)) != GHIDRA_CAST<uint8_t *>(0x0)) {
pbVar4 = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pvVar7) + 4));
}
pbVar9 = pbVar4;
do {
bVar1 = *pbVar9;
pbVar9 = pbVar9 + 1;
} while (bVar1 != 0);
uVar14 = GHIDRA_INT(pbVar9) - GHIDRA_INT((pbVar4 + 1));
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(modEntry))))->msvc::string::assign(pbVar4,uVar14);
bVar1 = (uint8_t)uVar14;
}
pvVar7 = (GHIDRA_CAST<xml_node *>((node)))->xml_node::first_node(GHIDRA_CAST<uint8_t *>("description"),GHIDRA_INT(pbVar4),bVar1);
if (pvVar7 != (void *)0x0) {
pbVar4 = &g_xmlNullStr;
if (*GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pvVar7) + 4)) != GHIDRA_CAST<uint8_t *>(0x0)) {
pbVar4 = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pvVar7) + 4));
}
pMStack_100d8 = GHIDRA_CAST<ModEntry *>((pbVar4 + 1));
pbVar9 = pbVar4;
do {
bVar1 = *pbVar9;
pbVar9 = pbVar9 + 1;
} while (bVar1 != 0);
uVar14 = GHIDRA_INT(pbVar9) - GHIDRA_INT(pMStack_100d8);
(GHIDRA_CAST<msvc::string *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0xa8))))))->msvc::string::assign(pbVar4,uVar14);
bVar1 = (uint8_t)uVar14;
}
pvVar7 = (GHIDRA_CAST<xml_node *>((node)))->xml_node::first_node(GHIDRA_CAST<uint8_t *>("version"),GHIDRA_INT(pbVar4),bVar1);
if (pvVar7 != (void *)0x0) {
pbVar4 = &g_xmlNullStr;
if (*GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pvVar7) + 4)) != GHIDRA_CAST<uint8_t *>(0x0)) {
pbVar4 = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pvVar7) + 4));
}
pMStack_100d8 = GHIDRA_CAST<ModEntry *>((pbVar4 + 1));
pbVar9 = pbVar4;
do {
bVar1 = *pbVar9;
pbVar9 = pbVar9 + 1;
} while (bVar1 != 0);
uVar14 = GHIDRA_INT(pbVar9) - GHIDRA_INT(pMStack_100d8);
(GHIDRA_CAST<msvc::string *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x78))))))->msvc::string::assign(pbVar4,uVar14);
bVar1 = (uint8_t)uVar14;
}
pvVar7 = (GHIDRA_CAST<xml_node *>((node)))->xml_node::first_node(s_id,GHIDRA_INT(pbVar4),bVar1);
if (pvVar7 != (void *)0x0) {
pbVar4 = &g_xmlNullStr;
if (*GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pvVar7) + 4)) != GHIDRA_CAST<uint8_t *>(0x0)) {
pbVar4 = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pvVar7) + 4));
}
pMStack_100d8 = GHIDRA_CAST<ModEntry *>((pbVar4 + 1));
pbVar9 = pbVar4;
do {
bVar1 = *pbVar9;
pbVar9 = pbVar9 + 1;
} while (bVar1 != 0);
uVar14 = GHIDRA_INT(pbVar9) - GHIDRA_INT(pMStack_100d8);
(GHIDRA_CAST<msvc::string *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x90))))))->msvc::string::assign(pbVar4,uVar14);
bVar1 = (uint8_t)uVar14;
}
pvVar7 = (GHIDRA_CAST<xml_node *>((node)))->xml_node::first_node(GHIDRA_CAST<uint8_t *>("visibility"),GHIDRA_INT(pbVar4),bVar1);
if (pvVar7 != (void *)0x0) {
pbVar4 = &g_xmlNullStr;
if (*GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pvVar7) + 4)) != GHIDRA_CAST<uint8_t *>(0x0)) {
pbVar4 = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(pvVar7) + 4));
}
pMStack_100d8 = GHIDRA_CAST<ModEntry *>((pbVar4 + 1));
pbVar9 = pbVar4;
do {
bVar1 = *pbVar9;
pbVar9 = pbVar9 + 1;
} while (bVar1 != 0);
uVar14 = GHIDRA_INT(pbVar9) - GHIDRA_INT(pMStack_100d8);
(GHIDRA_CAST<msvc::string *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0xc0))))))->msvc::string::assign(pbVar4,uVar14);
bVar1 = (uint8_t)uVar14;
}
pMStack_100d8 = (GHIDRA_CAST<xml_node *>((node)))->xml_node::first_node(&DAT_00b6e3b4,GHIDRA_INT(pbVar4),bVar1);
if (pMStack_100d8 != GHIDRA_CAST<ModEntry *>(0x0)) {
LAB_008f67a0:
pMVar6 = modEntry;
pbVar4 = s_id;
do {
pbStack_100e4 = pbVar4;
pbVar4 = pbStack_100e4 + 1;
} while (*pbVar4 != 0);
pbStack_100e4 = pbStack_100e4 + -0xb1bfef;
for (node = *GHIDRA_CAST<uint32_t **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMStack_100d8)) + 0x20)))); node != GHIDRA_CAST<uint32_t *>(0x0);
node = GHIDRA_CAST<uint32_t *>(node[6])) {
pbVar4 = GHIDRA_CAST<uint8_t *>(*node);
if (pbVar4 == GHIDRA_CAST<uint8_t *>(0x0)) {
pbVar9 = GHIDRA_CAST<uint8_t *>(0x0);
pbVar4 = &g_xmlNullStr;
}
else {
pbVar9 = GHIDRA_CAST<uint8_t *>(node[2]);
}
if (pbVar9 == pbStack_100e4) {
pbVar9 = pbVar9 + GHIDRA_INT(pbVar4);
if (pbVar9 <= pbVar4) goto LAB_008f6921;
ptrDelta = GHIDRA_INT(s_id) - GHIDRA_INT(pbVar4);
while (*pbVar4 == pbVar4[ptrDelta]) {
pbVar4 = pbVar4 + 1;
if (pbVar9 <= pbVar4) goto LAB_008f6921;
}
}
}
node = GHIDRA_CAST<uint32_t *>(0x0);
LAB_008f6921:
if (node != GHIDRA_CAST<uint32_t *>(0x0)) {
pbVar4 = &g_xmlNullStr;
if (GHIDRA_CAST<uint8_t *>(node[1]) != GHIDRA_CAST<uint8_t *>(0x0)) {
pbVar4 = GHIDRA_CAST<uint8_t *>(node[1]);
}
tmpStringSize = 0;
tmpStringCapacity = 0xf;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x0))) = GHIDRA_CAST<uint8_t *>(0x0);
pbVar9 = pbVar4;
do {
bVar1 = *pbVar9;
pbVar9 = pbVar9 + 1;
} while (bVar1 != 0);
(GHIDRA_CAST<msvc::string *>((tmpString)))->msvc::string::assign(pbVar4,GHIDRA_INT(pbVar9) - GHIDRA_INT((pbVar4 + 1)));
newModState = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x0)));
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 3;
psVar10 = *GHIDRA_CAST<std_string **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0xdc))));
if (psVar10 == *GHIDRA_CAST<std_string **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0xe0))))) {
vector_string_emplace_reallocate_move
(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0xd8))),psVar10,GHIDRA_CAST<std_string *>(tmpString));
uVar14 = tmpStringCapacity;
}
else {
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x0))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x0))) & 0xffffff00;
*GHIDRA_CAST<uint32_t *>(psVar10->_buf) = newModState;
*GHIDRA_CAST<uint32_t *>((psVar10->_buf + 4)) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x4)));
*GHIDRA_CAST<uint32_t *>((psVar10->_buf + 8)) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x8)));
*GHIDRA_CAST<int *>((psVar10->_buf + 0xc)) = iStack_34;
psVar10->_size = tmpStringSize;
psVar10->_capacity = tmpStringCapacity;
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0xdc)))) = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0xdc)))) + 0x18;
uVar14 = 0xf;
}
ehState = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x1))),2);
if (0xf < uVar14) {
size = uVar14 + 1;
pbVar4 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<uint8_t *>(tmpString))) + 0x0)));
if (0xfff < size) {
pbVar4 = *GHIDRA_CAST<uint8_t **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x0))) + -4));
size = uVar14 + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x0))) + (-4 - GHIDRA_INT(pbVar4)))))
goto LAB_008f70a8;
}
operator_delete(pbVar4,size);
}
}
pcVar13 = "freeFn";
do {
pcVar15 = pcVar13;
pcVar13 = pcVar15 + 1;
} while (*pcVar13 != '\0');
pMStack_100d8 = *GHIDRA_CAST<ModEntry **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMStack_100d8)) + 0x2c))));
if (pMStack_100d8 != GHIDRA_CAST<ModEntry *>(0x0)) {
do {
pbVar4 = *GHIDRA_CAST<uint8_t **>(pMStack_100d8);
if (pbVar4 == GHIDRA_CAST<uint8_t *>(0x0)) {
pcVar13 = GHIDRA_CAST<char *>(0x0);
pbVar4 = &g_xmlNullStr;
}
else {
pcVar13 = *GHIDRA_CAST<char **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMStack_100d8)) + 0x8))));
}
if (pcVar13 == pcVar15 + -0xb6e3b3) {
pbVar9 = pbVar4 + GHIDRA_INT(pcVar13);
if (pbVar9 <= pbVar4) goto LAB_008f67a0;
ptrDelta = GHIDRA_INT(&DAT_00b6e3b4) - GHIDRA_INT(pbVar4);
while (*pbVar4 == pbVar4[ptrDelta]) {
pbVar4 = pbVar4 + 1;
if (pbVar9 <= pbVar4) goto LAB_008f67a0;
}
}
pMStack_100d8 = *GHIDRA_CAST<ModEntry **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMStack_100d8)) + 0x2c))));
if (pMStack_100d8 == GHIDRA_CAST<ModEntry *>(0x0)) break;
} while( true );
}
}
}
LAB_008f67e5:
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 4;
tracked_alloc(1,pMStack_100e0,0);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 5;
(GHIDRA_CAST<xml_memory_pool *>((&xmlPool)))->xml_memory_pool::clear();
ehState = (*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(ehState))) + 0x1))) << 8;
}
cStack_100d1 = '\0';
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x28)))) == 0) {
pbVar4 = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(dirEntries) + dirIndex * 8 + 4));
pbVar9 = pbVar4;
do {
bVar1 = *pbVar9;
pbVar9 = pbVar9 + 1;
} while (bVar1 != 0);
(GHIDRA_CAST<msvc::string *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x18))))))->msvc::string::assign(pbVar4,GHIDRA_INT(pbVar9) - GHIDRA_INT((pbVar4 + 1)));
cStack_100d1 = '\x01';
}
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x10)))) == 0) {
pbVar4 = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(dirEntries) + dirIndex * 8 + 4));
pbVar9 = pbVar4;
do {
bVar1 = *pbVar9;
pbVar9 = pbVar9 + 1;
} while (bVar1 != 0);
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(modEntry))))->msvc::string::assign(pbVar4,GHIDRA_INT(pbVar9) - GHIDRA_INT((pbVar4 + 1)));
cStack_100d1 = '\x01';
}
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x88)))) == 0) {
(GHIDRA_CAST<msvc::string *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x78))))))->msvc::string::assign(&DAT_00b76e84,3);
cStack_100d1 = '\x01';
}
if (*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x14)))) < 0x10) {
pMStack_100e0 = GHIDRA_CAST<ModEntry *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x0))) + *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x10))))));
pMVar6 = modEntry;
pMVar8 = modEntry;
if (0xf < *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x14))))) goto LAB_008f6a7e;
}
else {
pMStack_100e0 =
GHIDRA_CAST<ModEntry *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(((*GHIDRA_CAST<ModEntry **>(modEntry)))) + 0x0))) + *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x10))))));
pMVar8 = *GHIDRA_CAST<ModEntry **>(modEntry);
LAB_008f6a7e:
pMVar6 = *GHIDRA_CAST<ModEntry **>(modEntry);
}
if (pMVar6 != pMStack_100e0) {
ptrDelta = GHIDRA_INT(pMVar8) - GHIDRA_INT(pMVar6);
do {
bVar1 = (*tolowerFn)(GHIDRA_INT((char)*GHIDRA_CAST<uint8_t *>(pMVar6)));
*GHIDRA_CAST<uint8_t *>((ptrDelta + GHIDRA_INT(pMVar6))) = bVar1;
pMVar6 = GHIDRA_CAST<ModEntry *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x1))));
} while (pMVar6 != pMStack_100e0);
}
if (cStack_100d1 != '\0') {
(GHIDRA_CAST<ModEntry *>((modEntry)))->ModEntry::parse_metadata_xml();
}
pMVar6 = modEntry;
pcVar13 = &DAT_00c73228;
do {
pcVar15 = pcVar13;
pcVar13 = pcVar15 + 1;
} while (*pcVar15 != '\0');
psVar10 = GHIDRA_CAST<std_string *>((pcVar15 + -0xc73228));
if (GHIDRA_CAST<std_string *>((0x7fffffff - *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x10)))))) < psVar10)
goto LAB_008f70e6;
pMVar8 = modEntry;
if (0xf < *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x14))))) {
pMVar8 = *GHIDRA_CAST<ModEntry **>(modEntry);
}
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(modSaveDirTmp))))->msvc::string::concat(GHIDRA_INT(pbStack_100e4),psVar10,&DAT_00c73228,
GHIDRA_UINT(psVar10),GHIDRA_CAST<uint8_t *>(pMVar8),*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x10)))));
cleanupFlags = cleanupFlags | 1;
ehState = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x1))),6);
piVar5 = (GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(modSaveDirTmp))))->msvc::string::append(GHIDRA_CAST<uint8_t *>(&DAT_00b6db28),1);
node = &(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x60)));
pvStack_70 = (void *)*piVar5;
iStack_6c = piVar5[1];
uStack_68 = piVar5[2];
uStack_64 = piVar5[3];
saveDirSize = piVar5[4];
pbStack_100e4 = GHIDRA_CAST<uint8_t *>(piVar5[5]);
piVar5[4] = 0;
piVar5[5] = 0xf;
*GHIDRA_CAST<uint8_t *>(piVar5) = 0;
saveDirTmpSize = saveDirSize;
saveDirTmpCapacity = pbStack_100e4;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x8))) = pvStack_70;
iStack_34 = iStack_6c;
tmpStringSize = uStack_68;
tmpStringCapacity = uStack_64;
if ((void **)node == &pvStack_70) {
if (&DAT_0000000f < pbStack_100e4) {
pbVar4 = pbStack_100e4 + 1;
pvVar7 = pvStack_70;
if (GHIDRA_CAST<uint8_t *>(0xfff) < pbVar4) {
pvVar7 = *(void **)(GHIDRA_CAST<char *>(pvStack_70) + -4);
pbVar4 = pbStack_100e4 + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(pvStack_70) + (-4 - GHIDRA_INT(pvVar7))))) goto LAB_008f70a8;
}
operator_delete(pvVar7,GHIDRA_UINT(pbVar4));
}
}
else {
(GHIDRA_CAST<msvc::string *>((node)))->msvc::string::_Tidy_deallocate();
*GHIDRA_CAST<uint32_t *>(node) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x8)));
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x64)))) = iStack_34;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x68)))) = tmpStringSize;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x6c)))) = tmpStringCapacity;
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x70)))) = saveDirSize;
*GHIDRA_CAST<uint8_t **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x74)))) = pbStack_100e4;
}
ehState = ehState & 0xffffff00;
if (0xf < modSaveDirTmpCapacity) {
uVar14 = modSaveDirTmpCapacity + 1;
pvVar7 = modSaveDirTmp[0];
if (0xfff < uVar14) {
pvVar7 = *(void **)(GHIDRA_INT(modSaveDirTmp[0]) + -4);
uVar14 = modSaveDirTmpCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(modSaveDirTmp[0]) + (-4 - GHIDRA_INT(pvVar7))))) goto LAB_008f70a8;
}
operator_delete(pvVar7,uVar14);
}
pbStack_100e4 = *GHIDRA_CAST<uint8_t **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x74))));
if (pbStack_100e4 < GHIDRA_CAST<uint8_t *>(0x10)) {
pcVar15 = node + *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x70))));
puVar11 = node;
pcVar13 = node;
if (&DAT_0000000f < pbStack_100e4) goto LAB_008f6c13;
}
else {
pcVar15 = GHIDRA_CAST<char *>((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x70)))) + *GHIDRA_CAST<int *>(node)));
puVar11 = *GHIDRA_CAST<uint8_t **>(node);
LAB_008f6c13:
pcVar13 = *GHIDRA_CAST<char **>(node);
node = puVar11;
}
if (pcVar13 != pcVar15) {
pbStack_100e4 = node + -GHIDRA_INT(pcVar13);
do {
cVar2 = (*tolowerFn)(GHIDRA_INT(*pcVar13));
pcVar13[GHIDRA_INT(pbStack_100e4)] = cVar2;
pcVar13 = pcVar13 + 1;
} while (pcVar13 != pcVar15);
}
pbVar4 = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(dirEntries) + dirIndex * 8 + 4));
pbVar9 = pbVar4;
do {
bVar1 = *pbVar9;
pbVar9 = pbVar9 + 1;
} while (bVar1 != 0);
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(modEntry))))->msvc::string::assign(pbVar4,GHIDRA_INT(pbVar9) - GHIDRA_INT((pbVar4 + 1)));
if (*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x14)))) < 0x10) {
pMStack_100e0 = GHIDRA_CAST<ModEntry *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x0))) + *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x10))))));
pMVar6 = modEntry;
pMVar8 = modEntry;
if (0xf < *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x14))))) goto LAB_008f6c95;
}
else {
pMStack_100e0 =
GHIDRA_CAST<ModEntry *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(((*GHIDRA_CAST<ModEntry **>(modEntry)))) + 0x0))) + *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x10))))));
pMVar8 = *GHIDRA_CAST<ModEntry **>(modEntry);
LAB_008f6c95:
pMVar6 = *GHIDRA_CAST<ModEntry **>(modEntry);
}
if (pMVar6 != pMStack_100e0) {
ptrDelta = GHIDRA_INT(pMVar8) - GHIDRA_INT(pMVar6);
do {
bVar1 = (*tolowerFn)(GHIDRA_INT((char)*GHIDRA_CAST<uint8_t *>(pMVar6)));
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(pMVar6) + ptrDelta)) = bVar1;
pMVar6 = GHIDRA_CAST<ModEntry *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x1))));
} while (pMVar6 != pMStack_100e0);
}
if (0x7fffffffU - GHIDRA_INT(modPathSize) < 0xb) {
LAB_008f70e6:
/* WARNING: Subroutine does not return */
msvc::string::_Xlen();
}
pMVar6 = GHIDRA_CAST<ModEntry *>(modPath);
if (0xf < modPathCapacity) {
pMVar6 = modPath[0];
}
(GHIDRA_CAST<msvc::string *>((tmpString)))->msvc::string::concat(GHIDRA_INT(pbStack_100e4),modPathSize,GHIDRA_CAST<uint8_t *>(pMVar6),
GHIDRA_UINT(modPathSize),GHIDRA_CAST<uint8_t *>("/resources/"),0xb);
pMVar6 = modEntry;
node = &(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((modEntry)) + 0x30)));
if (node == tmpString) {
if (0xf < tmpStringCapacity) {
uVar14 = tmpStringCapacity + 1;
pbVar4 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<uint8_t *>(tmpString))) + 0x0)));
if (0xfff < uVar14) {
pbVar4 = *GHIDRA_CAST<uint8_t **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x0))) + -4));
uVar14 = tmpStringCapacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x0))) + (-4 - GHIDRA_INT(pbVar4))))) goto LAB_008f70a8;
}
operator_delete(pbVar4,uVar14);
}
}
else {
(GHIDRA_CAST<msvc::string *>((node)))->msvc::string::_Tidy_deallocate();
*GHIDRA_CAST<uint32_t *>(node) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x0)));
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x34)))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x4)));
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x38)))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x8)));
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x3c)))) = iStack_34;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x40)))) = tmpStringSize;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x44)))) = tmpStringCapacity;
}
if (0x7fffffffU - GHIDRA_INT(modPathSize) < 9) goto LAB_008f70e6;
pMVar8 = GHIDRA_CAST<ModEntry *>(modPath);
if (0xf < modPathCapacity) {
pMVar8 = modPath[0];
}
(GHIDRA_CAST<msvc::string *>((tmpString)))->msvc::string::concat(GHIDRA_INT(pbStack_100e4),modPathSize,GHIDRA_CAST<uint8_t *>(pMVar8),
GHIDRA_UINT(modPathSize),GHIDRA_CAST<uint8_t *>("/content/"),9);
node = &(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x48)));
if (node == tmpString) {
if (0xf < tmpStringCapacity) {
uVar14 = tmpStringCapacity + 1;
pbVar4 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<uint8_t *>(tmpString))) + 0x0)));
if (0xfff < uVar14) {
pbVar4 = *GHIDRA_CAST<uint8_t **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x0))) + -4));
uVar14 = tmpStringCapacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x0))) + (-4 - GHIDRA_INT(pbVar4))))) goto LAB_008f70a8;
}
operator_delete(pbVar4,uVar14);
}
}
else {
(GHIDRA_CAST<msvc::string *>((node)))->msvc::string::_Tidy_deallocate();
*GHIDRA_CAST<uint32_t *>(node) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x0)));
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x4c)))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x4)));
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x50)))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x8)));
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x54)))) = iStack_34;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x58)))) = tmpStringSize;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pMVar6)) + 0x5c)))) = tmpStringCapacity;
}
if (0x7fffffffU - GHIDRA_INT(modPathSize) < 0xb) goto LAB_008f70e6;
pMVar8 = GHIDRA_CAST<ModEntry *>(modPath);
if (0xf < modPathCapacity) {
pMVar8 = modPath[0];
}
(GHIDRA_CAST<msvc::string *>((tmpString)))->msvc::string::concat(GHIDRA_INT(pbStack_100e4),modPathSize,GHIDRA_CAST<uint8_t *>(pMVar8),
GHIDRA_UINT(modPathSize),GHIDRA_CAST<uint8_t *>("/disable.it"),0xb);
ehState = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x1))),7);
pbVar4 = tmpString;
if (0xf < tmpStringCapacity) {
pbVar4 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<uint8_t *>(tmpString))) + 0x0)));
}
pbVar4 = FileSystem::ResolvePath(pbVar4);
cStack_100d1 = pbVar4 != GHIDRA_CAST<uint8_t *>(0x0);
if (pbVar4 != GHIDRA_CAST<uint8_t *>(0x0)) {
if (g_mainHeap == (void *)0x0) {
allocatedBytes = &g_allocatedBytesNoHeap;
}
else {
allocatedBytes = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar14 = *GHIDRA_CAST<uint32_t *>((pbVar4 + -4));
prevAllocated = *allocatedBytes;
*GHIDRA_CAST<uint32_t *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar14;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevAllocated) < uVar14));
free(pbVar4 + -4);
}
ehState = ehState & 0xffffff00;
if (0xf < tmpStringCapacity) {
uVar14 = tmpStringCapacity + 1;
pbVar4 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<uint8_t *>(tmpString))) + 0x0)));
if (0xfff < uVar14) {
pbVar4 = *GHIDRA_CAST<uint8_t **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x0))) + -4));
uVar14 = tmpStringCapacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x0))) + (-4 - GHIDRA_INT(pbVar4))))) goto LAB_008f70a8;
}
operator_delete(pbVar4,uVar14);
}
tmpStringSize = 0;
tmpStringCapacity = 0xf;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x0))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tmpString)) + 0x0))) & 0xffffff00;
if (cStack_100d1 == '\0') {
bVar1 = (g_manager->_optionsConfig)._enableMods;
}
else {
bVar1 = 0;
}
pMVar6->_loaded = bVar1;
pMVar6->_enabled = cStack_100d1 == '\0';
if (0x7fffffffU - GHIDRA_INT(modPathSize) < 10) goto LAB_008f70e6;
pMVar8 = GHIDRA_CAST<ModEntry *>(modPath);
if (0xf < modPathCapacity) {
pMVar8 = modPath[0];
}
(GHIDRA_CAST<msvc::string *>((tmpString)))->msvc::string::concat(GHIDRA_INT(freeFn),modPathSize,GHIDRA_CAST<uint8_t *>(pMVar8),GHIDRA_UINT(modPathSize),
GHIDRA_CAST<uint8_t *>("/update.it"),10);
cleanupFlags = cleanupFlags | 0x3e;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 9;
pbVar4 = tmpString;
if (0xf < tmpStringCapacity) {
pbVar4 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<uint8_t *>(tmpString))) + 0x0)));
}
pbVar4 = FileSystem::ResolvePath(pbVar4);
cStack_100d1 = pbVar4 != GHIDRA_CAST<uint8_t *>(0x0);
if (pbVar4 != GHIDRA_CAST<uint8_t *>(0x0)) {
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 10;
tracked_alloc(1,pbVar4,0);
}
ehState = (*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(ehState))) + 0x1))) << 8;
(GHIDRA_CAST<msvc::string *>((tmpString)))->msvc::string::_Tidy_deallocate();
if (cStack_100d1 != '\0') {
pMVar6->_enabled = 0;
pMVar6->_loaded = 0;
*GHIDRA_CAST<uint8_t *>((pMVar6 + 1)) = 1;
}
ptrDelta = enabledModCount + 1;
if (pMVar6->_loaded == 0) {
ptrDelta = enabledModCount;
}
node = *GHIDRA_CAST<uint32_t **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1))));
if (node == *GHIDRA_CAST<uint32_t **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[2])) + 0x2))))) {
msvc::vector<4byte>::_Emplace_reallocate(node,&pMStack_100fc);
}
else {
*node = pMVar6;
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1)))) = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1)))) + 4;
}
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("LOADED MOD %s\n"));
ehState = 0xffffffff;
if (0xf < modPathCapacity) {
uVar14 = modPathCapacity + 1;
pMVar6 = modPath[0];
if (0xfff < uVar14) {
pMVar6 = *GHIDRA_CAST<ModEntry **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(modPath[0][-1])) + 0xfa))));
uVar14 = modPathCapacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(modPath[0]) + (-4 - GHIDRA_INT(pMVar6))))) {
LAB_008f70a8:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pMVar6,uVar14);
}
pvVar7 = dirEntries;
enabledModCount = ptrDelta;
}
dirIndex = dirIndex + 1;
} while (dirIndex < dirEntryCount);
}
if (dirEntries != (void *)0x0) {
ptr = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(dirEntries) + -4));
ehState = 0xb;
_eh_vector_destructor_iterator_(dirEntries,8,*ptr,FUN_00a5a420);
operator_delete(ptr,*ptr * 8 + 4);
ehState = 0xffffffff;
}
msvc::_Sort_unchecked(*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1)))) - *GHIDRA_CAST<int *>(this) >> 2,FUN_008f6190,uVar3);
ptrDelta = *GHIDRA_CAST<int *>((this + 0xab74));
if (ptrDelta != 3) {
if (enabledModCount == 0) {
if ((ptrDelta == 2) || (newModState = 1, ptrDelta == 4)) {
newModState = 4;
}
*GHIDRA_CAST<uint32_t *>((this + 0xab74)) = newModState;
}
else {
*GHIDRA_CAST<uint32_t *>((this + 0xab74)) = 2;
}
}
ExceptionList = savedExceptionList;
return;
LAB_008f67da:
node = GHIDRA_CAST<uint32_t *>(node[0xb]);
if (node == GHIDRA_CAST<uint32_t *>(0x0)) goto LAB_008f67e5;
goto LAB_008f6596;
}
// 008f73f0
void ModManager::TriggerResize()
{
FUN_008f7dd0();
unload_shaders(this);
LoadShaders(this);
create_shader_render_targets(this);
return;
}
// 008f7c40
void ModManager::create_shader_render_targets()
{
int *piVar1;
uint32_t uVar2;
char cVar3;
uint32_t uVar4;
uint8_t *name;
void *newTarget;
uint32_t *extraout_EAX;
int *shaderNode;
int *modSlot;
KColor clearColor;
uint8_t createdTarget [4];
int *createdTargetRefCount;
uint8_t tmpTarget [4];
int *tmpTargetRefCount;
ModManager *modManager;
uint32_t *shaderTarget;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
local_8 = 0xffffffff;
puStack_c = &LAB_00b079dd;
local_10 = ExceptionList;
uVar4 = __security_cookie ^ GHIDRA_UINT((tmpTarget + 0x1c));
ExceptionList = &local_10;
modSlot = *GHIDRA_CAST<int **>(this);
modManager = this;
if (modSlot != *GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1))))) {
do {
if ((*GHIDRA_CAST<char *>((*modSlot + 0xfd)) != '\0') &&
(piVar1 = *GHIDRA_CAST<int **>((*modSlot + 0xe4)), shaderNode = GHIDRA_CAST<int *>(*piVar1), shaderNode != piVar1)) {
do {
name = GHIDRA_CAST<uint8_t *>(shaderNode[2]);
if (*GHIDRA_CAST<int *>((name + 0x68)) == 0) {
clearColor._unk = 0;
clearColor._red = 0.0;
clearColor._green = 0.0;
clearColor._blue = 0.0;
clearColor._alpha = 0.0;
if (0xf < *GHIDRA_CAST<uint32_t *>((name + 0x14))) {
name = *GHIDRA_CAST<uint8_t **>(name);
}
newTarget = KAGE_Graphics::create_render_target
(createdTarget,g_framebufferWidth,DAT_00c79114,name,&clearColor);
local_8 = 0;
shaderTarget = GHIDRA_CAST<uint32_t *>((shaderNode[2] + 0x68));
(GHIDRA_CAST<shared_ptr *>((tmpTarget)))->shared_ptr::assign(newTarget);
uVar2 = extraout_EAX[1];
extraout_EAX[1] = shaderTarget[1];
shaderTarget[1] = uVar2;
uVar2 = *extraout_EAX;
*extraout_EAX = *shaderTarget;
*shaderTarget = uVar2;
local_8 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),1);
if (((tmpTargetRefCount != GHIDRA_CAST<int *>(0x0)) &&
(cVar3 = (**(code **)(*tmpTargetRefCount + 0xc))(uVar4), cVar3 != '\0')) &&
(g_renderTargetReleaseFn != (void *)0x0)) {
(*g_renderTargetReleaseFn)(tmpTarget);
}
local_8 = 2;
if (((createdTargetRefCount != GHIDRA_CAST<int *>(0x0)) &&
(cVar3 = (**(code **)(*createdTargetRefCount + 0xc))(), cVar3 != '\0')) &&
(g_renderTargetReleaseFn != (void *)0x0)) {
(*g_renderTargetReleaseFn)(createdTarget);
}
local_8 = 0xffffffff;
piVar1 = *GHIDRA_CAST<int **>((shaderNode[2] + 0x68));
if ((piVar1[0xe] != 1) || (piVar1[0xf] != 1)) {
(**(code **)(*piVar1 + 0x48))(1,1);
piVar1[0xe] = 1;
piVar1[0xf] = 1;
}
}
shaderNode = GHIDRA_CAST<int *>(*shaderNode);
} while (shaderNode != GHIDRA_CAST<int *>(*GHIDRA_CAST<int *>((*modSlot + 0xe4))));
}
modSlot = modSlot + 1;
} while (modSlot != *GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(modManager[1])) + 0x1)))));
}
ExceptionList = local_10;
return;
}
// 008f7e20
void ModManager::unload_shaders()
{
char *this_00;
char isLastRef;
uint32_t uVar1;
uint64_t *allocCounter;
int iVar2;
void *mainHeap;
uint32_t uVar3;
int *shaderNode;
int *modIter;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
uint32_t *allocHeader;
uint32_t blockSize;
uint32_t *listNode;
uint32_t *nextNode;
uint64_t oldBytes;
int *uniformMap;
local_8 = 0xffffffff;
puStack_c = &LAB_00b07a00;
local_10 = ExceptionList;
uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
ExceptionList = &local_10;
modIter = *GHIDRA_CAST<int **>(this);
if (modIter != *GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1))))) {
do {
iVar2 = *modIter;
if (*GHIDRA_CAST<char *>((iVar2 + 0xfd)) != '\0') {
shaderNode = GHIDRA_CAST<int *>(**GHIDRA_CAST<int **>((iVar2 + 0xe4)));
if (shaderNode != *GHIDRA_CAST<int **>((iVar2 + 0xe4))) {
do {
KAGE::SmartPointer<RenderTargetBase>::reset(shaderNode[2] + 0x68);
(**(code **)(*GHIDRA_CAST<int *>((shaderNode[2] + 0x18)) + 4))(uVar1);
iVar2 = shaderNode[2];
uVar3 = 5;
mainHeap = g_mainHeap;
if (5 < *GHIDRA_CAST<int *>((iVar2 + 0x74)) + 5U) {
do {
iVar2 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar2 + 0x7c)) + uVar3 * 8));
allocCounter = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(mainHeap) + 0x30));
if (mainHeap == (void *)0x0) {
allocCounter = &g_allocatedBytesNoHeap;
}
if (iVar2 != 0) {
allocHeader = GHIDRA_CAST<uint32_t *>((iVar2 + -4));
blockSize = *allocHeader;
oldBytes = *allocCounter;
*GHIDRA_CAST<uint32_t *>(allocCounter) = GHIDRA_UINT(*allocCounter) - blockSize;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocCounter) + 4)) =
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldBytes) < blockSize));
free(allocHeader);
mainHeap = g_mainHeap;
}
iVar2 = shaderNode[2];
uVar3 = uVar3 + 1;
} while (uVar3 < *GHIDRA_CAST<int *>((iVar2 + 0x74)) + 5U);
}
iVar2 = *GHIDRA_CAST<int *>((iVar2 + 0x7c));
if (mainHeap == (void *)0x0) {
allocCounter = &g_allocatedBytesNoHeap;
}
else {
allocCounter = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(mainHeap) + 0x30));
}
if (iVar2 != 0) {
uVar3 = *GHIDRA_CAST<uint32_t *>((iVar2 + -4));
oldBytes = *allocCounter;
*GHIDRA_CAST<uint32_t *>(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar3;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocCounter) + 4)) =
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldBytes) < uVar3));
free((void *)(iVar2 + -4));
}
local_8 = 0xffffffff;
this_00 = GHIDRA_CAST<char *>(shaderNode[2]);
if (this_00 != GHIDRA_CAST<char *>(0x0)) {
uniformMap = GHIDRA_CAST<int *>((this_00 + 0x70));
FUN_004235c0(uniformMap,*GHIDRA_CAST<uint32_t *>((*uniformMap + 4)));
operator_delete((void *)*uniformMap,0x2c);
local_8 = 2;
if (((*GHIDRA_CAST<int **>((this_00 + 0x6c)) != GHIDRA_CAST<int *>(0x0)) &&
(isLastRef = (**(code **)(**GHIDRA_CAST<int **>((this_00 + 0x6c)) + 0xc))(), isLastRef != '\0')
) && (g_renderTargetReleaseFn != (void *)0x0)) {
(*g_renderTargetReleaseFn)(this_00 + 0x68);
}
local_8 = 0xffffffff;
*GHIDRA_CAST<uint8_t ***>((this_00 + 0x18)) = KAGE::Graphics::ShaderBase::vftable;
(GHIDRA_CAST<KAGE::Graphics::ShaderBase *>((this_00 + 0x18)))->KAGE::Graphics::ShaderBase::free_uniforms();
FID_conflict__Tidy(this_00 + 0x58);
FUN_00a15310();
(GHIDRA_CAST<msvc::string *>((this_00)))->msvc::string::_Tidy_deallocate();
operator_delete(this_00,0x80);
}
iVar2 = *modIter;
shaderNode = GHIDRA_CAST<int *>(*shaderNode);
} while (shaderNode != GHIDRA_CAST<int *>(*GHIDRA_CAST<int *>((iVar2 + 0xe4))));
}
listNode = *GHIDRA_CAST<uint32_t **>((iVar2 + 0xe4));
*GHIDRA_CAST<uint32_t *>(listNode[1]) = 0;
listNode = GHIDRA_CAST<uint32_t *>(*listNode);
while (listNode != GHIDRA_CAST<uint32_t *>(0x0)) {
nextNode = GHIDRA_CAST<uint32_t *>(*listNode);
operator_delete(listNode,0xc);
listNode = nextNode;
}
*GHIDRA_CAST<uint32_t *>(*GHIDRA_CAST<uint32_t *>((iVar2 + 0xe4))) = *GHIDRA_CAST<uint32_t *>((iVar2 + 0xe4));
*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar2 + 0xe4)) + 4)) = *GHIDRA_CAST<int *>((iVar2 + 0xe4));
*GHIDRA_CAST<uint32_t *>((iVar2 + 0xe8)) = 0;
}
modIter = modIter + 1;
} while (modIter != *GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1)))));
}
ExceptionList = local_10;
return;
}
// 008f8040
void ModManager::LoadModRooms(int stageId, int mode)
{
char isInserted;
RoomSet *text;
uint32_t *appendedPath;
uint8_t *ptr;
std_string *psVar1;
uint32_t *puVar2;
uint32_t *oldRoom;
uint32_t length;
void *pvVar3;
uint32_t uVar4;
int *piVar5;
int roomOffset;
RoomSet *this_00;
uint32_t *puVar6;
int magic;
uint32_t *puStack_b4;
RoomSet *roomSet;
int roomCount;
int *modIt;
int *file;
uint32_t roomIndex;
uint32_t *puStack_9c;
int savedStageId;
char isPathFound;
RoomConfig_Stage *local_90;
uint32_t uStack_8c;
int savedMode;
void *displayName [5];
uint32_t uStack_70;
void *fileName;
char acStack_68 [4];
char acStack_64 [4];
char acStack_60 [4];
uint32_t uStack_5c;
uint32_t uStack_58;
void *baseName [4];
uint32_t uStack_44;
uint32_t uStack_40;
std_string *contentPath [5];
uint32_t uStack_28;
uint32_t local_24;
uint8_t *puStack_20;
void *local_1c;
uint8_t *puStack_18;
void *local_14;
puStack_20 = GHIDRA_CAST<uint8_t *>((baseName + 0x14));
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xff;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))) = 0xffffff;
puStack_18 = &LAB_00b07a78;
local_1c = ExceptionList;
local_24 = __security_cookie ^ GHIDRA_UINT((baseName + 0x11));
ExceptionList = &local_1c;
savedStageId = stageId;
savedMode = mode;
if ((g_game != GHIDRA_CAST<Game *>(0x0)) && (modIt = *GHIDRA_CAST<int **>(this), modIt != *GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1)))))) {
do {
piVar5 = modIt;
if (*GHIDRA_CAST<char *>((*modIt + 0xfd)) != '\0') {
local_90 = GHIDRA_CAST<RoomConfig_Stage *>((g_game->_ventricleRazorPortals + stageId * 0xc4 + 0x598));
this_00 = GHIDRA_CAST<RoomSet *>((mode * 0x2c + 100 + GHIDRA_INT(local_90)));
roomSet = this_00;
(GHIDRA_CAST<RoomConfigStage *>((local_90)))->RoomConfigStage::GetDisplayName(GHIDRA_CAST<std_string *>(displayName),0x14);
local_14 = (void *)0x0;
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("[ModManager] load stage %d: %s (mode %d)\n"));
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xff;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))) = 0xffffff;
if (0xf < uStack_70) {
uVar4 = uStack_70 + 1;
pvVar3 = displayName[0];
if (0xfff < uVar4) {
pvVar3 = *(void **)(GHIDRA_INT(displayName[0]) + -4);
uVar4 = uStack_70 + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(displayName[0]) + (-4 - GHIDRA_INT(pvVar3))))) goto LAB_008f868f;
}
operator_delete(pvVar3,uVar4);
}
local_90 = GHIDRA_CAST<RoomConfig_Stage *>(*piVar5);
uVar4 = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this_00[5])) + 0x1))));
uStack_44 = 0;
uStack_40 = 0xf;
baseName[0] = (void *)0x0;
length = uVar4 - 3;
if (uVar4 < uVar4 - 3) {
length = uVar4;
}
text = this_00;
if (0xf < *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this_00[6])) + 0x2))))) {
text = *GHIDRA_CAST<RoomSet **>(this_00);
}
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(baseName))))->msvc::string::assign(GHIDRA_CAST<uint8_t *>(text),length);
local_14 = (void *)0x1;
appendedPath = (GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(baseName))))->msvc::string::append(&UNK_00b6cb40,3);
fileName = (void *)*appendedPath;
acStack_68 = (char [4])appendedPath[1];
acStack_64 = (char [4])appendedPath[2];
acStack_60 = (char [4])appendedPath[3];
uStack_5c = appendedPath[4];
uStack_58 = appendedPath[5];
appendedPath[4] = 0;
appendedPath[5] = 0xf;
*GHIDRA_CAST<uint8_t *>(appendedPath) = 0;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
(GHIDRA_CAST<Mod *>((local_90)))->Mod::GetContentPath(GHIDRA_CAST<std_string *>(contentPath),GHIDRA_CAST<std_string *>(&fileName));
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 4;
if (0xf < uStack_58) {
uVar4 = uStack_58 + 1;
pvVar3 = fileName;
if (0xfff < uVar4) {
pvVar3 = *(void **)(GHIDRA_CAST<char *>(fileName) + -4);
uVar4 = uStack_58 + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(fileName) + (-4 - GHIDRA_INT(pvVar3))))) goto LAB_008f868f;
}
operator_delete(pvVar3,uVar4);
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 5;
if (0xf < uStack_40) {
uVar4 = uStack_40 + 1;
pvVar3 = baseName[0];
if (0xfff < uVar4) {
pvVar3 = *(void **)(GHIDRA_INT(baseName[0]) + -4);
uVar4 = uStack_40 + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(baseName[0]) + (-4 - GHIDRA_INT(pvVar3))))) goto LAB_008f868f;
}
operator_delete(pvVar3,uVar4);
}
uStack_44 = 0;
psVar1 = GHIDRA_CAST<std_string *>(contentPath);
if (0xf < uStack_28) {
psVar1 = contentPath[0];
}
uStack_40 = 0xf;
baseName[0] = (void *)(GHIDRA_UINT(baseName[0]) & 0xffffff00);
ptr = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(psVar1));
isPathFound = ptr != GHIDRA_CAST<uint8_t *>(0x0);
if (ptr != GHIDRA_CAST<uint8_t *>(0x0)) {
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 6;
tracked_alloc(1,ptr,0);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 5;
}
if (isPathFound != '\0') {
psVar1 = GHIDRA_CAST<std_string *>(contentPath);
if (0xf < uStack_28) {
psVar1 = contentPath[0];
}
file = (GHIDRA_CAST<FileSystem *>((&PTR_vftable_00c37a10)))->FileSystem::Open(GHIDRA_CAST<uint8_t *>(psVar1),GHIDRA_CAST<int *>(0x0));
if (file == GHIDRA_CAST<int *>(0x0)) {
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("[ModManager] Failed to open room config files %s!\n"));
}
else {
(**(code **)(*file + 0x14))(&magic,1,4);
if (magic != 0x31425453) {
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("[ModManager] bad room config header in %s!\n"));
if (uStack_28 < 0x10) {
ExceptionList = local_1c;
return;
}
uVar4 = uStack_28 + 1;
psVar1 = contentPath[0];
if (uVar4 < 0x1000) {
LAB_008f8695:
operator_delete(psVar1,uVar4);
ExceptionList = local_1c;
return;
}
psVar1 = GHIDRA_CAST<std_string *>(contentPath[0][-1]._capacity);
uVar4 = uStack_28 + 0x24;
if (GHIDRA_CAST<uint8_t *>((GHIDRA_INT(contentPath[0]) + (-4 - GHIDRA_INT(psVar1)))) < GHIDRA_CAST<uint8_t *>(0x20))
goto LAB_008f8695;
goto LAB_008f868f;
}
roomIndex = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this_00[9])) + 0x1))));
(**(code **)(*file + 0x14))(&roomCount,4,1);
if (roomCount == 0) {
uStack_8c = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this_00[9])) + 0x1))));
}
else {
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("reallocate %d rooms.\n"));
puStack_b4 = GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this_00[9])) + 0x1)))) + roomCount));
local_90 = GHIDRA_CAST<RoomConfig_Stage *>(0x0);
uVar4 = -GHIDRA_UINT((GHIDRA_INT((ZEXT48(puStack_b4) * 0x5c >> 0x20)) != 0)) |
GHIDRA_UINT((ZEXT48(puStack_b4) * 0x5c));
uStack_8c = GHIDRA_UINT(puStack_b4);
puStack_9c = operator_new_tracked(-GHIDRA_UINT((0xfffffffb < uVar4)) | uVar4 + 4);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 7;
if (puStack_9c == GHIDRA_CAST<uint32_t *>(0x0)) {
puStack_9c = GHIDRA_CAST<uint32_t *>(0x0);
}
else {
*puStack_9c = uStack_8c;
puStack_9c = puStack_9c + 1;
_eh_vector_constructor_iterator_
(puStack_9c,0x5c,uStack_8c,GHIDRA_CAST<_func_void_void_ptr *>(&UNK_00828b20),
RoomConfigRoom::dtor);
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 5;
oldRoom = *GHIDRA_CAST<uint32_t **>((this_00 + 8));
puStack_b4 = oldRoom + *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this_00[9])) + 0x1)))) * 0x17;
if (oldRoom != puStack_b4) {
local_90 = GHIDRA_CAST<RoomConfig_Stage *>((puStack_9c + 2));
puVar6 = oldRoom + 10;
do {
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_90) + -8)) = *oldRoom;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_90) + -4)) = puVar6[-9];
*GHIDRA_CAST<uint32_t *>(local_90) = puVar6[-8];
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_90) + 4)) = puVar6[-7];
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_90) + 8)) = puVar6[-6];
if (GHIDRA_CAST<uint32_t *>((GHIDRA_INT(local_90) + 0xc)) != puVar6 + -5) {
puVar2 = puVar6 + -5;
if (0xf < *puVar6) {
puVar2 = GHIDRA_CAST<uint32_t *>(*puVar2);
}
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((GHIDRA_INT(local_90) + 0xc)))))->msvc::string::assign(GHIDRA_CAST<uint8_t *>(puVar2),puVar6[-1]);
}
oldRoom = oldRoom + 0x17;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_90) + 0x24)) = puVar6[1];
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_90) + 0x28)) = puVar6[2];
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_90) + 0x2c)) = puVar6[3];
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_90) + 0x30)) = puVar6[4];
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_90) + 0x34)) = puVar6[5];
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_90) + 0x38)) = puVar6[6];
*GHIDRA_CAST<short *>((GHIDRA_CAST<char *>(local_90) + 0x3c)) = (short)puVar6[7];
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(local_90) + 0x3e)) = *GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(puVar6) + 0x1e));
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(local_90) + 0x3f)) = *GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(puVar6) + 0x1f));
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_90) + 0x40)) = puVar6[8];
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_90) + 0x44)) = puVar6[9];
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_90) + 0x48)) = puVar6[10];
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_90) + 0x4c)) = puVar6[0xb];
puVar2 = puVar6 + 0xc;
puVar6 = puVar6 + 0x17;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_90) + 0x50)) = *puVar2;
local_90 = GHIDRA_CAST<RoomConfig_Stage *>((GHIDRA_INT(local_90) + 0x5c));
} while (oldRoom != puStack_b4);
oldRoom = *GHIDRA_CAST<uint32_t **>((roomSet + 8));
piVar5 = modIt;
this_00 = roomSet;
}
if (oldRoom != GHIDRA_CAST<uint32_t *>(0x0)) {
puVar6 = oldRoom + -1;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 8;
_eh_vector_destructor_iterator_(oldRoom,0x5c,*puVar6,RoomConfigRoom::dtor);
operator_delete(puVar6,*puVar6 * 0x5c + 4);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 5;
this_00 = roomSet;
}
*GHIDRA_CAST<uint32_t **>((this_00 + 8)) = puStack_9c;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this_00[9])) + 0x1)))) = uStack_8c;
}
if (roomIndex < uStack_8c) {
roomOffset = roomIndex * 0x5c;
do {
RoomConfig::ReadRoom(this_00,roomIndex,savedStageId,file);
*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((this_00 + 8)) + 4 + roomOffset)) = savedMode;
puStack_9c = RoomSet::GetVariantSet
(this_00,*GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>((this_00 + 8)) + 8 + roomOffset)));
uStack_8c = *GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>((this_00 + 8)) + 0xc + roomOffset));
isInserted = VariantRanges::Insert(uStack_8c);
if (isInserted == '\0') {
uVar4 = *puStack_9c;
piVar5 = *GHIDRA_CAST<int **>((uVar4 + 8));
if ((piVar5 == GHIDRA_CAST<int *>(0x0)) || (*piVar5 + 2 != *GHIDRA_CAST<int *>((uVar4 + 4)))) {
*GHIDRA_CAST<int *>((uVar4 + 4)) = *GHIDRA_CAST<int *>((uVar4 + 4)) + 1;
uStack_8c = *GHIDRA_CAST<uint32_t *>((*puStack_9c + 4));
}
else {
uStack_8c = *piVar5 + 1;
*GHIDRA_CAST<int *>((uVar4 + 8)) = piVar5[2];
*GHIDRA_CAST<int *>((*puStack_9c + 4)) = piVar5[1];
operator_delete(piVar5,0xc);
}
}
*GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>((this_00 + 8)) + 0xc + roomOffset)) = uStack_8c;
roomOffset = roomOffset + 0x5c;
roomIndex = roomIndex + 1;
} while (roomIndex < *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this_00[9])) + 0x1)))));
piVar5 = modIt;
}
(**(code **)*file)(1);
}
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0xff;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))) = 0xffffff;
if (0xf < uStack_28) {
uVar4 = uStack_28 + 1;
psVar1 = contentPath[0];
if (0xfff < uVar4) {
psVar1 = GHIDRA_CAST<std_string *>(contentPath[0][-1]._capacity);
uVar4 = uStack_28 + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(contentPath[0]) + (-4 - GHIDRA_INT(psVar1))))) {
LAB_008f868f:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(psVar1,uVar4);
}
stageId = savedStageId;
mode = savedMode;
}
modIt = piVar5 + 1;
} while (modIt != *GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1)))));
}
ExceptionList = local_1c;
return;
}
// 008f86c0
void ModManager::LoadModCurses()
{
uint8_t *resolvedPath;
std_string *psVar1;
int *in_ECX;
void *resolvedPath;
uint32_t uVar2;
uint32_t *modIt;
std_string fileName;
std_string *contentPath [5];
uint32_t contentPathCapacity;
uint32_t local_14;
void *local_10;
uint8_t *puStack_c;
std_string *local_8;
puStack_c = &LAB_00b07ac5;
local_10 = ExceptionList;
local_14 = __security_cookie ^ GHIDRA_UINT((contentPath + 10));
ExceptionList = &local_10;
if ((g_game != GHIDRA_CAST<Game *>(0x0)) && (modIt = GHIDRA_CAST<uint32_t *>(*in_ECX), modIt != GHIDRA_CAST<uint32_t *>(in_ECX[1])))
{
do {
if (*GHIDRA_CAST<char *>((GHIDRA_INT(*modIt) + 0xfd)) != '\0') {
fileName._capacity = 0xf;
fileName._size = 10;
builtin_strncpy(fileName._buf,"curses.xml",0xb);
local_8 = GHIDRA_CAST<std_string *>(0x0);
(GHIDRA_CAST<Mod *>(((void *)*modIt)))->Mod::GetContentPath(GHIDRA_CAST<std_string *>(contentPath),&fileName);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 2;
if (0xf < fileName._capacity) {
uVar2 = fileName._capacity + 1;
resolvedPath = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)fileName._buf)) + 0x0)));
if (0xfff < uVar2) {
resolvedPath = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(fileName._buf)) + 0x0))) + -4);
uVar2 = fileName._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(fileName._buf)) + 0x0))) + (-4 - GHIDRA_INT(resolvedPath))))) goto LAB_008f884d;
}
operator_delete(resolvedPath,uVar2);
}
psVar1 = GHIDRA_CAST<std_string *>(contentPath);
if (0xf < contentPathCapacity) {
psVar1 = contentPath[0];
}
resolvedPath = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(psVar1));
if (resolvedPath != GHIDRA_CAST<uint8_t *>(0x0)) {
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 3;
tracked_alloc(1,resolvedPath,0);
local_8 = GHIDRA_CAST<std_string *>(CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),2));
psVar1 = GHIDRA_CAST<std_string *>(contentPath);
if (0xf < contentPathCapacity) {
psVar1 = contentPath[0];
}
(GHIDRA_CAST<RoomConfig *>((&g_game->_roomConfig)))->RoomConfig::LoadCursesXml(GHIDRA_CAST<uint8_t *>(psVar1),1);
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 0xff;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))) = 0xffffff;
if (0xf < contentPathCapacity) {
uVar2 = contentPathCapacity + 1;
psVar1 = contentPath[0];
if (0xfff < uVar2) {
psVar1 = GHIDRA_CAST<std_string *>(contentPath[0][-1]._capacity);
uVar2 = contentPathCapacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(contentPath[0]) + (-4 - GHIDRA_INT(psVar1))))) {
LAB_008f884d:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(psVar1,uVar2);
}
}
modIt = modIt + 1;
} while (modIt != GHIDRA_CAST<uint32_t *>(in_ECX[1]));
}
ExceptionList = local_10;
return;
}
// 008f8a60
void ModManager::RenderCustomGameOver(int playerType, Vector *position)
{
uint8_t bVar1;
uint8_t *currentAnimChar;
uint32_t uVar2;
void *unused;
std_string *nameChar;
void *pvVar3;
EntityConfig_Player *playerConfig;
bool isLess;
std_string *displayName;
void *displayNameText [4];
uint32_t displayNameTextSize;
uint32_t displayNameTextCapacity;
uint32_t local_14;
void *local_10;
uint8_t *puStack_c;
void *local_8;
uint8_t *animData;
ANM2 *gameOverAnm;
local_8 = (void *)0xffffffff;
puStack_c = &LAB_00aff10d;
local_10 = ExceptionList;
local_14 = __security_cookie ^ GHIDRA_UINT((displayNameText + 10));
if (playerType < 0) {
return;
}
pvVar3 = (g_manager->_entityConfig)._players._begin;
unused = (void *)(GHIDRA_INT((g_manager->_entityConfig)._players._end) - GHIDRA_INT(pvVar3));
if (GHIDRA_INT(unused) / 0x148 <= playerType) {
return;
}
playerConfig = GHIDRA_CAST<EntityConfig_Player *>((playerType * 0x148 + GHIDRA_INT(pvVar3)));
if (playerConfig == GHIDRA_CAST<EntityConfig_Player *>(0x0)) {
return;
}
gameOverAnm = playerConfig->_moddedGameOverANM2;
if (gameOverAnm == GHIDRA_CAST<ANM2 *>(0x0)) {
return;
}
ExceptionList = &local_10;
displayName = EntityConfig_Player::GetDisplayName
(playerConfig,GHIDRA_CAST<std_string *>(displayNameText),unused);
local_8 = (void *)0x0;
if (0xf < displayName->_capacity) {
displayName = *GHIDRA_CAST<std_string **>(displayName->_buf);
}
animData = (gameOverAnm->_animState)._animData;
if (animData != GHIDRA_CAST<uint8_t *>(0x0)) {
currentAnimChar = animData;
nameChar = displayName;
if (0xf < *GHIDRA_CAST<uint32_t *>((animData + 0x14))) {
currentAnimChar = *GHIDRA_CAST<uint8_t **>(animData);
}
do {
bVar1 = *currentAnimChar;
isLess = bVar1 < (uint8_t)nameChar->_buf[0];
if (bVar1 != nameChar->_buf[0]) {
LAB_008f8b40:
uVar2 = -GHIDRA_UINT(isLess) | 1;
goto LAB_008f8b45;
}
if (bVar1 == 0) break;
bVar1 = currentAnimChar[1];
isLess = bVar1 < (uint8_t)nameChar->_buf[1];
if (bVar1 != nameChar->_buf[1]) goto LAB_008f8b40;
currentAnimChar = currentAnimChar + 2;
nameChar = GHIDRA_CAST<std_string *>((nameChar->_buf + 2));
} while (bVar1 != 0);
uVar2 = 0;
LAB_008f8b45:
if ((uVar2 == 0) && ((animData[0x34] == 0 || ((gameOverAnm->_animState)._isPlaying != 0))))
goto LAB_008f8b70;
}
bVar1 = (GHIDRA_CAST<ANM2 *>((gameOverAnm)))->ANM2::SetAnimation(GHIDRA_CAST<uint8_t *>(displayName),1);
if (bVar1 != 0) {
(GHIDRA_CAST<AnimationState *>((&gameOverAnm->_animState)))->AnimationState::Rewind();
(gameOverAnm->_animState)._isPlaying = 1;
}
LAB_008f8b70:
local_8 = (void *)0xffffffff;
if (0xf < displayNameTextCapacity) {
uVar2 = displayNameTextCapacity + 1;
pvVar3 = displayNameText[0];
if (0xfff < uVar2) {
pvVar3 = *(void **)(GHIDRA_INT(displayNameText[0]) + -4);
uVar2 = displayNameTextCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(displayNameText[0]) + (-4 - GHIDRA_INT(pvVar3))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pvVar3,uVar2);
}
displayNameTextSize = 0;
displayNameTextCapacity = 0xf;
displayNameText[0] = (void *)(GHIDRA_UINT(displayNameText[0]) & 0xffffff00);
(GHIDRA_CAST<ANM2 *>((playerConfig->_moddedGameOverANM2)))->ANM2::Render(position,&g_vectorZero,&g_vectorZero);
ExceptionList = local_10;
return;
}
// 008f8c00
void ModManager::Reset()
{
void *this_00;
Game *pGVar1;
uint32_t uVar2;
uint32_t uVar3;
this_00 = g_luaEngine;
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("Lua is resetting!\n"));
(GHIDRA_CAST<LuaEngine *>((this_00)))->LuaEngine::destroy();
(GHIDRA_CAST<LuaEngine *>((this_00)))->LuaEngine::Init(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(this_00) + 0x1c)));
if (DAT_00c79860 != 0) {
*GHIDRA_CAST<uint32_t *>((this + 0xab74)) = 3;
}
FUN_008f5960();
ListMods(this);
LoadShaders(this);
Manager::unload_configs();
LoadModContent(this);
if (g_menuManager != GHIDRA_CAST<MenuManager *>(0x0)) {
pause_screen_unload_sprites();
AnmCache::Clear();
FUN_00954710();
(GHIDRA_CAST<Menu_Character *>((&g_menuManager->_menuCharacter)))->Menu_Character::Reset();
Menu_Collection::reset();
}
if (g_game != GHIDRA_CAST<Game *>(0x0)) {
uVar3 = 0;
uVar2 = 0;
pGVar1 = g_game;
do {
if (uVar3 < 0x25) {
RoomConfig_Stage::unload
(GHIDRA_CAST<RoomConfig_Stage *>((pGVar1->_ventricleRazorPortals + uVar2 + 0x598)));
pGVar1 = g_game;
}
uVar2 = uVar2 + 0xc4;
uVar3 = uVar3 + 1;
} while (uVar2 < 0x1c54);
}
return;
}
// 008f8d00
void ModManager::RenderCustomCharacterMenu(int characterId, Vector *renderPos, Sprite *defaultSprite)
{
uint8_t bVar1;
uint8_t *pbVar2;
uint32_t uVar3;
void *unused;
void *extraout_ECX;
std_string *psVar4;
void *pvVar5;
ANM2 *menuSprite;
EntityConfig_Player *playerConfig;
bool isLess;
std_string *displayName;
void *displayNameStr [4];
uint32_t displayNameSize;
uint32_t displayNameCapacity;
uint32_t local_18;
void *local_10;
uint8_t *puStack_c;
void *local_8;
uint8_t *animData;
local_8 = (void *)0xffffffff;
puStack_c = &LAB_00af85cd;
local_10 = ExceptionList;
local_18 = __security_cookie ^ GHIDRA_UINT((displayNameStr + 0xb));
ExceptionList = &local_10;
if (characterId < 0) {
LAB_008f8e9e:
(GHIDRA_CAST<Sprite *>((defaultSprite)))->Sprite::RenderLayer(0,renderPos,&g_vectorZero,&g_vectorZero);
ExceptionList = local_10;
return;
}
pvVar5 = (g_manager->_entityConfig)._players._begin;
unused = (void *)(GHIDRA_INT((g_manager->_entityConfig)._players._end) - GHIDRA_INT(pvVar5));
if (((GHIDRA_INT(unused) / 0x148 <= characterId) ||
(playerConfig = GHIDRA_CAST<EntityConfig_Player *>((characterId * 0x148 + GHIDRA_INT(pvVar5))),
playerConfig == GHIDRA_CAST<EntityConfig_Player *>(0x0))) ||
(menuSprite = playerConfig->_moddedMenuBackgroundANM2, menuSprite == GHIDRA_CAST<ANM2 *>(0x0)))
goto LAB_008f8e9e;
if (playerConfig->_renderCustomBackground == 0) {
(GHIDRA_CAST<Sprite *>((defaultSprite)))->Sprite::RenderLayer(0,renderPos,&g_vectorZero,&g_vectorZero);
menuSprite = playerConfig->_moddedMenuBackgroundANM2;
unused = extraout_ECX;
}
displayName = EntityConfig_Player::GetDisplayName
(playerConfig,GHIDRA_CAST<std_string *>(displayNameStr),unused);
local_8 = (void *)0x0;
if (0xf < displayName->_capacity) {
displayName = *GHIDRA_CAST<std_string **>(displayName->_buf);
}
animData = (menuSprite->_animState)._animData;
if (animData != GHIDRA_CAST<uint8_t *>(0x0)) {
pbVar2 = animData;
psVar4 = displayName;
if (0xf < *GHIDRA_CAST<uint32_t *>((animData + 0x14))) {
pbVar2 = *GHIDRA_CAST<uint8_t **>(animData);
}
do {
bVar1 = *pbVar2;
isLess = bVar1 < (uint8_t)psVar4->_buf[0];
if (bVar1 != psVar4->_buf[0]) {
LAB_008f8e05:
uVar3 = -GHIDRA_UINT(isLess) | 1;
goto LAB_008f8e0a;
}
if (bVar1 == 0) break;
bVar1 = pbVar2[1];
isLess = bVar1 < (uint8_t)psVar4->_buf[1];
if (bVar1 != psVar4->_buf[1]) goto LAB_008f8e05;
pbVar2 = pbVar2 + 2;
psVar4 = GHIDRA_CAST<std_string *>((psVar4->_buf + 2));
} while (bVar1 != 0);
uVar3 = 0;
LAB_008f8e0a:
if ((uVar3 == 0) && ((animData[0x34] == 0 || ((menuSprite->_animState)._isPlaying != 0))))
goto LAB_008f8e35;
}
bVar1 = (GHIDRA_CAST<ANM2 *>((menuSprite)))->ANM2::SetAnimation(GHIDRA_CAST<uint8_t *>(displayName),1);
if (bVar1 != 0) {
(GHIDRA_CAST<AnimationState *>((&menuSprite->_animState)))->AnimationState::Rewind();
(menuSprite->_animState)._isPlaying = 1;
}
LAB_008f8e35:
local_8 = (void *)0xffffffff;
if (0xf < displayNameCapacity) {
uVar3 = displayNameCapacity + 1;
pvVar5 = displayNameStr[0];
if (0xfff < uVar3) {
pvVar5 = *(void **)(GHIDRA_INT(displayNameStr[0]) + -4);
uVar3 = displayNameCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(displayNameStr[0]) + (-4 - GHIDRA_INT(pvVar5))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pvVar5,uVar3);
}
displayNameSize = 0;
displayNameCapacity = 0xf;
displayNameStr[0] = (void *)(GHIDRA_UINT(displayNameStr[0]) & 0xffffff00);
(GHIDRA_CAST<ANM2 *>((playerConfig->_moddedMenuBackgroundANM2)))->ANM2::Render(renderPos,&g_vectorZero,&g_vectorZero);
ExceptionList = local_10;
return;
}
// 008f9f40
void ModManager::add_mod_entry(std_string *name, std_string *dir, std_string *path)
{
uint32_t *puVar1;
uint8_t *resolvedPath;
uint8_t ****ppppbVar2;
uint32_t *unfinishedFile;
void *pvVar3;
uint32_t uVar4;
uint32_t isMetadataMissing;
void *entryName [4];
uint32_t entryNameSize;
uint32_t entryNameCapacity;
void *entryDir [4];
uint32_t entryDirSize;
uint32_t entryDirCapacity;
void *entryPath [4];
uint32_t entryPathSize;
uint32_t entryPathCapacity;
uint8_t isDisabled;
uint8_t ****disablePath [4];
uint32_t disablePathSize;
uint32_t disablePathCapacity;
uint8_t ****metadataPath [4];
uint32_t metadataPathSize;
uint32_t metadataPathCapacity;
uint8_t ****unfinishedPath [4];
uint32_t unfinishedPathSize;
uint32_t unfinishedPathCapacity;
uint8_t ****modPath [4];
std_string *modPathSize;
uint32_t modPathCapacity;
uint32_t local_14;
void *local_10;
uint8_t *puStack_c;
uint8_t ***local_8;
local_8 = GHIDRA_CAST<uint8_t ***>(0xffffffff);
puStack_c = &LAB_00b07c40;
local_10 = ExceptionList;
local_14 = __security_cookie ^ GHIDRA_UINT((modPath + 10));
ExceptionList = &local_10;
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(modPath))))->msvc::string::string(path);
entryNameSize = 0;
entryNameCapacity = 0xf;
entryName[0] = (void *)0x0;
entryDirSize = 0;
entryDirCapacity = 0xf;
entryDir[0] = (void *)0x0;
entryPathSize = 0;
entryPathCapacity = 0xf;
entryPath[0] = (void *)0x0;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 1;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))) = 0;
if (GHIDRA_CAST<std_string *>(entryName) != name) {
puVar1 = &name->_size;
if (0xf < name->_capacity) {
name = *GHIDRA_CAST<std_string **>(name->_buf);
}
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(entryName))))->msvc::string::assign(GHIDRA_CAST<uint8_t *>(name),*puVar1);
}
if (GHIDRA_CAST<std_string *>(entryDir) != dir) {
puVar1 = &dir->_size;
if (0xf < dir->_capacity) {
dir = *GHIDRA_CAST<std_string **>(dir->_buf);
}
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(entryDir))))->msvc::string::assign(GHIDRA_CAST<uint8_t *>(dir),*puVar1);
}
ppppbVar2 = GHIDRA_CAST<uint8_t ****>(modPath);
if (0xf < modPathCapacity) {
ppppbVar2 = modPath[0];
}
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(entryPath))))->msvc::string::assign(GHIDRA_CAST<uint8_t *>(ppppbVar2),GHIDRA_UINT(modPathSize));
if (0x7fffffffU - GHIDRA_INT(modPathSize) < 0xb) {
LAB_008fa37c:
/* WARNING: Subroutine does not return */
msvc::string::_Xlen();
}
ppppbVar2 = GHIDRA_CAST<uint8_t ****>(modPath);
if (0xf < modPathCapacity) {
ppppbVar2 = modPath[0];
}
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(disablePath))))->msvc::string::concat(GHIDRA_INT(this),modPathSize,GHIDRA_CAST<uint8_t *>(ppppbVar2),GHIDRA_UINT(modPathSize),
GHIDRA_CAST<uint8_t *>("/disable.it"),0xb);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 2;
ppppbVar2 = GHIDRA_CAST<uint8_t ****>(disablePath);
if (0xf < disablePathCapacity) {
ppppbVar2 = disablePath[0];
}
resolvedPath = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(ppppbVar2));
isDisabled = resolvedPath != GHIDRA_CAST<uint8_t *>(0x0);
if (resolvedPath != GHIDRA_CAST<uint8_t *>(0x0)) {
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 3;
tracked_alloc(1,resolvedPath,0);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 2;
}
if (0x7fffffffU - GHIDRA_INT(modPathSize) < 0xd) goto LAB_008fa37c;
ppppbVar2 = GHIDRA_CAST<uint8_t ****>(modPath);
if (0xf < modPathCapacity) {
ppppbVar2 = modPath[0];
}
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(metadataPath))))->msvc::string::concat(GHIDRA_INT(this),modPathSize,GHIDRA_CAST<uint8_t *>(ppppbVar2),GHIDRA_UINT(modPathSize)
,GHIDRA_CAST<uint8_t *>("/metadata.xml"),0xd);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 4;
ppppbVar2 = GHIDRA_CAST<uint8_t ****>(metadataPath);
if (0xf < metadataPathCapacity) {
ppppbVar2 = metadataPath[0];
}
resolvedPath = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(ppppbVar2));
if (resolvedPath != GHIDRA_CAST<uint8_t *>(0x0)) {
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 5;
tracked_alloc(1,resolvedPath,0);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 4;
}
isMetadataMissing = resolvedPath != GHIDRA_CAST<uint8_t *>(0x0) ^ 1;
if (0x7fffffffU - GHIDRA_INT(modPathSize) < 0xe) goto LAB_008fa37c;
ppppbVar2 = GHIDRA_CAST<uint8_t ****>(modPath);
if (0xf < modPathCapacity) {
ppppbVar2 = modPath[0];
}
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(unfinishedPath))))->msvc::string::concat(GHIDRA_INT(this),modPathSize,GHIDRA_CAST<uint8_t *>(ppppbVar2),
GHIDRA_UINT(modPathSize),GHIDRA_CAST<uint8_t *>("/unfinished.it"),0xe);
local_8 = GHIDRA_CAST<uint8_t ***>(CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),6));
ppppbVar2 = GHIDRA_CAST<uint8_t ****>(unfinishedPath);
if (0xf < unfinishedPathCapacity) {
ppppbVar2 = unfinishedPath[0];
}
unfinishedFile = (GHIDRA_CAST<SaveDataManager *>((&PTR_vftable_00c5aa80)))->SaveDataManager::open_file_write(GHIDRA_CAST<uint8_t *>(ppppbVar2),0);
if (unfinishedFile != GHIDRA_CAST<uint32_t *>(0x0)) {
(**(code **)*unfinishedFile)(1);
}
FUN_008fc5b0(&isMetadataMissing);
if (0xf < unfinishedPathCapacity) {
uVar4 = unfinishedPathCapacity + 1;
ppppbVar2 = unfinishedPath[0];
if (0xfff < uVar4) {
ppppbVar2 = GHIDRA_CAST<uint8_t ****>(unfinishedPath[0][-1]);
uVar4 = unfinishedPathCapacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(unfinishedPath[0]) + (-4 - GHIDRA_INT(ppppbVar2)))))
goto LAB_008fa34e;
}
operator_delete(ppppbVar2,uVar4);
}
unfinishedPathSize = 0;
unfinishedPathCapacity = 0xf;
unfinishedPath[0] = GHIDRA_CAST<uint8_t ****>((GHIDRA_UINT(unfinishedPath[0]) & 0xffffff00));
if (0xf < metadataPathCapacity) {
uVar4 = metadataPathCapacity + 1;
ppppbVar2 = metadataPath[0];
if (0xfff < uVar4) {
ppppbVar2 = GHIDRA_CAST<uint8_t ****>(metadataPath[0][-1]);
uVar4 = metadataPathCapacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(metadataPath[0]) + (-4 - GHIDRA_INT(ppppbVar2))))) goto LAB_008fa34e;
}
operator_delete(ppppbVar2,uVar4);
}
metadataPathSize = 0;
metadataPathCapacity = 0xf;
metadataPath[0] = GHIDRA_CAST<uint8_t ****>((GHIDRA_UINT(metadataPath[0]) & 0xffffff00));
if (0xf < disablePathCapacity) {
uVar4 = disablePathCapacity + 1;
ppppbVar2 = disablePath[0];
if (0xfff < uVar4) {
ppppbVar2 = GHIDRA_CAST<uint8_t ****>(disablePath[0][-1]);
uVar4 = disablePathCapacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(disablePath[0]) + (-4 - GHIDRA_INT(ppppbVar2))))) goto LAB_008fa34e;
}
operator_delete(ppppbVar2,uVar4);
}
disablePathSize = 0;
disablePathCapacity = 0xf;
disablePath[0] = GHIDRA_CAST<uint8_t ****>((GHIDRA_UINT(disablePath[0]) & 0xffffff00));
if (0xf < entryPathCapacity) {
uVar4 = entryPathCapacity + 1;
pvVar3 = entryPath[0];
if (0xfff < uVar4) {
pvVar3 = *(void **)(GHIDRA_INT(entryPath[0]) + -4);
uVar4 = entryPathCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(entryPath[0]) + (-4 - GHIDRA_INT(pvVar3))))) goto LAB_008fa34e;
}
operator_delete(pvVar3,uVar4);
}
if (0xf < entryDirCapacity) {
uVar4 = entryDirCapacity + 1;
pvVar3 = entryDir[0];
if (0xfff < uVar4) {
pvVar3 = *(void **)(GHIDRA_INT(entryDir[0]) + -4);
uVar4 = entryDirCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(entryDir[0]) + (-4 - GHIDRA_INT(pvVar3))))) goto LAB_008fa34e;
}
operator_delete(pvVar3,uVar4);
}
if (0xf < entryNameCapacity) {
uVar4 = entryNameCapacity + 1;
pvVar3 = entryName[0];
if (0xfff < uVar4) {
pvVar3 = *(void **)(GHIDRA_INT(entryName[0]) + -4);
uVar4 = entryNameCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(entryName[0]) + (-4 - GHIDRA_INT(pvVar3))))) goto LAB_008fa34e;
}
operator_delete(pvVar3,uVar4);
}
if (0xf < modPathCapacity) {
uVar4 = modPathCapacity + 1;
ppppbVar2 = modPath[0];
if (0xfff < uVar4) {
ppppbVar2 = GHIDRA_CAST<uint8_t ****>(modPath[0][-1]);
uVar4 = modPathCapacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(modPath[0]) + (-4 - GHIDRA_INT(ppppbVar2))))) {
LAB_008fa34e:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(ppppbVar2,uVar4);
}
ExceptionList = local_10;
return;
}
// 008fa390
void ModManager::UpdateWorkshopMods()
{
uint16_t *puVar1;
uint8_t *puVar2;
uint8_t bVar3;
std_string *psVar4;
int iVar5;
uint8_t *pbVar6;
int ****ppppiVar7;
int ****ppppiVar8;
uint32_t *markerFile;
uint8_t ****ppppbVar9;
LPCSTR ***ppppCVar10;
char *statusKey;
int ****ppppiVar11;
LPCSTR ***ppppCVar12;
uint32_t uVar13;
uint64_t *allocCounter;
int ****ppppiVar14;
int entriesBegin;
int ****ppppiVar15;
int *in_stack_00000004;
_SHFILEOPSTRUCTA deleteOp;
_SHFILEOPSTRUCTA fileOp;
int *workshopEntries;
uint32_t entryIdx;
uint8_t *local_2a8;
int ****modDirString;
char isUnfinishedExists;
int ****local_29c;
int ****local_298;
LPCSTR ***local_294;
int ****local_290;
uint8_t ****markerPath [5];
uint32_t markerPathCapacity;
uint8_t ****unfinishedPath [4];
uint32_t unfinishedPathSize;
uint32_t unfinishedPathCapacity;
int ****sourcePath;
int ***pppiStack_258;
int ***pppiStack_254;
int ***pppiStack_250;
int ****sourcePathSize;
int ****sourcePathCapacity;
LPCSTR ***uninstallPath;
int ***pppiStack_240;
int ***pppiStack_23c;
int ***pppiStack_238;
int ****uninstallPathSize;
int ****uninstallPathCapacity;
int ****modPath;
int ***pppiStack_228;
int ***pppiStack_224;
int ***pppiStack_220;
int ****modPathSize;
int ****modPathCapacity;
uint8_t uninstallingText [256];
uint8_t installingText [256];
uint32_t stackCookie;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
uint64_t allocatedBytes;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 0xff;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))) = 0xffffff;
puStack_c = &LAB_00b07cb7;
local_10 = ExceptionList;
stackCookie = __security_cookie ^ GHIDRA_UINT((installingText + 0x110));
ExceptionList = &local_10;
workshopEntries = in_stack_00000004;
entryIdx = 0;
entriesBegin = *in_stack_00000004;
iVar5 = in_stack_00000004[1] - entriesBegin >> 0x1f;
if ((in_stack_00000004[1] - entriesBegin) / 0x50 + iVar5 != iVar5) {
do {
ppppiVar15 = GHIDRA_CAST<int ****>((entryIdx * 0x50 + entriesBegin));
local_29c = ppppiVar15;
if (*ppppiVar15 == GHIDRA_CAST<int ***>(0x2)) {
pbVar6 = string_table_translate(&g_manager->_stringTablePc,GHIDRA_CAST<uint8_t *>("#MOD_UNINSTALLING"));
sprintf_s(uninstallingText,0x100,pbVar6);
pbVar6 = uninstallingText;
do {
bVar3 = *pbVar6;
pbVar6 = pbVar6 + 1;
} while (bVar3 != 0);
(GHIDRA_CAST<msvc::string *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((g_manager)) + 0x4a6dc))))))->msvc::string::assign(uninstallingText,
GHIDRA_INT(pbVar6) - GHIDRA_INT((uninstallingText + 1)));
local_29c = GHIDRA_CAST<int ****>(ppppiVar15[0xb]);
ppppiVar14 = ppppiVar15 + 7;
uninstallPath = GHIDRA_CAST<LPCSTR ***>(0x0);
uninstallPathSize = GHIDRA_CAST<int ****>(0x0);
uninstallPathCapacity = GHIDRA_CAST<int ****>(0x0);
if (GHIDRA_CAST<int ***>(0xf) < ppppiVar15[0xc]) {
ppppiVar14 = GHIDRA_CAST<int ****>(*ppppiVar14);
}
if (&DAT_0000000f < local_29c) {
ppppiVar15 = GHIDRA_CAST<int ****>((GHIDRA_UINT(local_29c) | 0xf));
if (GHIDRA_CAST<int ****>(0x7fffffff) < ppppiVar15) {
ppppiVar15 = GHIDRA_CAST<int ****>(0x7fffffff);
}
uninstallPath = msvc::_Allocate(GHIDRA_UINT((GHIDRA_INT(ppppiVar15) + 1)));
memcpy(uninstallPath,ppppiVar14,(size_t)(GHIDRA_INT(local_29c) + 1));
uninstallPathCapacity = ppppiVar15;
}
else {
uninstallPath = GHIDRA_CAST<LPCSTR ***>(*ppppiVar14);
pppiStack_240 = ppppiVar14[1];
pppiStack_23c = ppppiVar14[2];
pppiStack_238 = ppppiVar14[3];
uninstallPathCapacity = GHIDRA_CAST<int ****>(&DAT_0000000f);
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 6;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))) = 0;
uninstallPathSize = local_29c;
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(&uninstallPath))))->msvc::string::append(&DAT_00b76eac,1);
ppppiVar11 = GHIDRA_CAST<int ****>(0x0);
ppppCVar12 = uninstallPath;
ppppiVar15 = uninstallPathSize;
ppppiVar14 = uninstallPathCapacity;
if (uninstallPathSize != GHIDRA_CAST<int ****>(0x0)) {
do {
ppppCVar10 = GHIDRA_CAST<LPCSTR ***>(&uninstallPath);
if (&DAT_0000000f < ppppiVar14) {
ppppCVar10 = ppppCVar12;
}
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(ppppCVar10) + GHIDRA_INT(ppppiVar11))) == '/') {
ppppCVar10 = GHIDRA_CAST<LPCSTR ***>(&uninstallPath);
if (&DAT_0000000f < ppppiVar14) {
ppppCVar10 = ppppCVar12;
}
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(ppppCVar10) + GHIDRA_INT(ppppiVar11))) = 0x5c;
ppppCVar12 = uninstallPath;
ppppiVar15 = uninstallPathSize;
ppppiVar14 = uninstallPathCapacity;
}
ppppiVar11 = GHIDRA_CAST<int ****>((GHIDRA_INT(ppppiVar11) + 1));
} while (ppppiVar11 < ppppiVar15);
}
if (ppppiVar15 < ppppiVar14) {
uninstallPathSize = GHIDRA_CAST<int ****>((GHIDRA_INT(ppppiVar15) + 1));
ppppCVar10 = GHIDRA_CAST<LPCSTR ***>(&uninstallPath);
if (&DAT_0000000f < ppppiVar14) {
ppppCVar10 = ppppCVar12;
}
*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(ppppCVar10) + GHIDRA_INT(ppppiVar15))) = 0;
}
else {
if (ppppiVar15 == GHIDRA_CAST<int ****>(0x7fffffff)) goto LAB_008fb119;
local_290 = GHIDRA_CAST<int ****>((GHIDRA_UINT((GHIDRA_INT(ppppiVar15) + 1)) | 0xf));
if (local_290 < GHIDRA_CAST<int ****>(0x80000000)) {
if (GHIDRA_CAST<int ****>((0x7fffffff - (GHIDRA_UINT(ppppiVar14) >> 1))) < ppppiVar14) {
local_290 = GHIDRA_CAST<int ****>(0x7fffffff);
}
else {
ppppiVar11 = GHIDRA_CAST<int ****>((GHIDRA_INT(ppppiVar14) + (GHIDRA_UINT(ppppiVar14) >> 1)));
if (local_290 < ppppiVar11) {
local_290 = ppppiVar11;
}
}
}
else {
local_290 = GHIDRA_CAST<int ****>(0x7fffffff);
}
local_294 = msvc::_Allocate(GHIDRA_UINT((GHIDRA_INT(local_290) + 1)));
ppppCVar12 = uninstallPath;
uninstallPathSize = GHIDRA_CAST<int ****>((GHIDRA_INT(ppppiVar15) + 1));
uninstallPathCapacity = local_290;
local_29c = GHIDRA_CAST<int ****>((GHIDRA_INT(local_294) + GHIDRA_INT(ppppiVar15)));
local_298 = GHIDRA_CAST<int ****>((GHIDRA_CAST<uint8_t *>((GHIDRA_INT(ppppiVar15) + 1)) + GHIDRA_INT(local_294)));
if (ppppiVar14 < GHIDRA_CAST<int ****>(0x10)) {
memcpy(local_294,&uninstallPath,(size_t)ppppiVar15);
*GHIDRA_CAST<uint8_t *>(local_29c) = 0;
*GHIDRA_CAST<uint8_t *>(local_298) = 0;
}
else {
memcpy(local_294,uninstallPath,(size_t)ppppiVar15);
ppppiVar15 = GHIDRA_CAST<int ****>((GHIDRA_INT(ppppiVar14) + 1));
*GHIDRA_CAST<uint8_t *>(local_29c) = 0;
*GHIDRA_CAST<uint8_t *>(local_298) = 0;
ppppCVar10 = ppppCVar12;
if (GHIDRA_CAST<int ****>(0xfff) < ppppiVar15) {
ppppCVar10 = GHIDRA_CAST<LPCSTR ***>(ppppCVar12[-1]);
ppppiVar15 = ppppiVar14 + 9;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(ppppCVar12) + (-4 - GHIDRA_INT(ppppCVar10)))))
goto LAB_008fb113;
}
operator_delete(ppppCVar10,GHIDRA_UINT(ppppiVar15));
}
uninstallPath = local_294;
}
deleteOp.hwnd = (HWND)0x0;
deleteOp.wFunc = 0;
deleteOp.pFrom = (LPCSTR)0x0;
deleteOp.pTo = (LPCSTR)0x0;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(deleteOp)) + 0x18))) = 0;
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(deleteOp)) + 0x10))) = 0;
(*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(&(deleteOp.lpszProgressTitle)) + 0x2))) = 0;
if (_glfw == 0) {
_glfwInputError(0x10001,0);
deleteOp.hwnd = (HWND)0x0;
}
else if (DAT_00c73694 == 0x60001) {
deleteOp.hwnd = *GHIDRA_CAST<HWND *>((GHIDRA_CAST<char *>(g_glfwWindow) + 0x2b4));
}
else {
_glfwInputError(0x1000e,"Win32: Platform not initialized");
deleteOp.hwnd = (HWND)0x0;
}
deleteOp.fFlags = 0x614;
deleteOp.pFrom = (LPCSTR)&uninstallPath;
if (&DAT_0000000f < uninstallPathCapacity) {
deleteOp.pFrom = (LPCSTR)uninstallPath;
}
deleteOp.wFunc = 3;
SHFileOperationA(&deleteOp);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 0xff;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))) = 0xffffff;
if (&DAT_0000000f < uninstallPathCapacity) {
ppppiVar15 = GHIDRA_CAST<int ****>((GHIDRA_INT(uninstallPathCapacity) + 1));
ppppCVar12 = uninstallPath;
if (GHIDRA_CAST<int ****>(0xfff) < ppppiVar15) {
ppppCVar12 = GHIDRA_CAST<LPCSTR ***>(uninstallPath[-1]);
ppppiVar15 = uninstallPathCapacity + 9;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(uninstallPath) + (-4 - GHIDRA_INT(ppppCVar12)))))
goto LAB_008fb113;
}
operator_delete(ppppCVar12,GHIDRA_UINT(ppppiVar15));
}
uninstallPathSize = GHIDRA_CAST<int ****>(0x0);
uninstallPathCapacity = GHIDRA_CAST<int ****>(&DAT_0000000f);
uninstallPath = GHIDRA_CAST<LPCSTR ***>((GHIDRA_UINT(uninstallPath) & 0xffffff00));
}
else {
statusKey = "#MOD_INSTALLING";
if (*ppppiVar15 != GHIDRA_CAST<int ***>(0x1)) {
statusKey = "#MOD_UPDATING";
}
pbVar6 = string_table_translate(&g_manager->_stringTablePc,GHIDRA_CAST<uint8_t *>(statusKey));
sprintf_s(installingText,0x100,pbVar6);
pbVar6 = installingText;
do {
bVar3 = *pbVar6;
pbVar6 = pbVar6 + 1;
} while (bVar3 != 0);
(GHIDRA_CAST<msvc::string *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((g_manager)) + 0x4a6dc))))))->msvc::string::assign(installingText,
GHIDRA_INT(pbVar6) - GHIDRA_INT((installingText + 1)));
local_290 = GHIDRA_CAST<int ****>(ppppiVar15[0xb]);
ppppiVar14 = ppppiVar15 + 7;
sourcePath = GHIDRA_CAST<int ****>(0x0);
sourcePathSize = GHIDRA_CAST<int ****>(0x0);
sourcePathCapacity = GHIDRA_CAST<int ****>(0x0);
if (GHIDRA_CAST<int ***>(0xf) < ppppiVar15[0xc]) {
ppppiVar14 = GHIDRA_CAST<int ****>(*ppppiVar14);
}
if (&DAT_0000000f < local_290) {
ppppiVar15 = GHIDRA_CAST<int ****>((GHIDRA_UINT(local_290) | 0xf));
if (GHIDRA_CAST<int ****>(0x7fffffff) < ppppiVar15) {
ppppiVar15 = GHIDRA_CAST<int ****>(0x7fffffff);
}
sourcePath = msvc::_Allocate(GHIDRA_UINT((GHIDRA_INT(ppppiVar15) + 1)));
memcpy(sourcePath,ppppiVar14,(size_t)(GHIDRA_INT(local_290) + 1));
sourcePathSize = local_290;
sourcePathCapacity = ppppiVar15;
}
else {
sourcePath = GHIDRA_CAST<int ****>(*ppppiVar14);
pppiStack_258 = ppppiVar14[1];
pppiStack_254 = ppppiVar14[2];
pppiStack_250 = ppppiVar14[3];
sourcePathCapacity = GHIDRA_CAST<int ****>(&DAT_0000000f);
sourcePathSize = local_290;
}
modDirString = local_29c + 0xd;
local_8 = 0;
modPath = GHIDRA_CAST<int ****>(0x0);
modPathSize = GHIDRA_CAST<int ****>(0x0);
modPathCapacity = GHIDRA_CAST<int ****>(0x0);
ppppiVar15 = GHIDRA_CAST<int ****>(local_29c[0x11]);
local_290 = modDirString;
if (GHIDRA_CAST<int ***>(0xf) < local_29c[0x12]) {
local_290 = GHIDRA_CAST<int ****>(*modDirString);
}
if (&DAT_0000000f < ppppiVar15) {
ppppiVar14 = GHIDRA_CAST<int ****>((GHIDRA_UINT(ppppiVar15) | 0xf));
if (GHIDRA_CAST<int ****>(0x7fffffff) < ppppiVar14) {
ppppiVar14 = GHIDRA_CAST<int ****>(0x7fffffff);
}
modPath = msvc::_Allocate(GHIDRA_UINT((GHIDRA_INT(ppppiVar14) + 1)));
memcpy(modPath,local_290,(size_t)(GHIDRA_INT(ppppiVar15) + 1));
modPathCapacity = ppppiVar14;
}
else {
modPath = GHIDRA_CAST<int ****>(*local_290);
pppiStack_228 = local_290[1];
pppiStack_224 = local_290[2];
pppiStack_220 = local_290[3];
modPathCapacity = GHIDRA_CAST<int ****>(&DAT_0000000f);
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 1;
modPathSize = ppppiVar15;
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(&sourcePath))))->msvc::string::append(&DAT_00b76eac,1);
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(&modPath))))->msvc::string::append(&DAT_00b76eac,1);
ppppiVar15 = GHIDRA_CAST<int ****>(0x0);
if (sourcePathSize != GHIDRA_CAST<int ****>(0x0)) {
ppppiVar14 = sourcePathCapacity;
ppppiVar11 = sourcePath;
ppppiVar7 = sourcePathSize;
do {
ppppiVar8 = GHIDRA_CAST<int ****>(&sourcePath);
if (&DAT_0000000f < ppppiVar14) {
ppppiVar8 = ppppiVar11;
}
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(ppppiVar8) + GHIDRA_INT(ppppiVar15))) == '/') {
ppppiVar7 = GHIDRA_CAST<int ****>(&sourcePath);
if (&DAT_0000000f < ppppiVar14) {
ppppiVar7 = ppppiVar11;
}
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(ppppiVar7) + GHIDRA_INT(ppppiVar15))) = 0x5c;
ppppiVar14 = sourcePathCapacity;
ppppiVar11 = sourcePath;
ppppiVar7 = sourcePathSize;
}
ppppiVar15 = GHIDRA_CAST<int ****>((GHIDRA_INT(ppppiVar15) + 1));
} while (ppppiVar15 < ppppiVar7);
}
ppppiVar15 = GHIDRA_CAST<int ****>(0x0);
if (modPathSize != GHIDRA_CAST<int ****>(0x0)) {
ppppiVar14 = modPathSize;
ppppiVar11 = modPathCapacity;
ppppiVar7 = modPath;
do {
ppppiVar8 = GHIDRA_CAST<int ****>(&modPath);
if (&DAT_0000000f < ppppiVar11) {
ppppiVar8 = ppppiVar7;
}
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(ppppiVar8) + GHIDRA_INT(ppppiVar15))) == '/') {
ppppiVar14 = GHIDRA_CAST<int ****>(&modPath);
if (&DAT_0000000f < ppppiVar11) {
ppppiVar14 = ppppiVar7;
}
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(ppppiVar14) + GHIDRA_INT(ppppiVar15))) = 0x5c;
ppppiVar14 = modPathSize;
ppppiVar11 = modPathCapacity;
ppppiVar7 = modPath;
}
ppppiVar15 = GHIDRA_CAST<int ****>((GHIDRA_INT(ppppiVar15) + 1));
} while (ppppiVar15 < ppppiVar14);
}
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(&sourcePath))))->msvc::string::append(&DAT_00b76fc0,3);
ppppiVar15 = sourcePathSize;
local_290 = sourcePathCapacity;
if (sourcePathSize < sourcePathCapacity) {
ppppiVar15 = GHIDRA_CAST<int ****>(&sourcePath);
if (&DAT_0000000f < sourcePathCapacity) {
ppppiVar15 = sourcePath;
}
puVar1 = GHIDRA_CAST<uint16_t *>((GHIDRA_INT(ppppiVar15) + GHIDRA_INT(sourcePathSize)));
sourcePathSize = GHIDRA_CAST<int ****>((GHIDRA_INT(sourcePathSize) + 1));
*puVar1 = 0;
}
else {
if (sourcePathSize == GHIDRA_CAST<int ****>(0x7fffffff)) goto LAB_008fb119;
ppppiVar14 = GHIDRA_CAST<int ****>((GHIDRA_UINT((GHIDRA_INT(sourcePathSize) + 1)) | 0xf));
if (ppppiVar14 < GHIDRA_CAST<int ****>(0x80000000)) {
if (GHIDRA_CAST<int ****>((0x7fffffff - (GHIDRA_UINT(sourcePathCapacity) >> 1))) < sourcePathCapacity) {
ppppiVar14 = GHIDRA_CAST<int ****>(0x7fffffff);
}
else {
ppppiVar11 = GHIDRA_CAST<int ****>(((GHIDRA_UINT(sourcePathCapacity) >> 1) + GHIDRA_INT(sourcePathCapacity)));
if (ppppiVar14 < ppppiVar11) {
ppppiVar14 = ppppiVar11;
}
}
}
else {
ppppiVar14 = GHIDRA_CAST<int ****>(0x7fffffff);
}
local_298 = msvc::_Allocate(GHIDRA_UINT((GHIDRA_INT(ppppiVar14) + 1)));
ppppiVar11 = sourcePath;
sourcePathSize = GHIDRA_CAST<int ****>((GHIDRA_INT(ppppiVar15) + 1));
local_294 = GHIDRA_CAST<LPCSTR ***>((GHIDRA_CAST<uint8_t *>((GHIDRA_INT(ppppiVar15) + 1)) + GHIDRA_INT(local_298)));
puVar2 = GHIDRA_CAST<uint8_t *>((GHIDRA_INT(ppppiVar15) + GHIDRA_INT(local_298)));
local_2a8 = puVar2;
sourcePathCapacity = ppppiVar14;
if (local_290 < GHIDRA_CAST<int ****>(0x10)) {
memcpy(local_298,&sourcePath,(size_t)ppppiVar15);
*puVar2 = 0;
*GHIDRA_CAST<uint8_t *>(local_294) = 0;
}
else {
memcpy(local_298,sourcePath,(size_t)ppppiVar15);
ppppiVar14 = GHIDRA_CAST<int ****>((GHIDRA_INT(local_290) + 1));
*local_2a8 = 0;
*GHIDRA_CAST<uint8_t *>(local_294) = 0;
ppppiVar15 = ppppiVar11;
if (GHIDRA_CAST<int ****>(0xfff) < ppppiVar14) {
ppppiVar15 = GHIDRA_CAST<int ****>(ppppiVar11[-1]);
ppppiVar14 = local_290 + 9;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(ppppiVar11) + (-4 - GHIDRA_INT(ppppiVar15)))))
goto LAB_008fb113;
}
operator_delete(ppppiVar15,GHIDRA_UINT(ppppiVar14));
}
sourcePath = local_298;
}
ppppiVar15 = modPathSize;
local_298 = modPathCapacity;
if (modPathSize < modPathCapacity) {
ppppiVar15 = GHIDRA_CAST<int ****>(&modPath);
if (&DAT_0000000f < modPathCapacity) {
ppppiVar15 = modPath;
}
puVar1 = GHIDRA_CAST<uint16_t *>((GHIDRA_INT(ppppiVar15) + GHIDRA_INT(modPathSize)));
modPathSize = GHIDRA_CAST<int ****>((GHIDRA_INT(modPathSize) + 1));
*puVar1 = 0;
}
else {
if (modPathSize == GHIDRA_CAST<int ****>(0x7fffffff)) goto LAB_008fb119;
ppppiVar14 = GHIDRA_CAST<int ****>((GHIDRA_UINT((GHIDRA_INT(modPathSize) + 1)) | 0xf));
if (ppppiVar14 < GHIDRA_CAST<int ****>(0x80000000)) {
if (GHIDRA_CAST<int ****>((0x7fffffff - (GHIDRA_UINT(modPathCapacity) >> 1))) < modPathCapacity) {
ppppiVar14 = GHIDRA_CAST<int ****>(0x7fffffff);
}
else {
ppppiVar11 = GHIDRA_CAST<int ****>(((GHIDRA_UINT(modPathCapacity) >> 1) + GHIDRA_INT(modPathCapacity)));
if (ppppiVar14 < ppppiVar11) {
ppppiVar14 = ppppiVar11;
}
}
}
else {
ppppiVar14 = GHIDRA_CAST<int ****>(0x7fffffff);
}
local_290 = msvc::_Allocate(GHIDRA_UINT((GHIDRA_INT(ppppiVar14) + 1)));
ppppiVar11 = modPath;
modPathSize = GHIDRA_CAST<int ****>((GHIDRA_INT(ppppiVar15) + 1));
local_294 = GHIDRA_CAST<LPCSTR ***>((GHIDRA_CAST<uint8_t *>((GHIDRA_INT(ppppiVar15) + 1)) + GHIDRA_INT(local_290)));
puVar2 = GHIDRA_CAST<uint8_t *>((GHIDRA_INT(local_290) + GHIDRA_INT(ppppiVar15)));
local_2a8 = puVar2;
modPathCapacity = ppppiVar14;
if (local_298 < GHIDRA_CAST<int ****>(0x10)) {
memcpy(local_290,&modPath,(size_t)ppppiVar15);
*puVar2 = 0;
*GHIDRA_CAST<uint8_t *>(local_294) = 0;
}
else {
memcpy(local_290,modPath,(size_t)ppppiVar15);
ppppiVar14 = GHIDRA_CAST<int ****>((GHIDRA_INT(local_298) + 1));
*local_2a8 = 0;
*GHIDRA_CAST<uint8_t *>(local_294) = 0;
ppppiVar15 = ppppiVar11;
if (GHIDRA_CAST<int ****>(0xfff) < ppppiVar14) {
ppppiVar15 = GHIDRA_CAST<int ****>(ppppiVar11[-1]);
ppppiVar14 = local_298 + 9;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(ppppiVar11) + (-4 - GHIDRA_INT(ppppiVar15)))))
goto LAB_008fb113;
}
operator_delete(ppppiVar15,GHIDRA_UINT(ppppiVar14));
}
modPath = local_290;
}
fileOp.hwnd = (HWND)0x0;
fileOp.wFunc = 0;
fileOp.pFrom = (LPCSTR)0x0;
fileOp.pTo = (LPCSTR)0x0;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(fileOp)) + 0x18))) = 0;
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(fileOp)) + 0x10))) = 0;
(*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(&(fileOp.lpszProgressTitle)) + 0x2))) = 0;
if (_glfw == 0) {
_glfwInputError(0x10001,0);
fileOp.hwnd = (HWND)0x0;
}
else if (DAT_00c73694 == 0x60001) {
fileOp.hwnd = *GHIDRA_CAST<HWND *>((GHIDRA_CAST<char *>(g_glfwWindow) + 0x2b4));
}
else {
_glfwInputError(0x1000e,"Win32: Platform not initialized");
fileOp.hwnd = (HWND)0x0;
}
fileOp.fFlags = 0x614;
fileOp.pFrom = (LPCSTR)&modPath;
if (&DAT_0000000f < modPathCapacity) {
fileOp.pFrom = (LPCSTR)modPath;
}
fileOp.wFunc = 3;
SHFileOperationA(&fileOp);
ppppiVar15 = GHIDRA_CAST<int ****>(&modPath);
if (&DAT_0000000f < modPathCapacity) {
ppppiVar15 = modPath;
}
CreateDirectoryA((LPCSTR)ppppiVar15,(LPSECURITY_ATTRIBUTES)0x0);
ppppiVar15 = modDirString;
psVar4 = GHIDRA_CAST<std_string *>(modDirString[4]);
if (0x7fffffffU - GHIDRA_INT(psVar4) < 0xe) {
LAB_008fb119:
/* WARNING: Subroutine does not return */
msvc::string::_Xlen();
}
ppppiVar14 = modDirString;
if (GHIDRA_CAST<int ***>(0xf) < modDirString[5]) {
ppppiVar14 = GHIDRA_CAST<int ****>(*modDirString);
}
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(markerPath))))->msvc::string::concat(GHIDRA_INT(modDirString),psVar4,GHIDRA_CAST<uint8_t *>(ppppiVar14),
GHIDRA_UINT(psVar4),GHIDRA_CAST<uint8_t *>("/unfinished.it"),0xe);
local_8 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),2);
ppppbVar9 = GHIDRA_CAST<uint8_t ****>(markerPath);
if (0xf < markerPathCapacity) {
ppppbVar9 = markerPath[0];
}
markerFile = (GHIDRA_CAST<SaveDataManager *>((&PTR_vftable_00c5aa80)))->SaveDataManager::open_file_write(GHIDRA_CAST<uint8_t *>(ppppbVar9),0);
if (markerFile != GHIDRA_CAST<uint32_t *>(0x0)) {
(**(code **)*markerFile)(1);
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 1;
if (0xf < markerPathCapacity) {
uVar13 = markerPathCapacity + 1;
ppppbVar9 = markerPath[0];
if (0xfff < uVar13) {
ppppbVar9 = GHIDRA_CAST<uint8_t ****>(markerPath[0][-1]);
uVar13 = markerPathCapacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(markerPath[0]) + (-4 - GHIDRA_INT(ppppbVar9)))))
goto LAB_008fb113;
}
operator_delete(ppppbVar9,uVar13);
}
fileOp.wFunc = 2;
fileOp.pTo = (LPCSTR)&modPath;
if (&DAT_0000000f < modPathCapacity) {
fileOp.pTo = (LPCSTR)modPath;
}
fileOp.pFrom = (LPCSTR)&sourcePath;
if (&DAT_0000000f < sourcePathCapacity) {
fileOp.pFrom = (LPCSTR)sourcePath;
}
SHFileOperationA(&fileOp);
if (*GHIDRA_CAST<char *>((local_29c + 0x13)) != '\0') {
psVar4 = GHIDRA_CAST<std_string *>(ppppiVar15[4]);
if (0x7fffffffU - GHIDRA_INT(psVar4) < 0xb) goto LAB_008fb119;
ppppiVar14 = ppppiVar15;
if (GHIDRA_CAST<int ***>(0xf) < ppppiVar15[5]) {
ppppiVar14 = GHIDRA_CAST<int ****>(*ppppiVar15);
}
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(markerPath))))->msvc::string::concat(GHIDRA_INT(modDirString),psVar4,GHIDRA_CAST<uint8_t *>(ppppiVar14),
GHIDRA_UINT(psVar4),GHIDRA_CAST<uint8_t *>("/disable.it"),0xb);
local_8 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),3);
ppppbVar9 = GHIDRA_CAST<uint8_t ****>(markerPath);
if (0xf < markerPathCapacity) {
ppppbVar9 = markerPath[0];
}
markerFile = (GHIDRA_CAST<SaveDataManager *>((&PTR_vftable_00c5aa80)))->SaveDataManager::open_file_write(GHIDRA_CAST<uint8_t *>(ppppbVar9),0);
if (markerFile != GHIDRA_CAST<uint32_t *>(0x0)) {
(**(code **)*markerFile)(1);
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 1;
if (0xf < markerPathCapacity) {
uVar13 = markerPathCapacity + 1;
ppppbVar9 = markerPath[0];
if (0xfff < uVar13) {
ppppbVar9 = GHIDRA_CAST<uint8_t ****>(markerPath[0][-1]);
uVar13 = markerPathCapacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(markerPath[0]) + (-4 - GHIDRA_INT(ppppbVar9)))))
goto LAB_008fb113;
}
operator_delete(ppppbVar9,uVar13);
}
}
psVar4 = GHIDRA_CAST<std_string *>(ppppiVar15[4]);
if (0x7fffffffU - GHIDRA_INT(psVar4) < 0xe) goto LAB_008fb119;
if (GHIDRA_CAST<int ***>(0xf) < ppppiVar15[5]) {
ppppiVar15 = GHIDRA_CAST<int ****>(*ppppiVar15);
}
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(unfinishedPath))))->msvc::string::concat(GHIDRA_INT(modDirString),psVar4,GHIDRA_CAST<uint8_t *>(ppppiVar15),
GHIDRA_UINT(psVar4),GHIDRA_CAST<uint8_t *>("/unfinished.it"),0xe);
local_8 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),4);
ppppbVar9 = GHIDRA_CAST<uint8_t ****>(unfinishedPath);
if (0xf < unfinishedPathCapacity) {
ppppbVar9 = unfinishedPath[0];
}
pbVar6 = FileSystem::ResolvePath(GHIDRA_CAST<uint8_t *>(ppppbVar9));
isUnfinishedExists = pbVar6 != GHIDRA_CAST<uint8_t *>(0x0);
if (pbVar6 != GHIDRA_CAST<uint8_t *>(0x0)) {
if (g_mainHeap == (void *)0x0) {
allocCounter = &g_allocatedBytesNoHeap;
}
else {
allocCounter = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
uVar13 = *GHIDRA_CAST<uint32_t *>((pbVar6 + -4));
allocatedBytes = *allocCounter;
*GHIDRA_CAST<uint32_t *>(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar13;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocCounter) + 4)) =
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBytes) < uVar13));
free(pbVar6 + -4);
}
if (isUnfinishedExists != '\0') {
ppppbVar9 = GHIDRA_CAST<uint8_t ****>(unfinishedPath);
if (0xf < unfinishedPathCapacity) {
ppppbVar9 = unfinishedPath[0];
}
remove(GHIDRA_CAST<char *>(ppppbVar9));
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 1;
if (0xf < unfinishedPathCapacity) {
uVar13 = unfinishedPathCapacity + 1;
ppppbVar9 = unfinishedPath[0];
if (0xfff < uVar13) {
ppppbVar9 = GHIDRA_CAST<uint8_t ****>(unfinishedPath[0][-1]);
uVar13 = unfinishedPathCapacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(unfinishedPath[0]) + (-4 - GHIDRA_INT(ppppbVar9)))))
goto LAB_008fb113;
}
operator_delete(ppppbVar9,uVar13);
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 0;
unfinishedPathSize = 0;
unfinishedPathCapacity = 0xf;
unfinishedPath[0] = GHIDRA_CAST<uint8_t ****>((GHIDRA_UINT(unfinishedPath[0]) & 0xffffff00));
if (&DAT_0000000f < modPathCapacity) {
ppppiVar14 = GHIDRA_CAST<int ****>((GHIDRA_INT(modPathCapacity) + 1));
ppppiVar15 = modPath;
if (GHIDRA_CAST<int ****>(0xfff) < ppppiVar14) {
ppppiVar15 = GHIDRA_CAST<int ****>(modPath[-1]);
ppppiVar14 = modPathCapacity + 9;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(modPath) + (-4 - GHIDRA_INT(ppppiVar15)))))
goto LAB_008fb113;
}
operator_delete(ppppiVar15,GHIDRA_UINT(ppppiVar14));
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 0xff;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))) = 0xffffff;
modPathSize = GHIDRA_CAST<int ****>(0x0);
modPathCapacity = GHIDRA_CAST<int ****>(&DAT_0000000f);
modPath = GHIDRA_CAST<int ****>((GHIDRA_UINT(modPath) & 0xffffff00));
if (&DAT_0000000f < sourcePathCapacity) {
ppppiVar14 = GHIDRA_CAST<int ****>((GHIDRA_INT(sourcePathCapacity) + 1));
ppppiVar15 = sourcePath;
if (GHIDRA_CAST<int ****>(0xfff) < ppppiVar14) {
ppppiVar15 = GHIDRA_CAST<int ****>(sourcePath[-1]);
ppppiVar14 = sourcePathCapacity + 9;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(sourcePath) + (-4 - GHIDRA_INT(ppppiVar15))))) {
LAB_008fb113:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(ppppiVar15,GHIDRA_UINT(ppppiVar14));
}
}
entryIdx = entryIdx + 1;
entriesBegin = *workshopEntries;
} while (entryIdx < GHIDRA_UINT(((workshopEntries[1] - entriesBegin) / 0x50)));
}
*GHIDRA_CAST<uint8_t *>((workshopEntries + 3)) = 1;
ExceptionList = local_10;
return;
}