Skip to content

Instantly share code, notes, and snippets.

@leoetlino
Created January 10, 2021 21:34
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/5d101f0a25a578774d61a0a7e7788bb0 to your computer and use it in GitHub Desktop.
Save leoetlino/5d101f0a25a578774d61a0a7e7788bb0 to your computer and use it in GitHub Desktop.
botw_decompiler_bugs
/*
CMP W1, #3
TBZ W2, #0, loc_710096E890
B.GT loc_710096E8C0
MOV X0, X20 ; a1
MOV W1, WZR ; a2
BL sead::ListImpl::nth(int)const
*/
...
if ( (signed int)type <= 9 )
{
v5 = sead::ListImpl::nth((sead::ListImpl *)((char *)a1 + 0x68), 0);
if ( !v5 )
return (signed int)v5;
v6 = (char *)v5 - *((signed int *)v3 + 0x1F);
if ( v5 != (sead::ListNode *)*((signed int *)v3 + 0x1F) )
{
LODWORD(v5) = 0;
do
{
if ( *((_DWORD *)v6 + 6) > 3 )
break;
LODWORD(v5) = (unsigned __int8)v6[0x25] + (_DWORD)v5;
v7 = *((signed int *)v3 + 0x1F);
v8 = *(char **)&v6[v7 + 8];
if ( v8 == v4 )
break;
v6 = &v8[-v7];
}
while ( v6 );
return (signed int)v5;
}
LABEL_69:
LODWORD(v5) = 0;
return (signed int)v5;
}
// loc_710096E8C0
if ( (signed int)type > 6 )
{
switch ( type )
{
case 9u:
v14 = (char **)*((_QWORD *)a1 + 0x8845);
if ( !v14 )
goto LABEL_69;
break;
case 8u:
v14 = (char **)*((_QWORD *)a1 + 0x8844);
if ( !v14 )
goto LABEL_69;
break;
case 7u:
v14 = (char **)*((_QWORD *)a1 + 0x8843);
if ( !v14 )
goto LABEL_69;
break;
default:
goto LABEL_69;
}
v26 = *v14;
if ( !v26 )
goto LABEL_69;
LODWORD(v5) = 0;
do
{
if ( *((_DWORD *)v26 + 6) != type )
break;
LODWORD(v5) = (unsigned __int8)v26[0x25] + (_DWORD)v5;
v27 = *((signed int *)v3 + 0x1F);
v28 = *(char **)&v26[v27 + 8];
if ( v28 == v4 )
break;
v26 = &v28[-v27];
}
while ( v26 );
}
else
{
v10 = (char **)*((_QWORD *)a1 + 0x8842);
if ( !v10 )
goto LABEL_69;
v11 = *v10;
if ( !v11 )
goto LABEL_69;
LODWORD(v5) = 0;
do
{
if ( *((_DWORD *)v11 + 6) > 6 )
break;
LODWORD(v5) = (unsigned __int8)v11[0x25] + (_DWORD)v5;
v12 = *((signed int *)v3 + 0x1F);
v13 = *(char **)&v11[v12 + 8];
if ( v13 == v4 )
break;
v11 = &v13[-v12];
}
while ( v11 );
}
return (signed int)v5;
/*
CMP W1, #3
TBZ W2, #0, loc_710096E890
B.GT loc_710096E8C0
MOV X0, X20 ; a1
MOV W1, WZR ; a2
BL sead::ListImpl::nth(int)const
*/
...
*(_QWORD *)&v5 = sead::ListImpl::nth(&a1->mItemLists.list1, 0);
if ( !*(_QWORD *)&v5 )
return v5;
v6 = (int *)(*(_QWORD *)&v5 - a1->mItemLists.list1.mOffset);
if ( !v6 )
return 0;
v5 = 0;
do
{
if ( v6[6] > 3 )
break;
v5 += *((unsigned __int8 *)v6 + 0x25);
v7 = a1->mItemLists.list1.mOffset;
v8 = *(struct_35 **)((char *)v6 + v7 + 8);
if ( v8 == v4 )
break;
v6 = (int *)((char *)v8 - v7);
}
while ( v6 );
return v5;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment