{"type": "func", "start": 6442970528, "end": 6442971194, "name": "cocos2d::CCImage::_saveImageToJPG", "pseudocode": "// \n// cocos2d::CCImage::_saveImageToJPG from 0x18007eda0 to 0x18007f03a (666 bytes)\n// \n// 6 xrefs:\n// > <???> @ 0x180145440\n// > <???> @ 0x180145474\n// > <???> @ 0x18014548c\n// > <???> @ 0x1801454a0\n// > <???> @ 0x18014cf68\n// > <???> @ 0x1801bf07c\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 11:22:01 +0000\n// \n\nbool __fastcall cocos2d::CCImage::_saveImageToJPG(cocos2d::CCImage *this, const char *a2)\n{\n  FILE *v4; // rax\n  FILE *v5; // r14\n  __int64 v6; // rdx\n  int v7; // eax\n  int v8; // esi\n  _BYTE *v9; // rdi\n  int v10; // r9d\n  int v11; // ecx\n  int v12; // r10d\n  int v13; // ecx\n  int v14; // ecx\n  unsigned int j; // eax\n  unsigned int i; // eax\n  _QWORD v18[2]; // [rsp+20h] [rbp-E0h] BYREF\n  _QWORD v19[6]; // [rsp+30h] [rbp-D0h] BYREF\n  int v20; // [rsp+60h] [rbp-A0h]\n  unsigned int v21; // [rsp+64h] [rbp-9Ch]\n  int v22; // [rsp+68h] [rbp-98h]\n  int v23; // [rsp+6Ch] [rbp-94h]\n  unsigned int v24; // [rsp+150h] [rbp+50h]\n  _BYTE v25[176]; // [rsp+230h] [rbp+130h] BYREF\n\n  if ( !a2 )\n  {\n    LOBYTE(v4) = 0;\n    return (char)v4;\n  }\n  v19[0] = jpeg62_89(v25);\n  jpeg62_30(v19, 62, 504);\n  v4 = fopen(a2, \"wb\");\n  v5 = v4;\n  if ( !v4 )\n    return (char)v4;\n  jpeg62_90(v19, v4);\n  v20 = *((unsigned __int16 *)this + 28);\n  v21 = *((unsigned __int16 *)this + 29);\n  v22 = 3;\n  v23 = 2;\n  jpeg62_81(v19);\n  LOBYTE(v6) = 1;\n  jpeg62_86(v19, v6);\n  v7 = *((unsigned __int16 *)this + 28);\n  v8 = 3 * v7;\n  if ( !*((_BYTE *)this + 72) )\n  {\n    for ( i = v24; v24 < v21; i = v24 )\n    {\n      v18[0] = *((_QWORD *)this + 8) + v8 * i;\n      jpeg62_98(v19, v18, 1);\n    }\n    goto LABEL_16;\n  }\n  v9 = (_BYTE *)sub_1800E4C6C(3 * v7 * *((unsigned __int16 *)this + 29));\n  if ( v9 )\n  {\n    v10 = 0;\n    if ( *((_WORD *)this + 29) )\n    {\n      LOWORD(v11) = *((_WORD *)this + 28);\n      do\n      {\n        v12 = 0;\n        if ( (_WORD)v11 )\n        {\n          do\n          {\n            v9[3 * v12 + 3 * v10 * (unsigned __int16)v11] = *(_BYTE *)(4 * (v12 + v10 * (unsigned __int16)v11)\n                                                                     + *((_QWORD *)this + 8));\n            v13 = v12 + v10 * *((unsigned __int16 *)this + 28);\n            v9[3 * v13 + 1] = *(_BYTE *)(4 * v13 + *((_QWORD *)this + 8) + 1LL);\n            v14 = v12 + v10 * *((unsigned __int16 *)this + 28);\n            ++v12;\n            v9[3 * v14 + 2] = *(_BYTE *)(4 * v14 + *((_QWORD *)this + 8) + 2LL);\n            v11 = *((unsigned __int16 *)this + 28);\n          }\n          while ( v12 < v11 );\n        }\n        ++v10;\n      }\n      while ( v10 < *((unsigned __int16 *)this + 29) );\n    }\n    for ( j = v24; v24 < v21; j = v24 )\n    {\n      v18[0] = &v9[v8 * j];\n      jpeg62_98(v19, v18, 1);\n    }\n    j_j_free_0(v9);\nLABEL_16:\n    jpeg62_49(v19);\n    fclose(v5);\n    jpeg62_43(v19);\n    LOBYTE(v4) = 1;\n    return (char)v4;\n  }\n  jpeg62_49(v19);\n  jpeg62_43(v19);\n  fclose(v5);\n  LOBYTE(v4) = 0;\n  return (char)v4;\n}", "assembly": "; \n; cocos2d::CCImage::_saveImageToJPG from 0x18007eda0 to 0x18007f03a (666 bytes)\n; \n; 6 xrefs:\n; > <???> @ 0x180145440\n; > <???> @ 0x180145474\n; > <???> @ 0x18014548c\n; > <???> @ 0x1801454a0\n; > <???> @ 0x18014cf68\n; > <???> @ 0x1801bf07c\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 11:22:01 +0000\n; \npush    rbp                                                            ; +0x0, 0x18007eda0\npush    rbx                                                            ; +0x2, 0x18007eda2\npush    rdi                                                            ; +0x3, 0x18007eda3\nlea     rbp, [rsp-1F0h]                                                ; +0x4, 0x18007eda4\nsub     rsp, 2F0h                                                      ; +0xc, 0x18007edac\nmov     rax, cs:__security_cookie                                      ; +0x13, 0x18007edb3\nxor     rax, rsp                                                       ; +0x1a, 0x18007edba\nmov     [rbp+200h+var_20], rax                                         ; +0x1d, 0x18007edbd\nmov     rdi, rdx                                                       ; +0x24, 0x18007edc4\nmov     rbx, rcx                                                       ; +0x27, 0x18007edc7\ntest    rdx, rdx                                                       ; +0x2a, 0x18007edca\njz      loc_18007F033                                                  ; +0x2d, 0x18007edcd\nlea     rcx, [rbp+200h+var_D0]                                         ; +0x33, 0x18007edd3\nmov     [rsp+300h+arg_18], r14                                         ; +0x3a, 0x18007edda\ncall    jpeg62_89                                                      ; +0x42, 0x18007ede2\nmov     edx, 3Eh ; '>'                                                 ; +0x47, 0x18007ede7\nmov     [rsp+300h+var_2D0], rax                                        ; +0x4c, 0x18007edec\nmov     r8d, 1F8h                                                      ; +0x51, 0x18007edf1\nlea     rcx, [rsp+300h+var_2D0]                                        ; +0x57, 0x18007edf7\ncall    jpeg62_30                                                      ; +0x5c, 0x18007edfc\nlea     rdx, Mode; \"wb\"                                                ; +0x61, 0x18007ee01\nmov     rcx, rdi; FileName                                             ; +0x68, 0x18007ee08\ncall    cs:fopen                                                       ; +0x6b, 0x18007ee0b\nmov     r14, rax                                                       ; +0x71, 0x18007ee11\ntest    rax, rax                                                       ; +0x74, 0x18007ee14\njz      loc_18007F02E                                                  ; +0x77, 0x18007ee17\nmov     rdx, rax                                                       ; +0x7d, 0x18007ee1d\nmov     [rsp+300h+arg_10], rsi                                         ; +0x80, 0x18007ee20\nlea     rcx, [rsp+300h+var_2D0]                                        ; +0x88, 0x18007ee28\ncall    jpeg62_90                                                      ; +0x8d, 0x18007ee2d\nmovzx   eax, word ptr [rbx+38h]                                        ; +0x92, 0x18007ee32\nlea     rcx, [rsp+300h+var_2D0]                                        ; +0x96, 0x18007ee36\nmov     [rsp+300h+var_2A0], eax                                        ; +0x9b, 0x18007ee3b\nmovzx   eax, word ptr [rbx+3Ah]                                        ; +0x9f, 0x18007ee3f\nmov     [rsp+300h+var_29C], eax                                        ; +0xa3, 0x18007ee43\nmov     [rsp+300h+var_298], 3                                          ; +0xa7, 0x18007ee47\nmov     [rsp+300h+var_294], 2                                          ; +0xaf, 0x18007ee4f\ncall    jpeg62_81                                                      ; +0xb7, 0x18007ee57\nmov     dl, 1                                                          ; +0xbc, 0x18007ee5c\nlea     rcx, [rsp+300h+var_2D0]                                        ; +0xbe, 0x18007ee5e\ncall    jpeg62_86                                                      ; +0xc3, 0x18007ee63\ncmp     byte ptr [rbx+48h], 0                                          ; +0xc8, 0x18007ee68\nmovzx   eax, word ptr [rbx+38h]                                        ; +0xcc, 0x18007ee6c\nlea     esi, [rax+rax*2]                                               ; +0xd0, 0x18007ee70\njz      loc_18007EFD4                                                  ; +0xd3, 0x18007ee73\nmovzx   ecx, word ptr [rbx+3Ah]                                        ; +0xd9, 0x18007ee79\nimul    ecx, eax                                                       ; +0xdd, 0x18007ee7d\nlea     ecx, [rcx+rcx*2]                                               ; +0xe0, 0x18007ee80\nmovsxd  rcx, ecx; Size                                                 ; +0xe3, 0x18007ee83\ncall    sub_1800E4C6C                                                  ; +0xe6, 0x18007ee86\nmov     rdi, rax                                                       ; +0xeb, 0x18007ee8b\ntest    rax, rax                                                       ; +0xee, 0x18007ee8e\njnz     short loc_18007EEDC                                            ; +0xf1, 0x18007ee91\nlea     rcx, [rsp+300h+var_2D0]                                        ; +0xf3, 0x18007ee93\ncall    jpeg62_49                                                      ; +0xf8, 0x18007ee98\nlea     rcx, [rsp+300h+var_2D0]                                        ; +0xfd, 0x18007ee9d\ncall    jpeg62_43                                                      ; +0x102, 0x18007eea2\nmov     rcx, r14; Stream                                               ; +0x107, 0x18007eea7\ncall    cs:fclose                                                      ; +0x10a, 0x18007eeaa\nxor     al, al                                                         ; +0x110, 0x18007eeb0\nmov     rsi, [rsp+300h+arg_10]                                         ; +0x112, 0x18007eeb2\nmov     r14, [rsp+300h+arg_18]                                         ; +0x11a, 0x18007eeba\nmov     rcx, [rbp+200h+var_20]                                         ; +0x122, 0x18007eec2\nxor     rcx, rsp; StackCookie                                          ; +0x129, 0x18007eec9\ncall    __security_check_cookie                                        ; +0x12c, 0x18007eecc\nadd     rsp, 2F0h                                                      ; +0x131, 0x18007eed1\npop     rdi                                                            ; +0x138, 0x18007eed8\npop     rbx                                                            ; +0x139, 0x18007eed9\npop     rbp                                                            ; +0x13a, 0x18007eeda\nretn                                                                   ; +0x13b, 0x18007eedb\nxor     r11d, r11d                                                     ; +0x13c, 0x18007eedc\nmov     r9d, r11d                                                      ; +0x13f, 0x18007eedf\ncmp     r11w, [rbx+3Ah]                                                ; +0x142, 0x18007eee2\njnb     loc_18007EF98                                                  ; +0x147, 0x18007eee7\nmovzx   ecx, word ptr [rbx+38h]                                        ; +0x14d, 0x18007eeed\nmov     r10d, r11d                                                     ; +0x151, 0x18007eef1\ncmp     r11w, cx                                                       ; +0x154, 0x18007eef4\njnb     loc_18007EF88                                                  ; +0x158, 0x18007eef8\nxchg    ax, ax                                                         ; +0x15e, 0x18007eefe\nmov     rdx, [rbx+40h]                                                 ; +0x160, 0x18007ef00\nmovzx   ecx, cx                                                        ; +0x164, 0x18007ef04\nimul    ecx, r9d                                                       ; +0x167, 0x18007ef07\nadd     ecx, r10d                                                      ; +0x16b, 0x18007ef0b\nlea     eax, ds:0[rcx*4]                                               ; +0x16e, 0x18007ef0e\nmovsxd  r8, eax                                                        ; +0x175, 0x18007ef15\nlea     eax, [rcx+rcx*2]                                               ; +0x178, 0x18007ef18\nmovsxd  rcx, eax                                                       ; +0x17b, 0x18007ef1b\nmovzx   eax, byte ptr [r8+rdx]                                         ; +0x17e, 0x18007ef1e\nmov     [rcx+rdi], al                                                  ; +0x183, 0x18007ef23\nmovzx   ecx, word ptr [rbx+38h]                                        ; +0x186, 0x18007ef26\nmov     rdx, [rbx+40h]                                                 ; +0x18a, 0x18007ef2a\nimul    ecx, r9d                                                       ; +0x18e, 0x18007ef2e\nadd     ecx, r10d                                                      ; +0x192, 0x18007ef32\nlea     eax, ds:0[rcx*4]                                               ; +0x195, 0x18007ef35\nmovsxd  r8, eax                                                        ; +0x19c, 0x18007ef3c\nlea     eax, [rcx+rcx*2]                                               ; +0x19f, 0x18007ef3f\nmovsxd  rcx, eax                                                       ; +0x1a2, 0x18007ef42\nmovzx   eax, byte ptr [r8+rdx+1]                                       ; +0x1a5, 0x18007ef45\nmov     [rcx+rdi+1], al                                                ; +0x1ab, 0x18007ef4b\nmovzx   ecx, word ptr [rbx+38h]                                        ; +0x1af, 0x18007ef4f\nmov     rdx, [rbx+40h]                                                 ; +0x1b3, 0x18007ef53\nimul    ecx, r9d                                                       ; +0x1b7, 0x18007ef57\nadd     ecx, r10d                                                      ; +0x1bb, 0x18007ef5b\ninc     r10d                                                           ; +0x1be, 0x18007ef5e\nlea     eax, ds:0[rcx*4]                                               ; +0x1c1, 0x18007ef61\nmovsxd  r8, eax                                                        ; +0x1c8, 0x18007ef68\nlea     eax, [rcx+rcx*2]                                               ; +0x1cb, 0x18007ef6b\nmovsxd  rcx, eax                                                       ; +0x1ce, 0x18007ef6e\nmovzx   eax, byte ptr [r8+rdx+2]                                       ; +0x1d1, 0x18007ef71\nmov     [rcx+rdi+2], al                                                ; +0x1d7, 0x18007ef77\nmovzx   ecx, word ptr [rbx+38h]                                        ; +0x1db, 0x18007ef7b\ncmp     r10d, ecx                                                      ; +0x1df, 0x18007ef7f\njl      loc_18007EF00                                                  ; +0x1e2, 0x18007ef82\nmovzx   eax, word ptr [rbx+3Ah]                                        ; +0x1e8, 0x18007ef88\ninc     r9d                                                            ; +0x1ec, 0x18007ef8c\ncmp     r9d, eax                                                       ; +0x1ef, 0x18007ef8f\njl      loc_18007EEF1                                                  ; +0x1f2, 0x18007ef92\nmov     eax, [rbp+200h+var_1B0]                                        ; +0x1f8, 0x18007ef98\ncmp     eax, [rsp+300h+var_29C]                                        ; +0x1fb, 0x18007ef9b\njnb     short loc_18007EFCA                                            ; +0x1ff, 0x18007ef9f\nimul    eax, esi                                                       ; +0x201, 0x18007efa1\nlea     rdx, [rsp+300h+var_2E0]                                        ; +0x204, 0x18007efa4\nmov     r8d, 1                                                         ; +0x209, 0x18007efa9\nlea     rcx, [rsp+300h+var_2D0]                                        ; +0x20f, 0x18007efaf\nadd     rax, rdi                                                       ; +0x214, 0x18007efb4\nmov     [rsp+300h+var_2E0], rax                                        ; +0x217, 0x18007efb7\ncall    jpeg62_98                                                      ; +0x21c, 0x18007efbc\nmov     eax, [rbp+200h+var_1B0]                                        ; +0x221, 0x18007efc1\ncmp     eax, [rsp+300h+var_29C]                                        ; +0x224, 0x18007efc4\njb      short loc_18007EFA1                                            ; +0x228, 0x18007efc8\nmov     rcx, rdi; Block                                                ; +0x22a, 0x18007efca\ncall    j_j_free_0                                                     ; +0x22d, 0x18007efcd\njmp     short loc_18007F00A                                            ; +0x232, 0x18007efd2\nmov     eax, [rbp+200h+var_1B0]                                        ; +0x234, 0x18007efd4\ncmp     eax, [rsp+300h+var_29C]                                        ; +0x237, 0x18007efd7\njnb     short loc_18007F00A                                            ; +0x23b, 0x18007efdb\nnop     dword ptr [rax]                                                ; +0x23d, 0x18007efdd\nimul    eax, esi                                                       ; +0x240, 0x18007efe0\nlea     rdx, [rsp+300h+var_2E0]                                        ; +0x243, 0x18007efe3\nmov     r8d, 1                                                         ; +0x248, 0x18007efe8\nlea     rcx, [rsp+300h+var_2D0]                                        ; +0x24e, 0x18007efee\nadd     rax, [rbx+40h]                                                 ; +0x253, 0x18007eff3\nmov     [rsp+300h+var_2E0], rax                                        ; +0x257, 0x18007eff7\ncall    jpeg62_98                                                      ; +0x25c, 0x18007effc\nmov     eax, [rbp+200h+var_1B0]                                        ; +0x261, 0x18007f001\ncmp     eax, [rsp+300h+var_29C]                                        ; +0x264, 0x18007f004\njb      short loc_18007EFE0                                            ; +0x268, 0x18007f008\nlea     rcx, [rsp+300h+var_2D0]                                        ; +0x26a, 0x18007f00a\ncall    jpeg62_49                                                      ; +0x26f, 0x18007f00f\nmov     rcx, r14; Stream                                               ; +0x274, 0x18007f014\ncall    cs:fclose                                                      ; +0x277, 0x18007f017\nlea     rcx, [rsp+300h+var_2D0]                                        ; +0x27d, 0x18007f01d\ncall    jpeg62_43                                                      ; +0x282, 0x18007f022\nmov     al, 1                                                          ; +0x287, 0x18007f027\njmp     loc_18007EEB2                                                  ; +0x289, 0x18007f029\njmp     loc_18007EEBA                                                  ; +0x28e, 0x18007f02e\nxor     al, al                                                         ; +0x293, 0x18007f033\njmp     loc_18007EEC2                                                  ; +0x295, 0x18007f035", "xrefs": ["<???> @ 0x180145440", "<???> @ 0x180145474", "<???> @ 0x18014548c", "<???> @ 0x1801454a0", "<???> @ 0x18014cf68", "<???> @ 0x1801bf07c"], "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"}