Six agents took over ANM2/AnimationState/LayerState, ItemConfig, EntityConfig, StringTable/Font/FormattedText/RichText, OptionsConfig/ChallengeParams and ModManager/ModEntry functions (FormattedText::parse checked against a transliteration of its assembly on 200,000 random inputs). 174 field rows and 32 names from the round are merged into db/. source_tree.py: a struct or class src/*.h defines is no longer emitted in classes.h (class takeover) and gets no stubs; data labels get stub definitions. build/isaac links (64-bit ELF) and stops at the first function not reconstructed: IsaacMain. Boot path 64/615 functions curated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
276 lines
8.1 KiB
C++
276 lines
8.1 KiB
C++
#include "classes.h"
|
|
|
|
// 00a55b70
|
|
FormattedText::FormattedText(uint8_t *param_1)
|
|
{
|
|
uint8_t *in_ECX;
|
|
uint8_t local_20 [4];
|
|
uint32_t local_1c;
|
|
uint16_t local_18;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
uint8_t *linesEnd;
|
|
|
|
puStack_c = &LAB_00b12810;
|
|
local_10 = ExceptionList;
|
|
ExceptionList = &local_10;
|
|
*in_ECX = 0;
|
|
in_ECX[4] = 0;
|
|
in_ECX[5] = 0;
|
|
in_ECX[6] = 0;
|
|
in_ECX[7] = 0;
|
|
in_ECX[8] = 0;
|
|
in_ECX[9] = 0;
|
|
in_ECX[10] = 0;
|
|
in_ECX[0xb] = 0;
|
|
in_ECX[0xc] = 0;
|
|
in_ECX[0xd] = 0;
|
|
in_ECX[0xe] = 0;
|
|
in_ECX[0xf] = 0;
|
|
local_8 = 0;
|
|
local_20[0] = *param_1;
|
|
local_1c = *GHIDRA_CAST<uint32_t *>((param_1 + 4));
|
|
local_18 = *GHIDRA_CAST<uint16_t *>((param_1 + 8));
|
|
*in_ECX = *in_ECX | 1;
|
|
linesEnd = *GHIDRA_CAST<uint8_t **>((in_ECX + 8));
|
|
if (linesEnd == *GHIDRA_CAST<uint8_t **>((in_ECX + 0xc))) {
|
|
msvc::vector<FormattedTextLine>::_Emplace_reallocate(linesEnd,local_20);
|
|
}
|
|
else {
|
|
*linesEnd = local_20[0];
|
|
*GHIDRA_CAST<uint32_t *>((linesEnd + 4)) = local_1c;
|
|
*GHIDRA_CAST<uint16_t *>((linesEnd + 8)) = local_18;
|
|
*GHIDRA_CAST<int *>((in_ECX + 8)) = *GHIDRA_CAST<int *>((in_ECX + 8)) + 0xc;
|
|
}
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 00a55ef0
|
|
void FormattedText::split_lines(uint8_t *text, void *lines)
|
|
{
|
|
uint8_t *pbVar1;
|
|
uint32_t uVar2;
|
|
uint8_t *linesEnd;
|
|
uint8_t scanChar;
|
|
int charCount;
|
|
uint8_t *pbVar3;
|
|
uint8_t ch;
|
|
uint8_t *pbVar4;
|
|
uint8_t *pbVar5;
|
|
uint8_t *pbVar6;
|
|
uint8_t *linesCapacityEnd;
|
|
uint8_t line [4];
|
|
uint8_t *lineText;
|
|
short lineLength;
|
|
uint8_t *textStart;
|
|
int textLength;
|
|
uint8_t *local_10;
|
|
void *linesLocal;
|
|
uint8_t *local_8;
|
|
|
|
charCount = 0;
|
|
textLength = 0;
|
|
pbVar3 = text;
|
|
if (*text != 0) {
|
|
do {
|
|
pbVar3 = pbVar3 + 1;
|
|
charCount = charCount + 1;
|
|
} while (*pbVar3 != 0);
|
|
textLength = charCount;
|
|
}
|
|
textStart = text;
|
|
linesLocal = lines;
|
|
do {
|
|
ch = *text;
|
|
pbVar3 = text;
|
|
lineText = text;
|
|
local_8 = text;
|
|
if (ch != 0) {
|
|
pbVar4 = text;
|
|
scanChar = ch;
|
|
do {
|
|
if (scanChar == 10) {
|
|
pbVar5 = pbVar4;
|
|
pbVar6 = pbVar4;
|
|
local_10 = pbVar4;
|
|
goto LAB_00a55f66;
|
|
}
|
|
scanChar = pbVar4[1];
|
|
pbVar4 = pbVar4 + 1;
|
|
} while (scanChar != 0);
|
|
}
|
|
pbVar6 = GHIDRA_CAST<uint8_t *>(0x0);
|
|
local_10 = GHIDRA_CAST<uint8_t *>(0x0);
|
|
pbVar4 = GHIDRA_CAST<uint8_t *>(0x0);
|
|
pbVar5 = GHIDRA_CAST<uint8_t *>(0x0);
|
|
while (ch != 0) {
|
|
LAB_00a55f66:
|
|
uVar2 = 0;
|
|
while (ch == (&DAT_00b65584)[uVar2]) {
|
|
uVar2 = uVar2 + 1;
|
|
if (1 < uVar2) {
|
|
uVar2 = GHIDRA_UINT((pbVar5 != GHIDRA_CAST<uint8_t *>(0x0)));
|
|
if ((pbVar3 == GHIDRA_CAST<uint8_t *>(0x0)) || (pbVar5 <= pbVar3)) goto LAB_00a55fb8;
|
|
uVar2 = 2;
|
|
linesCapacityEnd = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(linesLocal) + 8));
|
|
linesEnd = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(linesLocal) + 4));
|
|
goto LAB_00a55fcb;
|
|
}
|
|
}
|
|
pbVar1 = pbVar3 + 1;
|
|
pbVar3 = pbVar3 + 1;
|
|
ch = *pbVar1;
|
|
}
|
|
if (pbVar4 == GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
pbVar6 = GHIDRA_CAST<uint8_t *>(0x0);
|
|
}
|
|
uVar2 = GHIDRA_UINT((local_10 != GHIDRA_CAST<uint8_t *>(0x0)));
|
|
pbVar5 = pbVar6;
|
|
LAB_00a55fb8:
|
|
pbVar3 = pbVar5;
|
|
linesCapacityEnd = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(linesLocal) + 8));
|
|
linesEnd = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(linesLocal) + 4));
|
|
if (pbVar3 == GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
lineLength = (short)textLength + ((short)textStart - (short)text);
|
|
line[0] = 0;
|
|
if (linesEnd == linesCapacityEnd) {
|
|
msvc::vector<FormattedTextLine>::_Emplace_reallocate(linesEnd,line);
|
|
return;
|
|
}
|
|
*GHIDRA_CAST<uint8_t **>((linesEnd + 4)) = text;
|
|
*linesEnd = 0;
|
|
*GHIDRA_CAST<short *>((linesEnd + 8)) = lineLength;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(linesLocal) + 4)) = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(linesLocal) + 4)) + 0xc;
|
|
return;
|
|
}
|
|
LAB_00a55fcb:
|
|
lineLength = (short)pbVar3 - (short)text;
|
|
line[0] = 0;
|
|
if (linesEnd == linesCapacityEnd) {
|
|
msvc::vector<FormattedTextLine>::_Emplace_reallocate(linesEnd,line);
|
|
text = pbVar3 + uVar2;
|
|
}
|
|
else {
|
|
*linesEnd = 0;
|
|
*GHIDRA_CAST<uint8_t **>((linesEnd + 4)) = text;
|
|
*GHIDRA_CAST<short *>((linesEnd + 8)) = lineLength;
|
|
text = pbVar3 + uVar2;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(linesLocal) + 4)) = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(linesLocal) + 4)) + 0xc;
|
|
}
|
|
} while( true );
|
|
}
|
|
|
|
// 00a56060
|
|
void FormattedText::split_lines_utf16(short *text, void *outLines)
|
|
{
|
|
short *psVar1;
|
|
int lengthCount;
|
|
uint32_t uVar2;
|
|
uint8_t *linesEnd;
|
|
short scanChar;
|
|
short currentChar;
|
|
uint8_t *linesCapacity;
|
|
short *lineEnd;
|
|
uint8_t newLine [4];
|
|
short *newLineText;
|
|
uint16_t newLineLength;
|
|
short *textStart;
|
|
int textLength;
|
|
short *local_18;
|
|
short *local_14;
|
|
short *newlinePos;
|
|
short *local_c;
|
|
void *outLinesLocal;
|
|
|
|
lengthCount = 0;
|
|
textLength = 0;
|
|
psVar1 = text;
|
|
if (*text != 0) {
|
|
do {
|
|
psVar1 = psVar1 + 1;
|
|
lengthCount = lengthCount + 1;
|
|
} while (*psVar1 != 0);
|
|
textLength = lengthCount;
|
|
}
|
|
textStart = text;
|
|
outLinesLocal = outLines;
|
|
do {
|
|
currentChar = *text;
|
|
newLineText = text;
|
|
local_c = text;
|
|
if (currentChar != 0) {
|
|
newlinePos = text;
|
|
scanChar = currentChar;
|
|
do {
|
|
if (scanChar == 10) goto LAB_00a560e3;
|
|
scanChar = newlinePos[1];
|
|
newlinePos = newlinePos + 1;
|
|
} while (scanChar != 0);
|
|
}
|
|
newlinePos = GHIDRA_CAST<short *>(0x0);
|
|
if (currentChar != 0) {
|
|
LAB_00a560e3:
|
|
psVar1 = text;
|
|
do {
|
|
uVar2 = 0;
|
|
while (currentChar == (char)(&DAT_00b65584)[uVar2]) {
|
|
uVar2 = uVar2 + 1;
|
|
if (1 < uVar2) {
|
|
uVar2 = GHIDRA_UINT((newlinePos != GHIDRA_CAST<short *>(0x0)));
|
|
lineEnd = newlinePos;
|
|
if ((psVar1 == GHIDRA_CAST<short *>(0x0)) || (newlinePos <= psVar1)) goto LAB_00a5614b;
|
|
uVar2 = 2;
|
|
linesCapacity = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(outLinesLocal) + 8));
|
|
linesEnd = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(outLinesLocal) + 4));
|
|
goto LAB_00a56158;
|
|
}
|
|
}
|
|
currentChar = psVar1[1];
|
|
psVar1 = psVar1 + 1;
|
|
} while (currentChar != 0);
|
|
}
|
|
lineEnd = newlinePos;
|
|
if (newlinePos == GHIDRA_CAST<short *>(0x0)) {
|
|
lineEnd = GHIDRA_CAST<short *>(0x0);
|
|
}
|
|
uVar2 = GHIDRA_UINT((newlinePos != GHIDRA_CAST<short *>(0x0)));
|
|
LAB_00a5614b:
|
|
psVar1 = lineEnd;
|
|
linesCapacity = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(outLinesLocal) + 8));
|
|
linesEnd = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(outLinesLocal) + 4));
|
|
if (psVar1 == GHIDRA_CAST<short *>(0x0)) {
|
|
newLine[0] = 0;
|
|
newLineLength = (uint16_t)((textLength * 2 - GHIDRA_INT(text)) + GHIDRA_INT(textStart) >> 1);
|
|
if (linesEnd == linesCapacity) {
|
|
local_18 = newlinePos;
|
|
local_14 = newlinePos;
|
|
msvc::vector<FormattedTextLine>::_Emplace_reallocate(linesEnd,newLine);
|
|
return;
|
|
}
|
|
*GHIDRA_CAST<short **>((linesEnd + 4)) = text;
|
|
*linesEnd = 0;
|
|
*GHIDRA_CAST<uint16_t *>((linesEnd + 8)) = newLineLength;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(outLinesLocal) + 4)) = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(outLinesLocal) + 4)) + 0xc;
|
|
return;
|
|
}
|
|
LAB_00a56158:
|
|
newLine[0] = 0;
|
|
newLineLength = (uint16_t)(GHIDRA_INT(psVar1) - GHIDRA_INT(text) >> 1);
|
|
if (linesEnd == linesCapacity) {
|
|
local_18 = newlinePos;
|
|
local_14 = newlinePos;
|
|
msvc::vector<FormattedTextLine>::_Emplace_reallocate(linesEnd,newLine);
|
|
text = psVar1 + uVar2;
|
|
}
|
|
else {
|
|
*GHIDRA_CAST<short **>((linesEnd + 4)) = text;
|
|
text = psVar1 + uVar2;
|
|
*linesEnd = 0;
|
|
*GHIDRA_CAST<uint16_t *>((linesEnd + 8)) = newLineLength;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(outLinesLocal) + 4)) = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(outLinesLocal) + 4)) + 0xc;
|
|
}
|
|
} while( true );
|
|
}
|