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

Unlock cutscene framerrate/turn off FG for cutscenes #1

Open
VonManGuy opened this issue Dec 10, 2024 · 24 comments
Open

Unlock cutscene framerrate/turn off FG for cutscenes #1

VonManGuy opened this issue Dec 10, 2024 · 24 comments

Comments

@VonManGuy
Copy link

VonManGuy commented Dec 10, 2024

Hello,

Love this fix and unsure if it would be possible but I believe that this game before Path Tracing (Update 1) had unlocked framerate on cutscenes. When locked @ 60 with FG it makes the cutscenes look worse in my opinion.

Is there any way to turn off FG for cutscenes or unlock cutscene fps?

Thank you so much for the support for ultrawide.

@Lyall
Copy link
Owner

Lyall commented Dec 10, 2024

I had a quick look at unlocking the framerate during cutscenes but it caused them to speed up. I'm not sure that it can be unlocked without issues but maybe with more research it'd be possible.

@PCLoadLetter2024
Copy link

PCLoadLetter2024 commented Dec 12, 2024

I, too, would love this. Going from 110ish - 114 fps to 60 fps is very jarring (looks jittery) and is the only thing preventing me from enjoying this otherwise good game. I've already tried Lossless Scaling and while the motion interpolation works to give the cutscenes the impression of running at 120 fps, it very much judders.

If you can figure out a way around the lock without compromising the animations I would be eternally grateful. I would do it myself if I had an inkling of a clue how to do so.

@dirtydanisreal
Copy link
Contributor

I had a quick look at unlocking the framerate during cutscenes but it caused them to speed up. I'm not sure that it can be unlocked without issues but maybe with more research it'd be possible.

could we set a custom fps limit for cutscenes? that way it isnt completely unlocked but it is capped

@Lyall
Copy link
Owner

Lyall commented Dec 16, 2024

I had a quick look at unlocking the framerate during cutscenes but it caused them to speed up. I'm not sure that it can be unlocked without issues but maybe with more research it'd be possible.

could we set a custom fps limit for cutscenes? that way it isnt completely unlocked but it is capped

It already is capped, to 60FPS. Unlocking it would likely cause timing issues.

@emoose
Copy link
Contributor

emoose commented Dec 16, 2024

mdnt_useDeltaTime 2 seems it might fix cutscene timing, needs a way to unlock the fps as well though, found com_syncToTime 0 would unlock it but not really sure if that's the best (looks like some flashing lights can have speed issues with that, maybe finding where the cutscenes actually enable the lock and disabling that would work better)

@Lyall
Copy link
Owner

Lyall commented Dec 16, 2024

mdnt_useDeltaTime 2 seems it might fix cutscene timing, needs a way to unlock the fps as well though, found com_syncToTime 0 would unlock it but not really sure if that's the best (looks like some flashing lights can have speed issues with that, maybe finding where the cutscenes actually enable the lock and disabling that would work better)

mdnt_enableCaptureClock 1 will uncap the framerate but it also seems to cause speed-up issues even outside of cutscenes.

You can manually uncap the framerate here:

TheGreatCircle.exe+E6A7DC - 0F5B C0               - cvtdq2ps xmm0,xmm0
>> TheGreatCircle.exe+E6A7DF - 48 8B 48 60           - mov rcx,[rax+60]
TheGreatCircle.exe+E6A7E3 - F3 0F5E C8            - divss xmm1,xmm0

One curious thing I spotted was r_cameraCutCounter, it makes me wonder if that's what is responsible for the hitching on cuts in certain scenes.

@emoose
Copy link
Contributor

emoose commented Dec 16, 2024

>> TheGreatCircle.exe+E6A7DF - 48 8B 48 60 - mov rcx,[rax+60]

Ah nice, seems better than com_syncToTime since the fps limit in settings will still be used

Nopping TheGreatCircle.exe+CFAD06 seems to allow FG to work during cutscenes (the byte that checks is setup at +1DCD947 but that byte could get checked by other code too, the CFAD06 code seems to be FG related only)

Gonna try the following out for a bit and see how it plays, wonder why they had FG disabled for these though...

  • TheGreatCircle.exe+E6A7DF -> xor rcx, rcx, remove cutscene framerate cap
  • mdnt_useDeltaTime 2, fix cutscene speedup
  • TheGreatCircle.exe+CFAD06 -> nop, allow FG during cutscene

@PCLoadLetter2024
Copy link

PCLoadLetter2024 commented Dec 16, 2024

Awesome, looks like you all are making progress. This has been killing me lately.

@Lyall
Copy link
Owner

Lyall commented Dec 16, 2024

>> TheGreatCircle.exe+E6A7DF - 48 8B 48 60 - mov rcx,[rax+60]

Ah nice, seems better than com_syncToTime since the fps limit in settings will still be used

Nopping TheGreatCircle.exe+CFAD06 seems to allow FG to work during cutscenes (the byte that checks is setup at +1DCD947 but that byte could get checked by other code too, the CFAD06 code seems to be FG related only)

