- 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>
207 lines
7.9 KiB
C++
207 lines
7.9 KiB
C++
#include "classes.h"
|
|
|
|
// 0069d290
|
|
void Menu_Mods::Update()
|
|
{
|
|
std_string *displayName;
|
|
uint8_t *b;
|
|
void *freeBlock;
|
|
uint32_t size;
|
|
uint8_t *nameSize;
|
|
int playersBegin;
|
|
uint8_t *a;
|
|
int iVar2;
|
|
int playersEnd;
|
|
uint8_t local_74 [4];
|
|
uint32_t playerIndex;
|
|
Menu_Mods *self;
|
|
uint8_t *nameMapHead;
|
|
uint32_t local_64;
|
|
uint8_t *local_60;
|
|
uint32_t local_5c;
|
|
void *displayNameBuf [3];
|
|
uint8_t local_4c [8];
|
|
uint8_t *local_44;
|
|
void *nameKey;
|
|
uint32_t uStack_3c;
|
|
uint32_t uStack_38;
|
|
uint32_t uStack_34;
|
|
uint32_t nameKeySize;
|
|
uint32_t nameKeyCapacity;
|
|
uint32_t local_28;
|
|
uint32_t securityCookie;
|
|
uint8_t *puStack_20;
|
|
void *local_1c;
|
|
uint8_t *puStack_18;
|
|
uint32_t local_14;
|
|
uint32_t *nameSize;
|
|
EntityConfig_Player *playerConfig;
|
|
|
|
puStack_20 = local_4c + 0x48;
|
|
local_14 = 0xffffffff;
|
|
puStack_18 = &LAB_00af9dbd;
|
|
local_1c = ExceptionList;
|
|
securityCookie = __security_cookie ^ GHIDRA_UINT((local_4c + 0x3c));
|
|
ExceptionList = &local_1c;
|
|
nameMapHead = GHIDRA_CAST<uint8_t *>(0x0);
|
|
local_64 = 0;
|
|
self = this;
|
|
nameMapHead = operator_new(0x2c);
|
|
*GHIDRA_CAST<uint8_t **>(nameMapHead) = nameMapHead;
|
|
*GHIDRA_CAST<uint8_t **>((nameMapHead + 4)) = nameMapHead;
|
|
*GHIDRA_CAST<uint8_t **>((nameMapHead + 8)) = nameMapHead;
|
|
*GHIDRA_CAST<uint16_t *>((nameMapHead + 0xc)) = 0x101;
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0;
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))) = 0;
|
|
playersEnd = *GHIDRA_CAST<int *>((this + 4));
|
|
playersBegin = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[2])) + 0x2))));
|
|
local_5c = 0x29;
|
|
local_60 = nameMapHead;
|
|
if (0x29 < GHIDRA_UINT(((playersEnd - playersBegin) / 0x148))) {
|
|
iVar2 = 0x3488;
|
|
do {
|
|
playerConfig = GHIDRA_CAST<EntityConfig_Player *>((iVar2 + playersBegin));
|
|
if ((*GHIDRA_CAST<char *>((iVar2 + 0x128 + playersBegin)) == '\0') &&
|
|
((playerConfig->_bSkinParentName)._size == 0)) {
|
|
displayName = EntityConfig_Player::GetDisplayName
|
|
(playerConfig,GHIDRA_CAST<std_string *>(displayNameBuf),playerConfig);
|
|
nameKey = *(void **)displayName->_buf;
|
|
uStack_3c = *GHIDRA_CAST<uint32_t *>((displayName->_buf + 4));
|
|
uStack_38 = *GHIDRA_CAST<uint32_t *>((displayName->_buf + 8));
|
|
uStack_34 = *GHIDRA_CAST<uint32_t *>((displayName->_buf + 0xc));
|
|
nameKeySize = displayName->_size;
|
|
nameKeyCapacity = displayName->_capacity;
|
|
displayName->_size = 0;
|
|
displayName->_capacity = 0xf;
|
|
displayName->_buf[0] = '\0';
|
|
local_28 = local_5c;
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
|
|
FUN_006a00d0(local_74,&nameKey);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 1;
|
|
if (0xf < nameKeyCapacity) {
|
|
size = nameKeyCapacity + 1;
|
|
freeBlock = nameKey;
|
|
if (0xfff < size) {
|
|
freeBlock = *(void **)(GHIDRA_CAST<char *>(nameKey) + -4);
|
|
size = nameKeyCapacity + 0x24;
|
|
if (0x1f < GHIDRA_UINT((GHIDRA_INT(nameKey) + (-4 - GHIDRA_INT(freeBlock))))) goto LAB_0069d502;
|
|
}
|
|
operator_delete(freeBlock,size);
|
|
}
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 0;
|
|
if (&DAT_0000000f < local_44) {
|
|
nameSize = local_44 + 1;
|
|
freeBlock = displayNameBuf[0];
|
|
if (GHIDRA_CAST<uint8_t *>(0xfff) < nameSize) {
|
|
freeBlock = *(void **)(GHIDRA_INT(displayNameBuf[0]) + -4);
|
|
nameSize = local_44 + 0x24;
|
|
if (0x1f < GHIDRA_UINT((GHIDRA_INT(displayNameBuf[0]) + (-4 - GHIDRA_INT(freeBlock))))) {
|
|
LAB_0069d502:
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(freeBlock,GHIDRA_UINT(nameSize));
|
|
}
|
|
}
|
|
iVar2 = iVar2 + 0x148;
|
|
local_5c = local_5c + 1;
|
|
playersEnd = *GHIDRA_CAST<int *>((self + 4));
|
|
playersBegin = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(self[2])) + 0x2))));
|
|
} while (local_5c < GHIDRA_UINT(((playersEnd - playersBegin) / 0x148)));
|
|
local_60 = nameMapHead;
|
|
}
|
|
playerIndex = 0x29;
|
|
nameSize = local_60;
|
|
nameMapHead = local_60;
|
|
if (0x29 < GHIDRA_UINT(((playersEnd - playersBegin) / 0x148))) {
|
|
local_5c = 0x3488;
|
|
do {
|
|
if ((*GHIDRA_CAST<char *>((local_5c + 0x128 + playersBegin)) == '\0') &&
|
|
(*GHIDRA_CAST<int *>((local_5c + 0x11c + playersBegin)) != 0)) {
|
|
a = GHIDRA_CAST<uint8_t *>((playersBegin + local_5c + 0x10c));
|
|
msvc::map<msvc::string>::_Find_lower_bound(local_4c,a);
|
|
nameSize = local_44;
|
|
if (local_44[0xd] == '\0') {
|
|
b = local_44 + 0x10;
|
|
if (0xf < *GHIDRA_CAST<uint32_t *>((local_44 + 0x24))) {
|
|
b = *GHIDRA_CAST<uint8_t **>(b);
|
|
}
|
|
nameSize = GHIDRA_CAST<uint32_t *>((a + 0x10));
|
|
if (0xf < *GHIDRA_CAST<uint32_t *>((a + 0x14))) {
|
|
a = *GHIDRA_CAST<uint8_t **>(a);
|
|
}
|
|
playersBegin = string_compare(a,*nameSize,b,*GHIDRA_CAST<uint32_t *>((local_44 + 0x20)));
|
|
if ((-1 < playersBegin) && (nameSize != local_60)) {
|
|
*GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>((nameSize + 0x28)) * 0x148 + 0x124 + *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(self[2])) + 0x2)))))) =
|
|
playerIndex;
|
|
local_60 = nameMapHead;
|
|
}
|
|
}
|
|
nameSize = local_60;
|
|
}
|
|
local_5c = local_5c + 0x148;
|
|
playerIndex = playerIndex + 1;
|
|
playersBegin = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(self[2])) + 0x2))));
|
|
} while (playerIndex < GHIDRA_UINT(((*GHIDRA_CAST<int *>((self + 4)) - playersBegin) / 0x148)));
|
|
}
|
|
msvc::map<msvc::string_int>::_Erase_tree(&nameMapHead,*GHIDRA_CAST<uint32_t *>((nameSize + 4)));
|
|
operator_delete(nameMapHead,0x2c);
|
|
ExceptionList = local_1c;
|
|
return;
|
|
}
|
|
|
|
// 008e4970
|
|
void Menu_Mods::reset()
|
|
{
|
|
uint8_t bVar1;
|
|
uint8_t *currentName;
|
|
uint32_t compareResult;
|
|
uint8_t *defaultName;
|
|
bool isLess;
|
|
uint8_t *animData;
|
|
MenuManager *menuManager;
|
|
|
|
animData = *GHIDRA_CAST<uint8_t **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[0x16])) + 0x2))));
|
|
if (animData != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
currentName = animData;
|
|
if (0xf < *GHIDRA_CAST<uint32_t *>((animData + 0x14))) {
|
|
currentName = *GHIDRA_CAST<uint8_t **>(animData);
|
|
}
|
|
defaultName = &DAT_00b6767c;
|
|
do {
|
|
bVar1 = *currentName;
|
|
isLess = bVar1 < *defaultName;
|
|
if (bVar1 != *defaultName) {
|
|
LAB_008e49b0:
|
|
compareResult = -GHIDRA_UINT(isLess) | 1;
|
|
goto LAB_008e49b5;
|
|
}
|
|
if (bVar1 == 0) break;
|
|
bVar1 = currentName[1];
|
|
isLess = bVar1 < defaultName[1];
|
|
if (bVar1 != defaultName[1]) goto LAB_008e49b0;
|
|
currentName = currentName + 2;
|
|
defaultName = defaultName + 2;
|
|
} while (bVar1 != 0);
|
|
compareResult = 0;
|
|
LAB_008e49b5:
|
|
if ((compareResult == 0) && ((animData[0x34] == 0 || (*GHIDRA_CAST<char *>((this + 0x1c)) != '\0'))))
|
|
goto LAB_008e49e2;
|
|
}
|
|
bVar1 = ANM2::SetAnimation(GHIDRA_CAST<ANM2 *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[5])) + 0x1)))),&DAT_00b6767c,1);
|
|
if (bVar1 != 0) {
|
|
AnimationState::Rewind(GHIDRA_CAST<AnimationState *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[0x15])) + 0x1)))));
|
|
*GHIDRA_CAST<uint8_t *>((this + 0x1c)) = 1;
|
|
}
|
|
LAB_008e49e2:
|
|
menuManager = g_menuManager;
|
|
*GHIDRA_CAST<uint32_t *>(this) = 0;
|
|
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1)))) = 0;
|
|
menuManager->_viewPositionSet[7].y = -216.0;
|
|
menuManager->_state = 1;
|
|
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[0x62])) + 0x2)))) = g_manager->_modManager;
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[0x61])) + 0x1))) = 0;
|
|
return;
|
|
}
|