Skip to content

Instantly share code, notes, and snippets.

@leoetlino
Created September 29, 2018 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leoetlino/8e1c6f2224c5e79d91a24198a623a2fb to your computer and use it in GitHub Desktop.
Save leoetlino/8e1c6f2224c5e79d91a24198a623a2fb to your computer and use it in GitHub Desktop.
__int64 __fastcall sub_710111AB00(void *this, __int64 x1_0, __int64 a3)
{
// [COLLAPSED LOCAL DECLARATIONS. PRESS KEYPAD CTRL-"+" TO EXPAND]
v3 = a3;
v5 = (_QWORD *)(a3 + 0x28);
v6 = x1_0;
(*(void (__fastcall **)(__int64))(*(_QWORD *)(a3 + 0x28) + 0x18LL))(a3 + 0x28);
(*(void (__fastcall **)(_QWORD *))(*v5 + 0x18LL))(v5);
v7 = (char *)v5[1];
if ( v7 != "scene" )
{
v8 = 0LL;
while ( 1 )
{
v9 = (unsigned __int8)v7[v8];
if ( v9 != (unsigned __int8)aScene[v8] )
return 0LL;
if ( v9 == (unsigned __int8)sead::SafeStringBase<char>::cNullChar )
break;
if ( ++v8 >= 0x80001 )
return 0LL;
}
}
v74.vptr = &`vtable for'sead::SafeStringBase<char>;
v74.cstr = "file_info";
result = sub_7100B2B318(v3, &v74);
if ( !result )
return result;
a2 = (__int64)&`vtable for'sead::SafeStringBase<char>;
v73 = "version";
v11 = sead::XmlElement::findAttributeValue(result, &a2);
if ( !(sub_710111B16C(v11, &v74) & 1) )
return 0LL;
v74.vptr = &`vtable for'sead::SafeStringBase<char>;
v74.cstr = "scene_info";
v12 = sub_7100B2B318(v3, &v74);
v13 = v12;
if ( v12 )
{
a2 = (__int64)&`vtable for'sead::SafeStringBase<char>;
v73 = "world_scale";
sead::XmlElement::findAttributeValue(v12, &a2);
v70 = (__int64)&`vtable for'sead::SafeStringBase<char>;
v71 = "height_scale";
sead::XmlElement::findAttributeValue(v13, &v70);
if ( *v74.cstr != sead::SafeStringBase<char>::cNullChar )
{
v14 = Terrain::sInstance;
*(float *)&v14->field_3C8 = sead::StringUtil::parseF32((__int64)&v74);
Terrain::__auto13(Terrain::sInstance, this);
*((_DWORD *)this + 7) = v15;
*((_DWORD *)this + 8) = v16;
Terrain::__auto14(Terrain::sInstance, this);
*((_DWORD *)this + 9) = v17;
}
v54 = v3;
v55 = v6;
if ( *(unsigned __int8 *)v73 != (unsigned __int8)sead::SafeStringBase<char>::cNullChar )
{
v18 = Terrain::sInstance;
*((float *)&v18->field_3C8 + 1) = sead::StringUtil::parseF32((__int64)&a2);
Terrain::__auto13(Terrain::sInstance, this);
*((_DWORD *)this + 7) = v19;
*((_DWORD *)this + 8) = v20;
Terrain::__auto14(Terrain::sInstance, this);
*((_DWORD *)this + 9) = v21;
}
v70 = (__int64)&`vtable for'sead::SafeStringBase<char>;
v71 = "material_info_array";
v22 = sub_7100B2B318(v13, &v70);
v23 = v22;
if ( v22 )
{
v24 = Terrain::sInstance;
if ( Terrain::sInstance->field_A58 & 1 )
{
v25 = *(_QWORD *)(v22 + 0x10);
v26 = 0;
if ( v25 )
{
v27 = (_QWORD *)(v25 - 8);
if ( v25 != 8 )
{
v26 = 0;
do
{
v70 = (__int64)&`vtable for'sead::SafeStringBase<char>;
v71 = "material_info";
(*(void (__fastcall **)(_QWORD *))(v27[5] + 0x18LL))(v27 + 5);
(*(void (__fastcall **)(_QWORD *))(v27[5] + 0x18LL))(v27 + 5);
v28 = (const char *)v27[6];
(*(void (__fastcall **)(__int64 *))(v70 + 0x18))(&v70);
if ( v28 == v71 )
{
LABEL_29:
v35 = 1;
}
else
{
v29 = v27[6];
v30 = 0LL;
v31 = (__int64)(v71 + 1);
while ( 1 )
{
v32 = *(unsigned __int8 *)(v29 + v30);
if ( v32 != (unsigned __int8)v71[v30] )
break;
if ( v32 == (unsigned __int8)sead::SafeStringBase<char>::cNullChar )
goto LABEL_29;
v33 = *(unsigned __int8 *)(v29 + v30 + 1);
if ( v33 != *(unsigned __int8 *)(v31 + v30) )
break;
if ( v33 == (unsigned __int8)sead::SafeStringBase<char>::cNullChar )
goto LABEL_29;
v34 = *(unsigned __int8 *)(v29 + v30 + 2);
if ( v34 != *(unsigned __int8 *)(v31 + v30 + 1) )
break;
if ( v34 == (unsigned __int8)sead::SafeStringBase<char>::cNullChar )
goto LABEL_29;
v30 += 3LL;
if ( v30 >= 0x80001 )
{
v35 = 0;
goto LABEL_31;
}
}
v35 = 0;
}
LABEL_31:
v26 += v35;
v36 = v27[3];
if ( v36 )
v27 = (_QWORD *)(v36 - 8);
else
v27 = 0LL;
}
while ( v27 );
v24 = Terrain::sInstance;
}
}
sub_71011406CC(*(_QWORD *)(v24->field_370 + 0x4AE0) + 0x10LL, v26);
v24 = Terrain::sInstance;
}
v37 = *(_QWORD *)(v23 + 0x10);
if ( v37 )
{
v38 = v37 - 8;
if ( v37 != 8 )
{
v39 = *(_DWORD *)(*(_QWORD *)(v24->field_370 + 0x4AE0) + 0x710LL);
v40 = "mat_index";
v41 = "tex_index";
v42 = "uv_scale";
v56 = *(_DWORD *)(*(_QWORD *)(v24->field_370 + 0x4AE0) + 0x710LL);
do
{
v68 = (__int64)&`vtable for'sead::SafeStringBase<char>;
v69 = v40;
sead::XmlElement::findAttributeValue(v38, &v68);
v66 = (__int64)&`vtable for'sead::SafeStringBase<char>;
v67 = v41;
sead::XmlElement::findAttributeValue(v38, &v66);
v64 = (__int64)&`vtable for'sead::SafeStringBase<char>;
v65 = v42;
sead::XmlElement::findAttributeValue(v38, &v64);
v62 = (__int64)&`vtable for'sead::SafeStringBase<char>;
v63 = "fabrication_micro";
sead::XmlElement::findAttributeValue(v38, &v62);
v60 = (__int64)&`vtable for'sead::SafeStringBase<char>;
v61 = "fabrication_tilling";
sead::XmlElement::findAttributeValue(v38, &v60);
v58 = (__int64)&`vtable for'sead::SafeStringBase<char>;
v59 = "uvw_info";
sead::XmlElement::findAttributeValue(v38, &v58);
v43 = sead::StringUtil::parseU32((__int64)&v70, 0xFFFFFFFF);
if ( v43 < v39 )
{
v44 = (char *)this + 0x18 * (signed int)v43 + 0xE8;
v45 = (signed int)v43;
if ( *(unsigned __int8 *)v61 != (unsigned __int8)sead::SafeStringBase<char>::cNullChar )
{
v57 = 0.0;
LODWORD(v58) = 0x3F800000;
v46 = v42;
v47 = v41;
v48 = v40;
v49 = (char *)this + 0x18 * (signed int)v43;
sub_710111B5AC(v49 + 0xEC, v49 + 0xF0, &v57, &v58, &v60);
*v44 = (unsigned int)v57;
*((_DWORD *)v49 + 0x3D) = v58;
*((_DWORD *)v49 + 0x3E) = 0x3F800000;
v40 = v48;
v41 = v47;
v42 = v46;
}
if ( *(unsigned __int8 *)v67 != (unsigned __int8)sead::SafeStringBase<char>::cNullChar )
sub_710111C744((char *)this + 0x18 * v45 + 0xEC, (char *)this + 0x18 * v45 + 0xF0, &v66);
if ( *(unsigned __int8 *)v69 != (unsigned __int8)sead::SafeStringBase<char>::cNullChar )
sub_710111D088(v44, &v70);
if ( *(unsigned __int8 *)v65 != (unsigned __int8)sead::SafeStringBase<char>::cNullChar )
sub_710111D59C((char *)this + 0x18 * v45 + 0xF4, &v64);
v39 = v56;
if ( *(unsigned __int8 *)v63 != (unsigned __int8)sead::SafeStringBase<char>::cNullChar )
sub_710111D59C((char *)this + 0x18 * v45 + 0xF8, &v62);
}
v50 = *(_QWORD *)(v38 + 0x18);
if ( v50 )
v38 = v50 - 8;
else
v38 = 0LL;
}
while ( v38 );
}
}
}
v6 = v55;
v3 = v54;
}
v74.vptr = &`vtable for'sead::SafeStringBase<char>;
v74.cstr = "extra_info_array";
if ( sub_7100B2B318(v3, &v74) )
sub_710111A4DC();
v74.vptr = &`vtable for'sead::SafeStringBase<char>;
v74.cstr = "area_array";
v51 = sub_7100B2B318(v3, &v74);
if ( sub_710111A2B8(this, v6, v51) & 1 )
return 1LL;
v52 = Terrain::sInstance->field_A50;
if ( !v52 )
return 1LL;
printDebug(
(void *)(v52 + 0x70),
"最小/最大高さが取得できないエリアがありました。このエラーが出た場合は斎藤までご連絡をお願いいたします");
v53 = v74.vptr;
if ( !v74.vptr )
return 1LL;
v74.vptr[1].assureTermination = (void (__fastcall *)(sead::SafeString *))(signed __int64)(float)((float)sead::TickSpan::cFrequency
* 10.0);
if ( LOBYTE(v74.cstr) )
BYTE4(v53[2].dtor) = 1;
return 1LL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment