Skip to content

Instantly share code, notes, and snippets.

@Lusamine
Created June 19, 2025 18:12
Show Gist options
  • Select an option

  • Save Lusamine/075c9cd38cd7adbb5de01e4a070c4d27 to your computer and use it in GitHub Desktop.

Select an option

Save Lusamine/075c9cd38cd7adbb5de01e4a070c4d27 to your computer and use it in GitHub Desktop.
__int64 __fastcall camp_load_data(__int64 a1, __int64 a2)
{
__int64 v2; // x29
__int64 v3; // x30
_QWORD *v4; // x0
_QWORD *v5; // x20
nn::os *v6; // x19
unsigned __int64 CurrentThread; // x0
unsigned __int64 v8; // x21
unsigned __int64 *v9; // x23
__int64 v12; // x21
__int64 v13; // x0
unsigned __int8 v14; // w8
__int64 v15; // x0
__int64 v16; // x0
__int64 v17; // x22
__int64 v19; // x0
__int64 v20; // x0
__int64 v21[3]; // [xsp+0h] [xbp-A0h] BYREF
__int64 v22; // [xsp+18h] [xbp-88h]
__int64 v23; // [xsp+20h] [xbp-80h]
__int64 v24; // [xsp+30h] [xbp-70h] BYREF
char v25[24]; // [xsp+38h] [xbp-68h] BYREF
__int64 v26; // [xsp+50h] [xbp-50h]
__int64 v27; // [xsp+58h] [xbp-48h] BYREF
__int64 v28; // [xsp+68h] [xbp-38h]
__int64 v29; // [xsp+90h] [xbp-10h]
__int64 v30; // [xsp+98h] [xbp-8h]
v4 = *(_QWORD **)(a1 + 312);
v29 = v2;
v30 = v3;
v5 = v4;
v27 = a2;
v6 = (nn::os *)sub_71011C7170();
CurrentThread = nn::os::GetCurrentThread(v6);
v8 = CurrentThread;
v9 = (unsigned __int64 *)((char *)v6 + 16);
do
{
if ( __ldaxr(v9) )
{
while ( 1 )
{
__clrex();
nn::os::WaitLightEvent((char *)v6 + 4);
while ( !__ldaxr(v9) )
{
if ( !__stxr(v8, v9) )
goto LABEL_8;
}
}
}
}
while ( __stxr(CurrentThread, v9) );
LABEL_8:
v12 = *(_QWORD *)&global_struct->gap0[144];
if ( v12 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)(v12 + 72) + 16LL))(v12 + 72);
v13 = *(_QWORD *)(v12 + 1672);
if ( v13 )
{
sub_71005E7120(v13, &v27);
}
else
{
v14 = atomic_load((unsigned __int8 *)&qword_71028EF730);
if ( (v14 & 1) == 0 )
{
v19 = _cxa_guard_acquire_0(&qword_71028EF730);
if ( (_DWORD)v19 )
{
v20 = sub_71005E5E60(v19);
qword_71028EF728 = v20;
if ( v20 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)(v20 + 72) + 16LL))(v20 + 72);
sub_71000001C0(sub_71005E5C50, &qword_71028EF728, &off_71024DB000);
_cxa_guard_release_0(&qword_71028EF730);
}
}
v21[0] = qword_71028EF728;
if ( qword_71028EF728 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)(qword_71028EF728 + 72) + 16LL))(qword_71028EF728 + 72);
}
sub_71005CF0C0(v21);
if ( v21[0] )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)(v21[0] + 72) + 24LL))(v21[0] + 72);
v21[0] = 0LL;
}
(*(void (__fastcall **)(__int64))(*(_QWORD *)(v12 + 72) + 24LL))(v12 + 72);
sub_710126CAC0("bin/pokemon_data/pokecamp/monohiroi/", ".bin", &v24, (__int64)v25);
sub_7100983620(&v24, (__int64)v21);
v15 = sub_7100CA0AB0(qword_7102961D30, 8LL);
sub_71005DCCD0(qword_71026364E0, 1LL, v21, 0LL, v5[11], v15);
v16 = v5[13];
if ( v16 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)(v16 + 72) + 24LL))(v16 + 72);
v5[13] = 0LL;
}
v17 = v28;
v5[13] = v28;
if ( v17 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)(v17 + 72) + 16LL))(v17 + 72);
if ( v5[14] || v5[30] )
sub_71005E1E70(v17, v5 + 12, 1LL);
(*(void (__fastcall **)(__int64))(*(_QWORD *)(v17 + 72) + 24LL))(v17 + 72);
}
if ( v22 && v21[0] )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)(v21[0] + 72) + 24LL))(v21[0] + 72);
v21[0] = 0LL;
}
v21[0] = 0LL;
v21[1] = 0xCBF29CE484222645LL;
v21[2] = (__int64)&byte_7101C38550;
v22 = 0LL;
if ( v23 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)(v23 + 72) + 24LL))(v23 + 72);
v23 = 0LL;
}
if ( v24 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)(v24 + 72) + 24LL))(v24 + 72);
v24 = 0LL;
}
if ( v26 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)(v26 + 72) + 24LL))(v26 + 72);
v26 = 0LL;
}
do
__ldxr(v9);
while ( __stlxr(0LL, v9) );
return nn::os::SignalLightEvent((char *)v6 + 4);
}
----
.text:000000710126C8C4 LDR X8, [X8,#0x18]
.text:000000710126C8C8 BLR X8
.text:000000710126C8CC STR XZR, [SP,#0xA0+var_A0]
.text:000000710126C8D0
.text:000000710126C8D0 loc_710126C8D0 ; CODE XREF: camp_load_data+151C↑j
.text:000000710126C8D0 LDR X8, [X21,#0x48]!
.text:000000710126C8D4 LDR X8, [X8,#0x18]
.text:000000710126C8D8 MOV X0, X21
.text:000000710126C8DC BLR X8
.text:000000710126C8E0 ADRL X0, aBinPokemonData_2 ; "bin/pokemon_data/pokecamp/monohiroi/"
.text:000000710126C8E8 ADRL X2, aBin ; ".bin"
.text:000000710126C8F0 ADD X8, SP, #0xA0+var_70
.text:000000710126C8F4 ADD X1, SP, #0xA0+var_68
.text:000000710126C8F8 BL sub_710126CAC0
.text:000000710126C8FC MOV X8, SP
.text:000000710126C900 ADD X0, SP, #0xA0+var_70
.text:000000710126C904 BL sub_7100983620
.text:000000710126C908 ADRP X8, #off_710261E770@PAGE
.text:000000710126C90C LDR X8, [X8,#off_710261E770@PAGEOFF]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment