Curation round 2, wave A: anm2 (Anm2Ed JSON), text, config as idiomatic classes; SDL3 platform opens a window
- 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>
This commit is contained in:
1 parent
d6e1ca7c6c
commit
780767f5e1
161 files changed
+8646
-21919
No files matched your search
+13
-242
@@ -40,88 +40,13 @@ uint8_t Sprite::FlipY()
|
||||
return this->_flipY;
|
||||
}
|
||||
|
||||
// 0040a140
|
||||
void Sprite::RenderLayer(int layerId, Vector *position, Vector *topLeftClamp, Vector *bottomRightClamp)
|
||||
{
|
||||
if (this->_loaded != 0) {
|
||||
if (this->_overlayRenderFirst != 0) {
|
||||
FUN_0040a080(layerId,position,topLeftClamp,bottomRightClamp);
|
||||
FUN_0040a080(layerId,position,topLeftClamp,bottomRightClamp);
|
||||
return;
|
||||
}
|
||||
FUN_0040a080(layerId,position,topLeftClamp,bottomRightClamp);
|
||||
FUN_0040a080(layerId,position,topLeftClamp,bottomRightClamp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 0040a2b0
|
||||
void Sprite::PlayRandom(uint32_t seed)
|
||||
{
|
||||
uint8_t bVar1;
|
||||
uint8_t *curAnimName;
|
||||
uint32_t cmpResult;
|
||||
uint8_t *animNameCursor;
|
||||
uint8_t *anim;
|
||||
bool isLess;
|
||||
uint8_t *curAnimData;
|
||||
|
||||
if (this->_animCount == 0) {
|
||||
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("[warn] PlayRandom: no animations\n"));
|
||||
return;
|
||||
}
|
||||
anim = GHIDRA_CAST<uint8_t *>(((seed % GHIDRA_UINT(this->_animCount)) * 0x13c + GHIDRA_INT(this->_animData)));
|
||||
if (0xf < *GHIDRA_CAST<uint32_t *>((anim + 0x14))) {
|
||||
anim = *GHIDRA_CAST<uint8_t **>(anim);
|
||||
}
|
||||
curAnimData = (this->_animState)._animData;
|
||||
if (curAnimData != GHIDRA_CAST<uint8_t *>(0x0)) {
|
||||
curAnimName = curAnimData;
|
||||
if (0xf < *GHIDRA_CAST<uint32_t *>((curAnimData + 0x14))) {
|
||||
curAnimName = *GHIDRA_CAST<uint8_t **>(curAnimData);
|
||||
}
|
||||
animNameCursor = anim;
|
||||
do {
|
||||
bVar1 = *curAnimName;
|
||||
isLess = bVar1 < *animNameCursor;
|
||||
if (bVar1 != *animNameCursor) {
|
||||
LAB_0040a320:
|
||||
cmpResult = -GHIDRA_UINT(isLess) | 1;
|
||||
goto LAB_0040a325;
|
||||
}
|
||||
if (bVar1 == 0) break;
|
||||
bVar1 = curAnimName[1];
|
||||
isLess = bVar1 < animNameCursor[1];
|
||||
if (bVar1 != animNameCursor[1]) goto LAB_0040a320;
|
||||
curAnimName = curAnimName + 2;
|
||||
animNameCursor = animNameCursor + 2;
|
||||
} while (bVar1 != 0);
|
||||
cmpResult = 0;
|
||||
LAB_0040a325:
|
||||
if (cmpResult == 0) {
|
||||
if (curAnimData[0x34] == 0) {
|
||||
return;
|
||||
}
|
||||
if ((this->_animState)._isPlaying != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
bVar1 = (GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>(this))))->ANM2::SetAnimation(anim,1);
|
||||
if (bVar1 != 0) {
|
||||
(GHIDRA_CAST<AnimationState *>((&this->_animState)))->AnimationState::Rewind();
|
||||
(this->_animState)._isPlaying = 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 0040a360
|
||||
void Sprite::Play(std_string *animName, uint8_t isForce)
|
||||
{
|
||||
if (0xf < animName->_capacity) {
|
||||
animName = *GHIDRA_CAST<std_string **>(animName->_buf);
|
||||
}
|
||||
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>(this))))->ANM2::Play(GHIDRA_CAST<uint8_t *>(animName),isForce);
|
||||
ANM2::Play(GHIDRA_CAST<ANM2 *>(this),GHIDRA_CAST<uint8_t *>(animName),isForce);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -133,7 +58,7 @@ void Sprite::IsPlaying(uint8_t *param_1)
|
||||
if (0xf < *GHIDRA_CAST<uint32_t *>((param_1 + 0x14))) {
|
||||
param_1 = *GHIDRA_CAST<uint8_t **>(param_1);
|
||||
}
|
||||
(GHIDRA_CAST<ANM2 *>((in_ECX)))->ANM2::IsPlaying(param_1);
|
||||
ANM2::IsPlaying(in_ECX,param_1);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -145,7 +70,7 @@ uint8_t Sprite::IsFinished(std_string *animName)
|
||||
if (0xf < animName->_capacity) {
|
||||
animName = *GHIDRA_CAST<std_string **>(animName->_buf);
|
||||
}
|
||||
bVar1 = (GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>(this))))->ANM2::IsFinishedImpl(GHIDRA_CAST<uint8_t *>(animName));
|
||||
bVar1 = ANM2::IsFinishedImpl(GHIDRA_CAST<ANM2 *>(this),GHIDRA_CAST<uint8_t *>(animName));
|
||||
return bVar1;
|
||||
}
|
||||
|
||||
@@ -157,7 +82,7 @@ uint8_t Sprite::SetAnimation(std_string *name, uint8_t isReset)
|
||||
if (0xf < name->_capacity) {
|
||||
name = *GHIDRA_CAST<std_string **>(name->_buf);
|
||||
}
|
||||
bVar1 = (GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>(this))))->ANM2::SetAnimation(GHIDRA_CAST<uint8_t *>(name),isReset);
|
||||
bVar1 = ANM2::SetAnimation(GHIDRA_CAST<ANM2 *>(this),GHIDRA_CAST<uint8_t *>(name),isReset);
|
||||
return bVar1;
|
||||
}
|
||||
|
||||
@@ -165,26 +90,7 @@ uint8_t Sprite::SetAnimation(std_string *name, uint8_t isReset)
|
||||
void Sprite::SetFrame_1(int frame)
|
||||
{
|
||||
if ((this->_animState)._animData != (void *)0x0) {
|
||||
(GHIDRA_CAST<AnimationState *>((&this->_animState)))->AnimationState::SetFrameFloat((float)frame);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 0040a760
|
||||
void Sprite::SetLastFrame()
|
||||
{
|
||||
if ((this->_animState)._animData != (void *)0x0) {
|
||||
AnimationState::AdvancePosition
|
||||
(&this->_animState,*GHIDRA_CAST<int *>((GHIDRA_INT((this->_animState)._animData) + 0x30)) + -1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 0040a910
|
||||
void Sprite::Stop()
|
||||
{
|
||||
if ((this->_animState)._animData != (void *)0x0) {
|
||||
(this->_animState)._isPlaying = 0;
|
||||
AnimationState::SetFrameFloat(&this->_animState,(float)frame);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -197,7 +103,7 @@ void Sprite::PlayOverlay(uint8_t *param_1, uint8_t param_2)
|
||||
if (0xf < *GHIDRA_CAST<uint32_t *>((param_1 + 0x14))) {
|
||||
param_1 = *GHIDRA_CAST<uint8_t **>(param_1);
|
||||
}
|
||||
(GHIDRA_CAST<ANM2 *>((in_ECX)))->ANM2::PlayOverlay(param_1,param_2);
|
||||
ANM2::PlayOverlay(in_ECX,param_1,param_2);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -223,7 +129,7 @@ uint8_t Sprite::SetOverlayAnimation(std_string *animName, uint8_t isReset)
|
||||
if (0xf < animName->_capacity) {
|
||||
animName = *GHIDRA_CAST<std_string **>(animName->_buf);
|
||||
}
|
||||
bVar1 = (GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>(this))))->ANM2::SetOverlayAnimation(GHIDRA_CAST<uint8_t *>(animName),isReset);
|
||||
bVar1 = ANM2::SetOverlayAnimation(GHIDRA_CAST<ANM2 *>(this),GHIDRA_CAST<uint8_t *>(animName),isReset);
|
||||
return bVar1;
|
||||
}
|
||||
|
||||
@@ -235,29 +141,13 @@ void Sprite::SetOverlayFrame(std_string *animName, int frame)
|
||||
if (0xf < animName->_capacity) {
|
||||
animName = *GHIDRA_CAST<std_string **>(animName->_buf);
|
||||
}
|
||||
isAnimationSet = (GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>(this))))->ANM2::SetOverlayAnimation(GHIDRA_CAST<uint8_t *>(animName),1);
|
||||
isAnimationSet = ANM2::SetOverlayAnimation(GHIDRA_CAST<ANM2 *>(this),GHIDRA_CAST<uint8_t *>(animName),1);
|
||||
if ((isAnimationSet != 0) && ((this->_overlayAnimState)._animData != (void *)0x0)) {
|
||||
(GHIDRA_CAST<AnimationState *>((&this->_overlayAnimState)))->AnimationState::SetFrameFloat((float)frame);
|
||||
AnimationState::SetFrameFloat(&this->_overlayAnimState,(float)frame);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 0040ac50
|
||||
int Sprite::GetOverlayFrame()
|
||||
{
|
||||
if ((this->_overlayAnimState)._animData == (void *)0x0) {
|
||||
return -1;
|
||||
}
|
||||
return GHIDRA_INT((this->_overlayAnimState)._animFrame);
|
||||
}
|
||||
|
||||
// 0040ac60
|
||||
void Sprite::RemoveOverlay()
|
||||
{
|
||||
(GHIDRA_CAST<AnimationState *>((&this->_overlayAnimState)))->AnimationState::SetAnimationData((void *)0x0);
|
||||
return;
|
||||
}
|
||||
|
||||
// 0040b000
|
||||
uint8_t Sprite::IsEventTriggered(void *eventName)
|
||||
{
|
||||
@@ -269,7 +159,7 @@ uint8_t Sprite::IsEventTriggered(void *eventName)
|
||||
if ((this->_animState)._animData == (void *)0x0) {
|
||||
return 0;
|
||||
}
|
||||
isTriggered = (GHIDRA_CAST<AnimationState *>((&this->_animState)))->AnimationState::IsEventTriggered(eventName);
|
||||
isTriggered = AnimationState::IsEventTriggered(&this->_animState,eventName);
|
||||
return isTriggered;
|
||||
}
|
||||
|
||||
@@ -284,28 +174,16 @@ uint8_t Sprite::WasEventTriggered(std_string *eventName)
|
||||
if ((this->_animState)._animData == (void *)0x0) {
|
||||
return 0;
|
||||
}
|
||||
local_AL_32 = (GHIDRA_CAST<AnimationState *>((&this->_animState)))->AnimationState::WasEventTriggered(GHIDRA_CAST<uint8_t *>(eventName));
|
||||
local_AL_32 = AnimationState::WasEventTriggered(&this->_animState,GHIDRA_CAST<uint8_t *>(eventName));
|
||||
return local_AL_32;
|
||||
}
|
||||
|
||||
// 0040b1d0
|
||||
void * Sprite::GetNullFrame(uint8_t *nullLayerName)
|
||||
{
|
||||
void *nullFrame;
|
||||
|
||||
if ((this->_animState)._animData == (void *)0x0) {
|
||||
return (void *)0x0;
|
||||
}
|
||||
nullFrame = (GHIDRA_CAST<AnimationState *>((&this->_animState)))->AnimationState::GetNullFrame(nullLayerName);
|
||||
return nullFrame;
|
||||
}
|
||||
|
||||
// 0040b200
|
||||
LayerState * Sprite::GetLayer(uint8_t *layerName)
|
||||
{
|
||||
LayerState *layer;
|
||||
|
||||
layer = (GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>(this))))->ANM2::GetLayer(layerName);
|
||||
layer = ANM2::GetLayer(GHIDRA_CAST<ANM2 *>(this),layerName);
|
||||
return layer;
|
||||
}
|
||||
|
||||
@@ -347,51 +225,10 @@ KColor * Sprite::GetTexel(KColor *param_2, float param_3, float param_4, float p
|
||||
return param_2;
|
||||
}
|
||||
|
||||
// 0040bf30
|
||||
uint8_t Sprite::ReplaceSpritesheet(int layerId, std_string *pngFilename)
|
||||
{
|
||||
uint32_t lengthA;
|
||||
uint8_t isSamePath;
|
||||
int layerOffset;
|
||||
std_string *layerPathData;
|
||||
std_string *newPathData;
|
||||
std_string *layerPath;
|
||||
void *layerStates;
|
||||
|
||||
if ((-1 < layerId) && (layerId < this->_layerCount)) {
|
||||
layerStates = this->_layerState;
|
||||
layerOffset = layerId * 0xa0;
|
||||
layerPath = GHIDRA_CAST<std_string *>((layerOffset + 8 + GHIDRA_INT(layerStates)));
|
||||
layerPathData = layerPath;
|
||||
if (0xf < layerPath->_capacity) {
|
||||
layerPathData = *GHIDRA_CAST<std_string **>(layerPath->_buf);
|
||||
}
|
||||
lengthA = pngFilename->_size;
|
||||
newPathData = pngFilename;
|
||||
if (0xf < pngFilename->_capacity) {
|
||||
newPathData = *GHIDRA_CAST<std_string **>(pngFilename->_buf);
|
||||
}
|
||||
isSamePath = str_eq(GHIDRA_CAST<uint8_t *>(newPathData),lengthA,GHIDRA_CAST<uint8_t *>(layerPathData),layerPath->_size);
|
||||
if (isSamePath == 0) {
|
||||
if (layerPath == pngFilename) {
|
||||
*GHIDRA_CAST<uint8_t *>((layerOffset + 0x30 + GHIDRA_INT(layerStates))) = 0;
|
||||
return 1;
|
||||
}
|
||||
if (0xf < pngFilename->_capacity) {
|
||||
pngFilename = *GHIDRA_CAST<std_string **>(pngFilename->_buf);
|
||||
}
|
||||
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(layerPath))))->msvc::string::assign(GHIDRA_CAST<uint8_t *>(pngFilename),lengthA);
|
||||
*GHIDRA_CAST<uint8_t *>((layerOffset + 0x30 + GHIDRA_INT(this->_layerState))) = 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0040bff0
|
||||
void Sprite::LoadGraphics()
|
||||
{
|
||||
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>(this))))->ANM2::LoadGraphics((uint8_t)this);
|
||||
ANM2::LoadGraphics(GHIDRA_CAST<ANM2 *>(this),(uint8_t)this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -435,13 +272,6 @@ void Sprite::SetOverlayRenderPriority(uint8_t param_2)
|
||||
return;
|
||||
}
|
||||
|
||||
// 00435c60
|
||||
void Sprite::set_flip_x(uint8_t isFlipX)
|
||||
{
|
||||
this->_flipX = isFlipX;
|
||||
return;
|
||||
}
|
||||
|
||||
// 0043ee80
|
||||
void Sprite::SetRotation(float rotation)
|
||||
{
|
||||
@@ -474,62 +304,3 @@ Vector * Sprite::Offset()
|
||||
{
|
||||
return &this->_offset;
|
||||
}
|
||||
|
||||
// 004a5cf0
|
||||
std_string * Sprite::GetDefaultAnimationName()
|
||||
{
|
||||
return &this->_animDefaultName;
|
||||
}
|
||||
|
||||
// 0085db20
|
||||
char * Sprite::GetAnimation(char *param_2)
|
||||
{
|
||||
void *animData;
|
||||
|
||||
animData = (this->_animState)._animData;
|
||||
if (animData == (void *)0x0) {
|
||||
param_2[0] = '\0';
|
||||
param_2[1] = '\0';
|
||||
param_2[2] = '\0';
|
||||
param_2[3] = '\0';
|
||||
param_2[0x10] = '\0';
|
||||
param_2[0x11] = '\0';
|
||||
param_2[0x12] = '\0';
|
||||
param_2[0x13] = '\0';
|
||||
param_2[0x14] = '\x0f';
|
||||
param_2[0x15] = '\0';
|
||||
param_2[0x16] = '\0';
|
||||
param_2[0x17] = '\0';
|
||||
*param_2 = '\0';
|
||||
param_2[0x10] = '\0';
|
||||
param_2[0x11] = '\0';
|
||||
param_2[0x12] = '\0';
|
||||
param_2[0x13] = '\0';
|
||||
*param_2 = '\0';
|
||||
return param_2;
|
||||
}
|
||||
(GHIDRA_CAST<msvc::string *>((param_2)))->msvc::string::string(animData);
|
||||
return param_2;
|
||||
}
|
||||
|
||||
// 0085db70
|
||||
std_string * Sprite::GetOverlayAnimation(std_string *outName)
|
||||
{
|
||||
void *animData;
|
||||
|
||||
animData = (this->_overlayAnimState)._animData;
|
||||
if (animData == (void *)0x0) {
|
||||
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;
|
||||
}
|
||||
(GHIDRA_CAST<msvc::string *>((outName->_buf)))->msvc::string::string(animData);
|
||||
return outName;
|
||||
}
|
||||
Reference in new issue
Block a user