0% found this document useful (0 votes)
36 views4 pages

FOV and Aspect Ratio Adjustments Script

Uploaded by

publisher.dva
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views4 pages

FOV and Aspect Ratio Adjustments Script

Uploaded by

publisher.dva
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

require(GlobalDependencys:GetDependency("StandardBase"):GetPackageName())

--GAME VARS
fAdditionalFOV = 0
fDefaultAspectRatio = 1.777777791
fFOVMax = 110

--ControlVars
bFOVFix = true
bFixEnabled = true
bAspectRatio = true

--PROCESS VARS
Process_FriendlyName = "Spec Ops: The Line"
Process_WindowName = "Spec Ops: The Line"
Process_ClassName = "LaunchUnrealUWindowsClient"
Process_EXEName = "*"

--INJECTION BEHAVIOUR
InjectDelay = 5000
WriteInterval = 500
SearchInterval = 1000
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()
[Link]("Header_FOV","FOV Fine adjustment",15,70,210,17)
[Link]("FOVSlider","FOVSlider_Changed",55,100,125,35)
[Link]("Header_FixesEnableDisable","Individual
Fixes",245,70,210,17)
[Link]("CKFOVFix_Enable","FOV
Fix","CKFOVFix_Changed",255,101,180,14)
[Link]("CKAspect_Enable","Aspect
Ratio","CKAspect_Changed",255,120,180,14)
end

function Configure_SignatureScan()

local tAddress = HackTool:AddAddress("MenuAspectRatio")


if HackTool:SignatureScan("F30F10??D905????????0F????
F3",tAddress,PAGE_EXECUTE_READ,0,Process_EXEName) == 0 then
return ErrorOccurred([Link](SigScanError,tAddress:GetName()))
else
tAddress:AcquireAddress(0x6)
print( tAddress:GetInfo(TYPE_FLOAT) )
end

local tAddress = HackTool:AddAddress("InGameAspectRatio")


if HackTool:SignatureScan("8B??????????D95C????D9??????????8D????????????
D9",tAddress,PAGE_EXECUTE_READ,0xA,Process_EXEName) == 0 then
return ErrorOccurred([Link](SigScanError,tAddress:GetName()))
else
print( tAddress:GetInfo(TYPE_ADDRESS) )
end

local tAddress = HackTool:AddAddress("FOVFix")


if HackTool:SignatureScan("D905????????F30F10??????
F30F5905",tAddress,PAGE_EXECUTE_READ,0x6,Process_EXEName) == 0 then
return ErrorOccurred([Link](SigScanError,tAddress:GetName()))
else
print( tAddress:GetInfo(TYPE_ADDRESS) )
end

return true

end

function Enable_Inject()

FOVCalculator = HackTool:InjectFOVCalculator("FOVCalculator")

ResolutionChanged()

local asm = [[

(codecave:jmp)FOVFix,FOVFix_cc:
fld dword [$$2]
call (allocation)FOVCalculator
fstp dword [$$2] $context=1
%originalcode%
jmp %returnaddress%
%end%

(codecave:jmp)InGameAspectRatio,InGameAspectRatio_cc:
fld dword ptr [(address)MenuAspectRatio]
fst dword ptr [$$2] $context=1
jmp %returnaddress%
%end%

]]

if HackTool:CompileAssembly(asm,"FOVFix") == nil then


return ErrorOccurred("Assembly compilation failed...")
else
Toggle_CodeCave("FOVFix_cc",bFOVFix)
Toggle_CodeCave("InGameAspectRatio_cc",bAspectRatio)
end

end

function Periodic()

PluginViewport:AppendStatusMessage( [Link]("\r\n
%s",FOVCalculatorSummary("FOVCalculator","World",bFOVFix)) )

local MenuAspectRatio = HackTool:GetAddress("MenuAspectRatio")


if MenuAspectRatio then
PluginViewport:AppendStatusMessage( [Link](", Aspect Ratio:
%.2f", MenuAspectRatio:ReadFloat()) )
end
end

function Disable_Inject()

local MenuAspectRatio = HackTool:GetAddress("MenuAspectRatio")


if MenuAspectRatio then
if MenuAspectRatio:ReadFloat() ~= fDefaultAspectRatio then
MenuAspectRatio:WriteFloat(fDefaultAspectRatio)
end
end

CleanUp()

end

function ResolutionChanged()

SyncDisplayDetection()

UpdateFOVCalculator("FOVCalculator",DisplayInfo:GetAspectRatio()/fDefaultAspectRati
o,fAdditionalFOV)

local MenuAspectRatio = HackTool:GetAddress("MenuAspectRatio")


if MenuAspectRatio then
if bAspectRatio == true then
MenuAspectRatio:WriteFloat(DisplayInfo:GetAspectRatio())
end
end

end

function CKFOVFix_Changed(Sender)

bFOVFix = Toggle_CheckFix(Sender)
Toggle_CodeCave("FOVFix_cc",bFOVFix)
ForceUpdate()

end

function CKAspect_Changed(Sender)

bAspectRatio = Toggle_CheckFix(Sender)
Toggle_CodeCave("InGameAspectRatio_cc",bAspectRatio)

local MenuAspectRatio = HackTool:GetAddress("MenuAspectRatio")


if MenuAspectRatio then
if bAspectRatio == true then
MenuAspectRatio:WriteFloat(DisplayInfo:GetAspectRatio())
else
if MenuAspectRatio:ReadFloat() ~= fDefaultAspectRatio then
MenuAspectRatio:WriteFloat(fDefaultAspectRatio)
end
end
end

ForceUpdate()
end

function HK_IncreaseFOV()
FOVSlider:OffsetPosition(1)
end

function HK_DecreaseFOV()
FOVSlider:OffsetPosition(-1)
end

function FOVSlider_Changed(Sender)

fAdditionalFOV = Sender:GetScaledFloat(2)
UpdateFOVCalculator_AdditionalFOV("FOVCalculator",fAdditionalFOV)
[Link]:SetCaption( [Link]("Value:
%.2f",fAdditionalFOV) )
ForceUpdate()

end

function Init()
Init_BaseControls()
Init_Controls()
end

function DeInit()
DisableFix()
end

You might also like