Halve game speed (for 60 FPS support) #2
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed, here's a patch that halves Zestiria's simulation speed, letting us run the game at 60 FPS in real time.
For reference / future game updates: addresses were found by looking around for 1/30 in memory and tracing through related code. There's two integer speed multipliers, initially set to 2 at
SpeedResetCode3_Address
, as part of a structure at a static address. I found they get copied over from an object, or reset if lower than 2, upon some state changes (e.g. loading a save or entering a cutscene), hence I patch the code that does this atSpeedResetCode_Address
andSpeedResetCode2_Address
to skip these particular multipliers.The size of said structure is not hardcoded to allow for at least some flexibility to game updates - should its base address and the location and syntax of the code copying it stay the same, this patch will continue to function even if the structure gets expanded after the part we care about.
The patch is activated if the target framerate is above 45 and thus running the game at 50% speed gets us closer to real time than 100%.
In addition, I change the FudgeFactor internally (i.e. not saved to config) according to the target framerate, as I've noticed the default 1.666 is inadequate when targeting 60 FPS, causing slowdowns of about 1/6 in busy town areas.
Note this is not yet shippable, as the target framerate is hardcoded to 60 for now. As we talked about, this value should be looked up from BMF.
Once that is implemented, no further configuration changes than setting
targetFPS=60
in BMF's config are necessary to activate this patch.Best regards,
Niklas.