superkooks / sot-fov

Change the FoV of Sea of Thieves to 120 degrees (Linux only)
GNU General Public License v3.0
1 stars 0 forks source link

Fixed fov for cannon and helm (feature request) #2

Open terpii opened 2 years ago

terpii commented 2 years ago

Would be nice if the fov stays the same during cannon and helm. I tried to implement this myself, but I'm confused how one finds the pattern for the functions to hook. My idea would be to hook cannon and helm functions you can probably find in this list and just run the same that we would run when we trap the fov call. I'm just not sure how to convert the memory address in the list to the byte array used to find the fov function.

superkooks commented 2 years ago

I'll look into it. I don't really know how the function signature was found, I copied it from https://github.com/NtLoadDriverEx/fov_hk. The signature is simply the first 10 bytes of the function. I'm not exactly sure how this function was found, but I do know that it accepts a pointer to the struct as it's first argument, so somewhere must a function that does the same thing, but potentially with a different struct.

I can't find the current function in the list by it's address, but it could have a different for different versions and platforms. By my reckoning the function we are hooking is this one: 0x00007FF745C90010 , UFOVHandlerFunctions::execSetTargetFOV "void UFOVHandlerFunctions::SetTargetFOV(AAthenaPlayerCharacter* Character, float TargetFOV)"

superkooks commented 2 years ago

I've been thinking about this issue. I don't see a realistic way to do this. The only way to really do this is collect all function calls that happen when the user uses the cannon, and then try to map each one to a function in the list you provided. Then you look for function calls mentioning fov, or at least the AAthenaPlayerCharacter and try set breakpoints on each. The problem is that the list you posted isn't accurate on linux, which makes it impossible to look through the function calls.

Maybe the addresses line up on windows? I am unable to test this as my Sea of Thieves is installed on a ext4 partition, which isn't accessible from windows, and I can't run the game in a VM because it doesn't support DX11. If you have Sea of Thieves installed on windows, maybe you could use WinDbg to view the address 0x00007FF745C90010 and see if it lines up with the function signature we use, 40 57 48 83 EC 30 80 79 44 00. Right now that seems the only way forward.

superkooks commented 2 years ago

Update: I managed to start Sea of Thieves on Windows, but whenever I attach WinDbg, it crashes the game, meaning I am unable to do any debugging. Unless it works for someone else, I don't see any way to support this.

terpii commented 2 years ago

You can also use WinDbg on Linux using protonhax. Its probably better because we wanna develop it for Linux anyway.

terpii commented 2 years ago

Sorry didn't want to close this

superkooks commented 2 years ago

I've taken another crack at this, but it hasn't worked either. I extracted the list of functions for the latest version using https://github.com/guttir14/UnrealDumper-4.25 (UnrealDumper-4.10 branch). Then I used the generated header files to find the address of other functions, based on the address of the known function. It didn't work, all I ended up with were segfaults.

Protonhax looks cool, but I couldn't install CheatEngine, so... not very useful to me. I ended using WinDbg as a disassembler/memory inspector, then copying the byte sequence of the function so I could use find it on linux using gdb.