274 lines
8.2 KiB
Lua
274 lines
8.2 KiB
Lua
require(GlobalDependencys:GetDependency("StandardBase"):GetPackageName())
|
|
|
|
--GAME VARS
|
|
fDefaultFOV = 85
|
|
fAdditionalFOV = 0
|
|
fAspectRatio = DisplayInfo:GetWidth() / DisplayInfo:GetHeight()
|
|
fAspectRatio219 = 2.333333254
|
|
fAspectRatio169 = 1.777777791
|
|
fFactor = 0.00872665
|
|
|
|
--ControlVars
|
|
bFixEnabled = true
|
|
bFOV = true
|
|
bAspect = true
|
|
bDOF = true
|
|
|
|
--PROCESS VARS
|
|
Process_FriendlyName = Module:GetFriendlyName()
|
|
Process_WindowName = "*"
|
|
Process_ClassName = "*"
|
|
Process_EXEName = "ASC-Win64-Shipping.exe"
|
|
|
|
--INJECTION BEHAVIOUR
|
|
InjectDelay = 500
|
|
WriteInterval = 100
|
|
SearchInterval = 100
|
|
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.AddFixedFOVSlider("FOVSlider","FOVSlider_Changed",55,100,125,35,0,90,0,1)
|
|
|
|
FOVSlider:SetTickFrequency(5)
|
|
FOVSlider:SetLabel1Text("-20")
|
|
FOVSlider:SetLabel2Text("+70")
|
|
|
|
DefaultControls.AddFixToggle("CKFOVFix_Enable","FOV fix","CKFOVFix_Changed",255,101,180,14)
|
|
DefaultControls.AddFixToggle("CKARFix_Enable","Aspect ratio fix","CKARFix_Changed",255,121,180,14)
|
|
DefaultControls.AddFixToggle("CKDOFFix_Enable","Depth of field fix","CKDOFFix_Changed",255,141,180,14)
|
|
|
|
end
|
|
|
|
function Configure_SignatureScan()
|
|
|
|
local tAddress = HackTool:AddAddress("FOV")
|
|
|
|
if HackTool:SignatureScan("F3 ?? ?? ?? F2 0F ?? ?? ?? 0F ?? ?? 48 89",tAddress,PAGE_EXECUTE_READ,0x04,Process_EXEName) == 0 then
|
|
return ErrorOccurred(string.format(SigScanError,tAddress:GetName()))
|
|
else
|
|
print( tAddress:GetInfo(TYPE_ADDRESS) )
|
|
--ASC-Win64-Shipping.exe+42E671F - 0F 29 45 F0 - movaps [rbp-10],xmm0
|
|
--ASC-Win64-Shipping.exe+42E6723 - F3 0F 10 07 - movss xmm0,[rdi]
|
|
--ASC-Win64-Shipping.exe+42E6727 - F2 0F 11 4D 00 - movsd [rbp+00],xmm1 <<==
|
|
--ASC-Win64-Shipping.exe+42E672C - 0F 28 CF - movaps xmm1,xmm7
|
|
--ASC-Win64-Shipping.exe+42E672F - 48 89 74 24 30 - mov [rsp+30],rsi
|
|
end
|
|
|
|
local tAddress = HackTool:AddAddress("FOV2")
|
|
|
|
if HackTool:SignatureScan("77 ?? 48 ?? ?? FF 90 ?? ?? ?? ?? F3 0F ?? ?? ?? 48 ?? ?? ??",tAddress,PAGE_EXECUTE_READ,0x0b,Process_EXEName) == 0 then
|
|
return ErrorOccurred(string.format(SigScanError,tAddress:GetName()))
|
|
else
|
|
print( tAddress:GetInfo(TYPE_ADDRESS) )
|
|
--ASC-Win64-Shipping.exe+48546C4 - 48 8B 01 - mov rax,[rcx]
|
|
--ASC-Win64-Shipping.exe+48546C7 - FF 90 08 07 00 00 - call qword ptr [rax+00000708]
|
|
--ASC-Win64-Shipping.exe+48546CD - F3 0F 10 40 30 - movss xmm0,[rax+30] <<==
|
|
--ASC-Win64-Shipping.exe+48546D2 - 48 83 C4 28 - add rsp,28
|
|
--ASC-Win64-Shipping.exe+48546D6 - C3 - ret
|
|
end
|
|
|
|
local tAddress = HackTool:AddAddress("ASPECT")
|
|
|
|
if HackTool:SignatureScan("48 89 ?? ?? ?? 57 48 83 ?? ?? 0F ?? ?? 48 8B F9 48 ?? ?? 0F ?? ?? F2 0F ?? ?? ?? F2 0F ?? ?? ??",tAddress,PAGE_EXECUTE_READ,0x59,Process_EXEName) == 0 then
|
|
return ErrorOccurred(string.format(SigScanError,tAddress:GetName()))
|
|
else
|
|
print( tAddress:GetInfo(TYPE_ADDRESS) )
|
|
--ASC-Win64-Shipping.exe+165AA40 - 8B 42 44 - mov eax,[rdx+44]
|
|
--ASC-Win64-Shipping.exe+165AA43 - 89 41 44 - mov [rcx+44],eax
|
|
--ASC-Win64-Shipping.exe+165AA46 - 8B 42 48 - mov eax,[rdx+48]
|
|
--ASC-Win64-Shipping.exe+165AA49 - 89 41 48 - mov [rcx+48],eax
|
|
--ASC-Win64-Shipping.exe+165AA4C - 8B 49 4C - mov ecx,[rcx+4C]
|
|
end
|
|
|
|
local tAddress = HackTool:AddAddress("DOF")
|
|
|
|
if HackTool:SignatureScan("0F 8F ?? ?? ?? ?? 48 8B ?? ?? ?? ?? ?? 48 ?? ?? 8B ?? ?? E8 ?? ?? ?? ??",tAddress,PAGE_EXECUTE_READ,0x0d,Process_EXEName) == 0 then
|
|
return ErrorOccurred(string.format(SigScanError,tAddress:GetName()))
|
|
else
|
|
print( tAddress:GetInfo(TYPE_ADDRESS) )
|
|
--ASC-Win64-Shipping.exe+30FBD84 - 48 8B 05 9D DE 2A 05 - mov rax,[ASC-Win64-Shipping.exe+83A9C28]
|
|
--ASC-Win64-Shipping.exe+30FBD8B - 48 8B CB - mov rcx,rbx
|
|
--ASC-Win64-Shipping.exe+30FBD8E - 8B 78 04 - mov edi,[rax+04]
|
|
--ASC-Win64-Shipping.exe+30FBD91 - E8 DA 7A 80 01 - call ASC-Win64-Shipping.exe+4903870
|
|
--ASC-Win64-Shipping.exe+30FBD96 - 48 63 C8 - movsxd rcx,eax
|
|
end
|
|
|
|
return true
|
|
end
|
|
|
|
function Enable_Inject()
|
|
|
|
local Variables = HackTool:AllocateMemory("Variables",0)
|
|
Variables:PushFloat("CompensatedFOV")
|
|
Variables:PushFloat("FOVIn")
|
|
Variables:PushFloat("FOVOut")
|
|
Variables:PushFloat("AdditionalFOV")
|
|
Variables:PushFloat("AspectRatio")
|
|
Variables:PushFloat("ScreenRatio")
|
|
Variables:PushFloat("factor")
|
|
Variables:Allocate()
|
|
Variables["FOVIn"]:WriteFloat(fDefaultFOV)
|
|
Variables["FOVOut"]:WriteFloat(fDefaultFOV)
|
|
Variables["AdditionalFOV"]:WriteFloat(fAdditionalFOV)
|
|
Variables["AspectRatio"]:WriteFloat(fAspectRatio169)
|
|
Variables["ScreenRatio"]:WriteFloat(fAspectRatio)
|
|
Variables["factor"]:WriteFloat(fFactor)
|
|
|
|
ResolutionChanged()
|
|
|
|
local asm = [[
|
|
|
|
(codecave:jmp)FOV,FOV_cc:
|
|
%originalcode%
|
|
fld dword ptr [rdi]
|
|
fst dword ptr [(allocation)Variables->FOVIn]
|
|
fmul dword ptr [(allocation)Variables->factor]
|
|
fptan
|
|
fstp st0
|
|
fld dword ptr [(allocation)Variables->ScreenRatio]
|
|
fdiv dword ptr [(allocation)Variables->AspectRatio]
|
|
fmulp st1,st0
|
|
fld1
|
|
fpatan
|
|
fdiv dword ptr [(allocation)Variables->factor]
|
|
fst dword ptr [(allocation)Variables->CompensatedFOV]
|
|
fadd dword ptr [(allocation)Variables->AdditionalFOV]
|
|
fstp dword ptr [(allocation)Variables->FOVOut]
|
|
jmp %returnaddress%
|
|
%end%
|
|
|
|
(codecave:jmp)FOV2,FOV2_cc:
|
|
$$0 $$1,[(allocation)Variables->FOVOut] $ctx=1
|
|
jmp %returnaddress%
|
|
%end%
|
|
|
|
(codecave:jmp)ASPECT,ASPECT_cc:
|
|
fld dword ptr [rdx+0x48]
|
|
fstp dword ptr [(allocation)Variables->AspectRatio]
|
|
$$0 $$2,[(allocation)Variables->ScreenRatio] $ctx=1
|
|
%originalcode%
|
|
jmp %returnaddress%
|
|
%end%
|
|
|
|
(codecave:jmp)DOF,DOF_cc:
|
|
$$0 $$1,$$2 $ctx=1
|
|
$$0 edi,0 $ctx=1
|
|
jmp %returnaddress%
|
|
%end%
|
|
]]
|
|
|
|
if HackTool:CompileAssembly(asm,"Fixes") == nil then
|
|
return ErrorOccurred("Assembly compilation failed...")
|
|
else
|
|
Toggle_CodeCave("FOV_cc",bFixEnabled)
|
|
Toggle_CodeCave("FOV2_cc",bFixEnabled)
|
|
Toggle_CodeCave("ASPECT_cc",bAspect)
|
|
Toggle_CodeCave("DOF_cc",bDOF)
|
|
end
|
|
|
|
Write_FOV()
|
|
|
|
end
|
|
|
|
function Periodic()
|
|
local Variables = HackTool:GetAllocation("Variables")
|
|
|
|
if Variables and Variables["FOVIn"] and Variables["AdditionalFOV"] then
|
|
local fCompensatedFOV = Variables["CompensatedFOV"]:ReadFloat()
|
|
local fFOVIn = Variables["FOVIn"]:ReadFloat()
|
|
local fFOVOut = Variables["FOVOut"]:ReadFloat()
|
|
|
|
PluginViewport:AppendStatusMessage( string.format("\r\n===== Fix informations =====\r\nFOV In: %0.2f, Compensated FOV : %0.2f, FOV Out : %.02f", fFOVIn, fCompensatedFOV, fFOVOut))
|
|
end
|
|
end
|
|
|
|
function FOVSlider_Changed(Sender)
|
|
|
|
fAdditionalFOV = Sender:GetPosition() - 20
|
|
lblFOVSlider.Caption:SetCaption( string.format("Value: +%.0f",fAdditionalFOV) )
|
|
|
|
Write_FOV()
|
|
|
|
ForceUpdate()
|
|
|
|
end
|
|
|
|
function Write_FOV()
|
|
|
|
local Variables = HackTool:GetAllocation("Variables")
|
|
if Variables and Variables["AdditionalFOV"] then
|
|
if bFOV == true then
|
|
Variables["AdditionalFOV"]:WriteFloat(fAdditionalFOV)
|
|
else
|
|
Variables["AdditionalFOV"]:WriteFloat(0)
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
function Disable_Inject()
|
|
|
|
CleanUp()
|
|
|
|
end
|
|
|
|
function CKFOVFix_Changed(Sender)
|
|
|
|
bFOV = Toggle_CheckFix(Sender)
|
|
Write_FOV()
|
|
Toggle_CodeCave("FOV_cc",bFixEnabled)
|
|
Toggle_CodeCave("FOV2_cc",bFixEnabled)
|
|
ForceUpdate()
|
|
|
|
end
|
|
|
|
function CKARFix_Changed(Sender)
|
|
|
|
bAspect = Toggle_CheckFix(Sender)
|
|
|
|
Toggle_CodeCave("ASPECT_cc",bAspect)
|
|
ForceUpdate()
|
|
|
|
if bAspect == false then
|
|
Variables["AspectRatio"]:WriteFloat(fAspectRatio)
|
|
Variables["ScreenRatio"]:WriteFloat(fAspectRatio)
|
|
end
|
|
|
|
end
|
|
|
|
function CKDOFFix_Changed(Sender)
|
|
|
|
bDOF = Toggle_CheckFix(Sender)
|
|
Toggle_CodeCave("DOF_cc",bDOF)
|
|
ForceUpdate()
|
|
|
|
end
|
|
|
|
function ResolutionChanged()
|
|
|
|
SyncDisplayDetection()
|
|
|
|
end
|
|
|
|
function Init()
|
|
|
|
Init_BaseControls()
|
|
Init_Controls()
|
|
|
|
end
|
|
|
|
function DeInit()
|
|
|
|
DisableFix()
|
|
|
|
end
|