{"type": "func", "start": 4300231888, "end": 4300232320, "name": "GJRateLevelLayer::onCustomButton", "pseudocode": "// \n// GJRateLevelLayer::onCustomButton from 0x1005054d0 to 0x100505680 (432 bytes)\n// \n// 1 xrefs:\n// > <???> @ 0x100b658d8\n// \n// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n// \n// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n// Generated at Fri, 27 Nov 2026 12:31:32 +0000\n// \n\nvoid __fastcall GJRateLevelLayer::onCustomButton(__int64 a1, __int64 a2, double a3)\n{\n  int v3; // eax\n  __int64 *v4; // r14\n  __int64 v5; // rax\n  __int64 v6; // rax\n  _QWORD v7[2]; // [rsp+8h] [rbp-48h] BYREF\n  void *__p; // [rsp+18h] [rbp-38h]\n  __int128 v9[3]; // [rsp+20h] [rbp-30h] BYREF\n\n  v3 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 64LL))(a2);\n  if ( v3 != -4 )\n  {\n    if ( v3 != -2 )\n      return;\n    __p = operator new(0x28u);\n    v7[0] = 41;\n    v7[1] = 33;\n    strcpy((char *)__p, \"Do you want to unrate this level?\");\n    v4 = (__int64 *)FLAlertLayer::create_1(\n                      (int)a1 + 1040,\n                      (int)\"Unrate Level\",\n                      (__int64)v7,\n                      (int)\"Cancel\",\n                      (int)\"Unrate\",\n                      380.0);\n    if ( (v7[0] & 1) != 0 )\n      operator delete(__p);\n    ButtonSprite::updateBGImage(v4[77], (__int64)\"GJ_button_06.png\");\n    (*(void (__fastcall **)(__int64 *, __int64))(*v4 + 72))(v4, 4294967293LL);\n    goto LABEL_6;\n  }\n  *(float *)&a3 = (*(float (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1464LL))(a1, 0xFFFFFFFFLL);\n  if ( (int)*(float *)&a3 > 0 && *(int *)(a1 + 1112) > 0 )\n  {\n    v5 = GameLevelManager::sharedState(a3);\n    if ( (unsigned __int8)sub_100579B30(\n                            v5,\n                            (unsigned int)(*(_DWORD *)(*(_QWORD *)(a1 + 1048) + 328LL)\n                                         - *(_DWORD *)(*(_QWORD *)(a1 + 1048) + 332LL)),\n                            (unsigned int)(int)*(float *)&a3) )\n    {\n      *(_QWORD *)(GameLevelManager::sharedState(a3) + 1360) = a1 + 1024;\n      v6 = *(_QWORD *)(a1 + 1096);\n      if ( v6 )\n        *(_QWORD *)(v6 + 664) = 0;\n      strcpy((char *)v9, \" Updating rank...\");\n      v4 = (__int64 *)UploadActionPopup::create(a1 + 1016, v9);\n      *(_QWORD *)(a1 + 1096) = v4;\n      if ( (v9[0] & 1) != 0 )\n      {\n        operator delete(*(void **)&v9[1]);\n        v4 = *(__int64 **)(a1 + 1096);\n      }\nLABEL_6:\n      (*(void (__fastcall **)(__int64 *))(*v4 + 1312))(v4);\n    }\n  }\n}", "assembly": "; \n; GJRateLevelLayer::onCustomButton from 0x1005054d0 to 0x100505680 (432 bytes)\n; \n; 1 xrefs:\n; > <???> @ 0x100b658d8\n; \n; This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n; \n; Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n; Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n; Generated at Fri, 27 Nov 2026 12:31:32 +0000\n; \npush    rbp                                                            ; +0x0, 0x1005054d0\nmov     rbp, rsp                                                       ; +0x1, 0x1005054d1\npush    r15                                                            ; +0x4, 0x1005054d4\npush    r14                                                            ; +0x6, 0x1005054d6\npush    rbx                                                            ; +0x8, 0x1005054d8\nsub     rsp, 38h                                                       ; +0x9, 0x1005054d9\nmov     rbx, rdi                                                       ; +0xd, 0x1005054dd\nmov     rax, [rsi]                                                     ; +0x10, 0x1005054e0\nmov     rdi, rsi                                                       ; +0x13, 0x1005054e3\ncall    qword ptr [rax+40h]                                            ; +0x16, 0x1005054e6\ncmp     eax, 0FFFFFFFCh                                                ; +0x19, 0x1005054e9\njz      loc_1005055AC                                                  ; +0x1c, 0x1005054ec\ncmp     eax, 0FFFFFFFEh                                                ; +0x22, 0x1005054f2\njnz     loc_100505675                                                  ; +0x25, 0x1005054f5\nadd     rbx, 410h                                                      ; +0x2b, 0x1005054fb\nmov     edi, 28h ; '('; __sz                                           ; +0x32, 0x100505502\ncall    __Znwm; operator new(ulong)                                    ; +0x37, 0x100505507\nlea     r15, [rbp+__p]                                                 ; +0x3c, 0x10050550c\nmov     [rbp+__p], rax                                                 ; +0x40, 0x100505510\nmov     [rbp+var_48], 29h ; ')'                                        ; +0x44, 0x100505514\nmov     [rbp+var_40], 21h ; '!'                                        ; +0x4c, 0x10050551c\nmovups  xmm0, xmmword ptr cs:aDoYouWantToUnr+10h; \"nrate this level?\"  ; +0x54, 0x100505524\nmovups  xmmword ptr [rax+10h], xmm0                                    ; +0x5b, 0x10050552b\nmovups  xmm0, xmmword ptr cs:aDoYouWantToUnr; \"Do you want to unrate this level?\" ; +0x5f, 0x10050552f\nmovups  xmmword ptr [rax], xmm0                                        ; +0x66, 0x100505536\nmov     word ptr [rax+20h], 3Fh ; '?'                                  ; +0x69, 0x100505539\nlea     rsi, aUnrateLevel; \"Unrate Level\"                              ; +0x6f, 0x10050553f\nlea     rcx, aCancel; \"Cancel\"                                         ; +0x76, 0x100505546\nlea     r8, aUnrate; \"Unrate\"                                          ; +0x7d, 0x10050554d\nlea     rdx, [rbp+var_48]                                              ; +0x84, 0x100505554\nmovss   xmm0, cs:dword_100A03824                                       ; +0x88, 0x100505558\nmov     rdi, rbx                                                       ; +0x90, 0x100505560\ncall    FLAlertLayer__create_1                                         ; +0x93, 0x100505563\nmov     r14, rax                                                       ; +0x98, 0x100505568\ntest    byte ptr [rbp+var_48], 1                                       ; +0x9b, 0x10050556b\njz      short loc_10050557A                                            ; +0x9f, 0x10050556f\nmov     rdi, [rbp+__p]; __p                                            ; +0xa1, 0x100505571\ncall    __ZdlPv; operator delete(void *)                               ; +0xa5, 0x100505575\nmov     rdi, [r14+268h]                                                ; +0xaa, 0x10050557a\nlea     rsi, aGjButton06Png; \"GJ_button_06.png\"                        ; +0xb1, 0x100505581\ncall    ButtonSprite__updateBGImage                                    ; +0xb8, 0x100505588\nmov     rax, [r14]                                                     ; +0xbd, 0x10050558d\nmov     rdi, r14                                                       ; +0xc0, 0x100505590\nmov     esi, 0FFFFFFFDh                                                ; +0xc3, 0x100505593\ncall    qword ptr [rax+48h]                                            ; +0xc8, 0x100505598\nmov     rax, [r14]                                                     ; +0xcb, 0x10050559b\nmov     rdi, r14                                                       ; +0xce, 0x10050559e\ncall    qword ptr [rax+520h]                                           ; +0xd1, 0x1005055a1\njmp     loc_100505675                                                  ; +0xd7, 0x1005055a7\nmov     rax, [rbx]                                                     ; +0xdc, 0x1005055ac\nmov     rdi, rbx                                                       ; +0xdf, 0x1005055af\nmov     esi, 0FFFFFFFFh                                                ; +0xe2, 0x1005055b2\ncall    qword ptr [rax+5B8h]                                           ; +0xe7, 0x1005055b7\ncvttss2si r14d, xmm0                                                   ; +0xed, 0x1005055bd\ntest    r14d, r14d                                                     ; +0xf2, 0x1005055c2\njle     loc_100505675                                                  ; +0xf5, 0x1005055c5\ncmp     dword ptr [rbx+458h], 0                                        ; +0xfb, 0x1005055cb\njle     loc_100505675                                                  ; +0x102, 0x1005055d2\ncall    GameLevelManager__sharedState                                  ; +0x108, 0x1005055d8\nmov     rcx, [rbx+418h]                                                ; +0x10d, 0x1005055dd\nmov     esi, [rcx+148h]                                                ; +0x114, 0x1005055e4\nsub     esi, [rcx+14Ch]                                                ; +0x11a, 0x1005055ea\nmov     rdi, rax                                                       ; +0x120, 0x1005055f0\nmov     edx, r14d                                                      ; +0x123, 0x1005055f3\ncall    sub_100579B30                                                  ; +0x126, 0x1005055f6\ntest    al, al                                                         ; +0x12b, 0x1005055fb\njz      short loc_100505675                                            ; +0x12d, 0x1005055fd\ncall    GameLevelManager__sharedState                                  ; +0x12f, 0x1005055ff\nlea     rcx, [rbx+400h]                                                ; +0x134, 0x100505604\nmov     [rax+550h], rcx                                                ; +0x13b, 0x10050560b\nmov     rax, [rbx+448h]                                                ; +0x142, 0x100505612\ntest    rax, rax                                                       ; +0x149, 0x100505619\njz      short loc_100505629                                            ; +0x14c, 0x10050561c\nmov     qword ptr [rax+298h], 0                                        ; +0x14e, 0x10050561e\nlea     rdi, [rbx+3F8h]                                                ; +0x159, 0x100505629\nmov     [rbp+var_30], 20h ; ' '                                        ; +0x160, 0x100505630\nmovups  xmm0, xmmword ptr cs:aUpdatingRank; \"Updating rank...\"         ; +0x164, 0x100505634\nmovups  xmmword ptr [rbp+var_30+1], xmm0                               ; +0x16b, 0x10050563b\nmov     [rbp+var_30+11h], 0                                            ; +0x16f, 0x10050563f\nlea     rsi, [rbp+var_30]                                              ; +0x173, 0x100505643\ncall    UploadActionPopup__create                                      ; +0x177, 0x100505647\nmov     r14, rax                                                       ; +0x17c, 0x10050564c\nmov     [rbx+448h], rax                                                ; +0x17f, 0x10050564f\ntest    [rbp+var_30], 1                                                ; +0x186, 0x100505656\njz      loc_10050559B                                                  ; +0x18a, 0x10050565a\nmov     rdi, qword ptr [rbp+var_30+10h]; __p                           ; +0x190, 0x100505660\ncall    __ZdlPv; operator delete(void *)                               ; +0x194, 0x100505664\nmov     r14, [rbx+448h]                                                ; +0x199, 0x100505669\njmp     loc_10050559B                                                  ; +0x1a0, 0x100505670\nadd     rsp, 38h                                                       ; +0x1a5, 0x100505675\npop     rbx                                                            ; +0x1a9, 0x100505679\npop     r14                                                            ; +0x1aa, 0x10050567a\npop     r15                                                            ; +0x1ac, 0x10050567c\npop     rbp                                                            ; +0x1ae, 0x10050567e\nretn                                                                   ; +0x1af, 0x10050567f", "xrefs": ["<???> @ 0x100b658d8"], "is_objc": false, "is_32_bit": false, "is_64_bit": true, "idp_name": "pc", "bida_info": "8.3.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings"}