//
// sub_84ACE0 from 0x84ace0 to 0x84b3c6 (1766 bytes)
//
// 0 xrefs:
//
// 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:27 +0000
//
_DWORD *__fastcall sub_84ACE0(int *a1, _BYTE *a2)
{
int v2; // r10
int v4; // r5
_DWORD *v5; // r7
int v6; // r1
const char *v7; // r6
char *v8; // r11
char *v9; // r8
void *v10; // r0
_DWORD *result; // r0
char *v12; // r9
int v13; // r0
bool v14; // zf
char **v15; // r0
const char *v16; // r2
const char *v17; // r3
const char *v18; // r1
const char *v19; // r0
const char *v20; // r9
const char *v21; // lr
const char *v22; // r6
int v23; // r6
_DWORD *v24; // r5
int v25; // r3
__int64 v26; // r2
__int64 v27; // r8
__int64 v28; // r0
bool v29; // zf
const char *v30; // r0
__int64 v31; // r2
const char *v32; // [sp+18h] [bp-2Ch]
__int64 v33; // [sp+18h] [bp-2Ch]
const char *v34; // [sp+20h] [bp-24h]
const char *v35; // [sp+24h] [bp-20h]
const char *v36; // [sp+28h] [bp-1Ch]
char *v37; // [sp+2Ch] [bp-18h]
const char *v38; // [sp+34h] [bp-10h]
const char *v39; // [sp+38h] [bp-Ch]
char **v40; // [sp+3Ch] [bp-8h]
v2 = *a1;
v4 = *(_DWORD *)(*a1 + 1224);
v5 = *(_DWORD **)(*a1 + 332);
*a2 = 1;
v6 = *(_DWORD *)(v2 + 34696);
v5[25] = 0;
v5[24] = v6;
*(_BYTE *)(v2 + 904) = 1;
switch ( v4 )
{
case 1:
v34 = "OPTIONS";
goto LABEL_23;
case 2:
*(_BYTE *)(v2 + 904) = 0;
v34 = "DESCRIBE";
goto LABEL_23;
case 3:
v7 = *(const char **)(v2 + 1152);
v32 = *(const char **)(v2 + 1148);
if ( v7 )
{
v8 = nullptr;
v35 = nullptr;
v34 = "ANNOUNCE";
v9 = (char *)sub_824474((int)a1, "Transport:");
goto LABEL_4;
}
v34 = "ANNOUNCE";
v7 = "*";
goto LABEL_26;
case 4:
v34 = "SETUP";
goto LABEL_23;
case 5:
v34 = "PLAY";
goto LABEL_23;
case 6:
v34 = "PAUSE";
goto LABEL_23;
case 7:
v34 = "TEARDOWN";
LABEL_23:
v32 = *(const char **)(v2 + 1148);
goto LABEL_24;
case 8:
*(_BYTE *)(v2 + 904) = 0;
v34 = "GET_PARAMETER";
goto LABEL_34;
case 9:
v34 = "SET_PARAMETER";
goto LABEL_34;
case 10:
v34 = "RECORD";
LABEL_34:
v32 = *(const char **)(v2 + 1148);
if ( !v32 )
{
sub_828178(v2, "Refusing to issue an RTSP request [%s] without a session ID.", v34);
return (_DWORD *)(&word_2A + 1);
}
LABEL_24:
v7 = *(const char **)(v2 + 1152);
if ( !v7 )
v7 = "*";
LABEL_26:
v13 = sub_824474((int)a1, "Transport:");
v14 = v13 == 0;
if ( !v13 )
v14 = v4 == 4;
v9 = (char *)v13;
if ( v14 )
{
if ( !*(_DWORD *)(v2 + 1156) )
{
sub_828178(v2, "Refusing to issue an RTSP SETUP without a Transport: header.");
return (_DWORD *)(&word_2A + 1);
}
v8 = nullptr;
off_D200B0((void *)a1[179]);
a1[179] = 0;
v9 = sub_837044("Transport: %s\r\n", *(const char **)(v2 + 1156));
a1[179] = (int)v9;
if ( !v9 )
return &dword_18 + 3;
goto LABEL_32;
}
v8 = nullptr;
if ( v4 != 2 )
{
LABEL_32:
v35 = nullptr;
goto LABEL_4;
}
if ( sub_824474((int)a1, "Accept:") )
v35 = nullptr;
else
v35 = "Accept: application/sdp\r\n";
v8 = nullptr;
if ( !sub_824474((int)a1, "Accept-Encoding:") )
{
if ( *(_DWORD *)(v2 + 996) )
{
off_D200B0((void *)a1[173]);
a1[173] = 0;
v8 = sub_837044("Accept-Encoding: %s\r\n", *(const char **)(v2 + 996));
a1[173] = (int)v8;
if ( !v8 )
return &dword_18 + 3;
}
else
{
v8 = nullptr;
}
}
LABEL_4:
if ( sub_824474((int)a1, "User-Agent:") && (v10 = (void *)a1[172]) != nullptr )
{
off_D200B0(v10);
v36 = nullptr;
a1[172] = 0;
}
else if ( sub_824474((int)a1, "User-Agent:") )
{
v36 = nullptr;
}
else if ( *(_DWORD *)(v2 + 1104) )
{
v36 = (const char *)a1[172];
}
else
{
v36 = nullptr;
}
result = (_DWORD *)sub_8247F0((int)a1, (int)v34, (int)v7, 0);
if ( result )
return result;
v38 = (const char *)a1[171];
v39 = (const char *)a1[174];
off_D200B0((void *)a1[176]);
a1[176] = 0;
if ( *(_DWORD *)(v2 + 1312) && !sub_824474((int)a1, "Referer:") )
{
v37 = sub_837044("Referer: %s\r\n", *(const char **)(v2 + 1312));
a1[176] = (int)v37;
}
else
{
a1[176] = 0;
v37 = nullptr;
}
if ( *(_BYTE *)(v2 + 34681) && v4 << 28 && !sub_824474((int)a1, "Range:") && *(_DWORD *)(v2 + 34684) )
{
off_D200B0((void *)a1[175]);
a1[175] = 0;
v12 = sub_837044("Range: %s\r\n", *(const char **)(v2 + 34684));
a1[175] = (int)v12;
}
else
{
v12 = nullptr;
}
if ( sub_824474((int)a1, "CSeq:") )
{
sub_828178(v2, "CSeq cannot be set as a custom header.");
return &dword_54 + 1;
}
if ( sub_824474((int)a1, "Session:") )
{
sub_828178(v2, "Session ID cannot be set as a custom header.");
return (_DWORD *)(&word_2A + 1);
}
v15 = (char **)sub_824E0C();
v40 = v15;
if ( !v15 )
return &dword_18 + 3;
result = (_DWORD *)sub_824FEC(v15, (int)"%s %s RTSP/1.0\r\nCSeq: %ld\r\n", v34, v7, v5[24]);
if ( result )
return result;
if ( v32 )
{
result = (_DWORD *)sub_824FEC(v40, (int)"Session: %s\r\n", v32);
if ( result )
return result;
}
if ( v9 )
v16 = v9;
else
v16 = &byte_BF4ECA;
v17 = v35;
if ( v35 )
{
if ( v8 )
goto LABEL_71;
goto LABEL_133;
}
v17 = &byte_BF4ECA;
if ( !v8 )
LABEL_133:
v8 = &byte_BF4ECA;
LABEL_71:
if ( v12 )
v18 = v12;
else
v18 = &byte_BF4ECA;
v19 = v37;
if ( !v37 )
v19 = &byte_BF4ECA;
if ( v36 )
v20 = v36;
else
v20 = &byte_BF4ECA;
if ( v38 )
v21 = v38;
else
v21 = &byte_BF4ECA;
v22 = v39;
if ( !v39 )
v22 = &byte_BF4ECA;
v23 = sub_824FEC(v40, (int)"%s%s%s%s%s%s%s%s", v16, v17, v8, v18, v19, v20, v21, v22);
off_D200B0((void *)a1[174]);
a1[174] = 0;
if ( v23 )
return (_DWORD *)v23;
if ( ((v4 - 2) & 0xFFFFFFFD) != 0 || (result = (_DWORD *)sub_825458(v2, v40)) == nullptr )
{
result = (_DWORD *)sub_82524C(a1, 0, v40);
if ( !result )
{
if ( (unsigned int)(v4 - 8) > 1 && v4 != 3 )
{
v33 = 0;
goto LABEL_88;
}
if ( *(_BYTE *)(v2 + 905) )
{
v27 = 0;
v28 = *(_QWORD *)(v2 + 34712);
*(_DWORD *)(v2 + 636) = 4;
v33 = v28;
}
else
{
v27 = *(_QWORD *)(v2 + 34712);
v29 = HIDWORD(v27) == -1;
if ( HIDWORD(v27) == -1 )
v29 = (_DWORD)v27 == -1;
if ( v29 )
{
v30 = *(const char **)(v2 + 396);
if ( v30 )
v27 = strlen(v30);
else
v27 = 0;
}
*(_DWORD *)(v2 + 636) = 2;
v33 = 0;
}
if ( v27 < 1 && v33 < 1 )
{
if ( v4 == 8 )
{
*(_DWORD *)(v2 + 636) = 5;
*(_BYTE *)(v2 + 904) = 1;
}
LABEL_88:
*(_BYTE *)(v2 + 331) = 1;
result = (_DWORD *)sub_8250F4((void **)v40, &word_BF5394, 2);
if ( result )
return result;
LABEL_89:
v24 = (_DWORD *)sub_824E54((void **)v40, a1, (_DWORD *)(v2 + 34804), 0, 0);
if ( v24 )
{
sub_828178(v2, "Failed sending RTSP request");
return v24;
}
else
{
if ( v33 )
{
v25 = 0;
v24 = v5 + 10;
}
else
{
v25 = -1;
}
sub_83AA00(a1, 0, -1, -1, 1u, (int)(v5 + 8), v25, v24);
++*(_DWORD *)(v2 + 34696);
v26 = *((_QWORD *)v5 + 5);
if ( v26 && (sub_820E44(v2, v26), sub_820F7C(a1)) )
return (_DWORD *)&word_2A;
else
return nullptr;
}
}
if ( sub_824474((int)a1, "Content-Length:")
|| (*(_BYTE *)(v2 + 905) ? (v31 = v33) : (v31 = v27),
(result = (_DWORD *)sub_824FEC(v40, (int)"Content-Length: %lld\r\n", v31)) == nullptr) )
{
if ( (unsigned int)(v4 - 8) <= 1 )
{
if ( !sub_824474((int)a1, "Content-Type:") )
{
result = (_DWORD *)sub_824FEC(v40, (int)"Content-Type: text/parameters\r\n");
if ( result )
return result;
}
}
else if ( !sub_824474((int)a1, "Content-Type:") )
{
result = (_DWORD *)sub_824FEC(v40, (int)"Content-Type: application/sdp\r\n");
if ( result )
return result;
}
*(_BYTE *)(v2 + 34660) = 0;
*(_BYTE *)(v2 + 331) = 1;
result = (_DWORD *)sub_8250F4((void **)v40, &word_BF5394, 2);
if ( result )
return result;
if ( v27 >= 1 )
{
result = (_DWORD *)sub_8250F4((void **)v40, *(void **)(v2 + 396), v27);
if ( result )
return result;
}
goto LABEL_89;
}
}
}
return result;
case 11:
*(_BYTE *)(v2 + 904) = 0;
sub_83AA00(a1, 0, -1, -1, 1u, (int)(v5 + 8), -1, nullptr);
return nullptr;
case 12:
sub_828178(v2, "Got invalid RTSP request: RTSPREQ_LAST");
return (_DWORD *)(&word_2A + 1);
default:
sub_828178(v2, "Got invalid RTSP request");
return (_DWORD *)(&word_2A + 1);
}
}