-
Notifications
You must be signed in to change notification settings - Fork 32
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
Add FixSlowdown
to FRAME RATE
settings, support for above 60FPS
#25
Conversation
I played at 144 FPS up until the Hunnigan cutscene. Didn't encounter any issues so far. |
Nice! I'll test the stuff that triggers the usual FPS-related bugs, like this one I recorded on release: https://www.youtube.com/watch?v=PZEGNNjldqE
Edit: Grenade issue seems to still be here: 2021-12-03.09-38-14.mp4 |
Huh I've never seen that grenade problem before, that was with 60FPS? Wonder what could cause that.
Ah yeah same happens here, I only really tested this in windowed mode, but looks like fullscreen always uses 60Hz mode for some reason, will need to try looking into what handles that. E: might have found the cause for that, seems 0x9391E0 (1.1.0) goes through each D3DDISPLAYMODE returned by D3D9, but seems to only check for 60Hz ones there, so anything not 60hz will get skipped over... Unfortunately I can't test this out since it looks like my 100Hz mode doesn't show up in the D3DDISPLAYMODE list that D3D9 returns for some reason (guess it's something to do with being a custom resolution) If someone with a actual 120/144Hz monitor wants to test, open bio4.exe with hex editor, go to 0x538651, and change the 3C to your display rate in hex (for 120Hz use 78, |
Added some hooks that should allow non-60Hz fullscreen modes hopefully, like mentioned above I haven't been able to test it properly myself though, but think it should work. Build+INI here: winmm_fps-slowdown-fix-v2.zip Make sure the E: also just noticed 0x93A850 (1.1.0) seems to setup shadow resolution based on INI |
The first video (from 2014) was at 59 fps. Yeah, even one frame less than 60 caused issues.
Oh, nice! This should fix the black screen issue people have when their monitors don't have 60 hz as an option. Edit: latest build is crashing inside gameMainLoop, at this instruction: |
Great finds thanks!! I'll try it out when I get home and get back to you. |
That's with the build I just posted? What game ver is that? I did test against 1.1.0/1.0.6 before pushing, not sure why it'd be changing gameMainLoop. |
Hmm, tried disabling both options, but the game still crashes. There might be something wrong with my game? I'm using .exe ver 1.1.0 Edit: oh, it was raz0r's trainer crashing the game. No idea why. Grenade issue is happening consistently here: The game also freezes when trying to quit, for some reason: This is at 144 fps. Maybe that's too high? Also, might as well mention this here as well: that issue about invisible item in the inventory with RaiseInventoryAlloc enabled is happening here, but only with the builds you posted in this PR: |
Ah looks like it freezes on quit for me too with 60FPS, looks like it's the Does the inventory issue go away if you disable both FixSlowdown & FixDisplayMode? |
Here's a few issues:
Audio.mp4
Backwards+Turning.mp4
Striker.+.TMP.mp4
Inventory.Hang.mp4
Water.+.Headturn.mp460FPS footage was recorded with FixSlowdown = false and variableframerate 60. |
Thanks for giving it a try, I'd guess some of these like backwards turning/head turn/water are probably also wrong speed at 60FPS too, probably need to find a way to adjust those to match with 30FPS speed, like how nipkownix's 60FPS item falling fixes were done. That striker bug is crazy lol, haven't seen anything like that before, guess that's something animation related, but since it's also playing sounds for the shells too maybe it'll be easier to track down than the rifle animation issue. |
It doesn't, actually. This makes no sense. Release/Debug build from master: no inventory issue. However, people on nexus were having this exact same issue with the latest release, while it works fine for me.
Edit: I just built your branch myself and the bug isn't showing anymore. Even more cursed now. Edit2: uh, so, now it doesn't even show with your builds anymore. Some memory corruption must be happening randomly. |
Damn... guessing it's probably some weird memory issue, maybe something gets corrupt under certain conditions, I hate bugs like that >.< For me the inventory seems fine with this build, same with your one on nexus too :/ I'll try looking over the stuff we patched to redirect the buffer soon, maybe something was left out somewhere. (wonder if maybe g_MemPool_SubScreen/g_MemPool_SubScreen2 initial values could be affecting anything, maybe those should be memset to 0 first...) E: btw just to be sure, you're using the same resolution/fullscreen mode/etc between tests right? Was thinking maybe screen res changes how much of those buffer is filled, not sure about that though. |
Yep, same settings and starting a new game on every test. |
Can confirm that However the game is unstable in this build. Alt+Tabbing and opening the video settings in game will result in crash. |
Looks like the striker shell issue is something to do with the call to Not sure why E: hmm, think it's an issue inside Problem is somewhere around the Thinking about it, maybe this is what's causing issue with grenades too, game maybe doesn't realize animation has ended so it ends up like that, hmm E2: oh wait wtf, the shell issue happens for me even with |
Yep, I was about to post that. |
Hmm, might have an idea what's happening: MotionSequenceCtrl:
v4 = (flags & 4) == 0;
animNumFrames_ = a1->numFrames_BC;
newFrameNum = *((float *)pG + 0x1C) * a1->speed_C0 + a1->field_B8;
newFrameNum_ = newFrameNum;
a1->field_B8 = newFrameNum;
if ( v4 )
{
animNumFrames__ = (double)animNumFrames_;
if ( animNumFrames__ <= newFrameNum_ )
{
v9 = animNumFrames__ - *((float *)pG + 0x1C);
a1->field_42 = 4;
a1->field_B8 = v9;
}
}
else
{
v7 = (double)animNumFrames_;
if ( v7 <= newFrameNum_ )
{
a1->field_42 = 1;
a1->field_B8 = newFrameNum_ - v7;
}
}
}
In that code it seems to be using the deltaTime ( Problem is with our Wonder if changing that so it just uses animNumFrames__ value if it's above it might help at all, wouldn't be surprised if that ends up breaking other stuff though. E: aha yep, nopping the insn that subtracts deltaTime seems to fix it 😄 no doubt something else is probably broken though. |
…m anim frame number
Here's a build of that commit: Only difference I've noticed is the striker shell bug is fixed, looks like grenades are still broken, and game still won't quit properly :/ E: seems grenade explosion is triggered by New IDB with the cSubWep stuff labelled: pc-1.1.0_enum - Copy.7z.zip E: it's looking like Not really sure if this can be patched that easily, maybe hooking it and setting to 0 if it's below might work though. |
Alright seem to have something working, should fix grenades + striker reloading, haven't tested it that much yet though so not sure if it might break anything else. Build+INI: winmm_fps-slowdown-fix-v4.zip |
Nice! Your fixes are working nicely here! Edit: another freeze issue I've noticed:
|
This build fixes the TMP reload sound too, but breaks several death animations (even at 60fps with FixSlowdown = true): Death.animations.mp4Also another bug that happens with the original build (second jump on the church bridge): Church.jump.mp4 |
About A custom refresh rate could then be set from winmm.ini, which is easier to find and allows evrything to be configured from one place, + we can change it using the ImGui menu, I guess. |
Hi, I've been having trouble trying to get the Steam version of Resident Evil 4 running on my PC for the past year or so since my laptop (a Lenovo Legion 7i) has no selectable refresh rate other than 144Hz and CRU isn't working for me. The game would only open in a small black window with audible sound but no video. This fix managed to at least fix the video, for which I'm grateful, but I hadn't walked two feet before trying to check settings in the options menu and it crashes to desktop. As far as I can tell, it's only the primary pause/options menu. Is there a way to fix this? |
Made the changes to @SupahDrivah1234, I believe you're the same person I replied to on Steam, but here's a build with just the black screen fix and nothing else from this PR, since the other stuff is probably what is crashing your game: |
about that grenade suspension problem; was this ever resolved? I recently noticed this too on a room I was working on, but managed to fix it by editing the EAT file. Maybe that issue you see is simply some bad EAT in the room you were in (looks like r109 if I am not mistaken). If the issue is still present, I can edit the r109 and send it over for testing. |
I think you did reply to me on Steam, yes. Unfortunately, even with a clean install of RE4 this new build didn't work. I'm facing the same issue of being unable to open the options menu without crashing to desktop. |
Hmm, this new test build has some logging that might help us understand the issue a little better: To the get log, create a folder named "CrashDumps" in re4's bin32 folder, near the .exe file.
I think it was solved with the last commit. |
@emoose Got a crash log + minidump of the issue @SupahDrivah1234 is having. Used the stuff from the branch I mentioned in #38. Looks like the Edit: Got it to not crash by making it just not read the resolution list: No idea what could be wrong with this list though. Maybe the game is making a list of 60hz resolutions -only-? And we end up with an empty list if no 60hz mode is present? |
That reminded me of this comment in one of the commits here: 28c2701#diff-59bafca88011950dfe128dac79f2499e832dde20dc1ee96cdf788919734f3961R170 Could be that's related, I'm not sure if your FixDisplayMode touches the func hooked there, might be worth looking into. E2: ah I should have looked at your commits first, looks like that does already hook that func, hmm... guess there's probably other 60Hz checks around too, maybe in one of the addrs above. |
Hmm, my FixDisplayMode is the exact same as yours, the only difference being that I get the refresh rate from Windows instead of getting it from the ini file. |
I think that fix only hooks the EnumAdapterModes stuff in 0x9391E0, but looks like the 0x953480 func that calls EnumAdapterModes also has some weird 60 checks inside it, maybe that's what makes the res list. (E: does seem to get called just a little bit before the part that caused exception too) Some weird checks in that for |
Oh, there's another func calling EnumAdapterModes? I'll check that out. Edit: You're right on the money again, @emoose. Hooking that section fixed the crash! Thank you!
Oh no! But what about the people runing RTX 12080s in a distante future?! We better add an option to uncap this silly limit. |
@SupahDrivah1234, let me know if this build resolves your issue: |
@nipkownix Glad to hear it was resolved. EAT files handle projectile collision data and has the same structure as SAT which handles player and enemy collision data. With no EAT there is no ground for the grenade to bounce off. |
That worked! thank you so much for your help. |
BTW the PCGW page for RE4 currently links to the old Maybe it's worth making a proper release with the new fixes, if you feel all the new changes after 1.6 are stable enough. |
Ah, thanks for the heads up. I'll probably make a new release today, then. I just want to address #40 before making the release. Edit: new release is up and I've updated the PCGW stuff. |
Hmm, so the main animation problems seemed to be caused by delta-time varying between different frames... I wonder if locking it to 90/120FPS frametime would work better, wouldn't help with the slowdown issue at all, but it'd give benefit of increased framerate at least (as long as user can maintain it), I guess it'd probably help show what things need framerate fixes too (wind/water/etc). Maybe I'll make a new PR soon with something like that, since this PR draft is mostly to do with slowdown. |
Nice. Sounds like a good idea to me. |
Huh seems it's easier than I thought, just need to overwrite the double it uses for limiting framerate from 0.166666... to 1/framerate, so 0.011111... for 90FPS, (double is at 0xB1D180 in 1.1.0), then make sure your config.ini variableframerate is set to 90, and with those game looks like it runs at 90 fine - would probably work with 120 fine as well, but my monitor doesn't support that so can't test it myself - not sure if 144 would work that well since it's not a multiple of 30. I imagine there's probably lots of things that need timing fixed similar to the 60FPS fixes though, maybe running at higher framerate will make it easier to spot those. If anyone wants to try it out here's some builds, feel free to report issues in this PR for now: Edit your Documents\My Games\Capcom\RE4\config.ini first and set resolution line to end with 90/120/144, and set variableframerate to 90/120/144, and edit re4_tweaks INI and change IgnoreFPSWarning to true (forgot to do that in the included INI...) (btw, seems re4_tweaks is ignoring the |
Could have been because I moved IgnoreFPSWarning to another section in the .ini file? |
Ah that might be it, looks like my INI had it in the new section tho, so guess I was probably using a build from before 1.7.2 somehow (maybe built from an older commit at some point) In case anyones wondering, the builds I posted are from the latest commit, just added a line of code to patch the frametime in. |
Not sure if it's a known issue, but I tried |
Posted a new PR with improved framelimiter fix here: #50 If anyone wants to test greater-than-60 FPS please let us know of any issues there! |
Made the fix from #23 (comment) use signatures, seems to work fine across 1.0.6/1.0.6 debug/1.1.0 😃
I noticed one thing while testing, seems
maxFrameTime
var shouldn't be kept at 31, looks like it depends on the display / internal framerate (not sure which yet), so for now it's set to(variableFramerate / 2) + 1
This means going below half of the variableFramerate setting will still result in slowdown though... hopefully can find some way to detect if user is in the new-game event & only apply this maxFrameTime stuff in that case (or detect if user is in gameplay & make it disable this instead), so we can get rid of all slowdown during gameplay. (the commented EvtMgr stuff might help with this in future, so I left that in for now)
I've only added INI setting for it, wasn't sure about adding to UI since I don't know how easily this can be reversed :/
This should probably be tested out a lot before merging, have only really tried out the beginning new-game section with it myself so far... will probably try a 100Hz run over the weekend, if anyone has a >60Hz monitor please give it a try!
E: here's a build + INI for it, INI has been setup to enable it: winmm_fps-slowdown-fix.zip
To use >60FPS, edit your
Documents\My Games\Capcom\RE4\config.ini
file, and changevariableframerate
to your desired framerate, and run the game - if it still doesn't work, try settingvsync
to 0 in config.ini.