require(GlobalDependencys:GetDependency("StandardBase"):GetPackageName()) --GAME VARS fAdditionalFOV = 0 fDefaultAspectRatio = 1.777777791 fInitialFOV = 0 --ControlVars bFixEnabled = true bCSAspectRatio = true bFOV = true --PROCESS VARS Process_FriendlyName = Module:GetFriendlyName() Process_WindowName = "Marvel's Guardians of the Galaxy" Process_ClassName = "ZSystemClass000" Process_EXEName = "gotg.exe" --INJECTION BEHAVIOUR InjectDelay = 500 WriteInterval = 500 SearchInterval = 500 SuspendThread = true --Name Manual/Auto/Hybrid Steam/Origin/Any IncludeFile:Configure;Enable;Periodic;Disable; SupportedVersions = { {"Automatically Detect", "Hybrid", "Any", "Configure_SignatureScan;Enable_Inject;Periodic;Disable_Inject;"}, } function Init_Controls() DefaultControls.AddHeader("Header_FixesEnableDisable","Individual Fixes",245,70,210,17) DefaultControls.AddHeader("Header_FOV","FOV Fine adjustment",15,70,210,17) DefaultControls.AddFOVSlider("FOVSlider","FOVSlider_Changed",55,100,125,35) DefaultControls.AddFixToggle("CKCSAspectFix_Enable","Cutscene Aspect Fix","CKCSAspectFix_Changed",255,101,180,14) DefaultControls.AddFixToggle("CKFOVFix_Enable","FOV Fix","CKFOVFix_Changed",255,101,180,54) end function Configure_SignatureScan() local tAddress = HackTool:AddAddress("CSAspectConstrain") if HackTool:SignatureScan("F3 48 0F 2A ?? F3 48 0F 2A ?? 0F 28 ?? F3 0F ?? ?? 0F ?? ?? 76 ?? 44",tAddress,PAGE_EXECUTE_READ,0x14,Process_EXEName) == 0 then return ErrorOccurred(string.format(SigScanError,tAddress:GetName())) else print( tAddress:GetInfo(TYPE_ADDRESS) ) end local tAddress = HackTool:AddAddress("FOV") --if HackTool:SignatureScan("0F 28 C1 F3 0F 5C 41 10",tAddress,PAGE_EXECUTE_READ,0x0,Process_EXEName) == 0 then if HackTool:SignatureScan("FF 90 28 02 00 00 48 8B 45",tAddress,PAGE_EXECUTE_READ,0x0,Process_EXEName) == 0 then return ErrorOccurred(string.format(SigScanError,tAddress:GetName())) else print( tAddress:GetInfo(TYPE_ADDRESS) ) end return true end function Enable_Inject() local Variables = HackTool:AllocateMemory("Variables",0) Variables:PushFloat("FOV") Variables:PushFloat("InitialFOV") Variables:Allocate() Variables["InitialFOV"]:WriteFloat(fInitialFOV) ResolutionChanged() local asm = [[ (codecave)CSAspectConstrain,CSAspectConstrain_cc: jmp $$1 (codecave:jmp)FOV,FOV_cc: %originalcode% movaps xmm15,xmm1 addss xmm15,[(allocation)Variables->FOV] movss [rcx+0x10],xmm15 ; second code ;%originalcode% ;movss xmm15,xmm1 ;addss xmm15,[(allocation)Variables->FOV] ; additional FOV to game's locked one ;movss [rcx+0x10],xmm15 ; first code ;movss [(allocation)Variables->InitialFOV],xmm1 ;addss xmm1,[(allocation)Variables->FOV] ; additional FOV to game's locked one ;%originalcode% jmp %returnaddress% %end% ; gotg.exe+8AF680: 0F 28 C1 - movaps xmm0,xmm1 copy FOV from register to another ; gotg.exe+8AF683: F3 0F 5C 41 10 - subss xmm0,[rcx+10] ]] if HackTool:CompileAssembly(asm,"FOVFix") == nil then return ErrorOccurred("Assembly compilation failed...") else Toggle_CodeCave("CSAspectConstrain_cc",bCSAspectRatio) Toggle_CodeCave("FOV_cc",bFOV) if bFOV then WriteFOV() end end end function Periodic() local Variables = HackTool:GetAllocation("Variables") local calculatedFOV = 55 + Variables["FOV"]:ReadFloat() if Variables and Variables["FOV"] then PluginViewport:AppendStatusMessage( string.format("\r\n===== Fix informations =====\r\nIn game new : FOV %.2f\r\n", calculatedFOV ) ) end end function FOVSlider_Changed(Sender) fAdditionalFOV = (Sender:GetScaledFloat(2) * 1.5) + 25 lblFOVSlider.Caption:SetCaption( string.format("Value: %.0f",fAdditionalFOV) ) WriteFOV() ForceUpdate() end function WriteFOV() local Variables = HackTool:GetAllocation("Variables") if Variables and Variables["FOV"] then Variables["FOV"]:WriteFloat(fAdditionalFOV) end end function Disable_Inject() CleanUp() end function CKCSAspectFix_Changed(Sender) bCSAspectRatio = Toggle_CheckFix(Sender) Toggle_CodeCave("CSAspectConstrain_cc",bCSAspectRatio) ForceUpdate() end function CKFOVFix_Changed(Sender) bFOV = Toggle_CheckFix(Sender) Toggle_CodeCave("FOV_cc",bFOV) ForceUpdate() end function ResolutionChanged() SyncDisplayDetection() end function Init() Init_BaseControls() Init_Controls() end function DeInit() DisableFix() end