PotatoOfDoom / CyberFSR2

FidelityFx Super Resolution 2.0 for Cyberpunk
MIT License
620 stars 67 forks source link

Disable the need for registry edits #12

Open RealIndica opened 2 years ago

RealIndica commented 2 years ago

Although it is nice that with a registry edit you can enable signature override but this might have implications for other games and certain anti-cheats.

It is possible to enable signature override within Cyberpunk by setting a single byte to 0x1 at the address 0x4B9AA0C and any registry modifications will not be needed.

You would most likely need another DLL to make the modifications before nvngx.dll is loaded.

Address can be found by searching for referenced string "OVERRIDE DETECTED" and can be found at the start of the function where a pointer to that address can be found.

imniko commented 2 years ago

Its a bit more nuanced than that, not all game uses same check, also some games apply different checks even before the "OVERRIDE DETECTED" part, like in HZD the dll loads fine for Nvidia users (after the registry patch of course), but does not load on AMD even with the reg patch, so I had to find another check that happens before the "OVERRIDE DETECTED" part, thus we have to consider that the patching is going to be different for some games. So the mod needs to be flexible enough to consider such cases.

RealIndica commented 2 years ago

Its a bit more nuanced than that, not all game uses same check, also some games apply different checks even before the "OVERRIDE DETECTED" part, like in HZD the dll loads fine for Nvidia users (after the registry patch of course), but does not load on AMD even with the reg patch, so I had to find another check that happens before the "OVERRIDE DETECTED" part, thus we have to consider that the patching is going to be different for some games. So the mod needs to be flexible enough to consider such cases.

That's a game specific check, not the override im referring to. The check you are referring to can be bypassed by switching the jz to jnz or nopping out the responsible instruction entirely which is what my fork does for RDR2.

imniko commented 2 years ago

Yes, I got the idea of bypassing the driver check from your repo (changing JNZ to JZ), so thanks for that, as I never done any IDA/assembly related work before. And I wasn't saying we need the registry, I was just chiming in to say, while we are at it (patching the exe instead of reg) we should also find a flexible way to patch game specific stuffs, maybe creating a separate issue for this would be better.

RealIndica commented 2 years ago

Yes, I got the idea of bypassing the driver check from your repo (changing JNZ to JZ), so thanks for that, as I never done any IDA/assembly related work before. And I wasn't saying we need the registry, I was just chiming in to say, while we are at it (patching the exe instead of reg) we should also find a flexible way to patch game specific stuffs, maybe creating a separate issue for this would be better.

A flexible method of applying patches pre-nvngx load would be useful. Right now the best method is to find the name of another DLL the game would load and patch with that but it might be possible to write a service program to auto-patch a game upon launch. Even better, could be done automatically if you can grab the signature for the function that contains a pointer to the signature override byte and just find the instructions offset and get the pointer from the mov instruction.

PIPIPIG233666 commented 2 years ago

That's a game specific check, not the override im referring to. The check you are referring to can be bypassed by switching the jz to jnz or nopping out the responsible instruction entirely which is what my fork does for RDR2.

Any hint on which function to look for? I'm trying to do SOTTR.


image

I think I found it, at least something related to GPU check.