add versions of clubman and tokyo

This commit is contained in:
Bartek Dobrowolski-Nowakowski
2022-05-05 13:11:53 +02:00
parent b108e53f59
commit 12ab4bdb0c
91 changed files with 30652 additions and 0 deletions

View File

@@ -0,0 +1,211 @@
#include %A_LineFile%\..\CLR.ahk
; Static class, holds ViGEm Client instance
class ViGEmWrapper {
static asm := 0
static client := 0
Init(){
if (this.client == 0){
this.asm := CLR_LoadLibrary(A_LineFile "\..\ViGEmWrapper.dll")
}
}
CreateInstance(cls){
return this.asm.CreateInstance(cls)
}
}
; Base class for ViGEm "Targets" (Controller types - eg xb360 / ds4) to inherit from
class ViGEmTarget {
target := 0
helperClass := ""
controllerClass := ""
__New(){
;~ this.asm := CLR_LoadLibrary(A_LineFile "\..\ViGEmWrapper.dll")
ViGEmWrapper.Init()
this.Instance := ViGEmWrapper.CreateInstance(this.helperClass)
if (this.Instance.OkCheck() != "OK"){
msgbox ViGEmWrapper.dll failed to load!
ExitApp
}
}
SendReport(){
this.Instance.SendReport()
}
SubscribeFeedback(callback){
this.Instance.SubscribeFeedback(callback)
}
}
; DS4 (DualShock 4 for Playstation 4)
class ViGEmDS4 extends ViGEmTarget {
helperClass := "ViGEmWrapper.Ds4"
__New(){
static buttons := {Square: 16, Cross: 32, Circle: 64, Triangle: 128, L1: 256, R1: 512, L2: 1024, R2: 2048
, Share: 4096, Options: 8192, LS: 16384, RS: 32768 }
static specialButtons := {Ps: 1, TouchPad: 2}
static axes := {LX: 2, LY: 3, RX: 4, RY: 5, LT: 0, RT: 1}
this.Buttons := {}
for name, id in buttons {
this.Buttons[name] := new this._ButtonHelper(this, id)
}
for name, id in specialButtons {
this.Buttons[name] := new this._SpecialButtonHelper(this, id)
}
this.Axes := {}
for name, id in axes {
this.Axes[name] := new this._AxisHelper(this, id)
}
this.Dpad := new this._DpadHelper(this)
base.__New()
}
class _ButtonHelper {
__New(parent, id){
this._Parent := parent
this._Id := id
}
SetState(state){
this._Parent.Instance.SetButtonState(this._Id, state)
this._Parent.Instance.SendReport()
return this._Parent
}
}
class _SpecialButtonHelper {
__New(parent, id){
this._Parent := parent
this._Id := id
}
SetState(state){
this._Parent.Instance.SetSpecialButtonState(this._Id, state)
this._Parent.Instance.SendReport()
return this._Parent
}
}
class _AxisHelper {
__New(parent, id){
this._Parent := parent
this._Id := id
}
SetState(state){
this._Parent.Instance.SetAxisState(this._Id, this.ConvertAxis(state))
this._Parent.Instance.SendReport()
return this._Parent
}
ConvertAxis(state){
return round(state * 2.55)
}
}
class _DpadHelper {
__New(parent){
this._Parent := parent
this._Id := id
}
SetState(state){
static dPadDirections := {Up: 0, UpRight: 1, Right: 2, DownRight: 3, Down: 4, DownLeft: 5, Left: 6, UpLeft: 7, None: 8}
this._Parent.Instance.SetDpadState(dPadDirections[state])
this._Parent.Instance.SendReport()
return this._Parent
}
}
}
; Xb360
class ViGEmXb360 extends ViGEmTarget {
helperClass := "ViGEmWrapper.Xb360"
__New(){
static buttons := {A: 4096, B: 8192, X: 16384, Y: 32768, LB: 256, RB: 512, LS: 64, RS: 128, Back: 32, Start: 16, Xbox: 1024}
static axes := {LX: 2, LY: 3, RX: 4, RY: 5, LT: 0, RT: 1}
this.Buttons := {}
for name, id in buttons {
this.Buttons[name] := new this._ButtonHelper(this, id)
}
this.Axes := {}
for name, id in axes {
this.Axes[name] := new this._AxisHelper(this, id)
}
this.Dpad := new this._DpadHelper(this)
base.__New()
}
class _ButtonHelper {
__New(parent, id){
this._Parent := parent
this._Id := id
}
SetState(state){
this._Parent.Instance.SetButtonState(this._Id, state)
this._Parent.Instance.SendReport()
return this._Parent
}
}
class _AxisHelper {
__New(parent, id){
this._Parent := parent
this._id := id
}
SetState(state){
this._Parent.Instance.SetAxisState(this._Id, this.ConvertAxis(state))
this._Parent.Instance.SendReport()
}
ConvertAxis(state){
value := round((state * 655.36) - 32768)
if (value == 32768)
return 32767
return value
}
}
class _DpadHelper {
_DpadStates := {1:0, 8:0, 2:0, 4:0} ; Up, Right, Down, Left
__New(parent){
this._Parent := parent
}
SetState(state){
static dpadDirections := { None: {1:0, 8:0, 2:0, 4:0}
, Up: {1:1, 8:0, 2:0, 4:0}
, UpRight: {1:1, 8:1, 2:0, 4:0}
, Right: {1:0, 8:1, 2:0, 4:0}
, DownRight: {1:0, 8:1, 2:1, 4:0}
, Down: {1:0, 8:0, 2:1, 4:0}
, DownLeft: {1:0, 8:0, 2:1, 4:1}
, Left: {1:0, 8:0, 2:0, 4:1}
, UpLeft: {1:1, 8:0, 2:0, 4:1}}
newStates := dpadDirections[state]
for id, newState in newStates {
oldState := this._DpadStates[id]
if (oldState != newState){
this._DpadStates[id] := newState
this._Parent.Instance.SetButtonState(id, newState)
}
this._Parent.SendReport()
}
}
}
}

