// // lws_read from 0x856368 to 0x856482 (282 bytes) // // 2 xrefs: // > lws_service_fd @ 0x85760c // > lws_service_fd @ 0x857672 // // This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False! // // Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings // Generated at Fri, 27 Nov 2026 12:02:36 +0000 // int __fastcall lws_read(int a1, int a2, unsigned int a3) { int v3; // r3 unsigned int v5; // r6 int v6; // r3 unsigned int v7; // r3 int result; // r0 int v9; // r5 int v10; // r5 unsigned int v11; // r7 int v12; // r2 unsigned int v13; // r1 int v14; // r3 int v15; // r3 int v16; // [sp+Ch] [bp-8h] BYREF v3 = *(unsigned __int8 *)(a1 + 264); v16 = a2; v5 = a3; switch ( v3 ) { case 0: goto LABEL_8; case 1: goto LABEL_9; case 2: goto LABEL_10; case 3: if ( !a3 ) return 0; v7 = *(_DWORD *)(a1 + 28); if ( !v7 ) return 0; break; case 5: case 8: if ( !((int (*)(void))sub_859A58)() ) return 0; goto LABEL_11; default: lws_log(1, "%s: Unhandled state\n", "lws_read"); return 0; } while ( 1 ) { v10 = *(_DWORD *)(a1 + 188); v11 = v7; v12 = *(_DWORD *)(a1 + 192); if ( v7 >= v5 ) v11 = v5; v13 = v7 - v11; v14 = v16; *(_DWORD *)(a1 + 28) = v13; v5 -= v11; v9 = (*(int (__fastcall **)(int, int, int, int, unsigned int))(v10 + 4))(a1, 13, v12, v14, v11); if ( v9 ) { LABEL_11: sub_856B30(a1, 0); return -1; } v15 = *(_DWORD *)(a1 + 28); v16 += v11; if ( v15 ) break; while ( 2 ) { lws_set_timeout(a1, 0, 0); if ( (*(int (__fastcall **)(int, int, _DWORD, _DWORD, _DWORD))(*(_DWORD *)(a1 + 188) + 4))( a1, 14, *(_DWORD *)(a1 + 192), 0, 0) ) { goto LABEL_11; } while ( 1 ) { do { if ( !v5 ) return 0; LABEL_8: *(_BYTE *)(a1 + 260) &= ~1u; LABEL_9: *(_BYTE *)(a1 + 264) = 2; *(_BYTE *)(a1 + 18) = 83; *(_WORD *)(a1 + 12) = 0; LABEL_10: result = sub_859A58(a1, &v16, v5); if ( result ) goto LABEL_11; if ( (*(_BYTE *)(a1 + 260) & 1) == 0 ) return 0; v6 = *(unsigned __int8 *)(a1 + 264); } while ( v6 == 2 ); if ( v6 == 3 ) break; if ( *(_BYTE *)(a1 + 264) ) return result; } v7 = *(_DWORD *)(a1 + 24); *(_DWORD *)(a1 + 28) = v7; if ( !v7 ) continue; break; } if ( !v5 ) return 0; } lws_set_timeout(a1, 10, 5); return v9; }
GD Web Decomp Icon

GD Web Decomp

Raw Source