Kaldaien / TZF

Tales of Zestiria "Fix" - Framerate, Render and Sound Fixes
GNU General Public License v2.0
115 stars 14 forks source link

Halve game speed (for 60 FPS support) #2

Closed drdaxxy closed 8 years ago

drdaxxy commented 8 years ago

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 at SpeedResetCode_Address and SpeedResetCode2_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.