import configparser
import time

def read_config():
    config = configparser.ConfigParser()
    config.read('/storage/emulated/0/Android/data/com.tencent.tmgp.pubgmhd/files/UE4Game/ShadowTrackerExtra/ShadowTrackerExtra/Saved/Config/config.cfg')
    return config

def autoaim(sensitivity):
    while True:
        mouse_x, mouse_y = get_mouse_position()

        target_x, target_y = get_target_position()

        aim_vector = (target_x - mouse_x, target_y - mouse_y)

        aim_angle = calculate_aim_angle(aim_vector)

        set_mouse_position(mouse_x + aim_angle * sensitivity, mouse_y + aim_angle * sensitivity)

        time.sleep(0.01)

def main():
    config = read_config()
    autoaim_enabled = config.getboolean('settings', 'autoaim')
    sensitivity = float(config.get('settings', 'sensitivity'))

    if autoaim_enabled:
        autoaim(sensitivity)

if __name__ == '__main__':
    main()
