Open joshlory opened 4 months ago
We have a few patterns implemented for this already, but it's pretty fragile. Can you post the asm that resulted in the above?
There are a few in weapon funcs, links below.
https://decomp.me/scratch/udWNi
2ac: move a2,s0
2b0: lw t0,0(s0)
2b4: ~> lw v0,0(a3)
2b8: lw v1,4(a3)
2bc: lw a0,8(a3)
2c0: lw a1,0xc(a3)
2c4: sw v0,0(a2)
2c8: sw v1,4(a2)
2cc: sw a0,8(a2)
2d0: sw a1,0xc(a2)
2d4: addiu a3,a3,0x10
2d8: bne a3,t1,2b4 ~>
2dc: addiu a2,a2,0x10
2e0: lw v0,0(a3)
2e4: nop
2e8: sw v0,0(a2)
https://decomp.me/scratch/p4pzA
2a0: move a2,s0
2a4: lw t0,0(s0)
2a8: ~> lw v0,0(a3)
2ac: lw v1,4(a3)
2b0: lw a0,8(a3)
2b4: lw a1,0xc(a3)
2b8: sw v0,0(a2)
2bc: sw v1,4(a2)
2c0: sw a0,8(a2)
2c4: sw a1,0xc(a2)
2c8: addiu a3,a3,0x10
2cc: bne a3,t1,2a8 ~>
2d0: addiu a2,a2,0x10
2d4: lw v0,0(a3)
2d8: nop
2dc: sw v0,0(a2)
https://decomp.me/scratch/MnTB0
2a0: move a2,s0
2a4: lw t1,0(s0)
2a8: ~> lw v0,0(a3)
2ac: lw v1,4(a3)
2b0: lw a0,8(a3)
2b4: lw a1,0xc(a3)
2b8: sw v0,0(a2)
2bc: sw v1,4(a2)
2c0: sw a0,8(a2)
2c4: sw a1,0xc(a2)
2c8: addiu a3,a3,0x10
2cc: bne a3,t0,2a8 ~>
2d0: addiu a2,a2,0x10
2d4: lw v0,0(a3)
2d8: nop
2dc: sw v0,0(a2)
Slightly different pattern here: https://decomp.me/scratch/ra0BJ
c: addiu a3,sp,0x10
10: lui a2,%hi(g_Entities)
14: addiu a2,a2,%lo(g_Entities)
18: addiu t0,a2,0xb0
2c: ~> lw v0,0(a2)
30: lw v1,4(a2)
34: lw a0,8(a2)
38: lw a1,0xc(a2)
3c: sw v0,0(a3)
40: sw v1,4(a3)
44: sw a0,8(a3)
48: sw a1,0xc(a3)
4c: addiu a2,a2,0x10
50: bne a2,t0,2c ~>
54: addiu a3,a3,0x10
58: lw v0,0(a2)
5c: lw v1,4(a2)
60: lw a0,8(a2)
64: sw v0,0(a3)
68: sw v1,4(a3)
6c: sw a0,8(a3)
We've seen this pattern in sotn decomp:
...which matches as: