//
// GJShaderState::timesyncShaderAction from 0x1003ca020 to 0x1003ca202 (482 bytes)
//
// 2 xrefs:
// > GJShaderState::timesyncShaderActions @ 0x1003ca007
// > ShaderLayer::tweenValueAuto @ 0x1003cdc40
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall GJShaderState::timesyncShaderAction(GJShaderState *a1, int a2)
{
unsigned __int64 value; // r9
unsigned __int64 v3; // r10
unsigned __int64 v4; // r8
std::__hash_node_base, void *> *> *v5; // rax
std::__hash_node_base, void *> *>::__next_pointer next; // r15
unsigned __int64 v7; // r9
std::__hash_node_base, void *> *>::__next_pointer v8; // rax
unsigned __int64 v9; // rax
float v10; // xmm0_4
int *v11; // [rsp+8h] [rbp-28h] BYREF
int v12; // [rsp+10h] [rbp-20h] BYREF
char v13[25]; // [rsp+17h] [rbp-19h] BYREF
v12 = a2;
value = a1->m_tweenActions.__table_.__bucket_list_.__ptr_.__value_.__data_.__value_;
if ( value )
{
v3 = (0x101010101010101LL
* ((((value - ((value >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((value - ((value >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)
+ ((((value - ((value >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((value - ((value >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)) >> 4))
& 0xF0F0F0F0F0F0F0FLL)) >> 56;
if ( v3 <= 1 )
{
v4 = a2 & (value - 1);
v5 = a1->m_tweenActions.__table_.__bucket_list_.__ptr_.__value_[v4];
if ( !v5 )
return;
goto LABEL_9;
}
v4 = a2;
if ( value <= a2 )
{
if ( !((value | a2) >> 32) )
{
v4 = a2 % (unsigned int)value;
v5 = a1->m_tweenActions.__table_.__bucket_list_.__ptr_.__value_[v4];
if ( !v5 )
return;
goto LABEL_9;
}
v4 = a2 % value;
}
v5 = a1->m_tweenActions.__table_.__bucket_list_.__ptr_.__value_[v4];
if ( !v5 )
return;
LABEL_9:
next = v5->__next_;
if ( !v5->__next_ )
return;
if ( (unsigned int)v3 < 2 )
{
v7 = value - 1;
while ( 1 )
{
v8 = next[1].__next_;
if ( v8 == (std::__hash_node_base, void *> *>::__next_pointer)a2 )
{
if ( LODWORD(next[2].__next_) == a2 )
goto LABEL_27;
}
else if ( (v7 & (unsigned __int64)v8) != v4 )
{
return;
}
next = next->__next_;
if ( !next )
return;
}
}
do
{
v9 = (unsigned __int64)next[1].__next_;
if ( v9 == a2 )
{
if ( LODWORD(next[2].__next_) == a2 )
{
LABEL_27:
v11 = &v12;
v10 = a1->m_time - *(double *)(sub_1003D2150(&a1->m_tweenTimes, &v12, &unk_10081AF06, &v11, v13) + 24);
GJValueTween::step((GJValueTween *)((char *)&next[2].__next_ + 4), v10);
GJShaderState::updateTweenAction(a1, *((float *)&next[4].__next_ + 1), v12);
return;
}
}
else
{
if ( v9 < value )
goto LABEL_23;
if ( (value | v9) >> 32 )
{
v9 %= value;
LABEL_23:
if ( v9 != v4 )
return;
goto LABEL_18;
}
if ( (unsigned int)v9 % (unsigned int)value != v4 )
return;
}
LABEL_18:
next = next->__next_;
}
while ( next );
}
}