Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #SingleInstance force
- #Persistent
- #MaxThreadsPerHotkey 20
- #Include %A_ScriptDir%\lib\classMemory.ahk
- SetWorkingDir %A_ScriptDir%
- inifile = settings.txt
- ;load settings
- IniRead, maxZoom, %inifile%, settings, maxZoom, 60
- IniRead, tiltCoeficient, %inifile%, settings, tiltCoeficient, 0.005
- IniRead, tiltInvert, %inifile%, settings, tiltInvert, 0
- loaded := false
- prevMouseY := 0
- Gui Show, w295 h330, Window
- Gui Add, Edit, x152 y32 w120 h21 vmaxZoom, %maxZoom%
- Gui Add, Text, x24 y32 w120 h23 +0x200, Max Zoom
- Gui Add, Text, x24 y64 w120 h23 +0x200, Tilt Coefficient
- Gui Add, Edit, x152 y64 w120 h21 vtiltCoeficient, %tiltCoeficient%
- if (tiltInvert = 1)
- Gui Add, CheckBox, x232 y96 w38 h24 Checked vtiltInvert
- else
- Gui Add, CheckBox, x232 y96 w38 h24 vtiltInvert
- Gui Add, Text, x24 y96 w204 h23 +0x200, Invert Vertical Camera Movement
- Gui Add, GroupBox, x16 y8 w265 h173, Settings
- Gui Add, Button, x64 y128 w161 h35 Default, Save settings
- Gui Add, Text, x16 y192 w120 h23 +0x200, Loading libraries
- if (_ClassMemory.__Class != "_ClassMemory"){
- msgbox class memory not correctly installed. Or the (global class) variable "_ClassMemory" has been overwritten
- ExitApp
- }
- Gui Font, c0x008000
- Gui Add, Text, x160 y192 w120 h23 +0x200, Ok
- Gui Font
- Gui Add, Text, x17 y223 w120 h23 +0x200, Searching memory
- dos := new _ClassMemory("ahk_exe EoCApp.exe", "", hProcessCopy)
- if !isObject(dos){
- msgbox failed to open a handle
- if (hProcessCopy = 0)
- msgbox The program isn't running (not found) or you passed an incorrect program identifier parameter.
- else if (hProcessCopy = "")
- msgbox OpenProcess failed. If the target process has admin rights, then the script also needs to be ran as admin. Consult A_LastError for more information.
- ExitApp
- }
- SetFormat, integerFast, Hex
- aob := dos.hexStringToPattern("00 00 b0 40 00 00 98 41")
- bAddr := dos.processPatternScan(0x10000000000,,aob*)
- zoomMinAddr := bAddr
- zoomMaxAddr := bAddr + 0x4
- TiltMinAddr := bAddr + 0x8c
- TiltMaxAddr := bAddr + 0x80
- TiltCombatMinAddr := bAddr + 0xa4
- TiltCombatMaxAddr := bAddr + 0x98
- if (bAddr = 0)
- {
- msgbox % "bAddr = " . bAddr . ". Could not lock onto camera controls in the game using the processPatternScan function."
- ExitApp
- }
- Gui Font, c0x008000
- Gui Add, Text, x160 y223 w120 h23 +0x200, Ok
- Gui Font
- Gui Add, Text, x16 y256 w120 h23 +0x200, Enabling functions
- dos.write(zoomMaxAddr, maxZoom, "Float")
- Gui Font, c0x008000
- Gui Add, Text, x160 y256 w120 h23 +0x200, Ok
- Gui Font
- Gui Font, s14 c0x008000
- Gui Add, Text, x16 y288 w264 h45 +0x1 +0x200, READY
- Gui Font
- loaded := true
- return
- ButtonSaveSettings:
- gui, submit, nohide
- IniWrite, %maxZoom%, %inifile%, settings, maxZoom
- IniWrite, %tiltCoeficient%, %inifile%, settings, tiltCoeficient
- IniWrite, %tiltInvert%, %inifile%, settings, tiltInvert
- dos.write(zoomMaxAddr, maxZoom, "Float")
- return
- ~MButton::
- while (getkeystate("MButton"))
- {
- MouseGetPos, posX, posY
- if (prevMouseY = 0){
- prevMouseY := posY
- }else{
- diff := posY - prevMouseY
- if(diff != 0){
- prevMouseY := posY
- curTilt := dos.read(TiltMinAddr,"Float")
- adjust := diff * tiltCoeficient
- if(tiltInvert = 1)
- adjust := adjust * -1
- newTilt := adjust + curTilt
- if(newTilt < 3 and newTilt > 0.1){
- dos.write(TiltMinAddr, newTilt, "Float")
- dos.write(TiltMaxAddr, newTilt, "Float")
- dos.write(TiltCombatMinAddr, newTilt, "Float")
- dos.write(TiltCombatMaxAddr, newTilt, "Float")
- }
- }
- sleep, 25
- }
- }
- prevMouseY := 0
- return
- GuiClose:
- dos.write(zoomMaxAddr, 19, "Float")
- ExitApp
Add Comment
Please, Sign In to add comment