Skip to content

Commit

Permalink
huge version upgrade! 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jire committed Mar 25, 2021
1 parent 75f6f0a commit 4dfc687
Show file tree
Hide file tree
Showing 13 changed files with 185 additions and 262 deletions.
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# Overwatcheat

_Free, open-source undetected color cheat for Overwatch!_

[![Build Status](https://travis-ci.org/Jire/Overwatcheat.svg?branch=master)](https://travis-ci.org/Jire/Overwatcheat)
[![License](https://img.shields.io/github/license/Jire/Overwatcheat.svg)](https://github.com/Jire/Overwatcheat/blob/master/LICENSE.txt)

**Available Features**

* Incredibly efficient frame grabber
* Optimized zero-garbage frame pixel scanner
* Extremely low CPU and memory usage, with minimal effect on FPS
* Red-pixel HP bar aimbot
* Magenta-pixel HP bar aimbot
* Uses Interception driver to avoid mouse event detection
* Capable of finding an OBS projector window, in case of color ban (error 5)

**Beginner's Guide**

Expand All @@ -24,12 +28,16 @@ The first step is to compile the source code into a usable cheat program.
* Double click on the "_build_" (_build.bat_) script and wait for it to complete

Once those steps are complete, the usable cheat program can be found within the _build_
directory, and will in a directory called **Overwatcheat 2.1.0**.
directory, and will in a directory called **Overwatcheat 3.0.0**.

From within the **Overwatcheat 2.1.0** directory, you can start the cheat by running
the _"Start Overwatcheat 2.1.0"_ script.
From within the **Overwatcheat 3.0.0** directory, you can start the cheat by running the _"Start Overwatcheat 3.0.0"_
script.

Before starting the cheat, you should use fullscreen windowed mode!
**Requirements:**
* Use fullscreen windowed mode if not using OBS projector
* It is vital to configure sensitivity to be the same as your in-game sens
* Increasing sensitivity to beyond your sens will give you slower aim
* Increasing FPS will increase accuracy

---

Expand Down
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import java.nio.file.Files
*/

group 'com.overwatcheat'
version '2.1.0'
version '3.0.0'

buildscript {
ext.kotlin_version = '1.4.31'
ext.kotlin_version = '1.4.32'

repositories {
jcenter()
Expand Down Expand Up @@ -50,6 +50,8 @@ dependencies {

implementation group: 'net.java.dev.jna', name: 'jna', version: '5.7.0'
implementation group: 'net.java.dev.jna', name: 'jna-platform', version: '5.7.0'

implementation group: 'it.unimi.dsi', name: 'fastutil', version: '8.5.2'
}

jar {
Expand Down
36 changes: 17 additions & 19 deletions overwatcheat.cfg
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
# The virtual key code key which activates the aim bot when held
aim_key=5

# The speed of the aim as a percentile, lower being slower, higher being faster
# I recommend to not use 0.5 or greater due to massively increased flicks.
speed=0.333
# Your in-game sensitivity.
sensitivity=10.0

# The number of frames per second to capture the game at.
# The higher this is, the faster the aim speed, relative to the sensitivity.
fps=60

# Calculates aim box width by dividing screen width by this value
box_width_divisor=4.0
box_width_divisor=10.0
# Calculates aim box height by dividing screen height by this value
box_height_divisor=2.5
box_height_divisor=12.0

# Divides the box width/height by this value to use as a maximum possible aim snap.
max_snap_divisor=2.0

# The RGB hex color code to use as a basis to aim at.
# The RGB hex color codes to use as a basis to aim at.
#
# You should prefer magenta since it is a unique color not often used.
#
# Samples:
# Red: ff0013
# Neon: 21d4d7
# Magenta: e23be9
target_color=e23be9
target_color=dd32db,db33d8,e23be9,d619dd,d200d6

# The amount of tolerance for the difference between the target color and the scanned screen color.
target_color_tolerance=20
target_color_tolerance=16

# Checks if window title contains this.
# Usually you want this set to "Overwatch".
#
# If you are color blocked (error 5), you can use
# "Fullscreen Projector" in OBS and here.
window_title_search=Fullscreen Projector
window_title_search=Overwatch

# The native mouse device ID, usually this should be 11.
# The range is 11..20 for mouse IDs, and 1..10 for keyboard IDs.
device_id=11

# A divisor for your screen dimensions, as a limit for maximum movement per aim.
# Generally the default of 128 is fine, but raising it will reduce flicks, lowering may introduce more.
max_distance_divisor=128
device_id=11
53 changes: 53 additions & 0 deletions src/main/kotlin/com/overwatcheat/Colors.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Free, open-source undetected color cheat for Overwatch!
* Copyright (C) 2017 Thomas G. Nappo
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.overwatcheat

import com.overwatcheat.Overwatcheat.SETTINGS
import it.unimi.dsi.fastutil.ints.IntOpenHashSet
import it.unimi.dsi.fastutil.ints.IntSet

object Colors {

private val set: IntSet = IntOpenHashSet()

fun colorMatches(rgb: Int) = set.contains(rgb)

fun init() {
val tolerance = SETTINGS.targetColorTolerance
val rgbs = SETTINGS.targetColors
for (rgb in rgbs) {
val r = (rgb and 0xFF_00_00) ushr 16
val g = (rgb and 0x00_FF_00) ushr 8
val b = rgb and 0x00_00_FF

for (ri in -tolerance..tolerance) {
val nr = r + ri
for (gi in -tolerance..tolerance) {
val ng = g + gi
for (bi in -tolerance..tolerance) {
val nb = b + bi
val nrgb = ((nr and 0xFF) shl 16) or ((ng and 0xFF) shl 8) or (nb and 0xFF)
set.add(nrgb)
}
}
}
}
}

}
8 changes: 4 additions & 4 deletions src/main/kotlin/com/overwatcheat/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ package com.overwatcheat
import com.overwatcheat.util.Screen
import kotlin.math.ceil

const val X_OFFSET_1080p = 18
const val Y_OFFSET_1080p = 40
const val X_OFFSET_1440p = 34
const val Y_OFFSET_1440p = 56

val X_OFFSET = ceil(X_OFFSET_1080p * (Screen.WIDTH / 1920.0)).toInt()
val Y_OFFSET = ceil(Y_OFFSET_1080p * (Screen.HEIGHT / 1080.0)).toInt()
val X_OFFSET = ceil(X_OFFSET_1440p * (Screen.WIDTH / 2560.0)).toInt()
val Y_OFFSET = ceil(Y_OFFSET_1440p * (Screen.HEIGHT / 1440.0)).toInt()
80 changes: 46 additions & 34 deletions src/main/kotlin/com/overwatcheat/Overwatcheat.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@

package com.overwatcheat

import com.overwatcheat.aimbot.aimBot
import com.overwatcheat.aimbot.pixels
import com.overwatcheat.nativelib.HWNDFinder
import com.overwatcheat.nativelib.interception.Mouse
import com.overwatcheat.util.Keyboard.keyPressed
import com.overwatcheat.util.Screen
import com.overwatcheat.util.toRGB
import org.bytedeco.javacv.FFmpegFrameGrabber
import org.bytedeco.javacv.FrameConverter
import org.bytedeco.javacv.Java2DFrameConverter
import java.awt.image.BufferedImage
import kotlin.system.measureTimeMillis
import java.awt.image.DataBufferByte
import kotlin.math.abs

object Overwatcheat {

Expand All @@ -47,27 +47,32 @@ object Overwatcheat {
var CAPTURE_OFFSET_Y = 0
private set

var MOVE_X_MAX = 0
var CAPTURE_CENTER_X = 0
private set
var MOVE_Y_MAX = 0
var CAPTURE_CENTER_Y = 0
private set

@JvmStatic
fun main(args: Array<String>) {
Thread.currentThread().priority = Thread.MAX_PRIORITY

SETTINGS = Settings.read() // load settings

CAPTURE_WIDTH = (Screen.WIDTH / SETTINGS.boxWidthDivisor).toInt()
CAPTURE_HEIGHT = (Screen.HEIGHT / SETTINGS.boxHeightDivisor).toInt()

CAPTURE_OFFSET_X = (Screen.WIDTH / 2) - (CAPTURE_WIDTH / 2)
CAPTURE_OFFSET_Y = (Screen.HEIGHT / 2) - (CAPTURE_HEIGHT / 2)
val MAX_SNAP_X = CAPTURE_WIDTH / SETTINGS.maxSnapDivisor
val MAX_SNAP_Y = CAPTURE_HEIGHT / SETTINGS.maxSnapDivisor

CAPTURE_OFFSET_X = (Screen.WIDTH - CAPTURE_WIDTH) / 2
CAPTURE_OFFSET_Y = (Screen.HEIGHT - CAPTURE_HEIGHT) / 2

MOVE_X_MAX = Screen.WIDTH / SETTINGS.maxDistanceDivisor
MOVE_Y_MAX = Screen.HEIGHT / SETTINGS.maxDistanceDivisor
CAPTURE_CENTER_X = CAPTURE_WIDTH / 2
CAPTURE_CENTER_Y = CAPTURE_HEIGHT / 2

FRAME_GRABBER = FFmpegFrameGrabber("title=${HWNDFinder.projectorWindowTitle}").apply {
format = "gdigrab"
frameRate = 60.0
frameRate = SETTINGS.fps
imageWidth = CAPTURE_WIDTH
imageHeight = CAPTURE_HEIGHT

Expand All @@ -78,29 +83,36 @@ object Overwatcheat {
}

FRAME_CONVERTER = Java2DFrameConverter()

CaptureThread.start()
do {
val millis = measureTimeMillis { aimBot() }
if (millis == 0L) Thread.sleep(1)

// give the CPU a break
/*val sleepTime = SETTINGS.sleepMin + FastRandom[SETTINGS.sleepMax - SETTINGS.sleepMin]
if (sleepTime > 0) Thread.sleep(sleepTime.toLong())*/
} while (true)
}

object CaptureThread : Thread() {

@Volatile
var yAxis: Array<IntArray>? = null

override fun run() {
do {
val frame = FRAME_GRABBER.grabFrame(false, true, true, false, false)
val img = FRAME_CONVERTER.convert(frame)
yAxis = img.toRGB(pixels)
} while (true)
Colors.init()

frames@ while (true) {
val frame = FRAME_GRABBER.grabImage()

if (!keyPressed(SETTINGS.aimKey)) continue

val img = FRAME_CONVERTER.convert(frame)
val imgWidth = img.width
val imgHeight = img.height
val pixels = (img.raster.dataBuffer as DataBufferByte).data

y@ for (y in 0..imgHeight - 1) {
val pixelY = imgWidth * y * 3
for (x in 0..imgWidth - 1) {
val pixel = pixelY + (x * 3)
val rgb = (pixels[pixel].toInt() and 0xFF) or // blue
((pixels[pixel + 1].toInt() and 0xFF) shl 8) or // green
((pixels[pixel + 2].toInt() and 0xFF) shl 16) // red
if (!Colors.colorMatches(rgb)) continue

val dX = x - CAPTURE_CENTER_X + X_OFFSET
if (abs(dX) >= MAX_SNAP_X) continue
val dY = y - CAPTURE_CENTER_Y + Y_OFFSET
if (abs(dY) >= MAX_SNAP_Y) continue

Mouse.move((dX / SETTINGS.sensitivity).toInt(), (dY / SETTINGS.sensitivity).toInt())
continue@frames
}
}
}
}

Expand Down
Loading

0 comments on commit 4dfc687

Please sign in to comment.