Gonna try the following out for a bit and see how it plays, wonder why they had FG disabled for these though...

  • TheGreatCircle.exe+E6A7DF -> xor rcx, rcx, remove cutscene framerate cap
  • mdnt_useDeltaTime 2, fix cutscene speedup
  • TheGreatCircle.exe+CFAD06 -> nop, allow FG during cutscene

In my testing after following those steps, it seems that mdnt_useDeltaTime 2 does cause cutscene animations to playback at the correct speed but foliage in particular seems to be animating too fast.

If you start a new game, then back out to the main menu during the initial cutscene, the main menu will be presented as a cutscene which makes it a good spot to test.

Cutscene frame generation seems to work pretty well though. If the sync related issues can't be resolved, that'll at least make a great compromise.

Edit: There's two helpfully labelled functions that run before and after a cutscene that I made note of in-case anything had to be toggled during cutscenes.

TheGreatCircle.exe+1DCD8A2 - E8 395B95FE           - call TheGreatCircle.exe+7233E0
TheGreatCircle.exe+1DCD8A7 - 4C 8B F0              - mov r14,rax
TheGreatCircle.exe+1DCD8AA - 48 8D 0D 77258E01     - lea rcx,[TheGreatCircle.exe+36AFE28] { ("idLogicMidnightInstanceEventStartedRealtimeCS") }
TheGreatCircle.exe+1DCD8B1 - 89 58 08              - mov [rax+08],ebx
TheGreatCircle.exe+1DCD8B4 - 48 89 78 10           - mov [rax+10],rdi

There are also some interesting cvars that are set here if mdnt_cs_recordingHack is set to 1. I wonder if they might point in a helpful direction.

TheGreatCircle.exe+1DCD701 - 48 8D 99 28030000     - lea rbx,[rcx+00000328]
TheGreatCircle.exe+1DCD708 - 48 8B CB              - mov rcx,rbx
TheGreatCircle.exe+1DCD70B - E8 10876DFE           - call TheGreatCircle.exe+4A5E20
TheGreatCircle.exe+1DCD710 - 41 B8 1E000000        - mov r8d,0000001E { 30 }
TheGreatCircle.exe+1DCD716 - 48 8D 15 93A97B01     - lea rdx,[TheGreatCircle.exe+35880B0] { ("g_rate") }
TheGreatCircle.exe+1DCD71D - 48 8B CB              - mov rcx,rbx
TheGreatCircle.exe+1DCD720 - E8 4B886DFE           - call TheGreatCircle.exe+4A5F70
TheGreatCircle.exe+1DCD725 - 41 B8 1E000000        - mov r8d,0000001E { 30 }
TheGreatCircle.exe+1DCD72B - 48 8D 15 96636E01     - lea rdx,[TheGreatCircle.exe+34B3AC8] { ("com_adaptiveTickMaxHz") }
TheGreatCircle.exe+1DCD732 - 48 8B CB              - mov rcx,rbx
TheGreatCircle.exe+1DCD735 - E8 36886DFE           - call TheGreatCircle.exe+4A5F70
TheGreatCircle.exe+1DCD73A - 80 BE 59030000 00     - cmp byte ptr [rsi+00000359],00 { 0 }
TheGreatCircle.exe+1DCD741 - 75 16                 - jne TheGreatCircle.exe+1DCD759
TheGreatCircle.exe+1DCD743 - 4C 8D 05 F2A87B01     - lea r8,[TheGreatCircle.exe+358803C] { ("server") }
TheGreatCircle.exe+1DCD74A - 48 8B CB              - mov rcx,rbx
TheGreatCircle.exe+1DCD74D - 48 8D 15 F4A87B01     - lea rdx,[TheGreatCircle.exe+3588048] { ("ce_view") }
TheGreatCircle.exe+1DCD754 - E8 F78D6DFE           - call TheGreatCircle.exe+4A6550
TheGreatCircle.exe+1DCD759 - 41 B0 01              - mov r8b,01 { 1 }
TheGreatCircle.exe+1DCD75C - 48 8D 15 C5A87601     - lea rdx,[TheGreatCircle.exe+3538028] { ("r_lightScatteringQualityCinematic") }
TheGreatCircle.exe+1DCD763 - 48 8B CB              - mov rcx,rbx
TheGreatCircle.exe+1DCD766 - E8 258B6DFE           - call TheGreatCircle.exe+4A6290
TheGreatCircle.exe+1DCD76B - 45 33 C0              - xor r8d,r8d
TheGreatCircle.exe+1DCD76E - 48 8D 15 BB017801     - lea rdx,[TheGreatCircle.exe+354D930] { ("r_cameraCutCounter") }
TheGreatCircle.exe+1DCD775 - 48 8B CB              - mov rcx,rbx
TheGreatCircle.exe+1DCD778 - E8 F3876DFE           - call TheGreatCircle.exe+4A5F70
TheGreatCircle.exe+1DCD77D - 45 33 C0              - xor r8d,r8d
TheGreatCircle.exe+1DCD780 - 48 8D 15 015C7801     - lea rdx,[TheGreatCircle.exe+3553388] { ("r_shadowUseTileBinningVisibility") }
TheGreatCircle.exe+1DCD787 - 48 8B CB              - mov rcx,rbx

