Skip to content

Instantly share code, notes, and snippets.

@JohnnyonFlame
Last active May 16, 2023 14:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JohnnyonFlame/078b0ebf4fe3051a6b73e63961c50f7f to your computer and use it in GitHub Desktop.
Save JohnnyonFlame/078b0ebf4fe3051a6b73e63961c50f7f to your computer and use it in GitHub Desktop.
Any-screen metro2033 fix for Flawless Widescreen
require(GlobalDependencys:GetDependency("StandardBase"):GetPackageName())
--PROCESS VARS
Process_FriendlyName = Module:GetFriendlyName()
Process_WindowName = "Metro 2033"
Process_ClassName = "_uengine_"
Process_EXEName = "Metro2033.exe"
--INJECTION BEHAVIOUR
InjectDelay = 2500
WriteInterval = 100
SearchInterval = 500
SuspendThread = true
-- CONTROLS
fSenseMod = 1
fWorldFov = 45
fHandsFov = 45
bMouseFix = true
bSenseMod = true
bWorldFov = true
bHandsFov = 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_SenseMod","Sensitivity Fine adjustment",15,70,210,17)
DefaultControls.AddFOVSlider("SenseSlider","SenseSlider_Changed",55,100,125,35)
DefaultControls.AddHeader("Header_WorldFov","World Fov adjustment",15,162,210,17)
DefaultControls.AddFOVSlider("WorldFovSlider","WorldFovSlider_Changed",55,192,125,35)
DefaultControls.AddHeader("Header_HandsFov","Hands Fov adjustment",15,252,210,17)
DefaultControls.AddFOVSlider("HandsFovSlider","HandsFovSlider_Changed",55,292,125,35)
DefaultControls.AddHeader("Header_FixesEnableDisable","Individual Fixes",245,70,210,17)
DefaultControls.AddFixToggle("CKMouseFix_Enable","Mouse Fix","CKMouseFix_Changed",255,101,180,14)
DefaultControls.AddFixToggle("CKSenseMod_Enable","Sensitivity Modifier","CKSenseMod_Toggled",255,120,180,14)
DefaultControls.AddFixToggle("CKWorldFov_Enable","World Fov","CKWorldFov_Toggled",255,139,180,14)
DefaultControls.AddFixToggle("CKHandsFov_Enable","Hands Fov","CKHandsFov_Toggled",255,158,180,14)
end
function Configure_SignatureScan()
-- Metro2033.exe+32719E - F3 0F10 05 3484A100 - movss xmm0,[Metro2033.exe+618434] { [2.37] } <-----
-- Metro2033.exe+3271A6 - F3 0F59 44 24 08 - mulss xmm0,[esp+08]
-- Metro2033.exe+3271AC - F3 0F59 44 24 10 - mulss xmm0,[esp+10]
-- Metro2033.exe+3271B2 - 0F57 C9 - xorps xmm1,xmm1
-- Metro2033.exe+3271B5 - 0F2F C8 - comiss xmm1,xmm0
-- Metro2033.exe+3271B8 - BE 05000000 - mov esi,00000005 { 5 }
local tAddress = HackTool:AddAddress("MouseFix")
if HackTool:SignatureScan("F3 0F10 05 ???????? F3 0F59 44 24 08 F3 0F59 44 24 10 0F57 C9 0F2F C8", tAddress, PAGE_EXECUTE_READ, 0x0, Process_EXEName) == 0 then
return ErrorOccurred(string.format(SigScanError,tAddress:GetName()))
else
print( tAddress:GetInfo(TYPE_ADDRESS) )
end
-- Metro2033.exe+327166 - F3 0F10 05 2C389F00 - movss xmm0,[Metro2033.exe+5F382C] { [0.19] } <-----
-- Metro2033.exe+32716E - EB 08 - jmp Metro2033.exe+327178
-- Metro2033.exe+327170 - F3 0F10 05 4C389F00 - movss xmm0,[Metro2033.exe+5F384C] { [0.10] }
-- Metro2033.exe+327178 - F3 0F59 05 501F9D00 - mulss xmm0,[Metro2033.exe+5D1F50] { [0.01] }
-- Metro2033.exe+327180 - F3 0F11 44 24 08 - movss [esp+08],xmm0
-- Metro2033.exe+327186 - F3 0F10 44 24 10 - movss xmm0,[esp+10]
local tAddress = HackTool:AddAddress("SenseMod")
if HackTool:SignatureScan("F3 0F10 05 ???????? EB ?? F3 0F10 05 ???????? F3 0F59 05 ???????? F3 0F11 44 24 08 F3 0F10 44 24 10", tAddress, PAGE_EXECUTE_READ, 0x0, Process_EXEName) == 0 then
return ErrorOccurred(string.format(SigScanError,tAddress:GetName()))
else
print( tAddress:GetInfo(TYPE_ADDRESS) )
end
-- Metro2033.exe+452E26 - 83 EC 44 - sub esp,44 { 68 }
-- Metro2033.exe+452E29 - F3 0F10 05 3084A100 - movss xmm0,[Metro2033.exe+618430] { [90.00] } <-----
-- Metro2033.exe+452E31 - F3 0F5E 05 24289F00 - divss xmm0,[Metro2033.exe+5F2824] { [90.00] }
-- Metro2033.exe+452E39 - 53 - push ebx
-- Metro2033.exe+452E3A - 8B 5D 08 - mov ebx,[ebp+08]
-- Metro2033.exe+452E3D - 56 - push esi
-- Metro2033.exe+452E3E - 57 - push edi
-- Metro2033.exe+452E3F - 51 - push ecx
local tAddress = HackTool:AddAddress("WorldFov")
if HackTool:SignatureScan("83 EC 44 F3 0F10 05 ???????? F3 0F5E 05 ???????? 53 8B 5D 08 56 57 51", tAddress, PAGE_EXECUTE_READ, 0x3, Process_EXEName) == 0 then
return ErrorOccurred(string.format(SigScanError,tAddress:GetName()))
else
print( tAddress:GetInfo(TYPE_ADDRESS) )
end
-- Metro2033.exe+3B18B2 - 74 05 - je Metro2033.exe+3B18B9
-- Metro2033.exe+3B18B4 - E8 E7050A00 - call Metro2033.exe+451EA0
-- Metro2033.exe+3B18B9 - F3 0F10 85 30030000 - movss xmm0,[ebp+00000330] <-----
-- Metro2033.exe+3B18C1 - F3 0F59 05 10289F00 - mulss xmm0,[Metro2033.exe+5F2810] { [0.60] }
-- Metro2033.exe+3B18C9 - F3 0F59 05 80199D00 - mulss xmm0,[Metro2033.exe+5D1980] { [0.02] }
-- Metro2033.exe+3B18D1 - F3 0F59 05 48279600 - mulss xmm0,[Metro2033.exe+562748] { [0.50] }
-- Metro2033.exe+3B18D9 - 0F5A C0 - cvtps2pd xmm0,xmm0
-- Metro2033.exe+3B18DC - E8 29C41800 - call Metro2033.exe+53DD0A { ->->MSVCR80._libm_sse2_tan }
local tAddress = HackTool:AddAddress("HandsFov")
if HackTool:SignatureScan("74 05 E8 ???????? F3 0F10 85 ???????? F3 0F59 05 ???????? F3 0F59 05 ???????? F3 0F59 05 ???????? 0F5A C0 E8 ????????", tAddress, PAGE_EXECUTE_READ, 0x7, Process_EXEName) == 0 then
return ErrorOccurred(string.format(SigScanError,tAddress:GetName()))
else
print( tAddress:GetInfo(TYPE_ADDRESS) )
end
return true
end
function CKMouseFix_Changed(Sender)
bMouseFix = Toggle_CheckFix(Sender)
Toggle_CodeCave("MouseFix_cc",bMouseFix)
end
function SenseSlider_Changed(Sender)
fSenseMod = (Sender:GetScaledFloat(1) + 100) / 200
lblSenseSlider.Caption:SetCaption( string.format("Value: %.2f",fSenseMod) )
ForceUpdate()
end
function WorldFovSlider_Changed(Sender)
fWorldFov = 35 + ((Sender:GetScaledFloat(1) + 100) / 200) * 75
lblWorldFovSlider.Caption:SetCaption( string.format("Value: %.2f",fWorldFov) )
ForceUpdate()
end
function HandsFovSlider_Changed(Sender)
fHandsFov = 35 + ((Sender:GetScaledFloat(1) + 100) / 200) * 75
lblHandsFovSlider.Caption:SetCaption( string.format("Value: %.2f",fHandsFov) )
ForceUpdate()
end
function CKSenseMod_Toggled(Sender)
bSenseMod = Toggle_CheckFix(Sender)
Toggle_CodeCave("SenseMod_cc",bSenseMod)
end
function CKWorldFov_Toggled(Sender)
bWorldFov = Toggle_CheckFix(Sender)
Toggle_CodeCave("WorldFov_cc",bWorldFov)
end
function CKHandsFov_Toggled(Sender)
bWorldFov = Toggle_CheckFix(Sender)
Toggle_CodeCave("HandsFov_cc",bHandsFov)
end
function Enable_Inject()
local Variables = HackTool:AllocateMemory("Variables",0)
Variables:PushFloat("Sensitivity")
Variables:PushFloat("WorldFov")
Variables:PushFloat("HandsFov")
Variables:Allocate()
Variables["Sensitivity"]:WriteFloat(fSenseMod)
Variables["WorldFov"]:WriteFloat(fWorldFov)
Variables["HandsFov"]:WriteFloat(fHandsFov)
local asm = [[
(codecave:jmp)MouseFix,MouseFix_cc:
movss xmm0, [AspectFix]
jmp %returnaddress%
%end%
(codecave:jmp)SenseMod,SenseMod_cc:
%originalcode%
mulss xmm0, [(allocation)Variables->Sensitivity]
jmp %returnaddress%
%end%
(codecave:jmp)WorldFov,WorldFov_cc:
movss xmm0, [(allocation)Variables->WorldFov]
movss [$$2], xmm0 $context=2
%originalcode%
jmp %returnaddress%
%end%
(codecave:jmp)HandsFov,HandsFov_cc:
movss xmm0, [(allocation)Variables->HandsFov]
jmp %returnaddress%
%end%
AspectFix: (float)1f
]]
if HackTool:CompileAssembly(asm,"tAssembly") == nil then
return ErrorOccurred("Assembly compilation failed...")
else
Toggle_CodeCave("MouseFix_cc", bMouseFix)
Toggle_CodeCave("SenseMod_cc", bSenseMod)
Toggle_CodeCave("WorldFov_cc", bWorldFov)
Toggle_CodeCave("HandsFov_cc", bHandsFov)
end
end
function Periodic()
local Variables = HackTool:GetAllocation("Variables")
if (Variables) then
if (bSenseMod == true) then
Variables["Sensitivity"]:WriteFloat(fSenseMod)
end
if (bWorldFov == true) then
Variables["WorldFov"]:WriteFloat(fWorldFov)
end
if (bHandsFov == true) then
Variables["HandsFov"]:WriteFloat(fHandsFov)
end
end
end
function Disable_Inject()
CleanUp()
end
function ResolutionChanged()
end
function Init()
Init_BaseControls()
Init_Controls()
end
function DeInit()
DisableFix()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment