Files
isaac-port/generated-src/item_config_item.cpp
T
shweetandClaude Opus 5.5 3ce74c6e2d Reconstruction layout: generated-src/ (generated) and src/ (curated), CMake, the first takeover: RNG
The decompiled C++ tree moves to generated-src/ (classes.h, C++20); src/ is for code written by hand. A curated function
defines the generated declaration and starts its comment with its address, and source_tree.py stops emitting that body.
src/rng.cpp takes over RNG (SetSeed, the constructor, Next, RandomInt, RandomFloat, Shuffle) with the shift table read
from the exe as a constexpr array; src/log.h names KAGE_LogMessage's levels (1 INFO, 2 NET, 4 WARN, 8 ERROR, 16 ASSERT,
from its prefix jump table). CMakeLists.txt builds src/*.cpp against generated-src/classes.h (clean with -Wall -Wextra).
structs.hpp and headers.py are retired: scripts/merge_fields.py writes the merged field list, classes.h checks the layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 21:10:23 -05:00

205 lines
5.9 KiB
C++

#include "classes.h"
// 00722a80
ItemConfig_Item::ItemConfig_Item()
{
ItemConfig_Item *tail;
this->type = 0;
this->id = 0;
(this->name)._buf[0] = '\0';
(this->name)._buf[1] = '\0';
(this->name)._buf[2] = '\0';
(this->name)._buf[3] = '\0';
(this->name)._size = 0;
(this->name)._capacity = 0xf;
(this->desc)._buf[0] = '\0';
(this->desc)._buf[1] = '\0';
(this->desc)._buf[2] = '\0';
(this->desc)._buf[3] = '\0';
(this->desc)._size = 0;
(this->desc)._capacity = 0xf;
(this->gfxFilename)._buf[0] = '\0';
(this->gfxFilename)._buf[1] = '\0';
(this->gfxFilename)._buf[2] = '\0';
(this->gfxFilename)._buf[3] = '\0';
(this->gfxFilename)._size = 0;
(this->gfxFilename)._capacity = 0xf;
this->achievementId = 0;
this->cacheFlags = 0;
this->addMaxhearts = 0;
this->addHearts = 0;
this->addSoulHearts = 0;
this->addBlackHearts = 0;
this->addBombs = 0;
this->addKeys = 0;
this->addCoins = 0;
this->maxCharges = 0;
this->maxCooldown = 0;
this->devilprice = 1;
this->shopPrice = 0xf;
(this->costume).id = 0;
(this->costume).anm2Path._buf[0] = '\0';
(this->costume).anm2Path._buf[1] = '\0';
(this->costume).anm2Path._buf[2] = '\0';
(this->costume).anm2Path._buf[3] = '\0';
(this->costume).anm2Path._size = 0;
(this->costume).anm2Path._capacity = 0xf;
(this->costume).priority = 0;
(this->costume).hasOverlay = 0;
(this->costume).isFlying = 0;
(this->costume).hasSkinAlt = 0;
(this->costume).skinColor = -1;
*GHIDRA_CAST<undefined2 *>(&(this->costume).overwriteColor) = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&((this->costume))) + 0x2a))) = 0;
this->chargeType = 0;
this->special = 0;
this->passiveCache = 0;
this->addCostumeOnPickup = 1;
this->hidden = 0;
this->persistentEffect = 0;
this->clearEffectsOnRemove = 1;
*GHIDRA_CAST<undefined4 *>(&this->tags) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&this->tags) + 4)) = 0;
this->quality = 0;
this->craftingQuality = 0;
this->_initCharge = -1;
this[1].type = 0;
this[1].id = 0;
this[1].name._buf[0] = '\0';
this[1].name._buf[1] = '\0';
this[1].name._buf[2] = '\0';
this[1].name._buf[3] = '\0';
tail = this + 1;
(tail->name)._buf[4] = '\0';
(tail->name)._buf[5] = '\0';
(tail->name)._buf[6] = '\0';
(tail->name)._buf[7] = '\0';
tail = this + 1;
(tail->name)._buf[8] = -1;
(tail->name)._buf[9] = -1;
(tail->name)._buf[10] = -1;
(tail->name)._buf[0xb] = -1;
tail = this + 1;
(tail->name)._buf[0xc] = '\0';
(tail->name)._buf[0xd] = '\0';
(tail->name)._buf[0xe] = '\0';
(tail->name)._buf[0xf] = '\0';
return this;
}
// 00722c10
ItemConfig_Item::~ItemConfig_Item()
{
void *ownedCostume;
ownedCostume = (void *)this[1].type;
if (ownedCostume != (void *)0x0) {
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((GHIDRA_INT(ownedCostume) + 0x174)))))->std::string::_Tidy_deallocate();
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((GHIDRA_INT(ownedCostume) + 0x15c)))))->std::string::_Tidy_deallocate();
operator_delete(ownedCostume,0x198);
this[1].type = 0;
}
FUN_00731160();
(GHIDRA_CAST<std::string *>(((this->costume).anm2Path._buf)))->std::string::_Tidy_deallocate();
(GHIDRA_CAST<std::string *>(((this->gfxFilename)._buf)))->std::string::_Tidy_deallocate();
(GHIDRA_CAST<std::string *>(((this->desc)._buf)))->std::string::_Tidy_deallocate();
(GHIDRA_CAST<std::string *>(((this->name)._buf)))->std::string::_Tidy_deallocate();
return;
}
// 0072ff10
std_string * ItemConfig_Item::GetLocalizedName(std_string *outName, int language)
{
std_string *text;
std_string *textEnd;
int resolvedLanguage;
char *ch;
StringTable *stringTable;
if ((this->name)._size == 0) {
outName->_buf[0] = '\0';
outName->_buf[1] = '\0';
outName->_buf[2] = '\0';
outName->_buf[3] = '\0';
outName->_size = 0;
outName->_capacity = 0xf;
outName->_buf[0] = '\0';
outName->_size = 0;
outName->_buf[0] = '\0';
return outName;
}
resolvedLanguage = language;
if (language == 0x14) {
resolvedLanguage = *GHIDRA_CAST<int *>(&g_manager->_stringTable);
}
text = &this->name;
if (0xf < (this->name)._capacity) {
text = *GHIDRA_CAST<std_string **>(text->_buf);
}
stringTable = &g_manager->_stringTable;
if (text->_buf[0] == '#') {
language = language & 0xffffff;
StringTable::get_string
(stringTable,GHIDRA_CAST<byte *>("Items"),resolvedLanguage,GHIDRA_CAST<byte *>((text->_buf + 1)),
GHIDRA_CAST<byte *>((GHIDRA_INT(&language) + 3)));
if ((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(language)) + 0x3))) == '\0') {
language = language & 0xffffff;
text = (std_string *)
StringTable::get_string
(stringTable,GHIDRA_CAST<byte *>("Items"),resolvedLanguage,GHIDRA_CAST<byte *>((text->_buf + 1)),
GHIDRA_CAST<byte *>((GHIDRA_INT(&language) + 3)));
}
}
outName->_buf[0] = '\0';
outName->_buf[1] = '\0';
outName->_buf[2] = '\0';
outName->_buf[3] = '\0';
outName->_size = 0;
outName->_capacity = 0xf;
outName->_buf[0] = '\0';
textEnd = text;
do {
ch = textEnd->_buf;
textEnd = GHIDRA_CAST<std_string *>((textEnd->_buf + 1));
} while (*ch != '\0');
(GHIDRA_CAST<std::string *>((outName->_buf)))->std::string::assign(GHIDRA_CAST<byte *>(text),GHIDRA_INT(textEnd) - GHIDRA_INT((text->_buf + 1)));
return outName;
}
// 007307b0
byte ItemConfig_Item::is_mom_item()
{
int iVar1;
iVar1 = this->type;
if (((iVar1 != 1) && (iVar1 != 3)) && (iVar1 != 4)) {
switchD_007307de_caseD_20:
return 0;
}
iVar1 = this->id;
if (iVar1 < 0x164) {
if (iVar1 != 0x163) {
switch(iVar1) {
case 0x1d:
case 0x1e:
case 0x1f:
case 0x37:
case 0x6e:
case 0x72:
case 199:
case 200:
case 0xd9:
case 0xe4:
break;
default:
goto switchD_007307de_caseD_20;
}
}
}
else if ((iVar1 != 0x1fc) && (iVar1 != 0x2dc)) {
return 0;
}
return 1;
}