//
// KeybindingsLayer::init from 0x1402bf990 to 0x1402c029a (2314 bytes)
//
// 5 xrefs:
// > KeybindingsLayer::create @ 0x1402bf957
// > KeybindingsLayer::create @ 0x1402bf95e
// > KeybindingsLayer::create @ 0x1402bf948
// > ??> @ 0x140581fd8
// > ??> @ 0x1406d2930
//
// 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
//
bool KeybindingsLayer::init(KeybindingsLayer *a1)
{
bool result; // al
__int64 v3; // rcx
cocos2d::CCDirector *v4; // rax
struct cocos2d::CCRect *v5; // rax
struct cocos2d::extension::CCScale9Sprite *v6; // rdi
cocos2d::extension::CCScale9Sprite_vtbl *v7; // rbx
const cocos2d::CCSize *v8; // rax
float v9; // xmm0_4
cocos2d::extension::CCScale9Sprite_vtbl *v10; // rbx
double v11; // xmm0_8
const cocos2d::CCPoint *v12; // rax
struct cocos2d::CCLabelBMFont *v13; // rsi
cocos2d::CCLabelBMFont_vtbl *v14; // rbx
const cocos2d::CCPoint *v15; // rax
double v16; // xmm0_8
struct cocos2d::CCLabelBMFont *v17; // rdi
__int64 v18; // rax
__int64 v19; // rcx
cocos2d::CCDictionary *v20; // rax
__int64 v21; // rcx
cocos2d::CCDictionary *v22; // rax
__int64 v23; // rcx
cocos2d::CCMenu *v24; // rax
cocos2d::CCLayer *m_mainLayer; // rcx
cocos2d::CCLabelBMFont *v26; // rax
cocos2d::CCLabelBMFont *v27; // rax
struct cocos2d::CCSprite *v28; // rax
CCMenuItemSpriteExtra *v29; // rdi
float v30; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v31; // rbx
struct cocos2d::CCPoint v32; // rax
struct cocos2d::CCSprite *v33; // rax
CCMenuItemSpriteExtra *v34; // rax
cocos2d::CCMenu *m_buttonMenu; // rcx
CCMenuItemSpriteExtra_vtbl *v36; // rbx
__int64 v37; // rcx
cocos2d::CCDirector *v38; // rax
float v39; // xmm0_4
struct cocos2d::CCPoint v40; // rax
cocos2d::CCSprite *v41; // rbx
CCMenuItemSpriteExtra *v42; // rax
cocos2d::CCMenu *v43; // rcx
CCMenuItemSpriteExtra_vtbl *v44; // rbx
__int64 v45; // rcx
cocos2d::CCDirector *v46; // rax
float v47; // xmm0_4
struct cocos2d::CCPoint v48; // rax
cocos2d::CCRect v49; // [rsp+30h] [rbp-48h] BYREF
float v50; // [rsp+88h] [rbp+10h]
cocos2d::CCSize v51; // [rsp+90h] [rbp+18h] BYREF
struct cocos2d::CCPoint v52; // [rsp+98h] [rbp+20h] BYREF
result = FLAlertLayer::init_1(a1, 75);
if ( result )
{
v4 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v3);
cocos2d::CCDirector::getWinSize(v4);
cocos2d::CCRect::CCRect(&v49, 0.0, 0.0, 80.0, 80.0);
v6 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v5);
v7 = v6->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCSize::CCSize(&v51, 420.0, 280.0);
v7->setContentSize(v6, v8);
v9 = ((float (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v6,
0xFFFFFFFFLL);
v10 = v6->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v11 = cocos2d::CCPoint::CCPoint(v9, v50 * 0.5);
v10->setPosition_0(v6, v12);
v13 = cocos2d::CCLabelBMFont::create("Key Bindings", (const char *)&qword_14052A4D8);
v14 = v13->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(*(float *)&v11, v50 * 0.5);
v14->setPosition_0(v13, v15);
v16 = ((double (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild_1)(
a1->m_mainLayer,
v13);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v13->setScale_0)(v13);
v17 = cocos2d::CCLabelBMFont::create("(Customizing key bindings is not yet supported)", "goldFont.fnt");
cocos2d::CCPoint::CCPoint(*(float *)&v16, 0.0);
v18 = (__int64)v13->getPosition_0(v13);
cocos2d::CCPoint::operator+(v18, &v51);
v17->setPosition_0(v17, (const cocos2d::CCPoint *)&v51);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v17);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v17->setScale_0)(v17);
v20 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v19);
a1->m_variables = v20;
cocos2d::CCObject::retain(v20);
v22 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v21);
a1->m_values = v22;
cocos2d::CCObject::retain(v22);
v24 = (cocos2d::CCMenu *)cocos2d::CCMenu::create(v23);
m_mainLayer = a1->m_mainLayer;
a1->m_buttonMenu = v24;
m_mainLayer->addChild_0(m_mainLayer, v24, 10);
v26 = KeybindingsLayer::addKeyPair(a1, "Gameplay Keys", " ");
v26->setColor(&v26->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&unk_140529B04);
KeybindingsLayer::addKeyPair(a1, "Jump", "Space / Up");
KeybindingsLayer::addKeyPair(a1, "Pause", "Escape");
KeybindingsLayer::addKeyPair(a1, "Place Checkpoint", "Z");
KeybindingsLayer::addKeyPair(a1, "Delete Checkpoint", "X");
a1->m_keyCount = 7;
v27 = KeybindingsLayer::addKeyPair(a1, "Editor Keys", " ");
v27->setColor(&v27->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&unk_140529B04);
KeybindingsLayer::addKeyPair(a1, "Build Mode", (const char *)&word_140531EA4);
KeybindingsLayer::addKeyPair(a1, "Edit Mode", (const char *)&word_140531EA0);
KeybindingsLayer::addKeyPair(a1, "Delete Mode", (const char *)&word_140531E9C);
KeybindingsLayer::addKeyPair(a1, "Swipe Modifier", "Shift");
KeybindingsLayer::addKeyPair(a1, "Move Modifier", (const char *)&dword_140564844);
KeybindingsLayer::addKeyPair(a1, "Rotate CCW", "Q");
KeybindingsLayer::addKeyPair(a1, "Rotate CW", "E");
KeybindingsLayer::addKeyPair(a1, "Flip X", "Alt + Q");
KeybindingsLayer::addKeyPair(a1, "Flip Y", "Alt + E");
KeybindingsLayer::addKeyPair(a1, "Delete selected", "Delete");
KeybindingsLayer::addKeyPair(a1, "Undo", "Ctrl + Z");
KeybindingsLayer::addKeyPair(a1, "Redo", "Ctrl + Shift + Z");
KeybindingsLayer::addKeyPair(a1, "Deselect", "Alt + D");
KeybindingsLayer::addKeyPair(a1, "Copy", "Ctrl + C");
KeybindingsLayer::addKeyPair(a1, "Paste", "Ctrl + V");
KeybindingsLayer::addKeyPair(a1, "Duplicate", "Ctrl + D");
KeybindingsLayer::addKeyPair(a1, "Rotate", "R");
KeybindingsLayer::addKeyPair(a1, "Free Move", "F");
KeybindingsLayer::addKeyPair(a1, "Swipe", "T");
KeybindingsLayer::addKeyPair(a1, "Snap", "G");
KeybindingsLayer::addKeyPair(a1, "Playtest", "Enter");
KeybindingsLayer::addKeyPair(a1, "Playback music", "Ctrl + Enter");
KeybindingsLayer::addKeyPair(a1, "Next Group", "Arrow Right");
KeybindingsLayer::addKeyPair(a1, "Previous Group", "Arrow Left");
KeybindingsLayer::addKeyPair(a1, "Object Left", (const char *)&word_1405447D4);
KeybindingsLayer::addKeyPair(a1, "Object Right", "D");
KeybindingsLayer::addKeyPair(a1, "Object Up", "W");
KeybindingsLayer::addKeyPair(a1, "Object Down", "S");
KeybindingsLayer::addKeyPair(a1, "Object Left small", "Shift + A");
KeybindingsLayer::addKeyPair(a1, "Object Right small", "Shift + D");
KeybindingsLayer::addKeyPair(a1, "Object Up small", "Shift + W");
KeybindingsLayer::addKeyPair(a1, "Object Down small", "Shift + S");
KeybindingsLayer::addKeyPair(a1, "Object Down small", "Shift + S");
KeybindingsLayer::addKeyPair(a1, "Lock Preview", "F1");
KeybindingsLayer::addKeyPair(a1, "Unlock Preview", "F2");
KeybindingsLayer::addKeyPair(a1, "Preview Mode On/Off", "F3");
KeybindingsLayer::addKeyPair(a1, "Particle Icons On/Off", "F4");
KeybindingsLayer::addKeyPair(a1, "Debug Draw On/Off", "F5");
KeybindingsLayer::addKeyPair(a1, "Hide Invisible On/Off", "F6");
KeybindingsLayer::addKeyPair(a1, "Save Editor Pos", "Ctrl + 0-9");
KeybindingsLayer::addKeyPair(a1, "Load Editor Pos", "Alt + 0-9");
KeybindingsLayer::addKeyPair(a1, "Zoom", "Ctrl + ScrollWheel");
KeybindingsLayer::addKeyPair(a1, "Transform", "Ctrl + T");
v28 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v29 = CCMenuItemSpriteExtra::create(v28, nullptr, a1, (cocos2d::SEL_MenuHandler *)AudioAssetsBrowser::onClose);
HIDWORD(v29->m_pfnSelector.adj) = 1069547520;
v30 = ((float (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild_1)(
a1->m_buttonMenu,
v29);
v31 = v29->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v30, (float)((float)(v50 * 0.5) - 210.0) + 5.0);
v32 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v52);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v31->setPosition_0)(v29, v32);
v33 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v34 = CCMenuItemSpriteExtra::create(v33, nullptr, a1, (cocos2d::SEL_MenuHandler *)KeybindingsLayer::onPrevPage);
m_buttonMenu = a1->m_buttonMenu;
a1->m_prevButton = v34;
m_buttonMenu->addChild_1(m_buttonMenu, v34);
v36 = a1->m_prevButton->__vftable;
v38 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v37);
v39 = cocos2d::CCDirector::getScreenLeft(v38) + 24.0;
cocos2d::CCPoint::CCPoint(v39, v39);
v40 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v52);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v36->setPosition_0)(a1->m_prevButton, v40);
v41 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
cocos2d::CCSprite::setFlipX(v41, 1);
v42 = CCMenuItemSpriteExtra::create(v41, nullptr, a1, (cocos2d::SEL_MenuHandler *)KeybindingsLayer::onNextPage);
v43 = a1->m_buttonMenu;
a1->m_nextButton = v42;
v43->addChild_1(v43, v42);
v44 = a1->m_nextButton->__vftable;
v46 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v45);
v47 = cocos2d::CCDirector::getScreenRight(v46) - 24.0;
cocos2d::CCPoint::CCPoint(v47, v47);
v48 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v52);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v44->setPosition_0)(a1->m_nextButton, v48);
KeybindingsLayer::goToPage(a1, 0);
return 1;
}
return result;
}