Add support for changing mask side (#141)

* Add mask config options

* Mask side support

* Mask side support

* Mask side support

* Update main.py

* Add maskSide support

* Add maskSide support

* revert

* double revert :(
This commit is contained in:
JinxTheCat 2023-12-14 21:21:18 -08:00 committed by GitHub
parent e51fda35eb
commit 333a015acf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 14 deletions

View File

@ -2,8 +2,9 @@
screenShotHeight = 320 screenShotHeight = 320
screenShotWidth = 320 screenShotWidth = 320
# For use in games that are 3rd person and character model interferes with the autoaim # Use "left" or "right" for the mask side depending on where the interfering object is, useful for 3rd player models or large guns
useMask = False useMask = False
maskSide = "left"
maskWidth = 80 maskWidth = 80
maskHeight = 200 maskHeight = 200
@ -32,4 +33,4 @@ centerOfScreen = True
# 1 - CPU # 1 - CPU
# 2 - AMD # 2 - AMD
# 3 - NVIDIA # 3 - NVIDIA
onnxChoice = 2 onnxChoice = 1

View File

@ -41,8 +41,15 @@ def main():
# Getting Frame # Getting Frame
npImg = np.array(camera.get_latest_frame()) npImg = np.array(camera.get_latest_frame())
from config import maskSide # "temporary" workaround for bad syntax
if useMask: if useMask:
maskSide = maskSide.lower()
if maskSide == "right":
npImg[-maskHeight:, -maskWidth:, :] = 0
elif maskSide == "left":
npImg[-maskHeight:, :maskWidth, :] = 0 npImg[-maskHeight:, :maskWidth, :] = 0
else:
raise Exception('ERROR: Invalid maskSide! Please use "left" or "right"')
# Normalizing Data # Normalizing Data
im = torch.from_numpy(npImg) im = torch.from_numpy(npImg)
@ -169,5 +176,5 @@ if __name__ == "__main__":
except Exception as e: except Exception as e:
import traceback import traceback
traceback.print_exception(e) traceback.print_exception(e)
print(str(e)) print("ERROR: " + str(e))
print("Ask @Wonder for help in our Discord in the #ai-aimbot channel ONLY: https://discord.gg/rootkitorg") print("Ask @Wonder for help in our Discord in the #ai-aimbot channel ONLY: https://discord.gg/rootkitorg")

View File

@ -49,8 +49,15 @@ def main():
# Getting Frame # Getting Frame
npImg = np.array(camera.get_latest_frame()) npImg = np.array(camera.get_latest_frame())
from config import maskSide # "temporary" workaround for bad syntax
if useMask: if useMask:
maskSide = maskSide.lower()
if maskSide == "right":
npImg[-maskHeight:, -maskWidth:, :] = 0
elif maskSide == "left":
npImg[-maskHeight:, :maskWidth, :] = 0 npImg[-maskHeight:, :maskWidth, :] = 0
else:
raise Exception('ERROR: Invalid maskSide! Please use "left" or "right"')
# If Nvidia, do this # If Nvidia, do this
if onnxChoice == 3: if onnxChoice == 3:
@ -192,5 +199,5 @@ if __name__ == "__main__":
except Exception as e: except Exception as e:
import traceback import traceback
traceback.print_exception(e) traceback.print_exception(e)
print(str(e)) print("ERROR: " + str(e))
print("Ask @Wonder for help in our Discord in the #ai-aimbot channel ONLY: https://discord.gg/rootkitorg") print("Ask @Wonder for help in our Discord in the #ai-aimbot channel ONLY: https://discord.gg/rootkitorg")

View File

@ -1,4 +1,3 @@
from unittest import result
import torch import torch
import numpy as np import numpy as np
import cv2 import cv2
@ -13,7 +12,7 @@ import cupy as cp
# Could be do with # Could be do with
# from config import * # from config import *
# But we are writing it out for clarity for new devs # But we are writing it out for clarity for new devs
from config import aaMovementAmp, useMask, maskHeight, maskWidth, aaQuitKey, confidence, headshot_mode, cpsDisplay, visuals, centerOfScreen from config import aaMovementAmp, useMask, maskHeight, maskWidth, aaQuitKey, confidence, headshot_mode, cpsDisplay, visuals, centerOfScreen, screenShotWidth
import gameSelection import gameSelection
def main(): def main():
@ -32,7 +31,7 @@ def main():
# Used for colors drawn on bounding boxes # Used for colors drawn on bounding boxes
COLORS = np.random.uniform(0, 255, size=(1500, 3)) COLORS = np.random.uniform(0, 255, size=(1500, 3))
# Main loop Quit if Q is pressed # Main loop Quit if exit key is pressed
last_mid_coord = None last_mid_coord = None
with torch.no_grad(): with torch.no_grad():
while win32api.GetAsyncKeyState(ord(aaQuitKey)) == 0: while win32api.GetAsyncKeyState(ord(aaQuitKey)) == 0:
@ -42,8 +41,15 @@ def main():
# If the image has an alpha channel, remove it # If the image has an alpha channel, remove it
npImg = npImg[:, :, :, :3] npImg = npImg[:, :, :, :3]
from config import maskSide # "temporary" workaround for bad syntax
if useMask: if useMask:
maskSide = maskSide.lower()
if maskSide == "right":
npImg[:, -maskHeight:, -maskWidth:, :] = 0
elif maskSide == "left":
npImg[:, -maskHeight:, :maskWidth, :] = 0 npImg[:, -maskHeight:, :maskWidth, :] = 0
else:
raise Exception('ERROR: Invalid maskSide! Please use "left" or "right"')
im = npImg / 255 im = npImg / 255
im = im.astype(cp.half) im = im.astype(cp.half)
@ -161,5 +167,5 @@ if __name__ == "__main__":
except Exception as e: except Exception as e:
import traceback import traceback
traceback.print_exception(e) traceback.print_exception(e)
print(str(e)) print("ERROR: " + str(e))
print("Ask @Wonder for help in our Discord in the #ai-aimbot channel ONLY: https://discord.gg/rootkitorg") print("Ask @Wonder for help in our Discord in the #ai-aimbot channel ONLY: https://discord.gg/rootkitorg")