@emoose
Copy link
Contributor

emoose commented Dec 16, 2024

TheGreatCircle.exe+0x1822BF0 -> xor rdx, rdx seems to disable framelimit and also fix light flashing speed, maybe that'd also help foliage as well.
That also seems to fix the anim speed without needing mdnt_useDeltaTime, neat.
(AFAIK this is making it skip using any of the deltatime/timescale data from the midnight demo though, maybe would have issues if a cutscene had slo-mo or speed changes...)

FG in cutscenes mostly seems fine, there are some motion issues if you're looking for them though (maybe they disabled during cutscenes since you're more likely to notice when you're watching instead of playing), wonder if DLSSG-to-FSR might clean those up.

@Lyall
Copy link
Owner

Lyall commented Dec 16, 2024

@emoose Do you want to create a PR for any of this stuff?

@emoose
Copy link
Contributor

emoose commented Dec 17, 2024

Oh sure, just noticed you added ini support too which is perfect, will look into it now.

@Lyall
Copy link
Owner

Lyall commented Dec 17, 2024

That's v0.0.3 out with @emoose's cutscene framerate unlock/frame generation contributions.

@emoose
Copy link
Contributor

emoose commented Dec 17, 2024

Seems new patch broke the framerate unlock, darn, gonna have to rev up uwpdumper again

E: seems the code we patched for framerate unlock was changed a bit, locks to 60FPS for even more things now? probably gonna have to test it some more.

@PCLoadLetter2024
Copy link

Wasn't working for me in the beginning cutscenes and I haven't even patched it yet.

@emoose
Copy link
Contributor

emoose commented Dec 17, 2024

Odd, I've been testing with the intro cutscenes and always unlocked fine for me, does the log file mention anything?

If you want to try with newest update here's a build:
greatcirclefix-upd2.zip
Make sure to enable the frame unlock in INI

@PCLoadLetter2024
Copy link

PCLoadLetter2024 commented Dec 18, 2024

Weirdly still capped at 60 even with the newest update. How can I check the log file?

And Cutscene Framerate Unlock it is indeed set to True in the .ini.

Strange. Maybe I am not using the proper framegen .dll? I have the latest 3.8.1.

@emoose
Copy link
Contributor

emoose commented Dec 18, 2024

There should be a GreatCircleFix.log next to the game exe if it loaded in, also are you playing on gamepass or a different release?

@PCLoadLetter2024
Copy link

For whatever reason, no log.

I'm using the Steam version. Could have something to do with my install specifically.

@emoose
Copy link
Contributor

emoose commented Dec 18, 2024

Oh do you have the dinput8.dll next to the game exe too? Didn't include that in the zip, you can get it from latest release https://github.com/Lyall/GreatCircleFix/releases/download/v0.0.3/GreatCircleFix_v0.0.3.zip

With the dinput8.dll from that and the .asi/.ini from the upd2 zip above it should hopefully at least make a log file

@PCLoadLetter2024
Copy link

PCLoadLetter2024 commented Dec 18, 2024

That did the trick! Thank you.

They're unlocked now. There's some scenes where the camera's not entirely fluid, but it's mostly excellent. Way, way better. You two are sorcerers of sorts.

Great work. But just out of curiosity what FG dll version are you using? Also, while I'm here (as I know nothing about all of this) are you all using a hex editor to dig into all these files?

@emoose
Copy link
Contributor

emoose commented Dec 19, 2024

I'm just using the latest 3.8.1, doesn't really seem any different to the 3.7 the game came with though, still occasionally get some odd ghosting artifacts during cutscenes with both of them :/
Wonder if DLSSG-to-FSR would help at all, but haven't actually been able to get that working with this, maybe the DLSSG/SL game uses is too recent.

I mostly use IDA to look into games, it's paid software though but there is a free version available too, there's also Ghidra which is mostly the same thing but open-source (I've always preferred IDA for faster analysis/easier plugin coding though)

@PCLoadLetter2024
Copy link

PCLoadLetter2024 commented Dec 19, 2024

Ok, yeah I get some odd graphical flickers at times in the cutscenes with this new mod.

But yeah, I'm using 3.8.1 too and get really bad ghosting in general (not due to the mod) just when moving at times, and I think my base framerate is pretty ok. I also get a very bad case of microstuttering.

I tried using DLSSG-to-FSR last night - not extensively - and while it could have been placebic, it seemed like it was helping some as far as the egregious ghosting and some of the microstutter. Granted, I didn't get to test it enough; will later tonight.

EDIT: Nevermind. Did nothing. Any luck on this front?

@PCLoadLetter2024
Copy link

I see there's a FSR 3.1 mod from PureDark now. If you wanted to try that.

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

No branches or pull requests

5 participants