Skip to content

Instantly share code, notes, and snippets.

@st4rk
Created October 28, 2019 21:43
Show Gist options
  • Save st4rk/b344fd71cc9ecb3ec9e63cced18078a5 to your computer and use it in GitHub Desktop.
Save st4rk/b344fd71cc9ecb3ec9e63cced18078a5 to your computer and use it in GitHub Desktop.
void __cdecl pl_mv00_pad() {
int v0; // eax
print("pl_mv00_pad\n");
v0 = G->Key & 0xC0;
if (v0 != 128 && v0 != 192 || *(s8*)(&G->Key_trg) >= 0)
goto LABEL_57;
if (sub_45F960())
{
G->Status_flg |= 0x80u;
G->Flg_5 &= 0xFFBFu;
*(u16*)&G->Pl_work.R2 = 10;
G->Pl_work.field_8A = -128;
G->Pl_work.R1 = 1;
return;
}
if (sub_456880())
{
G->Pl_work.St_flg |= 0x80u;
G->Flg_5 &= 0xFFBFu;
*(u16*)&G->Pl_work.R2 = 12;
G->Pl_work.R1 = 1;
return;
}
if (G->Pl_work.field_3 & 0x20)
{
G->Pl_work.field_8A = -128;
G->Pl_work.R1 = 1;
G->Flg_5 &= 0xFFBFu;
*(u16*)&G->Pl_work.R2 = 17;
if (G->Status_flg & 0x10)
*(u16*)&G->Pl_work.R2 = 11;
}
else
{
LABEL_57:
if (*(s8*)(&G->Status_flg) < 0)
{
switch (G->Key & 0xF)
{
case 2:
if (G->Pl_work.R2 != 4)
G->Pl_work.R3 = 0;
G->Pl_work.R2 = 4;
break;
case 8:
if (G->Pl_work.R2 != 5)
G->Pl_work.R3 = 0;
G->Pl_work.R2 = 5;
break;
default:
return;
}
}
else if (G->Status_flg & 0x40)
{
G->Pl_work.R1 = 1;
G->Flg_5 &= 0xFFBFu;
*(u16*)&G->Pl_work.R2 = 16;
}
else if (G->Pl_work.field_3 & 0x20)
{
G->Pl_work.field_8A = -128;
G->Pl_work.R1 = 1;
G->Flg_5 &= 0xFFBFu;
*(u16*)&G->Pl_work.R2 = 17;
if (G->Status_flg & 0x10)
*(u16*)&G->Pl_work.R2 = 11;
}
else if (G->Key & 0x100 && G->Pl_work.Sc_id >= 0x6Fu)
{
G->Pl_work.R1 = 3;
if (G->Pl_work.Sc_id == 1)
G->Pl_work.R1 = 4;
*(u16*)&G->Pl_work.R2 = 18;
}
else if (G->Key & 0x100 && G->Pl_work.Sc_id >= 1u && G->Pl_work.Sc_id < 0xBu)
{
G->Pl_work.R1 = 3;
if (G->Pl_work.Sc_id == 1)
G->Pl_work.R1 = 4;
*(u16*)&G->Pl_work.R2 = 18;
}
else
{
switch (G->Key & 0xF)
{
case 1:
G->Pl_work.R2 = 1;
if (!(*(u16*)0xC3F8E4 & 1))
G->Pl_work.R3 = 0;
break;
case 2:
if (G->Pl_work.R2 != 4)
G->Pl_work.R3 = 0;
G->Pl_work.R2 = 4;
break;
case 3:
G->Pl_work.R2 = 2;
if (!(*(u16*)0xC3F8E4 & 1))
G->Pl_work.R3 = 0;
break;
case 4:
G->Pl_work.R2 = 8;
if (!(*(u16*)0xC3F8E4 & 4))
G->Pl_work.R3 = 0;
break;
case 6:
G->Pl_work.R2 = 6;
if (!(*(u16*)0xC3F8E4 & 4))
G->Pl_work.R3 = 0;
break;
case 8:
if (G->Pl_work.R2 != 5)
G->Pl_work.R3 = 0;
G->Pl_work.R2 = 5;
break;
case 9:
G->Pl_work.R2 = 3;
if (!(*(u16*)0xC3F8E4 & 1))
G->Pl_work.R3 = 0;
break;
case 0xC:
G->Pl_work.R2 = 7;
if (!(*(u16*)0xC3F8E4 & 4))
G->Pl_work.R3 = 0;
break;
default:
return;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment