#include "classes.h" // 0091b720 void PersistentGameData::copy_shared_progress(PersistentGameData *dst, PersistentGameData *src) { int iVar1; int iVar2; uint i; int nextId; int iVar3; int eventCounterIds [2]; undefined8 uStack_c0; int aiStack_b8 [12]; undefined4 local_88; int local_84 [19]; int achievementIds [13]; achievementIds[0xc] = __security_cookie ^ GHIDRA_UINT((achievementIds + 0xd)); if ((dst != GHIDRA_CAST(0x0)) && (src != GHIDRA_CAST(0x0))) { eventCounterIds[0] = 0x72; eventCounterIds[1] = 0x73; iVar1 = 0; nextId = 0xa2; do { iVar2 = iVar1; iVar3 = nextId + 4; *GHIDRA_CAST((eventCounterIds + iVar2 + 2)) = CONCAT44(nextId + -2,nextId + -3); aiStack_b8[iVar2] = nextId + -1; aiStack_b8[iVar2 + 1] = nextId; iVar1 = iVar2 + 4; nextId = iVar3; } while (iVar3 < 0xae); if (iVar1 < 0xe) { iVar2 = iVar2 + 0xa3; do { eventCounterIds[iVar1 + 2] = iVar2; iVar1 = iVar1 + 1; iVar2 = iVar2 + 1; } while (iVar1 < 0xe); } iVar1 = 0x10; local_84[0] = 0x181; local_84[1] = 0x182; local_84[2] = 0x183; local_84[3] = 0x184; local_88 = 0xd4; local_84[4] = 0x185; local_84[5] = 0x186; local_84[6] = 0x187; local_84[7] = 0x188; local_84[8] = 0x189; local_84[9] = 0x18a; local_84[10] = 0x18b; local_84[0xb] = 0x18c; local_84[0xc] = 0x18d; local_84[0xd] = 0x18e; local_84[0xe] = 399; local_84[0xf] = 400; do { local_84[iVar1] = iVar1 + 0x181; iVar1 = iVar1 + 1; } while (iVar1 < 0x13); i = 0; do { dst->_eventCounters[eventCounterIds[i]] = src->_eventCounters[eventCounterIds[i]]; dst->_eventCounters[eventCounterIds[i + 1]] = src->_eventCounters[eventCounterIds[i + 1]]; dst->_eventCounters[eventCounterIds[i + 2]] = src->_eventCounters[eventCounterIds[i + 2]]; dst->_eventCounters[aiStack_b8[i - 1]] = src->_eventCounters[aiStack_b8[i - 1]]; dst->_eventCounters[aiStack_b8[i]] = src->_eventCounters[aiStack_b8[i]]; iVar1 = i + 1; i = i + 6; dst->_eventCounters[aiStack_b8[iVar1]] = src->_eventCounters[aiStack_b8[iVar1]]; } while (i < 0x24); i = 0; achievementIds[0] = 0xf2; achievementIds[1] = 0xf3; achievementIds[2] = 0xf4; achievementIds[3] = 0xf5; achievementIds[4] = 0x113; achievementIds[5] = 0xf6; achievementIds[6] = 0xf7; achievementIds[7] = 0xf8; achievementIds[8] = 0x155; achievementIds[9] = 0xf9; achievementIds[10] = 0xfa; achievementIds[0xb] = 0xfb; do { dst->_achievements[achievementIds[i]] = src->_achievements[achievementIds[i]]; dst->_achievements[achievementIds[i + 1]] = src->_achievements[achievementIds[i + 1]]; dst->_achievements[achievementIds[i + 2]] = src->_achievements[achievementIds[i + 2]]; dst->_achievements[achievementIds[i + 3]] = src->_achievements[achievementIds[i + 3]]; dst->_achievements[achievementIds[i + 4]] = src->_achievements[achievementIds[i + 4]]; iVar1 = i + 5; i = i + 6; dst->_achievements[achievementIds[iVar1]] = src->_achievements[achievementIds[iVar1]]; } while (i < 0xc); } return; } // 00925f80 PersistentGameData * PersistentGameData::constructor() { void *local_10; undefined1 *puStack_c; undefined4 local_8; puStack_c = &LAB_00b0a81b; local_10 = ExceptionList; ExceptionList = &local_10; this->_saveFile = (void *)0x0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1c)))) = 0xf; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x30)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x34)))) = 0xf; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20))) = 0; local_8 = 1; PersistentGameData_Bestiary::constructor (GHIDRA_CAST(&this->_bestiaryEncounters)); Clear(this,1); ExceptionList = local_10; return this; } // 009261a0 void PersistentGameData::copy_constructor(PersistentGameData *other) { void *local_10; undefined1 *puStack_c; undefined4 local_8; puStack_c = &LAB_00b0a8a9; local_10 = ExceptionList; ExceptionList = &local_10; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1c)))) = 0xf; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x30)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x34)))) = 0xf; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20))) = 0; local_8 = 1; PersistentGameData_Bestiary::constructor (GHIDRA_CAST(&this->_bestiaryEncounters)); local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),2); operator_assign(this,other); ExceptionList = local_10; return; } // 009262b0 void PersistentGameData::Clear(byte unk) { std_map *bestiaryMap; undefined1 *this_00; void *mapHead; int iVar3; int *eventCounter; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf84)))) = 0; if (unk != 0) { *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf88)))) = 0; } memset(this->_achievements,0,0x282); memset(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xae8))),0,0x2dd); eventCounter = this->_eventCounters; for (iVar3 = 0x20b; iVar3 != 0; iVar3 = iVar3 + -1) { *eventCounter = 0; eventCounter = eventCounter + 1; } *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdc8)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdcc)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdd0)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdd4)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdd8)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xddc)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xde0)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xde4)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xde8)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdec)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdf0)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdf4)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdf8)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe00)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe04)))) = 0; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe06))) = 0; memset(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe07))),0,0x68); memset(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe6f))),0,0x2e); this->_cutsceneCounters[0] = 0; this->_cutsceneCounters[1] = 0; this->_cutsceneCounters[2] = 0; this->_cutsceneCounters[3] = 0; this->_cutsceneCounters[4] = 0; this->_cutsceneCounters[5] = 0; this->_cutsceneCounters[6] = 0; this->_cutsceneCounters[7] = 0; this->_cutsceneCounters[8] = 0; this->_cutsceneCounters[9] = 0; this->_cutsceneCounters[10] = 0; this->_cutsceneCounters[0xb] = 0; this->_cutsceneCounters[0xc] = 0; this->_cutsceneCounters[0xd] = 0; this->_cutsceneCounters[0xe] = 0; this->_cutsceneCounters[0xf] = 0; this->_cutsceneCounters[0x10] = 0; this->_cutsceneCounters[0x11] = 0; this->_cutsceneCounters[0x12] = 0; this->_cutsceneCounters[0x13] = 0; this->_cutsceneCounters[0x14] = 0; this->_cutsceneCounters[0x15] = 0; this->_cutsceneCounters[0x16] = 0; this->_cutsceneCounters[0x17] = 0; this->_cutsceneCounters[0x18] = 0; this->_cutsceneCounters[0x19] = 0; this->_cutsceneCounters[0x1a] = 0; this->_lastDifficulty = 0; this->_characterMenuShown = 0; memset(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf14))),0,0x50); mapHead = (this->_bestiaryDeaths)._head; FID_conflict__Erase_tree_>_> (&this->_bestiaryDeaths, (fuzzer_allocator_> *)&this->_bestiaryDeaths, *(_Tree_node **)(GHIDRA_INT(mapHead) + 4)); *(void **)(GHIDRA_CAST(mapHead) + 4) = mapHead; *(void **)mapHead = mapHead; *(void **)(GHIDRA_CAST(mapHead) + 8) = mapHead; (this->_bestiaryDeaths)._size = 0; bestiaryMap = &this->_bestiaryEncounters; mapHead = bestiaryMap->_head; FID_conflict__Erase_tree_>_> (bestiaryMap,(fuzzer_allocator_> *)bestiaryMap, *(_Tree_node **)(GHIDRA_INT(mapHead) + 4)); *(void **)(GHIDRA_CAST(mapHead) + 4) = mapHead; *(void **)mapHead = mapHead; *(void **)(GHIDRA_CAST(mapHead) + 8) = mapHead; (this->_bestiaryEncounters)._size = 0; this_00 = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf74))); iVar3 = *GHIDRA_CAST(this_00); FID_conflict__Erase_tree_>_> (this_00,(fuzzer_allocator_> *)this_00, *(_Tree_node **)(iVar3 + 4)); *GHIDRA_CAST((iVar3 + 4)) = iVar3; *GHIDRA_CAST(iVar3) = iVar3; *GHIDRA_CAST((iVar3 + 8)) = iVar3; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf78)))) = 0; bestiaryMap = &this->_bestiaryKills; mapHead = bestiaryMap->_head; FID_conflict__Erase_tree_>_> (bestiaryMap,(fuzzer_allocator_> *)bestiaryMap, *(_Tree_node **)(GHIDRA_INT(mapHead) + 4)); *(void **)(GHIDRA_CAST(mapHead) + 4) = mapHead; *(void **)mapHead = mapHead; *(void **)(GHIDRA_CAST(mapHead) + 8) = mapHead; (this->_bestiaryKills)._size = 0; *GHIDRA_CAST(this) = 0; this->_isSteamAchievementsEnabled = 1; this->_isFileLoaded = 1; return; } // 00926a50 byte PersistentGameData::Load(byte *filepath) { char isImported; byte bVar1; int *saveFile; uint position; byte ****rebirthPathText; int fd; byte *pathEnd; byte ****ppppbVar2; uint uVar3; char *format; undefined4 searchText; undefined1 uStack_44; undefined4 uStack_38; undefined4 uStack_34; byte ****rebirthPath [5]; uint rebirthPathCapacity; uint securityCookie; void *local_10; undefined1 *puStack_c; byte ***pppbStack_8; pppbStack_8 = GHIDRA_CAST(0xffffffff); puStack_c = &LAB_00b0a935; local_10 = ExceptionList; securityCookie = __security_cookie ^ GHIDRA_UINT((rebirthPath + 0xb)); ExceptionList = &local_10; if (this->_saveFile != GHIDRA_CAST(0x0)) { (*(code *)**GHIDRA_CAST(this->_saveFile))(1,securityCookie); } pathEnd = filepath; do { bVar1 = *pathEnd; pathEnd = pathEnd + 1; } while (bVar1 != 0); (GHIDRA_CAST((&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8))))))->std::string::assign(filepath,GHIDRA_INT(pathEnd) - GHIDRA_INT((filepath + 1))); KAGE_LogMessage(1,GHIDRA_CAST("Loading Repentance PersistentGameData from disk: %s.\n")); saveFile = (GHIDRA_CAST((&PTR_vftable_00c5aa80)))->SaveDataManager::open_file_read(filepath); this->_saveFile = saveFile; if (saveFile == GHIDRA_CAST(0x0)) { Clear(this,1); isImported = func_0x0092c7e0(filepath); if (isImported == '\0') { KAGE_LogMessage(1,GHIDRA_CAST("No Repentance PersistentGameData, trying to import AB+ save.\n")); isImported = func_0x0092c550(filepath); if (isImported == '\0') { KAGE_LogMessage(1,GHIDRA_CAST("No AB+ PersistentGameData, trying to import AB save.\n")); bVar1 = TryImportABLocalSave(this,filepath); if (bVar1 == 0) { KAGE_LogMessage(1,GHIDRA_CAST("No AB PersistentGameData, trying to import Rebirth save.\n")); (GHIDRA_CAST((GHIDRA_CAST(rebirthPath))))->std::string::string_from_cstr(filepath); uVar3 = rebirthPathCapacity; ppppbVar2 = rebirthPath[0]; uStack_34 = 0xf; uStack_38 = 4; searchText = 0x2b706572; uStack_44 = 0; pppbStack_8 = GHIDRA_CAST(0x1); rebirthPathText = GHIDRA_CAST(rebirthPath); if (0xf < rebirthPathCapacity) { rebirthPathText = rebirthPath[0]; } position = FUN_00836980(rebirthPathText,&searchText,4); if (position != 0xffffffff) { (GHIDRA_CAST((GHIDRA_CAST(rebirthPath))))->std::string::replace(position,4,&s_empty,0); ppppbVar2 = rebirthPath[0]; uVar3 = rebirthPathCapacity; } rebirthPathText = GHIDRA_CAST(rebirthPath); if (0xf < uVar3) { rebirthPathText = ppppbVar2; } bVar1 = TryImportRebirthLocalSave(this,GHIDRA_CAST(rebirthPathText)); if (bVar1 == 0) { Clear(this,1); KAGE_LogMessage(1,(byte *) "No PersistentGameData found for any version of Isaac, creating new one.\n" ); Save(this); bVar1 = 0; } else { KAGE_LogMessage(1,GHIDRA_CAST("Successfully imported Rebirth save!!\n")); bVar1 = 0; if (this->_isFileLoaded != 0) { Save(this); bVar1 = this->_isFileLoaded; } } if (0xf < rebirthPathCapacity) { uVar3 = rebirthPathCapacity + 1; ppppbVar2 = rebirthPath[0]; if (0xfff < uVar3) { ppppbVar2 = GHIDRA_CAST(rebirthPath[0][-1]); uVar3 = rebirthPathCapacity + 0x24; if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(rebirthPath[0]) + (-4 - GHIDRA_INT(ppppbVar2))))) { /* WARNING: Subroutine does not return */ _invalid_parameter_noinfo_noreturn(); } } operator_delete(ppppbVar2,uVar3); } ExceptionList = local_10; return bVar1; } format = "Successfully imported from AB!\n"; } else { format = "Successfully imported from AB+!\n"; } } else { format = "Successfully imported!\n"; } KAGE_LogMessage(1,GHIDRA_CAST(format)); if (this->_isFileLoaded == 0) { ExceptionList = local_10; return 0; } Save(this); } else { isImported = (**(code **)(*saveFile + 0x30))(); if ((isImported != '\0') && (fd = _fileno(GHIDRA_CAST(saveFile[3])), -1 < fd)) { flock(fd,1); } bVar1 = func_0x00926e90(); saveFile = this->_saveFile; this->_isFileLoaded = bVar1; isImported = (**(code **)(*saveFile + 0x30))(); if ((isImported != '\0') && (fd = _fileno(GHIDRA_CAST(saveFile[3])), -1 < fd)) { flock(fd,8); } (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x34))(); } ExceptionList = local_10; return this->_isFileLoaded; } // 00926cf0 byte PersistentGameData::LoadFromSteamCloud() { qword qVar1; char cVar2; byte isLoaded; undefined4 *allocBlock; undefined4 *steamCloudFile; undefined1 *fileName; qword *allocCounter; if (this->_saveFile != GHIDRA_CAST(0x0)) { (*(code *)**GHIDRA_CAST(this->_saveFile))(1); } if (g_mainHeap == (void *)0x0) { allocCounter = &g_allocatedBytesNoHeap; } else { allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); } allocBlock = malloc(0x28); if (allocBlock == GHIDRA_CAST(0x0)) { FUN_00a23200(0x7fcb9dd6); } else { qVar1 = *allocCounter; *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) + 0x28; *allocBlock = 0x28; *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) + GHIDRA_UINT((0xffffffd7 < GHIDRA_UINT(qVar1))); steamCloudFile = allocBlock + 1; if (steamCloudFile != GHIDRA_CAST(0x0)) { allocBlock[2] = 2; allocBlock[3] = 0; *steamCloudFile = IsaacRepentancePlus::SteamCloudFile::vftable; allocBlock[5] = 0; allocBlock[7] = 0; allocBlock[8] = 0; *GHIDRA_CAST((allocBlock + 9)) = 0; goto LAB_00926d39; } } steamCloudFile = GHIDRA_CAST(0x0); LAB_00926d39: fileName = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20))); this->_saveFile = steamCloudFile; KAGE_LogMessage(1,GHIDRA_CAST("Loading PersistentGameData from Steam Cloud: %s.\n")); if (0xf < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x34))))) { fileName = *GHIDRA_CAST(fileName); } cVar2 = (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x24))(fileName); if ((cVar2 != '\0') && (cVar2 = (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x30))(), cVar2 != '\0')) { isLoaded = func_0x00926e90(); this->_isFileLoaded = isLoaded; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x34))(); return this->_isFileLoaded; } KAGE_LogMessage(1,GHIDRA_CAST("SteamCloud could not find or open %s.\n")); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x34))(); Clear(this,1); KAGE_LogMessage(1,GHIDRA_CAST("Trying to import AB+ Steam save.\n")); cVar2 = FUN_0092c0e0(); if (((cVar2 == '\0') && (cVar2 = FUN_0092bf00(), cVar2 == '\0')) && (cVar2 = FUN_0092bd20(), cVar2 == '\0')) { KAGE_LogMessage(1,GHIDRA_CAST("Starting with a clean save state.\n")); Clear(this,1); } else { KAGE_LogMessage(1,GHIDRA_CAST("Successfully imported!\n")); if (this->_isFileLoaded != 0) { SaveToSteamCloud(this); return this->_isFileLoaded; } } return 0; } // 00926f10 byte PersistentGameData::read(void *stream) { char isEof; uint list3Head; undefined4 *newNode; void *mapNode; int *expectedHeader; int *readHeader; PersistentGameData *data; std_map *bestiaryMap; undefined1 *list3Map; int entryKey; uint uVar3; bool bVar4; void *list1Parent; int list1Child; void *list1Bound; void *list3Parent; int list3Child; void *list3Bound; void *list2Parent; int list2Child; void *list2Bound; void *list4Parent; int list4Child; void *list4Bound; undefined1 *list3Guard; undefined4 list3GuardNode; std_map *list1Guard; undefined4 list1GuardNode; std_map *list4Guard; undefined4 list4GuardNode; std_map *list2Guard; undefined4 list2GuardNode; int list3Key; int list1Key; uint list1Value; uint list1Bytes; undefined4 cutsceneCounterValue; uint list3Value; uint list3Bytes; int list2Key; uint list2Value; uint list2Bytes; undefined4 levelCounterValue; undefined4 counterValue; int list4Key; uint list4Value; uint list4Bytes; undefined4 bestiaryListType; undefined4 gameSettingValue; uint bestiaryListCount; uint bestiaryListIdx; int list1KeyCopy; uint storedChecksum; uint specialSeedCount; uint cutsceneCounterCount; uint challengeCounterCount; uint bossCount; uint miniBossCount; uint collectibleCount; uint levelCounterCount; uint counterCount; uint achievementCount; int chunkId; int chunkLimit; uint gameSettingCount; uint uStack_40; uint uStack_3c; char achievementByte; char specialSeedByte; char challengeCounterByte; char bossByte; char miniBossByte; char collectibleByte; int listKeyCopy; uint chunkSize; PersistentGameData *self; int fileHeader [4]; uint local_14; void *local_10; undefined1 *puStack_c; int iStack_8; PersistentGameData *dataCopy; int entryKey; undefined4 list3Head; iStack_8 = 0xffffffff; puStack_c = &LAB_00b0a991; local_10 = ExceptionList; local_14 = __security_cookie ^ GHIDRA_UINT((fileHeader + 8)); ExceptionList = &local_10; self = this; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(fileHeader,1,0x10,local_14); expectedHeader = &DAT_00b1b98c; readHeader = fileHeader; uVar3 = 0xc; do { if (*expectedHeader != *readHeader) { expectedHeader = &DAT_00b1b9a0; readHeader = fileHeader; uVar3 = 0xc; goto LAB_00926f90; } expectedHeader = expectedHeader + 1; readHeader = readHeader + 1; bVar4 = 3 < uVar3; uVar3 = uVar3 - 4; } while (bVar4); uVar3 = 6; chunkLimit = 9; goto LAB_00927011; while( true ) { expectedHeader = expectedHeader + 1; readHeader = readHeader + 1; bVar4 = uVar3 < 4; uVar3 = uVar3 - 4; if (bVar4) break; LAB_00926f90: if (*expectedHeader != *readHeader) { expectedHeader = &DAT_00b1b9b4; readHeader = fileHeader; uVar3 = 0xc; goto LAB_00926fc0; } } uVar3 = 7; chunkLimit = 10; goto LAB_00927011; while( true ) { expectedHeader = expectedHeader + 1; readHeader = readHeader + 1; bVar4 = uVar3 < 4; uVar3 = uVar3 - 4; if (bVar4) break; LAB_00926fc0: if (*expectedHeader != *readHeader) { expectedHeader = &DAT_00b7ab6c; readHeader = fileHeader; uVar3 = 0xc; do { if (*expectedHeader != *readHeader) { KAGE_LogMessage(1,GHIDRA_CAST("PersistentGameData wrong file header (%.16s)\n")); ExceptionList = local_10; return 0; } expectedHeader = expectedHeader + 1; readHeader = readHeader + 1; bVar4 = 3 < uVar3; uVar3 = uVar3 - 4; } while (bVar4); uVar3 = 9; chunkLimit = 0xb; goto LAB_00927011; } } uVar3 = 8; chunkLimit = 10; LAB_00927011: list3Head = checksum_stream(stream,0x10,4); (**(code **)(*GHIDRA_CAST(stream) + 0xc))(0xfffffffc,2); storedChecksum = 0; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&storedChecksum,4,1); if (storedChecksum == list3Head) { if (8 < uVar3) { (**(code **)(*GHIDRA_CAST(stream) + 0xc))(0x10,0); data = self; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&(*GHIDRA_CAST((GHIDRA_CAST((self)) + 0xf84))),4,1); chunkId = 0; do { do { isEof = (**(code **)(*GHIDRA_CAST(stream) + 0x10))(); if (((isEof != '\0') || (chunkId < 0)) || (chunkLimit <= chunkId)) { (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&(*GHIDRA_CAST((GHIDRA_CAST((data)) + 0xf88))),4,1); ExceptionList = local_10; return 1; } (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&chunkId,4,1); KAGE_LogMessage(1,GHIDRA_CAST("Reading chunk %d\n")); chunkSize = 0; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&chunkSize,4,1); } while (chunkSize == 0); switch(chunkId) { case 1: KAGE_LogMessage(1,GHIDRA_CAST("Reading Achievements\n")); achievementCount = 0; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&achievementCount,4,1); if (achievementCount != 0x282) { KAGE_LogMessage(4,GHIDRA_CAST("Different number of achievements %d/%d\n")); } uVar3 = 0; if (achievementCount != 0) { do { if (chunkSize <= uVar3) break; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&achievementByte,1,1); if (uVar3 < 0x282) { data->_achievements[uVar3] = '\0' < achievementByte; } uVar3 = uVar3 + 1; } while (uVar3 < achievementCount); } KAGE_LogMessage(1,GHIDRA_CAST("Done Reading Achievements\n")); break; case 2: KAGE_LogMessage(1,GHIDRA_CAST("Reading Counters\n")); counterCount = 0; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&counterCount,4,1); if (counterCount != 0x20b) { KAGE_LogMessage(4,GHIDRA_CAST("Different number of counters %d/%d\n")); } uVar3 = 0; if (counterCount != 0) { list3Head = 0; do { if (chunkSize <= list3Head) break; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&counterValue,4,1); if (uVar3 < 0x20b) { *GHIDRA_CAST((GHIDRA_CAST(self->_eventCounters) + list3Head)) = counterValue; } uVar3 = uVar3 + 1; list3Head = list3Head + 4; } while (uVar3 < counterCount); } KAGE_LogMessage(1,GHIDRA_CAST("Done Reading Counters\n")); data = self; break; case 3: KAGE_LogMessage(1,GHIDRA_CAST("Reading Level Counters\n")); levelCounterCount = 0; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&levelCounterCount,4,1); if (levelCounterCount != 0xe) { KAGE_LogMessage(4,GHIDRA_CAST("Different number of counters %d/%d\n")); } uVar3 = 0; if (levelCounterCount != 0) { list3Head = 0; do { if (chunkSize <= list3Head) break; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&levelCounterValue,4,1); if (uVar3 < 0xe) { *GHIDRA_CAST((GHIDRA_CAST(self->_cutsceneCounters) + (list3Head - 0xd8))) = levelCounterValue; } uVar3 = uVar3 + 1; list3Head = list3Head + 4; } while (uVar3 < levelCounterCount); } KAGE_LogMessage(1,GHIDRA_CAST("Done Reading Level Counters\n")); data = self; break; case 4: KAGE_LogMessage(1,GHIDRA_CAST("Reading Collectibles\n")); collectibleCount = 0; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&collectibleCount,4,1); if (collectibleCount != 0x2dd) { KAGE_LogMessage(4,GHIDRA_CAST("Different number of collectibles in collection %d/%d\n")); } uVar3 = 0; if (collectibleCount != 0) { do { if (chunkSize <= uVar3) break; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&collectibleByte,1,1); if (uVar3 < 0x2dd) { *GHIDRA_CAST((GHIDRA_CAST(data->_eventCounters) + uVar3 + 0x82c)) = '\0' < collectibleByte; } uVar3 = uVar3 + 1; } while (uVar3 < collectibleCount); } KAGE_LogMessage(1,GHIDRA_CAST("Done Reading Collectibles\n")); break; case 5: KAGE_LogMessage(1,GHIDRA_CAST("Reading Mini Bosses\n")); miniBossCount = 0; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&miniBossCount,4,1); if (miniBossCount != 7) { KAGE_LogMessage(4,GHIDRA_CAST("Different number of minibosses %d/%d\n")); } uVar3 = 0; if (miniBossCount != 0) { do { if (chunkSize <= uVar3) break; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&miniBossByte,1,1); if (uVar3 < 7) { *GHIDRA_CAST((GHIDRA_CAST(data->_cutsceneCounters) + (uVar3 - 0xa0))) = '\0' < miniBossByte; } uVar3 = uVar3 + 1; } while (uVar3 < miniBossCount); } KAGE_LogMessage(1,GHIDRA_CAST("Done Reading Mini Bosses\n")); break; case 6: KAGE_LogMessage(1,GHIDRA_CAST("Reading Bosses\n")); bossCount = 0; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&bossCount,4,1); if (bossCount != 0x68) { KAGE_LogMessage(4,GHIDRA_CAST("Different number of minibosses %d/%d\n")); } uVar3 = 0; if (bossCount != 0) { do { if (chunkSize <= uVar3) break; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&bossByte,1,1); if (uVar3 < 0x68) { *GHIDRA_CAST((GHIDRA_CAST(data->_cutsceneCounters) + (uVar3 - 0x99))) = '\0' < bossByte; } uVar3 = uVar3 + 1; } while (uVar3 < bossCount); } KAGE_LogMessage(1,GHIDRA_CAST("Done Reading Bosses\n")); break; case 7: KAGE_LogMessage(1,GHIDRA_CAST("Reading Challenge Counters\n")); challengeCounterCount = 0; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&challengeCounterCount,4,1); if (challengeCounterCount != 0x2e) { KAGE_LogMessage(4,GHIDRA_CAST("Different number of challenges %d/%d\n")); } uVar3 = 0; if (challengeCounterCount != 0) { do { if (chunkSize <= uVar3) break; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&challengeCounterByte,1,1); if (uVar3 < 0x2e) { *GHIDRA_CAST((GHIDRA_CAST(data->_cutsceneCounters) + (uVar3 - 0x31))) = '\0' < challengeCounterByte; } uVar3 = uVar3 + 1; } while (uVar3 < challengeCounterCount); } KAGE_LogMessage(1,GHIDRA_CAST("Done Reading Challenge Counters\n")); break; case 8: KAGE_LogMessage(1,GHIDRA_CAST("Reading Cutscene Counters\n")); cutsceneCounterCount = 0; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&cutsceneCounterCount,4,1); if (cutsceneCounterCount != 0x1b) { KAGE_LogMessage(4,GHIDRA_CAST("Different number of cutscenes %d/%d\n")); } uVar3 = 0; if (cutsceneCounterCount != 0) { list3Head = 0; do { if (chunkSize <= list3Head) break; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&cutsceneCounterValue,4,1); if (uVar3 < 0x1b) { *GHIDRA_CAST((GHIDRA_CAST(self->_cutsceneCounters) + list3Head)) = cutsceneCounterValue; } uVar3 = uVar3 + 1; list3Head = list3Head + 4; } while (uVar3 < cutsceneCounterCount); } KAGE_LogMessage(1,GHIDRA_CAST("Done Reading Cutscene Counters\n")); data = self; break; case 9: KAGE_LogMessage(1,GHIDRA_CAST("Reading GameSettings\n")); gameSettingCount = 0; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&gameSettingCount,4,1); bVar4 = gameSettingCount == 2; if (!bVar4) { KAGE_LogMessage(4,GHIDRA_CAST("Different number of settings %d/%d\n")); bVar4 = gameSettingCount == 2; } if (1 < gameSettingCount && !bVar4) { gameSettingCount = 2; } uVar3 = 0; if (gameSettingCount != 0) { list3Head = 0; do { if (chunkSize <= list3Head) break; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&gameSettingValue,4,1); if (uVar3 < 2) { *GHIDRA_CAST((GHIDRA_CAST(self->_cutsceneCounters) + list3Head + 0x6c)) = gameSettingValue; } uVar3 = uVar3 + 1; list3Head = list3Head + 4; } while (uVar3 < gameSettingCount); } KAGE_LogMessage(1,GHIDRA_CAST("Done Reading GameSettings\n")); data = self; break; case 10: KAGE_LogMessage(1,GHIDRA_CAST("Reading Special Seed Counters\n")); specialSeedCount = 0; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&specialSeedCount,4,1); if (specialSeedCount != 0x50) { KAGE_LogMessage(4,GHIDRA_CAST("Different number of special seeds %d/%d\n")); } uVar3 = 0; if (specialSeedCount != 0) { do { if (chunkSize <= uVar3) break; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&specialSeedByte,1,1); if (uVar3 < 0x50) { *GHIDRA_CAST((GHIDRA_CAST(data->_cutsceneCounters) + uVar3 + 0x74)) = '\0' < specialSeedByte; } uVar3 = uVar3 + 1; } while (uVar3 < specialSeedCount); } KAGE_LogMessage(1,GHIDRA_CAST("Done Reading Special Seed Counters\n")); break; case 0xb: KAGE_LogMessage(1,GHIDRA_CAST("Reading Bestiary Counters\n")); mapNode = (data->_bestiaryDeaths)._head; FID_conflict__Erase_tree_>_> (&data->_bestiaryDeaths, (fuzzer_allocator_> *) &data->_bestiaryDeaths,*(_Tree_node **)(GHIDRA_INT(mapNode) + 4)); dataCopy = self; *(void **)(GHIDRA_CAST(mapNode) + 4) = mapNode; *(void **)mapNode = mapNode; *(void **)(GHIDRA_CAST(mapNode) + 8) = mapNode; (data->_bestiaryDeaths)._size = 0; bestiaryMap = &self->_bestiaryEncounters; mapNode = bestiaryMap->_head; FID_conflict__Erase_tree_>_> (bestiaryMap, (fuzzer_allocator_> *)bestiaryMap, *(_Tree_node **)(GHIDRA_INT(mapNode) + 4)); data = self; *(void **)(GHIDRA_CAST(mapNode) + 4) = mapNode; *(void **)mapNode = mapNode; *(void **)(GHIDRA_CAST(mapNode) + 8) = mapNode; (dataCopy->_bestiaryEncounters)._size = 0; list3Map = &(*GHIDRA_CAST((GHIDRA_CAST((self)) + 0xf74))); entryKey = *GHIDRA_CAST(list3Map); FID_conflict__Erase_tree_>_> (list3Map,(fuzzer_allocator_> *)list3Map, *(_Tree_node **)(entryKey + 4)); dataCopy = self; *GHIDRA_CAST((entryKey + 4)) = entryKey; *GHIDRA_CAST(entryKey) = entryKey; *GHIDRA_CAST((entryKey + 8)) = entryKey; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((data)) + 0xf78)))) = 0; bestiaryMap = &self->_bestiaryKills; mapNode = bestiaryMap->_head; FID_conflict__Erase_tree_>_> (bestiaryMap, (fuzzer_allocator_> *)bestiaryMap, *(_Tree_node **)(GHIDRA_INT(mapNode) + 4)); *(void **)(GHIDRA_CAST(mapNode) + 4) = mapNode; *(void **)mapNode = mapNode; *(void **)(GHIDRA_CAST(mapNode) + 8) = mapNode; (dataCopy->_bestiaryKills)._size = 0; (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&bestiaryListCount,4,1); bestiaryListIdx = 0; if (bestiaryListCount != 0) { do { (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&bestiaryListType,4,1); switch(bestiaryListType) { case 1: (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&list1Bytes,4,1); if (0 < GHIDRA_INT(list1Bytes)) { uStack_3c = list1Bytes >> 2; entryKey = 0; if (uStack_3c != 0) { do { (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&list1Key,4,1); (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&list1Value,4,1); entryKey = list1Key; uStack_40 = list1Value; list1KeyCopy = list1Key; std::set::find_node(&list1Parent,&list1KeyCopy); if ((*GHIDRA_CAST((GHIDRA_CAST(list1Bound) + 0xd)) != '\0') || (mapNode = list1Bound, entryKey < *GHIDRA_CAST((GHIDRA_CAST(list1Bound) + 0x10)))) { if ((self->_bestiaryEncounters)._size == 0xaaaaaaa) { LAB_00927cd3: /* WARNING: Subroutine does not return */ FUN_004170d0(); } mapNode = (self->_bestiaryEncounters)._head; iStack_8 = 3; list1GuardNode = 0; list1Guard = &self->_bestiaryEncounters; newNode = operator_new(0x18); iStack_8 = 0xffffffff; list1GuardNode = 0; newNode[4] = list1KeyCopy; newNode[5] = 0; *newNode = mapNode; newNode[1] = mapNode; newNode[2] = mapNode; *GHIDRA_CAST((newNode + 3)) = 0; mapNode = std::_Tree::_Insert_node (&self->_bestiaryEncounters,list1Parent,list1Child, newNode); } entryKey = entryKey + 1; *GHIDRA_CAST((GHIDRA_CAST(mapNode) + 0x14)) = uStack_40; } while (entryKey < GHIDRA_INT(uStack_3c)); } } break; case 2: (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&list2Bytes,4,1); if (0 < GHIDRA_INT(list2Bytes)) { uStack_3c = list2Bytes >> 2; entryKey = 0; if (uStack_3c != 0) { do { (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&list2Key,4,1); (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&list2Value,4,1); entryKey = list2Key; uStack_40 = list2Value; listKeyCopy = list2Key; std::set::find_node(&list2Parent,&listKeyCopy); if ((*GHIDRA_CAST((GHIDRA_CAST(list2Bound) + 0xd)) != '\0') || (mapNode = list2Bound, entryKey < *GHIDRA_CAST((GHIDRA_CAST(list2Bound) + 0x10)))) { if ((self->_bestiaryKills)._size == 0xaaaaaaa) goto LAB_00927cd3; mapNode = (self->_bestiaryKills)._head; iStack_8 = 1; list2GuardNode = 0; list2Guard = &self->_bestiaryKills; newNode = operator_new(0x18); iStack_8 = 0xffffffff; list2GuardNode = 0; newNode[4] = listKeyCopy; newNode[5] = 0; *newNode = mapNode; newNode[1] = mapNode; newNode[2] = mapNode; *GHIDRA_CAST((newNode + 3)) = 0; mapNode = std::_Tree::_Insert_node (&self->_bestiaryKills,list2Parent,list2Child,newNode); } entryKey = entryKey + 1; *GHIDRA_CAST((GHIDRA_CAST(mapNode) + 0x14)) = uStack_40; } while (entryKey < GHIDRA_INT(uStack_3c)); } } break; case 3: (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&list3Bytes,4,1); if (0 < GHIDRA_INT(list3Bytes)) { uStack_3c = list3Bytes >> 2; entryKey = 0; if (uStack_3c != 0) { do { (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&list3Key,4,1); (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&list3Value,4,1); entryKey = list3Key; uStack_40 = list3Value; listKeyCopy = list3Key; std::set::find_node(&list3Parent,&listKeyCopy); if ((*GHIDRA_CAST((GHIDRA_CAST(list3Bound) + 0xd)) != '\0') || (mapNode = list3Bound, entryKey < *GHIDRA_CAST((GHIDRA_CAST(list3Bound) + 0x10)))) { if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((self)) + 0xf78)))) == 0xaaaaaaa) goto LAB_00927cd3; list3Head = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((self)) + 0xf74)))); iStack_8 = 2; list3GuardNode = 0; list3Guard = &(*GHIDRA_CAST((GHIDRA_CAST((self)) + 0xf74))); newNode = operator_new(0x18); iStack_8 = 0xffffffff; list3GuardNode = 0; newNode[4] = listKeyCopy; newNode[5] = 0; *newNode = list3Head; newNode[1] = list3Head; newNode[2] = list3Head; *GHIDRA_CAST((newNode + 3)) = 0; mapNode = std::_Tree::_Insert_node (&(*GHIDRA_CAST((GHIDRA_CAST((self)) + 0xf74))),list3Parent,list3Child,newNode); } entryKey = entryKey + 1; *GHIDRA_CAST((GHIDRA_CAST(mapNode) + 0x14)) = uStack_40; } while (entryKey < GHIDRA_INT(uStack_3c)); } } break; case 4: (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&list4Bytes,4,1); if (0 < GHIDRA_INT(list4Bytes)) { uStack_40 = list4Bytes >> 2; entryKey = 0; if (uStack_40 != 0) { do { (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&list4Key,4,1); (**(code **)(*GHIDRA_CAST(stream) + 0x14))(&list4Value,4,1); entryKey = list4Key; uStack_3c = list4Value; listKeyCopy = list4Key; std::set::find_node(&list4Parent,&listKeyCopy); if ((*GHIDRA_CAST((GHIDRA_CAST(list4Bound) + 0xd)) != '\0') || (mapNode = list4Bound, entryKey < *GHIDRA_CAST((GHIDRA_CAST(list4Bound) + 0x10)))) { if ((self->_bestiaryDeaths)._size == 0xaaaaaaa) goto LAB_00927cd3; mapNode = (self->_bestiaryDeaths)._head; iStack_8 = 0; list4GuardNode = 0; list4Guard = &self->_bestiaryDeaths; newNode = operator_new(0x18); iStack_8 = 0xffffffff; list4GuardNode = 0; newNode[4] = listKeyCopy; newNode[5] = 0; *newNode = mapNode; newNode[1] = mapNode; newNode[2] = mapNode; *GHIDRA_CAST((newNode + 3)) = 0; mapNode = std::_Tree::_Insert_node (&self->_bestiaryDeaths,list4Parent,list4Child,newNode); } entryKey = entryKey + 1; *GHIDRA_CAST((GHIDRA_CAST(mapNode) + 0x14)) = uStack_3c; } while (entryKey < GHIDRA_INT(uStack_40)); } } } bestiaryListIdx = bestiaryListIdx + 1; } while (bestiaryListIdx < bestiaryListCount); } KAGE_LogMessage(1,GHIDRA_CAST("Done Reading Bestiary Counters\n")); data = self; } } while( true ); } KAGE_LogMessage(1,GHIDRA_CAST("[warn] Unsuported save version (probably an AB or Rebirth save)!\n")); } else { KAGE_LogMessage(1,GHIDRA_CAST("[warn] PersistentGameData checksum invalid!\n")); } ExceptionList = local_10; return 0; } // 00927d20 void PersistentGameData::backfill_cutscene_counters() { int iVar1; int iVar2; int *piVar3; int *piVar4; int *piVar5; int minCount; iVar1 = this->_eventCounters[1]; if (this->_achievements[4] != 0) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[3]) { piVar3 = this->_cutsceneCounters + 3; } piVar4 = this->_cutsceneCounters + 2; this->_cutsceneCounters[3] = *piVar3; minCount = 1; piVar3 = &minCount; if (1 < *piVar4) { piVar3 = piVar4; } iVar2 = *piVar3; *piVar4 = iVar2; piVar3 = &minCount; if (1 < iVar2) { piVar3 = piVar4; } minCount = 1; iVar2 = *piVar3; *piVar4 = iVar2; piVar3 = &minCount; if (1 < iVar2) { piVar3 = piVar4; } minCount = 1; *piVar4 = *piVar3; } if (0 < iVar1) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[4]) { piVar3 = this->_cutsceneCounters + 4; } this->_cutsceneCounters[4] = *piVar3; piVar3 = this->_cutsceneCounters + 2; minCount = 1; piVar4 = &minCount; if (1 < *piVar3) { piVar4 = piVar3; } *piVar3 = *piVar4; if (1 < iVar1) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[5]) { piVar3 = this->_cutsceneCounters + 5; } this->_cutsceneCounters[5] = *piVar3; piVar3 = this->_cutsceneCounters + 2; minCount = 1; piVar4 = &minCount; if (1 < *piVar3) { piVar4 = piVar3; } *piVar3 = *piVar4; if (2 < iVar1) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[6]) { piVar3 = this->_cutsceneCounters + 6; } this->_cutsceneCounters[6] = *piVar3; piVar3 = this->_cutsceneCounters + 2; minCount = 1; piVar4 = &minCount; if (1 < *piVar3) { piVar4 = piVar3; } *piVar3 = *piVar4; if (3 < iVar1) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[7]) { piVar3 = this->_cutsceneCounters + 7; } this->_cutsceneCounters[7] = *piVar3; piVar3 = this->_cutsceneCounters + 2; minCount = 1; piVar4 = &minCount; if (1 < *piVar3) { piVar4 = piVar3; } *piVar3 = *piVar4; if (4 < iVar1) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[8]) { piVar3 = this->_cutsceneCounters + 8; } this->_cutsceneCounters[8] = *piVar3; piVar3 = this->_cutsceneCounters + 2; minCount = 1; piVar4 = &minCount; if (1 < *piVar3) { piVar4 = piVar3; } *piVar3 = *piVar4; if (5 < iVar1) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[9]) { piVar3 = this->_cutsceneCounters + 9; } this->_cutsceneCounters[9] = *piVar3; piVar3 = this->_cutsceneCounters + 2; minCount = 1; piVar4 = &minCount; if (1 < *piVar3) { piVar4 = piVar3; } *piVar3 = *piVar4; if (6 < iVar1) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[10]) { piVar3 = this->_cutsceneCounters + 10; } this->_cutsceneCounters[10] = *piVar3; piVar3 = this->_cutsceneCounters + 2; minCount = 1; piVar4 = &minCount; if (1 < *piVar3) { piVar4 = piVar3; } *piVar3 = *piVar4; if (7 < iVar1) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[0xb]) { piVar3 = this->_cutsceneCounters + 0xb; } this->_cutsceneCounters[0xb] = *piVar3; piVar3 = this->_cutsceneCounters + 2; minCount = 1; piVar4 = &minCount; if (1 < *piVar3) { piVar4 = piVar3; } *piVar3 = *piVar4; if (8 < iVar1) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[0xc]) { piVar3 = this->_cutsceneCounters + 0xc; } this->_cutsceneCounters[0xc] = *piVar3; piVar3 = this->_cutsceneCounters + 2; minCount = 1; piVar4 = &minCount; if (1 < *piVar3) { piVar4 = piVar3; } *piVar3 = *piVar4; if (9 < iVar1) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[0xd]) { piVar3 = this->_cutsceneCounters + 0xd; } this->_cutsceneCounters[0xd] = *piVar3; piVar3 = this->_cutsceneCounters + 2; minCount = 1; piVar4 = &minCount; if (1 < *piVar3) { piVar4 = piVar3; } *piVar3 = *piVar4; if (10 < iVar1) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[0xe]) { piVar3 = this->_cutsceneCounters + 0xe; } this->_cutsceneCounters[0xe] = *piVar3; piVar3 = this->_cutsceneCounters + 2; minCount = 1; piVar4 = &minCount; if (1 < *piVar3) { piVar4 = piVar3; } *piVar3 = *piVar4; } } } } } } } } } } } if (0 < this->_eventCounters[0xd]) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[0xf]) { piVar3 = this->_cutsceneCounters + 0xf; } this->_cutsceneCounters[0xf] = *piVar3; piVar3 = this->_cutsceneCounters + 2; minCount = 1; piVar4 = &minCount; if (1 < *piVar3) { piVar4 = piVar3; } *piVar3 = *piVar4; } if (0 < this->_eventCounters[0xb]) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[0x10]) { piVar3 = this->_cutsceneCounters + 0x10; } this->_cutsceneCounters[0x10] = *piVar3; piVar3 = this->_cutsceneCounters + 2; minCount = 1; piVar4 = &minCount; if (1 < *piVar3) { piVar4 = piVar3; } *piVar3 = *piVar4; } if (0 < this->_eventCounters[0x19]) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[0x12]) { piVar3 = this->_cutsceneCounters + 0x12; } this->_cutsceneCounters[0x12] = *piVar3; piVar3 = this->_cutsceneCounters + 2; minCount = 1; piVar4 = &minCount; if (1 < *piVar3) { piVar4 = piVar3; } *piVar3 = *piVar4; } if (0 < this->_eventCounters[0x18]) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[0x11]) { piVar3 = this->_cutsceneCounters + 0x11; } this->_cutsceneCounters[0x11] = *piVar3; piVar3 = this->_cutsceneCounters + 2; minCount = 1; piVar4 = &minCount; if (1 < *piVar3) { piVar4 = piVar3; } *piVar3 = *piVar4; } if (0 < this->_eventCounters[0x1a]) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[0x13]) { piVar3 = this->_cutsceneCounters + 0x13; } this->_cutsceneCounters[0x13] = *piVar3; piVar3 = this->_cutsceneCounters + 2; minCount = 1; piVar4 = &minCount; if (1 < *piVar3) { piVar4 = piVar3; } *piVar3 = *piVar4; } if (0 < this->_eventCounters[0x9e]) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[0x14]) { piVar3 = this->_cutsceneCounters + 0x14; } this->_cutsceneCounters[0x14] = *piVar3; piVar3 = this->_cutsceneCounters + 2; minCount = 1; piVar4 = &minCount; if (1 < *piVar3) { piVar4 = piVar3; } *piVar3 = *piVar4; } if (0 < this->_eventCounters[0xbb]) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[0x16]) { piVar3 = this->_cutsceneCounters + 0x16; } this->_cutsceneCounters[0x16] = *piVar3; piVar3 = this->_cutsceneCounters + 2; minCount = 1; piVar4 = &minCount; if (1 < *piVar3) { piVar4 = piVar3; } *piVar3 = *piVar4; } if (this->_eventCounters[0x1eb] != 0) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[0x18]) { piVar3 = this->_cutsceneCounters + 0x18; } this->_cutsceneCounters[0x18] = *piVar3; piVar3 = this->_cutsceneCounters + 2; minCount = 1; piVar4 = &minCount; if (1 < *piVar3) { piVar4 = piVar3; } *piVar3 = *piVar4; } if (this->_eventCounters[0x1ec] != 0) { minCount = 1; piVar3 = &minCount; if (1 < this->_cutsceneCounters[0x19]) { piVar3 = this->_cutsceneCounters + 0x19; } piVar4 = this->_cutsceneCounters + 2; this->_cutsceneCounters[0x19] = *piVar3; piVar3 = this->_cutsceneCounters + 0x1a; minCount = 1; piVar5 = &minCount; if (1 < *piVar4) { piVar5 = piVar4; } iVar1 = *piVar5; *piVar4 = iVar1; minCount = 1; piVar5 = &minCount; if (1 < *piVar3) { piVar5 = piVar3; } *piVar3 = *piVar5; piVar3 = &minCount; if (1 < iVar1) { piVar3 = piVar4; } minCount = 1; *piVar4 = *piVar3; } return; } // 009282e0 void PersistentGameData::write() { undefined1 *puVar1; int extraout_ECX; void *pvVar2; uint *puVar3; int *valuePtr; int local_40; byte local_3c; uint local_38; int local_34; uint finalChecksum; void *checksumWord; void *local_28; void *local_24; void *local_20; void *local_1c; void *sectionSize; void *sectionId; void *sectionCount; byte flagByte [7]; byte isFlagSet; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(&DAT_00b7ab6c,1,0x10); local_34 = 1; local_40 = 0; local_3c = 0; local_38 = 0xfedcba76; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf84))),4,1); local_28 = *(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf84))); (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); sectionId = (void *)0x1; sectionSize = (void *)0x282; sectionCount = (void *)0x282; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionId,4,1); local_28 = sectionId; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionSize,4,1); local_28 = sectionSize; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionCount,4,1); local_28 = sectionCount; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); pvVar2 = (void *)0x0; if (sectionCount != (void *)0x0) { do { isFlagSet = this->_achievements[GHIDRA_INT(pvVar2)] != 0; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(&isFlagSet,1,1); flagByte[0] = isFlagSet; (GHIDRA_CAST((&local_40)))->Checksum::Update(flagByte,1); pvVar2 = (void *)(GHIDRA_INT(pvVar2) + 1); } while (pvVar2 < sectionCount); } sectionId = (void *)0x2; sectionSize = (void *)0x82c; sectionCount = (void *)0x20b; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionId,4,1); local_28 = sectionId; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionSize,4,1); local_28 = sectionSize; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionCount,4,1); local_28 = sectionCount; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); pvVar2 = (void *)0x0; if (sectionCount != (void *)0x0) { valuePtr = this->_eventCounters; do { (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(valuePtr,4,1); local_28 = (void *)*valuePtr; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); pvVar2 = (void *)(GHIDRA_INT(pvVar2) + 1); valuePtr = valuePtr + 1; } while (pvVar2 < sectionCount); } sectionId = (void *)0x3; sectionSize = (void *)0x38; sectionCount = (void *)0xe; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionId,4,1); local_28 = sectionId; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionSize,4,1); local_28 = sectionSize; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionCount,4,1); local_28 = sectionCount; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); pvVar2 = (void *)0x0; if (sectionCount != (void *)0x0) { puVar3 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdc8)))); do { (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(puVar3,4,1); local_28 = (void *)*puVar3; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); pvVar2 = (void *)(GHIDRA_INT(pvVar2) + 1); puVar3 = puVar3 + 1; } while (pvVar2 < sectionCount); } sectionId = (void *)0x4; sectionSize = (void *)0xb74; sectionCount = (void *)0x2dd; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionId,4,1); local_28 = sectionId; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionSize,4,1); local_28 = sectionSize; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionCount,4,1); local_28 = sectionCount; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); pvVar2 = (void *)0x0; if (sectionCount != (void *)0x0) { do { isFlagSet = *GHIDRA_CAST((GHIDRA_CAST(this->_eventCounters) + GHIDRA_INT(pvVar2) + 0x82cU)) != '\0'; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(&isFlagSet,1,1); flagByte[0] = isFlagSet; (GHIDRA_CAST((&local_40)))->Checksum::Update(flagByte,1); pvVar2 = (void *)(GHIDRA_INT(pvVar2) + 1); } while (pvVar2 < sectionCount); } sectionId = (void *)0x5; sectionSize = (void *)0x1c; sectionCount = (void *)0x7; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionId,4,1); local_28 = sectionId; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionSize,4,1); local_28 = sectionSize; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionCount,4,1); local_28 = sectionCount; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); pvVar2 = (void *)0x0; if (sectionCount != (void *)0x0) { do { isFlagSet = *GHIDRA_CAST((GHIDRA_CAST(this->_cutsceneCounters) + (GHIDRA_INT(pvVar2) - 0xa0U))) != '\0'; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(&isFlagSet,1,1); flagByte[0] = isFlagSet; (GHIDRA_CAST((&local_40)))->Checksum::Update(flagByte,1); pvVar2 = (void *)(GHIDRA_INT(pvVar2) + 1); } while (pvVar2 < sectionCount); } sectionId = (void *)0x6; sectionSize = (void *)0x1a0; sectionCount = (void *)0x68; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionId,4,1); local_28 = sectionId; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionSize,4,1); local_28 = sectionSize; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionCount,4,1); local_28 = sectionCount; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); pvVar2 = (void *)0x0; if (sectionCount != (void *)0x0) { do { isFlagSet = *GHIDRA_CAST((GHIDRA_CAST(this->_cutsceneCounters) + (GHIDRA_INT(pvVar2) - 0x99U))) != '\0'; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(&isFlagSet,1,1); flagByte[0] = isFlagSet; (GHIDRA_CAST((&local_40)))->Checksum::Update(flagByte,1); pvVar2 = (void *)(GHIDRA_INT(pvVar2) + 1); } while (pvVar2 < sectionCount); } sectionId = (void *)0x7; sectionSize = (void *)0xb8; sectionCount = (void *)0x2e; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionId,4,1); local_28 = sectionId; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionSize,4,1); local_28 = sectionSize; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionCount,4,1); local_28 = sectionCount; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); pvVar2 = (void *)0x0; if (sectionCount != (void *)0x0) { do { isFlagSet = *GHIDRA_CAST((GHIDRA_CAST(this->_cutsceneCounters) + (GHIDRA_INT(pvVar2) - 0x31U))) != '\0'; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(&isFlagSet,1,1); flagByte[0] = isFlagSet; (GHIDRA_CAST((&local_40)))->Checksum::Update(flagByte,1); pvVar2 = (void *)(GHIDRA_INT(pvVar2) + 1); } while (pvVar2 < sectionCount); } sectionId = (void *)0x8; sectionSize = (void *)0x6c; sectionCount = (void *)0x1b; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionId,4,1); local_28 = sectionId; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionSize,4,1); local_28 = sectionSize; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionCount,4,1); local_28 = sectionCount; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); pvVar2 = (void *)0x0; if (sectionCount != (void *)0x0) { valuePtr = this->_cutsceneCounters; do { local_20 = (void *)*valuePtr; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(&local_20,4,1); local_28 = local_20; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); pvVar2 = (void *)(GHIDRA_INT(pvVar2) + 1); valuePtr = valuePtr + 1; } while (pvVar2 < sectionCount); } sectionId = (void *)0x9; sectionSize = (void *)0x8; sectionCount = (void *)0x2; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionId,4,1); local_28 = sectionId; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionSize,4,1); local_28 = sectionSize; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionCount,4,1); local_28 = sectionCount; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); pvVar2 = (void *)0x0; if (sectionCount != (void *)0x0) { valuePtr = &this->_lastDifficulty; do { local_20 = (void *)*valuePtr; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(&local_20,4,1); local_28 = local_20; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); pvVar2 = (void *)(GHIDRA_INT(pvVar2) + 1); valuePtr = valuePtr + 1; } while (pvVar2 < sectionCount); } sectionId = (void *)0xa; sectionSize = (void *)0x140; sectionCount = (void *)0x50; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionId,4,1); local_28 = sectionId; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionSize,4,1); local_28 = sectionSize; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionCount,4,1); local_28 = sectionCount; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); pvVar2 = (void *)0x0; if (sectionCount != (void *)0x0) { do { isFlagSet = *GHIDRA_CAST((GHIDRA_CAST(this->_cutsceneCounters) + GHIDRA_INT(pvVar2) + 0x74U)) != '\0'; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(&isFlagSet,1,1); flagByte[0] = isFlagSet; (GHIDRA_CAST((&local_40)))->Checksum::Update(flagByte,1); pvVar2 = (void *)(GHIDRA_INT(pvVar2) + 1); } while (pvVar2 < sectionCount); } sectionCount = (void *)((this->_bestiaryEncounters)._size + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf78)))) + (this->_bestiaryDeaths)._size + (this->_bestiaryKills)._size); sectionId = (void *)0xb; sectionSize = (void *)(GHIDRA_INT(sectionCount) * 4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionId,4,1); local_28 = sectionId; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(§ionSize,4,1); local_28 = sectionSize; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); local_24 = (void *)0x4; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(&local_24,4,1); local_28 = local_24; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); local_1c = (void *)0x4; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(&local_1c,4,1); local_28 = local_1c; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); local_20 = (void *)((this->_bestiaryDeaths)._size << 2); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(&local_20,4,1); local_28 = local_20; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&local_28),4); valuePtr = (this->_bestiaryDeaths)._head; local_28 = (void *)*valuePtr; if (local_28 != valuePtr) { do { pvVar2 = local_28; puVar3 = GHIDRA_CAST((GHIDRA_INT(local_28) + 0x10)); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(puVar3,4,1); checksumWord = (void *)*puVar3; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&checksumWord),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(GHIDRA_CAST((GHIDRA_INT(pvVar2) + 0x14)),4,1); checksumWord = *(void **)(GHIDRA_CAST(pvVar2) + 0x14); (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&checksumWord),4); std:: _Tree_unchecked_const_iterator_>,std::_Iterator_base0> ::operator++((_Tree_unchecked_const_iterator_>,std::_Iterator_base0> *)&local_28); } while (local_28 != (this->_bestiaryDeaths)._head); } local_1c = (void *)0x2; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(&local_1c,4,1); checksumWord = local_1c; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&checksumWord),4); local_20 = (void *)((this->_bestiaryKills)._size << 2); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(&local_20,4,1); checksumWord = local_20; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&checksumWord),4); valuePtr = (this->_bestiaryKills)._head; local_28 = (void *)*valuePtr; if (local_28 != valuePtr) { do { pvVar2 = local_28; puVar3 = GHIDRA_CAST((GHIDRA_INT(local_28) + 0x10)); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(puVar3,4,1); checksumWord = (void *)*puVar3; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&checksumWord),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(GHIDRA_CAST((GHIDRA_INT(pvVar2) + 0x14)),4,1); checksumWord = *(void **)(GHIDRA_CAST(pvVar2) + 0x14); (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&checksumWord),4); std:: _Tree_unchecked_const_iterator_>,std::_Iterator_base0> ::operator++((_Tree_unchecked_const_iterator_>,std::_Iterator_base0> *)&local_28); } while (local_28 != (this->_bestiaryKills)._head); } local_1c = (void *)0x3; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(&local_1c,4,1); checksumWord = local_1c; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&checksumWord),4); local_20 = (void *)(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf78)))) << 2); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(&local_20,4,1); checksumWord = local_20; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&checksumWord),4); local_28 = (void *)**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf74)))); if (local_28 != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf74))))) { do { pvVar2 = local_28; puVar3 = GHIDRA_CAST((GHIDRA_INT(local_28) + 0x10)); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(puVar3,4,1); checksumWord = (void *)*puVar3; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&checksumWord),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(GHIDRA_CAST((GHIDRA_INT(pvVar2) + 0x14)),4,1); checksumWord = *(void **)(GHIDRA_CAST(pvVar2) + 0x14); (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&checksumWord),4); std:: _Tree_unchecked_const_iterator_>,std::_Iterator_base0> ::operator++((_Tree_unchecked_const_iterator_>,std::_Iterator_base0> *)&local_28); } while (local_28 != *(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf74)))); } local_1c = (void *)0x1; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(&local_1c,4,1); checksumWord = local_1c; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&checksumWord),4); local_20 = (void *)((this->_bestiaryEncounters)._size << 2); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(&local_20,4,1); checksumWord = local_20; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&checksumWord),4); valuePtr = (this->_bestiaryEncounters)._head; local_28 = (void *)*valuePtr; if (local_28 != valuePtr) { do { pvVar2 = local_28; puVar3 = GHIDRA_CAST((GHIDRA_INT(local_28) + 0x10)); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(puVar3,4,1); checksumWord = (void *)*puVar3; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&checksumWord),4); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(GHIDRA_CAST((GHIDRA_INT(pvVar2) + 0x14)),4,1); checksumWord = *(void **)(GHIDRA_CAST(pvVar2) + 0x14); (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&checksumWord),4); std:: _Tree_unchecked_const_iterator_>,std::_Iterator_base0> ::operator++((_Tree_unchecked_const_iterator_>,std::_Iterator_base0> *)&local_28); } while (local_28 != (this->_bestiaryEncounters)._head); } puVar1 = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf88))); *GHIDRA_CAST(puVar1) = *GHIDRA_CAST(puVar1) + 1; (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(puVar1,4,1); checksumWord = *(void **)puVar1; (GHIDRA_CAST((&local_40)))->Checksum::Update(GHIDRA_CAST(&checksumWord),4); if ((local_34 == 0) && (local_3c != 0)) { if (local_3c < 4) { memset((void *)(extraout_ECX + GHIDRA_UINT(local_3c)),0,GHIDRA_UINT((byte)(4 - local_3c))); } finalChecksum = local_38 * -0x80000000 + (local_38 >> 1) + local_40; } else { finalChecksum = local_38; } (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x1c))(&finalChecksum,4,1); return; } // 00928ee0 void PersistentGameData::SaveToSteamCloud() { byte isSharedSaveWritten; char cVar1; undefined4 *allocBlock; undefined4 *cloudFile; qword *allocatedBytes; undefined1 *savePathChars; qword oldAllocatedBytes; if ((g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) && (isSharedSaveWritten = shared_save_write(), isSharedSaveWritten == 0)) { return; } if (this->_saveFile != GHIDRA_CAST(0x0)) { (*(code *)**GHIDRA_CAST(this->_saveFile))(1); } if (g_mainHeap == (void *)0x0) { allocatedBytes = &g_allocatedBytesNoHeap; } else { allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); } allocBlock = malloc(0x28); if (allocBlock == GHIDRA_CAST(0x0)) { FUN_00a23200(0x7fcb9dd6); } else { oldAllocatedBytes = *allocatedBytes; *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) + 0x28; *allocBlock = 0x28; *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) + GHIDRA_UINT((0xffffffd7 < GHIDRA_UINT(oldAllocatedBytes))); cloudFile = allocBlock + 1; if (cloudFile != GHIDRA_CAST(0x0)) { allocBlock[2] = 2; allocBlock[3] = 0; *cloudFile = IsaacRepentancePlus::SteamCloudFile::vftable; allocBlock[5] = 0; allocBlock[7] = 0; allocBlock[8] = 0; *GHIDRA_CAST((allocBlock + 9)) = 0; goto LAB_00928f4a; } } cloudFile = GHIDRA_CAST(0x0); LAB_00928f4a: savePathChars = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20))); this->_saveFile = cloudFile; KAGE_LogMessage(1,GHIDRA_CAST("Saving PersistentGameData to Steam Cloud: %s.\n")); if (0xf < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x34))))) { savePathChars = *GHIDRA_CAST(savePathChars); } cVar1 = FUN_00683930(savePathChars,0x10000); if ((cVar1 == '\0') || (cVar1 = (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x30))(), cVar1 == '\0')) { (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x34))(); KAGE_LogMessage(1,GHIDRA_CAST("[warn] failed to open file.\n")); return; } write(this); (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x34))(); return; } // 00929010 PersistentGameData * PersistentGameData::operator_assign(PersistentGameData *other) { undefined4 uVar1; undefined4 uVar2; undefined4 uVar3; byte *srcText; int dwordsLeft; undefined4 *puVar4; int *src; byte *pbVar5; undefined4 *src; int *dst; srcText = &(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0x8))); if (&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8))) != srcText) { if (0xf < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0x1c))))) { srcText = *GHIDRA_CAST(srcText); } (GHIDRA_CAST((&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8))))))->std::string::assign(srcText,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0x18))))); } srcText = &(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0x20))); if (&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20))) != srcText) { if (0xf < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0x34))))) { srcText = *GHIDRA_CAST(srcText); } (GHIDRA_CAST((&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20))))))->std::string::assign(srcText,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0x30))))); } srcText = other->_achievements; pbVar5 = this->_achievements; for (dwordsLeft = 0xa0; dwordsLeft != 0; dwordsLeft = dwordsLeft + -1) { *GHIDRA_CAST(pbVar5) = *GHIDRA_CAST(srcText); srcText = srcText + 4; pbVar5 = pbVar5 + 4; } *GHIDRA_CAST(pbVar5) = *GHIDRA_CAST(srcText); src = other->_eventCounters; dst = this->_eventCounters; for (dwordsLeft = 0x20b; dwordsLeft != 0; dwordsLeft = dwordsLeft + -1) { *dst = *src; src = src + 1; dst = dst + 1; } puVar4 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xae8)))); src = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xae8)))); for (dwordsLeft = 0xb7; dwordsLeft != 0; dwordsLeft = dwordsLeft + -1) { *src = *puVar4; puVar4 = puVar4 + 1; src = src + 1; } *GHIDRA_CAST(src) = *GHIDRA_CAST(puVar4); uVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xdcc)))); uVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xdd0)))); uVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xdd4)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdc8)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xdc8)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdcc)))) = uVar1; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdd0)))) = uVar2; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdd4)))) = uVar3; uVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xddc)))); uVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xde0)))); uVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xde4)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdd8)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xdd8)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xddc)))) = uVar1; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xde0)))) = uVar2; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xde4)))) = uVar3; uVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xdec)))); uVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xdf0)))); uVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xdf4)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xde8)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xde8)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdec)))) = uVar1; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdf0)))) = uVar2; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdf4)))) = uVar3; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdf8)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xdf8)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe00)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xe00)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe04)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xe04)))); (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe06))) = (*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xe06))); puVar4 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xe07)))); src = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe07)))); for (dwordsLeft = 0x1a; dwordsLeft != 0; dwordsLeft = dwordsLeft + -1) { *src = *puVar4; puVar4 = puVar4 + 1; src = src + 1; } uVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xe73)))); uVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xe77)))); uVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xe7b)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe6f)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xe6f)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe73)))) = uVar1; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe77)))) = uVar2; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe7b)))) = uVar3; uVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xe83)))); uVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xe87)))); uVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xe8b)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe7f)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xe7f)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe83)))) = uVar1; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe87)))) = uVar2; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe8b)))) = uVar3; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe8f)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xe8f)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe97)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xe97)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe9b)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xe9b)))); src = other->_cutsceneCounters; dst = this->_cutsceneCounters; for (dwordsLeft = 0x1b; dwordsLeft != 0; dwordsLeft = dwordsLeft + -1) { *dst = *src; src = src + 1; dst = dst + 1; } dwordsLeft = other->_lastDifficulty; this->_characterMenuShown = other->_characterMenuShown; this->_lastDifficulty = dwordsLeft; uVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf18)))); uVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf1c)))); uVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf20)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf14)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf14)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf18)))) = uVar1; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf1c)))) = uVar2; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf20)))) = uVar3; uVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf28)))); uVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf2c)))); uVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf30)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf24)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf24)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf28)))) = uVar1; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf2c)))) = uVar2; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf30)))) = uVar3; uVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf38)))); uVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf3c)))); uVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf40)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf34)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf34)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf38)))) = uVar1; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf3c)))) = uVar2; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf40)))) = uVar3; uVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf48)))); uVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf4c)))); uVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf50)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf44)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf44)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf48)))) = uVar1; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf4c)))) = uVar2; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf50)))) = uVar3; uVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf58)))); uVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf5c)))); uVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf60)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf54)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf54)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf58)))) = uVar1; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf5c)))) = uVar2; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf60)))) = uVar3; std_map_copy_assign(&this->_bestiaryEncounters,&other->_bestiaryEncounters); std_map_copy_assign(&this->_bestiaryKills,&other->_bestiaryKills); std_map_copy_assign(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf74))),&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf74)))); std_map_copy_assign(&this->_bestiaryDeaths,&other->_bestiaryDeaths); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf84)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf84)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf88)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xf88)))); this->_isFileLoaded = other->_isFileLoaded; this->_saveFile = (void *)0x0; return this; } // 00929240 byte * PersistentGameData::get_save_file_name() { byte *pbVar1; byte *fileNameCopy; byte ch; byte *fileNameCopy; fileNameCopy = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8))); if (0xf < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1c))))) { fileNameCopy = *GHIDRA_CAST(fileNameCopy); } ch = *fileNameCopy; if (ch == 0) { fileNameCopy = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20))); if (0xf < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x34))))) { fileNameCopy = *GHIDRA_CAST(fileNameCopy); } ch = *fileNameCopy; } pbVar1 = fileNameCopy; if (ch != 0) { do { pbVar1 = pbVar1 + 1; } while (*pbVar1 != 0); for (; (pbVar1 != fileNameCopy && (*pbVar1 != 0x2f)); pbVar1 = pbVar1 + -1) { } } fileNameCopy = pbVar1 + 1; if (*pbVar1 != 0x2f) { fileNameCopy = pbVar1; } pbVar1 = fileNameCopy; do { ch = *pbVar1; pbVar1 = pbVar1 + 1; } while (ch != 0); fileNameCopy = operator_new_tracked(GHIDRA_UINT((pbVar1 + (1 - GHIDRA_INT((fileNameCopy + 1)))))); pbVar1 = fileNameCopy; do { ch = *fileNameCopy; fileNameCopy = fileNameCopy + 1; *pbVar1 = ch; pbVar1 = pbVar1 + 1; } while (ch != 0); return fileNameCopy; } // 009293d0 void PersistentGameData::write_file(byte *path) { char isFileOpen; undefined4 *block; undefined4 *puVar1; int *saveFile; int fd; qword *allocCounter; qword oldAllocated; if (this->_saveFile != GHIDRA_CAST(0x0)) { (*(code *)**GHIDRA_CAST(this->_saveFile))(1); } if (g_mainHeap == (void *)0x0) { allocCounter = &g_allocatedBytesNoHeap; } else { allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); } block = malloc(0x14); if (block == GHIDRA_CAST(0x0)) { FUN_00a23200(0x7fcb9dd6); } else { oldAllocated = *allocCounter; *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) + 0x14; *block = 0x14; *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) + GHIDRA_UINT((0xffffffeb < GHIDRA_UINT(oldAllocated))); puVar1 = block + 1; if (puVar1 != GHIDRA_CAST(0x0)) { block[2] = 2; block[3] = 0; *puVar1 = KAGE::Filesys::File::vftable; block[4] = 0; goto LAB_00929418; } } puVar1 = GHIDRA_CAST(0x0); LAB_00929418: this->_saveFile = puVar1; saveFile = (GHIDRA_CAST((&PTR_vftable_00c5aa80)))->SaveDataManager::open_file_write(path,0); this->_saveFile = saveFile; if (saveFile == GHIDRA_CAST(0x0)) { KAGE_LogMessage(1,GHIDRA_CAST("Could not open %s for writing!\n")); return; } isFileOpen = (**(code **)(*saveFile + 0x30))(); if (isFileOpen != '\0') { fd = _fileno(GHIDRA_CAST(saveFile[3])); if (-1 < fd) { flock(fd,2); } } write(this); saveFile = this->_saveFile; isFileOpen = (**(code **)(*saveFile + 0x30))(); if (isFileOpen != '\0') { fd = _fileno(GHIDRA_CAST(saveFile[3])); if (-1 < fd) { flock(fd,8); } } (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x34))(); return; } // 009294f0 void PersistentGameData::Save() { qword qVar1; byte isSharedSaveWritten; char isOpen; undefined4 *fileBlock; undefined4 *newFile; byte *path; int *saveFile; int fd; qword *allocatedBytes; if ((g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) && (isSharedSaveWritten = shared_save_write(), isSharedSaveWritten == 0)) { return; } if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18)))) == 0) { KAGE_LogMessage(1,GHIDRA_CAST("PersistentGameData no filename supplied\n")); return; } if (this->_saveFile != GHIDRA_CAST(0x0)) { (*(code *)**GHIDRA_CAST(this->_saveFile))(1); } if (g_mainHeap == (void *)0x0) { allocatedBytes = &g_allocatedBytesNoHeap; } else { allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); } fileBlock = malloc(0x14); if (fileBlock == GHIDRA_CAST(0x0)) { FUN_00a23200(0x7fcb9dd6); } else { qVar1 = *allocatedBytes; *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) + 0x14; *fileBlock = 0x14; *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) + GHIDRA_UINT((0xffffffeb < GHIDRA_UINT(qVar1))); newFile = fileBlock + 1; if (newFile != GHIDRA_CAST(0x0)) { fileBlock[2] = 2; fileBlock[3] = 0; *newFile = KAGE::Filesys::File::vftable; fileBlock[4] = 0; goto LAB_00929575; } } newFile = GHIDRA_CAST(0x0); LAB_00929575: path = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8))); this->_saveFile = newFile; if (0xf < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1c))))) { path = *GHIDRA_CAST(path); } saveFile = (GHIDRA_CAST((&PTR_vftable_00c5aa80)))->SaveDataManager::open_file_write(path,0); this->_saveFile = saveFile; if (saveFile == GHIDRA_CAST(0x0)) { KAGE_LogMessage(1,GHIDRA_CAST("Could not open %s for writing!\n")); return; } isOpen = (**(code **)(*saveFile + 0x30))(); if ((isOpen != '\0') && (fd = _fileno(GHIDRA_CAST(saveFile[3])), -1 < fd)) { flock(fd,2); } write(this); saveFile = this->_saveFile; isOpen = (**(code **)(*saveFile + 0x30))(); if ((isOpen != '\0') && (fd = _fileno(GHIDRA_CAST(saveFile[3])), -1 < fd)) { flock(fd,8); } (**(code **)(*GHIDRA_CAST(this->_saveFile) + 0x34))(); return; } // 009296c0 void PersistentGameData::check_challenge_unlocks() { uint clampedChallenge; uint requirementIdx; uint uVar1; uint lastChallengeIdx; void *challengeParamsBegin; bool isAllAchieved; bool isAllAchievedNext; int requirementOffset; uVar1 = 1; do { requirementIdx = 0; challengeParamsBegin = (g_manager->_challengeParams)._begin; lastChallengeIdx = (GHIDRA_INT((g_manager->_challengeParams)._end) - GHIDRA_INT((g_manager->_challengeParams)._begin)) / 0xa4 - 1; isAllAchievedNext = true; while( true ) { isAllAchieved = isAllAchievedNext; clampedChallenge = lastChallengeIdx; if (uVar1 < lastChallengeIdx) { clampedChallenge = uVar1; } if (GHIDRA_UINT((*GHIDRA_CAST((clampedChallenge * 0xa4 + 0x4c + GHIDRA_INT(challengeParamsBegin))) - *GHIDRA_CAST((clampedChallenge * 0xa4 + 0x48 + GHIDRA_INT(challengeParamsBegin))) >> 2)) <= requirementIdx) break; requirementOffset = requirementIdx * 4; clampedChallenge = lastChallengeIdx; if (uVar1 < lastChallengeIdx) { clampedChallenge = uVar1; } requirementIdx = requirementIdx + 1; isAllAchievedNext = false; if (this->_achievements [*GHIDRA_CAST((*GHIDRA_CAST((clampedChallenge * 0xa4 + 0x48 + GHIDRA_INT(challengeParamsBegin))) + requirementOffset))] != 0) { isAllAchievedNext = isAllAchieved; } } if (((isAllAchieved) && (uVar1 < 0x2e)) && (*GHIDRA_CAST((&DAT_00b7b0b0 + uVar1 * 4)) != 0)) { TryUnlock(this,*GHIDRA_CAST((&DAT_00b7b0b0 + uVar1 * 4))); } uVar1 = uVar1 + 1; } while (GHIDRA_INT(uVar1) < 0x2e); return; } // 00929790 void PersistentGameData::UnlockSteamAchievement(int achievementID) { undefined4 *steamUserStats; byte achievementName [8]; uint local_c; undefined1 auStack_8 [4]; local_c = __security_cookie ^ GHIDRA_UINT((auStack_8 + 4)); if (this->_isSteamAchievementsEnabled != 0) { sprintf_s(achievementName,8,s__d); KAGE_LogMessage(1,GHIDRA_CAST("unlock steam achievement \'%s\'\n")); if ((DAT_00c5ab08 & 1) != 0) { steamUserStats = GHIDRA_CAST(SteamInternal_ContextInit(&PTR_FUN_00bf93c8)); (**(code **)(*GHIDRA_CAST(*steamUserStats) + 0x18))(achievementName); steamUserStats = GHIDRA_CAST(SteamInternal_ContextInit(&PTR_FUN_00bf93c8)); (**(code **)(*GHIDRA_CAST(*steamUserStats) + 0x24))(); } } return; } // 00929a20 byte PersistentGameData::TryUnlock(int achievementID) { byte isGameplayInputActive; Manager *manager; manager = g_manager; if (((this->_isReadOnly != 0) || (achievementID == 0)) || (this->_achievements[achievementID] != 0)) { return 0; } this->_achievements[achievementID] = 1; if (manager->_netplayManager != *GHIDRA_CAST((manager + 1))) { isGameplayInputActive = Manager::IsGameplayInputActive(GHIDRA_INT(manager)); if (isGameplayInputActive != 0) goto LAB_00929a75; } if (this->_isSteamAchievementsEnabled != 0) { UnlockSteamAchievement(this,achievementID); Manager::queue_achievement_popup(achievementID); } LAB_00929a75: *GHIDRA_CAST(this) = 1; check_challenge_unlocks(this); check_collection_unlocks(this); return 1; } // 00929aa0 byte PersistentGameData::Unlocked(int achievementID) { if ((achievementID == -2) || ((-1 < achievementID && ((0x281 < GHIDRA_UINT(achievementID) || (((achievementID != 0 && (this->_achievements[achievementID] == 0)) && (((g_manager->_state != 2 || (g_game == GHIDRA_CAST(0x0))) || (((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))))))))))) { return 0; } return 1; } // 00929b40 void PersistentGameData::IncreaseEventCounter(int eEventCounters, int num) { int iVar1; uint uVar2; int marksDone; uint baseAllMarks; int iVar3; uint characterIndex; uint allMarksCount; int specificMarkCount; uint baseAllMarksCount; int aiStack_c4 [47]; uint local_8; bool isAllMarked; local_8 = __security_cookie ^ GHIDRA_UINT((aiStack_c4 + 0x30)); if (this->_isReadOnly == 0) { iVar1 = this->_eventCounters[eEventCounters]; iVar3 = 0; if (-iVar1 == num || -num < iVar1) { iVar3 = iVar1 + num; } this->_eventCounters[eEventCounters] = iVar3; *GHIDRA_CAST(this) = 1; uVar2 = 0; if (this->_eventCounters[0xca] != 0) { TryUnlock(this,0x167); uVar2 = this->_eventCounters[0xca]; } if (9 < uVar2) { TryUnlock(this,0x181); } if (9 < GHIDRA_UINT(this->_eventCounters[200])) { TryUnlock(this,0x179); } if (4 < GHIDRA_UINT(this->_eventCounters[0xc9])) { TryUnlock(this,0x17e); } uVar2 = this->_eventCounters[2]; if (99 < uVar2) { TryUnlock(this,0x55); uVar2 = this->_eventCounters[2]; } if (499 < uVar2) { TryUnlock(this,0x15e); } uVar2 = this->_eventCounters[3]; if (9 < uVar2) { TryUnlock(this,0x1c); uVar2 = this->_eventCounters[3]; } if (99 < uVar2) { TryUnlock(this,0xc); } if (3 < GHIDRA_UINT(this->_eventCounters[7])) { TryUnlock(this,0x24); } if (9 < GHIDRA_UINT(this->_eventCounters[9])) { TryUnlock(this,0x1a); } if (99 < GHIDRA_UINT(this->_eventCounters[5])) { TryUnlock(this,0x91); } if (4 < GHIDRA_UINT(this->_eventCounters[0xc2])) { TryUnlock(this,0x161); } uVar2 = this->_eventCounters[0xb]; if (9 < uVar2) { TryUnlock(this,0x44); uVar2 = this->_eventCounters[0xb]; } if (4 < uVar2) { TryUnlock(this,0x39); } if (4 < GHIDRA_UINT(this->_eventCounters[0xd])) { TryUnlock(this,0x4e); } if ((this->_eventCounters[0x18] != 0) && (this->_eventCounters[0x19] != 0)) { TryUnlock(this,0x29); } if (99 < GHIDRA_UINT(this->_eventCounters[10])) { TryUnlock(this,0x1e); } uVar2 = 0; if (this->_eventCounters[1] != 0) { TryUnlock(this,0x51); uVar2 = this->_eventCounters[1]; } if (1 < uVar2) { TryUnlock(this,0x96); uVar2 = this->_eventCounters[1]; } if (2 < uVar2) { TryUnlock(this,8); uVar2 = this->_eventCounters[1]; } if (3 < uVar2) { TryUnlock(this,0x8b); uVar2 = this->_eventCounters[1]; } if (4 < uVar2) { TryUnlock(this,0x21); uVar2 = this->_eventCounters[1]; } if (5 < uVar2) { TryUnlock(this,0x8c); uVar2 = this->_eventCounters[1]; } if (6 < uVar2) { TryUnlock(this,0x8d); uVar2 = this->_eventCounters[1]; } if (7 < uVar2) { TryUnlock(this,10); uVar2 = this->_eventCounters[1]; } if (8 < uVar2) { TryUnlock(this,0xb); uVar2 = this->_eventCounters[1]; } if (9 < uVar2) { TryUnlock(this,0x20); TryUnlock(this,0xea); uVar2 = this->_eventCounters[1]; } if (10 < uVar2) { TryUnlock(this,0x22); uVar2 = this->_eventCounters[1]; if (10 < uVar2) { TryUnlock(this,0x156); uVar2 = this->_eventCounters[1]; } } if (0xf < uVar2) { TryUnlock(this,0x157); uVar2 = this->_eventCounters[1]; } if (0x14 < uVar2) { TryUnlock(this,0x158); uVar2 = this->_eventCounters[1]; } if (0x1d < uVar2) { TryUnlock(this,0x159); } if (0x13 < GHIDRA_UINT(this->_eventCounters[0xc])) { TryUnlock(this,0x3d); } if (99 < GHIDRA_UINT(this->_eventCounters[0xe])) { TryUnlock(this,0x40); } uVar2 = this->_eventCounters[0xf]; if (9 < uVar2) { TryUnlock(this,0x42); uVar2 = this->_eventCounters[0xf]; } if (0x18 < uVar2) { TryUnlock(this,0x17c); } uVar2 = this->_eventCounters[0x10]; if (0x13 < uVar2) { TryUnlock(this,0x8e); uVar2 = this->_eventCounters[0x10]; } if (0x18 < uVar2) { TryUnlock(this,0x178); uVar2 = this->_eventCounters[0x10]; } if (0x31 < uVar2) { TryUnlock(this,0x17f); } if (0x1d < GHIDRA_UINT(this->_eventCounters[0x11])) { TryUnlock(this,0x93); } if (0x1d < GHIDRA_UINT(this->_eventCounters[0x12])) { TryUnlock(this,0x94); } if ((0x1e < GHIDRA_UINT(this->_eventCounters[0xbe])) && (g_manager->_state == 1)) { TryUnlock(this,0x145); } if (4 < GHIDRA_UINT(this->_eventCounters[0xc0])) { TryUnlock(this,0x150); } if (6 < GHIDRA_UINT(this->_eventCounters[0xc1])) { TryUnlock(this,0x162); } if (0x13 < GHIDRA_UINT(this->_eventCounters[0xc3])) { TryUnlock(this,0x166); } if (0x13 < GHIDRA_UINT(this->_eventCounters[0xc4])) { TryUnlock(this,0x16a); } if (0x31 < GHIDRA_UINT(this->_eventCounters[0xc5])) { TryUnlock(this,0x16c); } if (0x13 < GHIDRA_UINT(this->_eventCounters[0xc6])) { TryUnlock(this,0x173); } if (0x31 < GHIDRA_UINT(this->_eventCounters[199])) { TryUnlock(this,0x177); } if (9 < GHIDRA_UINT(this->_eventCounters[0x1ed])) { TryUnlock(this,0x199); } if (9 < GHIDRA_UINT(this->_eventCounters[0x1ee])) { TryUnlock(this,0x221); } if (4 < GHIDRA_UINT(this->_eventCounters[0x1ef])) { TryUnlock(this,0x20b); } if (2 < GHIDRA_UINT(this->_eventCounters[0x9e])) { TryUnlock(this,0x197); } iVar1 = 0; do { aiStack_c4[iVar1] = iVar1; aiStack_c4[iVar1 + 1] = iVar1 + 1; aiStack_c4[iVar1 + 2] = iVar1 + 2; aiStack_c4[iVar1 + 3] = iVar1 + 3; iVar1 = iVar1 + 4; } while (iVar1 < 8); iVar1 = 0; aiStack_c4[8] = 9; aiStack_c4[9] = 0xc; aiStack_c4[10] = 0xd; aiStack_c4[0xb] = 0xe; baseAllMarks = 0; uVar2 = 0; aiStack_c4[0xc] = 0; aiStack_c4[0xd] = 1; aiStack_c4[0xe] = 2; aiStack_c4[0xf] = 3; aiStack_c4[0x14] = 8; aiStack_c4[0x10] = 4; aiStack_c4[0x11] = 5; aiStack_c4[0x12] = 6; aiStack_c4[0x13] = 7; aiStack_c4[0x15] = 9; aiStack_c4[0x17] = 0xd; aiStack_c4[0x18] = 0xe; aiStack_c4[0x19] = 0xf; aiStack_c4[0x1a] = 0x10; aiStack_c4[0x16] = 10; aiStack_c4[0x1d] = 0x15; aiStack_c4[0x1e] = 0x16; aiStack_c4[0x1f] = 0x17; aiStack_c4[0x20] = 0x18; aiStack_c4[0x1b] = 0x12; aiStack_c4[0x21] = 0x19; aiStack_c4[0x22] = 0x1a; aiStack_c4[0x23] = 0x1b; aiStack_c4[0x24] = 0x1c; aiStack_c4[0x1c] = 0x13; aiStack_c4[0x25] = 0x1d; aiStack_c4[0x26] = 0x1e; aiStack_c4[0x27] = 0x1f; aiStack_c4[0x28] = 0x20; aiStack_c4[0x2d] = 0x25; aiStack_c4[0x29] = 0x21; aiStack_c4[0x2a] = 0x22; aiStack_c4[0x2b] = 0x23; aiStack_c4[0x2c] = 0x24; specificMarkCount = 0; baseAllMarksCount = 0; allMarksCount = 0; isAllMarked = true; characterIndex = 0; do { if (aiStack_c4[characterIndex + 0xc] < 0x29) { iVar3 = aiStack_c4[characterIndex + 0xc] * 0x90; baseAllMarks = baseAllMarksCount; if (&DAT_00c35ed0 + iVar3 != GHIDRA_CAST(0x0)) { marksDone = 0; uVar2 = 0; do { iVar1 = *GHIDRA_CAST((&DAT_00c35ed0 + iVar3 + aiStack_c4[uVar2] * 8)); if ((iVar1 != 0) && ((this->_eventCounters[iVar1] & 2) != 0)) { marksDone = marksDone + 1; } uVar2 = uVar2 + 1; } while (uVar2 < 0xc); if ((((this->_eventCounters[*GHIDRA_CAST((&DAT_00c35ed8 + iVar3))] != 0) && (this->_eventCounters[*GHIDRA_CAST((&DAT_00c35ef0 + iVar3))] != 0)) && (this->_eventCounters[*GHIDRA_CAST((&DAT_00c35ee0 + iVar3))] != 0)) && (this->_eventCounters[*GHIDRA_CAST((&DAT_00c35ef8 + iVar3))] != 0)) { TryUnlock(this,*GHIDRA_CAST((&DAT_00c35f54 + iVar3))); } if ((this->_eventCounters[*GHIDRA_CAST((&DAT_00c35ee8 + iVar3))] != 0) && (this->_eventCounters[*GHIDRA_CAST((&DAT_00c35f18 + iVar3))] != 0)) { TryUnlock(this,*GHIDRA_CAST((&DAT_00c35f5c + iVar3))); } if (marksDone == 0xc) { TryUnlock(this,*GHIDRA_CAST((&DAT_00c35f24 + iVar3))); } if (characterIndex < 0x11) { iVar1 = specificMarkCount + 1; if (this->_eventCounters[*GHIDRA_CAST((&DAT_00c35ef0 + iVar3))] == 0) { iVar1 = specificMarkCount; } isAllMarked = (bool)(this->_eventCounters[*GHIDRA_CAST((&DAT_00c35f00 + iVar3))] != 0 & isAllMarked); specificMarkCount = iVar1; if (marksDone != 0xc) goto LAB_0092a235; baseAllMarksCount = baseAllMarksCount + 1; uVar2 = allMarksCount + 1; baseAllMarks = baseAllMarksCount; allMarksCount = allMarksCount + 1; } else if (marksDone == 0xc) { uVar2 = allMarksCount + 1; iVar1 = specificMarkCount; allMarksCount = uVar2; } else { LAB_0092a235: iVar1 = specificMarkCount; uVar2 = allMarksCount; } } } characterIndex = characterIndex + 1; } while (characterIndex < 0x22); if (2 < iVar1) { TryUnlock(this,0x15a); iVar1 = specificMarkCount; } if (5 < iVar1) { TryUnlock(this,0x15b); } if (isAllMarked) { TryUnlock(this,0x114); } if (0x10 < baseAllMarks) { TryUnlock(this,0x223); } if (0x21 < uVar2) { TryUnlock(this,0x27c); } } return; } // 0092a2d0 void PersistentGameData::AddToCollection(int collectibleID) { if ((this->_isReadOnly == 0) && (GHIDRA_UINT(collectibleID) < 0x2dd)) { if ((collectibleID != 0) && (*GHIDRA_CAST((GHIDRA_CAST(this->_eventCounters) + collectibleID + 0x82c)) == '\0')) { *GHIDRA_CAST((GHIDRA_CAST(this->_eventCounters) + collectibleID + 0x82c)) = 1; *GHIDRA_CAST(this) = 1; check_collection_unlocks(this); } if ((((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xb5c))) != '\0') && ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xb27))) != '\0')) && ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc4c))) != '\0')) { TryUnlock(this,0x17d); } if (((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc39))) != '\0') && ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xbd0))) != '\0')) { TryUnlock(this,0x16b); } } return; } // 0092a350 void PersistentGameData::check_collection_unlocks() { ItemConfig_Item *collectible; int iVar1; int iVar2; int seenCount; uint id; int unlockedAchievementCount; int iVar3; int unseenExcludedCount; iVar3 = 0; seenCount = 0; iVar2 = 0; id = 1; unseenExcludedCount = 0; do { if (*GHIDRA_CAST((GHIDRA_CAST(this->_eventCounters) + id + 0x82c)) == '\0') { if (((((id != 0x114) && (id != 0x14d)) && (id != 0x14e)) && ((id != 0x14f && (id != 0x11b)))) && (id != 0x14b)) { collectible = (GHIDRA_CAST((&g_manager->_itemConfig)))->ItemConfig::GetCollectible(id); if ((collectible == GHIDRA_CAST(0x0)) || (iVar1 = iVar3, collectible->hidden != 0)) { seenCount = seenCount + 1; iVar1 = iVar3 + 1; if (0x15a < id) { iVar1 = iVar3; } } iVar2 = unseenExcludedCount; goto LAB_0092a3f8; } iVar2 = iVar2 + 1; unseenExcludedCount = iVar2; } else { seenCount = seenCount + 1; iVar1 = iVar3 + 1; if (0x15a < id) { iVar1 = iVar3; } LAB_0092a3f8: iVar3 = iVar1; } id = id + 1; if (0x2dc < GHIDRA_INT(id)) { if (0x159 < iVar2 + iVar3) { unlockedAchievementCount = 0; iVar3 = 1; iVar1 = 0; do { if (this->_achievements[iVar3] == 0) { if (((((iVar3 == 0x81) || (iVar3 == 0x82)) || (iVar3 == 0x83)) || (((iVar3 == 0x84 || (iVar3 == 0x85)) || ((iVar3 == 0x9c || ((iVar3 == 0x52 || (iVar3 == 0x54)))))))) || (iVar3 == 0xaf)) { iVar1 = iVar1 + 1; } } else { unlockedAchievementCount = unlockedAchievementCount + 1; } iVar3 = iVar3 + 1; } while (iVar3 < 0xb3); if (0xb0 < iVar1 + unlockedAchievementCount) { TryUnlock(this,0x45); iVar2 = unseenExcludedCount; } if ((0xb0 < unlockedAchievementCount) && (iVar2 == 0)) { TryUnlock(this,0x54); } } if (0x1fd < seenCount) { iVar3 = 1; iVar2 = 0; do { iVar1 = iVar2 + 1; if (this->_achievements[iVar3] == 0) { iVar1 = iVar2; } iVar3 = iVar3 + 1; iVar2 = iVar1; } while (iVar3 < 0x282); if (0x112 < iVar1) { TryUnlock(this,0xeb); } if (0x191 < iVar1) { TryUnlock(this,0x153); } if ((0x2db < seenCount) && (0x27f < iVar1)) { TryUnlock(this,0x27d); } } return; } } while( true ); } // 0092a7b0 void PersistentGameData::AddChallenge(int challengeID) { if ((this->_isReadOnly == 0) && (GHIDRA_UINT(challengeID) < 0x2e)) { *GHIDRA_CAST((GHIDRA_CAST(this->_cutsceneCounters) + challengeID + -0x31)) = 1; switch(challengeID) { case 1: TryUnlock(this,0x59); return; case 2: TryUnlock(this,0x5a); return; case 3: TryUnlock(this,0x5b); return; case 4: TryUnlock(this,0x5c); return; case 5: TryUnlock(this,0x5d); return; case 6: TryUnlock(this,0x5e); return; case 7: TryUnlock(this,0x78); return; case 8: TryUnlock(this,0x60); return; case 9: TryUnlock(this,0x61); return; case 10: TryUnlock(this,0x62); return; case 0xb: TryUnlock(this,99); return; case 0xc: TryUnlock(this,100); return; case 0xd: TryUnlock(this,0x3c); return; case 0xe: TryUnlock(this,0x3f); return; case 0xf: TryUnlock(this,0x65); return; case 0x10: TryUnlock(this,0x66); return; case 0x11: TryUnlock(this,0x67); return; case 0x12: TryUnlock(this,0x68); return; case 0x13: TryUnlock(this,0x3e); return; case 0x14: TryUnlock(this,0x5f); return; case 0x15: TryUnlock(this,0xe0); return; case 0x16: TryUnlock(this,0xe1); return; case 0x17: TryUnlock(this,0xe2); return; case 0x18: TryUnlock(this,0xe3); return; case 0x19: TryUnlock(this,0xe4); return; case 0x1a: TryUnlock(this,0xe5); return; case 0x1b: TryUnlock(this,0xe6); return; case 0x1c: TryUnlock(this,0xe7); return; case 0x1d: TryUnlock(this,0xe8); return; case 0x1e: TryUnlock(this,0xe9); return; case 0x1f: TryUnlock(this,0x14b); return; case 0x20: TryUnlock(this,0x14c); return; case 0x21: TryUnlock(this,0x14d); return; case 0x22: TryUnlock(this,0x14e); return; case 0x23: TryUnlock(this,0x14f); return; case 0x24: TryUnlock(this,0x205); return; case 0x25: TryUnlock(this,0x206); return; case 0x26: TryUnlock(this,0x207); return; case 0x27: TryUnlock(this,0x208); return; case 0x28: TryUnlock(this,0x209); return; case 0x29: TryUnlock(this,0x20a); return; case 0x2a: TryUnlock(this,0x213); return; case 0x2b: TryUnlock(this,0x214); return; case 0x2c: TryUnlock(this,0x215); return; case 0x2d: TryUnlock(this,0x21a); return; } } return; } // 0092acb0 byte PersistentGameData::AddBestiaryKill(int EntityType, int EntityVariant) { EntityConfig_Entity *bestiaryEntry; int *killCountSlot; undefined4 *newKillCountSlot; uint killCount; int otherKillCount; int iVar1; PersistentGameData *persistentData; undefined1 findResult [8]; void *foundNode; if (((this->_isReadOnly != 0) || (bestiaryEntry = (GHIDRA_CAST((&g_manager->_entityConfig)))->EntityConfig::GetBestiaryConfig(EntityType,EntityVariant), bestiaryEntry == GHIDRA_CAST(0x0))) || (bestiaryEntry->bestiary == 0)) { return 0; } iVar1 = (bestiaryEntry->id << 0xc | bestiaryEntry->variant) * 0x100; EntityVariant = iVar1; std::set::find_node(findResult,&EntityVariant); if (((*GHIDRA_CAST((GHIDRA_CAST(foundNode) + 0xd)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(foundNode) + 0x10)) <= iVar1)) && (foundNode != (this->_bestiaryKills)._head)) { EntityVariant = iVar1; killCountSlot = GHIDRA_CAST(std)::map::operator_index(&EntityVariant); *killCountSlot = *killCountSlot + 1; } else { EntityType = iVar1; newKillCountSlot = GHIDRA_CAST(std)::map::operator_index(&EntityType); *newKillCountSlot = 1; } persistentData = &g_manager->_persistentGameData; killCount = GetBestiaryKillCount(persistentData,bestiaryEntry->id,bestiaryEntry->variant); switch(bestiaryEntry->id) { case 0x10f: case 0x110: iVar1 = GetBestiaryKillCount(persistentData,0x110,0); otherKillCount = GetBestiaryKillCount(persistentData,0x10f,0); if (9 < GHIDRA_UINT((iVar1 + otherKillCount))) { TryUnlock(persistentData,0x175); } break; case 0x132: if (0x13 < killCount) { TryUnlock(persistentData,0x15d); return 1; } break; case 0x194: if (0x13 < killCount) { TryUnlock(persistentData,0x164); return 1; } } return 1; } // 0092aea0 byte PersistentGameData::TryAddBestiaryEncounter(int type, int variant) { byte isInputActive; undefined4 *puVar1; int encounterCount; int *extraout_ECX; int *extraout_ECX_00; int *piVar2; uint bestiaryTotal; float fVar3; int *local_24; int *encounterKey; int *newEncounterKey; EntityConfig_Entity *bestiaryEntry; undefined1 findResult [8]; void *foundNode; int *entitiesHead; Manager *manager; PersistentGameData *persistentData; if (this->_isReadOnly != 0) { return 0; } bestiaryEntry = (GHIDRA_CAST((&g_manager->_entityConfig)))->EntityConfig::GetBestiaryConfig(type,variant); if (bestiaryEntry == GHIDRA_CAST(0x0)) { return 0; } if (bestiaryEntry->bestiary == 0) { return 0; } piVar2 = GHIDRA_CAST(((bestiaryEntry->id << 0xc | bestiaryEntry->variant) * 0x100)); local_24 = piVar2; std::set::find_node(findResult,&local_24); if (((*GHIDRA_CAST((GHIDRA_CAST(foundNode) + 0xd)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(foundNode) + 0x10)) <= GHIDRA_INT(piVar2)) ) && (foundNode != (this->_bestiaryEncounters)._head)) { encounterKey = piVar2; piVar2 = GHIDRA_CAST(std)::map::operator_index(&encounterKey); *piVar2 = *piVar2 + 1; piVar2 = extraout_ECX; } else { newEncounterKey = piVar2; puVar1 = GHIDRA_CAST(std)::map::operator_index(&newEncounterKey); *puVar1 = 1; piVar2 = extraout_ECX_00; } if (DAT_00c7f508 == 0) { entitiesHead = (g_manager->_entityConfig)._entities._head; local_24 = GHIDRA_CAST(*entitiesHead); piVar2 = local_24; if (local_24 != entitiesHead) { fVar3 = 0.0; bestiaryTotal = DAT_00c7f508; do { if (((-1 < local_24[0x1f]) && ((float)local_24[0x1a] != fVar3)) && ((char)local_24[0x40] != '\0')) { bestiaryTotal = bestiaryTotal + 1; } std:: _Tree_unchecked_const_iterator_>,std::_Iterator_base0> ::operator++((_Tree_unchecked_const_iterator_>,std::_Iterator_base0> *)&local_24); } while (local_24 != entitiesHead); piVar2 = local_24; DAT_00c7f508 = bestiaryTotal; } } manager = g_manager; if (((DAT_00c7f508 <= (this->_bestiaryEncounters)._size) && (persistentData = &g_manager->_persistentGameData, (g_manager->_persistentGameData)._isReadOnly == 0)) && ((g_manager->_persistentGameData)._achievements[0x144] == 0)) { (g_manager->_persistentGameData)._achievements[0x144] = 1; if (((manager->_netplayManager == *GHIDRA_CAST((manager + 1))) || (isInputActive = Manager::IsGameplayInputActive(GHIDRA_INT(piVar2)), isInputActive == 0)) && ((manager->_persistentGameData)._isSteamAchievementsEnabled != 0)) { UnlockSteamAchievement(persistentData,0x144); Manager::queue_achievement_popup(0x144); } *GHIDRA_CAST(persistentData) = 1; check_challenge_unlocks(persistentData); check_collection_unlocks(persistentData); } if (((bestiaryEntry->id == 0x4e) && (bestiaryEntry->variant != 0)) && (encounterCount = GetBestiaryEncounterCount(this,0x4e,0), encounterCount == 0)) { TryAddBestiaryEncounter(this,0x4e,0); AddBestiaryKill(this,0x4e,0); } return 1; } // 0092b070 int PersistentGameData::GetBestiaryDeathCount(int EntityType, int EntityVariant) { EntityConfig_Entity *config; int key; undefined1 findResult [8]; void *node; config = (GHIDRA_CAST((&g_manager->_entityConfig)))->EntityConfig::GetBestiaryConfig(EntityType,EntityVariant); if ((config == GHIDRA_CAST(0x0)) || (config->bestiary == 0)) { return 0; } key = (config->id << 0xc | config->variant) * 0x100; EntityVariant = key; std::set::find_node(findResult,&EntityVariant); if (((*GHIDRA_CAST((GHIDRA_CAST(node) + 0xd)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(node) + 0x10)) <= key)) && (node != (this->_bestiaryDeaths)._head)) { return *GHIDRA_CAST((GHIDRA_CAST(node) + 0x14)); } return 0; } // 0092b100 int PersistentGameData::GetBestiaryKillCount(int EntityType, int EntityVariant) { EntityConfig_Entity *bestiaryEntry; int killKey; undefined1 findResult [8]; void *foundNode; bestiaryEntry = (GHIDRA_CAST((&g_manager->_entityConfig)))->EntityConfig::GetBestiaryConfig(EntityType,EntityVariant); if ((bestiaryEntry == GHIDRA_CAST(0x0)) || (bestiaryEntry->bestiary == 0)) { return 0; } killKey = (bestiaryEntry->id << 0xc | bestiaryEntry->variant) * 0x100; EntityVariant = killKey; std::set::find_node(findResult,&EntityVariant); if (((*GHIDRA_CAST((GHIDRA_CAST(foundNode) + 0xd)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(foundNode) + 0x10)) <= killKey)) && (foundNode != (this->_bestiaryKills)._head)) { return *GHIDRA_CAST((GHIDRA_CAST(foundNode) + 0x14)); } return 0; } // 0092b270 void PersistentGameData::set_run_mask(uint maskLow, uint maskHigh) { uint bit; uint highMask; uint lowMask; int setBitCount; setBitCount = 0; this->_eventCounters[0xbc] = maskLow; this->_eventCounters[0x1f0] = maskHigh; bit = 0; do { lowMask = 1 << (bit & 0x1f); highMask = 0; if (0x1f < bit) { highMask = lowMask; } lowMask = lowMask ^ highMask; if (0x3f < bit) { highMask = lowMask; } if ((lowMask & maskLow) != 0 || (highMask & maskHigh) != 0) { setBitCount = setBitCount + 1; } bit = bit + 1; } while (GHIDRA_INT(bit) < 0x29); if (4 < setBitCount) { TryUnlock(this,0x143); } *GHIDRA_CAST(this) = 1; return; } // 0092b2e0 byte PersistentGameData::TryImportRebirthLocalSave(byte *path) { char cVar1; char isFileOpen; byte *searchText; int *saveFile; int iVar2; int *steamContext; byte *pbVar3; undefined3 uVar6; byte *****extraout_ECX; undefined4 extraout_ECX_00; byte *****pppppbVar4; void *freeBlock; byte *****pppppbVar5; byte *****compareCursor; uint uVar7; undefined4 *copySrc; byte *****matchPos; undefined4 *copyDst; int *unaff_FS_OFFSET; bool isLess; undefined8 counterEntry; byte isImported; void *rebirthSavePath [4]; undefined4 rebirthSavePathSize; uint rebirthSavePathCapacity; void *rebirthStr; undefined4 rebirthStrSize; uint rebirthStrCapacity; undefined4 rebirthAchievements; undefined4 rebirthCollectibleFlags; undefined1 uStack_10c; undefined1 uStack_10b; undefined1 uStack_10a; undefined1 uStack_109; undefined1 uStack_108; undefined1 uStack_107; undefined1 uStack_106; undefined4 uStack_105; undefined4 uStack_101; undefined4 uStack_fd; undefined4 uStack_f9; undefined4 uStack_f5; undefined4 uStack_f1; undefined4 uStack_ed; undefined4 uStack_e9; undefined4 uStack_e5; undefined4 uStack_e1; undefined4 uStack_dd; undefined4 uStack_d9; undefined8 uStack_d5; undefined1 uStack_cd; undefined4 uStack_cc; undefined4 uStack_c8; undefined4 uStack_c4; undefined4 uStack_c0; undefined4 uStack_bc; undefined1 uStack_b8; int rebirthCutsceneCounter0; int rebirthCutsceneCounter1; int rebirthCutsceneCounter2; int rebirthCutsceneCounter3; int rebirthCutsceneCounter4; int rebirthCutsceneCounter5; int rebirthCutsceneCounter6; int rebirthCutsceneCounter7; int rebirthCutsceneCounter8; int rebirthCutsceneCounter9; int rebirthCutsceneCounter10; int rebirthCutsceneCounter11; int rebirthCutsceneCounter12; int rebirthCutsceneCounter13; int rebirthCutsceneCounter14; int rebirthCutsceneCounter15; int rebirthCutsceneCounter16; int rebirthCutsceneCounter17; int rebirthCutsceneCounter18; int rebirthCutsceneCounter19; int rebirthLastDifficulty; byte *searchTextBuf; undefined4 searchTextSize; undefined4 searchTextCapacity; byte *****rebirthPath [4]; uint rebirthPathSize; uint rebirthPathCapacity; uint stackCookie; byte *****pppppbStack_20; int savedExceptionList; undefined *puStack_18; byte ****ppppbStack_14; byte curByte; Manager *manager; pppppbStack_20 = GHIDRA_CAST((rebirthPath + 0xe)); ppppbStack_14 = GHIDRA_CAST(0xffffffff); puStack_18 = &UNK_00b0aa10; savedExceptionList = *unaff_FS_OFFSET; stackCookie = __security_cookie ^ GHIDRA_UINT((rebirthPath + 0xb)); *unaff_FS_OFFSET = GHIDRA_INT(&savedExceptionList); searchText = std::_Allocate(0x20); searchTextSize = 0x1c; searchText[0] = 'B'; searchText[1] = 'i'; searchText[2] = 'n'; searchText[3] = 'd'; searchText[4] = 'i'; searchText[5] = 'n'; searchText[6] = 'g'; searchText[7] = ' '; searchText[8] = 'o'; searchText[9] = 'f'; searchText[10] = ' '; searchText[0xb] = 'I'; searchText[0xc] = 's'; searchText[0xd] = 'a'; searchText[0xe] = 'a'; searchText[0xf] = 'c'; searchTextCapacity = 0x1f; searchText[0x10] = 0x20; searchText[0x11] = 0x52; searchText[0x12] = 0x65; searchText[0x13] = 0x70; searchText[0x14] = 0x65; searchText[0x15] = 0x6e; searchText[0x16] = 0x74; searchText[0x17] = 0x61; searchText[0x18] = 'n'; searchText[0x19] = 'c'; searchText[0x1a] = 'e'; searchText[0x1b] = '+'; searchText[0x1c] = 0; ppppbStack_14 = GHIDRA_CAST(0x0); rebirthPathSize = 0; rebirthPathCapacity = 0xf; rebirthPath[0] = GHIDRA_CAST(0x0); pbVar3 = path; do { curByte = *pbVar3; pbVar3 = pbVar3 + 1; } while (curByte != 0); searchTextBuf = searchText; (GHIDRA_CAST((GHIDRA_CAST(rebirthPath))))->std::string::assign(path,GHIDRA_INT(pbVar3) - GHIDRA_INT((path + 1))); (*GHIDRA_CAST((GHIDRA_CAST(&(ppppbStack_14)) + 0x0))) = 1; pppppbVar5 = GHIDRA_CAST(rebirthPath); if (0xf < rebirthPathCapacity) { pppppbVar5 = rebirthPath[0]; } pppppbVar4 = pppppbVar5; if (0x1b < rebirthPathSize) { iVar2 = -1; if (rebirthPathSize - 0x1c != -1) { iVar2 = rebirthPathSize - 0x1c; } matchPos = GHIDRA_CAST((GHIDRA_INT(pppppbVar5) + iVar2)); do { if (*GHIDRA_CAST(matchPos) == *searchText) { uVar7 = 0x18; pbVar3 = searchText; compareCursor = matchPos; do { pppppbVar4 = GHIDRA_CAST(*compareCursor); if (pppppbVar4 != *GHIDRA_CAST(pbVar3)) { isLess = (byte)pppppbVar4 < *pbVar3; if ((byte)pppppbVar4 == *pbVar3) { curByte = *GHIDRA_CAST((GHIDRA_CAST(compareCursor) + 1)); uVar6 = (undefined3)(GHIDRA_UINT(pppppbVar4) >> 8); pppppbVar4 = GHIDRA_CAST(CONCAT31(uVar6,curByte)); isLess = curByte < pbVar3[1]; if (curByte == pbVar3[1]) { curByte = *GHIDRA_CAST((GHIDRA_CAST(compareCursor) + 2)); pppppbVar4 = GHIDRA_CAST(CONCAT31(uVar6,curByte)); isLess = curByte < pbVar3[2]; if (curByte == pbVar3[2]) { curByte = *GHIDRA_CAST((GHIDRA_CAST(compareCursor) + 3)); pppppbVar4 = GHIDRA_CAST(CONCAT31(uVar6,curByte)); isLess = curByte < pbVar3[3]; if (curByte == pbVar3[3]) { uVar7 = 0; goto LAB_0092b42a; } } } } uVar7 = -GHIDRA_UINT(isLess) | 1; goto LAB_0092b42a; } compareCursor = compareCursor + 1; pbVar3 = pbVar3 + 4; isLess = 3 < uVar7; uVar7 = uVar7 - 4; } while (isLess); uVar7 = 0; LAB_0092b42a: if (uVar7 == 0) { if (GHIDRA_INT(matchPos) - GHIDRA_INT(pppppbVar5) != 0xffffffff) { std::string::replace (GHIDRA_CAST(rebirthPath),GHIDRA_INT(matchPos) - GHIDRA_INT(pppppbVar5),0x1c, GHIDRA_CAST("Binding of Isaac Rebirth"),0x18); pppppbVar4 = extraout_ECX; } break; } } pppppbVar4 = pppppbVar5; if (matchPos == pppppbVar5) break; matchPos = GHIDRA_CAST((GHIDRA_INT(matchPos) + -1)); } while( true ); } pppppbVar5 = GHIDRA_CAST(rebirthPath); if (0xf < rebirthPathCapacity) { pppppbVar5 = rebirthPath[0]; } rebirthSavePathSize = 0; rebirthSavePathCapacity = 0xf; rebirthSavePath[0] = (void *)0x0; rebirthStrSize = 0; rebirthStrCapacity = 0xf; rebirthStr = (void *)0x0; RebirthSaveData::Clear(pppppbVar4); ppppbStack_14 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(ppppbStack_14)) + 0x1))),2)); RebirthSaveData::Clear(extraout_ECX_00); pppppbVar4 = pppppbVar5; do { cVar1 = *GHIDRA_CAST(pppppbVar4); pppppbVar4 = GHIDRA_CAST((GHIDRA_INT(pppppbVar4) + 1)); } while (cVar1 != '\0'); (GHIDRA_CAST((GHIDRA_CAST(rebirthSavePath))))->std::string::assign(GHIDRA_CAST(pppppbVar5), GHIDRA_INT(pppppbVar4) - (GHIDRA_INT(pppppbVar5) + 1)); KAGE_LogMessage(1,GHIDRA_CAST("Loading RebirthPersistentGameData from disk: %s.\n")); saveFile = (GHIDRA_CAST((&PTR_vftable_00c5aa80)))->SaveDataManager::open_file_read(GHIDRA_CAST(pppppbVar5)); if (saveFile == GHIDRA_CAST(0x0)) { LAB_0092b7ec: isImported = 0; } else { cVar1 = (**(code **)(*saveFile + 0x30))(); if ((cVar1 != '\0') && (iVar2 = _fileno(GHIDRA_CAST(saveFile[3])), -1 < iVar2)) { flock(iVar2,1); } cVar1 = func_0x009e4260(); isFileOpen = (**(code **)(*saveFile + 0x30))(); if ((isFileOpen != '\0') && (iVar2 = _fileno(GHIDRA_CAST(saveFile[3])), -1 < iVar2)) { flock(iVar2,8); } (**(code **)(*saveFile + 0x34))(); if (cVar1 == '\0') goto LAB_0092b7ec; Clear(this,1); copySrc = &rebirthAchievements; pbVar3 = this->_achievements; for (iVar2 = 0x2c; iVar2 != 0; iVar2 = iVar2 + -1) { *GHIDRA_CAST(pbVar3) = *copySrc; copySrc = copySrc + 1; pbVar3 = pbVar3 + 4; } *GHIDRA_CAST(pbVar3) = *GHIDRA_CAST(copySrc); pbVar3[2] = *GHIDRA_CAST((GHIDRA_CAST(copySrc) + 2)); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe07)))) = uStack_105; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe0b)))) = uStack_101; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe0f)))) = uStack_fd; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe13)))) = uStack_f9; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe17)))) = uStack_f5; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe1b)))) = uStack_f1; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe1f)))) = uStack_ed; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe23)))) = uStack_e9; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe27)))) = uStack_e5; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe2b)))) = uStack_e1; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe2f)))) = uStack_dd; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe33)))) = uStack_d9; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe37)))) = uStack_d5; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe3f))) = uStack_cd; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe6f)))) = uStack_cc; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe73)))) = uStack_c8; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe77)))) = uStack_c4; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe7b)))) = uStack_c0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe7f)))) = uStack_bc; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe83))) = uStack_b8; copySrc = &rebirthCollectibleFlags; copyDst = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xae8)))); for (iVar2 = 0x56; iVar2 != 0; iVar2 = iVar2 + -1) { *copyDst = *copySrc; copySrc = copySrc + 1; copyDst = copyDst + 1; } *GHIDRA_CAST(copyDst) = *GHIDRA_CAST(copySrc); *GHIDRA_CAST((GHIDRA_CAST(copyDst) + 2)) = *GHIDRA_CAST((GHIDRA_CAST(copySrc) + 2)); iVar2 = 0; do { counterEntry = func_0x009e3ea0(); iVar2 = iVar2 + 1; this->_eventCounters[GHIDRA_INT(counterEntry)] = GHIDRA_INT(((ulonglong)counterEntry >> 0x20)); } while (iVar2 < 0x5f); iVar2 = 0; this->_cutsceneCounters[0] = rebirthCutsceneCounter0; this->_cutsceneCounters[1] = rebirthCutsceneCounter1; this->_cutsceneCounters[2] = rebirthCutsceneCounter2; this->_cutsceneCounters[3] = rebirthCutsceneCounter3; this->_cutsceneCounters[4] = rebirthCutsceneCounter4; this->_cutsceneCounters[5] = rebirthCutsceneCounter5; this->_cutsceneCounters[6] = rebirthCutsceneCounter6; this->_cutsceneCounters[7] = rebirthCutsceneCounter7; this->_cutsceneCounters[8] = rebirthCutsceneCounter8; this->_cutsceneCounters[9] = rebirthCutsceneCounter9; this->_cutsceneCounters[10] = rebirthCutsceneCounter10; this->_cutsceneCounters[0xb] = rebirthCutsceneCounter11; this->_cutsceneCounters[0xc] = rebirthCutsceneCounter12; this->_cutsceneCounters[0xd] = rebirthCutsceneCounter13; this->_cutsceneCounters[0xe] = rebirthCutsceneCounter14; this->_cutsceneCounters[0xf] = rebirthCutsceneCounter15; this->_cutsceneCounters[0x10] = rebirthCutsceneCounter16; this->_cutsceneCounters[0x11] = rebirthCutsceneCounter17; this->_cutsceneCounters[0x12] = rebirthCutsceneCounter18; this->_cutsceneCounters[0x13] = rebirthCutsceneCounter19; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe00))) = uStack_10c; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe01))) = uStack_10b; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe02))) = uStack_10a; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe03))) = uStack_109; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe04))) = uStack_108; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe05))) = uStack_107; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe06))) = uStack_106; this->_lastDifficulty = rebirthLastDifficulty; do { counterEntry = func_0x009e4f80(); iVar2 = iVar2 + 1; this->_cutsceneCounters[GHIDRA_INT(counterEntry) + -0x36] = GHIDRA_INT(((ulonglong)counterEntry >> 0x20)); manager = g_manager; } while (iVar2 < 0xc); *GHIDRA_CAST(this) = 1; iVar2 = (manager->_optionsConfig)._popupsMode; (manager->_optionsConfig)._popupsMode = 0; check_challenge_unlocks(this); IncreaseEventCounter(this,0,0); (g_manager->_optionsConfig)._popupsMode = iVar2; if ((*GHIDRA_CAST(this) == '\0') || (this->_isFileLoaded == 0)) { LAB_0092b7d7: isImported = 1; } else { *GHIDRA_CAST(this) = 0; (GHIDRA_CAST((GHIDRA_CAST(this))))->Manager::BackupSaveFile(); manager = g_manager; steamContext = GHIDRA_CAST(SteamInternal_ContextInit(&PTR_FUN_00c5c3a4)); if ((*steamContext == 0) || ((manager->_optionsConfig)._enableSteamCloud == 0)) { Save(this); goto LAB_0092b7d7; } SaveToSteamCloud(this); isImported = 1; } } ppppbStack_14 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(ppppbStack_14)) + 0x1))),4)); if (saveFile != GHIDRA_CAST(0x0)) { (**(code **)*saveFile)(1); } if (0xf < rebirthStrCapacity) { uVar7 = rebirthStrCapacity + 1; freeBlock = rebirthStr; if (0xfff < uVar7) { freeBlock = *(void **)(GHIDRA_CAST(rebirthStr) + -4); uVar7 = rebirthStrCapacity + 0x24; if (0x1f < GHIDRA_UINT((GHIDRA_INT(rebirthStr) + (-4 - GHIDRA_INT(freeBlock))))) goto LAB_0092b8cf; } operator_delete(freeBlock,uVar7); } rebirthStrSize = 0; rebirthStrCapacity = 0xf; rebirthStr = (void *)(GHIDRA_UINT(rebirthStr) & 0xffffff00); if (0xf < rebirthSavePathCapacity) { uVar7 = rebirthSavePathCapacity + 1; freeBlock = rebirthSavePath[0]; if (0xfff < uVar7) { freeBlock = *(void **)(GHIDRA_INT(rebirthSavePath[0]) + -4); uVar7 = rebirthSavePathCapacity + 0x24; if (0x1f < GHIDRA_UINT((GHIDRA_INT(rebirthSavePath[0]) + (-4 - GHIDRA_INT(freeBlock))))) goto LAB_0092b8cf; } operator_delete(freeBlock,uVar7); } rebirthSavePathSize = 0; rebirthSavePathCapacity = 0xf; rebirthSavePath[0] = (void *)(GHIDRA_UINT(rebirthSavePath[0]) & 0xffffff00); if (0xf < rebirthPathCapacity) { uVar7 = rebirthPathCapacity + 1; pppppbVar5 = rebirthPath[0]; if (0xfff < uVar7) { pppppbVar5 = GHIDRA_CAST(rebirthPath[0][-1]); uVar7 = rebirthPathCapacity + 0x24; if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(rebirthPath[0]) + (-4 - GHIDRA_INT(pppppbVar5))))) { LAB_0092b8cf: /* WARNING: Subroutine does not return */ _invalid_parameter_noinfo_noreturn(); } } operator_delete(pppppbVar5,uVar7); } rebirthPathSize = 0; rebirthPathCapacity = 0xf; rebirthPath[0] = GHIDRA_CAST((GHIDRA_UINT(rebirthPath[0]) & 0xffffff00)); operator_delete(searchText,0x20); *unaff_FS_OFFSET = savedExceptionList; return isImported; } // 0092b930 byte PersistentGameData::import_afterbirth_save(void *stream) { byte isHeaderValid; uint uVar1; int *steamContext; undefined4 extraout_ECX; int iVar2; void *stringBlock; int oldIndex; int extraout_EDX; byte *srcAchievement; undefined4 *srcWord; byte *dstAchievement; undefined4 *dstWord; byte isImported; undefined1 abSaveData [4]; undefined4 local_70c; void *abFirstStringData; undefined4 abFirstStringSize; uint abFirstStringCapacity; void *abSecondStringData; undefined4 abSecondStringSize; uint abSecondStringCapacity; byte abAchievements [280]; int abEventCounters [162]; undefined4 abCollection [111]; undefined4 abLevelCounter0; undefined4 abLevelCounter1; undefined4 abLevelCounter2; undefined4 abLevelCounter3; undefined4 abLevelCounter4; undefined4 abLevelCounter5; undefined4 abLevelCounter6; undefined4 abLevelCounter7; undefined4 abLevelCounter8; undefined4 abLevelCounter9; undefined4 abLevelCounter10; undefined4 abLevelCounter11; undefined1 abMiniboss0; undefined1 abMiniboss1; undefined1 abMiniboss2; undefined1 abMiniboss3; undefined1 abMiniboss4; undefined1 abMiniboss5; undefined1 abMiniboss6; undefined4 abBossFlags0; undefined4 abBossFlags4; undefined4 abBossFlags8; undefined4 abBossFlags12; undefined4 abBossFlags16; undefined4 abBossFlags20; undefined4 abBossFlags24; undefined4 abBossFlags28; undefined4 abBossFlags32; undefined4 abBossFlags36; undefined4 abBossFlags40; undefined4 abBossFlags44; undefined4 abBossFlags48; undefined4 abBossFlags52; undefined4 abBossFlags56; undefined4 abBossFlags60; undefined2 abBossFlags64; undefined1 abBossFlags66; undefined4 abChallengeFlags0; undefined4 abChallengeFlags4; undefined4 abChallengeFlags8; undefined4 abChallengeFlags12; undefined4 abChallengeFlags16; undefined4 abChallengeFlags20; undefined4 abChallengeFlags24; undefined2 abChallengeFlags28; undefined1 abChallengeFlags30; int abCutscene0; int abCutscene1; int abCutscene2; int abCutscene3; int abCutscene4; int abCutscene5; int abCutscene6; int abCutscene7; int abCutscene8; int abCutscene9; int abCutscene10; int abCutscene11; int abCutscene12; int abCutscene13; int abCutscene14; int abCutscene15; int abCutscene16; int abCutscene17; int abCutscene18; int abCutscene19; undefined8 abCutscenes20And21; int abLastDifficulty; uint local_24; undefined1 *puStack_20; void *local_1c; undefined1 *puStack_18; undefined4 local_14; Manager *manager; puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); local_14 = 0xffffffff; puStack_18 = &LAB_00b0aa50; local_1c = ExceptionList; uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U; ExceptionList = &local_1c; local_70c = 0; abFirstStringSize = 0; abFirstStringCapacity = 0xf; abFirstStringData = (void *)0x0; abSecondStringSize = 0; abSecondStringCapacity = 0xf; abSecondStringData = (void *)0x0; local_24 = uVar1; FUN_0041d560(this); local_14 = 0; FUN_0041d560(extraout_ECX); (**(code **)(*GHIDRA_CAST(stream) + 0xc))(0,0,uVar1); isHeaderValid = (GHIDRA_CAST((abSaveData)))->AfterbirthPersistentGameData::check_header(stream); if (isHeaderValid == 0) { isImported = 0; } else { Clear(this,1); srcAchievement = abAchievements; dstAchievement = this->_achievements; for (iVar2 = 0x45; iVar2 != 0; iVar2 = iVar2 + -1) { *GHIDRA_CAST(dstAchievement) = *GHIDRA_CAST(srcAchievement); srcAchievement = srcAchievement + 4; dstAchievement = dstAchievement + 4; } *dstAchievement = *srcAchievement; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe07)))) = abBossFlags0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe0b)))) = abBossFlags4; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe0f)))) = abBossFlags8; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe13)))) = abBossFlags12; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe17)))) = abBossFlags16; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe1b)))) = abBossFlags20; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe1f)))) = abBossFlags24; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe23)))) = abBossFlags28; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe27)))) = abBossFlags32; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe2b)))) = abBossFlags36; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe2f)))) = abBossFlags40; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe33)))) = abBossFlags44; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe37)))) = abBossFlags48; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe3b)))) = abBossFlags52; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe3f)))) = abBossFlags56; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe43)))) = abBossFlags60; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe47)))) = abBossFlags64; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe49))) = abBossFlags66; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe6f)))) = abChallengeFlags0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe73)))) = abChallengeFlags4; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe77)))) = abChallengeFlags8; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe7b)))) = abChallengeFlags12; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe7f)))) = abChallengeFlags16; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe83)))) = abChallengeFlags20; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe87)))) = abChallengeFlags24; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe8b)))) = abChallengeFlags28; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe8d))) = abChallengeFlags30; oldIndex = 0; srcWord = abCollection; dstWord = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xae8)))); for (iVar2 = 0x6e; iVar2 != 0; iVar2 = iVar2 + -1) { *dstWord = *srcWord; srcWord = srcWord + 1; dstWord = dstWord + 1; } *GHIDRA_CAST(dstWord) = *GHIDRA_CAST(srcWord); do { iVar2 = afterbirth_save_index_remap(oldIndex); oldIndex = extraout_EDX + 1; this->_eventCounters[iVar2] = abEventCounters[extraout_EDX]; } while (oldIndex < 0xa2); this->_cutsceneCounters[0] = abCutscene0; this->_cutsceneCounters[1] = abCutscene1; this->_cutsceneCounters[2] = abCutscene2; this->_cutsceneCounters[3] = abCutscene3; this->_cutsceneCounters[4] = abCutscene4; this->_cutsceneCounters[5] = abCutscene5; this->_cutsceneCounters[6] = abCutscene6; this->_cutsceneCounters[7] = abCutscene7; this->_cutsceneCounters[8] = abCutscene8; this->_cutsceneCounters[9] = abCutscene9; this->_cutsceneCounters[10] = abCutscene10; this->_cutsceneCounters[0xb] = abCutscene11; this->_cutsceneCounters[0xc] = abCutscene12; this->_cutsceneCounters[0xd] = abCutscene13; this->_cutsceneCounters[0xe] = abCutscene14; this->_cutsceneCounters[0xf] = abCutscene15; this->_cutsceneCounters[0x10] = abCutscene16; this->_cutsceneCounters[0x11] = abCutscene17; this->_cutsceneCounters[0x12] = abCutscene18; this->_cutsceneCounters[0x13] = abCutscene19; *GHIDRA_CAST((this->_cutsceneCounters + 0x14)) = abCutscenes20And21; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe00))) = abMiniboss0; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe01))) = abMiniboss1; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe02))) = abMiniboss2; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe03))) = abMiniboss3; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe04))) = abMiniboss4; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe05))) = abMiniboss5; (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xe06))) = abMiniboss6; this->_lastDifficulty = abLastDifficulty; manager = g_manager; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdc8)))) = abLevelCounter0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdcc)))) = abLevelCounter1; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdd0)))) = abLevelCounter2; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdd4)))) = abLevelCounter3; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdd8)))) = abLevelCounter4; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xddc)))) = abLevelCounter5; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xde0)))) = abLevelCounter6; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xde4)))) = abLevelCounter7; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xde8)))) = abLevelCounter8; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdec)))) = abLevelCounter9; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdf0)))) = abLevelCounter10; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xdf4)))) = abLevelCounter11; *GHIDRA_CAST(this) = 1; iVar2 = (manager->_optionsConfig)._popupsMode; (manager->_optionsConfig)._popupsMode = 0; check_challenge_unlocks(this); IncreaseEventCounter(this,0,0); (g_manager->_optionsConfig)._popupsMode = iVar2; if ((*GHIDRA_CAST(this) != '\0') && (this->_isFileLoaded != 0)) { *GHIDRA_CAST(this) = 0; (GHIDRA_CAST((GHIDRA_CAST(this))))->Manager::BackupSaveFile(); manager = g_manager; steamContext = GHIDRA_CAST(SteamInternal_ContextInit(&PTR_FUN_00c5c3a4)); if ((*steamContext == 0) || ((manager->_optionsConfig)._enableSteamCloud == 0)) { Save(this); } else { SaveToSteamCloud(this); } } isImported = 1; } if (0xf < abSecondStringCapacity) { uVar1 = abSecondStringCapacity + 1; stringBlock = abSecondStringData; if (0xfff < uVar1) { stringBlock = *(void **)(GHIDRA_CAST(abSecondStringData) + -4); uVar1 = abSecondStringCapacity + 0x24; if (0x1f < GHIDRA_UINT((GHIDRA_INT(abSecondStringData) + (-4 - GHIDRA_INT(stringBlock))))) goto LAB_0092bce3; } operator_delete(stringBlock,uVar1); } abSecondStringSize = 0; abSecondStringCapacity = 0xf; abSecondStringData = (void *)(GHIDRA_UINT(abSecondStringData) & 0xffffff00); if (0xf < abFirstStringCapacity) { uVar1 = abFirstStringCapacity + 1; stringBlock = abFirstStringData; if (0xfff < uVar1) { stringBlock = *(void **)(GHIDRA_CAST(abFirstStringData) + -4); uVar1 = abFirstStringCapacity + 0x24; if (0x1f < GHIDRA_UINT((GHIDRA_INT(abFirstStringData) + (-4 - GHIDRA_INT(stringBlock))))) { LAB_0092bce3: /* WARNING: Subroutine does not return */ _invalid_parameter_noinfo_noreturn(); } } operator_delete(stringBlock,uVar1); } ExceptionList = local_1c; return isImported; } // 0092c2c0 byte PersistentGameData::TryImportABLocalSave(byte *path) { char cVar1; byte bVar2; uint uVar3; byte *needleCursor; byte *****pathChars; int *stream; int iVar4; byte *pbVar5; byte *****hayCursor; uint uVar6; byte *****matchPos; int *unaff_FS_OFFSET; bool isLess; byte isImported; byte *****savePath [4]; uint savePathSize; uint savePathCapacity; uint uStack_24; byte *****pppppbStack_20; int iStack_1c; undefined *puStack_18; byte ****ppppbStack_14; pppppbStack_20 = GHIDRA_CAST((savePath + 0xe)); ppppbStack_14 = GHIDRA_CAST(0xffffffff); puStack_18 = &UNK_00b0aad5; iStack_1c = *unaff_FS_OFFSET; uVar3 = __security_cookie ^ GHIDRA_UINT((savePath + 0xb)); *unaff_FS_OFFSET = GHIDRA_INT(&iStack_1c); savePathSize = 0; savePathCapacity = 0xf; savePath[0] = GHIDRA_CAST(0x0); pbVar5 = path; do { bVar2 = *pbVar5; pbVar5 = pbVar5 + 1; } while (bVar2 != 0); uStack_24 = uVar3; (GHIDRA_CAST((GHIDRA_CAST(savePath))))->std::string::assign(path,GHIDRA_INT(pbVar5) - GHIDRA_INT((path + 1))); ppppbStack_14 = GHIDRA_CAST(0x0); pbVar5 = std::_Allocate(0x20); pbVar5[0] = 'B'; pbVar5[1] = 'i'; pbVar5[2] = 'n'; pbVar5[3] = 'd'; pbVar5[4] = 'i'; pbVar5[5] = 'n'; pbVar5[6] = 'g'; pbVar5[7] = ' '; pbVar5[8] = 'o'; pbVar5[9] = 'f'; pbVar5[10] = ' '; pbVar5[0xb] = 'I'; pbVar5[0xc] = 's'; pbVar5[0xd] = 'a'; pbVar5[0xe] = 'a'; pbVar5[0xf] = 'c'; pbVar5[0x10] = 0x20; pbVar5[0x11] = 0x52; pbVar5[0x12] = 0x65; pbVar5[0x13] = 0x70; pbVar5[0x14] = 0x65; pbVar5[0x15] = 0x6e; pbVar5[0x16] = 0x74; pbVar5[0x17] = 0x61; pbVar5[0x18] = 'n'; pbVar5[0x19] = 'c'; pbVar5[0x1a] = 'e'; pbVar5[0x1b] = '+'; pbVar5[0x1c] = 0; ppppbStack_14 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(ppppbStack_14)) + 0x1))),1)); pathChars = GHIDRA_CAST(savePath); if (0xf < savePathCapacity) { pathChars = savePath[0]; } if (savePathSize < 0x1c) { LAB_0092c428: pathChars = GHIDRA_CAST(savePath); if (0xf < savePathCapacity) { pathChars = savePath[0]; } stream = (GHIDRA_CAST((&PTR_vftable_00c5aa80)))->SaveDataManager::open_file_read(GHIDRA_CAST(pathChars)); if (stream == GHIDRA_CAST(0x0)) { KAGE_LogMessage(1,GHIDRA_CAST("No AB save found! (%s)\n")); isImported = 0; } else { cVar1 = (**(code **)(*stream + 0x30))(uVar3); if ((cVar1 != '\0') && (iVar4 = _fileno(GHIDRA_CAST(stream[3])), -1 < iVar4)) { flock(iVar4,1); } bVar2 = import_afterbirth_save(this,stream); this->_isFileLoaded = bVar2; cVar1 = (**(code **)(*stream + 0x30))(); if ((cVar1 != '\0') && (iVar4 = _fileno(GHIDRA_CAST(stream[3])), -1 < iVar4)) { flock(iVar4,8); } (**(code **)(*stream + 0x34))(); (**(code **)*stream)(1); isImported = this->_isFileLoaded; } operator_delete(pbVar5,0x20); if (0xf < savePathCapacity) { uVar3 = savePathCapacity + 1; pathChars = savePath[0]; if (0xfff < uVar3) { pathChars = GHIDRA_CAST(savePath[0][-1]); uVar3 = savePathCapacity + 0x24; if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(savePath[0]) + (-4 - GHIDRA_INT(pathChars))))) { /* WARNING: Subroutine does not return */ _invalid_parameter_noinfo_noreturn(); } } operator_delete(pathChars,uVar3); } *unaff_FS_OFFSET = iStack_1c; return isImported; } iVar4 = -1; if (savePathSize - 0x1c != -1) { iVar4 = savePathSize - 0x1c; } matchPos = GHIDRA_CAST((GHIDRA_INT(pathChars) + iVar4)); do { if (*GHIDRA_CAST(matchPos) == *pbVar5) { uVar6 = 0x18; needleCursor = pbVar5; hayCursor = matchPos; do { if (*hayCursor != *GHIDRA_CAST(needleCursor)) { bVar2 = (byte)*hayCursor; isLess = bVar2 < *needleCursor; if ((((bVar2 == *needleCursor) && (isLess = *GHIDRA_CAST((GHIDRA_CAST(hayCursor) + 1)) < needleCursor[1], *GHIDRA_CAST((GHIDRA_CAST(hayCursor) + 1)) == needleCursor[1])) && (isLess = *GHIDRA_CAST((GHIDRA_CAST(hayCursor) + 2)) < needleCursor[2], *GHIDRA_CAST((GHIDRA_CAST(hayCursor) + 2)) == needleCursor[2])) && (isLess = *GHIDRA_CAST((GHIDRA_CAST(hayCursor) + 3)) < needleCursor[3], *GHIDRA_CAST((GHIDRA_CAST(hayCursor) + 3)) == needleCursor[3])) { uVar6 = 0; } else { uVar6 = -GHIDRA_UINT(isLess) | 1; } goto LAB_0092c3fa; } hayCursor = hayCursor + 1; needleCursor = needleCursor + 4; isLess = 3 < uVar6; uVar6 = uVar6 - 4; } while (isLess); uVar6 = 0; LAB_0092c3fa: if (uVar6 == 0) { if (GHIDRA_INT(matchPos) - GHIDRA_INT(pathChars) != 0xffffffff) { std::string::replace (GHIDRA_CAST(savePath),GHIDRA_INT(matchPos) - GHIDRA_INT(pathChars),0x1c, GHIDRA_CAST("Binding of Isaac Afterbirth"),0x1b); } goto LAB_0092c428; } } if (matchPos == pathChars) goto LAB_0092c428; matchPos = GHIDRA_CAST((GHIDRA_INT(matchPos) + -1)); } while( true ); }