- anm2.h/.cpp take over ANM2, AnimationState, LayerState, AnmCache and the frame data. They read Anm2Ed's JSON documents with simdjson and play them as the game does (interpolation baked at load). src/anm2/ and msvc.h are retired. - font, formatted_text, string_table and rich_text take over the text classes. FormattedText::parse is still bit-exact against its assembly. - options_config and challenge_params take over OptionsConfig, ChallengeParams and the .ini helpers. The tests include Save's exact bytes. - platform.h/.cpp and main.cpp run IsaacMain on SDL3: the window and GL context open, and the run stops at the first built-in shader (FUN_00a13fa0). - source_tree.py: a taken-over parent stays bytes, taken-over methods are not re-emitted as a namespace, and every address in a (a, b, c to d) list on a comment counts as taken over. - log.h: reconstruction_missing() for a taken-over class's methods that are not written yet. 206 functions taken over, boot path 89/615. The full build waits for wave B: item_config, entity_config and mod_manager still use the old APIs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
899 lines
35 KiB
C++
899 lines
35 KiB
C++
#include "classes.h"
|
|
|
|
// 00840670
|
|
HUD_Message::~HUD_Message()
|
|
{
|
|
HUD_Message *sprite = this;
|
|
uint8_t *puVar1;
|
|
char isRenderTargetValid;
|
|
uint32_t extraout_ECX;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
uint8_t *sprite;
|
|
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00b02a60;
|
|
local_10 = ExceptionList;
|
|
ExceptionList = &local_10;
|
|
free_text_buffers(sprite);
|
|
sprite = &(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(sprite[10])) + 0x2)));
|
|
ANM2::Reset(GHIDRA_CAST<ANM2 *>(sprite));
|
|
KAGE::SmartPointer<RenderTargetBase>::reset(extraout_ECX);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(sprite[2])) + 0x2))) = 0;
|
|
Font::Unload(GHIDRA_CAST<Font *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(sprite[0x8d])) + 0x1)))));
|
|
puVar1 = &(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(sprite[0xa2])) + 0x2)));
|
|
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<msvc::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
|
|
(puVar1,(fuzzer_allocator<msvc::_Tree_node<unsigned_int,void*>_> *)puVar1,
|
|
*(_Tree_node<unsigned_int,void*> **)(*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(sprite[0xa2])) + 0x2)))) + 4));
|
|
operator_delete(*(void **)puVar1,0x18);
|
|
FUN_004b3950();
|
|
Font::Unload(GHIDRA_CAST<Font *>((sprite + 0x74)));
|
|
puVar1 = &(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(sprite[0x89])) + 0x1)));
|
|
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<msvc::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
|
|
(puVar1,(fuzzer_allocator<msvc::_Tree_node<unsigned_int,void*>_> *)puVar1,
|
|
*(_Tree_node<unsigned_int,void*> **)(*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(sprite[0x89])) + 0x1)))) + 4));
|
|
operator_delete(*(void **)puVar1,0x18);
|
|
FUN_004b3950();
|
|
local_8 = 0;
|
|
ANM2::Reset(GHIDRA_CAST<ANM2 *>(sprite));
|
|
AnimationState::~AnimationState(GHIDRA_CAST<AnimationState *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(sprite[0x25])) + 0x1)))));
|
|
AnimationState::~AnimationState(GHIDRA_CAST<AnimationState *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(sprite[0x1a])) + 0x2)))));
|
|
(GHIDRA_CAST<msvc::string *>((&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(sprite[0x12])) + 0x2))))))->msvc::string::_Tidy_deallocate();
|
|
(GHIDRA_CAST<msvc::string *>((sprite)))->msvc::string::_Tidy_deallocate();
|
|
local_8 = 1;
|
|
if (*GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(sprite[9])) + 0x1)))) != GHIDRA_CAST<int *>(0x0)) {
|
|
isRenderTargetValid = (**(code **)(**GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(sprite[9])) + 0x1)))) + 0xc))();
|
|
if ((isRenderTargetValid != '\0') && (g_renderTargetReleaseFn != (void *)0x0)) {
|
|
(*g_renderTargetReleaseFn)(sprite + 8);
|
|
}
|
|
}
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 008407a0
|
|
void HUD_Message::load_graphics()
|
|
{
|
|
char isLastRef;
|
|
void *renderTarget;
|
|
uint8_t *extraout_EAX;
|
|
uint8_t *extraout_EAX_00;
|
|
uint8_t *fontPath;
|
|
HUD_Message *in_ECX;
|
|
KColor *clearColor;
|
|
char *freeBlock;
|
|
uint32_t freeSize;
|
|
uint8_t tmpRenderTarget [4];
|
|
int *renderTargetRefCount;
|
|
char *krFontPath [4];
|
|
uint32_t krFontPathSize;
|
|
uint32_t krFontPathCapacity;
|
|
char *local_54 [4];
|
|
uint32_t local_44;
|
|
uint32_t local_40;
|
|
uint8_t local_3c [16];
|
|
uint32_t local_2c;
|
|
uint32_t local_28;
|
|
uint32_t securityCookie;
|
|
uint8_t *puStack_20;
|
|
void *local_1c;
|
|
uint8_t *puStack_18;
|
|
uint32_t local_14;
|
|
Manager *manager;
|
|
|
|
puStack_20 = local_3c + 0x38;
|
|
local_14 = 0xffffffff;
|
|
puStack_18 = &LAB_00b02ab5;
|
|
local_1c = ExceptionList;
|
|
securityCookie = __security_cookie ^ GHIDRA_UINT((local_3c + 0x2c));
|
|
ExceptionList = &local_1c;
|
|
local_2c = 0;
|
|
local_28 = 0xf;
|
|
local_3c[0] = '\0';
|
|
local_3c[1] = '\0';
|
|
local_3c[2] = '\0';
|
|
local_3c[3] = '\0';
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_3c)) + 0x0))) = msvc::_Allocate(0x20);
|
|
local_2c = 0x15;
|
|
local_28 = 0x1f;
|
|
builtin_strncpy((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(local_3c))) + 0x0))),"gfx/ui/ui_streak.anm2",0x16);
|
|
local_14 = 0;
|
|
ANM2::Load(GHIDRA_CAST<ANM2 *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(in_ECX[10])) + 0x2)))),GHIDRA_CAST<std_string *>(local_3c),1);
|
|
local_14 = 0xffffffff;
|
|
if (0xf < local_28) {
|
|
freeSize = local_28 + 1;
|
|
freeBlock = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(local_3c))) + 0x0)));
|
|
if (0xfff < freeSize) {
|
|
freeBlock = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_3c)) + 0x0))) + -4));
|
|
freeSize = local_28 + 0x24;
|
|
if (GHIDRA_CAST<char *>(0x1f) < GHIDRA_CAST<char *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_3c)) + 0x0))) + (-4 - GHIDRA_INT(freeBlock))))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(freeBlock,freeSize);
|
|
}
|
|
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>((local_3c + 4)))))->KColor::SetFromARGB(0);
|
|
renderTarget = KAGE_Graphics::create_render_target
|
|
(tmpRenderTarget,400,0x80,GHIDRA_CAST<uint8_t *>("HUD_Message Text Surface"),clearColor);
|
|
local_14 = 1;
|
|
(GHIDRA_CAST<shared_ptr *>((in_ECX + 8)))->shared_ptr::operator_assign(renderTarget);
|
|
local_14 = 2;
|
|
if (renderTargetRefCount != GHIDRA_CAST<int *>(0x0)) {
|
|
isLastRef = (**(code **)(*renderTargetRefCount + 0xc))();
|
|
if ((isLastRef != '\0') && (g_renderTargetReleaseFn != (void *)0x0)) {
|
|
(*g_renderTargetReleaseFn)(tmpRenderTarget);
|
|
}
|
|
}
|
|
manager = g_manager;
|
|
local_14 = 0xffffffff;
|
|
local_54[0] = msvc::_Allocate(0x20);
|
|
local_44 = 0x12;
|
|
local_40 = 0x1f;
|
|
builtin_strncpy(local_54[0],"font/MPlus_12b.fnt",0x13);
|
|
local_14 = 3;
|
|
ModManager::TryRedirectPath
|
|
(GHIDRA_CAST<ModManager *>(&manager->_modManager),GHIDRA_CAST<std_string *>(local_3c),GHIDRA_CAST<std_string *>(local_54));
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 4;
|
|
fontPath = extraout_EAX;
|
|
if (0xf < *GHIDRA_CAST<uint32_t *>((extraout_EAX + 0x14))) {
|
|
fontPath = *GHIDRA_CAST<uint8_t **>(extraout_EAX);
|
|
}
|
|
Font::Load(GHIDRA_CAST<Font *>((in_ECX + 0x74)),fontPath,0);
|
|
local_14 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),3);
|
|
if (0xf < local_28) {
|
|
freeSize = local_28 + 1;
|
|
freeBlock = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(local_3c))) + 0x0)));
|
|
if (0xfff < freeSize) {
|
|
freeBlock = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_3c)) + 0x0))) + -4));
|
|
freeSize = local_28 + 0x24;
|
|
if (GHIDRA_CAST<char *>(0x1f) < GHIDRA_CAST<char *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_3c)) + 0x0))) + (-4 - GHIDRA_INT(freeBlock))))) goto LAB_008409ce;
|
|
}
|
|
operator_delete(freeBlock,freeSize);
|
|
}
|
|
local_14 = 0xffffffff;
|
|
local_2c = 0;
|
|
local_28 = 0xf;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_3c)) + 0x0))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_3c)) + 0x0))) & 0xffffff00;
|
|
if (0xf < local_40) {
|
|
freeSize = local_40 + 1;
|
|
freeBlock = local_54[0];
|
|
if (0xfff < freeSize) {
|
|
freeBlock = *GHIDRA_CAST<char **>((local_54[0] + -4));
|
|
freeSize = local_40 + 0x24;
|
|
if (GHIDRA_CAST<char *>(0x1f) < local_54[0] + (-4 - GHIDRA_INT(freeBlock))) {
|
|
LAB_008409ce:
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(freeBlock,freeSize);
|
|
}
|
|
manager = g_manager;
|
|
krFontPath[0] = msvc::_Allocate(0x20);
|
|
krFontPathSize = 0x12;
|
|
krFontPathCapacity = 0x1f;
|
|
builtin_strncpy(krFontPath[0],"font/KR_Font14.fnt",0x13);
|
|
local_14 = 5;
|
|
ModManager::TryRedirectPath
|
|
(GHIDRA_CAST<ModManager *>(&manager->_modManager),GHIDRA_CAST<std_string *>(local_54),GHIDRA_CAST<std_string *>(krFontPath));
|
|
local_14 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),6);
|
|
fontPath = extraout_EAX_00;
|
|
if (0xf < *GHIDRA_CAST<uint32_t *>((extraout_EAX_00 + 0x14))) {
|
|
fontPath = *GHIDRA_CAST<uint8_t **>(extraout_EAX_00);
|
|
}
|
|
Font::Load(GHIDRA_CAST<Font *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(in_ECX[0x8d])) + 0x1)))),fontPath,0);
|
|
if (0xf < local_40) {
|
|
freeSize = local_40 + 1;
|
|
freeBlock = local_54[0];
|
|
if (0xfff < freeSize) {
|
|
freeBlock = *GHIDRA_CAST<char **>((local_54[0] + -4));
|
|
freeSize = local_40 + 0x24;
|
|
if (GHIDRA_CAST<char *>(0x1f) < local_54[0] + (-4 - GHIDRA_INT(freeBlock))) goto LAB_00840ab4;
|
|
}
|
|
operator_delete(freeBlock,freeSize);
|
|
}
|
|
local_44 = 0;
|
|
local_40 = 0xf;
|
|
local_54[0] = GHIDRA_CAST<char *>((GHIDRA_UINT(local_54[0]) & 0xffffff00));
|
|
if (0xf < krFontPathCapacity) {
|
|
freeSize = krFontPathCapacity + 1;
|
|
freeBlock = krFontPath[0];
|
|
if (0xfff < freeSize) {
|
|
freeBlock = *GHIDRA_CAST<char **>((krFontPath[0] + -4));
|
|
freeSize = krFontPathCapacity + 0x24;
|
|
if (GHIDRA_CAST<char *>(0x1f) < krFontPath[0] + (-4 - GHIDRA_INT(freeBlock))) {
|
|
LAB_00840ab4:
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(freeBlock,freeSize);
|
|
}
|
|
*GHIDRA_CAST<uint32_t *>((in_ECX + 4)) = 0;
|
|
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(in_ECX[5])) + 0x1)))) = 0;
|
|
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(in_ECX[6])) + 0x2)))) = 0x3f800000;
|
|
free_text_buffers(in_ECX);
|
|
ExceptionList = local_1c;
|
|
return;
|
|
}
|
|
|
|
// 00840b00
|
|
void HUD_Message::Show(uint8_t *title, uint8_t *subtitle, uint8_t autoHide, uint8_t isCurseDisplay)
|
|
{
|
|
uint8_t bVar1;
|
|
short *text;
|
|
char *anim;
|
|
LayerState *curseLayer;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00b02ae0;
|
|
local_10 = ExceptionList;
|
|
ExceptionList = &local_10;
|
|
if (title == GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
KAGE_LogMessage(8,(uint8_t *)
|
|
"(GHIDRA_CAST<HUD_Message *>(()))->HUD_Message::Show() recieved NULL messageText (This will have no effect) \n")
|
|
;
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
text = utf8_to_utf16_alloc(title);
|
|
if (subtitle == GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
title = GHIDRA_CAST<uint8_t *>(0x0);
|
|
}
|
|
else {
|
|
title = GHIDRA_CAST<uint8_t *>(utf8_to_utf16_alloc(subtitle));
|
|
}
|
|
if (text == GHIDRA_CAST<short *>(0x0)) {
|
|
KAGE_LogMessage(8,(uint8_t *)
|
|
"(GHIDRA_CAST<HUD_Message *>(()))->HUD_Message::Show() recieved NULL messageText (This will have no effect) \n")
|
|
;
|
|
}
|
|
else {
|
|
text_out(this);
|
|
set_text_line(this,text,0);
|
|
if (title != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
set_text_line(this,GHIDRA_CAST<short *>(title),1);
|
|
}
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[3])) + 0x1))) = isCurseDisplay;
|
|
anim = &DAT_00b1c208;
|
|
if (autoHide == 0) {
|
|
anim = "TextIn";
|
|
}
|
|
*GHIDRA_CAST<uint8_t *>((this + 3)) = autoHide;
|
|
bVar1 = ANM2::SetAnimation(GHIDRA_CAST<ANM2 *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[10])) + 0x2)))),GHIDRA_CAST<uint8_t *>(anim),1);
|
|
if (bVar1 != 0) {
|
|
AnimationState::Rewind(GHIDRA_CAST<AnimationState *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[0x1a])) + 0x2)))));
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[0x21])) + 0x1))) = 1;
|
|
}
|
|
bVar1 = (*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[3])) + 0x1)));
|
|
curseLayer = ANM2::GetLayer(GHIDRA_CAST<ANM2 *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[10])) + 0x2)))),GHIDRA_CAST<uint8_t *>(0x1));
|
|
curseLayer->_visible = bVar1;
|
|
UpdateTextImage(this);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[2])) + 0x2))) = 1;
|
|
}
|
|
local_8 = 0;
|
|
tracked_alloc(1,text,0);
|
|
local_8 = 1;
|
|
tracked_alloc(1,title,0);
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 00840c60
|
|
void HUD_Message::text_out()
|
|
{
|
|
uint8_t bVar1;
|
|
uint8_t *animNameCursor;
|
|
uint32_t cmpResult;
|
|
char *targetNameCursor;
|
|
bool isLess;
|
|
|
|
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[2])) + 0x2))) != '\0') {
|
|
if ((*GHIDRA_CAST<int *>((this + 0x1c)) != 0) && ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[0x21])) + 0x1))) != '\0')) {
|
|
animNameCursor = *GHIDRA_CAST<uint8_t **>((this + 0x1c));
|
|
if (animNameCursor == GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
animNameCursor = &s_empty;
|
|
}
|
|
else if (0xf < *GHIDRA_CAST<uint32_t *>((animNameCursor + 0x14))) {
|
|
animNameCursor = *GHIDRA_CAST<uint8_t **>(animNameCursor);
|
|
}
|
|
targetNameCursor = "TextOut";
|
|
do {
|
|
bVar1 = *animNameCursor;
|
|
isLess = bVar1 < (uint8_t)*targetNameCursor;
|
|
if (bVar1 != *targetNameCursor) {
|
|
LAB_00840cb0:
|
|
cmpResult = -GHIDRA_UINT(isLess) | 1;
|
|
goto LAB_00840cb5;
|
|
}
|
|
if (bVar1 == 0) break;
|
|
bVar1 = animNameCursor[1];
|
|
isLess = bVar1 < (uint8_t)targetNameCursor[1];
|
|
if (bVar1 != targetNameCursor[1]) goto LAB_00840cb0;
|
|
animNameCursor = animNameCursor + 2;
|
|
targetNameCursor = targetNameCursor + 2;
|
|
} while (bVar1 != 0);
|
|
cmpResult = 0;
|
|
LAB_00840cb5:
|
|
if (cmpResult == 0) {
|
|
return;
|
|
}
|
|
}
|
|
bVar1 = ANM2::SetAnimation(GHIDRA_CAST<ANM2 *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[10])) + 0x2)))),GHIDRA_CAST<uint8_t *>("TextOut"),1);
|
|
if (bVar1 != 0) {
|
|
AnimationState::Rewind(GHIDRA_CAST<AnimationState *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[0x1a])) + 0x2)))));
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[0x21])) + 0x1))) = 1;
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 00840f70
|
|
void HUD_Message::free_text_buffers()
|
|
{
|
|
uint64_t *allocCounter;
|
|
int bufferIdx;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t uStack_8;
|
|
uint64_t allocatedBytes;
|
|
uint32_t blockSize;
|
|
int buffer;
|
|
|
|
uStack_8 = 0xffffffff;
|
|
puStack_c = &LAB_00af12f0;
|
|
local_10 = ExceptionList;
|
|
ExceptionList = &local_10;
|
|
bufferIdx = 0;
|
|
do {
|
|
buffer = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + bufferIdx * 4));
|
|
if (buffer != 0) {
|
|
if (g_mainHeap == (void *)0x0) {
|
|
allocCounter = &g_allocatedBytesNoHeap;
|
|
}
|
|
else {
|
|
allocCounter = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
|
|
}
|
|
blockSize = *GHIDRA_CAST<uint32_t *>((buffer + -4));
|
|
allocatedBytes = *allocCounter;
|
|
*GHIDRA_CAST<uint32_t *>(allocCounter) = GHIDRA_UINT(*allocCounter) - blockSize;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocCounter) + 4)) =
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBytes) < blockSize));
|
|
free((void *)(buffer + -4));
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + bufferIdx * 4)) = 0;
|
|
}
|
|
bufferIdx = bufferIdx + 1;
|
|
} while (bufferIdx < 2);
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 00841000
|
|
void HUD_Message::set_text_line(short *text, int lineIndex)
|
|
{
|
|
uint32_t *puVar1;
|
|
short *textEnd;
|
|
void *textCopy;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
int64_t byteSize;
|
|
short ch;
|
|
uint32_t charCount;
|
|
|
|
puStack_c = &LAB_00b02b00;
|
|
local_10 = ExceptionList;
|
|
ExceptionList = &local_10;
|
|
textCopy = *(void **)(GHIDRA_CAST<char *>(this) + lineIndex * 4);
|
|
puVar1 = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(this) + lineIndex * 4));
|
|
if (textCopy != (void *)0x0) {
|
|
local_8 = 0;
|
|
tracked_alloc(1,textCopy,0);
|
|
*puVar1 = 0;
|
|
}
|
|
local_8 = 0xffffffff;
|
|
textEnd = text;
|
|
do {
|
|
ch = *textEnd;
|
|
textEnd = textEnd + 1;
|
|
} while (ch != 0);
|
|
charCount = (GHIDRA_INT(textEnd) - GHIDRA_INT((text + 1)) >> 1) + 1;
|
|
byteSize = (uint64_t)charCount * 2;
|
|
textCopy = tracked_alloc(0,(void *)0x0,
|
|
(uint64_t)
|
|
(-GHIDRA_UINT((GHIDRA_INT(((uint64_t)byteSize >> 0x20)) != 0)) | GHIDRA_UINT(byteSize)));
|
|
*puVar1 = textCopy;
|
|
memcpy(textCopy,text,charCount * 2);
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 008410c0
|
|
void HUD_Message::UpdateTextImage()
|
|
{
|
|
char cVar1;
|
|
uint32_t *targetStackEntry;
|
|
uint32_t uVar2;
|
|
int unused;
|
|
int unused_00;
|
|
float fVar3;
|
|
float textY;
|
|
uint32_t drawSettings;
|
|
uint32_t local_48;
|
|
uint32_t local_44;
|
|
uint32_t local_40;
|
|
uint32_t local_3c;
|
|
uint32_t local_38;
|
|
uint32_t local_34;
|
|
KColor textColor;
|
|
uint64_t local_1c;
|
|
Font *subtitleFont;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
short *text;
|
|
Font *titleFont;
|
|
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00b02b35;
|
|
local_10 = ExceptionList;
|
|
ExceptionList = &local_10;
|
|
titleFont = &g_manager->_font7_Upheaval;
|
|
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[3])) + 0x1))) == '\0') {
|
|
subtitleFont = &g_manager->_font9_PFTempestaSevenCondensedAgain;
|
|
}
|
|
else {
|
|
subtitleFont = &g_manager->_font1_TeamMeatEx10;
|
|
}
|
|
local_1c = 0;
|
|
msvc::vector::resize(&local_1c);
|
|
targetStackEntry = msvc::deque::back();
|
|
if (GHIDRA_CAST<uint8_t *>((targetStackEntry + 1)) != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
*GHIDRA_CAST<uint8_t *>((targetStackEntry + 1)) = (uint8_t)(g_graphicsManager_flags >> 5) & 1;
|
|
}
|
|
*targetStackEntry = g_graphicsManager_renderTarget;
|
|
(GHIDRA_CAST<KAGE_Graphics *>((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget(*(void **)(this + 8),0);
|
|
(GHIDRA_CAST<RenderTarget *>((&DAT_00c798e0)))->RenderTarget::Clear();
|
|
g_graphicsManager_blendMode[0] = 0;
|
|
g_graphicsManager_blendMode[1] = 1;
|
|
g_graphicsManager_blendMode[2] = 7;
|
|
g_graphicsManager_blendMode[3] = 1;
|
|
g_graphicsManager_blendMode[4] = 7;
|
|
text = *GHIDRA_CAST<short **>(this);
|
|
fVar3 = (float)(*GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>((this + 8)) + 0x10)) >> 1) + 0.0;
|
|
local_1c = CONCAT44(fVar3,(uint32_t)local_1c);
|
|
if (text != GHIDRA_CAST<short *>(0x0)) {
|
|
if (*text == 1) {
|
|
(GHIDRA_CAST<KColor *>((&textColor)))->KColor::SetFromARGB(0xffffffff);
|
|
if ((*GHIDRA_CAST<char *>((this + 0x74)) == '\0') && ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[0x8d])) + 0x1))) == '\0')) {
|
|
textY = 0.0;
|
|
}
|
|
else {
|
|
textY = 2.0;
|
|
}
|
|
render_text_image(titleFont,text + 1,fVar3,textY,&textColor,unused);
|
|
}
|
|
else {
|
|
uVar2 = Font::get_string_width_utf16(titleFont,text,-1);
|
|
drawSettings = 0;
|
|
local_48 = 0xffff;
|
|
local_44 = 0;
|
|
local_40 = 0x3f800000;
|
|
local_3c = 0xffffffff;
|
|
local_38 = 0;
|
|
local_34 = 0;
|
|
fVar3 = fVar3 - ((float)(uVar2 >> 1) + 0.0);
|
|
local_8 = 0;
|
|
(GHIDRA_CAST<KColor *>((&textColor)))->KColor::SetFromARGB(0xffffffff);
|
|
if ((*GHIDRA_CAST<char *>((this + 0x74)) == '\0') && ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[0x8d])) + 0x1))) == '\0')) {
|
|
textY = 0.0;
|
|
}
|
|
else {
|
|
textY = 2.0;
|
|
}
|
|
Font::draw_string_wide_unscaled
|
|
(titleFont,*GHIDRA_CAST<short **>(this),fVar3,textY,&textColor,&drawSettings);
|
|
local_8 = 0xffffffff;
|
|
}
|
|
fVar3 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_1c)) + 0x4)));
|
|
}
|
|
text = *GHIDRA_CAST<short **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1))));
|
|
if (text != GHIDRA_CAST<short *>(0x0)) {
|
|
cVar1 = (*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[3])) + 0x1)));
|
|
uVar2 = 0xffffffff;
|
|
if (cVar1 != '\0') {
|
|
uVar2 = 0xff000000;
|
|
}
|
|
(GHIDRA_CAST<KColor *>((&textColor)))->KColor::SetFromARGB(uVar2);
|
|
textY = 18.0;
|
|
if (cVar1 != '\0') {
|
|
textY = 26.0;
|
|
}
|
|
if (*text == 1) {
|
|
render_text_image(subtitleFont,text + 1,fVar3,textY,&textColor,unused_00);
|
|
}
|
|
else {
|
|
uVar2 = Font::get_string_width_utf16(subtitleFont,text,-1);
|
|
drawSettings = 0;
|
|
local_48 = 0xffff;
|
|
local_44 = 0;
|
|
local_40 = 0x3f800000;
|
|
local_3c = 0xffffffff;
|
|
local_38 = 0;
|
|
local_34 = 0;
|
|
local_8 = 1;
|
|
Font::draw_string_wide_unscaled
|
|
(subtitleFont,*GHIDRA_CAST<short **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1)))),fVar3 - ((float)(uVar2 >> 1) + 0.0),
|
|
textY,&textColor,&drawSettings);
|
|
local_8 = 0xffffffff;
|
|
}
|
|
}
|
|
_glfw_context_reset(1);
|
|
pop_render_target();
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 008413a0
|
|
void HUD_Message::render_text_image(Font *font, short *text, float x, float y, KColor *color, int unused)
|
|
{
|
|
char isFontLoaded;
|
|
int iVar1;
|
|
void *pvVar2;
|
|
uint32_t uVar3;
|
|
LayerState *pLVar4;
|
|
uint8_t *shader;
|
|
uint16_t ch;
|
|
int unused_00;
|
|
int unused_01;
|
|
uint32_t hashMix;
|
|
double advance;
|
|
int *image;
|
|
int *imageRefCount;
|
|
uint8_t auStack_182 [2];
|
|
uint8_t quad [44];
|
|
float local_14c;
|
|
float local_138;
|
|
float local_124;
|
|
float local_110;
|
|
void *charNode;
|
|
uint8_t glyphLayout [16];
|
|
float uvX0;
|
|
float uvY0;
|
|
float uvX1;
|
|
float uvY1;
|
|
float uvX2;
|
|
float uvY2;
|
|
float uvX3;
|
|
float uvY3;
|
|
uint8_t local_cc;
|
|
Vector quadSize;
|
|
uint8_t statsTexture [4];
|
|
int *statsTextureRef;
|
|
uint8_t cardsPillsTexture [4];
|
|
int *cardsPillsTextureRef;
|
|
uint8_t pickupTexture [4];
|
|
int *pickupTextureRef;
|
|
uint8_t chargeBarTexture [4];
|
|
int *chargeBarTextureRef;
|
|
uint8_t heartsTexture [4];
|
|
int *heartsTextureRef;
|
|
Vector local_94;
|
|
uint8_t defaultTexture [4];
|
|
int *defaultTextureRef;
|
|
uint8_t roomTargetB [4];
|
|
int *roomTargetBRef;
|
|
uint8_t roomTargetA [4];
|
|
int *roomTargetARef;
|
|
uint16_t *charPtr;
|
|
int *charBuf;
|
|
int *local_6c;
|
|
int *local_64;
|
|
int *textureRef;
|
|
int *local_5c;
|
|
uint16_t *local_58;
|
|
int *local_54;
|
|
uint8_t colorScratch [28];
|
|
float fStack_34;
|
|
float fStack_30;
|
|
float fStack_2c;
|
|
float local_28;
|
|
uint32_t stackCookie;
|
|
uint8_t *puStack_20;
|
|
void *savedExceptionList;
|
|
uint8_t *puStack_18;
|
|
uint32_t ehState;
|
|
|
|
puStack_20 = colorScratch + 0x4c;
|
|
ehState = 0xffffffff;
|
|
puStack_18 = &LAB_00b02bcf;
|
|
savedExceptionList = ExceptionList;
|
|
stackCookie = __security_cookie ^ GHIDRA_UINT((colorScratch + 0x40));
|
|
ExceptionList = &savedExceptionList;
|
|
charPtr = GHIDRA_CAST<uint16_t *>(text);
|
|
local_54 = GHIDRA_CAST<int *>(0x0);
|
|
charBuf = GHIDRA_CAST<int *>(GHIDRA_UINT((uint16_t)*text));
|
|
if (*text != 0) {
|
|
isFontLoaded = *GHIDRA_CAST<char *>(font);
|
|
local_58 = GHIDRA_CAST<uint16_t *>(text);
|
|
local_5c = charBuf;
|
|
do {
|
|
if (isFontLoaded == '\0') {
|
|
LAB_00841470:
|
|
iVar1 = 8;
|
|
}
|
|
else {
|
|
local_6c = charBuf;
|
|
_Find_lower_bound<>();
|
|
if ((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(local_94.y) + 0xd)) != '\0') ||
|
|
(pvVar2 = (void *)local_94.y,
|
|
(GHIDRA_UINT(charBuf) & 0xffff) < *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(local_94.y) + 0x10)))) {
|
|
pvVar2 = (font->_charsBlock)._head;
|
|
}
|
|
if (pvVar2 == (font->_charsBlock)._head) {
|
|
iVar1 = font->_missingCharacter;
|
|
}
|
|
else {
|
|
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x14));
|
|
}
|
|
if ((iVar1 == -1) ||
|
|
(iVar1 = GHIDRA_INT(*GHIDRA_CAST<short *>((GHIDRA_CAST<char *>(font->_chars) + iVar1 * 0x14 + 0x10))), iVar1 == 0))
|
|
goto LAB_00841470;
|
|
}
|
|
local_58 = local_58 + 1;
|
|
local_54 = GHIDRA_CAST<int *>((GHIDRA_INT(local_54) + iVar1));
|
|
charBuf = GHIDRA_CAST<int *>(GHIDRA_UINT(*local_58));
|
|
isFontLoaded = *GHIDRA_CAST<char *>(font);
|
|
} while (*local_58 != 0);
|
|
local_6c = GHIDRA_CAST<int *>((GHIDRA_UINT(local_5c) & 0xffff));
|
|
local_58 = GHIDRA_CAST<uint16_t *>((x - ((float)(GHIDRA_UINT(local_54) >> 1) + 0.0)));
|
|
charBuf = GHIDRA_CAST<int *>(0x0);
|
|
do {
|
|
if (*GHIDRA_CAST<char *>(font) == '\0') {
|
|
LAB_008415fb:
|
|
ch = *charPtr;
|
|
LAB_00841601:
|
|
local_6c = GHIDRA_CAST<int *>(0x8);
|
|
local_64 = GHIDRA_CAST<int *>(0x0);
|
|
textureRef = GHIDRA_CAST<int *>(0x0);
|
|
uVar3 = ch + 1;
|
|
ehState = 0;
|
|
hashMix = uVar3 >> 5 ^ uVar3;
|
|
local_5c = GHIDRA_CAST<int *>(((uVar3 >> 0xc ^ hashMix) & 7));
|
|
local_54 = GHIDRA_CAST<int *>(((hashMix >> 8 ^ hashMix) & 0xffff));
|
|
switch(local_5c) {
|
|
case GHIDRA_CAST<int *>(0x0):
|
|
pLVar4 = ANM2::GetLayer(&(g_game->_hud)._heartsSprite,GHIDRA_CAST<uint8_t *>(0x0));
|
|
pvVar2 = LayerState::GetTexture(pLVar4,heartsTexture);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 1;
|
|
(GHIDRA_CAST<KAGE::SmartPointer *>((&local_64)))->KAGE::SmartPointer::operator_assign(pvVar2);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 2;
|
|
if (heartsTextureRef != GHIDRA_CAST<int *>(0x0)) {
|
|
isFontLoaded = (**(code **)(*heartsTextureRef + 0xc))();
|
|
pvVar2 = g_imageReleaseFn;
|
|
joined_r0x00841934:
|
|
if ((isFontLoaded != '\0') && (pvVar2 != (code *)0x0)) {
|
|
(*pvVar2)();
|
|
}
|
|
}
|
|
break;
|
|
case GHIDRA_CAST<int *>(0x1):
|
|
pLVar4 = ANM2::GetLayer(&(g_game->_hud)._chargeBarSprite,GHIDRA_CAST<uint8_t *>(0x0));
|
|
pvVar2 = LayerState::GetTexture(pLVar4,chargeBarTexture);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 3;
|
|
(GHIDRA_CAST<KAGE::SmartPointer *>((&local_64)))->KAGE::SmartPointer::operator_assign(pvVar2);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 4;
|
|
if (chargeBarTextureRef != GHIDRA_CAST<int *>(0x0)) {
|
|
isFontLoaded = (**(code **)(*chargeBarTextureRef + 0xc))();
|
|
pvVar2 = g_imageReleaseFn;
|
|
goto joined_r0x00841934;
|
|
}
|
|
break;
|
|
case GHIDRA_CAST<int *>(0x2):
|
|
pLVar4 = ANM2::GetLayer(&(g_game->_hud)._pickupHUDSprite,GHIDRA_CAST<uint8_t *>(0x0));
|
|
pvVar2 = LayerState::GetTexture(pLVar4,pickupTexture);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 5;
|
|
(GHIDRA_CAST<KAGE::SmartPointer *>((&local_64)))->KAGE::SmartPointer::operator_assign(pvVar2);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 6;
|
|
if (pickupTextureRef != GHIDRA_CAST<int *>(0x0)) {
|
|
isFontLoaded = (**(code **)(*pickupTextureRef + 0xc))();
|
|
pvVar2 = g_imageReleaseFn;
|
|
goto joined_r0x00841934;
|
|
}
|
|
break;
|
|
case GHIDRA_CAST<int *>(0x3):
|
|
pLVar4 = ANM2::GetLayer(&(g_game->_hud)._cardsPillsSprite,GHIDRA_CAST<uint8_t *>(0x0));
|
|
pvVar2 = LayerState::GetTexture(pLVar4,cardsPillsTexture);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 7;
|
|
(GHIDRA_CAST<KAGE::SmartPointer *>((&local_64)))->KAGE::SmartPointer::operator_assign(pvVar2);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 8;
|
|
if (cardsPillsTextureRef != GHIDRA_CAST<int *>(0x0)) {
|
|
isFontLoaded = (**(code **)(*cardsPillsTextureRef + 0xc))();
|
|
pvVar2 = g_imageReleaseFn;
|
|
goto joined_r0x00841934;
|
|
}
|
|
break;
|
|
case GHIDRA_CAST<int *>(0x4):
|
|
(GHIDRA_CAST<shared_ptr *>((roomTargetA)))->shared_ptr::assign((void *)(GHIDRA_INT(g_game->_room) + 0x1bc8));
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 9;
|
|
(GHIDRA_CAST<KAGE::SmartPointer *>((&local_64)))->KAGE::SmartPointer::operator_assign(roomTargetA);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 10;
|
|
if (roomTargetARef != GHIDRA_CAST<int *>(0x0)) {
|
|
isFontLoaded = (**(code **)(*roomTargetARef + 0xc))();
|
|
pvVar2 = g_renderTargetReleaseFn;
|
|
goto joined_r0x00841934;
|
|
}
|
|
break;
|
|
case GHIDRA_CAST<int *>(0x5):
|
|
(GHIDRA_CAST<shared_ptr *>((roomTargetB)))->shared_ptr::assign((void *)(GHIDRA_INT(g_game->_room) + 0x1bd0));
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0xb;
|
|
(GHIDRA_CAST<KAGE::SmartPointer *>((&local_64)))->KAGE::SmartPointer::operator_assign(roomTargetB);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0xc;
|
|
if (roomTargetBRef != GHIDRA_CAST<int *>(0x0)) {
|
|
isFontLoaded = (**(code **)(*roomTargetBRef + 0xc))();
|
|
pvVar2 = g_renderTargetReleaseFn;
|
|
goto joined_r0x00841934;
|
|
}
|
|
break;
|
|
case GHIDRA_CAST<int *>(0x6):
|
|
pLVar4 = ANM2::GetLayer(&(g_game->_hud)._statsSprite,GHIDRA_CAST<uint8_t *>(0x0));
|
|
pvVar2 = LayerState::GetTexture(pLVar4,statsTexture);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0xd;
|
|
(GHIDRA_CAST<KAGE::SmartPointer *>((&local_64)))->KAGE::SmartPointer::operator_assign(pvVar2);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0xe;
|
|
if (statsTextureRef != GHIDRA_CAST<int *>(0x0)) {
|
|
isFontLoaded = (**(code **)(*statsTextureRef + 0xc))();
|
|
pvVar2 = g_imageReleaseFn;
|
|
goto joined_r0x00841934;
|
|
}
|
|
break;
|
|
case GHIDRA_CAST<int *>(0x7):
|
|
(GHIDRA_CAST<KAGE::SmartPointer *>((defaultTexture)))->KAGE::SmartPointer::operator_assign(&DAT_00c798a8);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0xf;
|
|
(GHIDRA_CAST<KAGE::SmartPointer *>((&local_64)))->KAGE::SmartPointer::operator_assign(defaultTexture);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x0))) = 0x10;
|
|
if (defaultTextureRef != GHIDRA_CAST<int *>(0x0)) {
|
|
isFontLoaded = (**(code **)(*defaultTextureRef + 0xc))();
|
|
pvVar2 = g_imageReleaseFn;
|
|
goto joined_r0x00841934;
|
|
}
|
|
}
|
|
ehState = (*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(ehState))) + 0x1))) << 8;
|
|
if (local_64 != GHIDRA_CAST<int *>(0x0)) {
|
|
uVar3 = GHIDRA_UINT(local_64[4]) >> 3;
|
|
local_cc = 1;
|
|
local_28 = 0.0;
|
|
quadSize.x = 8.0;
|
|
quadSize.y = 16.0;
|
|
iVar1 = GHIDRA_INT(local_54) % GHIDRA_INT(((GHIDRA_UINT(local_64[5]) >> 4) * uVar3));
|
|
local_94.x = (float)local_58;
|
|
uvY0 = (float)(iVar1 / GHIDRA_INT(uVar3)) * 16.0;
|
|
uvY2 = uvY0 + 16.0;
|
|
uvX0 = (float)(iVar1 % GHIDRA_INT(uVar3)) * 8.0;
|
|
uvX1 = uvX0 + 8.0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(colorScratch)) + 0x18))) = 1.0;
|
|
fStack_34 = 1.0;
|
|
fStack_30 = 1.0;
|
|
fStack_2c = 1.0;
|
|
local_94.y = y;
|
|
uvY1 = uvY0;
|
|
uvX2 = uvX0;
|
|
uvX3 = uvX1;
|
|
uvY3 = uvY2;
|
|
render_quad_set_rect(quad,&local_94,&quadSize,GHIDRA_CAST<KColor *>((colorScratch + 0x18)));
|
|
if (local_5c == GHIDRA_CAST<int *>(&DAT_00000007)) {
|
|
if ((g_manager->_optionsConfig)._enableColorCorrection == 0) {
|
|
if ((local_14c + local_138 + local_124 + local_110) * 0.25 != 0.0) {
|
|
shader_push(GHIDRA_CAST<uint8_t *>("KAGE_ColorShader"));
|
|
FUN_00a11080();
|
|
pvVar2 = kage_graphics_flush((void *)0x0);
|
|
render_quad_draw(pvVar2,colorScratch + 8,quad,1,unused_01);
|
|
FUN_00a14200();
|
|
}
|
|
goto LAB_00841bda;
|
|
}
|
|
local_5c = GHIDRA_CAST<int *>(0x3f800000);
|
|
shader = &DAT_00c79398;
|
|
if ((DAT_00c7939c & 1) == 0) {
|
|
shader = g_currentShader;
|
|
}
|
|
local_54 = GHIDRA_CAST<int *>(0x3f800000);
|
|
g_currentShader = shader;
|
|
(GHIDRA_CAST<Shader *>((shader)))->Shader::set_uniform(GHIDRA_CAST<uint8_t *>("Exposure"),8,&local_5c,GHIDRA_INT(shader));
|
|
(GHIDRA_CAST<Shader *>((g_currentShader)))->Shader::set_uniform(GHIDRA_CAST<uint8_t *>("Gamma"),8,&local_54,unused_00);
|
|
}
|
|
else {
|
|
shader = &g_shaders;
|
|
if ((DAT_00c7911c & 1) == 0) {
|
|
shader = g_currentShader;
|
|
}
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(colorScratch)) + 0x0))) = 1.0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(colorScratch)) + 0x4))) = 1.0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(colorScratch)) + 0x8))) = 1.0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(colorScratch)) + 0xc))) = 1.0;
|
|
fStack_30 = 0.0;
|
|
fStack_2c = 0.0;
|
|
image = GHIDRA_CAST<int *>(0x0);
|
|
imageRefCount = GHIDRA_CAST<int *>(0x0);
|
|
local_28 = 0.0;
|
|
local_5c = textureRef;
|
|
local_54 = local_64;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(colorScratch)) + 0x10))) = 0.0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(colorScratch)) + 0x14))) = 0.0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(colorScratch)) + 0x18))) = 0.0;
|
|
fStack_34 = 0.0;
|
|
g_currentShader = shader;
|
|
if (textureRef != GHIDRA_CAST<int *>(0x0)) {
|
|
isFontLoaded = (**(code **)(*textureRef + 4))();
|
|
if (isFontLoaded != '\0') {
|
|
if (((imageRefCount != GHIDRA_CAST<int *>(0x0)) &&
|
|
(isFontLoaded = (**(code **)(*imageRefCount + 0xc))(), isFontLoaded != '\0')) &&
|
|
(g_imageReleaseFn != (void *)0x0)) {
|
|
(*g_imageReleaseFn)(auStack_182 + -10);
|
|
}
|
|
image = local_54;
|
|
imageRefCount = local_5c;
|
|
}
|
|
}
|
|
apply_sprite_shader_params(GHIDRA_CAST<ColorMod *>(colorScratch),1,image,imageRefCount);
|
|
}
|
|
(**(code **)(*local_64 + 0x14))(&uvX0);
|
|
}
|
|
LAB_00841bda:
|
|
ehState = 0x11;
|
|
if (((textureRef != GHIDRA_CAST<int *>(0x0)) &&
|
|
(isFontLoaded = (**(code **)(*textureRef + 0xc))(), isFontLoaded != '\0')) &&
|
|
(g_imageReleaseFn != (void *)0x0)) {
|
|
(*g_imageReleaseFn)();
|
|
}
|
|
}
|
|
else {
|
|
local_5c = local_6c;
|
|
_Find_lower_bound<>();
|
|
if ((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(charNode) + 0xd)) != '\0') ||
|
|
(pvVar2 = charNode, (GHIDRA_UINT(local_6c) & 0xffff) < *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(charNode) + 0x10)))) {
|
|
pvVar2 = (font->_charsBlock)._head;
|
|
}
|
|
if (pvVar2 == (font->_charsBlock)._head) {
|
|
iVar1 = font->_missingCharacter;
|
|
}
|
|
else {
|
|
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x14));
|
|
}
|
|
if (iVar1 == -1) goto LAB_008415fb;
|
|
local_6c = GHIDRA_CAST<int *>(GHIDRA_INT(*GHIDRA_CAST<short *>((GHIDRA_CAST<char *>(font->_chars) + iVar1 * 0x14 + 0x10))));
|
|
ch = *charPtr;
|
|
if (local_6c == GHIDRA_CAST<int *>(0x0)) goto LAB_00841601;
|
|
charBuf = GHIDRA_CAST<int *>(GHIDRA_UINT(ch));
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(colorScratch)) + 0x10))) = 0.0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(colorScratch)) + 0x14))) = 9.18341e-41;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(colorScratch)) + 0x18))) = 0.0;
|
|
fStack_34 = 1.0;
|
|
fStack_30 = -NAN;
|
|
fStack_2c = 0.0;
|
|
local_28 = 0.0;
|
|
ehState = 0x12;
|
|
pvVar2 = Font::layout_glyphs(font,glyphLayout,GHIDRA_CAST<uint8_t *>(&charBuf),colorScratch + 0x10,
|
|
&g_vectorOne);
|
|
ehState = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(ehState)) + 0x1))),0x13);
|
|
Font::draw_glyph_run(font,(float)local_58,y,pvVar2,1.0,1.0,*color,colorScratch + 0x10);
|
|
msvc::vector<12byte>::clear();
|
|
msvc::vector<12byte>::_Tidy();
|
|
}
|
|
ehState = 0xffffffff;
|
|
iVar1 = GHIDRA_INT(local_6c) >> 0x1f;
|
|
advance = (double)GHIDRA_INT(local_6c);
|
|
charPtr = charPtr + 1;
|
|
local_6c = GHIDRA_CAST<int *>(GHIDRA_UINT(*charPtr));
|
|
local_58 = GHIDRA_CAST<uint16_t *>(((float)(advance + __uint_to_double_fixup[-iVar1]) + (float)local_58));
|
|
} while (*charPtr != 0);
|
|
}
|
|
ExceptionList = savedExceptionList;
|
|
return;
|
|
}
|