-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
desync: freeze deadupfall physics position
Normally, the fighter's position is centered with the camera by directly updating the model's position with respect to the camera's view matrix. However, it also updates the fighter's physics position. This becomes a problem when screen shake is disabled on one client, as it will cause the physics position of the fighter being screen ko'd to differ slightly. This only seems to matter in the case of Ice Climbers, because Nana uses Popo's physics position to determine her next action.
- Loading branch information
1 parent
5b90483
commit bdfef2c
Showing
5 changed files
with
180 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
################################################################################ | ||
# Address: 0x800d4c1c | ||
################################################################################ | ||
|
||
.include "Common/Common.s" | ||
.include "Online/Online.s" | ||
|
||
# orig instruction | ||
stw r0, 0x2344 (r31) | ||
|
||
# init custom velocity | ||
lfs f0, 0x0030 (r30) # y velocity | ||
stfs f0, 0x2348 (r31) | ||
lfs f0, 0x003C (r30) # z velocity | ||
stfs f0, 0x234C (r31) | ||
|
||
# zero original velocity | ||
li r3,0 | ||
stw r3, 0x80 (r31) | ||
stw r3, 0x84 (r31) | ||
stw r3, 0x88 (r31) | ||
|
||
Exit: |
45 changes: 45 additions & 0 deletions
45
Online/Core/FreezeDeadUpFallPhysics/UpdateFallVelocity.asm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
################################################################################ | ||
# Address: 0x800d4d68 | ||
################################################################################ | ||
.include "Common/Common.s" | ||
.include "Online/Online.s" | ||
|
||
/* | ||
During DeadUpFall, after the fighter hits the screen | ||
|
||
0x2348 = previously used variable, now storing Y velocity | ||
0x234C = previously used variable, now storing Z velocity | ||
0x2350 = position vector | ||
0x235c = temp velocity vector (contents cleared when leaving function so cant use this across frames) | ||
*/ | ||
|
||
# orig instruction | ||
lfs f1, 0x0034 (r30) # gravity | ||
lfs f2, 0x0038 (r30) # terminal velocity | ||
lfs f3, 0x2348 (r31) # curr Y velocity | ||
|
||
# subtract gravity | ||
fsub f3, f3, f1 | ||
fneg f2, f2 # negate terminal velocity | ||
fcmpo cr0, f3, f2 # limit velocity | ||
bgt StoreVelocity | ||
# use terminal velocity | ||
fmr f3, f2 | ||
StoreVelocity: | ||
stfs f3, 0x2348 (r31) | ||
|
||
UpdateVector: | ||
# update Y position | ||
lfs f1, 0x2360 (r31) # y component of temp velocity | ||
lfs f2, 0x2348 (r31) # curr Y velocity | ||
fadds f1,f1,f2 | ||
stfs f1, 0x2360 (r31) # y component of temp velocity | ||
# update Z position | ||
lfs f1, 0x234C (r31) # curr Z velocity | ||
lfs f2, 0x2364 (r31) # Z component of temp velocity | ||
fadds f1,f1,f2 | ||
stfs f1, 0x2364 (r31) # Z component of temp velocity | ||
|
||
|
||
Exit: | ||
branch r12,0x800d4d84 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
################################################################################ | ||
# Address: 0x80080e80 | ||
################################################################################ | ||
.include "Common/Common.s" | ||
.include "Online/Online.s" | ||
|
||
/* | ||
The fighter's position is centered with the camera by directly | ||
updating the model's position with respect to the camera's view matrix. | ||
|
||
However, it also updates the fighter's physics position. This becomes a | ||
problem when screen shake is disabled on one client, as it will cause | ||
the physics position of the fighter being screen ko'd to differ slightly. | ||
This only seems to matter in the case of Ice Climbers, because Nana uses | ||
Popo's physics position to determine her next action. | ||
*/ | ||
|
||
backup | ||
|
||
# update camera mtx and return mtx ptr? | ||
branchl r12,0x800310b8 | ||
# get inverted viewing mtx ptr | ||
branchl r12,0x80369808 | ||
|
||
# mult with position vector | ||
addi r4, r30, 0x2350 # position vector | ||
addi r5, sp, 0x80 # output to temp vector on stack | ||
branchl r12,0x80342aa8 | ||
|
||
# update model position | ||
lwz r3, 0x80(sp) # vector X | ||
stw r3, 0x38(31) # model X | ||
lwz r3, 0x84(sp) # vector Y | ||
stw r3, 0x3c(31) # model Y | ||
lwz r3, 0x88(sp) # vector Z | ||
stw r3, 0x40(31) # model Z | ||
|
||
Exit: | ||
restore | ||
branch r12,0x80080ee4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters