- 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>
585 lines
20 KiB
C++
585 lines
20 KiB
C++
#include "classes.h"
|
|
|
|
// 0091d2b0
|
|
void OnlineChat::render(Vector *position, uint8_t isInputLine, uint8_t isCursorVisible, float alpha)
|
|
{
|
|
int iVar1;
|
|
KColor color;
|
|
KColor color_00;
|
|
uint32_t uVar2;
|
|
Entity_Player *player;
|
|
int iVar3;
|
|
uint8_t *lastLine;
|
|
void *this_00;
|
|
int iVar4;
|
|
uint32_t uVar5;
|
|
uint32_t extraout_ECX;
|
|
int unused;
|
|
Font *drawFont;
|
|
float lineHeight;
|
|
float fVar6;
|
|
float fVar7;
|
|
uint8_t cursorQuad [44];
|
|
float local_f4;
|
|
float local_e0;
|
|
float local_cc;
|
|
float local_b8;
|
|
uint32_t local_b0;
|
|
uint32_t local_ac;
|
|
uint32_t local_a8;
|
|
uint32_t local_a4;
|
|
uint32_t local_a0;
|
|
uint32_t local_9c;
|
|
uint32_t local_98;
|
|
int textColorUnk;
|
|
uint32_t textBlue;
|
|
uint32_t textGreen;
|
|
uint32_t textRed;
|
|
uint32_t local_84;
|
|
uint32_t local_80;
|
|
uint32_t local_7c;
|
|
uint32_t local_78;
|
|
uint32_t local_74;
|
|
uint32_t local_70;
|
|
uint32_t local_6c;
|
|
uint32_t local_68;
|
|
uint32_t local_64;
|
|
uint32_t local_60;
|
|
uint32_t local_5c;
|
|
KColor local_58;
|
|
float offsetY;
|
|
float offsetX;
|
|
Vector local_3c;
|
|
Vector local_34;
|
|
float messageOffsetX;
|
|
Font *font;
|
|
float alphaLocal;
|
|
Vector local_20 [2];
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
float local_8;
|
|
float fontScale;
|
|
|
|
local_8 = -NAN;
|
|
puStack_c = &LAB_00b0a3ae;
|
|
local_10 = ExceptionList;
|
|
ExceptionList = &local_10;
|
|
iVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 8));
|
|
drawFont = *GHIDRA_CAST<Font **>((*GHIDRA_CAST<int *>(this) + 0x5d8));
|
|
font = drawFont;
|
|
alphaLocal = alpha;
|
|
if (iVar4 == 0) {
|
|
LAB_0091d341:
|
|
sprintf(&DAT_00c93010,&s_empty);
|
|
}
|
|
else {
|
|
local_20[0].y = *GHIDRA_CAST<float *>((iVar4 + 8));
|
|
iVar3 = *GHIDRA_CAST<int *>((iVar4 + 0xc));
|
|
if (*GHIDRA_CAST<int *>((iVar4 + 8)) == 0 && iVar3 == 0) goto LAB_0091d341;
|
|
uVar2 = __ftoui3(__security_cookie ^ GHIDRA_UINT(&local_20[3].y));
|
|
user_profile_format_display_name(CONCAT44(iVar3,local_20[0].y),drawFont,uVar2);
|
|
sprintf(&DAT_00c93010,&DAT_00b6d198);
|
|
}
|
|
g_graphicsManager_blendMode[1] = 1;
|
|
g_graphicsManager_blendMode[0] = 0;
|
|
if (((uint8_t)g_graphicsManager_flags & 4) == 0) {
|
|
g_graphicsManager_blendMode[1] = 6;
|
|
}
|
|
g_graphicsManager_blendMode[2] = 7;
|
|
g_graphicsManager_blendMode[3] = 1;
|
|
g_graphicsManager_blendMode[4] = 7;
|
|
iVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 8));
|
|
iVar3 = *GHIDRA_CAST<int *>(this);
|
|
if (iVar4 == 0) {
|
|
local_20[0].y = 0.0;
|
|
local_20[0].x = 0.0;
|
|
}
|
|
else {
|
|
local_20[0].x = *GHIDRA_CAST<float *>((iVar4 + 8));
|
|
local_20[0].y = *GHIDRA_CAST<float *>((iVar4 + 0xc));
|
|
}
|
|
if (((*GHIDRA_CAST<char *>((iVar3 + 0x5f0)) == '\0') ||
|
|
(player = PlayerManager::get_player_by_user_id
|
|
(GHIDRA_CAST<PlayerManager *>(&g_manager->_netplayManager),GHIDRA_CAST<uint64_t *>(local_20)),
|
|
player == GHIDRA_CAST<Entity_Player *>(0x0))) ||
|
|
(player = GHIDRA_CAST<Entity_Player *>(FUN_004253d0()), player == GHIDRA_CAST<Entity_Player *>(0x0))) {
|
|
local_58._red = *GHIDRA_CAST<float *>((iVar3 + 0x5dc));
|
|
local_58._unk = *GHIDRA_CAST<int *>((iVar3 + 0x5ec));
|
|
local_58._green = *GHIDRA_CAST<float *>((iVar3 + 0x5e0));
|
|
local_58._blue = *GHIDRA_CAST<float *>((iVar3 + 0x5e4));
|
|
}
|
|
else {
|
|
(GHIDRA_CAST<Entity_Familiar *>((GHIDRA_CAST<Entity_Familiar *>(&g_game->_playerManager))))->Entity_Familiar::GetPlayerSlot(&local_58,player);
|
|
iVar3 = *GHIDRA_CAST<int *>(this);
|
|
}
|
|
drawFont = font;
|
|
local_58._alpha = alphaLocal * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x28));
|
|
textColorUnk = *GHIDRA_CAST<int *>((iVar3 + 0x5ec));
|
|
textRed = *GHIDRA_CAST<uint32_t *>((iVar3 + 0x5dc));
|
|
textGreen = *GHIDRA_CAST<uint32_t *>((iVar3 + 0x5e0));
|
|
textBlue = *GHIDRA_CAST<uint32_t *>((iVar3 + 0x5e4));
|
|
alphaLocal = local_58._alpha;
|
|
iVar3 = Font::get_string_width_n(font,&DAT_00c93010,-1);
|
|
iVar4 = *GHIDRA_CAST<int *>(this);
|
|
local_3c.x = *GHIDRA_CAST<float *>((iVar4 + 0x5f4));
|
|
offsetX = local_3c.x * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x1c));
|
|
offsetY = local_3c.x * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x20));
|
|
messageOffsetX =
|
|
local_3c.x * *GHIDRA_CAST<float *>((iVar4 + 0x610)) +
|
|
(float)((double)iVar3 + __uint_to_double_fixup[-(iVar3 >> 0x1f)]) * local_3c.x;
|
|
lineHeight = local_3c.x * *GHIDRA_CAST<float *>((iVar4 + 0x608));
|
|
local_3c.y = local_3c.x;
|
|
local_20[0].y = local_3c.x;
|
|
if (isInputLine == 0) {
|
|
uVar5 = 0xffff;
|
|
local_34.y = (float)((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x14)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x10))) / 0xc - 1);
|
|
if (GHIDRA_INT(local_34.y) < 0) {
|
|
fVar6 = position->y;
|
|
}
|
|
else {
|
|
_isInputLine = GHIDRA_INT(local_34.y) * 0xc;
|
|
do {
|
|
fVar6 = local_34.y;
|
|
FormattedText::FormattedText
|
|
(-GHIDRA_UINT((GHIDRA_UINT(local_34.y) <
|
|
GHIDRA_UINT(((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x14)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x10))) / 0xc)))) &
|
|
_isInputLine + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x10)),uVar5);
|
|
local_7c = 0;
|
|
local_78 = 0xffff;
|
|
local_74 = 0;
|
|
local_70 = 0x3f800000;
|
|
local_6c = 0xffffffff;
|
|
local_68 = 0;
|
|
local_64 = 0;
|
|
local_8 = 5.60519e-45;
|
|
color_00._green = (float)textGreen;
|
|
color_00._red = (float)textRed;
|
|
color_00._blue = (float)textBlue;
|
|
color_00._alpha = alphaLocal;
|
|
color_00._unk = textColorUnk;
|
|
Font::render_glyph_quads
|
|
(font,&local_a4,(position->x - offsetX) + messageOffsetX,
|
|
(position->y - offsetY) + 0.0,local_20[0].y,local_20[0].y,color_00,&local_7c);
|
|
local_8 = -NAN;
|
|
msvc::vector<12byte>::clear();
|
|
msvc::vector<12byte>::_Tidy();
|
|
local_34.y = (float)(GHIDRA_INT(fVar6) - 1);
|
|
fVar6 = position->y - lineHeight;
|
|
_isInputLine = _isInputLine + -0xc;
|
|
position->y = fVar6;
|
|
uVar5 = extraout_ECX;
|
|
} while (-1 < GHIDRA_INT(local_34.y));
|
|
drawFont = font;
|
|
}
|
|
local_7c = 0;
|
|
local_78 = 0xffff;
|
|
local_74 = 0;
|
|
local_70 = 0x3f800000;
|
|
local_6c = 0xffffffff;
|
|
local_68 = 0;
|
|
local_64 = 0;
|
|
local_8 = 7.00649e-45;
|
|
local_20[0].y = (fVar6 - offsetY) + lineHeight;
|
|
local_20[0].x = (position->x - offsetX) + 0.0;
|
|
Font::DrawString(drawFont,&DAT_00c93010,local_20,&local_3c,&local_58,&local_7c);
|
|
}
|
|
else {
|
|
local_b0 = 0;
|
|
local_ac = 0xffff;
|
|
local_a8 = 0;
|
|
local_a4 = 0x3f800000;
|
|
local_a0 = 0xffffffff;
|
|
local_9c = 0;
|
|
local_98 = 0;
|
|
local_8 = 0.0;
|
|
local_34.x = position->x - offsetX;
|
|
local_34.y = position->y - offsetY;
|
|
Font::DrawString(drawFont,&DAT_00c93010,&local_34,&local_3c,&local_58,&local_b0);
|
|
local_8 = -NAN;
|
|
local_34.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x10));
|
|
iVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x14)) - GHIDRA_INT(local_34.y);
|
|
_isInputLine = 0;
|
|
if (0 < iVar4 / 0xc) {
|
|
local_3c.y = 0.0;
|
|
do {
|
|
FormattedText::FormattedText
|
|
(-GHIDRA_UINT((_isInputLine <
|
|
GHIDRA_UINT(((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x14)) - GHIDRA_INT(local_34.y)) / 0xc)))) &
|
|
GHIDRA_INT(local_3c.y) + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x10)),iVar4);
|
|
local_60 = 0;
|
|
local_5c = 0xffff;
|
|
local_58._red = 0.0;
|
|
local_58._green = 1.0;
|
|
local_58._blue = -NAN;
|
|
local_58._alpha = 0.0;
|
|
local_58._unk = 0;
|
|
local_8 = 2.8026e-45;
|
|
color._green = (float)textGreen;
|
|
color._red = (float)textRed;
|
|
color._blue = (float)textBlue;
|
|
color._alpha = alphaLocal;
|
|
color._unk = textColorUnk;
|
|
Font::render_glyph_quads
|
|
(drawFont,&local_a4,(position->x - offsetX) + messageOffsetX,
|
|
(position->y - offsetY) + 0.0,local_20[0].y,local_20[0].y,color,&local_60);
|
|
local_8 = -NAN;
|
|
msvc::vector<12byte>::clear();
|
|
msvc::vector<12byte>::_Tidy();
|
|
_isInputLine = _isInputLine + 1;
|
|
local_3c.y = (float)(GHIDRA_INT(local_3c.y) + 0xc);
|
|
position->y = lineHeight + position->y;
|
|
local_34.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x10));
|
|
iVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x14)) - GHIDRA_INT(local_34.y);
|
|
} while (GHIDRA_INT(_isInputLine) < iVar4 / 0xc);
|
|
goto LAB_0091d913;
|
|
}
|
|
}
|
|
local_8 = -NAN;
|
|
LAB_0091d913:
|
|
if (isCursorVisible != 0) {
|
|
iVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x14));
|
|
iVar3 = (iVar4 - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x10))) / 0xc;
|
|
if (iVar3 == 0) {
|
|
fVar6 = 0.0;
|
|
}
|
|
else {
|
|
uVar2 = iVar3 - 1;
|
|
if (uVar2 < GHIDRA_UINT(((iVar4 - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x10))) / 0xc))) {
|
|
lastLine = *GHIDRA_CAST<uint8_t **>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x10)) + 4 + uVar2 * 0xc));
|
|
}
|
|
else {
|
|
lastLine = GHIDRA_CAST<uint8_t *>(0x0);
|
|
}
|
|
iVar3 = Font::get_string_width_n(font,lastLine,-1);
|
|
iVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x14));
|
|
fVar6 = (float)((double)iVar3 + __uint_to_double_fixup[-(iVar3 >> 0x1f)]);
|
|
}
|
|
iVar4 = iVar4 - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x10));
|
|
iVar3 = *GHIDRA_CAST<int *>(this);
|
|
fVar7 = 0.0;
|
|
fontScale = *GHIDRA_CAST<float *>((iVar3 + 0x5f4));
|
|
iVar1 = iVar4 >> 0x1f;
|
|
fVar6 = messageOffsetX + position->x + fVar6 * fontScale;
|
|
if (iVar4 / 0xc + iVar1 == iVar1) {
|
|
fVar6 = fVar6 - 1.0;
|
|
lineHeight = 0.0;
|
|
}
|
|
else {
|
|
fVar6 = fVar6 + 1.0;
|
|
}
|
|
local_58._red = *GHIDRA_CAST<float *>((iVar3 + 0x5dc));
|
|
local_58._green = *GHIDRA_CAST<float *>((iVar3 + 0x5e0));
|
|
local_58._blue = *GHIDRA_CAST<float *>((iVar3 + 0x5e4));
|
|
local_58._alpha = *GHIDRA_CAST<float *>((iVar3 + 0x5e8));
|
|
local_58._unk = *GHIDRA_CAST<int *>((iVar3 + 0x5ec));
|
|
lineHeight = position->y - lineHeight;
|
|
render_quad_set_uniform_color
|
|
(cursorQuad,fVar6,fontScale * 9.0 + lineHeight,fontScale * 6.0 + fVar6,
|
|
fontScale * 11.0 + lineHeight,&local_58);
|
|
if ((local_f4 + local_e0 + local_cc + local_b8) * 0.25 != fVar7) {
|
|
shader_push(GHIDRA_CAST<uint8_t *>("KAGE_ColorShader"));
|
|
local_74 = 0;
|
|
local_84 = 0;
|
|
local_78 = 0;
|
|
local_80 = 0;
|
|
local_6c = 0x3f800000;
|
|
local_7c = 0x3f800000;
|
|
local_68 = 0x3f800000;
|
|
local_70 = 0x3f800000;
|
|
local_64 = local_64 & 0xffffff00;
|
|
this_00 = kage_graphics_flush((void *)0x0);
|
|
render_quad_draw(this_00,&local_84,cursorQuad,1,unused);
|
|
FUN_00a14200();
|
|
}
|
|
}
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 0091db20
|
|
void OnlineChat::destructor()
|
|
{
|
|
int *memberMap;
|
|
uint32_t uVar1;
|
|
int *in_ECX;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t uStack_8;
|
|
|
|
uStack_8 = 0xffffffff;
|
|
puStack_c = &LAB_00af0a50;
|
|
local_10 = ExceptionList;
|
|
uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
|
|
ExceptionList = &local_10;
|
|
(GHIDRA_CAST<LobbyList *>((in_ECX)))->LobbyList::clear();
|
|
memberMap = in_ECX + 0x188;
|
|
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<msvc::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
|
|
(memberMap,(fuzzer_allocator<msvc::_Tree_node<unsigned_int,void*>_> *)memberMap,
|
|
*(_Tree_node<unsigned_int,void*> **)(in_ECX[0x188] + 4));
|
|
operator_delete((void *)*memberMap,0x20);
|
|
msvc::vector<12byte>::clear(uVar1);
|
|
msvc::vector<12byte>::_Tidy();
|
|
in_ECX[10] = GHIDRA_INT(KAGE)::System::UserProfileBase::vftable;
|
|
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>((in_ECX + 3)))))->msvc::string::_Tidy_deallocate();
|
|
msvc::map<u64_LobbyListEntry>::_Erase_tree(in_ECX,*GHIDRA_CAST<uint32_t *>((*in_ECX + 4)));
|
|
operator_delete((void *)*in_ECX,0x48);
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 0091e650
|
|
void OnlineChat::render_all(Vector *pos, uint8_t isFocused)
|
|
{
|
|
Vector *pVVar1;
|
|
undefined3 in_stack_00000009;
|
|
Vector linePos;
|
|
float alpha;
|
|
|
|
pVVar1 = pos;
|
|
if (isFocused == 0) {
|
|
alpha = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x54));
|
|
if (alpha <= 0.0) {
|
|
return;
|
|
}
|
|
}
|
|
else {
|
|
alpha = 1.0;
|
|
}
|
|
if (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 8)) != 0) {
|
|
linePos.x = pos->x + 0.0;
|
|
linePos.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x608)) * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x5f4)) + pos->y;
|
|
render((void *)(GHIDRA_INT(this) + 0x24),&linePos,1,(uint8_t)(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 8)) / 0x19) & 1,alpha);
|
|
}
|
|
linePos.x = pVVar1->x;
|
|
linePos.y = pVVar1->y;
|
|
pos = *GHIDRA_CAST<Vector **>(this);
|
|
if (pos != GHIDRA_CAST<Vector *>(pos->x)) {
|
|
do {
|
|
_isFocused = pos;
|
|
(GHIDRA_CAST<msvc::_Tree_iterator *>((&isFocused)))->msvc::_Tree_iterator::operator_decrement();
|
|
render(_isFocused + 3,&linePos,0,0,alpha);
|
|
(GHIDRA_CAST<msvc::_Tree_iterator *>((&pos)))->msvc::_Tree_iterator::operator_decrement();
|
|
} while (pos != GHIDRA_CAST<Vector *>(**(int **))this);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 0091e7c0
|
|
void OnlineChat::broadcast_message(std_string *text)
|
|
{
|
|
char isLastRef;
|
|
uint32_t uVar1;
|
|
int *steamUtils;
|
|
uint32_t *puVar2;
|
|
void *data;
|
|
void *messageRefCount;
|
|
uint8_t **stream;
|
|
void *local_60;
|
|
uint32_t local_5c;
|
|
void *streamBuffer;
|
|
void *local_54;
|
|
void *streamHeapBuffer;
|
|
uint32_t local_48;
|
|
uint32_t local_44;
|
|
uint32_t local_40;
|
|
uint8_t **streamWriter;
|
|
uint8_t local_38 [4];
|
|
int *messageRefCountPtr;
|
|
uint32_t senderId;
|
|
uint32_t local_2c [2];
|
|
uint32_t textLength;
|
|
uint8_t *puStack_20;
|
|
void *local_1c;
|
|
uint8_t *puStack_18;
|
|
uint32_t local_14;
|
|
Manager *manager;
|
|
|
|
puStack_20 = GHIDRA_CAST<uint8_t *>((local_2c + 10));
|
|
local_14 = 0xffffffff;
|
|
puStack_18 = &LAB_00b0a485;
|
|
local_1c = ExceptionList;
|
|
uVar1 = __security_cookie ^ GHIDRA_UINT((local_2c + 7));
|
|
ExceptionList = &local_1c;
|
|
apply_roll_command(text);
|
|
textLength = text->_size;
|
|
(GHIDRA_CAST<KAGE::Filesys::BufferedStream *>((&stream)))->KAGE::Filesys::BufferedStream::BufferedStream(0);
|
|
local_14 = 0;
|
|
steamUtils = GHIDRA_CAST<int *>(SteamInternal_ContextInit(&PTR_FUN_00c5c4ec,uVar1));
|
|
if (*steamUtils == 0) {
|
|
senderId = 1;
|
|
}
|
|
else {
|
|
puVar2 = GHIDRA_CAST<uint32_t *>(SteamInternal_ContextInit(&PTR_FUN_00c5c4ec,uVar1));
|
|
senderId = (**(code **)(*GHIDRA_CAST<int *>(*puVar2) + 0xc))();
|
|
}
|
|
local_2c[0] = 0;
|
|
(*(code *)streamWriter[7])(&senderId,8,1);
|
|
uVar1 = textLength;
|
|
local_2c[0] = textLength & 0xffff;
|
|
(*(code *)streamWriter[7])(local_2c,2,1);
|
|
if (0xf < text->_capacity) {
|
|
text = *GHIDRA_CAST<std_string **>(text->_buf);
|
|
}
|
|
buffered_stream_write(&streamWriter,text,1,uVar1);
|
|
data = streamBuffer;
|
|
if (streamHeapBuffer != (void *)0x0) {
|
|
data = streamHeapBuffer;
|
|
}
|
|
if (g_multiplayerService == (void *)0x0) {
|
|
KAGE_LogMessage(0x10,(uint8_t *)
|
|
"Attempting to create a message when there is no multiplayer service\n");
|
|
}
|
|
messageRefCount = (void *)0xa;
|
|
NetConnection::send_message(g_multiplayerService,local_38,1,data,GHIDRA_UINT(local_60),10);
|
|
manager = g_manager;
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 1;
|
|
FUN_008ef1d0(local_38);
|
|
NetplayManager::send_message
|
|
(GHIDRA_CAST<NetplayManager *>(&manager->_netplayManager),0x11,local_60,messageRefCount);
|
|
local_14 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),2);
|
|
if (messageRefCountPtr != GHIDRA_CAST<int *>(0x0)) {
|
|
isLastRef = (**(code **)(*messageRefCountPtr + 0xc))();
|
|
if ((isLastRef != '\0') && (g_multiplayerRelease != (void *)0x0)) {
|
|
(*g_multiplayerRelease)(local_38);
|
|
}
|
|
}
|
|
streamWriter = KAGE::Filesys::StreamBase::vftable;
|
|
stream = KAGE::Filesys::BufferedStreamBase::vftable;
|
|
local_60 = (void *)0x0;
|
|
local_5c = 0;
|
|
local_54 = streamBuffer;
|
|
streamHeapBuffer = (void *)0x0;
|
|
local_48 = 0;
|
|
local_44 = 0;
|
|
local_40 = 0;
|
|
FUN_007dcd30();
|
|
ExceptionList = local_1c;
|
|
return;
|
|
}
|
|
|
|
// 0091ee00
|
|
uint8_t OnlineChat::is_key_repeating(int keyCode)
|
|
{
|
|
int *piVar1;
|
|
char isKeyActive;
|
|
int temp_5f0b48a020;
|
|
|
|
temp_5f0b48a020 = keyCode;
|
|
isKeyActive = (**(code **)(PTR_vftable_00c57b18 + 0x74))(0,FUN_00a20730,&keyCode,0,0);
|
|
if (isKeyActive == '\0') {
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + temp_5f0b48a020 * 4 + 0x68)) = 0;
|
|
}
|
|
else {
|
|
piVar1 = GHIDRA_CAST<int *>((GHIDRA_INT(this) + temp_5f0b48a020 * 4 + 0x68));
|
|
*piVar1 = *piVar1 + 1;
|
|
}
|
|
keyCode = temp_5f0b48a020;
|
|
isKeyActive = (**(code **)(PTR_vftable_00c57b18 + 0x74))(0,FUN_00a207d0,&keyCode,0,0);
|
|
if ((isKeyActive == '\0') &&
|
|
((temp_5f0b48a020 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + temp_5f0b48a020 * 4 + 0x68)), temp_5f0b48a020 < 0x1e ||
|
|
(temp_5f0b48a020 % 3 != 0)))) {
|
|
return 0;
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
// 0091f5d0
|
|
void OnlineChat::apply_roll_command(std_string *message)
|
|
{
|
|
uint8_t isMatch;
|
|
std_string *text;
|
|
uint8_t *******lowerEnd;
|
|
int lowerChar;
|
|
uint8_t *******pppppppbVar1;
|
|
int iVar2;
|
|
uint8_t *******lowerEnd;
|
|
uint32_t capacity;
|
|
uint32_t size;
|
|
uint8_t *******command [4];
|
|
uint32_t commandSize;
|
|
uint32_t commandCapacity;
|
|
uint32_t local_18;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint8_t ******local_8;
|
|
|
|
local_8 = GHIDRA_CAST<uint8_t ******>(0xffffffff);
|
|
puStack_c = &LAB_00b0a59d;
|
|
local_10 = ExceptionList;
|
|
local_18 = __security_cookie ^ GHIDRA_UINT((command + 0xb));
|
|
if (message->_size == 0) {
|
|
return;
|
|
}
|
|
text = message;
|
|
if (0xf < message->_capacity) {
|
|
text = *GHIDRA_CAST<std_string **>(message->_buf);
|
|
}
|
|
if (text->_buf[0] != '/') {
|
|
return;
|
|
}
|
|
ExceptionList = &local_10;
|
|
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(command))))->msvc::string::string(message);
|
|
local_8 = GHIDRA_CAST<uint8_t ******>(0x0);
|
|
pppppppbVar1 = GHIDRA_CAST<uint8_t *******>(command);
|
|
if (0xf < commandCapacity) {
|
|
pppppppbVar1 = command[0];
|
|
}
|
|
lowerEnd = GHIDRA_CAST<uint8_t *******>((GHIDRA_INT(pppppppbVar1) + commandSize));
|
|
lowerEnd = GHIDRA_CAST<uint8_t *******>(command);
|
|
if (0xf < commandCapacity) {
|
|
lowerEnd = command[0];
|
|
}
|
|
if (lowerEnd != lowerEnd) {
|
|
iVar2 = GHIDRA_INT(pppppppbVar1) - GHIDRA_INT(lowerEnd);
|
|
do {
|
|
lowerChar = tolower(GHIDRA_INT((char)*GHIDRA_CAST<uint8_t *>(lowerEnd)));
|
|
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(lowerEnd) + iVar2)) = (uint8_t)lowerChar;
|
|
lowerEnd = GHIDRA_CAST<uint8_t *******>((GHIDRA_INT(lowerEnd) + 1));
|
|
} while (lowerEnd != lowerEnd);
|
|
}
|
|
capacity = commandCapacity;
|
|
pppppppbVar1 = command[0];
|
|
lowerEnd = GHIDRA_CAST<uint8_t *******>(command);
|
|
if (0xf < commandCapacity) {
|
|
lowerEnd = command[0];
|
|
}
|
|
isMatch = str_eq(GHIDRA_CAST<uint8_t *>(lowerEnd),commandSize,&DAT_00b79ecc,3);
|
|
if (isMatch == 0) {
|
|
lowerEnd = GHIDRA_CAST<uint8_t *******>(command);
|
|
if (0xf < capacity) {
|
|
lowerEnd = pppppppbVar1;
|
|
}
|
|
isMatch = str_eq(GHIDRA_CAST<uint8_t *>(lowerEnd),commandSize,&DAT_00b79eac,4);
|
|
if (isMatch == 0) goto LAB_0091f723;
|
|
iVar2 = rand();
|
|
(GHIDRA_CAST<msvc::string *>((message->_buf)))->msvc::string::assign(GHIDRA_CAST<uint8_t *>("Rolled a D20! Result = "),0x17);
|
|
(GHIDRA_CAST<msvc::string *>((message->_buf)))->msvc::string::push_back((char)(iVar2 % 0x14) + 1);
|
|
iVar2 = iVar2 % 0x14 + 0x1c;
|
|
}
|
|
else {
|
|
iVar2 = rand();
|
|
(GHIDRA_CAST<msvc::string *>((message->_buf)))->msvc::string::assign(GHIDRA_CAST<uint8_t *>("Rolled a D6! Result = "),0x16);
|
|
(GHIDRA_CAST<msvc::string *>((message->_buf)))->msvc::string::push_back((char)(iVar2 % 6) + 1);
|
|
iVar2 = iVar2 % 6 + 0x16;
|
|
}
|
|
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(g_manager[1]._gamestate)) + 0x92c)))) = iVar2;
|
|
capacity = commandCapacity;
|
|
pppppppbVar1 = command[0];
|
|
LAB_0091f723:
|
|
if (0xf < capacity) {
|
|
size = capacity + 1;
|
|
lowerEnd = pppppppbVar1;
|
|
if (0xfff < size) {
|
|
lowerEnd = GHIDRA_CAST<uint8_t *******>(pppppppbVar1[-1]);
|
|
size = capacity + 0x24;
|
|
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(pppppppbVar1) + (-4 - GHIDRA_INT(lowerEnd))))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(lowerEnd,size);
|
|
}
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|