#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((param_1 + 4)); local_18 = *GHIDRA_CAST((param_1 + 8)); *in_ECX = *in_ECX | 1; linesEnd = *GHIDRA_CAST((in_ECX + 8)); if (linesEnd == *GHIDRA_CAST((in_ECX + 0xc))) { msvc::vector::_Emplace_reallocate(linesEnd,local_20); } else { *linesEnd = local_20[0]; *GHIDRA_CAST((linesEnd + 4)) = local_1c; *GHIDRA_CAST((linesEnd + 8)) = local_18; *GHIDRA_CAST((in_ECX + 8)) = *GHIDRA_CAST((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(0x0); local_10 = GHIDRA_CAST(0x0); pbVar4 = GHIDRA_CAST(0x0); pbVar5 = GHIDRA_CAST(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(0x0))); if ((pbVar3 == GHIDRA_CAST(0x0)) || (pbVar5 <= pbVar3)) goto LAB_00a55fb8; uVar2 = 2; linesCapacityEnd = *GHIDRA_CAST((GHIDRA_CAST(linesLocal) + 8)); linesEnd = *GHIDRA_CAST((GHIDRA_CAST(linesLocal) + 4)); goto LAB_00a55fcb; } } pbVar1 = pbVar3 + 1; pbVar3 = pbVar3 + 1; ch = *pbVar1; } if (pbVar4 == GHIDRA_CAST(0x0)) { pbVar6 = GHIDRA_CAST(0x0); } uVar2 = GHIDRA_UINT((local_10 != GHIDRA_CAST(0x0))); pbVar5 = pbVar6; LAB_00a55fb8: pbVar3 = pbVar5; linesCapacityEnd = *GHIDRA_CAST((GHIDRA_CAST(linesLocal) + 8)); linesEnd = *GHIDRA_CAST((GHIDRA_CAST(linesLocal) + 4)); if (pbVar3 == GHIDRA_CAST(0x0)) { lineLength = (short)textLength + ((short)textStart - (short)text); line[0] = 0; if (linesEnd == linesCapacityEnd) { msvc::vector::_Emplace_reallocate(linesEnd,line); return; } *GHIDRA_CAST((linesEnd + 4)) = text; *linesEnd = 0; *GHIDRA_CAST((linesEnd + 8)) = lineLength; *GHIDRA_CAST((GHIDRA_CAST(linesLocal) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(linesLocal) + 4)) + 0xc; return; } LAB_00a55fcb: lineLength = (short)pbVar3 - (short)text; line[0] = 0; if (linesEnd == linesCapacityEnd) { msvc::vector::_Emplace_reallocate(linesEnd,line); text = pbVar3 + uVar2; } else { *linesEnd = 0; *GHIDRA_CAST((linesEnd + 4)) = text; *GHIDRA_CAST((linesEnd + 8)) = lineLength; text = pbVar3 + uVar2; *GHIDRA_CAST((GHIDRA_CAST(linesLocal) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(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(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(0x0))); lineEnd = newlinePos; if ((psVar1 == GHIDRA_CAST(0x0)) || (newlinePos <= psVar1)) goto LAB_00a5614b; uVar2 = 2; linesCapacity = *GHIDRA_CAST((GHIDRA_CAST(outLinesLocal) + 8)); linesEnd = *GHIDRA_CAST((GHIDRA_CAST(outLinesLocal) + 4)); goto LAB_00a56158; } } currentChar = psVar1[1]; psVar1 = psVar1 + 1; } while (currentChar != 0); } lineEnd = newlinePos; if (newlinePos == GHIDRA_CAST(0x0)) { lineEnd = GHIDRA_CAST(0x0); } uVar2 = GHIDRA_UINT((newlinePos != GHIDRA_CAST(0x0))); LAB_00a5614b: psVar1 = lineEnd; linesCapacity = *GHIDRA_CAST((GHIDRA_CAST(outLinesLocal) + 8)); linesEnd = *GHIDRA_CAST((GHIDRA_CAST(outLinesLocal) + 4)); if (psVar1 == GHIDRA_CAST(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::_Emplace_reallocate(linesEnd,newLine); return; } *GHIDRA_CAST((linesEnd + 4)) = text; *linesEnd = 0; *GHIDRA_CAST((linesEnd + 8)) = newLineLength; *GHIDRA_CAST((GHIDRA_CAST(outLinesLocal) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(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::_Emplace_reallocate(linesEnd,newLine); text = psVar1 + uVar2; } else { *GHIDRA_CAST((linesEnd + 4)) = text; text = psVar1 + uVar2; *linesEnd = 0; *GHIDRA_CAST((linesEnd + 8)) = newLineLength; *GHIDRA_CAST((GHIDRA_CAST(outLinesLocal) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(outLinesLocal) + 4)) + 0xc; } } while( true ); }