{"type": "func", "start": 5370853408, "end": 5370854100, "name": "GJBaseGameLayer::createBackground", "pseudocode": "// \n// GJBaseGameLayer::createBackground from 0x14020b820 to 0x14020bad4 (692 bytes)\n// \n// 7 xrefs:\n// > GameManager::finishedLoadingBGAsync @ 0x140182990\n// > GJBaseGameLayer::syncBGTextures @ 0x14023afc3\n// > LevelEditorLayer::init @ 0x1402d2b9f\n// > LevelSettingsLayer::selectArtClosed @ 0x140321f3d\n// > PlayLayer::setupHasCompleted @ 0x1403a6a59\n// > ArtTriggerGameObject::triggerObject @ 0x1404c2721\n// > <???> @ 0x1406ccd08\n// \n// This function is hookable on this platform!\n// \n// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings\n// \n\n// Hidden C++ exception states: #wind=1\nvoid GJBaseGameLayer::createBackground(GJBaseGameLayer *a1, int a2)\n{\n  int v2; // edi\n  cocos2d::CCSprite *m_background; // rcx\n  cocos2d::CCSprite *v5; // rcx\n  int v6; // ebp\n  char v7; // r14\n  GameManager *v8; // rcx\n  int v9; // ebx\n  cocos2d::CCString *v10; // rax\n  const char *CString; // rax\n  cocos2d::CCSprite *v12; // rax\n  GLuint v13; // eax\n  cocos2d::CCTexture2D *v14; // rax\n  float v15; // xmm0_4\n  cocos2d::CCSprite_vtbl *v16; // rbx\n  const cocos2d::CCPoint *v17; // rax\n  __int64 v18; // rdx\n  __int64 v19; // rcx\n  __int64 v20; // rcx\n  cocos2d::CCDirector *v21; // rax\n  float v22; // xmm0_4\n  __int16 v23; // [rsp+20h] [rbp-58h] BYREF\n  char v24; // [rsp+22h] [rbp-56h]\n  __int64 v25; // [rsp+28h] [rbp-50h]\n  cocos2d::CCRect v26; // [rsp+30h] [rbp-48h] BYREF\n  struct cocos2d::_ccTexParams v27; // [rsp+40h] [rbp-38h] BYREF\n\n  v2 = a2;\n  m_background = a1->m_background;\n  if ( !m_background || m_background->getTag(m_background) != a2 )\n  {\n    v5 = a1->m_background;\n    if ( v5 )\n    {\n      v5->removeFromParent(v5);\n      a1->m_background = nullptr;\n    }\n    v6 = 59;\n    if ( v2 > 59 )\n      v2 = 59;\n    v7 = 1;\n    switch ( v2 )\n    {\n      case 16:\n      case 35:\n      case 37:\n      case 40:\n      case 41:\n      case 42:\n      case 43:\n      case 44:\n      case 45:\n      case 46:\n      case 47:\n      case 48:\n      case 49:\n      case 50:\n      case 51:\n      case 53:\n      case 54:\n      case 55:\n      case 56:\n      case 57:\n      case 58:\n      case 59:\n        v7 = 0;\n        break;\n      default:\n        break;\n    }\n    v8 = (GameManager *)qword_1406C2ED8;\n    if ( !qword_1406C2ED8 )\n    {\n      v25 = (__int64)operator new(0x668u);\n      qword_1406C2ED8 = sub_14017AB00(v25);\n      (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);\n      v8 = (GameManager *)qword_1406C2ED8;\n    }\n    if ( v2 < 59 )\n      v6 = v2;\n    v9 = 1;\n    if ( v6 > 1 )\n      v9 = v6;\n    GameManager::loadBackground(v8, v9);\n    v10 = cocos2d::CCString::createWithFormat(\"game_bg_%02d_001.png\", v9);\n    CString = cocos2d::CCString::getCString(v10);\n    v12 = cocos2d::CCSprite::create(CString);\n    a1->m_background = v12;\n    v12->setTag(v12, v2);\n    v27.minFilter = 9729;\n    v27.magFilter = 9729;\n    v13 = 10497;\n    v27.wrapS = 10497;\n    if ( v7 )\n      v13 = 33648;\n    v27.wrapT = v13;\n    v14 = a1->m_background->getTexture(&a1->m_background->cocos2d::CCTextureProtocol);\n    cocos2d::CCTexture2D::setTexParameters(v14, &v27);\n    v15 = ((float (__fastcall *)(cocos2d::CCNode *, cocos2d::CCSprite *, __int64))a1->m_objectParent->addChild_0)(\n            a1->m_objectParent,\n            a1->m_background,\n            4294967236LL);\n    v16 = a1->m_background->__vftable;\n    cocos2d::CCPoint::CCPoint(v15, 0.0);\n    v16->setAnchorPoint(a1->m_background, v17);\n    cocos2d::CCApplication::sharedApplication(v19, v18);\n    v21 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v20);\n    cocos2d::CCDirector::getScreenScaleFactorMax(v21);\n    ((void (__fastcall *)(cocos2d::CCSprite *))a1->m_background->setScale_0)(a1->m_background);\n    v25 = 1;\n    ((void (__fastcall *)(cocos2d::CCTextureProtocol *, __int64))a1->m_background->setBlendFunc)(\n      &a1->m_background->cocos2d::CCTextureProtocol,\n      1);\n    v23 = 32040;\n    v24 = -1;\n    a1->m_background->setColor(&a1->m_background->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v23);\n    cocos2d::CCRect::CCRect(&v26, &a1->m_background->m_obRect);\n    v22 = a1->m_background->getScale(a1->m_background);\n    a1->m_gameState.m_unkFloat10 = v22 * v26.size.width;\n  }\n}", "assembly": "; \n; GJBaseGameLayer::createBackground from 0x14020b820 to 0x14020bad4 (692 bytes)\n; \n; 7 xrefs:\n; > GameManager::finishedLoadingBGAsync @ 0x140182990\n; > GJBaseGameLayer::syncBGTextures @ 0x14023afc3\n; > LevelEditorLayer::init @ 0x1402d2b9f\n; > LevelSettingsLayer::selectArtClosed @ 0x140321f3d\n; > PlayLayer::setupHasCompleted @ 0x1403a6a59\n; > ArtTriggerGameObject::triggerObject @ 0x1404c2721\n; > <???> @ 0x1406ccd08\n; \n; This function is hookable on this platform!\n; \n; Using BromaIDA 8.0.0 @ https:;github.com/Stazzical/BromaIDA\n; Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https:;github.com/geode-sdk/bindings\n; \n\nmov     [rsp+arg_10], rbx                                              ; +0x0, 0x14020b820\nmov     [rsp+arg_18], rbp                                              ; +0x5, 0x14020b825\npush    rsi                                                            ; +0xa, 0x14020b82a\npush    rdi                                                            ; +0xb, 0x14020b82b\npush    r14                                                            ; +0xc, 0x14020b82c\nsub     rsp, 60h                                                       ; +0xe, 0x14020b82e\nmov     rax, cs:__security_cookie                                      ; +0x12, 0x14020b832\nxor     rax, rsp                                                       ; +0x19, 0x14020b839\nmov     [rsp+78h+var_28], rax                                          ; +0x1c, 0x14020b83c\nmov     edi, edx                                                       ; +0x21, 0x14020b841\nmov     rsi, rcx                                                       ; +0x23, 0x14020b843\nmov     rcx, [rcx+1000h]                                               ; +0x26, 0x14020b846\ntest    rcx, rcx                                                       ; +0x2d, 0x14020b84d\njz      short loc_14020B860                                            ; +0x30, 0x14020b850\nmov     rax, [rcx]                                                     ; +0x32, 0x14020b852\ncall    qword ptr [rax+38h]                                            ; +0x35, 0x14020b855\ncmp     eax, edi                                                       ; +0x38, 0x14020b858\njz      loc_14020BA7B                                                  ; +0x3a, 0x14020b85a\nmov     rcx, [rsi+1000h]                                               ; +0x40, 0x14020b860\ntest    rcx, rcx                                                       ; +0x47, 0x14020b867\njz      short loc_14020B880                                            ; +0x4a, 0x14020b86a\nmov     rax, [rcx]                                                     ; +0x4c, 0x14020b86c\ncall    qword ptr [rax+1F0h]                                           ; +0x4f, 0x14020b86f\nmov     qword ptr [rsi+1000h], 0                                       ; +0x55, 0x14020b875\nmov     ebp, 3Bh ; ';'                                                 ; +0x60, 0x14020b880\ncmp     edi, ebp                                                       ; +0x65, 0x14020b885\ncmovg   edi, ebp                                                       ; +0x67, 0x14020b887\nmov     r14b, 1                                                        ; +0x6a, 0x14020b88a\nlea     eax, [rdi-10h]; switch 44 cases                                ; +0x6d, 0x14020b88d\ncmp     eax, 2Bh                                                       ; +0x70, 0x14020b890\nja      short def_14020B8B0; jumptable 000000014020B8B0 default case, cases 17-34,36,38,39,52 ; +0x73, 0x14020b893\ncdqe                                                                   ; +0x75, 0x14020b895\nlea     rdx, cs:140000000h                                             ; +0x77, 0x14020b897\nmovzx   eax, ds:(byte_14020BAA8 - 140000000h)[rdx+rax]                 ; +0x7e, 0x14020b89e\nmov     ecx, ds:(jpt_14020B8B0 - 140000000h)[rdx+rax*4]                ; +0x86, 0x14020b8a6\nadd     rcx, rdx                                                       ; +0x8d, 0x14020b8ad\njmp     rcx; switch jump                                               ; +0x90, 0x14020b8b0\nxor     r14b, r14b; jumptable 000000014020B8B0 cases 16,35,37,40-51,53-59 ; +0x92, 0x14020b8b2\nmov     rcx, cs:qword_1406C2ED8; jumptable 000000014020B8B0 default case, cases 17-34,36,38,39,52 ; +0x95, 0x14020b8b5\ntest    rcx, rcx                                                       ; +0x9c, 0x14020b8bc\njnz     short loc_14020B8F0                                            ; +0x9f, 0x14020b8bf\nmov     ecx, 668h; Size                                                ; +0xa1, 0x14020b8c1\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0xa6, 0x14020b8c6\nmov     [rsp+78h+var_50], rax                                          ; +0xab, 0x14020b8cb\nmov     rcx, rax                                                       ; +0xb0, 0x14020b8d0\ncall    sub_14017AB00                                                  ; +0xb3, 0x14020b8d3\nnop                                                                    ; +0xb8, 0x14020b8d8\nmov     cs:qword_1406C2ED8, rax                                        ; +0xb9, 0x14020b8d9\nmov     rdx, [rax]                                                     ; +0xc0, 0x14020b8e0\nmov     rcx, rax                                                       ; +0xc3, 0x14020b8e3\ncall    qword ptr [rdx+48h]                                            ; +0xc6, 0x14020b8e6\nmov     rcx, cs:qword_1406C2ED8                                        ; +0xc9, 0x14020b8e9\ncmp     edi, 3Bh ; ';'                                                 ; +0xd0, 0x14020b8f0\ncmovl   ebp, edi                                                       ; +0xd3, 0x14020b8f3\nmov     ebx, 1                                                         ; +0xd6, 0x14020b8f6\ncmp     ebp, ebx                                                       ; +0xdb, 0x14020b8fb\ncmovg   ebx, ebp                                                       ; +0xdd, 0x14020b8fd\nmov     edx, ebx                                                       ; +0xe0, 0x14020b900\ncall    GameManager__loadBackground                                    ; +0xe2, 0x14020b902\nmov     edx, ebx                                                       ; +0xe7, 0x14020b907\nlea     rcx, aGameBg02d001Pn; \"game_bg_%02d_001.png\"                   ; +0xe9, 0x14020b909\ncall    cs:?createWithFormat@CCString@cocos2d@@SAPEAV12@PEBDZZ; cocos2d::CCString::createWithFormat(char const *,...) ; +0xf0, 0x14020b910\nmov     rcx, rax                                                       ; +0xf6, 0x14020b916\ncall    cs:?getCString@CCString@cocos2d@@QEBAPEBDXZ; cocos2d::CCString::getCString(void) ; +0xf9, 0x14020b919\nmov     rcx, rax                                                       ; +0xff, 0x14020b91f\ncall    cs:?create@CCSprite@cocos2d@@SAPEAV12@PEBD@Z; cocos2d::CCSprite::create(char const *) ; +0x102, 0x14020b922\nmov     [rsi+1000h], rax                                               ; +0x108, 0x14020b928\nmov     r8, [rax]                                                      ; +0x10f, 0x14020b92f\nmov     edx, edi                                                       ; +0x112, 0x14020b932\nmov     rcx, rax                                                       ; +0x114, 0x14020b934\ncall    qword ptr [r8+40h]                                             ; +0x117, 0x14020b937\nmov     [rsp+78h+var_38], 2601h                                        ; +0x11b, 0x14020b93b\nmov     [rsp+78h+var_34], 2601h                                        ; +0x123, 0x14020b943\nmov     eax, 2901h                                                     ; +0x12b, 0x14020b94b\nmov     [rsp+78h+var_30], eax                                          ; +0x130, 0x14020b950\nmov     ecx, 8370h                                                     ; +0x134, 0x14020b954\ntest    r14b, r14b                                                     ; +0x139, 0x14020b959\ncmovnz  eax, ecx                                                       ; +0x13c, 0x14020b95c\nmov     [rsp+78h+var_2C], eax                                          ; +0x13f, 0x14020b95f\nmov     rcx, [rsi+1000h]                                               ; +0x143, 0x14020b963\nadd     rcx, 158h                                                      ; +0x14a, 0x14020b96a\nmov     rax, [rcx]                                                     ; +0x151, 0x14020b971\ncall    qword ptr [rax+10h]                                            ; +0x154, 0x14020b974\nmov     rcx, rax                                                       ; +0x157, 0x14020b977\nlea     rdx, [rsp+78h+var_38]                                          ; +0x15a, 0x14020b97a\ncall    cs:?setTexParameters@CCTexture2D@cocos2d@@QEAAXPEAU_ccTexParams@2@@Z; cocos2d::CCTexture2D::setTexParameters(cocos2d::_ccTexParams *) ; +0x15f, 0x14020b97f\nmov     rcx, [rsi+0FD0h]                                               ; +0x165, 0x14020b985\nmov     rax, [rcx]                                                     ; +0x16c, 0x14020b98c\nmov     r8d, 0FFFFFFC4h                                                ; +0x16f, 0x14020b98f\nmov     rdx, [rsi+1000h]                                               ; +0x175, 0x14020b995\ncall    qword ptr [rax+1B8h]                                           ; +0x17c, 0x14020b99c\nmov     rax, [rsi+1000h]                                               ; +0x182, 0x14020b9a2\nmov     rbx, [rax]                                                     ; +0x189, 0x14020b9a9\nxorps   xmm2, xmm2                                                     ; +0x18c, 0x14020b9ac\nxorps   xmm1, xmm1                                                     ; +0x18f, 0x14020b9af\nlea     rcx, [rsp+78h+var_50]                                          ; +0x192, 0x14020b9b2\ncall    cs:??0CCPoint@cocos2d@@QEAA@MM@Z; cocos2d::CCPoint::CCPoint(float,float) ; +0x197, 0x14020b9b7\nmov     rdx, rax                                                       ; +0x19d, 0x14020b9bd\nmov     rcx, [rsi+1000h]                                               ; +0x1a0, 0x14020b9c0\ncall    qword ptr [rbx+110h]                                           ; +0x1a7, 0x14020b9c7\ncall    cs:?sharedApplication@CCApplication@cocos2d@@SAPEAV12@XZ; cocos2d::CCApplication::sharedApplication(void) ; +0x1ad, 0x14020b9cd\ncall    cs:?sharedDirector@CCDirector@cocos2d@@SAPEAV12@XZ; cocos2d::CCDirector::sharedDirector(void) ; +0x1b3, 0x14020b9d3\nmov     rcx, rax                                                       ; +0x1b9, 0x14020b9d9\ncall    cs:?getScreenScaleFactorMax@CCDirector@cocos2d@@QEAAMXZ; cocos2d::CCDirector::getScreenScaleFactorMax(void) ; +0x1bc, 0x14020b9dc\nmov     rcx, [rsi+1000h]                                               ; +0x1c2, 0x14020b9e2\nmov     rax, [rcx]                                                     ; +0x1c9, 0x14020b9e9\nmovaps  xmm1, xmm0                                                     ; +0x1cc, 0x14020b9ec\ncall    qword ptr [rax+0A0h]                                           ; +0x1cf, 0x14020b9ef\nmov     [rsp+78h+var_50], 1                                            ; +0x1d5, 0x14020b9f5\nmov     rcx, [rsi+1000h]                                               ; +0x1de, 0x14020b9fe\nadd     rcx, 158h                                                      ; +0x1e5, 0x14020ba05\nmov     rax, [rcx]                                                     ; +0x1ec, 0x14020ba0c\nmov     rdx, [rsp+78h+var_50]                                          ; +0x1ef, 0x14020ba0f\ncall    qword ptr [rax]                                                ; +0x1f4, 0x14020ba14\nmov     [rsp+78h+var_58], 7D28h                                        ; +0x1f6, 0x14020ba16\nmovzx   eax, [rsp+78h+var_58]                                          ; +0x1fd, 0x14020ba1d\nmov     [rsp+78h+var_58], ax                                           ; +0x202, 0x14020ba22\nmov     [rsp+78h+var_56], 0FFh                                         ; +0x207, 0x14020ba27\nmov     rcx, [rsi+1000h]                                               ; +0x20c, 0x14020ba2c\nadd     rcx, 140h                                                      ; +0x213, 0x14020ba33\nmov     rax, [rcx]                                                     ; +0x21a, 0x14020ba3a\nlea     rdx, [rsp+78h+var_58]                                          ; +0x21d, 0x14020ba3d\ncall    qword ptr [rax]                                                ; +0x222, 0x14020ba42\nmov     rdx, [rsi+1000h]                                               ; +0x224, 0x14020ba44\nadd     rdx, 1A8h                                                      ; +0x22b, 0x14020ba4b\nlea     rcx, [rsp+78h+var_48]                                          ; +0x232, 0x14020ba52\ncall    cs:??0CCRect@cocos2d@@QEAA@AEBV01@@Z; cocos2d::CCRect::CCRect(cocos2d::CCRect const &) ; +0x237, 0x14020ba57\nmov     rcx, [rsi+1000h]                                               ; +0x23d, 0x14020ba5d\nmov     rax, [rcx]                                                     ; +0x244, 0x14020ba64\ncall    qword ptr [rax+0A8h]                                           ; +0x247, 0x14020ba67\nmulss   xmm0, [rsp+78h+var_40]                                         ; +0x24d, 0x14020ba6d\nmovss   dword ptr [rsi+4E4h], xmm0                                     ; +0x253, 0x14020ba73\nmov     rcx, [rsp+78h+var_28]                                          ; +0x25b, 0x14020ba7b\nxor     rcx, rsp; StackCookie                                          ; +0x260, 0x14020ba80\ncall    __security_check_cookie                                        ; +0x263, 0x14020ba83\nlea     r11, [rsp+78h+var_18]                                          ; +0x268, 0x14020ba88\nmov     rbx, [r11+30h]                                                 ; +0x26d, 0x14020ba8d\nmov     rbp, [r11+38h]                                                 ; +0x271, 0x14020ba91\nmov     rsp, r11                                                       ; +0x275, 0x14020ba95\npop     r14                                                            ; +0x278, 0x14020ba98\npop     rdi                                                            ; +0x27a, 0x14020ba9a\npop     rsi                                                            ; +0x27b, 0x14020ba9b\nretn                                                                   ; +0x27c, 0x14020ba9c\nalign 20h                                                              ; +0x27d, 0x14020ba9d\ndd offset loc_14020B8B2 - 140000000h; jump table for switch statement  ; +0x280, 0x14020baa0\ndb      0,     1,     1,     1; indirect table for switch statement    ; +0x288, 0x14020baa8", "xrefs": ["GameManager::finishedLoadingBGAsync @ 0x140182990", "GJBaseGameLayer::syncBGTextures @ 0x14023afc3", "LevelEditorLayer::init @ 0x1402d2b9f", "LevelSettingsLayer::selectArtClosed @ 0x140321f3d", "PlayLayer::setupHasCompleted @ 0x1403a6a59", "ArtTriggerGameObject::triggerObject @ 0x1404c2721", "<???> @ 0x1406ccd08"], "is_objc": false, "is_arm32": false, "is_arm64": false, "bida_info": "8.0.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings"}