//
// GameObject::getColorKey from 0x45cb04 to 0x45cd9c (664 bytes)
//
// 3 xrefs:
// > PlayLayer::processCreateObjectsFromSetup @ 0x40acbc
// > GameObject::getColorKey @ 0x45cc1c
// > LevelEditorLayer::getLevelString @ 0x472736
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:48:50 +0000
//
GameObject *__fastcall GameObject::getColorKey(GameObject *this, int a2, int a3, signed int a4)
{
int v7; // r9
GJSpriteColor *MainColorMode; // r0
GJSpriteColor *SecondaryColorMode; // r10
int v10; // r3
int i; // r7
int GroupID; // r0
const char *v13; // r0
const char *v14; // r4
size_t v15; // r0
const char *v17; // [sp+8h] [bp-21Ch] BYREF
size_t v18; // [sp+Ch] [bp-218h]
unsigned __int8 v19[12]; // [sp+10h] [bp-214h] BYREF
unsigned int v20[3]; // [sp+1Ch] [bp-208h] BYREF
char v21; // [sp+28h] [bp-1FCh] BYREF
v7 = a3;
if ( !a3 )
v7 = *(unsigned __int8 *)(a2 + 902);
v20[0] = 0;
v20[1] = 500;
v20[2] = (unsigned int)&v21;
if ( v7 )
{
MainColorMode = GameObject::getMainColorMode((GameObject *)a2);
fmt::BasicWriter::operator<<(v20, (int)MainColorMode);
if ( *(_BYTE *)(*(_DWORD *)(a2 + 960) + 32) )
{
v17 = ".";
v18 = 0;
fmt::BasicWriter::operator<<(v20, ".", 0);
fmt::BasicWriter::operator<<((int)v20);
fmt::BasicWriter::operator<<((int)v20);
fmt::BasicWriter::operator<<((int)v20);
fmt::BasicWriter::operator<<(v20, *(unsigned __int8 *)(*(_DWORD *)(a2 + 960) + 28));
fmt::BasicWriter::operator<<(v20, *(unsigned __int8 *)(*(_DWORD *)(a2 + 960) + 29));
}
if ( *(_BYTE *)(a2 + 902) )
{
v17 = "d";
v18 = 0;
fmt::BasicWriter::operator<<(v20, "d", 0);
}
}
else
{
SecondaryColorMode = GameObject::getSecondaryColorMode((GameObject *)a2);
fmt::BasicWriter::operator<<(v20, (int)SecondaryColorMode);
if ( SecondaryColorMode == (GJSpriteColor *)&stru_3EC.st_size )
{
v17 = ".";
v18 = 0;
fmt::BasicWriter::operator<<(v20, ".", 0);
GameObject::getColorKey((GameObject *)v19, a2, 1);
fmt::BasicStringRef::BasicStringRef((unsigned __int8 **)&v17, v19);
fmt::BasicWriter::operator<<(v20, v17, v18);
std::string::~string((int)v19);
}
v10 = *(_DWORD *)(a2 + 964);
if ( v10 && *(_BYTE *)(v10 + 32) )
{
v17 = ".";
v18 = 0;
fmt::BasicWriter::operator<<(v20, ".", 0);
fmt::BasicWriter::operator<<((int)v20);
fmt::BasicWriter::operator<<((int)v20);
fmt::BasicWriter::operator<<((int)v20);
fmt::BasicWriter::operator<<(v20, *(unsigned __int8 *)(*(_DWORD *)(a2 + 964) + 28));
fmt::BasicWriter::operator<<(v20, *(unsigned __int8 *)(*(_DWORD *)(a2 + 964) + 29));
}
}
v17 = ".";
v18 = 0;
fmt::BasicWriter::operator<<(v20, ".", 0);
if ( a4 )
{
for ( i = 0; i < *(__int16 *)(a2 + 1028); ++i )
{
fmt::BasicWriter::operator<<(v20, *(__int16 *)(*(_DWORD *)(a2 + 1024) + 2 * i));
v17 = ".";
v18 = 0;
fmt::BasicWriter::operator<<(v20, ".", 0);
}
}
else
{
while ( a4 < *(__int16 *)(a2 + 1020) )
{
GroupID = GameObject::getGroupID((GameObject *)a2, a4);
fmt::BasicWriter::operator<<(v20, GroupID);
v17 = ".";
v18 = 0;
fmt::BasicWriter::operator<<(v20, ".", 0);
++a4;
}
}
v17 = ".";
v18 = 0;
fmt::BasicWriter::operator<<(v20, ".", 0);
fmt::BasicWriter::operator<<(v20, v7);
v13 = (const char *)fmt::BasicWriter::c_str((int *)v20);
*(_DWORD *)this = 0;
*((_DWORD *)this + 1) = 0;
v14 = v13;
*((_DWORD *)this + 2) = 0;
v15 = strlen(v13);
std::string::__init((int *)this, v14, v15);
fmt::internal::Array::free((int)v20);
return this;
}