View File

@@ -0,0 +1,151 @@
; ==========================================================
; .NET Framework Interop
; https://autohotkey.com/boards/viewtopic.php?t=4633
; ==========================================================
;
; Author: Lexikos
; Version: 1.2
; Requires: AutoHotkey_L v1.0.96+
;
CLR_LoadLibrary(AssemblyName, AppDomain=0)
{
if !AppDomain
AppDomain := CLR_GetDefaultDomain()
e := ComObjError(0)
Loop 1 {
if assembly := AppDomain.Load_2(AssemblyName)
break
static null := ComObject(13,0)
args := ComObjArray(0xC, 1), args[0] := AssemblyName
typeofAssembly := AppDomain.GetType().Assembly.GetType()
if assembly := typeofAssembly.InvokeMember_3("LoadWithPartialName", 0x158, null, null, args)
break
if assembly := typeofAssembly.InvokeMember_3("LoadFrom", 0x158, null, null, args)
break
}
ComObjError(e)
return assembly
}
CLR_CreateObject(Assembly, TypeName, Args*)
{
if !(argCount := Args.MaxIndex())
return Assembly.CreateInstance_2(TypeName, true)
vargs := ComObjArray(0xC, argCount)
Loop % argCount
vargs[A_Index-1] := Args[A_Index]
static Array_Empty := ComObjArray(0xC,0), null := ComObject(13,0)
return Assembly.CreateInstance_3(TypeName, true, 0, null, vargs, null, Array_Empty)
}
CLR_CompileC#(Code, References="", AppDomain=0, FileName="", CompilerOptions="")
{
return CLR_CompileAssembly(Code, References, "System", "Microsoft.CSharp.CSharpCodeProvider", AppDomain, FileName, CompilerOptions)
}
CLR_CompileVB(Code, References="", AppDomain=0, FileName="", CompilerOptions="")
{
return CLR_CompileAssembly(Code, References, "System", "Microsoft.VisualBasic.VBCodeProvider", AppDomain, FileName, CompilerOptions)
}
CLR_StartDomain(ByRef AppDomain, BaseDirectory="")
{
static null := ComObject(13,0)
args := ComObjArray(0xC, 5), args[0] := "", args[2] := BaseDirectory, args[4] := ComObject(0xB,false)
AppDomain := CLR_GetDefaultDomain().GetType().InvokeMember_3("CreateDomain", 0x158, null, null, args)
return A_LastError >= 0
}
CLR_StopDomain(ByRef AppDomain)
{ ; ICorRuntimeHost::UnloadDomain
DllCall("SetLastError", "uint", hr := DllCall(NumGet(NumGet(0+RtHst:=CLR_Start())+20*A_PtrSize), "ptr", RtHst, "ptr", ComObjValue(AppDomain))), AppDomain := ""
return hr >= 0
}
; NOTE: IT IS NOT NECESSARY TO CALL THIS FUNCTION unless you need to load a specific version.
CLR_Start(Version="") ; returns ICorRuntimeHost*
{
static RtHst := 0
; The simple method gives no control over versioning, and seems to load .NET v2 even when v4 is present:
; return RtHst ? RtHst : (RtHst:=COM_CreateObject("CLRMetaData.CorRuntimeHost","{CB2F6722-AB3A-11D2-9C40-00C04FA30A3E}"), DllCall(NumGet(NumGet(RtHst+0)+40),"uint",RtHst))
if RtHst
return RtHst
EnvGet SystemRoot, SystemRoot
if Version =
Loop % SystemRoot "\Microsoft.NET\Framework" (A_PtrSize=8?"64":"") "\*", 2
if (FileExist(A_LoopFileFullPath "\mscorlib.dll") && A_LoopFileName > Version)
Version := A_LoopFileName
if DllCall("mscoree\CorBindToRuntimeEx", "wstr", Version, "ptr", 0, "uint", 0
, "ptr", CLR_GUID(CLSID_CorRuntimeHost, "{CB2F6723-AB3A-11D2-9C40-00C04FA30A3E}")
, "ptr", CLR_GUID(IID_ICorRuntimeHost, "{CB2F6722-AB3A-11D2-9C40-00C04FA30A3E}")
, "ptr*", RtHst) >= 0
DllCall(NumGet(NumGet(RtHst+0)+10*A_PtrSize), "ptr", RtHst) ; Start
return RtHst
}
;
; INTERNAL FUNCTIONS
;
CLR_GetDefaultDomain()
{
static defaultDomain := 0
if !defaultDomain
{ ; ICorRuntimeHost::GetDefaultDomain
if DllCall(NumGet(NumGet(0+RtHst:=CLR_Start())+13*A_PtrSize), "ptr", RtHst, "ptr*", p:=0) >= 0
defaultDomain := ComObject(p), ObjRelease(p)
}
return defaultDomain
}
CLR_CompileAssembly(Code, References, ProviderAssembly, ProviderType, AppDomain=0, FileName="", CompilerOptions="")
{
if !AppDomain
AppDomain := CLR_GetDefaultDomain()
if !(asmProvider := CLR_LoadLibrary(ProviderAssembly, AppDomain))
|| !(codeProvider := asmProvider.CreateInstance(ProviderType))
|| !(codeCompiler := codeProvider.CreateCompiler())
return 0
if !(asmSystem := (ProviderAssembly="System") ? asmProvider : CLR_LoadLibrary("System", AppDomain))
return 0
; Convert | delimited list of references into an array.
StringSplit, Refs, References, |, %A_Space%%A_Tab%
aRefs := ComObjArray(8, Refs0)
Loop % Refs0
aRefs[A_Index-1] := Refs%A_Index%
; Set parameters for compiler.
prms := CLR_CreateObject(asmSystem, "System.CodeDom.Compiler.CompilerParameters", aRefs)
, prms.OutputAssembly := FileName
, prms.GenerateInMemory := FileName=""
, prms.GenerateExecutable := SubStr(FileName,-3)=".exe"
, prms.CompilerOptions := CompilerOptions
, prms.IncludeDebugInformation := true
; Compile!
compilerRes := codeCompiler.CompileAssemblyFromSource(prms, Code)
if error_count := (errors := compilerRes.Errors).Count
{
error_text := ""
Loop % error_count
error_text .= ((e := errors.Item[A_Index-1]).IsWarning ? "Warning " : "Error ") . e.ErrorNumber " on line " e.Line ": " e.ErrorText "`n`n"
MsgBox, 16, Compilation Failed, %error_text%
return 0
}
; Success. Return Assembly object or path.
return compilerRes[FileName="" ? "CompiledAssembly" : "PathToAssembly"]
}
CLR_GUID(ByRef GUID, sGUID)
{
VarSetCapacity(GUID, 16, 0)
return DllCall("ole32\CLSIDFromString", "wstr", sGUID, "ptr", &GUID) >= 0 ? &GUID : ""
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,502 @@
; https://github.com/berban/Gdip
#HotkeyInterval 99000000
#KeyHistory 0
#MaxHotkeysPerInterval 99000000
#NoEnv
#Persistent
#SingleInstance Force
#Include Lib\Gdip.ahk
#Include Lib\AHK-ViGEm-Bus.ahk
CoordMode, Pixel, Client
CoordMode, ToolTip, Client
DetectHiddenWindows, On
ListLines Off
Process, priority, , High
SendMode Input
SetBatchLines, -1
SetDefaultMouseSpeed, 0
SetFormat, Float, 0.2
; SetFormat, IntegerFast, Hex
SetKeyDelay, 50
SetMouseDelay, -1
SetWorkingDir %A_ScriptDir%
; Variables
races_clean := 0
races_clean_percent := 0
races_completed := 0
races_completed_check := 0
credits_total := 0
credits_average := 0
time_start := A_TickCount
time_current := A_TickCount
window_width := 640
window_height := 360
; Create a new controller controller
controller := new ViGEmDS4()
; GUI
Gui, New, -MaximizeBox -Resize, ClubmanPlus 0.5
Gui, Font, S10
Gui, Add, Text, vStatRace, Race Counts: %races_completed%
Gui, Add, Text, vCleanRace, Clean Races: %races_clean%
Gui, Add, Text, vCleanRate, Average Clean Runs: %races_clean_percent%`%
Gui, Add, Text, vEarnings, Earnings: %credits_total%M
Gui, Add, Text, vEarningsRate, Earnings Rate: %credits_average%M/hr
Gui, Add, Button, w150 h40 Default gStart, Start
Gui, Add, Button, w150 h40 x+10 gReset, Reset
Gui, Show
return
; GUI events
GuiClose:
Gosub, Release_All
SetTimer, Health, Off
SetTimer, Summary, Off
OutputDebug % "Clubman> Terminated"
ExitApp
; GUI buttons
Stats:
GuiControl,,StatRace, Race Counts: %races_completed%
GuiControl,,CleanRace, Clean Races: %races_clean%
GuiControl,,CleanRate, Average Clean Runs: %races_clean_percent%`%
GuiControl,,Earnings, Earnings: %credits_total%M
GuiControl,,EarningsRate, Earnings Rate: %credits_average%M/hr
Return
Start:
hwnd := 0
Gosub, Release_All
Gosub, GrabWindow
if (hwnd = 0) {
MsgBox, % "PS Remote Play not found"
return
}
SetTimer, Health, 600000
SetTimer, Summary, 3600000
time_start := A_TickCount
; ** AFK Loop
Gosub, Press_X
Loop {
; ** RACE
OutputDebug % "Clubman> Race: Waiting for position GUI to show"
while (!IsColor(hwnd, 0xFFFFFF, 218, 490, 6, 20)) { ; top-right tire wear indicator
Gosub, Press_X
Sleep, 500
}
OutputDebug % "Clubman> Race: Starting race"
Gosub, Hold_X
; Gosub, Hold_Down
OutputDebug % "Clubman> Race: Racing until position GUI disappears"
while (IsColor(hwnd, 0xFFFFFF, 218, 490, 6, 20)) { ; top-right tire wear indicator
Sleep, 500
}
OutputDebug % "Clubman> Race: Race ended, releasing all buttons"
Gosub, Release_All
; Sleep, 5000
; ** GO TO LEADERBOARDS
OutputDebug % "Clubman> End race: Waiting for continue X icon to show"
while (!IsColor(hwnd, 0xC9C9C9, 465, 519, 6, 20)) { ; X icon
Sleep, 500
}
OutputDebug % "Clubman> End race: Press X to continue"
while (IsColor(hwnd, 0xC9C9C9, 465, 519, 6, 20)) { ; X icon
Gosub, Press_X
Sleep, 100
}
OutputDebug % "Clubman> End race: Transitioning to leaderboard"
; ** LEADERBOARD
Loop {
OutputDebug % "Clubman> Leaderboard: Checking positions"
if (IsColor(hwnd, 0xBADD3E, 671, 124, 10, 20)) { ; venom green on the leaderboard
OutputDebug % "Clubman> Leaderboard: 1st position"
Gosub, Press_X
break
}
else if (IsColor(hwnd, 0xBADD3E, 671, 153, 10, 20)) { ; venom green on the leaderboard
OutputDebug % "Clubman> Leaderboard: 2nd position"
Gosub, Press_X
break
}
else if (IsColor(hwnd, 0xBADD3E, 671, 182, 10, 20)) { ; venom green on the leaderboard
OutputDebug % "Clubman> Leaderboard: 3rd position"
Gosub, Press_X
break
}
else if (IsColor(hwnd, 0xBADD3E, 671, 211, 10, 20)) { ; venom green on the leaderboard
OutputDebug % "Clubman> Leaderboard: 4th position"
Gosub, Press_X
break
}
else if (IsColor(hwnd, 0xBADD3E, 671, 240, 10, 20)) { ; venom green on the leaderboard
OutputDebug % "Clubman> Leaderboard: 5th position"
Gosub, Press_X
break
}
else {
Sleep, 500
}
}
; ** REWARDS
OutputDebug % "Clubman> Rewards: Waiting for Rewards screen to load (checking money earnt)"
while (!IsColor(hwnd, 0xBE140F, 848, 192, 6, 100)) { ; money earn, the red text
Gosub, Press_X
Sleep, 500
}
OutputDebug % "Clubman> Rewards: Found Rewards screen"
races_completed++
Loop 100 {
if (IsColor(hwnd, 0x5C90FB, 451, 260, 10, 20)) { ; the 'R' in Clean Race Bonus
OutputDebug % "Clubman> Rewards: Clean bonus"
races_clean++
PixelSearch(486, 311, 1, hwnd, "clean", "")
break
}
if (A_Index == 100) {
OutputDebug % "Clubman> Rewards: No clean bonus"
PixelSearch(486, 311, 1, hwnd, "no-clean", "")
}
}
; ** REPLAY
OutputDebug % "Clubman> Replay: Waiting for Replay screen to load"
while (!IsColor(hwnd, 0xFFFFFF, 911, 510, 4, 20)) { ; the cursor on top the exit button
Gosub, Press_X
Sleep, 500
}
OutputDebug % "Clubman> Replay: Pressing the Exit button"
while (IsColor(hwnd, 0xFFFFFF, 911, 510, 4, 20)) { ; the cursor on top the exit button
Gosub, Press_X
Sleep, 500
}
OutputDebug % "Clubman> Replay: Leaving the Replay screen"
; ** RACE RESULTS
OutputDebug % "Clubman> Race Result: Waiting for Race Result screen to load (checking cursor)"
while (!IsColor(hwnd, 0xBE1E1C, 651, 497, 4, 20)) { ; the exit button
Sleep, 500
}
OutputDebug % "Clubman> Race Result: Moving cursor to the Retry button"
while (!IsColor(hwnd, 0xFFFFFF, 514, 504, 4, 20)) { ; cursor on top the retry button
Gosub, Press_Right
Sleep, 500
}
OutputDebug % "Clubman> Race Result: Pressing the Retry button"
while (IsColor(hwnd, 0xFFFFFF, 514, 504, 4, 20)) { ; cursor on top the retry button
Gosub, Press_X
Sleep, 500
}
; ** RACE START
OutputDebug % "Clubman> Race Start: Waiting for Race Start screen to load (checking cursor)"
while (!IsColor(hwnd, 0xFFFFFF, 287, 504, 4, 20)) { ; cursor on top the start button
Sleep, 500
}
OutputDebug % "Clubman> Race Start: Pressing the Start button"
while (IsColor(hwnd, 0xFFFFFF, 287, 504, 4, 20)) { ; cursor on top the start button
Gosub, Press_X
Sleep, 500
}
OutputDebug % "--- Summary ---"
credits_total := (races_completed * 0.07 + races_clean * 0.035)
races_clean_percent := (races_clean / races_completed) * 100
time_current := A_TickCount
credits_average := credits_total / (time_current - time_start) * 3600000
Gosub, Stats
OutputDebug % "Clubman> Summary: Races " races_completed
OutputDebug % "Clubman> Summary: Races Clean " races_clean
OutputDebug % "Clubman> Summary: Races Clean Rate " races_clean_percent "%"
OutputDebug % "Clubman> Summary: Earnings " credits_total "M"
OutputDebug % "Clubman> Summary: Earnings Rate " credits_average "M/Hr"
OutputDebug % "---------------"
}
return
Reset:
OutputDebug % "Clubman> Reloading"
Gosub, Release_All
SetTimer, Health, Off
SetTimer, Summary, Off
Reload
return
; -------------------
; Health Check
; -------------------
Health:
FormatTime, current_date,, % "yyMMdd-HHmm-ss"
OutputDebug % "Clubman> Health: Checking health at " current_date
OutputDebug % "Clubman> Health: Races completed " races_completed
OutputDebug % "Clubman> Health: Races completed last time " races_completed_check
if (races_completed_check >= races_completed) {
OutputDebug % "Clubman> Health: Error dectected, sending notification"
SendNotification("ClubmanPlus", "Something went wrong", 2, "persistent")
} else {
OutputDebug % "Clubman> Health: Running healthy"
races_completed_check := races_completed
}
Return
; -------------------
; Summary Check
; -------------------
Summary:
OutputDebug % "Clubman> Summary: Sending summary notification"
message := ""
message := message "Races " races_clean " / " races_completed " (" races_clean_percent ")`n"
message := message "Earnings " credits_total "M (" credits_average "M/Hr)"
SendNotification("ClubmanPlus", message, 0, "cashregister")
Return
; -------------------
; Send Notification
; -------------------
SendNotification(title, message, level, sound) {
IniRead, token, %A_ScriptDir%\clubman.ini, pushover, token
IniRead, user, %A_ScriptDir%\clubman.ini, pushover, user_key
retries := 60
expires := 3600
url := "https://api.pushover.net/1/messages.json"
param := "token=" token "&user=" user "&title=" title "&message=" message "&sound=" sound "&priority=" level
if (level == 2) {
param := param "&retry=" retries "&expire=" expires
}
WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
WebRequest.Open("POST", url)
WebRequest.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
WebRequest.Send(param)
Return
}
; -------------------
; Grab Window
; -------------------
GrabWindow:
OutputDebug % "Clubman> Looking for window"
hwnd := WinExist("PS Remote Play")
if (hwnd > 0) {
OutputDebug % "Clubman> Window found: " hwnd
WinMove, ahk_id %hwnd%,, 0, 0, %window_width%, %window_height%
WinActivate, ahk_id %hwnd%
ControlFocus,, ahk_id %hwnd%
}
return
; -------------------
; Is Color
; -------------------
IsColor(hwnd, target_color, x, y, b, tolerance) {
for i, c in PixelSearch(x, y, b, hwnd) {
if (ColorDistance(c, target_color) <= tolerance) {
Return True
}
}
Return False
}
; -------------------
; Color Distance
; -------------------
ColorDistance( c1, c2 ) {
r1 := c1 >> 16
g1 := c1 >> 8 & 255
b1 := c1 & 255
r2 := c2 >> 16
g2 := c2 >> 8 & 255
b2 := c2 & 255
return Sqrt( (r1-r2)**2 + (g1-g2)**2 + (b1-b2)**2 )
}
; -------------------
; Pixel Search
; -------------------
PixelSearch(x, y, b, hwnd, debugsave := "", debugsavecropped := "") {
x := (960 / x)
y := (540 / y)
VarSetCapacity(rect, 16)
DllCall("GetClientRect", "ptr", hwnd, "ptr", &rect)
x := floor(NumGet(rect, 8, "int") // x)
y := floor(NumGet(rect, 12, "int") // y)
b := floor((b * NumGet(rect, 8, "int")) / 960)
VarSetCapacity(POINT, 8)
NumPut(x, &POINT, 0, "Int")
NumPut(y, &POINT, 4, "Int")
DllCall("user32\ClientToScreen", Ptr, hwnd, Ptr,&POINT)
x := NumGet(&POINT, 0, "Int")
y := NumGet(&POINT, 4, "Int")
pToken := Gdip_Startup()
pBitmap := Gdip_BitmapFromScreen("hwnd:" hwnd)
pixs := []
Loop % b*2 + 1 {
i := (-1 * b) + (A_Index - 1)
Loop % b*2 + 1 {
j := (-1 * b) + (A_Index - 1)
pixs.Push(Gdip_GetPixel(pBitmap, x+i, y+j) & 0x00FFFFFF)
}
}
FormatTime, current_date,, % "yyMMdd-HHmm-ss"
if (debugsave != "") {
Gdip_SaveBitmapToFile(pBitmap, A_ScriptDir . "\" . current_date . "-" . debugsave . ".bmp")
}
if (debugsavecropped != "") {
debugbitmap:=Gdip_CloneBitmapArea(pBitmap, x-b, y-b, b*2, b*2)
Gdip_SaveBitmapToFile(debugbitmap, A_ScriptDir . "\" . current_date . "-" . debugsavecropped . ".bmp")
Gdip_DisposeImage(debugbitmap)
}
Gdip_DisposeImage(pBitmap)
Gdip_Shutdown(pToken)
return pixs
}
; -------------------
; Release All
; -------------------
Release_All:
Gosub, Release_X
Gosub, Release_O
Gosub, Release_Right
Gosub, Release_Left
Gosub, Release_Up
Gosub, Release_Down
return
; -------------------
; Press x
; -------------------
Press_X:
Gosub, Hold_X
Sleep, 50
Gosub, Release_x
return
Hold_X:
controller.Buttons.Cross.SetState(true)
return
Release_X:
controller.Buttons.Cross.SetState(false)
return
; -------------------
; Press O
; -------------------
Press_O:
Gosub, Hold_O
Sleep, 50
Gosub, Release_O
return
Hold_O:
controller.Buttons.Circle.SetState(true)
return
Release_O:
controller.Buttons.Circle.SetState(false)
return
; -------------------
; Press Right
; -------------------
Press_Right:
Gosub, Hold_Right
Sleep, 50
Gosub, Release_Right
return
Hold_Right:
controller.Dpad.SetState("Right")
return
Release_Right:
controller.Dpad.SetState("None")
return
; -------------------
; Press Left
; -------------------
Press_Left:
Gosub, Hold_Left
Sleep, 50
Gosub, Release_Left
return
Hold_Left:
controller.Dpad.SetState("Left")
return
Release_Left:
controller.Dpad.SetState("None")
return
; -------------------
; Press Up
; -------------------
Press_Up:
Gosub, Hold_Up
Sleep, 50
Gosub, Release_Up
return
Hold_Up:
controller.Dpad.SetState("Up")
return
Release_Up:
controller.Dpad.SetState("None")
return
; -------------------
; Press Down
; -------------------
Press_Down:
Gosub, Hold_Down
Sleep, 50
Gosub, Release_Down
return
Hold_Down:
controller.Dpad.SetState("Down")
return
Release_Down:
controller.Dpad.SetState("None")
return
; Hotkeys
^Esc::ExitApp

View File

@@ -0,0 +1,3 @@
[pushover]
user_key=your_key
token=your_token