// // PlatformToolbox::spriteFromSavedFile from 0x1004c4340 to 0x1004c46ed (941 bytes) // // 0 xrefs: // // 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 // cocos2d::CCSprite *__fastcall PlatformToolbox::spriteFromSavedFile(__int64 a1, double a2) { cocos2d::CCDirector *v2; // rax const char *v3; // r14 size_t v4; // rax std::string::size_type v5; // r15 char *data; // r12 size_t v7; // r13 std::string::pointer v8; // r13 unsigned __int64 size; // r15 std::string::size_type v10; // rax signed __int64 v11; // rdx char *v12; // r15 char *v13; // rax char *v14; // rax std::string::size_type v15; // rax std::string::size_type v16; // r15 std::string::size_type v17; // rcx cocos2d::CCTextureCache *v18; // rax const char *v19; // rsi cocos2d::CCTexture2D *v20; // rax cocos2d::CCSprite *result; // rax __int64 v22; // rbx NSString *v23; // rbx NSArray *v24; // rax id v25; // rax id v26; // rbx NSFileManager *v27; // rax unsigned __int8 v28; // cl const char *v29; // r14 size_t v30; // rax size_t v31; // rbx char *v32; // r15 const char *v33; // rdi size_t v34; // r12 cocos2d::CCSprite *v35; // rbx std::string::value_type __s[15]; // [rsp+1h] [rbp-6Fh] BYREF _QWORD v37[2]; // [rsp+18h] [rbp-58h] BYREF void *v38; // [rsp+28h] [rbp-48h] std::string __dst[2]; // [rsp+30h] [rbp-40h] BYREF v2 = cocos2d::CCDirector::sharedDirector(); *(float *)&a2 = sub_1004849C0((__int64)v2); if ( *(float *)&a2 != 2.0 ) goto LABEL_33; if ( (*(_BYTE *)a1 & 1) != 0 ) v3 = *(const char **)(a1 + 16); else v3 = (const char *)(a1 + 1); v4 = strlen(v3); if ( v4 >= 0xFFFFFFFFFFFFFFF8LL ) goto LABEL_55; v5 = v4; if ( v4 >= 0x17 ) { v7 = 26; if ( (v4 | 7) != 0x17 ) v7 = (v4 | 7) + 1; data = (char *)operator new(v7); __dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)data; __dst[0].__r_.__value_.__r.__words[0] = v7 + 1; __dst[0].__r_.__value_.__l.__size_ = v5; goto LABEL_12; } __dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v4); data = __dst[0].__r_.__value_.__s.__data_; if ( v4 ) LABEL_12: memcpy(data, v3, v5); v8 = __dst[0].__r_.__value_.__s.__data_; data[v5] = 0; *(_DWORD *)((char *)v37 + 1) = 1735290926; strcpy(__s, "-hd.png"); if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 ) { v8 = __dst[0].__r_.__value_.__l.__data_; size = __dst[0].__r_.__value_.__l.__size_; } else { size = *(_BYTE *)&__dst[0].__r_.__value_.__l.0 >> 1; } v10 = 0; LABEL_17: v11 = size - v10; if ( (__int64)(size - v10) >= 4 ) { v12 = &v8[size]; v13 = &v8[v10]; do { v14 = (char *)memchr(v13, 46, v11 - 3); if ( !v14 ) break; if ( *(_DWORD *)v14 == *(_DWORD *)((char *)v37 + 1) ) { if ( v14 != v12 ) { v15 = v14 - v8; if ( v15 != -1 ) { v16 = v15; std::string::replace(__dst, v15, 4u, __s, 7u); v17 = v16; if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 ) { v8 = __dst[0].__r_.__value_.__l.__data_; size = __dst[0].__r_.__value_.__l.__size_; v10 = v17 + 7; if ( __dst[0].__r_.__value_.__l.__size_ >= v17 + 7 ) goto LABEL_17; } else { size = *(_BYTE *)&__dst[0].__r_.__value_.__l.0 >> 1; v8 = __dst[0].__r_.__value_.__s.__data_; v10 = v17 + 7; if ( size >= v17 + 7 ) goto LABEL_17; } } } break; } v13 = v14 + 1; v11 = v12 - v13; } while ( v12 - v13 >= 4 ); } if ( (*(_BYTE *)a1 & 1) != 0 ) operator delete(*(void **)(a1 + 16)); *(_QWORD *)(a1 + 16) = __dst[0].__r_.__value_.__l.__data_; a2 = *(double *)__dst[0].__r_.__value_.__r.__words; *(_OWORD *)a1 = *(_OWORD *)&__dst[0].__r_.__value_.__l.0; LABEL_33: v18 = cocos2d::CCTextureCache::sharedTextureCache(); if ( (*(_BYTE *)a1 & 1) != 0 ) v19 = *(const char **)(a1 + 16); else v19 = (const char *)(a1 + 1); v20 = cocos2d::CCTextureCache::addImage(v18, v19, 0); if ( v20 ) return cocos2d::CCSprite::createWithTexture_1(v20); if ( (*(_BYTE *)a1 & 1) != 0 ) v22 = *(_QWORD *)(a1 + 16); else v22 = a1 + 1; v23 = +[NSString stringWithUTF8String:](&OBJC_CLASS___NSString, "stringWithUTF8String:", v22); v24 = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, 1u, 1); v25 = -[NSArray objectAtIndex:](v24, "objectAtIndex:", 0); v26 = objc_msgSend(v25, "stringByAppendingPathComponent:", v23); v27 = +[NSFileManager defaultManager](&OBJC_CLASS___NSFileManager, "defaultManager"); v28 = -[NSFileManager fileExistsAtPath:](v27, "fileExistsAtPath:", v26); result = nullptr; if ( v28 ) { v29 = (const char *)objc_msgSend(v26, "cStringUsingEncoding:", 4); v30 = strlen(v29); if ( v30 < 0xFFFFFFFFFFFFFFF8LL ) { v31 = v30; if ( v30 >= 0x17 ) { v34 = 26; if ( (v30 | 7) != 0x17 ) v34 = (v30 | 7) + 1; v32 = (char *)operator new(v34); v38 = v32; v37[0] = v34 + 1; v37[1] = v31; } else { LOBYTE(v37[0]) = 2 * v30; v32 = (char *)v37 + 1; if ( !v30 ) { BYTE1(v37[0]) = 0; if ( (v37[0] & 1) != 0 ) { LABEL_47: v33 = (const char *)v38; goto LABEL_53; } LABEL_52: v33 = (char *)v37 + 1; LABEL_53: result = cocos2d::CCSprite::create_1(v33); if ( (v37[0] & 1) != 0 ) { v35 = result; operator delete(v38); return v35; } return result; } } memmove(v32, v29, v31); v32[v31] = 0; if ( (v37[0] & 1) != 0 ) goto LABEL_47; goto LABEL_52; } LABEL_55: sub_100006BF0(a2); } return result; }
GD Web Decomp Icon

GD Web Decomp

Raw Source