Files
isaac-port/generated-src/font.cpp
T
shweetandClaude Opus 5.5 837aa06518 Curation round 1: 66 boot-path functions rewritten in src/; the game links into a Linux executable
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>
2026-11-19 22:13:25 -05:00

1140 lines
39 KiB
C++

#include "classes.h"
// 00407280
void Font::SetLineHeightModifier(float modifier)
{
*GHIDRA_CAST<float *>(&this->_paddingRight) = modifier;
return;
}
// 0085e450
void Font::EnableAutoWrap(uint16_t param_2)
{
this->_stretchH = 1;
this->_aa = 0;
this->_paddingUp = 0;
this->_infoBitField = (uint8_t)param_2;
this->_charSet = (*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(param_2)) + 0x1)));
this->_paddingRight = 0;
this->_paddingDown = 0;
this->_paddingLeft = 0x80;
this->_spacingHoriz = 0x3f;
return;
}
// 0085e470
void Font::Load(uint8_t *path)
{
Load(this,path,0);
return;
}
// 009f0140
Vector * Font::measure_rich_text(Vector *outSize, uint8_t *text, int maxWidth, float scale)
{
uint32_t uVar1;
void *pvVar2;
KColor *baseColor;
int linesHeight;
void *pvVar3;
float lineWidth;
float widestLine;
KColor white;
void *linesBegin;
void *linesEnd;
int linesCapacityEnd;
float textScale;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
int *lineWidthPtr;
puStack_c = &LAB_00b0ff7d;
local_10 = ExceptionList;
uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
ExceptionList = &local_10;
linesBegin = (void *)0x0;
linesEnd = (void *)0x0;
linesCapacityEnd = 0;
local_8 = 0;
textScale = scale;
(GHIDRA_CAST<KColor *>((&white)))->KColor::SetFromARGB(0xffffffff);
rich_text_layout(this,text,baseColor,maxWidth,&linesBegin,scale);
pvVar3 = linesEnd;
linesHeight = (GHIDRA_INT(linesEnd) - GHIDRA_INT(linesBegin) >> 4) *
GHIDRA_UINT(*GHIDRA_CAST<uint16_t *>(&(this->_kerningPairs)._begin));
outSize->x = 0.0;
outSize->y = (float)((double)linesHeight + __uint_to_double_fixup[-(linesHeight >> 0x1f)]) *
*GHIDRA_CAST<float *>(&this[1]._pages) * textScale;
if (linesBegin != linesEnd) {
pvVar2 = linesBegin;
do {
lineWidthPtr = GHIDRA_CAST<int *>((GHIDRA_INT(pvVar2) + 0xc));
pvVar2 = (void *)(GHIDRA_INT(pvVar2) + 0x10);
lineWidth = (float)((double)*lineWidthPtr + __uint_to_double_fixup[-(*lineWidthPtr >> 0x1f)]);
widestLine = outSize->x;
if (outSize->x <= lineWidth) {
widestLine = lineWidth;
}
outSize->x = widestLine;
} while (pvVar2 != linesEnd);
}
pvVar2 = linesBegin;
if (linesBegin != (void *)0x0) {
for (; pvVar2 != pvVar3; pvVar2 = (void *)(GHIDRA_INT(pvVar2) + 0x10)) {
msvc::vector<RichTextSegment>::_Tidy(uVar1);
}
uVar1 = linesCapacityEnd - GHIDRA_INT(linesBegin) & 0xfffffff0;
pvVar3 = linesBegin;
if (0xfff < uVar1) {
pvVar3 = *(void **)(GHIDRA_CAST<char *>(linesBegin) + -4);
uVar1 = uVar1 + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(linesBegin) + (-4 - GHIDRA_INT(pvVar3))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pvVar3,uVar1);
}
ExceptionList = local_10;
return outSize;
}
// 00a1a5c0
void Font::SetAlignment(uint32_t param_1)
{
uint32_t *in_ECX;
*in_ECX = param_1;
return;
}
// 00a1a5d0
void Font::SetMaxCharacters(uint16_t param_1)
{
int in_ECX;
*GHIDRA_CAST<uint16_t *>((in_ECX + 4)) = param_1;
return;
}
// 00a1a5e0
short Font::GetMaxCharacters()
{
return *GHIDRA_CAST<short *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4))));
}
// 00a1a5f0
uint8_t Font::IsAutoWrapEnabled()
{
int iVar1;
(*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(&(iVar1)) + 0x0))) = this->_stretchH;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(iVar1)) + 0x2))) = this->_aa;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(iVar1)) + 0x3))) = this->_paddingUp;
return iVar1 == 1;
}
// 00a1a600
void Font::EnableTruncation(uint16_t param_1)
{
int in_ECX;
*GHIDRA_CAST<uint32_t *>((in_ECX + 8)) = 2;
*GHIDRA_CAST<uint16_t *>((in_ECX + 6)) = param_1;
return;
}
// 00a1a620
bool Font::IsTruncationEnabled()
{
int in_ECX;
return *GHIDRA_CAST<int *>((in_ECX + 8)) == 2;
}
// 00a1a630
void Font::SetMissingCharacterOverride(uint32_t param_2)
{
this->_spacingVert = (uint8_t)param_2;
this->_outline = (*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(param_2)) + 0x1)));
*GHIDRA_CAST<uint16_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x12)))) = (*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(&(param_2)) + 0x2)));
return;
}
// 00a1a730
void Font::Load(uint8_t *path, uint8_t unusedIsLoading)
{
uint8_t bVar1;
int64_t lVar2;
char cVar3;
int *piVar4;
char *pcVar5;
uint8_t *pbVar6;
uint32_t uVar7;
void *pvVar8;
uint8_t *pbVar9;
void *kerningEnd;
uint32_t kerningCount;
uint32_t *pageTextures;
uint8_t *copySrc;
std_vector *kerningPairs;
uint8_t *copyDst;
int iVar10;
uint32_t *pageTextures;
bool bVar12;
undefined3 in_stack_00000009;
uint8_t image [4];
int *imageRef;
int blockStart;
uint32_t local_438;
std_vector *kerningVector;
void *local_430;
uint32_t local_42c;
int *openFile;
Font *local_424;
uint8_t *local_420;
uint32_t local_41c;
uint8_t local_417 [514];
char directory [513];
uint32_t local_14;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
local_8 = 0xffffffff;
puStack_c = &LAB_00b11203;
local_10 = ExceptionList;
local_14 = __security_cookie ^ GHIDRA_UINT((directory + 0x211));
ExceptionList = &local_10;
local_424 = this;
Unload(this);
piVar4 = (GHIDRA_CAST<FileSystem *>((&PTR_vftable_00c37a10)))->FileSystem::Open(path,GHIDRA_CAST<int *>(0x0));
if (piVar4 != GHIDRA_CAST<int *>(0x0)) {
iVar10 = -GHIDRA_INT(path);
do {
bVar1 = *path;
path = path + 1;
path[GHIDRA_INT((directory + iVar10))] = bVar1;
} while (bVar1 != 0);
pcVar5 = directory;
do {
pcVar5 = pcVar5 + 1;
} while (*pcVar5 != '\0');
pcVar5 = pcVar5 + -1;
cVar3 = *pcVar5;
for (; ((cVar3 != '/' && (cVar3 != '\\')) && (pcVar5 != directory + 1)); pcVar5 = pcVar5 + -1) {
cVar3 = pcVar5[-1];
}
*pcVar5 = '\0';
local_41c = 0;
openFile = piVar4;
(**(code **)(*piVar4 + 0x14))(&local_41c,1,3);
pbVar9 = &DAT_00b82680;
pbVar6 = GHIDRA_CAST<uint8_t *>(&local_41c);
do {
bVar1 = *pbVar6;
bVar12 = bVar1 < *pbVar9;
if (bVar1 != *pbVar9) {
LAB_00a1a830:
uVar7 = -GHIDRA_UINT(bVar12) | 1;
goto LAB_00a1a835;
}
if (bVar1 == 0) break;
bVar1 = pbVar6[1];
bVar12 = bVar1 < pbVar9[1];
if (bVar1 != pbVar9[1]) goto LAB_00a1a830;
pbVar6 = pbVar6 + 2;
pbVar9 = pbVar9 + 2;
} while (bVar1 != 0);
uVar7 = 0;
LAB_00a1a835:
if (uVar7 == 0) {
local_417[2] = '\0';
(**(code **)(*piVar4 + 0x14))(local_417 + 2,1,1);
if (local_417[2] == '\x03') {
cVar3 = (**(code **)(*piVar4 + 0x10))();
while (cVar3 == '\0') {
local_417[2] = '\0';
(**(code **)(*piVar4 + 0x14))(local_417 + 2,1,1);
local_41c = 0;
(**(code **)(*piVar4 + 0x14))(&local_41c,4,1);
blockStart = (**(code **)(*piVar4 + 8))();
cVar3 = (**(code **)(*piVar4 + 0x10))();
if (cVar3 != '\0') break;
switch(local_417[2]) {
case 1:
(**(code **)(*piVar4 + 0x14))(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4))),0x10,1);
break;
case 2:
(**(code **)(*piVar4 + 0x14))(&this->_lineHeight,0x10,1);
break;
case 3:
pbVar6 = operator_new_tracked(local_41c + 1);
local_420 = pbVar6;
(**(code **)(*piVar4 + 0x14))(pbVar6,1,local_41c);
pbVar6[local_41c] = 0;
uVar7 = GHIDRA_UINT((uint16_t)this->_pages);
local_424->_numPages = uVar7;
pageTextures = operator_new_tracked(-GHIDRA_UINT((0xfffffffb < uVar7 * 8)) | uVar7 * 8 + 4);
local_8 = 0;
if (pageTextures == GHIDRA_CAST<uint32_t *>(0x0)) {
pageTextures = GHIDRA_CAST<uint32_t *>(0x0);
}
else {
pageTextures = pageTextures + 1;
*pageTextures = uVar7;
_eh_vector_constructor_iterator_
(pageTextures,8,uVar7,GHIDRA_CAST<_func_void_void_ptr *>(&LAB_0040c5b0),TexturePtr::release);
}
local_42c = 0;
local_424->_pageTextures = pageTextures;
pbVar6 = local_420;
this = local_424;
if (local_424->_numPages != 0) {
do {
local_8 = 0xffffffff;
memset(local_417 + 3,0,0x200);
pcVar5 = directory + 1;
do {
cVar3 = *pcVar5;
pcVar5 = pcVar5 + 1;
} while (cVar3 != '\0');
if (pcVar5 != directory + 2) {
sprintf(local_417 + 3,&DAT_00b7dea4);
}
pbVar9 = pbVar6;
do {
bVar1 = *pbVar9;
pbVar9 = pbVar9 + 1;
} while (bVar1 != 0);
copyDst = local_417 + 2;
do {
copySrc = copyDst + 1;
copyDst = copyDst + 1;
} while (*copySrc != 0);
copySrc = pbVar6;
for (uVar7 = GHIDRA_UINT((GHIDRA_INT(pbVar9) - GHIDRA_INT(pbVar6))) >> 2; uVar7 != 0; uVar7 = uVar7 - 1)
{
*GHIDRA_CAST<uint32_t *>(copyDst) = *GHIDRA_CAST<uint32_t *>(copySrc);
copySrc = copySrc + 4;
copyDst = copyDst + 4;
}
for (uVar7 = GHIDRA_INT(pbVar9) - GHIDRA_INT(pbVar6) & 3; uVar7 != 0; uVar7 = uVar7 - 1) {
*copyDst = *copySrc;
copySrc = copySrc + 1;
copyDst = copyDst + 1;
}
pbVar9 = GHIDRA_CAST<uint8_t *>(0x0);
if (_unusedIsLoading != GHIDRA_CAST<char *>(0x0)) {
pcVar5 = _unusedIsLoading;
do {
cVar3 = *pcVar5;
pcVar5 = pcVar5 + 1;
} while (cVar3 != '\0');
pbVar9 = GHIDRA_CAST<uint8_t *>((pcVar5 + -GHIDRA_INT((_unusedIsLoading + 1))));
if (pbVar9 == GHIDRA_CAST<uint8_t *>(0x3)) {
pbVar9 = local_417 + 3;
do {
bVar1 = *pbVar9;
pbVar9 = pbVar9 + 1;
} while (bVar1 != 0);
uVar7 = GHIDRA_INT(pbVar9) - GHIDRA_INT((local_417 + 4));
pbVar9 = GHIDRA_CAST<uint8_t *>(0x0);
if ((4 < uVar7) &&
(pbVar9 = local_417 + uVar7 + 3, local_417[uVar7 - 1] == 0x2e)) {
*GHIDRA_CAST<uint16_t *>((local_417 + uVar7)) = *GHIDRA_CAST<uint16_t *>(_unusedIsLoading);
local_417[uVar7 + 2] = _unusedIsLoading[2];
}
}
}
pvVar8 = (void *)KAGE_Graphics_ImageManager::load_image_file
(image,local_417 + 3,pbVar9);
this = local_424;
uVar7 = local_42c;
local_8 = 1;
KAGE::SmartPointer::operator_assign
((void *)(GHIDRA_INT(local_424->_pageTextures) + local_42c * 8),pvVar8);
local_8 = 2;
if (((imageRef != GHIDRA_CAST<int *>(0x0)) &&
(cVar3 = (**(code **)(*imageRef + 0xc))(), cVar3 != '\0')) &&
(g_imageReleaseFn != (void *)0x0)) {
(*g_imageReleaseFn)(image);
}
do {
bVar1 = *pbVar6;
pbVar6 = pbVar6 + 1;
} while (bVar1 != 0);
local_42c = uVar7 + 1;
} while (local_42c < GHIDRA_UINT(this->_numPages));
}
local_8 = 0xffffffff;
if (local_420 != GHIDRA_CAST<uint8_t *>(0x0)) {
local_8 = 3;
tracked_alloc(1,local_420,0);
local_8 = 0xffffffff;
}
goto LAB_00a1ad1a;
case 4:
this->_numChars = local_41c / 0x14;
lVar2 = (uint64_t)(local_41c / 0x14) * 0x14;
pvVar8 = operator_new_tracked
(-GHIDRA_UINT((GHIDRA_INT(((uint64_t)lVar2 >> 0x20)) != 0)) | GHIDRA_UINT(lVar2));
this->_chars = pvVar8;
(**(code **)(*piVar4 + 0x14))(pvVar8,0x14,this->_numChars);
if (this->_numChars != 0) {
iVar10 = 0;
uVar7 = 0;
do {
pageTextures = map_find_value(&this->_charsBlock,GHIDRA_INT(local_424->_chars) + iVar10);
iVar10 = iVar10 + 0x14;
*pageTextures = uVar7;
uVar7 = uVar7 + 1;
} while (uVar7 < GHIDRA_UINT(local_424->_numChars));
this = local_424;
goto LAB_00a1ad1a;
}
break;
case 5:
kerningPairs = &this->_kerningPairs;
pvVar8 = kerningPairs->_begin;
kerningEnd = (this->_kerningPairs)._end;
kerningCount = local_41c / 10;
uVar7 = GHIDRA_INT(kerningEnd) - GHIDRA_INT(pvVar8) >> 4;
kerningVector = kerningPairs;
local_430 = kerningEnd;
if (kerningCount < uVar7) {
(this->_kerningPairs)._end = (void *)(kerningCount * 0x10 + GHIDRA_INT(pvVar8));
}
else if (uVar7 < kerningCount) {
if (GHIDRA_UINT((GHIDRA_INT((this->_kerningPairs)._capacity) - GHIDRA_INT(pvVar8) >> 4)) < kerningCount) {
msvc::vector<16byte>::_Resize_reallocate(kerningCount,uVar7);
}
else {
iVar10 = kerningCount - uVar7;
if (iVar10 != 0) {
memset(kerningEnd,0,iVar10 * 0x10);
kerningEnd = (void *)(GHIDRA_INT(local_430) + iVar10 * 0x10);
}
(this->_kerningPairs)._end = kerningEnd;
}
}
if (kerningCount != 0) {
local_430 = (void *)0x0;
do {
pageTextures = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(kerningPairs->_begin) + GHIDRA_INT(local_430)));
local_420 = GHIDRA_CAST<uint8_t *>(0x0);
(**(code **)(*openFile + 0x14))(&local_420,4,1);
pbVar6 = local_420;
local_42c = 0;
(**(code **)(*openFile + 0x14))(&local_42c,4,1);
pageTextures[1] = GHIDRA_UINT(pbVar6);
*pageTextures = local_42c;
local_420 = GHIDRA_CAST<uint8_t *>(0x0);
(**(code **)(*openFile + 0x14))(&local_420,2,1);
*GHIDRA_CAST<uint16_t *>((pageTextures + 2)) = (*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(&(local_420)) + 0x0)));
local_430 = (void *)(GHIDRA_INT(local_430) + 0x10);
kerningCount = kerningCount - 1;
kerningPairs = kerningVector;
} while (kerningCount != 0);
}
this = local_424;
local_438 = local_438 & 0xffffff00;
msvc::_Sort_unchecked<16byte_u64key>
(GHIDRA_INT((local_424->_kerningPairs)._end) - GHIDRA_INT(kerningPairs->_begin) >> 4,
local_438);
LAB_00a1ad1a:
piVar4 = openFile;
}
(**(code **)(*piVar4 + 0xc))(local_41c + blockStart,0);
cVar3 = (**(code **)(*piVar4 + 0x10))();
}
(**(code **)*piVar4)(1);
*GHIDRA_CAST<uint8_t *>(this) = 1;
}
}
}
ExceptionList = local_10;
return;
}
// 00a1ad90
void Font::Unload()
{
void *pvVar1;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
uint32_t *pageTexturesHeader;
puStack_c = &LAB_00b11230;
local_10 = ExceptionList;
ExceptionList = &local_10;
if (this->_chars != (void *)0x0) {
local_8 = 0;
tracked_alloc(1,this->_chars,0);
this->_chars = (void *)0x0;
}
local_8 = 0xffffffff;
pvVar1 = this->_pageTextures;
if (pvVar1 != (void *)0x0) {
pageTexturesHeader = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(pvVar1) + -4));
local_8 = 1;
_eh_vector_destructor_iterator_(pvVar1,8,*pageTexturesHeader,TexturePtr::release);
operator_delete(pageTexturesHeader,*pageTexturesHeader * 8 + 4);
this->_pageTextures = (void *)0x0;
}
pvVar1 = (this->_charsBlock)._head;
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<msvc::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(&this->_charsBlock,
(fuzzer_allocator<msvc::_Tree_node<unsigned_int,void*>_> *)&this->_charsBlock,
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(pvVar1) + 4));
*(void **)(GHIDRA_CAST<char *>(pvVar1) + 4) = pvVar1;
*(void **)pvVar1 = pvVar1;
*(void **)(GHIDRA_CAST<char *>(pvVar1) + 8) = pvVar1;
(this->_charsBlock)._size = 0;
*GHIDRA_CAST<uint8_t *>(this) = 0;
this->_numChars = 0;
this->_numPages = 0;
ExceptionList = local_10;
return;
}
// 00a1ae70
void Font::GetCharacterWidth()
{
FUN_00a1b510();
return;
}
// 00a1ae80
int Font::GetStringWidth(uint8_t *str)
{
int width;
width = get_string_width_n(this,str,-1);
return width;
}
// 00a1aea0
short Font::GetLineHeight()
{
return this->_lineHeight;
}
// 00a1aeb0
short Font::GetBaselineHeight()
{
return this->_base;
}
// 00a1aec0
void Font::DrawStringScaled(uint8_t *text, Vector *pos, KColor *color, void *settings)
{
float y;
uint32_t uVar1;
void *glyphs;
uint8_t glyphBuffer [16];
float local_14;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
local_8 = 0xffffffff;
puStack_c = &LAB_00b1125d;
local_10 = ExceptionList;
uVar1 = __security_cookie ^ GHIDRA_UINT((glyphBuffer + 0x20));
ExceptionList = &local_10;
y = pos->y;
local_14 = pos->x;
glyphs = measure_string(this,glyphBuffer,text,settings,&g_vectorOne);
local_8 = 0;
render_glyph_quads(this,glyphs,local_14,y,1.0,1.0,*color,settings);
msvc::vector<12byte>::clear(uVar1);
msvc::vector<12byte>::_Tidy();
ExceptionList = local_10;
return;
}
// 00a1af90
void Font::DrawString(uint8_t *text, KColor *color, void *settings, float x, float y)
{
uint32_t uVar1;
void *glyphs;
uint8_t local_2c [16];
float posX;
float posY;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
local_8 = 0xffffffff;
puStack_c = &LAB_00b1128d;
local_10 = ExceptionList;
uVar1 = __security_cookie ^ GHIDRA_UINT((local_2c + 0x28));
ExceptionList = &local_10;
posX = x;
posY = y;
glyphs = measure_string(this,local_2c,text,settings,&g_vectorOne);
local_8 = 0;
render_glyph_quads(this,glyphs,posX,posY,1.0,1.0,*color,settings);
msvc::vector<12byte>::clear(uVar1);
msvc::vector<12byte>::_Tidy();
ExceptionList = local_10;
return;
}
// 00a1b050
void Font::DrawString(uint8_t *str, Vector *position, Vector *scale, KColor *color, void *settings)
{
float scaleY;
float y;
uint32_t uVar1;
void *glyphs;
uint8_t glyphVector [16];
float local_1c;
float scaleX;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
local_8 = 0xffffffff;
puStack_c = &LAB_00b1128d;
local_10 = ExceptionList;
uVar1 = __security_cookie ^ GHIDRA_UINT((glyphVector + 0x28));
ExceptionList = &local_10;
scaleY = scale->y;
scaleX = scale->x;
y = position->y;
local_1c = position->x;
glyphs = measure_string(this,glyphVector,str,settings,scale);
local_8 = 0;
render_glyph_quads(this,glyphs,local_1c,y,scaleX,scaleY,*color,settings);
msvc::vector<12byte>::clear(uVar1);
msvc::vector<12byte>::_Tidy();
ExceptionList = local_10;
return;
}
// 00a1b140
void Font::DrawString(uint8_t *str, Vector pos, Vector scale, KColor *color, FontSettings *settings)
{
uint32_t uVar1;
void *glyphs;
uint8_t layout [16];
Vector scaleCopy;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
local_8 = 0xffffffff;
puStack_c = &LAB_00b1128d;
local_10 = ExceptionList;
uVar1 = __security_cookie ^ GHIDRA_UINT((layout + 0x28));
ExceptionList = &local_10;
scaleCopy.x = scale.x;
scaleCopy.y = scale.y;
glyphs = measure_string(this,layout,str,settings,&scaleCopy);
local_8 = 0;
render_glyph_quads(this,glyphs,pos.x,pos.y,scale.x,scale.y,*color,settings);
msvc::vector<12byte>::clear(uVar1);
msvc::vector<12byte>::_Tidy();
ExceptionList = local_10;
return;
}
// 00a1b210
void Font::draw_string_wide_unscaled(short *text, float x, float y, KColor *color, void *settings)
{
uint32_t uVar1;
void *glyphRun;
uint8_t glyphBuffer [16];
float drawX;
float drawY;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
local_8 = 0xffffffff;
puStack_c = &LAB_00b1128d;
local_10 = ExceptionList;
uVar1 = __security_cookie ^ GHIDRA_UINT((glyphBuffer + 0x28));
ExceptionList = &local_10;
drawX = x;
drawY = y;
glyphRun = layout_glyphs(this,glyphBuffer,GHIDRA_CAST<uint8_t *>(text),settings,&g_vectorOne);
local_8 = 0;
draw_glyph_run(this,drawX,drawY,glyphRun,1.0,1.0,*color,settings);
msvc::vector<12byte>::clear(uVar1);
msvc::vector<12byte>::_Tidy();
ExceptionList = local_10;
return;
}
// 00a1b3b0
void Font::SetMissingCharacter(uint32_t character)
{
uint8_t findResult [8];
void *boundNode;
uint32_t characterLocal;
characterLocal = character;
this->_missingCharacter = -1;
_Find_lower_bound<>(findResult,&character);
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(boundNode) + 0xd)) == '\0') &&
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(boundNode) + 0x10)) <= characterLocal)) &&
(boundNode != (this->_charsBlock)._head)) {
this->_missingCharacter = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(boundNode) + 0x14));
return;
}
this->_missingCharacter = -1;
return;
}
// 00a1b410
uint32_t Font::get_glyph_index(uint32_t param_1, uint32_t param_2)
{
uint32_t uVar1;
int in_ECX;
int iVar2;
uint8_t local_14 [8];
int local_c;
int local_8;
local_8 = in_ECX;
_Find_lower_bound<>(local_14,&param_1);
uVar1 = param_2;
if ((*GHIDRA_CAST<char *>((local_c + 0xd)) == '\0') && (*GHIDRA_CAST<uint32_t *>((local_c + 0x10)) <= param_1)) {
iVar2 = *GHIDRA_CAST<int *>((in_ECX + 0x40));
if (local_c != iVar2) {
return *GHIDRA_CAST<uint32_t *>((local_c + 0x14));
}
}
else {
iVar2 = *GHIDRA_CAST<int *>((in_ECX + 0x40));
}
if (param_2 != 0xffffffff) {
_Find_lower_bound<>(local_14,&param_2);
if (((*GHIDRA_CAST<char *>((local_c + 0xd)) == '\0') && (*GHIDRA_CAST<uint32_t *>((local_c + 0x10)) <= uVar1)) &&
(local_c != iVar2)) {
return *GHIDRA_CAST<uint32_t *>((local_c + 0x14));
}
}
return *GHIDRA_CAST<uint32_t *>((local_8 + 0x48));
}
// 00a1b580
void Font::render_glyph(uint32_t ch, uint8_t unknown, uint32_t *prevChar, float x, float y, float scaleX, float scaleY, KColor color, void *glyphContext)
{
char isAccepted;
int glyphIndex;
int iVar1;
uint32_t *puVar2;
uint32_t *extraout_EAX;
int unused;
KColor *color_00;
int unused_00;
uint32_t *dst;
float scaleXLocal;
float penX;
uint8_t renderQuad [112];
uint32_t *callbackArgs;
uint8_t *local_144;
uint32_t *local_140;
uint16_t local_13c;
uint32_t srcQuadCopy;
uint32_t uStack_134;
uint32_t uStack_130;
uint32_t uStack_12c;
uint32_t local_128;
uint32_t uStack_124;
uint32_t uStack_120;
uint32_t uStack_11c;
uint32_t local_118;
uint32_t colorQuad [28];
KColor cornerColor0;
KColor cornerColor1;
KColor cornerColor2;
KColor cornerColor3;
uint8_t srcQuad [16];
KColor white;
float kernOffset;
void *glyphTable;
Vector local_20;
Vector local_18;
Vector local_10;
void *glyphs;
local_20.y = (float)this;
glyphIndex = Font::get_glyph_index(ch,*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(glyphContext) + 0x10)));
if (glyphIndex == -1) {
return;
}
glyphs = this->_chars;
local_18.y = (float)GHIDRA_INT(*GHIDRA_CAST<short *>((GHIDRA_CAST<char *>(glyphs) + glyphIndex * 0x14 + 0x10)));
glyphTable = glyphs;
iVar1 = get_kerning(this,*prevChar,ch);
kernOffset = (float)iVar1 * scaleX;
penX = x - kernOffset;
x = penX;
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(glyphContext) + 0x14)) == 0) {
local_10.x = (float)*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(glyphs) + glyphIndex * 0x14 + 8));
local_10.y = (float)*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(glyphs) + glyphIndex * 0x14 + 10));
local_20.x = (float)*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(glyphs) + glyphIndex * 0x14 + 4));
local_20.y = (float)*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(glyphs) + glyphIndex * 0x14 + 6));
scaleXLocal = scaleX;
quad_set_rect(srcQuad,&local_20,&local_10,unused);
local_10.x = (float)*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(glyphs) + glyphIndex * 0x14 + 8)) * scaleXLocal;
local_10.y = (float)*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(glyphs) + glyphIndex * 0x14 + 10)) * scaleY;
local_20.x = (float)GHIDRA_INT(*GHIDRA_CAST<short *>((GHIDRA_CAST<char *>(glyphs) + glyphIndex * 0x14 + 0xc))) * scaleXLocal + penX;
local_20.y = (float)GHIDRA_INT(*GHIDRA_CAST<short *>((GHIDRA_CAST<char *>(glyphs) + glyphIndex * 0x14 + 0xe))) * scaleY + y;
render_quad_set_rect(renderQuad,&local_20,&local_10,&color);
(**(code **)(**GHIDRA_CAST<int **>((GHIDRA_INT(this->_pageTextures) +
GHIDRA_UINT(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(glyphs) + glyphIndex * 0x14 + 0x12))) * 8)) + 0x14))
(srcQuad,renderQuad,g_drawRectUnset);
}
else {
callbackArgs = &ch;
local_144 = &unknown;
local_140 = prevChar;
FUN_00a11080();
(GHIDRA_CAST<KColor *>((&white)))->KColor::SetFromARGB(0xffffffff);
(GHIDRA_CAST<ColorQuad *>((colorQuad)))->ColorQuad::ColorQuad(color_00);
(GHIDRA_CAST<KColor *>((&cornerColor0)))->KColor::SetFromARGB(0xffffffff);
(GHIDRA_CAST<KColor *>((&cornerColor1)))->KColor::SetFromARGB(0xffffffff);
(GHIDRA_CAST<KColor *>((&cornerColor2)))->KColor::SetFromARGB(0xffffffff);
(GHIDRA_CAST<KColor *>((&cornerColor3)))->KColor::SetFromARGB(0xffffffff);
local_13c = *GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(glyphs) + glyphIndex * 0x14 + 0x10));
local_18.x = (float)*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(glyphs) + glyphIndex * 0x14 + 8));
local_18.y = (float)*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(glyphs) + glyphIndex * 0x14 + 10));
local_10.x = (float)*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(glyphs) + glyphIndex * 0x14 + 4));
local_10.y = (float)*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(glyphs) + glyphIndex * 0x14 + 6));
puVar2 = quad_set_rect(srcQuad,&local_10,&local_18,unused_00);
srcQuadCopy = *puVar2;
uStack_134 = puVar2[1];
uStack_130 = puVar2[2];
uStack_12c = puVar2[3];
local_128 = puVar2[4];
uStack_124 = puVar2[5];
uStack_120 = puVar2[6];
uStack_11c = puVar2[7];
local_118 = puVar2[8];
local_10.x = (float)*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(glyphs) + glyphIndex * 0x14 + 8)) * scaleX;
local_10.y = (float)*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(glyphs) + glyphIndex * 0x14 + 10)) * scaleY;
local_18.x = (float)GHIDRA_INT(*GHIDRA_CAST<short *>((GHIDRA_CAST<char *>(glyphs) + glyphIndex * 0x14 + 0xc))) * scaleX + x;
local_18.y = (float)GHIDRA_INT(*GHIDRA_CAST<short *>((GHIDRA_CAST<char *>(glyphs) + glyphIndex * 0x14 + 0xe))) * scaleY + y;
render_quad_set_rect(renderQuad,&local_18,&local_10,&color);
puVar2 = extraout_EAX;
dst = colorQuad;
for (iVar1 = 0x1c; iVar1 != 0; iVar1 = iVar1 + -1) {
*dst = *puVar2;
puVar2 = puVar2 + 1;
dst = dst + 1;
}
isAccepted = (**(code **)(GHIDRA_CAST<char *>(glyphContext) + 0x14))
(&callbackArgs,*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(glyphContext) + 0x18)));
if (isAccepted == '\0') {
return;
}
(**(code **)(**GHIDRA_CAST<int **>((GHIDRA_INT(*(void **)(GHIDRA_CAST<char *>(local_20.y) + 0x3c)) +
GHIDRA_UINT(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(glyphTable) + glyphIndex * 0x14 + 0x12))) * 8)) + 0x14))
(&srcQuadCopy,colorQuad,g_drawRectUnset);
}
*prevChar = ch;
return;
}
// 00a1ba10
int Font::get_string_width_utf16(short *text, int length)
{
int iVar1;
int iVar2;
uint16_t *cursor;
uint32_t ch;
int width;
uint32_t prevChar;
uint32_t searchKey;
void *glyphMapHead;
uint16_t *textBegin;
uint16_t *textEnd;
uint8_t findResult [8];
void *glyphNode;
if ((*GHIDRA_CAST<char *>(this) == '\0') || (text == GHIDRA_CAST<short *>(0x0))) {
return 0;
}
FUN_00a55b00(text,length);
iVar2 = 0;
if (textBegin < textEnd) {
ch = GHIDRA_UINT(*textBegin);
prevChar = 0;
width = 0;
if (ch != 0) {
glyphMapHead = (this->_charsBlock)._head;
cursor = textBegin;
do {
cursor = cursor + 1;
searchKey = ch;
_Find_lower_bound<>(findResult,&searchKey);
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(glyphNode) + 0xd)) == '\0') && (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(glyphNode) + 0x10)) <= ch))
&& (glyphNode != glyphMapHead)) {
iVar2 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(glyphNode) + 0x14));
}
else {
iVar2 = this->_missingCharacter;
}
if (iVar2 != -1) {
iVar1 = get_kerning(this,prevChar,ch);
width = width + (*GHIDRA_CAST<short *>((GHIDRA_CAST<char *>(this->_chars) + iVar2 * 0x14 + 0x10)) - iVar1);
prevChar = ch;
}
iVar2 = width;
} while ((cursor < textEnd) && (ch = GHIDRA_UINT(*cursor), ch != 0));
}
}
if (iVar2 < 0) {
iVar2 = 0;
}
return iVar2;
}
// 00a1bb10
void * Font::measure_string(void *outLayout, uint8_t *text, void *settings, Vector *scale)
{
uint8_t *pbVar1;
uint16_t widthBudget;
uint32_t uVar3;
uint32_t lineWidth;
uint32_t maxWidth;
uint8_t *pbVar4;
uint8_t layout [4];
uint8_t *linesBegin;
int linesEnd;
int linesCapacity;
uint8_t *lineCount;
uint32_t local_14;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
float scaleX;
uint32_t widthBudget;
puStack_c = &LAB_00b1130b;
local_10 = ExceptionList;
uVar3 = __security_cookie ^ GHIDRA_UINT((layout + 0x24));
ExceptionList = &local_10;
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(settings) + 8)) == 1) {
widthBudget = *GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(settings) + 6));
scaleX = scale->x;
*GHIDRA_CAST<uint8_t *>(outLayout) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(outLayout) + 4)) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(outLayout) + 8)) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(outLayout) + 0xc)) = 0;
local_8 = 0;
(GHIDRA_CAST<FormattedText *>((outLayout)))->FormattedText::set(text,this,GHIDRA_UINT(widthBudget),scaleX,0);
ExceptionList = local_10;
return outLayout;
}
layout[0] = 0;
linesBegin = GHIDRA_CAST<uint8_t *>(0x0);
linesEnd = 0;
linesCapacity = 0;
local_8 = 1;
msvc::vector<12byte>::clear(uVar3);
FormattedText::split_lines(text,&linesBegin);
layout[0] = layout[0] | 1;
local_8 = 2;
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(settings) + 8)) == 2) {
maxWidth = GHIDRA_UINT(*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(settings) + 6)));
local_14 = get_string_width_n(this,&DAT_00b1cec0,-1);
if (maxWidth < local_14) {
local_14 = maxWidth;
}
local_14 = maxWidth - local_14;
text = GHIDRA_CAST<uint8_t *>(0x0);
lineCount = GHIDRA_CAST<uint8_t *>(((linesEnd - GHIDRA_INT(linesBegin)) / 0xc));
pbVar4 = linesBegin;
if (lineCount != GHIDRA_CAST<uint8_t *>(0x0)) {
do {
get_string_width_n(this,*GHIDRA_CAST<uint8_t **>((pbVar4 + 4)),GHIDRA_UINT(*GHIDRA_CAST<uint16_t *>((pbVar4 + 8))));
lineWidth = __ftoui3();
widthBudget = local_14;
if (maxWidth < lineWidth) {
*GHIDRA_CAST<short *>((pbVar4 + 8)) = *GHIDRA_CAST<short *>((pbVar4 + 8)) + -1;
*pbVar4 = *pbVar4 | 1;
if (*GHIDRA_CAST<short *>((pbVar4 + 8)) != 0) {
widthBudget = *GHIDRA_CAST<uint16_t *>((pbVar4 + 8));
do {
get_string_width_n(this,*GHIDRA_CAST<uint8_t **>((pbVar4 + 4)),GHIDRA_UINT(widthBudget));
lineWidth = __ftoui3();
if (lineWidth <= widthBudget) break;
pbVar1 = pbVar4 + 8;
*GHIDRA_CAST<short *>(pbVar1) = *GHIDRA_CAST<short *>(pbVar1) + -1;
widthBudget = *GHIDRA_CAST<uint16_t *>((pbVar4 + 8));
} while (*GHIDRA_CAST<short *>(pbVar1) != 0);
}
}
text = text + 1;
pbVar4 = pbVar4 + 0xc;
} while (text < lineCount);
}
}
*GHIDRA_CAST<uint8_t *>(outLayout) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(outLayout) + 4)) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(outLayout) + 8)) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(outLayout) + 0xc)) = 0;
local_8 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),3);
(GHIDRA_CAST<FormattedText *>((outLayout)))->FormattedText::operator_assign(layout);
msvc::vector<12byte>::clear(uVar3);
if (linesBegin != GHIDRA_CAST<uint8_t *>(0x0)) {
uVar3 = ((linesCapacity - GHIDRA_INT(linesBegin)) / 0xc) * 0xc;
pbVar4 = linesBegin;
if (0xfff < uVar3) {
pbVar4 = *GHIDRA_CAST<uint8_t **>((linesBegin + -4));
uVar3 = uVar3 + 0x23;
if (GHIDRA_CAST<uint8_t *>(0x1f) < linesBegin + (-4 - GHIDRA_INT(pbVar4))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pbVar4,uVar3);
}
ExceptionList = local_10;
return outLayout;
}
// 00a1c480
void * Font::layout_glyphs(void *outRun, uint8_t *text, void *settings, Vector *boxSize)
{
uint8_t *pbVar1;
uint8_t **ppbVar2;
float fVar3;
int iVar4;
Font *pFVar5;
uint16_t uVar6;
uint32_t uVar7;
Font *pFVar8;
void *_Dst;
int iVar9;
uint32_t uVar10;
uint8_t *pbVar11;
uint8_t *local_2c;
int local_28;
int local_24;
Font *local_20;
uint8_t *local_1c;
code *local_18;
Font *local_14;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
puStack_c = &LAB_00b11363;
local_10 = ExceptionList;
uVar7 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
ExceptionList = &local_10;
local_14 = this;
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(settings) + 8)) == 1) {
uVar6 = *GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(settings) + 6));
fVar3 = boxSize->x;
*GHIDRA_CAST<uint8_t *>(outRun) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(outRun) + 4)) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(outRun) + 8)) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(outRun) + 0xc)) = 0;
local_8 = 0;
msvc::vector<12byte>::clear(uVar7);
local_20 = local_14;
local_14 = GHIDRA_CAST<Font *>(&local_20);
local_18 = FUN_00a56bf0;
local_8 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),1);
local_1c = GHIDRA_CAST<uint8_t *>(fVar3);
FormattedText::split_lines_converted
(GHIDRA_CAST<short *>(text),GHIDRA_UINT(uVar6),GHIDRA_CAST<uint32_t *>((GHIDRA_INT(outRun) + 4)),FUN_00a56bf0,local_14);
*GHIDRA_CAST<uint8_t *>(outRun) = *GHIDRA_CAST<uint8_t *>(outRun) | 1;
ExceptionList = local_10;
return outRun;
}
local_2c = GHIDRA_CAST<uint8_t *>(0x0);
local_28 = 0;
local_24 = 0;
local_8 = 2;
msvc::vector<12byte>::clear(uVar7);
FormattedText::split_lines_utf16(GHIDRA_CAST<short *>(text),&local_2c);
local_8 = 3;
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(settings) + 8)) == 2) {
uVar10 = GHIDRA_UINT(*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(settings) + 6)));
uVar7 = get_string_width_n(this,&DAT_00b1cec0,-1);
if (uVar10 < uVar7) {
uVar7 = uVar10;
}
local_14 = GHIDRA_CAST<Font *>((uVar10 - uVar7));
text = GHIDRA_CAST<uint8_t *>(0x0);
local_1c = GHIDRA_CAST<uint8_t *>(((local_28 - GHIDRA_INT(local_2c)) / 0xc));
pbVar11 = local_2c;
if (local_1c != GHIDRA_CAST<uint8_t *>(0x0)) {
do {
get_string_width_utf16(this,*GHIDRA_CAST<short **>((pbVar11 + 4)),GHIDRA_UINT(*GHIDRA_CAST<uint16_t *>((pbVar11 + 8))));
uVar7 = __ftoui3();
pFVar5 = local_14;
if (uVar10 < uVar7) {
*GHIDRA_CAST<short *>((pbVar11 + 8)) = *GHIDRA_CAST<short *>((pbVar11 + 8)) + -1;
*pbVar11 = *pbVar11 | 1;
if (*GHIDRA_CAST<short *>((pbVar11 + 8)) != 0) {
uVar6 = *GHIDRA_CAST<uint16_t *>((pbVar11 + 8));
do {
get_string_width_utf16(this,*GHIDRA_CAST<short **>((pbVar11 + 4)),GHIDRA_UINT(uVar6));
pFVar8 = GHIDRA_CAST<Font *>(__ftoui3());
if (pFVar8 <= pFVar5) break;
pbVar1 = pbVar11 + 8;
*GHIDRA_CAST<short *>(pbVar1) = *GHIDRA_CAST<short *>(pbVar1) + -1;
uVar6 = *GHIDRA_CAST<uint16_t *>((pbVar11 + 8));
} while (*GHIDRA_CAST<short *>(pbVar1) != 0);
}
}
text = text + 1;
pbVar11 = pbVar11 + 0xc;
} while (text < local_1c);
}
}
ppbVar2 = GHIDRA_CAST<uint8_t **>((GHIDRA_INT(outRun) + 4));
*GHIDRA_CAST<uint8_t *>(outRun) = 0;
*ppbVar2 = GHIDRA_CAST<uint8_t *>(0x0);
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(outRun) + 8)) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(outRun) + 0xc)) = 0;
local_8 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),4);
*GHIDRA_CAST<uint8_t *>(outRun) = 1;
if (ppbVar2 != &local_2c) {
msvc::vector<12byte>::assign(local_2c,local_28,outRun);
}
if (((*GHIDRA_CAST<uint8_t *>(outRun) & 1) == 0) &&
(iVar9 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(outRun) + 8)) - GHIDRA_INT(*ppbVar2), text = GHIDRA_CAST<uint8_t *>(0x0), iVar4 = iVar9 >> 0x1f,
iVar9 / 0xc + iVar4 != iVar4)) {
boxSize = GHIDRA_CAST<Vector *>(0x0);
do {
pbVar11 = *ppbVar2;
_Dst = operator_new_tracked(GHIDRA_UINT(*GHIDRA_CAST<uint16_t *>((GHIDRA_INT(&boxSize[1].x) + GHIDRA_INT(pbVar11)))) * 2);
memcpy(_Dst,*(void **)(GHIDRA_INT(&boxSize->y) + GHIDRA_INT(pbVar11)),
GHIDRA_UINT(*GHIDRA_CAST<uint16_t *>((GHIDRA_INT(&boxSize[1].x) + GHIDRA_INT(pbVar11)))) * 2);
*(void **)(GHIDRA_INT(&boxSize->y) + GHIDRA_INT(pbVar11)) = _Dst;
text = text + 1;
boxSize = GHIDRA_CAST<Vector *>(&boxSize[1].y);
} while (text < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(outRun) + 8)) - GHIDRA_INT(*ppbVar2)) / 0xc)));
}
msvc::vector<12byte>::clear();
if (local_2c != GHIDRA_CAST<uint8_t *>(0x0)) {
uVar7 = ((local_24 - GHIDRA_INT(local_2c)) / 0xc) * 0xc;
pbVar11 = local_2c;
if (0xfff < uVar7) {
pbVar11 = *GHIDRA_CAST<uint8_t **>((local_2c + -4));
uVar7 = uVar7 + 0x23;
if (GHIDRA_CAST<uint8_t *>(0x1f) < local_2c + (-4 - GHIDRA_INT(pbVar11))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pbVar11,uVar7);
}
ExceptionList = local_10;
return outRun;
}