Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skylanders: Fix infinite fall softlock at high FPS #639

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SuperSamus
Copy link
Contributor

@SuperSamus SuperSamus commented Jul 26, 2024

Fixes one of the issues caused by higher framerates in the Skylanders saga: #615.

The reason why the character was respawning during long falls is because of a failsafe meant in case your character is stuck falling between geometry.
The game determines whether you are stuck with a simple method: it calculates the squared distance of your character from the position of the previous frame, then checks whether it's lower than 20². If that's true for 3 seconds, then it teleports you.
But if the framerate is higher, your distance is going to be lower than normal, and the game will consider you stuck even when falling at top speed.
Ironic...

The fix simply consists in overriding the load of 20.0, and load 20×30FPS/targetFPS instead.
(Ideally you would multiply by deltaTime instead of dividing by targetFPS, but since it's not already loaded in a register in that part, not bothering.)

Before:

before.mp4

After:

after.mp4

Credits:

  • Me for understanding and patching the issue on the Wii version of Swap Force.
  • @WinnerNombre for finding the addresses for the Wii U games. (And for the videos.)

This is currently a draft, as this is only one version of one game, so not worth merging now. More games and versions will be added later.
I'm leaving this for documentation and for reference.

Other things for reference:

  • For games that have debug symbols, the function is named updateStuckFallingCheck.

@SuperSamus
Copy link
Contributor Author

Both versions of Swap Force are here!

@Crementif
Copy link
Member

That's cool! Is this still intended to be a draft pull request, or is it mergeable. I'll trust you to say whatever is better for the users.

@SuperSamus
Copy link
Contributor Author

It's currently missing the other versions of SuperChargers.
@WinnerNombre said they'll look into that when they have time. These games luckily have debug symbols, so that should be quick.

@SuperSamus
Copy link
Contributor Author

All version of SuperChargers are here!
Ready for review.

@SuperSamus SuperSamus marked this pull request as ready for review October 6, 2024 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants